diff --git a/.gitignore b/.gitignore index bf09378..03496cb 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ *.so build/ __pycache__/ - +Makefile # Random junk *.sw? *.db diff --git a/CMakeLists.txt b/CMakeLists.txt index 2302f89..27b7e4c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,10 +43,11 @@ endif() set(CMAKE_CXX_STANDARD 17) set(PYBIND11_CPP_STANDARD -std=c++17) set(CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} -Wall -Werror -Wextra -Wno-register -Wno-deprecated-declarations -fPIC -march=native") + "${CMAKE_CXX_FLAGS} -g -Werror=unused-function -Wall -Werror -Wextra -Wno-register -fPIC -march=native") set(CMAKE_CXX_FLAGS_RELEASE "-O3") if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) + # set(CMAKE_BUILD_TYPE Debug) # FIXME endif() # Define a convenience function for tests @@ -79,3 +80,7 @@ add_subdirectory( add_subdirectory( src_cpp/elfgames/go ${CMAKE_CURRENT_BINARY_DIR}/elfgames/go) + +add_subdirectory( + src_cpp/elfgames/tasks + ${CMAKE_CURRENT_BINARY_DIR}/elfgames/tasks) diff --git a/Makefile b/Makefile index 378a86d..34d1794 100644 --- a/Makefile +++ b/Makefile @@ -1,32 +1,1472 @@ -.PHONY: all -all: elf elfgames/go +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.9 -.PHONY: clean +# Default target executed when no arguments are given to make. +default_target: all + +.PHONY : default_target + +# Allow only one "make -f Makefile2" at a time, but pass parallelism. +.NOTPARALLEL: + + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + + +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + + +# A target that is always out of date. +cmake_force: + +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /private/home/oteytaud/.conda/envs/otgo13/bin/cmake + +# The command to remove a file. +RM = /private/home/oteytaud/.conda/envs/otgo13/bin/cmake -E remove -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /private/home/oteytaud/newtasksexternal/ELF2 + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /private/home/oteytaud/newtasksexternal/ELF2 + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target install/strip +install/strip: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..." + /private/home/oteytaud/.conda/envs/otgo13/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip + +# Special rule for the target install/strip +install/strip/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..." + /private/home/oteytaud/.conda/envs/otgo13/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip/fast + +# Special rule for the target install +install: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..." + /private/home/oteytaud/.conda/envs/otgo13/bin/cmake -P cmake_install.cmake +.PHONY : install + +# Special rule for the target install +install/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..." + /private/home/oteytaud/.conda/envs/otgo13/bin/cmake -P cmake_install.cmake +.PHONY : install/fast + +# Special rule for the target install/local +install/local: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..." + /private/home/oteytaud/.conda/envs/otgo13/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local + +# Special rule for the target install/local +install/local/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..." + /private/home/oteytaud/.conda/envs/otgo13/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local/fast + +# Special rule for the target list_install_components +list_install_components: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"Unspecified\"" +.PHONY : list_install_components + +# Special rule for the target list_install_components +list_install_components/fast: list_install_components + +.PHONY : list_install_components/fast + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." + /private/home/oteytaud/.conda/envs/otgo13/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache + +.PHONY : edit_cache/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." + /private/home/oteytaud/.conda/envs/otgo13/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache + +.PHONY : rebuild_cache/fast + +# The main all target +all: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /private/home/oteytaud/newtasksexternal/ELF2/CMakeFiles /private/home/oteytaud/newtasksexternal/ELF2/CMakeFiles/progress.marks + $(MAKE) -f CMakeFiles/Makefile2 all + $(CMAKE_COMMAND) -E cmake_progress_start /private/home/oteytaud/newtasksexternal/ELF2/CMakeFiles 0 +.PHONY : all + +# The main clean target clean: - rm -rf build/ + $(MAKE) -f CMakeFiles/Makefile2 clean +.PHONY : clean + +# The main clean target +clean/fast: clean + +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + $(MAKE) -f CMakeFiles/Makefile2 preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + $(MAKE) -f CMakeFiles/Makefile2 preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +#============================================================================= +# Target rules for targets named gmock_main + +# Build rule for target. +gmock_main: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 gmock_main +.PHONY : gmock_main + +# fast build rule for target. +gmock_main/fast: + $(MAKE) -f third_party/googletest/googlemock/CMakeFiles/gmock_main.dir/build.make third_party/googletest/googlemock/CMakeFiles/gmock_main.dir/build +.PHONY : gmock_main/fast + +#============================================================================= +# Target rules for targets named gmock + +# Build rule for target. +gmock: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 gmock +.PHONY : gmock + +# fast build rule for target. +gmock/fast: + $(MAKE) -f third_party/googletest/googlemock/CMakeFiles/gmock.dir/build.make third_party/googletest/googlemock/CMakeFiles/gmock.dir/build +.PHONY : gmock/fast + +#============================================================================= +# Target rules for targets named gtest_main + +# Build rule for target. +gtest_main: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 gtest_main +.PHONY : gtest_main + +# fast build rule for target. +gtest_main/fast: + $(MAKE) -f third_party/googletest/googlemock/gtest/CMakeFiles/gtest_main.dir/build.make third_party/googletest/googlemock/gtest/CMakeFiles/gtest_main.dir/build +.PHONY : gtest_main/fast + +#============================================================================= +# Target rules for targets named gtest + +# Build rule for target. +gtest: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 gtest +.PHONY : gtest + +# fast build rule for target. +gtest/fast: + $(MAKE) -f third_party/googletest/googlemock/gtest/CMakeFiles/gtest.dir/build.make third_party/googletest/googlemock/gtest/CMakeFiles/gtest.dir/build +.PHONY : gtest/fast + +#============================================================================= +# Target rules for targets named ContinuousSubmit + +# Build rule for target. +ContinuousSubmit: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 ContinuousSubmit +.PHONY : ContinuousSubmit + +# fast build rule for target. +ContinuousSubmit/fast: + $(MAKE) -f third_party/json/CMakeFiles/ContinuousSubmit.dir/build.make third_party/json/CMakeFiles/ContinuousSubmit.dir/build +.PHONY : ContinuousSubmit/fast + +#============================================================================= +# Target rules for targets named ContinuousMemCheck + +# Build rule for target. +ContinuousMemCheck: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 ContinuousMemCheck +.PHONY : ContinuousMemCheck + +# fast build rule for target. +ContinuousMemCheck/fast: + $(MAKE) -f third_party/json/CMakeFiles/ContinuousMemCheck.dir/build.make third_party/json/CMakeFiles/ContinuousMemCheck.dir/build +.PHONY : ContinuousMemCheck/fast + +#============================================================================= +# Target rules for targets named ContinuousConfigure + +# Build rule for target. +ContinuousConfigure: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 ContinuousConfigure +.PHONY : ContinuousConfigure + +# fast build rule for target. +ContinuousConfigure/fast: + $(MAKE) -f third_party/json/CMakeFiles/ContinuousConfigure.dir/build.make third_party/json/CMakeFiles/ContinuousConfigure.dir/build +.PHONY : ContinuousConfigure/fast + +#============================================================================= +# Target rules for targets named ExperimentalSubmit + +# Build rule for target. +ExperimentalSubmit: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 ExperimentalSubmit +.PHONY : ExperimentalSubmit + +# fast build rule for target. +ExperimentalSubmit/fast: + $(MAKE) -f third_party/json/CMakeFiles/ExperimentalSubmit.dir/build.make third_party/json/CMakeFiles/ExperimentalSubmit.dir/build +.PHONY : ExperimentalSubmit/fast + +#============================================================================= +# Target rules for targets named ExperimentalMemCheck + +# Build rule for target. +ExperimentalMemCheck: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 ExperimentalMemCheck +.PHONY : ExperimentalMemCheck + +# fast build rule for target. +ExperimentalMemCheck/fast: + $(MAKE) -f third_party/json/CMakeFiles/ExperimentalMemCheck.dir/build.make third_party/json/CMakeFiles/ExperimentalMemCheck.dir/build +.PHONY : ExperimentalMemCheck/fast + +#============================================================================= +# Target rules for targets named ExperimentalTest + +# Build rule for target. +ExperimentalTest: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 ExperimentalTest +.PHONY : ExperimentalTest + +# fast build rule for target. +ExperimentalTest/fast: + $(MAKE) -f third_party/json/CMakeFiles/ExperimentalTest.dir/build.make third_party/json/CMakeFiles/ExperimentalTest.dir/build +.PHONY : ExperimentalTest/fast + +#============================================================================= +# Target rules for targets named ContinuousTest + +# Build rule for target. +ContinuousTest: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 ContinuousTest +.PHONY : ContinuousTest + +# fast build rule for target. +ContinuousTest/fast: + $(MAKE) -f third_party/json/CMakeFiles/ContinuousTest.dir/build.make third_party/json/CMakeFiles/ContinuousTest.dir/build +.PHONY : ContinuousTest/fast + +#============================================================================= +# Target rules for targets named ContinuousUpdate + +# Build rule for target. +ContinuousUpdate: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 ContinuousUpdate +.PHONY : ContinuousUpdate + +# fast build rule for target. +ContinuousUpdate/fast: + $(MAKE) -f third_party/json/CMakeFiles/ContinuousUpdate.dir/build.make third_party/json/CMakeFiles/ContinuousUpdate.dir/build +.PHONY : ContinuousUpdate/fast + +#============================================================================= +# Target rules for targets named ExperimentalBuild + +# Build rule for target. +ExperimentalBuild: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 ExperimentalBuild +.PHONY : ExperimentalBuild + +# fast build rule for target. +ExperimentalBuild/fast: + $(MAKE) -f third_party/json/CMakeFiles/ExperimentalBuild.dir/build.make third_party/json/CMakeFiles/ExperimentalBuild.dir/build +.PHONY : ExperimentalBuild/fast + +#============================================================================= +# Target rules for targets named NightlyMemoryCheck + +# Build rule for target. +NightlyMemoryCheck: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 NightlyMemoryCheck +.PHONY : NightlyMemoryCheck + +# fast build rule for target. +NightlyMemoryCheck/fast: + $(MAKE) -f third_party/json/CMakeFiles/NightlyMemoryCheck.dir/build.make third_party/json/CMakeFiles/NightlyMemoryCheck.dir/build +.PHONY : NightlyMemoryCheck/fast + +#============================================================================= +# Target rules for targets named NightlyBuild + +# Build rule for target. +NightlyBuild: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 NightlyBuild +.PHONY : NightlyBuild + +# fast build rule for target. +NightlyBuild/fast: + $(MAKE) -f third_party/json/CMakeFiles/NightlyBuild.dir/build.make third_party/json/CMakeFiles/NightlyBuild.dir/build +.PHONY : NightlyBuild/fast + +#============================================================================= +# Target rules for targets named ExperimentalUpdate + +# Build rule for target. +ExperimentalUpdate: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 ExperimentalUpdate +.PHONY : ExperimentalUpdate + +# fast build rule for target. +ExperimentalUpdate/fast: + $(MAKE) -f third_party/json/CMakeFiles/ExperimentalUpdate.dir/build.make third_party/json/CMakeFiles/ExperimentalUpdate.dir/build +.PHONY : ExperimentalUpdate/fast + +#============================================================================= +# Target rules for targets named ContinuousBuild + +# Build rule for target. +ContinuousBuild: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 ContinuousBuild +.PHONY : ContinuousBuild + +# fast build rule for target. +ContinuousBuild/fast: + $(MAKE) -f third_party/json/CMakeFiles/ContinuousBuild.dir/build.make third_party/json/CMakeFiles/ContinuousBuild.dir/build +.PHONY : ContinuousBuild/fast + +#============================================================================= +# Target rules for targets named Continuous + +# Build rule for target. +Continuous: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 Continuous +.PHONY : Continuous + +# fast build rule for target. +Continuous/fast: + $(MAKE) -f third_party/json/CMakeFiles/Continuous.dir/build.make third_party/json/CMakeFiles/Continuous.dir/build +.PHONY : Continuous/fast + +#============================================================================= +# Target rules for targets named Experimental + +# Build rule for target. +Experimental: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 Experimental +.PHONY : Experimental + +# fast build rule for target. +Experimental/fast: + $(MAKE) -f third_party/json/CMakeFiles/Experimental.dir/build.make third_party/json/CMakeFiles/Experimental.dir/build +.PHONY : Experimental/fast + +#============================================================================= +# Target rules for targets named ExperimentalConfigure + +# Build rule for target. +ExperimentalConfigure: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 ExperimentalConfigure +.PHONY : ExperimentalConfigure + +# fast build rule for target. +ExperimentalConfigure/fast: + $(MAKE) -f third_party/json/CMakeFiles/ExperimentalConfigure.dir/build.make third_party/json/CMakeFiles/ExperimentalConfigure.dir/build +.PHONY : ExperimentalConfigure/fast + +#============================================================================= +# Target rules for targets named NightlyStart + +# Build rule for target. +NightlyStart: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 NightlyStart +.PHONY : NightlyStart + +# fast build rule for target. +NightlyStart/fast: + $(MAKE) -f third_party/json/CMakeFiles/NightlyStart.dir/build.make third_party/json/CMakeFiles/NightlyStart.dir/build +.PHONY : NightlyStart/fast + +#============================================================================= +# Target rules for targets named NightlyTest + +# Build rule for target. +NightlyTest: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 NightlyTest +.PHONY : NightlyTest + +# fast build rule for target. +NightlyTest/fast: + $(MAKE) -f third_party/json/CMakeFiles/NightlyTest.dir/build.make third_party/json/CMakeFiles/NightlyTest.dir/build +.PHONY : NightlyTest/fast + +#============================================================================= +# Target rules for targets named NightlyUpdate + +# Build rule for target. +NightlyUpdate: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 NightlyUpdate +.PHONY : NightlyUpdate + +# fast build rule for target. +NightlyUpdate/fast: + $(MAKE) -f third_party/json/CMakeFiles/NightlyUpdate.dir/build.make third_party/json/CMakeFiles/NightlyUpdate.dir/build +.PHONY : NightlyUpdate/fast + +#============================================================================= +# Target rules for targets named ContinuousCoverage + +# Build rule for target. +ContinuousCoverage: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 ContinuousCoverage +.PHONY : ContinuousCoverage + +# fast build rule for target. +ContinuousCoverage/fast: + $(MAKE) -f third_party/json/CMakeFiles/ContinuousCoverage.dir/build.make third_party/json/CMakeFiles/ContinuousCoverage.dir/build +.PHONY : ContinuousCoverage/fast + +#============================================================================= +# Target rules for targets named ExperimentalStart + +# Build rule for target. +ExperimentalStart: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 ExperimentalStart +.PHONY : ExperimentalStart + +# fast build rule for target. +ExperimentalStart/fast: + $(MAKE) -f third_party/json/CMakeFiles/ExperimentalStart.dir/build.make third_party/json/CMakeFiles/ExperimentalStart.dir/build +.PHONY : ExperimentalStart/fast + +#============================================================================= +# Target rules for targets named Nightly + +# Build rule for target. +Nightly: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 Nightly +.PHONY : Nightly + +# fast build rule for target. +Nightly/fast: + $(MAKE) -f third_party/json/CMakeFiles/Nightly.dir/build.make third_party/json/CMakeFiles/Nightly.dir/build +.PHONY : Nightly/fast + +#============================================================================= +# Target rules for targets named NightlyConfigure + +# Build rule for target. +NightlyConfigure: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 NightlyConfigure +.PHONY : NightlyConfigure + +# fast build rule for target. +NightlyConfigure/fast: + $(MAKE) -f third_party/json/CMakeFiles/NightlyConfigure.dir/build.make third_party/json/CMakeFiles/NightlyConfigure.dir/build +.PHONY : NightlyConfigure/fast + +#============================================================================= +# Target rules for targets named NightlyCoverage + +# Build rule for target. +NightlyCoverage: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 NightlyCoverage +.PHONY : NightlyCoverage + +# fast build rule for target. +NightlyCoverage/fast: + $(MAKE) -f third_party/json/CMakeFiles/NightlyCoverage.dir/build.make third_party/json/CMakeFiles/NightlyCoverage.dir/build +.PHONY : NightlyCoverage/fast + +#============================================================================= +# Target rules for targets named ExperimentalCoverage + +# Build rule for target. +ExperimentalCoverage: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 ExperimentalCoverage +.PHONY : ExperimentalCoverage + +# fast build rule for target. +ExperimentalCoverage/fast: + $(MAKE) -f third_party/json/CMakeFiles/ExperimentalCoverage.dir/build.make third_party/json/CMakeFiles/ExperimentalCoverage.dir/build +.PHONY : ExperimentalCoverage/fast + +#============================================================================= +# Target rules for targets named NightlyMemCheck + +# Build rule for target. +NightlyMemCheck: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 NightlyMemCheck +.PHONY : NightlyMemCheck + +# fast build rule for target. +NightlyMemCheck/fast: + $(MAKE) -f third_party/json/CMakeFiles/NightlyMemCheck.dir/build.make third_party/json/CMakeFiles/NightlyMemCheck.dir/build +.PHONY : NightlyMemCheck/fast + +#============================================================================= +# Target rules for targets named ContinuousStart + +# Build rule for target. +ContinuousStart: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 ContinuousStart +.PHONY : ContinuousStart + +# fast build rule for target. +ContinuousStart/fast: + $(MAKE) -f third_party/json/CMakeFiles/ContinuousStart.dir/build.make third_party/json/CMakeFiles/ContinuousStart.dir/build +.PHONY : ContinuousStart/fast + +#============================================================================= +# Target rules for targets named NightlySubmit + +# Build rule for target. +NightlySubmit: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 NightlySubmit +.PHONY : NightlySubmit + +# fast build rule for target. +NightlySubmit/fast: + $(MAKE) -f third_party/json/CMakeFiles/NightlySubmit.dir/build.make third_party/json/CMakeFiles/NightlySubmit.dir/build +.PHONY : NightlySubmit/fast + +#============================================================================= +# Target rules for targets named test-wstring + +# Build rule for target. +test-wstring: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-wstring +.PHONY : test-wstring + +# fast build rule for target. +test-wstring/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-wstring.dir/build.make third_party/json/test/CMakeFiles/test-wstring.dir/build +.PHONY : test-wstring/fast + +#============================================================================= +# Target rules for targets named test-unicode + +# Build rule for target. +test-unicode: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-unicode +.PHONY : test-unicode + +# fast build rule for target. +test-unicode/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-unicode.dir/build.make third_party/json/test/CMakeFiles/test-unicode.dir/build +.PHONY : test-unicode/fast + +#============================================================================= +# Target rules for targets named test-udt + +# Build rule for target. +test-udt: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-udt +.PHONY : test-udt + +# fast build rule for target. +test-udt/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-udt.dir/build.make third_party/json/test/CMakeFiles/test-udt.dir/build +.PHONY : test-udt/fast + +#============================================================================= +# Target rules for targets named test-ubjson + +# Build rule for target. +test-ubjson: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-ubjson +.PHONY : test-ubjson + +# fast build rule for target. +test-ubjson/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-ubjson.dir/build.make third_party/json/test/CMakeFiles/test-ubjson.dir/build +.PHONY : test-ubjson/fast + +#============================================================================= +# Target rules for targets named test-to_chars + +# Build rule for target. +test-to_chars: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-to_chars +.PHONY : test-to_chars + +# fast build rule for target. +test-to_chars/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-to_chars.dir/build.make third_party/json/test/CMakeFiles/test-to_chars.dir/build +.PHONY : test-to_chars/fast + +#============================================================================= +# Target rules for targets named test-conversions + +# Build rule for target. +test-conversions: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-conversions +.PHONY : test-conversions + +# fast build rule for target. +test-conversions/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-conversions.dir/build.make third_party/json/test/CMakeFiles/test-conversions.dir/build +.PHONY : test-conversions/fast + +#============================================================================= +# Target rules for targets named test-convenience + +# Build rule for target. +test-convenience: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-convenience +.PHONY : test-convenience + +# fast build rule for target. +test-convenience/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-convenience.dir/build.make third_party/json/test/CMakeFiles/test-convenience.dir/build +.PHONY : test-convenience/fast + +#============================================================================= +# Target rules for targets named test-class_iterator + +# Build rule for target. +test-class_iterator: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-class_iterator +.PHONY : test-class_iterator + +# fast build rule for target. +test-class_iterator/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-class_iterator.dir/build.make third_party/json/test/CMakeFiles/test-class_iterator.dir/build +.PHONY : test-class_iterator/fast + +#============================================================================= +# Target rules for targets named test-class_parser + +# Build rule for target. +test-class_parser: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-class_parser +.PHONY : test-class_parser + +# fast build rule for target. +test-class_parser/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-class_parser.dir/build.make third_party/json/test/CMakeFiles/test-class_parser.dir/build +.PHONY : test-class_parser/fast + +#============================================================================= +# Target rules for targets named test-class_const_iterator + +# Build rule for target. +test-class_const_iterator: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-class_const_iterator +.PHONY : test-class_const_iterator + +# fast build rule for target. +test-class_const_iterator/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-class_const_iterator.dir/build.make third_party/json/test/CMakeFiles/test-class_const_iterator.dir/build +.PHONY : test-class_const_iterator/fast + +#============================================================================= +# Target rules for targets named test-json_patch + +# Build rule for target. +test-json_patch: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-json_patch +.PHONY : test-json_patch + +# fast build rule for target. +test-json_patch/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-json_patch.dir/build.make third_party/json/test/CMakeFiles/test-json_patch.dir/build +.PHONY : test-json_patch/fast + +#============================================================================= +# Target rules for targets named test-noexcept + +# Build rule for target. +test-noexcept: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-noexcept +.PHONY : test-noexcept + +# fast build rule for target. +test-noexcept/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-noexcept.dir/build.make third_party/json/test/CMakeFiles/test-noexcept.dir/build +.PHONY : test-noexcept/fast + +#============================================================================= +# Target rules for targets named test-class_lexer + +# Build rule for target. +test-class_lexer: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-class_lexer +.PHONY : test-class_lexer + +# fast build rule for target. +test-class_lexer/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-class_lexer.dir/build.make third_party/json/test/CMakeFiles/test-class_lexer.dir/build +.PHONY : test-class_lexer/fast + +#============================================================================= +# Target rules for targets named test-concepts + +# Build rule for target. +test-concepts: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-concepts +.PHONY : test-concepts + +# fast build rule for target. +test-concepts/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-concepts.dir/build.make third_party/json/test/CMakeFiles/test-concepts.dir/build +.PHONY : test-concepts/fast + +#============================================================================= +# Target rules for targets named test-testsuites + +# Build rule for target. +test-testsuites: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-testsuites +.PHONY : test-testsuites + +# fast build rule for target. +test-testsuites/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-testsuites.dir/build.make third_party/json/test/CMakeFiles/test-testsuites.dir/build +.PHONY : test-testsuites/fast + +#============================================================================= +# Target rules for targets named test-element_access2 + +# Build rule for target. +test-element_access2: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-element_access2 +.PHONY : test-element_access2 + +# fast build rule for target. +test-element_access2/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-element_access2.dir/build.make third_party/json/test/CMakeFiles/test-element_access2.dir/build +.PHONY : test-element_access2/fast + +#============================================================================= +# Target rules for targets named test-comparison + +# Build rule for target. +test-comparison: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-comparison +.PHONY : test-comparison + +# fast build rule for target. +test-comparison/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-comparison.dir/build.make third_party/json/test/CMakeFiles/test-comparison.dir/build +.PHONY : test-comparison/fast + +#============================================================================= +# Target rules for targets named test-regression + +# Build rule for target. +test-regression: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-regression +.PHONY : test-regression + +# fast build rule for target. +test-regression/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-regression.dir/build.make third_party/json/test/CMakeFiles/test-regression.dir/build +.PHONY : test-regression/fast + +#============================================================================= +# Target rules for targets named catch_main + +# Build rule for target. +catch_main: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 catch_main +.PHONY : catch_main + +# fast build rule for target. +catch_main/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/catch_main.dir/build.make third_party/json/test/CMakeFiles/catch_main.dir/build +.PHONY : catch_main/fast + +#============================================================================= +# Target rules for targets named test-json_pointer + +# Build rule for target. +test-json_pointer: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-json_pointer +.PHONY : test-json_pointer + +# fast build rule for target. +test-json_pointer/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-json_pointer.dir/build.make third_party/json/test/CMakeFiles/test-json_pointer.dir/build +.PHONY : test-json_pointer/fast + +#============================================================================= +# Target rules for targets named test-modifiers + +# Build rule for target. +test-modifiers: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-modifiers +.PHONY : test-modifiers + +# fast build rule for target. +test-modifiers/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-modifiers.dir/build.make third_party/json/test/CMakeFiles/test-modifiers.dir/build +.PHONY : test-modifiers/fast + +#============================================================================= +# Target rules for targets named test-allocator + +# Build rule for target. +test-allocator: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-allocator +.PHONY : test-allocator + +# fast build rule for target. +test-allocator/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-allocator.dir/build.make third_party/json/test/CMakeFiles/test-allocator.dir/build +.PHONY : test-allocator/fast + +#============================================================================= +# Target rules for targets named test-items + +# Build rule for target. +test-items: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-items +.PHONY : test-items + +# fast build rule for target. +test-items/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-items.dir/build.make third_party/json/test/CMakeFiles/test-items.dir/build +.PHONY : test-items/fast + +#============================================================================= +# Target rules for targets named test-algorithms + +# Build rule for target. +test-algorithms: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-algorithms +.PHONY : test-algorithms + +# fast build rule for target. +test-algorithms/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-algorithms.dir/build.make third_party/json/test/CMakeFiles/test-algorithms.dir/build +.PHONY : test-algorithms/fast + +#============================================================================= +# Target rules for targets named test-cbor + +# Build rule for target. +test-cbor: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-cbor +.PHONY : test-cbor + +# fast build rule for target. +test-cbor/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-cbor.dir/build.make third_party/json/test/CMakeFiles/test-cbor.dir/build +.PHONY : test-cbor/fast + +#============================================================================= +# Target rules for targets named test-pointer_access + +# Build rule for target. +test-pointer_access: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-pointer_access +.PHONY : test-pointer_access + +# fast build rule for target. +test-pointer_access/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-pointer_access.dir/build.make third_party/json/test/CMakeFiles/test-pointer_access.dir/build +.PHONY : test-pointer_access/fast + +#============================================================================= +# Target rules for targets named test-constructor2 + +# Build rule for target. +test-constructor2: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-constructor2 +.PHONY : test-constructor2 + +# fast build rule for target. +test-constructor2/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-constructor2.dir/build.make third_party/json/test/CMakeFiles/test-constructor2.dir/build +.PHONY : test-constructor2/fast + +#============================================================================= +# Target rules for targets named test-alt-string + +# Build rule for target. +test-alt-string: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-alt-string +.PHONY : test-alt-string + +# fast build rule for target. +test-alt-string/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-alt-string.dir/build.make third_party/json/test/CMakeFiles/test-alt-string.dir/build +.PHONY : test-alt-string/fast + +#============================================================================= +# Target rules for targets named test-iterators2 + +# Build rule for target. +test-iterators2: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-iterators2 +.PHONY : test-iterators2 + +# fast build rule for target. +test-iterators2/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-iterators2.dir/build.make third_party/json/test/CMakeFiles/test-iterators2.dir/build +.PHONY : test-iterators2/fast + +#============================================================================= +# Target rules for targets named test-capacity + +# Build rule for target. +test-capacity: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-capacity +.PHONY : test-capacity + +# fast build rule for target. +test-capacity/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-capacity.dir/build.make third_party/json/test/CMakeFiles/test-capacity.dir/build +.PHONY : test-capacity/fast + +#============================================================================= +# Target rules for targets named test-constructor1 + +# Build rule for target. +test-constructor1: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-constructor1 +.PHONY : test-constructor1 + +# fast build rule for target. +test-constructor1/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-constructor1.dir/build.make third_party/json/test/CMakeFiles/test-constructor1.dir/build +.PHONY : test-constructor1/fast + +#============================================================================= +# Target rules for targets named test-deserialization + +# Build rule for target. +test-deserialization: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-deserialization +.PHONY : test-deserialization + +# fast build rule for target. +test-deserialization/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-deserialization.dir/build.make third_party/json/test/CMakeFiles/test-deserialization.dir/build +.PHONY : test-deserialization/fast + +#============================================================================= +# Target rules for targets named test-reference_access + +# Build rule for target. +test-reference_access: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-reference_access +.PHONY : test-reference_access + +# fast build rule for target. +test-reference_access/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-reference_access.dir/build.make third_party/json/test/CMakeFiles/test-reference_access.dir/build +.PHONY : test-reference_access/fast + +#============================================================================= +# Target rules for targets named test-element_access1 + +# Build rule for target. +test-element_access1: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-element_access1 +.PHONY : test-element_access1 + +# fast build rule for target. +test-element_access1/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-element_access1.dir/build.make third_party/json/test/CMakeFiles/test-element_access1.dir/build +.PHONY : test-element_access1/fast + +#============================================================================= +# Target rules for targets named test-meta + +# Build rule for target. +test-meta: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-meta +.PHONY : test-meta + +# fast build rule for target. +test-meta/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-meta.dir/build.make third_party/json/test/CMakeFiles/test-meta.dir/build +.PHONY : test-meta/fast + +#============================================================================= +# Target rules for targets named test-inspection + +# Build rule for target. +test-inspection: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-inspection +.PHONY : test-inspection + +# fast build rule for target. +test-inspection/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-inspection.dir/build.make third_party/json/test/CMakeFiles/test-inspection.dir/build +.PHONY : test-inspection/fast + +#============================================================================= +# Target rules for targets named test-readme + +# Build rule for target. +test-readme: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-readme +.PHONY : test-readme + +# fast build rule for target. +test-readme/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-readme.dir/build.make third_party/json/test/CMakeFiles/test-readme.dir/build +.PHONY : test-readme/fast + +#============================================================================= +# Target rules for targets named test-iterators1 + +# Build rule for target. +test-iterators1: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-iterators1 +.PHONY : test-iterators1 + +# fast build rule for target. +test-iterators1/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-iterators1.dir/build.make third_party/json/test/CMakeFiles/test-iterators1.dir/build +.PHONY : test-iterators1/fast + +#============================================================================= +# Target rules for targets named test-merge_patch + +# Build rule for target. +test-merge_patch: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-merge_patch +.PHONY : test-merge_patch + +# fast build rule for target. +test-merge_patch/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-merge_patch.dir/build.make third_party/json/test/CMakeFiles/test-merge_patch.dir/build +.PHONY : test-merge_patch/fast + +#============================================================================= +# Target rules for targets named test-msgpack + +# Build rule for target. +test-msgpack: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-msgpack +.PHONY : test-msgpack + +# fast build rule for target. +test-msgpack/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-msgpack.dir/build.make third_party/json/test/CMakeFiles/test-msgpack.dir/build +.PHONY : test-msgpack/fast + +#============================================================================= +# Target rules for targets named test-serialization + +# Build rule for target. +test-serialization: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test-serialization +.PHONY : test-serialization + +# fast build rule for target. +test-serialization/fast: + $(MAKE) -f third_party/json/test/CMakeFiles/test-serialization.dir/build.make third_party/json/test/CMakeFiles/test-serialization.dir/build +.PHONY : test-serialization/fast + +#============================================================================= +# Target rules for targets named spdlog_headers_for_ide + +# Build rule for target. +spdlog_headers_for_ide: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 spdlog_headers_for_ide +.PHONY : spdlog_headers_for_ide + +# fast build rule for target. +spdlog_headers_for_ide/fast: + $(MAKE) -f third_party/spdlog/CMakeFiles/spdlog_headers_for_ide.dir/build.make third_party/spdlog/CMakeFiles/spdlog_headers_for_ide.dir/build +.PHONY : spdlog_headers_for_ide/fast + +#============================================================================= +# Target rules for targets named spdlog-utests + +# Build rule for target. +spdlog-utests: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 spdlog-utests +.PHONY : spdlog-utests + +# fast build rule for target. +spdlog-utests/fast: + $(MAKE) -f third_party/spdlog/tests/CMakeFiles/spdlog-utests.dir/build.make third_party/spdlog/tests/CMakeFiles/spdlog-utests.dir/build +.PHONY : spdlog-utests/fast + +#============================================================================= +# Target rules for targets named _elf + +# Build rule for target. +_elf: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 _elf +.PHONY : _elf + +# fast build rule for target. +_elf/fast: + $(MAKE) -f elf/CMakeFiles/_elf.dir/build.make elf/CMakeFiles/_elf.dir/build +.PHONY : _elf/fast + +#============================================================================= +# Target rules for targets named elf + +# Build rule for target. +elf: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 elf +.PHONY : elf + +# fast build rule for target. +elf/fast: + $(MAKE) -f elf/CMakeFiles/elf.dir/build.make elf/CMakeFiles/elf.dir/build +.PHONY : elf/fast + +#============================================================================= +# Target rules for targets named test_cpp_elfgames_go_sgf_sgf_test + +# Build rule for target. +test_cpp_elfgames_go_sgf_sgf_test: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test_cpp_elfgames_go_sgf_sgf_test +.PHONY : test_cpp_elfgames_go_sgf_sgf_test + +# fast build rule for target. +test_cpp_elfgames_go_sgf_sgf_test/fast: + $(MAKE) -f elfgames/go/CMakeFiles/test_cpp_elfgames_go_sgf_sgf_test.dir/build.make elfgames/go/CMakeFiles/test_cpp_elfgames_go_sgf_sgf_test.dir/build +.PHONY : test_cpp_elfgames_go_sgf_sgf_test/fast + +#============================================================================= +# Target rules for targets named test_cpp_elfgames_go_base_test_symmetry_test + +# Build rule for target. +test_cpp_elfgames_go_base_test_symmetry_test: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test_cpp_elfgames_go_base_test_symmetry_test +.PHONY : test_cpp_elfgames_go_base_test_symmetry_test + +# fast build rule for target. +test_cpp_elfgames_go_base_test_symmetry_test/fast: + $(MAKE) -f elfgames/go/CMakeFiles/test_cpp_elfgames_go_base_test_symmetry_test.dir/build.make elfgames/go/CMakeFiles/test_cpp_elfgames_go_base_test_symmetry_test.dir/build +.PHONY : test_cpp_elfgames_go_base_test_symmetry_test/fast + +#============================================================================= +# Target rules for targets named test_cpp_elfgames_go_base_test_go_test + +# Build rule for target. +test_cpp_elfgames_go_base_test_go_test: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test_cpp_elfgames_go_base_test_go_test +.PHONY : test_cpp_elfgames_go_base_test_go_test + +# fast build rule for target. +test_cpp_elfgames_go_base_test_go_test/fast: + $(MAKE) -f elfgames/go/CMakeFiles/test_cpp_elfgames_go_base_test_go_test.dir/build.make elfgames/go/CMakeFiles/test_cpp_elfgames_go_base_test_go_test.dir/build +.PHONY : test_cpp_elfgames_go_base_test_go_test/fast + +#============================================================================= +# Target rules for targets named elfgames_go_inference + +# Build rule for target. +elfgames_go_inference: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 elfgames_go_inference +.PHONY : elfgames_go_inference + +# fast build rule for target. +elfgames_go_inference/fast: + $(MAKE) -f elfgames/go/CMakeFiles/elfgames_go_inference.dir/build.make elfgames/go/CMakeFiles/elfgames_go_inference.dir/build +.PHONY : elfgames_go_inference/fast + +#============================================================================= +# Target rules for targets named _elfgames_go + +# Build rule for target. +_elfgames_go: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 _elfgames_go +.PHONY : _elfgames_go + +# fast build rule for target. +_elfgames_go/fast: + $(MAKE) -f elfgames/go/CMakeFiles/_elfgames_go.dir/build.make elfgames/go/CMakeFiles/_elfgames_go.dir/build +.PHONY : _elfgames_go/fast + +#============================================================================= +# Target rules for targets named test_cpp_elfgames_go_base_test_board_feature_test + +# Build rule for target. +test_cpp_elfgames_go_base_test_board_feature_test: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test_cpp_elfgames_go_base_test_board_feature_test +.PHONY : test_cpp_elfgames_go_base_test_board_feature_test + +# fast build rule for target. +test_cpp_elfgames_go_base_test_board_feature_test/fast: + $(MAKE) -f elfgames/go/CMakeFiles/test_cpp_elfgames_go_base_test_board_feature_test.dir/build.make elfgames/go/CMakeFiles/test_cpp_elfgames_go_base_test_board_feature_test.dir/build +.PHONY : test_cpp_elfgames_go_base_test_board_feature_test/fast + +#============================================================================= +# Target rules for targets named elfgames_go + +# Build rule for target. +elfgames_go: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 elfgames_go +.PHONY : elfgames_go + +# fast build rule for target. +elfgames_go/fast: + $(MAKE) -f elfgames/go/CMakeFiles/elfgames_go.dir/build.make elfgames/go/CMakeFiles/elfgames_go.dir/build +.PHONY : elfgames_go/fast + +#============================================================================= +# Target rules for targets named test_cpp_elfgames_go_base_test_coord_test + +# Build rule for target. +test_cpp_elfgames_go_base_test_coord_test: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 test_cpp_elfgames_go_base_test_coord_test +.PHONY : test_cpp_elfgames_go_base_test_coord_test + +# fast build rule for target. +test_cpp_elfgames_go_base_test_coord_test/fast: + $(MAKE) -f elfgames/go/CMakeFiles/test_cpp_elfgames_go_base_test_coord_test.dir/build.make elfgames/go/CMakeFiles/test_cpp_elfgames_go_base_test_coord_test.dir/build +.PHONY : test_cpp_elfgames_go_base_test_coord_test/fast + +#============================================================================= +# Target rules for targets named elfgames_go9 + +# Build rule for target. +elfgames_go9: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 elfgames_go9 +.PHONY : elfgames_go9 + +# fast build rule for target. +elfgames_go9/fast: + $(MAKE) -f elfgames/go/CMakeFiles/elfgames_go9.dir/build.make elfgames/go/CMakeFiles/elfgames_go9.dir/build +.PHONY : elfgames_go9/fast + +#============================================================================= +# Target rules for targets named _elfgames_go_inference + +# Build rule for target. +_elfgames_go_inference: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 _elfgames_go_inference +.PHONY : _elfgames_go_inference + +# fast build rule for target. +_elfgames_go_inference/fast: + $(MAKE) -f elfgames/go/CMakeFiles/_elfgames_go_inference.dir/build.make elfgames/go/CMakeFiles/_elfgames_go_inference.dir/build +.PHONY : _elfgames_go_inference/fast + +#============================================================================= +# Target rules for targets named elfgames_tasks_inference + +# Build rule for target. +elfgames_tasks_inference: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 elfgames_tasks_inference +.PHONY : elfgames_tasks_inference + +# fast build rule for target. +elfgames_tasks_inference/fast: + $(MAKE) -f elfgames/tasks/CMakeFiles/elfgames_tasks_inference.dir/build.make elfgames/tasks/CMakeFiles/elfgames_tasks_inference.dir/build +.PHONY : elfgames_tasks_inference/fast + +#============================================================================= +# Target rules for targets named elfgames_tasks9 + +# Build rule for target. +elfgames_tasks9: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 elfgames_tasks9 +.PHONY : elfgames_tasks9 + +# fast build rule for target. +elfgames_tasks9/fast: + $(MAKE) -f elfgames/tasks/CMakeFiles/elfgames_tasks9.dir/build.make elfgames/tasks/CMakeFiles/elfgames_tasks9.dir/build +.PHONY : elfgames_tasks9/fast + +#============================================================================= +# Target rules for targets named _elfgames_tasks + +# Build rule for target. +_elfgames_tasks: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 _elfgames_tasks +.PHONY : _elfgames_tasks + +# fast build rule for target. +_elfgames_tasks/fast: + $(MAKE) -f elfgames/tasks/CMakeFiles/_elfgames_tasks.dir/build.make elfgames/tasks/CMakeFiles/_elfgames_tasks.dir/build +.PHONY : _elfgames_tasks/fast + +#============================================================================= +# Target rules for targets named elfgames_tasks + +# Build rule for target. +elfgames_tasks: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 elfgames_tasks +.PHONY : elfgames_tasks + +# fast build rule for target. +elfgames_tasks/fast: + $(MAKE) -f elfgames/tasks/CMakeFiles/elfgames_tasks.dir/build.make elfgames/tasks/CMakeFiles/elfgames_tasks.dir/build +.PHONY : elfgames_tasks/fast + +#============================================================================= +# Target rules for targets named _elfgames_tasks_inference + +# Build rule for target. +_elfgames_tasks_inference: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 _elfgames_tasks_inference +.PHONY : _elfgames_tasks_inference -.PHONY: test -test: test_cpp +# fast build rule for target. +_elfgames_tasks_inference/fast: + $(MAKE) -f elfgames/tasks/CMakeFiles/_elfgames_tasks_inference.dir/build.make elfgames/tasks/CMakeFiles/_elfgames_tasks_inference.dir/build +.PHONY : _elfgames_tasks_inference/fast -.PHONY: test_cpp -test_cpp: test_cpp_elf test_cpp_elfgames_go +# Help Target +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... install/strip" + @echo "... install" + @echo "... install/local" + @echo "... list_install_components" + @echo "... edit_cache" + @echo "... rebuild_cache" + @echo "... gmock_main" + @echo "... gmock" + @echo "... gtest_main" + @echo "... gtest" + @echo "... ContinuousSubmit" + @echo "... ContinuousMemCheck" + @echo "... ContinuousConfigure" + @echo "... ExperimentalSubmit" + @echo "... ExperimentalMemCheck" + @echo "... ExperimentalTest" + @echo "... ContinuousTest" + @echo "... ContinuousUpdate" + @echo "... ExperimentalBuild" + @echo "... NightlyMemoryCheck" + @echo "... NightlyBuild" + @echo "... ExperimentalUpdate" + @echo "... ContinuousBuild" + @echo "... Continuous" + @echo "... Experimental" + @echo "... ExperimentalConfigure" + @echo "... NightlyStart" + @echo "... NightlyTest" + @echo "... NightlyUpdate" + @echo "... ContinuousCoverage" + @echo "... ExperimentalStart" + @echo "... Nightly" + @echo "... NightlyConfigure" + @echo "... NightlyCoverage" + @echo "... ExperimentalCoverage" + @echo "... NightlyMemCheck" + @echo "... ContinuousStart" + @echo "... NightlySubmit" + @echo "... test-wstring" + @echo "... test-unicode" + @echo "... test-udt" + @echo "... test-ubjson" + @echo "... test-to_chars" + @echo "... test-conversions" + @echo "... test-convenience" + @echo "... test-class_iterator" + @echo "... test-class_parser" + @echo "... test-class_const_iterator" + @echo "... test-json_patch" + @echo "... test-noexcept" + @echo "... test-class_lexer" + @echo "... test-concepts" + @echo "... test-testsuites" + @echo "... test-element_access2" + @echo "... test-comparison" + @echo "... test-regression" + @echo "... catch_main" + @echo "... test-json_pointer" + @echo "... test-modifiers" + @echo "... test-allocator" + @echo "... test-items" + @echo "... test-algorithms" + @echo "... test-cbor" + @echo "... test-pointer_access" + @echo "... test-constructor2" + @echo "... test-alt-string" + @echo "... test-iterators2" + @echo "... test-capacity" + @echo "... test-constructor1" + @echo "... test-deserialization" + @echo "... test-reference_access" + @echo "... test-element_access1" + @echo "... test-meta" + @echo "... test-inspection" + @echo "... test-readme" + @echo "... test-iterators1" + @echo "... test-merge_patch" + @echo "... test-msgpack" + @echo "... test-serialization" + @echo "... spdlog_headers_for_ide" + @echo "... spdlog-utests" + @echo "... _elf" + @echo "... elf" + @echo "... test_cpp_elfgames_go_sgf_sgf_test" + @echo "... test_cpp_elfgames_go_base_test_symmetry_test" + @echo "... test_cpp_elfgames_go_base_test_go_test" + @echo "... elfgames_go_inference" + @echo "... _elfgames_go" + @echo "... test_cpp_elfgames_go_base_test_board_feature_test" + @echo "... elfgames_go" + @echo "... test_cpp_elfgames_go_base_test_coord_test" + @echo "... elfgames_go9" + @echo "... _elfgames_go_inference" + @echo "... elfgames_tasks_inference" + @echo "... elfgames_tasks9" + @echo "... _elfgames_tasks" + @echo "... elfgames_tasks" + @echo "... _elfgames_tasks_inference" +.PHONY : help -build/Makefile: CMakeLists.txt */CMakeLists.txt - mkdir -p build - (cd build && cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..) -.PHONY: elf -elf: build/Makefile - (cd build && cmake --build elf -- -j) -.PHONY: test_cpp_elf -test_cpp_elf: - (cd build/elf && GTEST_COLOR=1 ctest --output-on-failure) +#============================================================================= +# Special targets to cleanup operation of make. -.PHONY: test_cpp_elfgames_go -test_cpp_elfgames_go: - (cd build/elfgames/go && GTEST_COLOR=1 ctest --output-on-failure) +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system -.PHONY: elfgames/go -elfgames/go: build/Makefile - (cd build && cmake --build elfgames/go -- -j) diff --git a/Makefile.basic b/Makefile.basic new file mode 100644 index 0000000..44f2996 --- /dev/null +++ b/Makefile.basic @@ -0,0 +1,32 @@ +.PHONY: all +all: elf elfgames/go elfgames/tasks + +.PHONY: clean +clean: + rm -rf build/ + +.PHONY: test +test: test_cpp + +.PHONY: test_cpp +test_cpp: test_cpp_elf test_cpp_elfgames_go + +build/Makefile: CMakeLists.txt */CMakeLists.txt + mkdir -p build + (cd build && cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..) + +.PHONY: elf +elf: build/Makefile + (cd build && cmake --build elf -- -j) + +.PHONY: test_cpp_elf +test_cpp_elf: + (cd build/elf && GTEST_COLOR=1 ctest --output-on-failure) + +.PHONY: test_cpp_elfgames_go +test_cpp_elfgames_go: + (cd build/elfgames/go && GTEST_COLOR=1 ctest --output-on-failure) + +.PHONY: elfgames/go +elfgames/go: build/Makefile + (cd build && cmake --build elfgames/go -- -j) diff --git a/allkill.sh b/allkill.sh new file mode 100755 index 0000000..059f66d --- /dev/null +++ b/allkill.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# Killing server. +pid=`ps -ef | grep -i train.py | grep batchsize | grep num_games | grep selfplay_async | cut -c 9-16` +if [ -z "$pid" ] +then + echo no such process +else + echo process $pid + kill -15 $pid +fi +# Killing checkers.. +pid=`ps -ef | grep -i check_mini | cut -c 9-16` +if [ -z "$pid" ] +then + echo no such process +else + echo process $pid + kill -15 $pid +fi + +# Killing clients. +pid=`ps -ef | grep -i selfplay.py | grep batchsize | cut -c 9-16` +if [ -z "$pid" ] +then + echo no such process +else + echo process $pid + kill -15 $pid +fi + diff --git a/allmake.sh b/allmake.sh new file mode 100755 index 0000000..d67a2fb --- /dev/null +++ b/allmake.sh @@ -0,0 +1,11 @@ +rm CMakeCache.txt + +module load anaconda3 +module load gcc/7.1.0 +module load cuda/9.0 +module load cudnn/v7.0-cuda.9.0 +source activate otgo12 +conda install -y numpy zeromq pyzmq +conda install -y -c pytorch pytorch cuda90 +find . -iname 'flags.make' -exec sed -i "s/std=c++14/std=c++17/g" {} \; +make -j diff --git a/alltest.sh b/alltest.sh new file mode 100755 index 0000000..effccb9 --- /dev/null +++ b/alltest.sh @@ -0,0 +1,31 @@ +#!/bin/bash + + +#module load anaconda3 +#module load cuda/9.0 +#module load cudnn/v7.0-cuda.9.0 +#source activate otgo12 +#conda install numpy zeromq pyzmq +#conda install -c pytorch pytorch cuda90 + +./allkill.sh + +sleep 1 +set -e -x +make -j + +# Launch the server. +./letustest.sh +#sleep 1 + +# Below, once per client: this launches something for checking how much we win against the baseline. +#./letustest_check.sh & + +#sleep 1 +./letustest_client.sh & + +#sleep 90 + +#./allkill.sh +wait + diff --git a/checkwinner.sh b/checkwinner.sh new file mode 100755 index 0000000..e9fb561 --- /dev/null +++ b/checkwinner.sh @@ -0,0 +1 @@ +egrep --text -i won *dgacheck*log* | sed 's/black.*black/0/g' | sed 's/white.*white/0/g' | sed 's/black.*white/1/g' | sed 's/white.*black/1/g' | sed 's/won//g' | sort | uniq -c diff --git a/diff.sh b/diff.sh new file mode 100755 index 0000000..e8bc685 --- /dev/null +++ b/diff.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +ROOTDIR=`git rev-parse --show-toplevel` +cd $ROOTDIR/src_cpp/elfgames/tasks +find . \( -iname '*.cc' -o -iname '*.h' -o -iname '*.py' \) -exec echo -n {} \; -exec diff {} `echo {} | sed 's/^/..\/go\//g'` \; 2>&1 | grep -iv codingenv + + + diff --git a/differentiator_go_tasks.sh b/differentiator_go_tasks.sh new file mode 100755 index 0000000..5f644d9 --- /dev/null +++ b/differentiator_go_tasks.sh @@ -0,0 +1,25 @@ +#!/bin/bash + + +list=`find . -iname 'tasks' ` + +for d in $list +do + files=`find $d \( -iname '*.py' -o -iname '*.h' -o -iname '*.cc' \) | grep -v test` + for f in $files + do + of=`echo $f | sed 's/\/tasks/\/go/g'` + if [ -f $of ]; then + cp -f $f /tmp/yo + sed -i 's/tasks/go/g' /tmp/yo + sed -i 's/ChouFleur/Go/g' /tmp/yo + numdiffs=`diff /tmp/yo $of | wc -l ` + if [ "$numdiffs" -ne "0" ] + then + echo "$f": $numdiffs "=====================================" + diff /tmp/yo $of + + fi + fi + done +done diff --git a/edit.sh b/edit.sh new file mode 100755 index 0000000..afff31b --- /dev/null +++ b/edit.sh @@ -0,0 +1,16 @@ +#!/bin/bash +ROOTDIR=`git rev-parse --show-toplevel` + +# Find a file with name $1 and edit it (first pass: only with tasks in the path) +for i in `find ${ROOTDIR}/ -iname $1 | grep "\/task"` +do +echo $i +vim $i +done +# Find a file with name $1 and edit it (second pass) +for i in `find ${ROOTDIR}/ -iname $1 | grep -v "\/task"` +do +echo $i +vim $i +done +find ~/newtasks -iname $1 diff --git a/find.sh b/find.sh new file mode 100755 index 0000000..7c9e92c --- /dev/null +++ b/find.sh @@ -0,0 +1,3 @@ +ROOTDIR=`git rev-parse --show-toplevel` +find $ROOTDIR \( -name '*.txt' -o -name '*.sh' -o -name '*.py' -o -name '*.cc' -o -name '*.h' \) -not -path "*codingenv*" -not -path "*third_party*" -exec grep -H "$1" {} \; +#find ~/newtasks -name "third_party" -prune \( -name '*.txt' -o -name '*.sh' -o -name '*.py' -o -name '*.cc' -o -name '*.h' \) -exec grep -iH "$1" {} \; diff --git a/fromscratchcompile.sh b/fromscratchcompile.sh new file mode 100644 index 0000000..0ec9a34 --- /dev/null +++ b/fromscratchcompile.sh @@ -0,0 +1,15 @@ +source scripts/devmode_set_pythonpath.sh +rm CMakeCache.txt +module load anaconda3 +module load gcc/7.1.0 +source scripts/devmode_set_pythonpath.sh +conda create --name otgo13 --clone /private/home/ssengupta/.conda/envs/go10 +source activate otgo13 +conda install numpy zeromq pyzmq +conda install -c pytorch pytorch cuda90 +source scripts/devmode_set_pythonpath.sh +#git clone https://github.com/pytorch/ELF.git . --recursive +git submodule sync && git submodule update --init --recursive +source scripts/devmode_set_pythonpath.sh +make +make test diff --git a/goletustest.sh b/goletustest.sh new file mode 100755 index 0000000..b7ca7e4 --- /dev/null +++ b/goletustest.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +module load anaconda3 +set -e -x +ROOTDIR=`git rev-parse --show-toplevel` +cd $ROOTDIR +source scripts/devmode_set_pythonpath.sh +PYTHONPATH=$PYTHONPATH:$ROOTDIR/elf/:$ROOTDIR/:$ROOTDIR/build/:$ROOTDIR/src_cpp/:$ROOTDIR/build/elfgames/go:$ROOTDIR/build/elfgames/go/:$ROOTDIR:$ROOTDIR/elfgames/go/ +source activate /private/home/ssengupta/.conda/envs/go10 +#git submodule sync && git submodule update --init --recursive + +pid=`ps -ef | grep -i train.py | grep batchsize | grep num_games | grep selfplay_async | cut -c 9-16` +if [ -z "$pid" ] +then + echo no such process +else + echo process $pid + kill -15 $pid +fi +make -j 2>&1 | grep -i20 error | head -n 37 + +cd scripts/elfgames/go +touch log.log +rm log.log +./start_server.sh +sleep 5 +#${ROOTDIR}/viewserverlog.sh +cat log.log diff --git a/goletustest_client.sh b/goletustest_client.sh new file mode 100755 index 0000000..5f3c1e5 --- /dev/null +++ b/goletustest_client.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +module load anaconda3 +ROOTDIR=`git rev-parse --show-toplevel` +cd $ROOTDIR +source scripts/devmode_set_pythonpath.sh +#/private/home/oteytaud/newgo/src_py/:/private/home/oteytaud/newgo/build/elf/:/private/home/oteytaud/newgo/build/elfgames/go/:/private/home/oteytaud/newgo/src_py/:/private/home/oteytaud/newgo/build/elf/:/private/home/oteytaud/newgo/build/elfgames/go/: +PYTHONPATH=$PYTHONPATH:$ROOTDIR/elf/:$ROOTDIR/:$ROOTDIR/build/:$ROOTDIR/src_cpp/:$ROOTDIR/build/elfgames/go:$ROOTDIR/build/elfgames/go/:$ROOTDIR:$ROOTDIR/elfgames/go/ +source activate /private/home/ssengupta/.conda/envs/go10 +#git submodule sync && git submodule update --init --recursive + +pid=`ps -ef | grep -i selfplay.py | grep batchsize | cut -c 9-16` +if [ -z "$pid" ] +then + echo no such process +else + echo process $pid + kill -15 $pid +fi +make -j 2>&1 | grep -i20 error | head -n 37 + +cd scripts/elfgames/go +#rm log.log +./start_client.sh diff --git a/goviewserverlog.sh b/goviewserverlog.sh new file mode 100755 index 0000000..e3b62c4 --- /dev/null +++ b/goviewserverlog.sh @@ -0,0 +1 @@ +tail -n 30 scripts/elfgames/tasks/log.log diff --git a/internalfulldiff.sh b/internalfulldiff.sh new file mode 100755 index 0000000..5129258 --- /dev/null +++ b/internalfulldiff.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +for i in cc h +do + for f in `find . -iname "*.$i" | grep -v third_par` + do + g=`echo $f | sed 's/^\./\/private\/home\/oteytaud\/newtasks/g'` + numdifs=`diff $f $g | wc -l` + if [ "$numdifs" -ne "0" ]; + then + echo $f: $numdifs + fi + done +done diff --git a/letustest.sh b/letustest.sh new file mode 100755 index 0000000..8f49729 --- /dev/null +++ b/letustest.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +touch ./scripts/elfgames/tasks/myserver/latest0 ./scripts/elfgames/tasks/myserver/toto.bin +rm ./scripts/elfgames/tasks/myserver/latest0 +rm ./scripts/elfgames/tasks/myserver/*.bin +#module load anaconda3 +set -e -x +ROOTDIR=`git rev-parse --show-toplevel` +cd $ROOTDIR +source scripts/devmode_set_pythonpath.sh +PYTHONPATH=$PYTHONPATH:$ROOTDIR/elf/:$ROOTDIR/:$ROOTDIR/build/:$ROOTDIR/src_cpp/:$ROOTDIR/build/elfgames/tasks:$ROOTDIR/build/elfgames/tasks/:$ROOTDIR:$ROOTDIR/elfgames/tasks/ +#source activate /private/home/ssengupta/.conda/envs/go10 +#source activate otgo12 +#git submodule sync && git submodule update --init --recursive + +#make -j 2>&1 | grep -i20 error | head -n 37 + +cd scripts/elfgames/tasks + +./start_server_mini.sh +#sleep 5 +#${ROOTDIR}/viewserverlog.sh +sleep 1 +cat ../../../log.log diff --git a/letustest_check.sh b/letustest_check.sh new file mode 100755 index 0000000..3fb0bf2 --- /dev/null +++ b/letustest_check.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +set -e -x +#touch ./scripts/elfgames/tasks/myserver/latest0 ./scripts/elfgames/tasks/myserver/toto.bin +#rm ./scripts/elfgames/tasks/myserver/latest0 +#rm ./scripts/elfgames/tasks/myserver/*.bin + +#module load anaconda3 +ROOTDIR=`git rev-parse --show-toplevel` +cd $ROOTDIR +source scripts/devmode_set_pythonpath.sh +#/private/home/oteytaud/newtasks/src_py/:/private/home/oteytaud/newtasks/build/elf/:/private/home/oteytaud/newtasks/build/elfgames/go/:/private/home/oteytaud/newtasks/src_py/:/private/home/oteytaud/newtasks/build/elf/:/private/home/oteytaud/newtasks/build/elfgames/go/: +PYTHONPATH=$PYTHONPATH:$ROOTDIR/elf/:$ROOTDIR/:$ROOTDIR/build/:$ROOTDIR/src_cpp/:$ROOTDIR/build/elfgames/tasks:$ROOTDIR/build/elfgames/tasks/:$ROOTDIR:$ROOTDIR/elfgames/tasks/ +#source activate /private/home/ssengupta/.conda/envs/go10 +#source activate otgo12 +#git submodule sync && git submodule update --init --recursive + +#pid=`ps -ef | grep -i selfplay.py | grep batchsize | cut -c 9-16` +#if [ -z "$pid" ] +#then +# echo no such process +#else +# echo process $pid +# kill -15 $pid +#fi +#make -j 2>&1 | grep -i20 error | head -n 37 + +pushd scripts/elfgames/tasks +#rm log.log +(stdbuf -o 0 -i 0 ./start_check_mini.sh 2>&1 | stdbuf -o 0 -i 0 tee ${ROOTDIR}/checklogs 2>&1 ) || true +popd + +echo We have finished! +#./viewchecklog.sh +tail -n 50 checklogs diff --git a/letustest_client.sh b/letustest_client.sh new file mode 100755 index 0000000..e56cb42 --- /dev/null +++ b/letustest_client.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +set -e -x +#touch ./scripts/elfgames/tasks/myserver/latest0 ./scripts/elfgames/tasks/myserver/toto.bin +#rm ./scripts/elfgames/tasks/myserver/latest0 +#rm ./scripts/elfgames/tasks/myserver/*.bin + +#module load anaconda3 +ROOTDIR=`git rev-parse --show-toplevel` +cd $ROOTDIR +source scripts/devmode_set_pythonpath.sh +#/private/home/oteytaud/newtasks/src_py/:/private/home/oteytaud/newtasks/build/elf/:/private/home/oteytaud/newtasks/build/elfgames/go/:/private/home/oteytaud/newtasks/src_py/:/private/home/oteytaud/newtasks/build/elf/:/private/home/oteytaud/newtasks/build/elfgames/go/: +PYTHONPATH=$PYTHONPATH:$ROOTDIR/elf/:$ROOTDIR/:$ROOTDIR/build/:$ROOTDIR/src_cpp/:$ROOTDIR/build/elfgames/tasks:$ROOTDIR/build/elfgames/tasks/:$ROOTDIR:$ROOTDIR/elfgames/tasks/ +#source activate /private/home/ssengupta/.conda/envs/go10 +#source activate otgo12 +#git submodule sync && git submodule update --init --recursive + +#make -j 2>&1 | grep -i20 error | head -n 37 + +cd scripts/elfgames/tasks +#rm log.log +stdbuf -o 0 -i 0 ./start_client_mini.sh 2>&1 | stdbuf -o 0 -i 0 tee $ROOTDIR/clientlogs 2>&1 diff --git a/manyedit.sh b/manyedit.sh new file mode 100755 index 0000000..eb7555f --- /dev/null +++ b/manyedit.sh @@ -0,0 +1,10 @@ +#!/bin/bash + + +ROOTDIR=`git rev-parse --show-toplevel` +for u in `find ${ROOTDIR} \( -name '*.txt' -o -name '*.sh' -o -name '*.py' -o -name '*.cc' -o -name '*.h' \) -not -path "*codingenv*" -not -path "*third_party*" -exec grep -iH "$1" {} \; | sed 's/:.*//g' | sort | uniq` +do + vim $u + sleep 1 +done +#find ~/newtasks -name "third_party" -prune \( -name '*.txt' -o -name '*.sh' -o -name '*.py' -o -name '*.cc' -o -name '*.h' \) -exec grep -iH "$1" {} \; diff --git a/plotwinrate.sh b/plotwinrate.sh new file mode 100755 index 0000000..5b7b8bf --- /dev/null +++ b/plotwinrate.sh @@ -0,0 +1,25 @@ + + +#num=`grep "^OTGChouFleur.ApplyAction[0-3]$" clientlogs | wc -l ` +num=`grep resigned.at clientlogs | wc -l` +echo $num games +skip=$(( 1 + ( ($num - 10 ) / 15 ) )) +for n in `seq 10 $skip $num` +do +#echo $n games +w=`grep resigned.at clientlogs | head -n $n |tail -n $skip | grep black| wc -l` +l=`grep resigned.at clientlogs | head -n $n | tail -n $skip |grep white |wc -l` +#w=`grep "^OTGChouFleur.ApplyAction[0-3]$" clientlogs | head -n $n | grep "[01]$" | wc -l` +#l=`grep "^OTGChouFleur.ApplyAction[0-3]$" clientlogs | head -n $n | grep "[23]$" | wc -l ` +wr=$(( 100 * $w / ( $w + $l ) )) +echo -n "$n --> ---- " +for i in `seq $wr` +do + echo -n "*" +done +echo " $wr" +done +echo -n "Black: " +grep -c "resigned.at.*black" clientlogs +echo -n "White: " +grep -c "resigned.at.*white" clientlogs diff --git a/point.sh b/point.sh new file mode 100755 index 0000000..831377c --- /dev/null +++ b/point.sh @@ -0,0 +1,12 @@ +#!/bin/bash + + + + +ROOTDIR=`git rev-parse --show-toplevel` +for i in `find $ROOTDIR \( -name '*.txt' -o -name '*.sh' -o -name '*.py' -o -name '*.cc' -o -name '*.h' \) -not -path "*codingenv*" -not -path "*third_party*" -exec grep -iH "$1" {} \; | sed 's/:.*//g'` +do +echo $i +vim $i +sleep 1 +done diff --git a/scripts/devmode_set_pythonpath.sh b/scripts/devmode_set_pythonpath.sh index 9318d11..a8c850d 100755 --- a/scripts/devmode_set_pythonpath.sh +++ b/scripts/devmode_set_pythonpath.sh @@ -1,4 +1,8 @@ #!/usr/bin/env bash export ELF_DEVELOPMENT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. && pwd )" -export PYTHONPATH="${ELF_DEVELOPMENT_ROOT}"/src_py/:"${ELF_DEVELOPMENT_ROOT}"/build/elf/:"${ELF_DEVELOPMENT_ROOT}"/build/elfgames/go/:${PYTHONPATH} +export PYTHONPATH="${ELF_DEVELOPMENT_ROOT}"/src_py/:"${ELF_DEVELOPMENT_ROOT}"/build/elf/:"${ELF_DEVELOPMENT_ROOT}"/build/elfgames/go/:"${ELF_DEVELOPMENT_ROOT}"/build/elfgames/tasks/:${PYTHONPATH} + + + + diff --git a/scripts/elfgames/tasks/df_console.py b/scripts/elfgames/tasks/df_console.py new file mode 100644 index 0000000..24859bd --- /dev/null +++ b/scripts/elfgames/tasks/df_console.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python + +# Copyright (c) 2018-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + +import os +import sys + +import torch + +from console_lib import GoConsoleGTP +from rlpytorch import Evaluator, load_env + + +def main(): + print('Python version:', sys.version) + print('PyTorch version:', torch.__version__) + print('CUDA version', torch.version.cuda) + print('Conda env:', os.environ.get("CONDA_DEFAULT_ENV", "")) + + additional_to_load = { + 'evaluator': ( + Evaluator.get_option_spec(), + lambda object_map: Evaluator(object_map, stats=None)), + } + + # Set game to online model. + env = load_env( + os.environ, + overrides={ + 'num_games': 1, + 'greedy': True, + 'T': 1, + 'model': 'online', + 'additional_labels': ['aug_code', 'move_idx'], + }, + additional_to_load=additional_to_load) + + evaluator = env['evaluator'] + + GC = env["game"].initialize() + + model_loader = env["model_loaders"][0] + model = model_loader.load_model(GC.params) + + mi = env['mi'] + mi.add_model("model", model) + mi.add_model("actor", model) + mi["model"].eval() + mi["actor"].eval() + + console = GoConsoleGTP(GC, evaluator) + + def human_actor(batch): + return console.prompt("", batch) + + def actor(batch): + return console.actor(batch) + + def train(batch): + console.prompt("DF Train> ", batch) + + evaluator.setup(sampler=env["sampler"], mi=mi) + + GC.reg_callback_if_exists("actor_black", actor) + GC.reg_callback_if_exists("human_actor", human_actor) + GC.reg_callback_if_exists("train", train) + + GC.start() + GC.GC.getClient().setRequest( + mi["actor"].step, -1, env['game'].options.resign_thres, -1) + + evaluator.episode_start(0) + + while True: + GC.run() + if console.exit: + break + GC.stop() + + +if __name__ == '__main__': + main() diff --git a/scripts/elfgames/tasks/gtp.sh b/scripts/elfgames/tasks/gtp.sh new file mode 100755 index 0000000..a9bf588 --- /dev/null +++ b/scripts/elfgames/tasks/gtp.sh @@ -0,0 +1 @@ +#!/bin/bash diff --git a/scripts/elfgames/tasks/selfplay.py b/scripts/elfgames/tasks/selfplay.py new file mode 100644 index 0000000..829f3f4 --- /dev/null +++ b/scripts/elfgames/tasks/selfplay.py @@ -0,0 +1,203 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Copyright (c) 2018-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + +import os +import sys +import time +import re +from datetime import datetime + +import torch + +from rlpytorch import \ + Evaluator, load_env, ModelInterface + + +class Stats(object): + def __init__(self): + self.total_batchsize = 0 + self.total_sel_batchsize = 0 + self.actor_count = 0 + + def feed(self, batch): + self.total_sel_batchsize += batch.batchsize + self.total_batchsize += batch.max_batchsize + self.actor_count += 1 + + if self.total_sel_batchsize >= 500000: + print(datetime.now()) + + batch_usage = self.total_sel_batchsize / self.total_batchsize + print(f'Batch usage: ' + f'{self.total_sel_batchsize}/{self.total_batchsize} ' + f'({100.0 * batch_usage:.2f}%)') + + wr = batch.GC.getClient().getGameStats().getWinRateStats() + win_rate = (100.0 * wr.black_wins / wr.total_games + if wr.total_games > 0 + else 0.0) + print(f'B/W: {wr.black_wins}/{wr.white_wins}. ' + f'Black winrate: {win_rate:.2f} {wr.total_games}') + + self.total_sel_batchsize = 0 + self.total_batchsize = 0 + print('Actor count:', self.actor_count) + + +name_matcher = re.compile(r"save-(\d+)") + + +def extract_ver(model_loader): + name = os.path.basename(model_loader.options.load) + m = name_matcher.match(name) + return int(m.group(1)) + + +def reload_model(model_loader, params, mi, actor_name, args): + model = model_loader.load_model(params) + + if actor_name not in mi: + mi.add_model(actor_name, model, cuda=(args.gpu >= 0), gpu_id=args.gpu) + else: + mi.update_model(actor_name, model) + mi[actor_name].eval() + + +def reload(mi, model_loader, params, args, root, ver, actor_name): + if model_loader.options.load is None or model_loader.options.load == "": + print('No previous model loaded, loading from', root) + real_path = os.path.join(root, "save-" + str(ver) + ".bin") + else: + this_root = os.path.dirname(model_loader.options.load) + real_path = os.path.join(this_root, "save-" + str(ver) + ".bin") + + if model_loader.options.load != real_path: + model_loader.options.load = real_path + reload_model(model_loader, params, mi, actor_name, args) + else: + print('Warning! Same model, skip loading', real_path) + + +def main(): + print('Python version:', sys.version) + print('PyTorch version:', torch.__version__) + print('CUDA version', torch.version.cuda) + print('Conda env:', os.environ.get("CONDA_DEFAULT_ENV", "")) + + # Set game to online model. + actors = ["actor_black", "actor_white"] + additional_to_load = { + ("eval_" + actor_name): ( + Evaluator.get_option_spec(name="eval_" + actor_name), + lambda object_map, actor_name=actor_name: Evaluator( + object_map, name="eval_" + actor_name, + actor_name=actor_name, stats=None) + ) + for i, actor_name in enumerate(actors) + } + additional_to_load.update({ + ("mi_" + name): (ModelInterface.get_option_spec(), ModelInterface) + for name in actors + }) + + env = load_env( + os.environ, num_models=2, overrides={'actor_only': True}, + additional_to_load=additional_to_load) + + GC = env["game"].initialize() + + stats = [Stats(), Stats()] + + for i in range(len(actors)): + actor_name = actors[i] + stat = stats[i] + e = env["eval_" + actor_name] + + print(f'register {actor_name} for e = {e!s}') + e.setup(sampler=env["sampler"], mi=env["mi_" + actor_name]) + + def actor(batch, e, stat): + reply = e.actor(batch) + stat.feed(batch) + #print("actor returns " + str(reply)) + return reply + + GC.reg_callback(actor_name, + lambda batch, e=e, stat=stat: actor(batch, e, stat)) + + root = os.environ.get("root", "./") + print(f'Root: "{root}"') + args = env["game"].options + loop_end = False + + def game_start(batch): + print("In game start") + + vers = [int(batch["black_ver"][0]), int(batch["white_ver"][0])] + + # Use the version number to load models. + for model_loader, ver, actor_name in zip( + env["model_loaders"], vers, actors): + if ver >= 0: + while True: + try: + reload( + env["mi_" + actor_name], model_loader, GC.params, + args, root, ver, actor_name) + break + except BaseException: + import traceback + traceback.print_exc() + time.sleep(10) + + def game_end(batch): + nonlocal loop_end + wr = batch.GC.getClient().getGameStats().getWinRateStats() + win_rate = (100.0 * wr.black_wins / wr.total_games + if wr.total_games > 0 else 0.0) + print(f'{datetime.now()!s} B/W: {wr.black_wins}/{wr.white_wins}.' + f'Black winrate: {win_rate:.2f} ({wr.total_games})') + + if args.suicide_after_n_games > 0 and \ + wr.total_games >= args.suicide_after_n_games: + print(f'#suicide_after_n_games: {args.suicide_after_n_games}, ' + f'total_games: {wr.total_games}') + loop_end = True + + GC.reg_callback_if_exists("game_start", game_start) + GC.reg_callback_if_exists("game_end", game_end) + + GC.start() + if args.eval_model_pair: + if args.eval_model_pair.find(",") >= 0: + black, white = args.eval_model_pair.split(",") + else: + black = extract_ver(env["model_loaders"][0]) + white = extract_ver(env["model_loaders"][1]) + + # Force them to reload in the future. + for model_loader, actor_name in zip(env["model_loaders"], actors): + reload_model(model_loader, GC.params, + env["mi_" + actor_name], actor_name, args) + + # We just use one thread to do selfplay. + GC.GC.getClient().setRequest( + int(black), int(white), env['game'].options.resign_thres, 1) + + for actor_name in actors: + env["eval_" + actor_name].episode_start(0) + + while not loop_end: + GC.run() + + GC.stop() + + +if __name__ == '__main__': + main() diff --git a/scripts/elfgames/tasks/server_addrs.py b/scripts/elfgames/tasks/server_addrs.py new file mode 100644 index 0000000..928cddb --- /dev/null +++ b/scripts/elfgames/tasks/server_addrs.py @@ -0,0 +1,3 @@ +addrs = { + "myserver": "[100.97.67.45]", +} diff --git a/scripts/elfgames/tasks/server_addrs.py.origin b/scripts/elfgames/tasks/server_addrs.py.origin new file mode 100644 index 0000000..913d0e3 --- /dev/null +++ b/scripts/elfgames/tasks/server_addrs.py.origin @@ -0,0 +1,3 @@ +addrs = { + "myserver": "[XXX.XXX.XXX.XXX]", +} diff --git a/scripts/elfgames/tasks/setaddr.sh b/scripts/elfgames/tasks/setaddr.sh new file mode 100755 index 0000000..beb302a --- /dev/null +++ b/scripts/elfgames/tasks/setaddr.sh @@ -0,0 +1 @@ +sed "s/XXX.XXX.XXX.XXX/`hostname -I | sed 's/ .*//g'`/g" server_addrs.py.origin > server_addrs.py diff --git a/scripts/elfgames/tasks/start_check_mini.sh b/scripts/elfgames/tasks/start_check_mini.sh new file mode 100755 index 0000000..3d3ca30 --- /dev/null +++ b/scripts/elfgames/tasks/start_check_mini.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +# Copyright (c) 2018-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + +# This file runs a client with small settings. + +echo $PYTHONPATH $SLURMD_NODENAME $CUDA_VISIBLE_DEVICES + +root=./myserver game=elfgames.tasks.game model=df_pred model_file=elfgames.tasks.df_model3 \ +stdbuf -o 0 -e 0 python -v ./selfplay.py \ + --T 1 --batchsize 1 \ + --dim0 1 --dim1 1 --gpu 0 \ + --keys_in_reply V rv --mcts_alpha 0.03 \ + --mcts_epsilon 0.25 --mcts_persistent_tree \ + --mcts_puct 0.85 --mcts_rollout_per_thread 200 \ + --mcts_threads 1 --mcts_use_prior \ + --mcts_virtual_loss 5 --mode selfplay \ + --num_block0 20 --num_block1 20 \ + --num_games 1 --ply_pass_enabled 160 \ + --policy_distri_cutoff 30 --policy_distri_training_for_all \ + --port 1234 \ + --no_check_loaded_options0 --no_check_loaded_options1 \ + --replace_prefix0 resnet.module,resnet init_conv.module,init_conv\ + --replace_prefix1 resnet.module,resnet init_conv.module,init_conv\ + --resign_thres 0.1 --selfplay_timeout_usec 10 \ + --use_mcts \ + --use_fp160 --use_fp161 --black_use_dga \ + --use_mcts_ai2 | sed 's/^/blackdga/g' > ../../../blackdgachecklogs & + +root=./myserver game=elfgames.tasks.game model=df_pred model_file=elfgames.tasks.df_model3 \ +stdbuf -o 0 -e 0 python -v ./selfplay.py \ + --T 1 --batchsize 1 \ + --dim0 1 --dim1 1 --gpu 0 \ + --keys_in_reply V rv --mcts_alpha 0.03 \ + --mcts_epsilon 0.25 --mcts_persistent_tree \ + --mcts_puct 0.85 --mcts_rollout_per_thread 200 \ + --mcts_threads 1 --mcts_use_prior \ + --mcts_virtual_loss 5 --mode selfplay \ + --num_block0 20 --num_block1 20 \ + --num_games 1 --ply_pass_enabled 160 \ + --policy_distri_cutoff 30 --policy_distri_training_for_all \ + --port 1234 \ + --no_check_loaded_options0 --no_check_loaded_options1 \ + --replace_prefix0 resnet.module,resnet init_conv.module,init_conv\ + --replace_prefix1 resnet.module,resnet init_conv.module,init_conv\ + --resign_thres 0.1 --selfplay_timeout_usec 10 \ + --use_mcts \ + --use_fp160 --use_fp161 --white_use_dga \ + --use_mcts_ai2 | sed 's/^/whitedga/g' > ../../../whitedgachecklogs + +wait diff --git a/scripts/elfgames/tasks/start_client.sh b/scripts/elfgames/tasks/start_client.sh new file mode 100755 index 0000000..ad97d7a --- /dev/null +++ b/scripts/elfgames/tasks/start_client.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Copyright (c) 2018-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + +echo $PYTHONPATH $SLURMD_NODENAME $CUDA_VISIBLE_DEVICES + +root=./myserver game=elfgames.tasks.game model=df_pred model_file=elfgames.tasks.df_model3 \ +stdbuf -o 0 -e 0 python -v ./selfplay.py \ + --T 1 --batchsize 128 \ + --dim0 224 --dim1 224 --gpu 0 \ + --keys_in_reply V rv --mcts_alpha 0.03 \ + --mcts_epsilon 0.25 --mcts_persistent_tree \ + --mcts_puct 0.85 --mcts_rollout_per_thread 200 \ + --mcts_threads 8 --mcts_use_prior \ + --mcts_virtual_loss 5 --mode selfplay \ + --num_block0 20 --num_block1 20 \ + --num_games 32 --ply_pass_enabled 160 \ + --policy_distri_cutoff 30 --policy_distri_training_for_all \ + --port 1234 \ + --no_check_loaded_options0 --no_check_loaded_options1 \ + --replace_prefix0 resnet.module,resnet init_conv.module,init_conv\ + --replace_prefix1 resnet.module,resnet init_conv.module,init_conv\ + --resign_thres 0.0 --selfplay_timeout_usec 10 \ + --server_id myserver --use_mcts \ + --use_fp160 --use_fp161 \ + --use_mcts_ai2 --verbose diff --git a/scripts/elfgames/tasks/start_client_mini.sh b/scripts/elfgames/tasks/start_client_mini.sh new file mode 100755 index 0000000..16cd97c --- /dev/null +++ b/scripts/elfgames/tasks/start_client_mini.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# Copyright (c) 2018-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + +# This file runs a client with small settings. + +echo $PYTHONPATH $SLURMD_NODENAME $CUDA_VISIBLE_DEVICES + +root=./myserver game=elfgames.tasks.game model=df_pred model_file=elfgames.tasks.df_model3 \ +stdbuf -o 0 -e 0 python -v ./selfplay.py \ + --T 1 --batchsize 10 \ + --dim0 2 --dim1 2 --gpu 0 \ + --keys_in_reply V rv --mcts_alpha 0.03 \ + --mcts_epsilon 0.25 --mcts_persistent_tree \ + --mcts_puct 0.85 --mcts_rollout_per_thread 200 \ + --mcts_threads 1 --mcts_use_prior \ + --mcts_virtual_loss 5 --mode selfplay \ + --num_block0 2 --num_block1 2 \ + --num_games 10 --ply_pass_enabled 160 \ + --policy_distri_cutoff 30 --policy_distri_training_for_all \ + --port 1234 \ + --no_check_loaded_options0 --no_check_loaded_options1 \ + --replace_prefix0 resnet.module,resnet init_conv.module,init_conv\ + --replace_prefix1 resnet.module,resnet init_conv.module,init_conv\ + --resign_thres 0.1 --selfplay_timeout_usec 500000 \ + --server_id myserver --use_mcts \ + --use_fp160 --use_fp161 \ + --use_mcts_ai2 --verbose diff --git a/scripts/elfgames/tasks/start_selfplay.sh b/scripts/elfgames/tasks/start_selfplay.sh new file mode 100755 index 0000000..468ef60 --- /dev/null +++ b/scripts/elfgames/tasks/start_selfplay.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +# Copyright (c) 2018-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + +LOAD0=$1 +shift + +LOAD1=$1 +shift + +BATCHSIZE=$1 +shift + +NUM_ROLLOUTS=$1 +shift + +BATCHSIZE2=$1 +shift + +NUM_ROLLOUTS2=$1 +shift + +GPU=$1 +shift + +DIM=224 +NUM_BLOCK=20 + +game=elfgames.tasks.game model=df_pred model_file=elfgames.tasks.df_model3 python3 selfplay.py \ + --mode selfplay --selfplay_timeout_usec 10 \ + --batchsize $BATCHSIZE --mcts_rollout_per_batch $BATCHSIZE \ + --num_games 1 --keys_in_reply V rv --port 2341 --server_id myserver \ + --mcts_threads 2 --mcts_rollout_per_thread $NUM_ROLLOUTS \ + --use_mcts --use_mcts_ai2 --mcts_use_prior \ + --mcts_persistent_tree --mcts_puct 1.5 \ + --batchsize2 $BATCHSIZE2 --white_mcts_rollout_per_batch $BATCHSIZE2 \ + --white_mcts_rollout_per_thread $NUM_ROLLOUTS2 \ + --eval_model_pair loaded \ + --policy_distri_cutoff 0 \ + --mcts_virtual_loss 1 --mcts_epsilon 0.0 --mcts_alpha 0.00 \ + --resign_thres 0.05 \ + --num_block0 $NUM_BLOCK --dim0 $DIM \ + --num_block1 $NUM_BLOCK --dim1 $DIM \ + --no_check_loaded_options0 \ + --no_check_loaded_options1 \ + --verbose \ + --gpu $GPU \ + --load0 $LOAD0 \ + --load1 $LOAD1 \ + --use_fp160 --use_fp161 \ + --gpu $GPU \ + --replace_prefix0 resnet.module,resnet --replace_prefix1 resnet.module,resnet \ + "$@" diff --git a/scripts/elfgames/tasks/start_server.sh b/scripts/elfgames/tasks/start_server.sh new file mode 100755 index 0000000..8b7ec20 --- /dev/null +++ b/scripts/elfgames/tasks/start_server.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +touch log.log + +rm log.log +# Copyright (c) 2018-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + +./setaddr.sh + +save=./myserver game=elfgames.tasks.game model=df_kl model_file=elfgames.tasks.df_model3 \ + stdbuf -o 0 -e 0 python -u ./train.py \ + --mode train --batchsize 2048 \ + --num_games 2048 --keys_in_reply V \ + --T 1 --use_data_parallel \ + --num_minibatch 1000 --num_episode 1000000 \ + --mcts_threads 8 --mcts_rollout_per_thread 200 \ + --keep_prev_selfplay --keep_prev_selfplay \ + --use_mcts --use_mcts_ai2 \ + --mcts_persistent_tree --mcts_use_prior \ + --mcts_virtual_loss 5 --mcts_epsilon 0.25 \ + --mcts_alpha 0.03 --mcts_puct 0.85 \ + --resign_thres 0.01 --gpu 0 \ + --server_id myserver --eval_num_games 400 \ + --eval_winrate_thres 0.55 --port 1234 \ + --q_min_size 200 --q_max_size 4000 \ + --save_first \ + --num_block 20 --dim 224 \ + --weight_decay 0.0002 --opt_method sgd \ + --bn_momentum=0 --num_cooldown=50 \ + --expected_num_client 496 \ + --selfplay_init_num 0 --selfplay_update_num 0 \ + --eval_num_games 0 --selfplay_async \ + --lr 0.01 --momentum 0.9 1>> log.log 2>&1 & diff --git a/scripts/elfgames/tasks/start_server_mini.sh b/scripts/elfgames/tasks/start_server_mini.sh new file mode 100755 index 0000000..3b6b651 --- /dev/null +++ b/scripts/elfgames/tasks/start_server_mini.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +./setaddr.sh + +touch ../../../log.log + +sleep 1 +rm ../../../log.log +# Copyright (c) 2018-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + +save=./myserver game=elfgames.tasks.game model=df_kl model_file=elfgames.tasks.df_model3 \ + stdbuf -o 0 -e 0 python -u ./train.py \ + --mode train --batchsize 300 \ + --num_games 300 --keys_in_reply V \ + --T 1 --use_data_parallel \ + --num_minibatch 1000 --num_episode 1000000 \ + --mcts_threads 1 --mcts_rollout_per_thread 20 \ + --keep_prev_selfplay --keep_prev_selfplay \ + --use_mcts --use_mcts_ai2 \ + --mcts_persistent_tree --mcts_use_prior \ + --mcts_virtual_loss 5 --mcts_epsilon 0.25 \ + --mcts_alpha 0.03 --mcts_puct 0.85 \ + --resign_thres 0.00 --gpu 0 \ + --server_id myserver --eval_num_games 400 \ + --eval_winrate_thres 0.55 --port 1234 \ + --q_min_size 200 --q_max_size 4000 \ + --save_first \ + --num_block 2 --dim 2 \ + --weight_decay 0.0002 --opt_method sgd \ + --bn_momentum=0 --num_cooldown=50 \ + --expected_num_client 1 \ + --selfplay_init_num 0 --selfplay_update_num 0 \ + --eval_num_games 0 --selfplay_async \ + --lr 0.01 --momentum 0.9 1>> ../../../log.log 2>&1 & diff --git a/scripts/elfgames/tasks/train.py b/scripts/elfgames/tasks/train.py new file mode 100644 index 0000000..3c143fb --- /dev/null +++ b/scripts/elfgames/tasks/train.py @@ -0,0 +1,144 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Copyright (c) 2018-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + +import os +import sys +import re +import time + +import torch + +from rlpytorch import load_env, SingleProcessRun, Trainer + + +matcher = re.compile(r"save-(\d+).bin") + + +def main(): + print('Python version:', sys.version) + print('PyTorch version:', torch.__version__) + print('CUDA version', torch.version.cuda) + print('Conda env:', os.environ.get("CONDA_DEFAULT_ENV", "")) + + additional_to_load = { + 'trainer': ( + Trainer.get_option_spec(), + lambda option_map: Trainer(option_map)), + 'runner': ( + SingleProcessRun.get_option_spec(), + lambda option_map: SingleProcessRun(option_map)), + } + + env = load_env(os.environ, additional_to_load=additional_to_load) + + trainer = env['trainer'] + runner = env['runner'] + + GC = env["game"].initialize() + + model_loader = env["model_loaders"][0] + model = model_loader.load_model(GC.params) + env["mi"].add_model("model", model, opt=True) + + keep_prev_selfplay = env["game"].options.keep_prev_selfplay + model_ver = 0 + model_filename = model_loader.options.load + if isinstance(model_filename, str) and model_filename != "": + realpath = os.path.realpath(model_filename) + m = matcher.match(os.path.basename(realpath)) + if m: + model_ver = int(m.group(1)) + + eval_old_model = env["game"].options.eval_old_model + + if eval_old_model >= 0: + GC.GC.getServer().setEvalMode(model_ver, eval_old_model) + else: + GC.GC.getServer().setInitialVersion(model_ver) + + selfplay_ver = model_ver + root = os.environ["save"] + print(f'Root: "{root}"') + print(f'Keep prev_selfplay: {keep_prev_selfplay!s}') + + def train(batch, *args, **kwargs): + # Check whether the version match. + if keep_prev_selfplay or \ + (batch["selfplay_ver"] != selfplay_ver).sum() == 0: + trainer.train(batch, *args, **kwargs) + else: + print(f'Get batch whose selfplay ver is different from ' + f'{selfplay_ver}, skipping') + runner.inc_episode_counter(-1) + + def train_ctrl(batch, *args, **kwargs): + nonlocal selfplay_ver + old_selfplay_ver = selfplay_ver + selfplay_ver = int(batch["selfplay_ver"][0]) + print( + f'Train ctrl: selfplay_ver: {old_selfplay_ver} -> {selfplay_ver}') + GC.GC.getServer().waitForSufficientSelfplay(selfplay_ver) + + # Reload old models. + real_path = os.path.join(root, "save-" + str(selfplay_ver) + ".bin") + model_loader.options.load = real_path + + while True: + try: + model = model_loader.load_model(GC.params) + break + except BaseException: + time.sleep(10) + + env["mi"].remove_model("model") + env["mi"].add_model("model", model, opt=True) + trainer.episode_reset() + runner.set_episode_counter(-1) + + GC.reg_callback("train", train) + GC.reg_callback("train_ctrl", train_ctrl) + + if GC.reg_has_callback("actor"): + args = env["game"].options + env["mi"].add_model( + "actor", + model, + copy=True, + cuda=(args.gpu >= 0), + gpu_id=args.gpu) + GC.reg_callback("actor", trainer.actor) + + trainer.setup( + sampler=env["sampler"], + mi=env["mi"], + rl_method=env["method"]) + + def episode_summary(i): + nonlocal selfplay_ver + ver = trainer.episode_summary(i) + # This might block (when evaluation does not catch up with training). + GC.GC.getServer().notifyNewVersion(selfplay_ver, ver) + + offline_training = (env["game"].options.mode == "offline_train") + + def after_start(): + nonlocal selfplay_ver + if not offline_training: + print("About to wait for sufficient selfplay") + GC.GC.getServer().waitForSufficientSelfplay(selfplay_ver) + + runner.setup(GC, after_start=after_start, + episode_summary=episode_summary, + episode_start=trainer.episode_start) + + runner.run() + + +if __name__ == '__main__': + main() diff --git a/src_cpp/elf/CMakeLists.txt b/src_cpp/elf/CMakeLists.txt index 0b26cdb..262ed03 100644 --- a/src_cpp/elf/CMakeLists.txt +++ b/src_cpp/elf/CMakeLists.txt @@ -14,10 +14,10 @@ set(ELF_SOURCES options/Pybind.cc ) -set(ELF_TEST_SOURCES - options/OptionMapTest.cc - options/OptionSpecTest.cc -) +# set(ELF_TEST_SOURCES +# options/OptionMapTest.cc +# options/OptionSpecTest.cc +# ) # Main ELF library @@ -40,7 +40,7 @@ target_link_libraries(elf PUBLIC # Tests enable_testing() -add_cpp_tests(test_cpp_elf_ elf ${ELF_TEST_SOURCES}) +# add_cpp_tests(test_cpp_elf_ elf ${ELF_TEST_SOURCES}) # Python bindings diff --git a/src_cpp/elf/ai/ai.h b/src_cpp/elf/ai/ai.h index e586e48..f7e12f2 100644 --- a/src_cpp/elf/ai/ai.h +++ b/src_cpp/elf/ai/ai.h @@ -40,12 +40,14 @@ class AI_T { // Given the current state, perform action and send the action to _a; // Return false if this procedure fails. virtual bool act(const S&, A*) { + std::cout << "WTF" << std::endl; return true; } virtual bool act_batch( const std::vector& /*batch_s*/, const std::vector& /*batch_a*/) { + std::cout << "WTF2" << std::endl; return true; } diff --git a/src_cpp/elf/ai/tree_search/tree_search.h b/src_cpp/elf/ai/tree_search/tree_search.h index dd2ac5e..291b247 100644 --- a/src_cpp/elf/ai/tree_search/tree_search.h +++ b/src_cpp/elf/ai/tree_search/tree_search.h @@ -81,6 +81,7 @@ class TreeSearchSingleThreadT { } void notifyReady(int num_rollout) { + //std::cout << "notifyreadynum_rollout" << num_rollout << std::endl; runInfoWhenStateReady_.push(num_rollout); } @@ -93,6 +94,7 @@ class TreeSearchSingleThreadT { int num_rollout; runInfoWhenStateReady_.pop(&num_rollout); + // std::cout << " ploploplo"<getStatePtr() == nullptr) { if (stop_search == nullptr || !stop_search->load()) { @@ -102,20 +104,23 @@ class TreeSearchSingleThreadT { } _set_ostream(actor); - + //std::cout << "pliplipli" << std::endl; if (output_ != nullptr) { *output_ << "[run=" << run_id << "] " << actor.info() << std::endl << std::flush; } - + // std::cout << "rolloutstuff" << num_rollout << "," << options_.num_rollouts_per_batch << std::endl; for (int idx = 0; idx < num_rollout && (stop_search == nullptr || !stop_search->load()); idx += options_.num_rollouts_per_batch) { // Start from the root and run one path + /*if ((idx <10)||(idx%100 == 0)) { + std::cout << " rollout " << idx << std::endl;}*/ batch_rollouts( RunContext(run_id, idx, num_rollout), root, actor, search_tree); + //std::cout << " stopsearch=nullptr ==> " << (stop_search == nullptr) << ", not(stop_search->load)" << !stop_search->load() << std::endl; } - + //std::cout << "plupluplu" << std::endl; if (output_ != nullptr) { *output_ << "[run=" << run_id << "] " << "Done" << std::endl @@ -415,7 +420,7 @@ class TreeSearchT { root->enhanceExploration( options_.root_epsilon, options_.root_alpha, actors_[0]->rng()); } - + //std::cout << " notifySearchesfromrun " << options_.num_rollouts_per_thread << std::endl; notifySearches(options_.num_rollouts_per_thread); // Wait until all tree searches are done. @@ -471,6 +476,7 @@ class TreeSearchT { void notifySearches(int num_rollout) { for (size_t i = 0; i < treeSearches_.size(); ++i) { + //std::cout << " notifySearches_num_rollout " << num_rollout << std::endl; treeSearches_[i]->notifyReady(num_rollout); } } diff --git a/src_cpp/elf/legacy/pybind_helper.h b/src_cpp/elf/legacy/pybind_helper.h index 3a6bd48..296afab 100644 --- a/src_cpp/elf/legacy/pybind_helper.h +++ b/src_cpp/elf/legacy/pybind_helper.h @@ -2455,6 +2455,7 @@ a47, \ a48) + #define MM_APPLY_49( \ macroname, \ C, \ @@ -2560,6 +2561,222 @@ a48, \ a49) +#define MM_APPLY_50( \ + macroname, \ + C, \ + a1, \ + a2, \ + a3, \ + a4, \ + a5, \ + a6, \ + a7, \ + a8, \ + a9, \ + a10, \ + a11, \ + a12, \ + a13, \ + a14, \ + a15, \ + a16, \ + a17, \ + a18, \ + a19, \ + a20, \ + a21, \ + a22, \ + a23, \ + a24, \ + a25, \ + a26, \ + a27, \ + a28, \ + a29, \ + a30, \ + a31, \ + a32, \ + a33, \ + a34, \ + a35, \ + a36, \ + a37, \ + a38, \ + a39, \ + a40, \ + a41, \ + a42, \ + a43, \ + a44, \ + a45, \ + a46, \ + a47, \ + a48, \ + a49, \ + a50) \ + MM_INVOKE_B(macroname, (C, a1)) \ + MM_APPLY_49( \ + macroname, \ + C, \ + a2, \ + a3, \ + a4, \ + a5, \ + a6, \ + a7, \ + a8, \ + a9, \ + a10, \ + a11, \ + a12, \ + a13, \ + a14, \ + a15, \ + a16, \ + a17, \ + a18, \ + a19, \ + a20, \ + a21, \ + a22, \ + a23, \ + a24, \ + a25, \ + a26, \ + a27, \ + a28, \ + a29, \ + a30, \ + a31, \ + a32, \ + a33, \ + a34, \ + a35, \ + a36, \ + a37, \ + a38, \ + a39, \ + a40, \ + a41, \ + a42, \ + a43, \ + a44, \ + a45, \ + a46, \ + a47, \ + a48, \ + a49, \ + a50) + +#define MM_APPLY_51( \ + macroname, \ + C, \ + a1, \ + a2, \ + a3, \ + a4, \ + a5, \ + a6, \ + a7, \ + a8, \ + a9, \ + a10, \ + a11, \ + a12, \ + a13, \ + a14, \ + a15, \ + a16, \ + a17, \ + a18, \ + a19, \ + a20, \ + a21, \ + a22, \ + a23, \ + a24, \ + a25, \ + a26, \ + a27, \ + a28, \ + a29, \ + a30, \ + a31, \ + a32, \ + a33, \ + a34, \ + a35, \ + a36, \ + a37, \ + a38, \ + a39, \ + a40, \ + a41, \ + a42, \ + a43, \ + a44, \ + a45, \ + a46, \ + a47, \ + a48, \ + a49, \ + a50, \ + a51) \ + MM_INVOKE_B(macroname, (C, a1)) \ + MM_APPLY_50( \ + macroname, \ + C, \ + a2, \ + a3, \ + a4, \ + a5, \ + a6, \ + a7, \ + a8, \ + a9, \ + a10, \ + a11, \ + a12, \ + a13, \ + a14, \ + a15, \ + a16, \ + a17, \ + a18, \ + a19, \ + a20, \ + a21, \ + a22, \ + a23, \ + a24, \ + a25, \ + a26, \ + a27, \ + a28, \ + a29, \ + a30, \ + a31, \ + a32, \ + a33, \ + a34, \ + a35, \ + a36, \ + a37, \ + a38, \ + a39, \ + a40, \ + a41, \ + a42, \ + a43, \ + a44, \ + a45, \ + a46, \ + a47, \ + a48, \ + a49, \ + a50, \ + a51) + #define MM_NARG(...) MM_NARG_(__VA_ARGS__, MM_RSEQ_N()) #define MM_NARG_(...) MM_ARG_N(__VA_ARGS__) #define MM_ARG_N( \ @@ -5134,6 +5351,220 @@ a47, \ a48) +#define MM_APPLY_COMMA_49( \ + macroname, \ + C, \ + a1, \ + a2, \ + a3, \ + a4, \ + a5, \ + a6, \ + a7, \ + a8, \ + a9, \ + a10, \ + a11, \ + a12, \ + a13, \ + a14, \ + a15, \ + a16, \ + a17, \ + a18, \ + a19, \ + a20, \ + a21, \ + a22, \ + a23, \ + a24, \ + a25, \ + a26, \ + a27, \ + a28, \ + a29, \ + a30, \ + a31, \ + a32, \ + a33, \ + a34, \ + a35, \ + a36, \ + a37, \ + a38, \ + a39, \ + a40, \ + a41, \ + a42, \ + a43, \ + a44, \ + a45, \ + a46, \ + a47, \ + a48, \ + a49) \ + MM_INVOKE_B(macroname, (C, a1)) \ + , \ + MM_APPLY_COMMA_48( \ + macroname, \ + C, \ + a2, \ + a3, \ + a4, \ + a5, \ + a6, \ + a7, \ + a8, \ + a9, \ + a10, \ + a11, \ + a12, \ + a13, \ + a14, \ + a15, \ + a16, \ + a17, \ + a18, \ + a19, \ + a20, \ + a21, \ + a22, \ + a23, \ + a24, \ + a25, \ + a26, \ + a27, \ + a28, \ + a29, \ + a30, \ + a31, \ + a32, \ + a33, \ + a34, \ + a35, \ + a36, \ + a37, \ + a38, \ + a39, \ + a40, \ + a41, \ + a42, \ + a43, \ + a44, \ + a45, \ + a46, \ + a47, \ + a48, \ + a49) + +#define MM_APPLY_COMMA_50( \ + macroname, \ + C, \ + a1, \ + a2, \ + a3, \ + a4, \ + a5, \ + a6, \ + a7, \ + a8, \ + a9, \ + a10, \ + a11, \ + a12, \ + a13, \ + a14, \ + a15, \ + a16, \ + a17, \ + a18, \ + a19, \ + a20, \ + a21, \ + a22, \ + a23, \ + a24, \ + a25, \ + a26, \ + a27, \ + a28, \ + a29, \ + a30, \ + a31, \ + a32, \ + a33, \ + a34, \ + a35, \ + a36, \ + a37, \ + a38, \ + a39, \ + a40, \ + a41, \ + a42, \ + a43, \ + a44, \ + a45, \ + a46, \ + a47, \ + a48, \ + a49, \ + a50) \ + MM_INVOKE_B(macroname, (C, a1)) \ + , \ + MM_APPLY_COMMA_49( \ + macroname, \ + C, \ + a2, \ + a3, \ + a4, \ + a5, \ + a6, \ + a7, \ + a8, \ + a9, \ + a10, \ + a11, \ + a12, \ + a13, \ + a14, \ + a15, \ + a16, \ + a17, \ + a18, \ + a19, \ + a20, \ + a21, \ + a22, \ + a23, \ + a24, \ + a25, \ + a26, \ + a27, \ + a28, \ + a29, \ + a30, \ + a31, \ + a32, \ + a33, \ + a34, \ + a35, \ + a36, \ + a37, \ + a38, \ + a39, \ + a40, \ + a41, \ + a42, \ + a43, \ + a44, \ + a45, \ + a46, \ + a47, \ + a48, \ + a49, \ + a50) + // C: pyclass instance #define ADD_PYBIND_FIELD(C, field) \ C.def_readwrite( \ diff --git a/src_cpp/elfgames/go/mcts/mcts.h b/src_cpp/elfgames/go/mcts/mcts.h index 4d5d33e..cf40428 100644 --- a/src_cpp/elfgames/go/mcts/mcts.h +++ b/src_cpp/elfgames/go/mcts/mcts.h @@ -47,9 +47,7 @@ class MCTSActor { MCTSActor(elf::GameClient* client, const MCTSActorParams& params) : params_(params), rng_(params.seed), - logger_(elf::logging::getIndexedLogger( - "elfgames::go::mcts::MCTSActor-", - "")) { + logger_(elf::logging::getIndexedLogger("elfgames::go::mcts::MCTSActor-", "")) { ai_.reset(new AI(client, {params_.actor_name})); } diff --git a/src_cpp/elfgames/tasks/CMakeLists.txt b/src_cpp/elfgames/tasks/CMakeLists.txt new file mode 100644 index 0000000..603cfd0 --- /dev/null +++ b/src_cpp/elfgames/tasks/CMakeLists.txt @@ -0,0 +1,85 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 3.3) +project(elfgames_tasks) + +# Source files + +set(ELFGAMES_TASKS_SOURCES + base/board_feature.cc +# base/common.cc +# base/go_state.cc +# base/board.cc +# sgf/sgf.cc + common/game_selfplay.cc + common/go_state_ext.cc + train/client_manager.cc + train/game_train.cc + train/Pybind.cc +) + +set(ELFGAMES_TASKS_INFERENCE_SOURCES + base/board_feature.cc +# base/common.cc +# base/go_state.cc +# base/board.cc +# sgf/sgf.cc + common/game_selfplay.cc + common/go_state_ext.cc + inference/Pybind.cc +) + +# Main Go library + +add_library(elfgames_tasks ${ELFGAMES_TASKS_SOURCES}) +if(${BOARD9x9}) + message("Use 9x9 board") + target_compile_definitions(elfgames_tasks PUBLIC BOARD9x9) +endif() +target_link_libraries(elfgames_tasks PUBLIC + cppzmq + elf +) + +add_library(elfgames_tasks_inference ${ELFGAMES_TASKS_INFERENCE_SOURCES}) +if(${BOARD9x9}) + message("Use 9x9 board") + target_compile_definitions(elfgames_tasks_inference PUBLIC BOARD9x9) +endif() +target_link_libraries(elfgames_tasks_inference PUBLIC + elf +) + +# For unit-test purpose, build 9x9 library +add_library(elfgames_tasks9 ${ELFGAMES_TASKS_SOURCES}) +target_compile_definitions(elfgames_tasks9 PUBLIC BOARD9x9) +target_link_libraries(elfgames_tasks9 PUBLIC + cppzmq + elf +) + +# Python bindings + +pybind11_add_module(_elfgames_tasks train/pybind_module.cc) +target_link_libraries(_elfgames_tasks PRIVATE + elfgames_tasks + zmq +) + +pybind11_add_module(_elfgames_tasks_inference inference/pybind_module.cc) +target_link_libraries(_elfgames_tasks_inference PRIVATE + elfgames_tasks_inference +) + +#set_target_properties(_elfgames_tasks PROPERTIES +# LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") + +# unit-test here: +set(TASKS_TEST_SOURCES +# base/test/coord_test.cc +# base/test/go_test.cc +# base/test/board_feature_test.cc +# base/test/symmetry_test.cc +# sgf/sgf_test.cc +# #mcts/mcts_test.cc +) +enable_testing() +add_cpp_tests(test_cpp_elfgames_tasks_ elfgames_tasks9 ${TASKS_TEST_SOURCES}) diff --git a/src_cpp/elfgames/tasks/Game.h b/src_cpp/elfgames/tasks/Game.h new file mode 100644 index 0000000..6e3151e --- /dev/null +++ b/src_cpp/elfgames/tasks/Game.h @@ -0,0 +1,754 @@ +#ifndef GAME_H__ +#define GAME_H__ + +typedef unsigned short Coord; + +#include +#include +#include +#include +#include "time.h" +#include +#include + +#include +#include +#include +#include +#include +#include + +#define BOARD_SIZE 18 + +//#include "base/common.h" + +/***** + Action and State are abstract classes. + Derived classes correspond to various problems. + + A difference with the AZ setting is that several actions can correspond to the +same logit + from the neural net. This is useful for complex action spaces in which the list +of possible + actions is tricky: the MCTS then takes care of differentiating the possible +actions. + + In most of our games, we are still in bijection, but in the case of draughts +this makes a difference. + + + We provide an implementation of the ChouFleur game as an example. + ChouFleur game (usually played with real distance and assuming here that your +foot can decide between length 2 and length 3): + - we start at distance DISTANCE + - you remove 2 or 3 + - I remove 2 or 3 + - you remove 2 or 3 + - I remove 2 or 3 + - ... + - when distance <=0 the player who just removed something wins. +******/ + +class Action { + public: + Action() {_x.resize(3);} + // Get the location of the move in the neural network output. + // Several moves might fall in the same location, no pb. + virtual int GetX() const {return _x[0];} + virtual int GetY() const {return _x[1];} + virtual int GetZ() const {return _x[2];} + unsigned long int GetHash() const { return _hash; } + void SetIndex(int i) { _i = i; } + int GetIndex() const { return _i; } + + protected: + unsigned long int _hash; + + // Warning! Two actions might have the same position _x. + std::vector _x; // position of the action in {0,...,GetXActionSize()-1} x {0,...,GetYActionSize()-1} x {0,...,GetZActionSize()-1} + + int _i; // index of the action in the list of legal actions in the + // corresponding state. + // _i makes sense since an action is never applied to two distinct states. We + // could have a pointer to + // the state this action is associated to. +}; + +class State { + public: + State() {_hash=-7;_xsize.resize(3);_actionSize.resize(3);} + virtual void Initialize() { /*std::cout << " OTG-Initialize" << std::endl;*/ exit(-1); } + virtual void ApplyAction(__attribute__((unused)) const Action& action) { /*std::cout << "OTG-ApplyAction" << std::endl;*/ exit(-1); } + virtual const std::vector& GetLegalActions() const { return _actions; } + bool checkMove(const unsigned short& c) const { return c < _actions.size(); } + unsigned long int GetHash() const { return _hash; } + float evaluate() const { + if (_status == 3) {std::cout << "blackwon" << std::endl;} + if (_status == 4) {std::cout << "whitewon" << std::endl;} + if (_status == 3) {return 1;} + if (_status == 4) {return -1.;} + return 0.;} + // Returns info about the current state. + // 0: black to play. + // 1: white to play. + // 2: draw. + // 3: black has won. + // 4: white has won. + int GetStatus() const { + return _status; }; + bool terminated() const { + return _status > 1; }; + float getFinalValue() const { return evaluate(); } + // Returns a pointer to GetXSize x GetYSize x GetZSize float, input for the + // NN. + const float* GetFeatures() const { return &_features[0]; } + virtual const std::string& showBoard() const { return boardstring; } + // Size of the neural network input. + int GetXSize() const { return _xsize[0]; } + int GetYSize() const { return _xsize[1]; } + int GetZSize() const { return _xsize[2]; } + // Size of the neural network output. + int GetXActionSize() const {return _actionSize[0];} + int GetYActionSize() const {return _actionSize[1];} + int GetZActionSize() const {return _actionSize[2];} + virtual void DoGoodAction() { + //std::cout << "OTG-DoGoodAction" << std::endl; + exit(-1); + } + bool moves_since(size_t* next_move_number, std::vector* moves) const { + //std::cout << "OTG-moves_since" << std::endl; + if (*next_move_number > _moves.size()) { + // The move number is not right. + return false; + } + moves->clear(); + for (size_t i = *next_move_number; i < _moves.size(); ++i) { + moves->push_back(_moves[i]); + } + *next_move_number = _moves.size(); + return true; + } + // helper functions for compatibility with some parts of ELF2, you might ignore this.. + int nextPlayer() const { + if (_status == 0) return 1; // S_BLACK FIXME + if (_status == 1) return 2; // S_WHITE FIXME dirty hack, I do not use S_WHITE because common.h not included + //std::cout << "OTG-nextplayer crashes " << _status << std::endl; + return 0; + } + virtual int getPly() const { return -1; } + bool forward(const Action& action) { + //std::cout << "OTG-forwarda" << action.GetHash() << std::endl; + // maybe we should check legality here in bool forward(Coord) ? FIXME + ApplyAction(action); + /* void *array[10]; + size_t size; + + // get void*'s for all entries on the stack + size = backtrace(array, 10); + + // print out all the frames to stderr + // fprintf(stderr, "Error: signal %d:\n", sig); + backtrace_symbols_fd(array, size, STDERR_FILENO); + + assert(0); + */ + return true; // FIXME forward always return true ? + } + bool forward(const unsigned short& coord) { + //std::cout << "OTG-forwardb" << coord << std::endl; + _moves.push_back(coord); + return forward(*GetLegalActions()[coord]); + } + void reset() { // for backward compatibility, don't worry :-) + _moves.clear(); + Initialize(); + } + int _GetStatus() const { // for compatibility, don't worry... + //std::cout << "OTG-_getStatus" << std::endl; + return GetStatus(); + } + // end of the helper functions that you might ignore. + + bool justStarted() const { + return _moves.size() == 0; + } + + protected: + std::vector_features; // neural network input + std::vector _actions; + int _status; + std::vector _xsize; // size of the neural network input + std::vector _actionSize; // size of the neural network output + unsigned long int _hash; + std::vector _moves; + std::string boardstring = ""; // string for visualization. + // corresponding state. + // _i makes sense since an action is never applied to two distinct states. We + // could have a pointer to + // the state this action is associated to. +}; + +class StateForChouFleur; +class ActionForChouFleur : public Action { + friend StateForChouFleur; + + public: + ActionForChouFleur():Action() {} + // each action has a position (_x[0], _x[1], _x[2]) + // here for ChouFleur, there is (0, 0, 0) and (1, 0, 0), corresponding to steps 2 and 3 respectively. + ActionForChouFleur(int x, int y, int direction):Action() { _x[0]=x;_x[1]=y;_x[2]=direction;_hash=direction*(x+y*18);} // step is 2 or 3. + ActionForChouFleur(Action& action):Action(action) {} + // The action is in 0 0 0 or in 1 0 0. +}; + + +#define StateForChouFleurNumActions 18*18*4 //board cells* nbr of direction +#define StateForChouFleurX 5 +#define StateForChouFleurY 18 +#define StateForChouFleurZ 18 + +const int Size = 18; +const int White = 0; +const int Black = 1; + +class StateForChouFleur : public State { + public: + bool touching = false; + + + char damier [Size] [Size]; + int damierI [Size] [Size]; + char edge [Size] [Size] [8]; + + int dxdir [8] = {-1, -1, 0, 1, 1, 1, 0, -1}; + int dydir [8] = { 0, 1, 1, 1, 0,-1,-1, -1}; + + + std::list legalMoves; + + + unsigned long long hash; + unsigned long long hashDamier [Size] [Size]; + unsigned long long hashEdge [Size] [Size] [8]; + + void computeHash () + { + hash = 0; + for (int i = 0; i < Size; i++) + for (int j = 0; j < Size; j++) + for (int e = 0; e < 8; e++) + { + if (edge [i] [j] [e] == '+') + hash ^= hashEdge [i] [j] [e]; + } + } + + /* un coup est codé sur un entier + * 7 dernier bit = i + * 7 bits precedents = j + * 7 bits precedents = x + * 7 bits precedents = y + * 3 bits precedents = dir + */ + + void initMap () + { + int mid = Size / 2; + for (int i = 0 ; i < Size; i++) + for (int j = 0; j < Size; j++) + { + damier [i] [j] = '.'; + damierI [i] [j] = 0; + for (int k = 0; k < 8; k++) + edge [i] [j] [k] = '.'; + } + + for (int i = mid - 5 ; i < mid - 1; i++) + { + damier [i] [mid - 2] = '+'; + damier [i] [mid + 1] = '+'; + damier [mid - 2] [i] = '+'; + damier [mid + 1] [i] = '+'; + damierI [i] [mid - 2] = 1; + damierI [i] [mid + 1] = 1; + damierI [mid - 2] [i] = 1; + damierI [mid + 1] [i] = 1; + } + damier [mid - 5] [mid - 1] = '+'; + damier [mid - 5] [mid] = '+'; + damier [mid - 1] [mid - 5] = '+'; + damier [mid] [mid - 5] = '+'; + + damierI [mid - 5] [mid - 1] = 1; + damierI [mid - 5] [mid] = 1; + damierI [mid - 1] [mid - 5] = 1; + damierI [mid] [mid - 5] =1; + for (int i = mid + 1 ; i < mid + 5; i++) + { + damier [i] [mid - 2] = '+'; + damier [i] [mid + 1] = '+'; + damier [mid - 2] [i] = '+'; + damier [mid + 1] [i] = '+'; + + damierI [i] [mid - 2] = 1; + damierI [i] [mid + 1] = 1; + damierI [mid - 2] [i] = 1; + damierI [mid + 1] [i] = 1; + } + damier [mid + 4] [mid - 1] = '+'; + damier [mid + 4] [mid] = '+'; + damier [mid - 1] [mid + 4] = '+'; + damier [mid] [mid + 4] = '+'; + + damierI [mid + 4] [mid - 1] = 1; + damierI [mid + 4] [mid] = 1; + damierI [mid - 1] [mid + 4] = 1; + damierI [mid] [mid + 4] = 1; + + hash = 0; + } + + bool won (int color) { + if (color == White) { + if (legalMoves.size() == 0) + return true; + } + else { + if (legalMoves.size() == 0) + return true; + } + return false; + } + + + + bool alignement (int x, int y, int k) + { + int dx = 0, dy = 0; + + // bug test x et y dans la map + + if (damier [x] [y] != '+') + return false; + for (int m = 0; m < 4; m++) + { + if (edge [x + dx] [y + dy] [k] == '+') + return false; + dx += dxdir [k]; + dy += dydir [k]; + + // bug x+dx peut etre negatif à l'initialisation + + if (damier [x + dx] [y + dy] != '+') + return false; + } + if (!touching) + { + if (edge [x - dxdir [k]] [y - dydir [k]] [k] == '+') + return false; + if (edge [x + 4 * dxdir [k]] [y + 4 * dydir [k]] [k] == '+') + return false; + } + return true; + } + + void findMovesAround (int i, int j, std::list & mvs) + { + for (int k = 0; k < 4; k++) + for (int m = -4; m <= 0; m++) + { + int x = i + m * dxdir [k], y = j + m * dydir [k]; + if (alignement (x, y, k)) + { + int move = i | (j << 7) | (x << 14) | (y << 21) | (k << 28); + mvs.push_back (move); + } + } + } + + void findPossibleMoves (std::list & mvs) + { + mvs.clear (); + for (int i = 0 ; i < Size; i++) + for (int j = 0; j < Size; j++) + if (damier [i] [j] == '.') + { + damier [i] [j] = '+'; + findMovesAround (i, j, mvs); + damier [i] [j] = '.'; + } + } + + + void playMove (int move) + { + int i = move & 127, j = (move >> 7) & 127, x = (move >> 14) & 127, y = (move >> 21) & 127, k = (move >> 28) & 7, oppositek; + damier [i] [j] = '+'; + damierI [i] [j] = 1; + int dx = 0, dy = 0; + if (k < 4) oppositek = k + 4; + else oppositek = k - 4; + for (int m = 0; m < 4; m++) + { + edge [x + dx] [y + dy] [k] = '+'; + hash ^= hashEdge [x + dx] [y + dy] [k]; + dx += dxdir [k]; + dy += dydir [k]; + edge [x + dx] [y + dy] [oppositek] = '+'; + hash ^= hashEdge [x + dx] [y + dy] [oppositek]; + } + } + + + bool legalMove (int move) + { + int i = move & 127, j = (move >> 7) & 127; + int x = (move >> 14) & 127, y = (move >> 21) & 127; + int k = (move >> 28) & 7, oppositek; + + if (damier [i] [j] == '+') + return false; + int dx = 0, dy = 0; + if (k < 4) oppositek = k + 4; + else oppositek = k - 4; + for (int m = 0; m < 4; m++) + { + if (edge [x + dx] [y + dy] [k] == '+') + return false; + dx += dxdir [k]; + dy += dydir [k]; + if (edge [x + dx] [y + dy] [oppositek] == '+') + return false; + } + dx = 0, dy = 0; + for (int m = 0; m < 5; m++) + { + if ((x + dx != i) || (y + dy != j)) + if (damier [x + dx] [y + dy] != '+') + return false; + dx += dxdir [k]; + dy += dydir [k]; + } + if (!touching) + { + if (edge [x - dxdir [k]] [y - dydir [k]] [k] == '+') + return false; + if (edge [x + 4 * dxdir [k]] [y + 4 * dydir [k]] [k] == '+') + return false; + } + return true; + } + + + bool alignementIncluding (int x, int y, int k, int i1, int j1) + { + int dx = 0, dy = 0; + bool included = false; + if (damier [x] [y] != '+') + return false; + if ((x == i1) && (y == j1)) + included = true; + for (int m = 0; m < 4; m++) + { + if (edge [x + dx] [y + dy] [k] == '+') + return false; + dx += dxdir [k]; + dy += dydir [k]; + if (damier [x + dx] [y + dy] != '+') + return false; + if ((x + dx == i1) && (y + dy == j1)) + included = true; + } + if (!touching) + { + if (edge [x - dxdir [k]] [y - dydir [k]] [k] == '+') + return false; + if (edge [x + 4 * dxdir [k]] [y + 4 * dydir [k]] [k] == '+') + return false; + } + return included; + } + + void findMovesAroundIncluding (int i, int j, int i1, int j1, int k, std::list & mvs) + { + /* for (int k = 0; k < 4; k++) */ + if (k > 4) k -= 4; + for (int m = -4; m <= 0; m++) + { + int x = i + m * dxdir [k], y = j + m * dydir [k]; + if (alignementIncluding (x, y, k, i1, j1)) + { + int move = i | (j << 7) | (x << 14) | (y << 21) | (k << 28); + mvs.push_back (move); + } + } + } + + void findMovesIncluding (int i1, int j1,std::list & mvs) + { + for (int k = 0; k < 8; k++) + for (int m = -4; m <= 0; m++) + { + int i = i1 + m * dxdir [k], j = j1 + m * dydir [k]; + if (damier [i] [j] == '.') + { + damier [i] [j] = '+'; + findMovesAroundIncluding (i, j, i1, j1, k, mvs); + damier [i] [j] = '.'; + } + } + } + + void updatePossibleMoves (int move) + { + + /* remove illegal moves */ + std::list::iterator it, it1; + std::list copyMoves = legalMoves; + + for (it = copyMoves.begin (); it != copyMoves.end (); ++it) + { + + if (!legalMove (*it)) + { + legalMoves.remove (*it); + + } + + } + /* add the new moves */ + int i = move & 127, j = (move >> 7) & 127; + findMovesIncluding (i,j, legalMoves); + + } + + + + StateForChouFleur():State() { + // std::cout << "OTGChouFleur CreateState" << std::endl; + Initialize(); + // std::cout << "OTGChouFleur CreateState done" << std::endl; + } + virtual ~StateForChouFleur() { +// std::cout << "OTGChouFleur DeleteState done" << std::endl; + } + // We start at distance 100, black plays first. + void Initialize() { + // People implementing classes should not have much to do in _moves; just _moves.clear(). + _moves.clear(); + // std::cout << "OTGChouFleur initialize" << std::endl; + _xsize[0]=StateForChouFleurX;_xsize[1]=StateForChouFleurY;_xsize[2]=StateForChouFleurZ; // features plans + _actionSize[0]=BOARD_SIZE;_actionSize[1]=BOARD_SIZE;_actionSize[2]=4; // size of the output of the neural network; this should cover the positions of actions (above). + _hash = 0; // _hash is an unsigned int, it should be nearly unique. + _status = 0; // _status is described above, 0 means black plays: + // 0: black to play. + // 1: white to play. + // 2: draw. + // 3: black has won. + // 4: white has won. + + // _features is a vector representing the current state. It can (must...) be large for complex games; here just one number between 0 and 1. + _features.resize(StateForChouFleurX*StateForChouFleurY*StateForChouFleurZ); // trivial case in dimension 1. + //0 to 323(18*18-1) board, (dir*18*18) to (1+dir)*(18*18)-1) legal move in dir ( dir in [1..8]) + generator.seed(time(NULL)); + + initMap(); + findFeatures(); + findActions(); + + } + + + void findFeatures(){ + for (int i = 0; i < 18*18*StateForChouFleurX; i++) + _features [i] = 0; + + for(int i = 0; i<324; i++) + _features[i]=damierI [i%18] [i/18]; + + + findPossibleMoves(legalMoves); + std::list::iterator it; + for (it = legalMoves.begin (); it != legalMoves.end (); ++it){ + + int x= (*it>>14)&127;//start line easting + int y= (*it>>21)&127;//start line ordinate + int dir= (*it>>28)&7; //direction of the line + + _features[324+324*dir+y*18+x]=1; + + } + } + + + + void findActions () { + + _actions.clear (); + int i=0; + std::list::iterator it; + for (it = legalMoves.begin (); it != legalMoves.end (); ++it){ + int x= (*it>>14)&127;//start line easting + int y= (*it>>21)&127;//start line ordinate + int dir= (*it>>28)&7; //direction of the line + _actions.push_back(new ActionForChouFleur(x, y, dir)); + _actions[i]->SetIndex(i); + i++; + } + } + + + + + void ApplyAction(const Action& action) { + int x = action.GetX (); + int y = action.GetY (); + int dir = action.GetZ (); + int move=0; + std::list::iterator it; + for (it = legalMoves.begin (); it != legalMoves.end (); ++it){ + + if(((*it>>14)&127) == x && ((*it>>21)&127) == y && ((*it>>28)&7) == dir){ + move=*it; + } + } + playMove(move); + updatePossibleMoves(move); + + if(_status == 1 ){ + + if(won(White)) + _status=3; + else + _status=0; + } + else{ + if(won(Black)) + _status=4; + else + _status=1; + } + findActions (); + findFeatures (); + _hash = hash; + + + + + } + + // For this trivial example we just compare to random play. Ok, this is not really a good action. + // By the way we need a good default DoGoodAction, e.g. one-ply at least. FIXME + void DoGoodAction() { + std::cout << "OTGMorpionSolitaire DoGoodAction" << std::endl; + + int i = rand () % _actions.size (); + ActionForChouFleur a = *_actions [i]; + ApplyAction(a); + } + + protected: + std::default_random_engine generator; +}; + + +// let us implement Draughts. This is a class compatible with Elf2, to be filled +// so that we can play with the AI. +// I assume below that the AI has a class for Board and a class for Actions. An +// action is an "entire" action, including the several jumps that an action can +// include. +class StateForDraughts; +class ActionForDraughts : public Action { + friend StateForDraughts; + // for black: + // _x[0]; // between 0 and 9, x-axis of the piece to be moved. + // _x[1]; // between 0 and 4, y-axis of the piece to be moved, divided by 2 (rounded below). + // _x[2]; // 0 if moving to the left, 1 if moving to the right (from the player's point of view on the board). + + // for white: symetry w.r.t the center of the board! + // i.e. for black _x = xaxis and _y = yaxis // 2 + // and for white _x = 9-xaxis and _y = (9-yaxis) // 2 + + // We also inherit _status, which tells us if it's black's turn or white's turn + // to play. Reminder: + // 0: black to play. + // 1: white to play. + // 2: draw. + // 3: black has won. + // 4: white has won. + + public: + ActionForDraughts():Action() {} + ActionForDraughts(Action& action):Action(action) {} + + protected: + // TODO here we should have an object of the the AI class for actions. + +}; + +#define StateForDraughgtsNumActions 37 +class StateForDraughts : public State { + public: + StateForDraughts():State() { + _xsize[0] = 10; _xsize[1] = 5; _xsize[2] = 4; // size of the neural net input. + // the neural network specifies which piece should be moved and if it should start by left or by right: + _actionSize[0]=10;_actionSize[1]=5;_actionSize[2]=2; // size of the neural net output; last if left(0)/right(1). + Initialize(); + } + + // This function initializes the board at its original state. + void Initialize() { + // TODO draughts this should initialize the the AI board. + _status = 1; // because at draughts White plays first. + _features.resize(200); // 50 locations, and 4 + _moves.clear(); + // boards because 4 + // different types of pieces + // (black, white, black + // king, white king). + + // TODO here we should use the AI's implementation of Board for: + // 1. generating the list of legal actions. + // 2. storing them in our this->_actions with the correct i_ for each + // (i.e. _actions[i]._i = i, this is just indexing). + } + + // The action just decreases the distance and swaps the turn to play. + void ApplyAction(__attribute__((unused)) const Action& action) { + // TODO draughts: we should update: + // 1. the the AI board object. + // 2. the _features vector: for black: + // _features[i] should be 1 if square i is black + // _features[50+i] should be 1 if square i is white + // _features[100+i] should be 1 if square i is black king + // _features[150+i] should be 1 if square i is white king + // 2. the _features vector: for white: + // _features[i] should be 1 if square 49-i is white + // _features[50+i] should be 1 if square 49-i is black + // _features[100+i] should be 1 if square 49-i is white king + // _features[150+i] should be 1 if square 49-i is black king + // We will take care to design data augmentation techniques for having + // several channels; here there is only 4 channels, + // so that people who use Elf2 do not have to understand anything from Elf2. + // For example, channels could include the history. + // + // We should also update _status if one of the players wins or if it's a + // draw. + _status = 1 - _status; // if nobody wins... + } + + // The feature space has dimension 1x1x1. + // This is just the distance, i.e. the _hash. + + // For this trivial example we just compare to random play. + void DoGoodAction() { + // TODO this should request a good action as suggest by the AI and apply + // this->ApplyAction accordingly. + // This will not be used during the learning, but for checking that the + // learning provides + // an improvement that can decently be included in the AI. + } + +}; + +#endif diff --git a/src_cpp/elfgames/tasks/base/board.h b/src_cpp/elfgames/tasks/base/board.h new file mode 100644 index 0000000..a52d3db --- /dev/null +++ b/src_cpp/elfgames/tasks/base/board.h @@ -0,0 +1,8 @@ +/** + * Copyright (c) 2018-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + diff --git a/src_cpp/elfgames/tasks/base/board_feature.cc b/src_cpp/elfgames/tasks/base/board_feature.cc new file mode 100644 index 0000000..db7f5e0 --- /dev/null +++ b/src_cpp/elfgames/tasks/base/board_feature.cc @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2018-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#include "board_feature.h" +#include +#include +#include +#include "go_state.h" + +#define S_ISA(c1, c2) ((c2 == S_EMPTY) || (c1 == c2)) + +void BoardFeature::extract(std::vector* features) const { + features->resize(TOTAL_FEATURE_SIZE); + extract(&(*features)[0]); +} + +void BoardFeature::extract(float* features) const { + std::copy(s_.GetFeatures(), s_.GetFeatures() + TOTAL_FEATURE_SIZE, features); + +} + +void BoardFeature::extractAGZ(std::vector* features) const { + features->resize(TOTAL_FEATURE_SIZE); + extractAGZ(&(*features)[0]); +} + +void BoardFeature::extractAGZ(float* features) const { + std::fill(features, features + TOTAL_FEATURE_SIZE, 0.0); + +} diff --git a/src_cpp/elfgames/tasks/base/board_feature.h b/src_cpp/elfgames/tasks/base/board_feature.h new file mode 100644 index 0000000..2c98c0b --- /dev/null +++ b/src_cpp/elfgames/tasks/base/board_feature.h @@ -0,0 +1,215 @@ +/** + * Copyright (c) 2018-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#include "go_common.h" +#include "../Game.h" + +#include +#include + +typedef unsigned short Coord; + +#define TOTAL_FEATURE_SIZE 1 // for ChouFleur FIXME +/*#define MAX_NUM_FEATURE 25 + +#define OUR_LIB 0 +#define OPPONENT_LIB 3 +#define OUR_SIMPLE_KO 6 +#define OUR_STONES 7 +#define OPPONENT_STONES 8 +#define EMPTY_STONES 9 + +// [TODO]: Other todo features. +#define OUR_HISTORY 10 +#define OPPONENT_HISTORY 11 +#define BORDER 12 +#define POSITION_MARK 13 +#define OUR_CLOSEST_COLOR 14 +#define OPPONENT_CLOSEST_COLOR 15 + +#define BLACK_INDICATOR 16 +#define WHITE_INDICATOR 17 + +#define MAX_NUM_AGZ_FEATURE 18 +#define MAX_NUM_AGZ_HISTORY 8 */ + +/*struct BoardHistory { + std::vector black; + std::vector white; + + BoardHistory(const Board& b) { + for (int i = 0; i < BOARD_SIZE; ++i) { + for (int j = 0; j < BOARD_SIZE; ++j) { + Coord c = OFFSETXY(i, j); + Stone s = b._infos[c].color; + if (s == S_WHITE) + white.push_back(c); + else if (s == S_BLACK) + black.push_back(c); + } + } + } +};*/ + +class StateForChouFleur; + +class BoardFeature { + public: + enum Rot { NONE = 0, CCW90, CCW180, CCW270 }; + + BoardFeature(const StateForChouFleur& s, Rot rot, bool flip) + : s_(s), _rot(rot), _flip(flip) {} + BoardFeature(const StateForChouFleur& s) : s_(s), _rot(NONE), _flip(false) {} + + /* static BoardFeature RandomShuffle(const StateForChouFleur& s, std::mt19937* rng) { + BoardFeature bf(s); + bf.setD4Code((*rng)() % 8); + return bf; + }*/ + + const StateForChouFleur& state() const { + return s_; + } + +/* + void setD4Group(Rot new_rot, bool new_flip) { + _rot = new_rot; + _flip = new_flip; + } + void setD4Code(int code) { + auto rot = (BoardFeature::Rot)(code % 4); + bool flip = (code >> 2) == 1; + setD4Group(rot, flip); + } + int getD4Code() const { + return (int)_rot + ((_flip ? 1 : 0) << 2); + } + + std::pair Transform(const std::pair& p) const { + std::pair output; + + if (_rot == CCW90) + output = std::make_pair(p.second, BOARD_SIZE - p.first - 1); + else if (_rot == CCW180) + output = + std::make_pair(BOARD_SIZE - p.first - 1, BOARD_SIZE - p.second - 1); + else if (_rot == CCW270) + output = std::make_pair(BOARD_SIZE - p.second - 1, p.first); + else + output = p; + + if (_flip) + std::swap(output.first, output.second); + return output; + } + + std::pair InvTransform(const std::pair& p) const { + std::pair output(p); + + if (_flip) + std::swap(output.first, output.second); + + if (_rot == CCW90) + output = std::make_pair(BOARD_SIZE - output.second - 1, output.first); + else if (_rot == CCW180) + output = std::make_pair( + BOARD_SIZE - output.first - 1, BOARD_SIZE - output.second - 1); + else if (_rot == CCW270) + output = std::make_pair(output.second, BOARD_SIZE - output.first - 1); + + return output; + }*/ + + int64_t coord2Action(Coord m) const { + // FIXME: be very careful about how actions are indices, given that there is not a 1-1 mapping between actions and nn outputs... + /*if (m == M_PASS) + return BOARD_ACTION_PASS; + auto p = Transform(std::make_pair(X(m), Y(m))); + return EXPORT_OFFSET_XY(p.first, p.second);*/ + + //return static_cast(m.GetIndex()); WAS OK WHEN Coord was a ActionForChouFleur + //return static_cast(m); + + // Biggest FIXME of the extension to other games...here I find where in the output tensor my action is. + // FIXME: Coord refers to action indices in this.s_.GetLegalActions() + int xsize = s_.GetXActionSize(); + int ysize = s_.GetYActionSize(); + Action* a = s_.GetLegalActions()[m]; + //std::cout << "selected coord = " << m << std::endl; + int64_t action = a->GetZ()*ysize*xsize + a->GetY()*xsize + a->GetX(); + //std::cout << "selected action = " << action << std::endl; + return action; + //s_ is a StateForChouFleur and we return the index of the coord in GetLegalActions... not 1:1 though, FIXME + } + + Coord action2Coord(int64_t action) const { + //std::cout << " action2coord1 for action=" << action << std::endl; + if (action < 0) { std::cout << "neg action!"<< std::endl;exit(-1); } + //return static_cast(*s_.GetLegalActions()[static_cast(action)]); + // FIXME: I just do the oppositote of coord2Actions above. + int xsize = s_.GetXActionSize(); + int ysize = s_.GetYActionSize(); + //std::cout << " action2coord2 xsize=" << xsize << " ysize=" << ysize << std::endl; + + // slow version... for many games we should be able to do better. + // FIXME: think carefully about what we are doing here. + for (unsigned int a=0; aGetZ()*ysize*xsize + act->GetY()*xsize + act->GetX() <GetZ()*ysize*xsize + act->GetY()*xsize + act->GetX() == action) + { + //std::cout << "validated" << a << std::endl; + return static_cast(a); + } + } + //std::cout << " action2coord3 BUG BUG BUG BUG" << std::endl; + exit(-1); + //return static_cast(action); + /* if (action == -1 || action == BOARD_ACTION_PASS) + return M_PASS; + auto p = InvTransform(std::make_pair(EXPORT_X(action), EXPORT_Y(action))); + return OFFSETXY(p.first, p.second);*/ + } + + void extract(std::vector* features) const; + void extractAGZ(std::vector* features) const; + void extract(float* features) const; + void extractAGZ(float* features) const; + + private: + const StateForChouFleur& s_; + Rot _rot = NONE; + bool _flip = false; + + //static constexpr int64_t kBoardRegion = BOARD_SIZE * BOARD_SIZE; + +/* int transform(int x, int y) const { + auto p = Transform(std::make_pair(x, y)); + return EXPORT_OFFSET_XY(p.first, p.second); + }*/ + +/* int transform(Coord m) const { + return transform(X(m), Y(m)); + } + + int transform(Coord m, int c) const { + return transform(X(m), Y(m)) + c * kBoardRegion; + } + + // Compute features. + bool getLibertyMap3(Stone player, float* data) const; + bool getLibertyMap(Stone player, float* data) const; + bool getLibertyMap3binary(Stone player, float* data) const; + bool getStones(Stone player, float* data) const; + bool getSimpleKo(Stone player, float* data) const; + bool getHistory(Stone player, float* data) const; + bool getHistoryExp(Stone player, float* data) const; + bool getDistanceMap(Stone player, float* data) const;*/ +}; diff --git a/src_cpp/elfgames/tasks/base/common.h b/src_cpp/elfgames/tasks/base/common.h new file mode 100644 index 0000000..7d67cf8 --- /dev/null +++ b/src_cpp/elfgames/tasks/base/common.h @@ -0,0 +1,66 @@ +/** + * Copyright (c) 2018-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#ifndef _COMMON_H_ +#define _COMMON_H_ + +#include +#include +#include +#include +#include "../Game.h" +#ifdef __cplusplus +extern "C" { +#endif + +double __attribute__((noinline)) wallclock(void); +uint64_t __attribute__((noinline)) wallclock64(); + +void dbg_printf(const char* format, ...); +void error(const char* format, ...); + +#ifdef __cplusplus +} +#endif + +#define __STR_EXPAND(tok) #tok +#define __STR(tok) __STR_EXPAND(tok) + +typedef unsigned short Coord; +typedef unsigned char Stone; + +#define S_EMPTY 0 +#define S_BLACK 1 +#define S_WHITE 2 +#define S_OFF_BOARD 3 + +// Two special moves. +#define M_PASS 0 // (-1, -1) +#define M_RESIGN 1 // (0, -1) +// Used when we want to skip and let the opponent play. +#define M_SKIP 2 +#define M_INVALID 3 +#define M_CLEAR 4 + +#define STR_BOOL(s) ((s) ? "true" : "false") +#define STR_STONE(s) ((s) == S_BLACK ? "B" : ((s) == S_WHITE ? "W" : "U")) + +#define timeit \ + { \ + double __start = wallclock(); + +#define endtime \ + double __duration = wallclock() - __start; \ + printf("Time spent = %lf\n", __duration); \ + } + +#define endtime2(t) \ + t = wallclock() - __start; \ + } + +#endif diff --git a/src_cpp/elfgames/tasks/base/go_common.h b/src_cpp/elfgames/tasks/base/go_common.h new file mode 100644 index 0000000..9b24a83 --- /dev/null +++ b/src_cpp/elfgames/tasks/base/go_common.h @@ -0,0 +1,15 @@ +/** + * Copyright (c) 2018-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +/*#include "board.h" + +constexpr uint64_t BOARD_ACTION_PASS = BOARD_SIZE * BOARD_SIZE; +constexpr uint64_t BOARD_NUM_ACTION = BOARD_SIZE * BOARD_SIZE + 1; + +// Maximum move. +constexpr int BOARD_MAX_MOVE = BOARD_SIZE * BOARD_SIZE * 2;*/ diff --git a/src_cpp/elfgames/tasks/base/go_state.h b/src_cpp/elfgames/tasks/base/go_state.h new file mode 100644 index 0000000..a5d9a99 --- /dev/null +++ b/src_cpp/elfgames/tasks/base/go_state.h @@ -0,0 +1,242 @@ +/** + * Copyright (c) 2018-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#include +#include +#include +#include +#include + +//#include "elfgames/go/sgf/sgf.h" + +#include "board.h" +#include "board_feature.h" + +//class HandicapTable { +// private: +// // handicap table. +// std::unordered_map> _handicaps; +// +// public: +// HandicapTable(); +// void apply(int handi, Board* board) const; +//}; + +/* +inline std::vector +simple_flood_fill(const Board& b, Stone player, std::ostream* oo = nullptr) { + std::queue q; + for (int i = 0; i < BOARD_SIZE; ++i) { + for (int j = 0; j < BOARD_SIZE; ++j) { + Coord c = OFFSETXY(i, j); + if (b._infos[c].color == player) { + q.push(c); + } + } + } + + if (oo != nullptr) + *oo << "For player " << player2str(player) << ": #stone: " << q.size() + << std::endl; + + std::vector open(BOARD_SIZE * BOARD_SIZE, false); + std::vector f(BOARD_SIZE * BOARD_SIZE, false); + + int counter = 0; + while (!q.empty()) { + Coord c = q.front(); + // if (oo != nullptr) *oo << coord2str2(c) << " "; + q.pop(); + f[EXPORT_OFFSET(c)] = true; + counter++; + + FOR4(c, _, cc) + int offset = EXPORT_OFFSET(cc); + if (b._infos[cc].color == S_EMPTY && !open[offset]) { + open[offset] = true; + q.push(cc); + } + ENDFOR4 + } + + if (oo != nullptr) + *oo << std::endl + << "For player " << player2str(player) << ": territory = " << counter + << std::endl; + return f; +} + +inline int simple_tt_scoring(const Board& b, std::ostream* oo = nullptr) { + // No dead stone considered. + // [TODO] Can be more efficient with bitset. + // if (oo != nullptr) *oo << "In tt scoring" << endl; + std::vector black = simple_flood_fill(b, S_BLACK, oo); + std::vector white = simple_flood_fill(b, S_WHITE, oo); + + int black_v = 0, white_v = 0; + for (size_t i = 0; i < black.size(); ++i) { + if (black[i] && !white[i]) + black_v++; + else if (white[i] && !black[i]) + white_v++; + } + + if (oo != nullptr) + *oo << "black_v: " << black_v << ", white: " << white_v << std::endl; + return black_v - white_v; +} +*/ +/*class ChouFleurState { + public: + ChouFleurState() { + reset(); + } + bool forward(const Coord& c); + bool checkMove(const Coord& c) const; + + void setFinalValue(float final_value) { + _final_value = final_value; + _has_final_value = true; + } + float getFinalValue() const { + return _final_value; + } + bool HasFinalValue() const { + return _has_final_value; + } + + void reset(); + void applyHandicap(int handi); + + ChouFleurState(const ChouFleurState& s) + : _history(s._history), + _board_hash(s._board_hash), + _moves(s._moves), + _final_value(s._final_value), + _has_final_value(s._has_final_value) { + copyBoard(&_board, &s._board); + } + + static HandicapTable& handi_table() { + return _handi_table; + } + + const Board& board() const { + return _board; + } + + // Note that ply started from 1. + bool justStarted() const { + return _board._ply == 1; + } + + int getPly() const { + return _board._ply; + } + bool isTwoPass() const { + return _board._last_move == M_PASS && _board._last_move2 == M_PASS; + } + + bool terminated() const { + return isTwoPass() || getPly() >= BOARD_MAX_MOVE || _check_superko(); + } + + Coord lastMove() const { + return _board._last_move; + } + Coord lastMove2() const { + return _board._last_move2; + } + Stone nextPlayer() const { + return _board._next_player; + } + + bool moves_since(size_t* next_move_number, std::vector* moves) const { + if (*next_move_number > _moves.size()) { + // The move number is not right. + return false; + } + moves->clear(); + for (size_t i = *next_move_number; i < _moves.size(); ++i) { + moves->push_back(_moves[i]); + } + *next_move_number = _moves.size(); + return true; + } + + uint64_t getHashCode() const { + return _board._hash; + } + + const std::vector& getAllMoves() const { + return _moves; + } + std::string getAllMovesString() const { + std::stringstream ss; + for (const Coord& c : _moves) { + ss << "[" << coord2str2(c) << "] "; + } + return ss.str(); + } + + std::string showBoard() const { + // char buf[2000]; showBoard2Buf(&_board, SHOW_LAST_MOVE, buf); return std::string(buf) + "\n" + "Last move: " + coord2str2(lastMove()) + ", nextPlayer: " + (nextPlayer() == S_BLACK ? "Black" : "White") + "\n"; + } + + float evaluate(float komi, std::ostream* oo = nullptr) const { + exit(-1); + float final_score = 0.0; + if (_check_superko()) { + final_score = nextPlayer() == S_BLACK ? 1.0 : -1.0; + } else { + final_score = (float)simple_tt_scoring(_board, oo) - komi; + } + + // cout << "Calling evaluate on the current situation, final score: " << + // final_score << endl; + // cout << showBoard(); + return final_score; + } + + // TODO: not a good design.. + const std::deque& getHistory() const { + return _history; + } + + protected: + Board _board; + std::deque _history; + + struct _BoardRecord { + Board::Bits bits; + }; + + std::unordered_map> _board_hash; + + std::vector _moves; + float _final_value = 0.0; + bool _has_final_value = false; + +// static HandicapTable _handi_table; + + bool _check_superko() const; + void _add_board_hash(const Coord& c); +};*/ + +struct ChouFleurReply { + const BoardFeature& bf; + Coord c; + std::vector pi; + float value = 0; + // Model version. + int64_t version = -1; + + ChouFleurReply(const BoardFeature& bf) : bf(bf), pi(StateForChouFleurNumActions, 0.0) {} +}; diff --git a/src_cpp/elfgames/tasks/base/hash_num.h b/src_cpp/elfgames/tasks/base/hash_num.h new file mode 100644 index 0000000..066e691 --- /dev/null +++ b/src_cpp/elfgames/tasks/base/hash_num.h @@ -0,0 +1,160 @@ +/** + * Copyright (c) 2018-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +// Randomly generated 21*21 hash numbers. +const uint64_t _board_hash[] = { + 0x216eb9db61c847b5, 0x42aef2f604c98e93, 0xc30ba4760d5e0271, + 0xae655e33bdebc0e7, 0x70de747b67913228, 0xda003ae9b6998cf1, + 0x74e27d64da89d7f5, 0x1925124836d37fb9, 0x653b3f4070c2bb3a, + 0xe2453c6b4d7bca51, 0x7d2c63fdfa0b6a53, 0xfe680195155cc181, + 0xb86fd7bc8ec309a9, 0xdc63d0aea3bd581a, 0x25320301cc4f89d8, + 0xc9b86ab699249bf4, 0x8905f7bce3715499, 0xb5f270a98e3bfed6, + 0xd40d91cbd5ec4070, 0x5a5de05c6fa33261, 0xdf237706abb4bee2, + 0xfbd4c5585e0e1e7, 0x68abdef12562784b, 0x523be061da550f9e, + 0xf29b17fcf977a5b3, 0x5a860a956d5403d2, 0xcb85dafea8b48da2, + 0xcf5c7e068ff5576, 0x8f891a9267f17705, 0xf0ba26576791f2fc, + 0xa6eae0129b6b0141, 0x7a2c15a763e1a330, 0xcb16f7a68c3051a6, + 0x17c6adddb9c0104d, 0x317a55f4267c90cc, 0xa96e5a43e04937c6, + 0x1df853058080f7c0, 0x984b8cd688e161cd, 0x533d3a40fa5c9385, + 0xf831736c86718dc4, 0xadec4a75c58466a9, 0x175f5e04a6cb512f, + 0xcc885f7162062e71, 0x4a3b8ee63686d865, 0xe9580e44be873e25, + 0xa7341515fd8be9b8, 0xff004a15909d855a, 0x26cdebd817f8f9b, + 0x864744759133ce6a, 0x44822586d0de3de9, 0x7fd4185b9c6c167, + 0xf279cd6242cf3384, 0x5fa1f997197913b5, 0x682b1c6cc5ef69, + 0x4639bb25be2e5631, 0x8feeff0443da9146, 0x2a1216faaba10d21, + 0x32f659b751c76cf1, 0x4a7475a6cad037e2, 0x84f336e193bd244a, + 0x9985eee6ef2633b2, 0xe6522b98ea541ac7, 0xf745b917d61f92f2, + 0xf702dad336b915ba, 0xe2231a939c35a81a, 0xddbeeff62548ecdf, + 0x5b53d2336afe94b2, 0xbb95841805534e4d, 0x8684fe148984099d, + 0x3571b0a9c527f659, 0xa99104cec7afedd, 0x47f0d77494748836, + 0xba773280301b7ba2, 0x31c123e6e72fe196, 0xbe8efc75863594a1, + 0xbad93e0ae377be98, 0xfc1b155352af0597, 0x2b1ec034413b3ef2, + 0x23feb0b498769ff2, 0xce1b47df31525b4c, 0xf678d951b7abcc00, + 0x9d56b2129ed5fb3d, 0x4e823d9341242f9f, 0x455ebdb82cbd8a50, + 0x2432b5fe1584a5f0, 0x66aaa5ddb3a49f7d, 0xdcf8e68e4d06a435, + 0x5c87b6ae1259ca60, 0x769e608aa74861c4, 0x6b7357cb126ba3f0, + 0x9ee8d78a9e82e174, 0xac72c1a4df5b553b, 0x7f1d09e8ae85ae42, + 0x4b2a6382c352ae58, 0xc828ad9aa41c4de5, 0xe33eb5ab9bdaf0f7, + 0x7616eef4efca694b, 0xa939b994bd903f91, 0x9befe5c4e26a2a3f, + 0xec45710edf9a8fd9, 0x1d492717d87deef7, 0x59a2b43fc3ef2ff, + 0x5b0dda5ec6740732, 0x3bf190c62ff4e432, 0xd49fee458f535984, + 0x63a05b052088c94b, 0x6284fb6276665c04, 0x9ba48c2b039e3708, + 0xcca79934bd1e21c0, 0x397de3294a3293c1, 0xf92510c002a535ba, + 0x8a026aa5a7e489f, 0x90fc0649d711f347, 0x963ac1350a769acb, + 0xace8bc8b274f3a8e, 0xcf433fc513125ddf, 0xd269c3612483fd10, + 0xf43b9d841ab3bf27, 0x3d02f63cd8111349, 0xcb4c4b9acb594d90, + 0xc415618a36f78af6, 0xc891ae4e9ac3306c, 0x7bb2ed194a7c5d02, + 0xe476fe9a3cc23fc8, 0x2e8987893aabced, 0xe6e5945b7b4ea069, + 0xdb791925f741f00e, 0xcd939d5146d17521, 0x71023c76e88dca28, + 0x85133d5d90654b27, 0x6e7358bc7900c627, 0xdb6891d28167827f, + 0x684ce868ccd8a485, 0xb4210ba43405f5d6, 0xb27ed83a074dd386, + 0x5ae3071b81ad17e0, 0x90a7a0614e711d87, 0xe88c6de3e2654087, + 0x7f9a43e5d95045b4, 0x5a8ae14d793abbe2, 0x7e277833733a1c30, + 0x71523c25104a2ddc, 0xc4b24f054fe2b7a3, 0xce918f74001dba97, + 0x529f69164421768c, 0x6fc1a29742c67202, 0xb86bcc34bd3a9236, + 0x54a5065c38a639c4, 0x9e868736781af022, 0xa68e242bbeac7b14, + 0x4684242d56c0de99, 0xc1e25aee23db48a4, 0x28109438c36da788, + 0xa9f9f1dd39b6a5, 0x287a50f468a6ec79, 0x73cee11f78a8b608, + 0x331e44556b91c8a7, 0xb31098332ff61631, 0xc47a8ad04b16c577, + 0x615d4e633e80fc12, 0xf8f7951b24cf0cb, 0x1ea6836497413c75, + 0xb9ec7419c0892f5e, 0x96fabe45861f53cd, 0xb96236f6da707d4e, + 0x261c4fbd68fb3b1b, 0x39961cbf3e83a9f4, 0x662ca4a76ce42d7, + 0x4d16748d6fe2493, 0x8fbe7641b245e39c, 0x843bd3feb22c5b4d, + 0x9941513a8aea4528, 0x84e905832706bb99, 0x73c302b44b23a833, + 0x9b039ad42efb229f, 0x174b8664dcfdee98, 0x8f76a50d9242d4d8, + 0xef442fac20cf05c8, 0x2d371097ebdc0233, 0x7dabb83eec13429c, + 0x5bc2e4427e17d383, 0xf6b648b8d2ddc3fd, 0xcde622a517cace58, + 0x97bb317cb02437d9, 0xcb45ba7e0fa432fe, 0xac4fef5d90a55520, + 0x9247701f9aefb704, 0x8e3013f29eaa62aa, 0x892923c2323608ac, + 0x5ebcc97ddfbbf557, 0x8ceca851ba635bb8, 0xb3acffb8089488b5, + 0x5fa8d9b207fc823c, 0x13f349cc43b8e92b, 0x4f3dd4f7bf836efe, + 0x4e4866a48014548, 0x37c80d7635932a1e, 0x94cb3023d4626099, + 0x6f7595b8a596480, 0xe281bb5d4e62c70b, 0x5c93cab868898c64, + 0xef14fb084bd4a42f, 0x6bd81f3a2d48a303, 0x200369727fd8ae65, + 0x74f03e003cd76611, 0x4271ed10e89032db, 0x92f887ac2d038777, + 0xe11c0468f6f99dc, 0x54e823791706d250, 0x3eac7ddbf9c54962, + 0x5729b435070785, 0x2da8bec908898e75, 0x68363d6a2dace09e, + 0xa2e8ae3c470843c2, 0x84f8687a4ece8428, 0xf360c8b00948260b, + 0x8a51839ef20dc311, 0xc07d214bdb1d324, 0x6b2e03afedb06924, + 0x4ba167a9b2bd913b, 0x72dbd35c311f6661, 0x4016db829756cdcf, + 0x1a542fbf0301fbaf, 0x2b1c7b6be84aa2b5, 0x2ff24da72a427da5, + 0x6aea19f2f4027f7e, 0xe46a551823507a86, 0x7e1cbf902862a206, + 0xc3cc6a680be887b3, 0x957c211bb8d864af, 0x46dce7fc18e645b4, + 0x5bfc930766f3370f, 0x1f4144e6ad738a88, 0x36d4f054cc794d9c, + 0xe64abfaa1037ec5b, 0xe2028fa5b5acbf1f, 0x984ca41286631640, + 0x1c084fd0d49c8331, 0xd2476113b8da9aac, 0xa6b595fd7aa79133, + 0xa2c60978c9b5576e, 0x2297a59a7b8fac5, 0xbbc76a402269261b, + 0xe3d6195507456f61, 0x21224246cf005216, 0x66162c382feb1970, + 0x16ed1e5a668b9c48, 0x52b9586897b44f51, 0x371bb9ed51217ae, + 0x2c4822b1158bc3cc, 0xd78b75015ddc3dbd, 0xa451036486b04fc2, + 0x95c12ae7d02ecab7, 0x36d6ad5a9d6471cd, 0x96cf8fcc14e96a4c, + 0xfc84a83062ae2d88, 0x9377459581eb2f78, 0x48690bd724c49a09, + 0x18423b6f44b8d981, 0xec46bb6c618d8dd4, 0x7dd4b0ae5e14c509, + 0x5d66eac4769cb54d, 0xa377539c6044392a, 0xaa0a528d085cb226, + 0x9c1f566710696424, 0xb6e5a34bdab52a52, 0xb642c1159ce2b903, + 0x927d932cf0ac39b6, 0xb713cfe53855c75b, 0x482f5199b2986de1, + 0xb79d27bc2e27d03b, 0x5f1a4f2fbce9e632, 0x78be2940fd4f65ed, + 0x7169f244230bab04, 0x61e259b7b68d2c9f, 0x71fce5e36b4aa000, + 0xb27b2a48ab621963, 0x34da43645f778b59, 0xab2cc40fbeadf898, + 0x83031a48c47525fe, 0x5c28d2c37ee137c, 0xb4cc5658b65d54dd, + 0xbee897784ab56456, 0x968cb4f182baba8, 0xc0724ee77c241345, + 0xd354092cb692811e, 0xe0ca91de3c86dc71, 0x37fafc5f7a508a86, + 0x20d3237c2aaeecc5, 0xadb3be359832044a, 0x62a6ccfe3d33807c, + 0x984abf100a085441, 0xd44ef65ab25809b6, 0x38c122f88aaaacf6, + 0xacdc3d16852aeca, 0xd726b92ef6cde948, 0x2d9cb846e1baba5c, + 0x7226e583e3297397, 0xaa09c9e896740994, 0x18e64f970059c3c7, + 0x56c10dfa0b286206, 0x456151c5f5a2578d, 0xcbcc8886155d1c0b, + 0xc6b0d23870b5e8a7, 0xb895c0b6ed0c72eb, 0x3cacd27183a23b5d, + 0x570dd1636ed434bd, 0x69053622298339cd, 0x366145083ecad362, + 0x8f8aa40c8efbb93e, 0x57eb9f92212cc01b, 0x87c619c4c9f0aef8, + 0xa9047142fbd05ed2, 0xe5703340a9e438a3, 0xe9b63e399714ca4a, + 0x6ebb5719844e338b, 0xfe76fe2c502c34e1, 0xdf690edc43114fc2, + 0x38709ea5f783eebb, 0xd21d7efc73649e5c, 0x73aefee26fa42a7c, + 0xe4bf5096734761ee, 0xea2e1a7322192d1e, 0xd2675a58635c8129, + 0x5c6a3e7762bb841c, 0x8e4905c2fb5c152f, 0x8e0ab755723c0f8e, + 0x40ead58ac81aacec, 0xe7c4823ee6fc561, 0x70b3b9fb14268acb, + 0x855ff908cd8b511, 0x8084cce7cbeedd02, 0x9d8f2a3133c95138, + 0xcf6a05b56b19a4da, 0xbfb1eefa0f5a3a91, 0xe8f6a06c2ada2286, + 0x5c838204bd40121e, 0x25965a4fe4f986c, 0x5160548b155792c1, + 0x409ec9498c1a0229, 0x5f03db1bb83757fe, 0x512693448ad7b3de, + 0x91ad165f5ea494af, 0xed01bc5137f69066, 0xde93fe00262830f9, + 0xbea4635dcbbcea01, 0x6bfd43de4f89c1c8, 0x6e82f555260003c, + 0xf776865a61fa88bb, 0xc3231519572393c6, 0x858a5558d026f5c6, + 0xcaa7089e21956b4e, 0xf7750b49d07fc5d3, 0x919db355d7ec7082, + 0x2de516f911c42751, 0x300c1e0917017c6e, 0x88db4622ebb0b59d, + 0xdbec2f9aa57a2292, 0x77507cf5fe9f1a03, 0xcf7e9fefe1536b7a, + 0x6cb3d5b66267c88a, 0x67060920569ebffb, 0xcb3108397444cfa7, + 0x49f2c916471b541, 0x8a7177972c348111, 0xe2d796545b2668ba, + 0x9a1d5ccb9400224b, 0x7011b0d62cf6d86d, 0x6a7866b47396706c, + 0xa459a476f9b81633, 0x3c3315269e091997, 0x3efdffed592a0460, + 0x3d744b0a6e4c1626, 0xe8399331f67160ae, 0xd050c0bdcb2f6ef3, + 0xc29807a229c373a, 0xdf766123272d120e, 0x8832f13dfddcfa3d, + 0x440d1b7955f84ae4, 0x6917ec8004bf92aa, 0xe18b9a77e9882134, + 0x8e270dafafca1ffb, 0xfd47950a93b8a273, 0x2614d5ac3edf0f61, + 0x50d1045205a67535, 0x1674ccb5961a5a6d, 0x4b01436476a3e3e5, + 0x3b5fca752d38400e, 0xd56835d65e70f639, 0xc2920628d4326060, + 0x9cd5017408e1bd42, 0x7a2f94847ecc0ac4, 0x668a164cfdde675d, + 0x230b7c2e36590c7d, 0xb0e13d44eb558d50, 0x1b7b242d17a03134, + 0x827b64bffb2fe4f0, 0xfd0a35b43fc2a51e, 0xde6e9493de024da3, + 0x6e75e946c5de9d89, 0x7c12d56aa006d63b, 0xd1fd5132db1bd165, + 0xd8b9691759049c58, 0x1139114fdd9b2e2a, 0xd3add92765eebab2, + 0xdfa1cd70c84fc3b5, 0x7e7c4e50744e950, 0xb49469aedb6ad0e9, + 0x7228dd4bf8fd2fec, 0xa8b97d470271e45f, 0x401b2a84c68e0edd, + 0x1bdf2bc379d4b2f9, 0x54c8cc1b72bc5ea7, 0x5ee4b0ab17b07010, + 0x1303480204c72f3c, 0x136ab4ae4eff90bf, 0xa34611e6a5eef376, + 0xde15ceeadc59ac34, 0xf08c65a12c87c493, 0x5c2febc9a52c91f0, + 0x1fb4d0ef7ae12a56, 0xe853cdc417cc82ab, 0x2356bd556946108c, + 0x4af4396ced355b2b, 0x1024c12632475f0b, 0x1ee28b7003074669, + 0x90ab7ebda1eba1a8, 0x9fe13e6f6bd966e9, 0x494249844f4165f0, + 0xa3aa3eaf75e17443, 0xc7e680dc68df2f71, 0x1000643ee15a98fd, + 0x77b02107980b1f3c, 0xfbad6df080a869ad, 0xee9262e7e8eafc89, + 0xaa3f62d4ddcaa981, 0x29ba35049c9fae77, 0x5dcbcde63dd01a8d, + 0xfc9e769c17b8e7be, 0xe08526ac653fc545, 0x2ab72b847ff9f50f, +}; diff --git a/src_cpp/elfgames/tasks/common/dispatcher_callback.h b/src_cpp/elfgames/tasks/common/dispatcher_callback.h new file mode 100644 index 0000000..9311a91 --- /dev/null +++ b/src_cpp/elfgames/tasks/common/dispatcher_callback.h @@ -0,0 +1,97 @@ +#pragma once + +#include "elf/base/context.h" +#include "elf/base/dispatcher.h" +#include "record.h" + +using Ctrl = elf::Ctrl; +using Addr = elf::Addr; +using ThreadedDispatcher = elf::ThreadedDispatcherT; + +class DispatcherCallback { + public: + DispatcherCallback(ThreadedDispatcher* dispatcher, elf::GameClient* client) + : client_(client) { + using std::placeholders::_1; + using std::placeholders::_2; + + dispatcher->Start( + std::bind(&DispatcherCallback::OnReply, this, _1, _2), + std::bind(&DispatcherCallback::OnFirstSend, this, _1, _2)); + } + + void OnFirstSend(const Addr& addr, MsgRequest* request) { + const size_t thread_idx = stoi(addr.label.substr(5)); + if (thread_idx == 0) { + // Actionable request + std::cout << elf_utils::now() + << ", EvalCtrl get new request: " << request->info() + << std::endl; + } + + int thread_used = request->client_ctrl.num_game_thread_used; + if (thread_used < 0) + return; + + if (thread_idx >= (size_t)thread_used) { + request->vers.set_wait(); + } + } + + std::vector OnReply( + const std::vector& requests, + std::vector* p_replies) { + auto& replies = *p_replies; + + const MsgRequest* request = nullptr; + size_t n = 0; + + for (size_t i = 0; i < replies.size(); ++i) { + // std::cout << "EvalCtrl: Get confirm from " << msg.second.result << ", + // game_idx = " << msg.second.game_idx << std::endl; + switch (replies[i]) { + case RestartReply::UPDATE_MODEL: + case RestartReply::UPDATE_MODEL_ASYNC: + if (request != nullptr && *request != requests[i]) { + std::cout << elf_utils::now() + << "Request inconsistent. existing request: " + << request->info() + << ", now request: " << requests[i].info() << std::endl; + throw std::runtime_error("Request inconsistent!"); + } + request = &requests[i]; + n++; + break; + default: + break; + } + } + + std::vector next_session(replies.size(), false); + + if (request != nullptr) { + // Once it is done, send to Python side. + std::cout << elf_utils::now() << " Get actionable request: black_ver = " + << request->vers.black_ver + << ", white_ver = " << request->vers.white_ver + << ", #addrs_to_reply: " << n << std::endl; + elf::FuncsWithState funcs = + client_->BindStateToFunctions({start_target_}, &request->vers); + client_->sendWait({start_target_}, &funcs); + + for (size_t i = 0; i < replies.size(); ++i) { + RestartReply& r = replies[i]; + if (r == RestartReply::UPDATE_MODEL) { + r = RestartReply::UPDATE_COMPLETE; + next_session[i] = true; + } + } + } + + return next_session; + } + + private: + elf::GameClient* client_ = nullptr; + const std::string start_target_ = "game_start"; +}; diff --git a/src_cpp/elfgames/tasks/common/game_base.h b/src_cpp/elfgames/tasks/common/game_base.h new file mode 100644 index 0000000..8cbbd76 --- /dev/null +++ b/src_cpp/elfgames/tasks/common/game_base.h @@ -0,0 +1,62 @@ +/** + * Copyright (c) 2018-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#include "elf/base/context.h" +#include "elf/legacy/python_options_utils_cpp.h" +#include "elf/utils/utils.h" + +#include "game_feature.h" + +class ChouFleurGameBase { + public: + ChouFleurGameBase( + int game_idx, + elf::GameClient* client, + const ContextOptions& context_options, + const GameOptions& options) + : client_(client), + _game_idx(game_idx), + _options(options), + _context_options(context_options) { + _seed = elf_utils::get_seed( + game_idx ^ std::hash{}(context_options.job_id)); +/* if (options.seed == 0) { + _seed = elf_utils::get_seed( + game_idx ^ std::hash{}(context_options.job_id)); + } else { + _seed = options.seed; + }*/ + _rng.seed(_seed); + } + + void mainLoop() { + /*if (_options.verbose) + std::cout << "[" << _game_idx << "] Seed:" << _seed + << ", thread_id: " << std::this_thread::get_id() << std::endl;*/ + // Main loop of the game. + while (!client_->DoStopGames()) { + act(); + } + } + + virtual void act() = 0; + + virtual ~ChouFleurGameBase() = default; + + protected: + elf::GameClient* client_ = nullptr; + uint64_t _seed = 0; + std::mt19937 _rng; + + int _game_idx = -1; + + GameOptions _options; + ContextOptions _context_options; +}; diff --git a/src_cpp/elfgames/tasks/common/game_feature.h b/src_cpp/elfgames/tasks/common/game_feature.h new file mode 100644 index 0000000..eff4c8d --- /dev/null +++ b/src_cpp/elfgames/tasks/common/game_feature.h @@ -0,0 +1,270 @@ +/** + * Copyright (c) 2018-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + + +#pragma once + +//#define OUTSIZE 2 +#define OUTSIZE 18*18*4 + +#include "../base/go_state.h" +#include "go_game_specific.h" +#include "go_state_ext.h" +#include "../Game.h" +#include "elf/base/extractor.h" + +#define UNUSED(expr) do { (void)(expr); } while (0) + + +enum SpecialActionType { SA_SKIP = -100, SA_PASS, SA_RESIGN, SA_CLEAR }; + +class ChouFleurFeature { + public: + ChouFleurFeature(const GameOptions& options) : options_(options) { + //std::cout << "ChouFleurFeature" << std::endl; + if (options.use_df_feature) { + /*_num_plane = MAX_NUM_FEATURE; + _our_stone_plane = OUR_STONES; + _opponent_stone_plane = OPPONENT_STONES;*/ + } else { + /*_num_plane = MAX_NUM_AGZ_FEATURE; + _our_stone_plane = 0; + _opponent_stone_plane = 1;*/ + } + _num_plane = StateForChouFleurX;// * StateForChouFleurY * StateForChouFleurZ; // FIXME // YOU MUST MODIFY THIS IF YOU MODIFY GAME.H / Game.h + } + + // Inference part. + static void extractState(const BoardFeature& bf, float* f) { + //std::cout << "extractState1 for ChouFleur" << std::endl; + bf.extract(f); + //std::cout << "extractState1ok for ChouFleur" << std::endl; + } + + static void extractStateAGZ(const BoardFeature& bf, float* f) { + //std::cout << "extractState2 for ChouFleur" << std::endl; + bf.extractAGZ(f); + //std::cout << "extractState2ok for ChouFleur" << std::endl; + } + + static void ReplyValue(ChouFleurReply& reply, const float* value) { + //std::cout << "ReplyValue for ChouFleur" << std::endl; + reply.value = *value; + //std::cout << "ReplyValueok for ChouFleur" << std::endl; + } + + static void ReplyPolicy(ChouFleurReply& reply, const float* pi) { + //std::cout << "ReplyPolicy for ChouFleur" << std::endl; + copy(pi, pi + reply.pi.size(), reply.pi.begin()); + //std::cout << "ReplyPolicyok for ChouFleur" << std::endl; + } + + static void ReplyAction(ChouFleurReply& reply, const int64_t* action) { + //std::cout << "ReplyAction" << std::endl; + switch ((SpecialActionType)*action) { + case SA_RESIGN: + reply.c = M_RESIGN; + break; + case SA_SKIP: + reply.c = M_SKIP; + break; + case SA_PASS: + reply.c = M_PASS; + break; + case SA_CLEAR: + reply.c = M_CLEAR; + break; + default: + reply.c = reply.bf.action2Coord(*action); // FIXME + } + //std::cout << "ReplyActionok " << reply.c << "}}" << std::endl; + } + + static void ReplyVersion(ChouFleurReply& reply, const int64_t* ver) { + reply.version = *ver; + } + + ///////////// + // Training part. + static void extractMoveIdx(const ChouFleurStateExtOffline& s, int* move_idx) { + *move_idx = s._state.getPly() - 1; + } + + static void extractNumMove(const ChouFleurStateExtOffline& s, int* num_move) { + *num_move = s.getNumMoves(); + } + + static void extractPredictedValue( + const ChouFleurStateExtOffline& s, + float* predicted_value) { + *predicted_value = s.getPredictedValue(s._state.getPly() - 1); + } + + static void extractAugCode(const ChouFleurStateExtOffline& s, int* code) { + UNUSED(s); + UNUSED(code); + //*code = s._bf.getD4Code(); + std::cout << "no idea what is this bug" << std::endl; + exit(-1); + } + + static void extractWinner(const ChouFleurStateExtOffline& s, float* winner) { + *winner = s._offline_winner; + } + + static void extractStateExt(const ChouFleurStateExtOffline& s, float* f) { + std::cout << "extractYOState for ChouFleur --- BUG" << std::endl; + // Then send the data to the server. + exit(-1); // I believe FIXME that this is not used so I can just put exit(-1) + extractState(s._bf, f); + } + + static void extractStateExtAGZ(const ChouFleurStateExtOffline& s, float* f) { + //std::cout << "extractStateExtAGZ for ChouFleur" << std::endl; + // Then send the data to the server. + extractStateAGZ(s._bf, f); + //std::cout << "extractStateExtAGZOk for ChouFleur" << std::endl; + } + + static void extractMCTSPi(const ChouFleurStateExtOffline& s, float* mcts_scores) { + std::cout << "extractMCTSPi for ChouFleur" << std::endl; + const BoardFeature& bf = s._bf; + const size_t move_to = s._state.getPly() - 1; + unsigned int BOARD_NUM_ACTION = OUTSIZE; //StateForChouFleurNumActions; TODO FIXME + std::fill(mcts_scores, mcts_scores + BOARD_NUM_ACTION, 0.0); + if (move_to < s._mcts_policies.size()) { + const auto& policy = s._mcts_policies[move_to].prob; + float sum_v = 0.0; + for (size_t i = 0; i < BOARD_NUM_ACTION; ++i) { + mcts_scores[i] = policy[bf.action2Coord(i)]; + sum_v += mcts_scores[i]; + } + // Then we normalize. + for (size_t i = 0; i < BOARD_NUM_ACTION; ++i) { + mcts_scores[i] /= sum_v; + std::cout << "mcts_score" << i << " = " << mcts_scores[i] << std::endl; + } + } else { +// mcts_scores[bf.coord2Action(s._offline_all_moves[move_to])] = 1.0; + mcts_scores[bf.coord2Action(s._offline_all_moves[move_to])] = 1.0; + } + std::cout << "extractMCTSPiok for ChouFleur" << std::endl; + } + + static void extractOfflineAction( + const ChouFleurStateExtOffline& s, + int64_t* offline_a) { + //std::cout << "extractOfflineAction/gf" << std::endl; + const BoardFeature& bf = s._bf; + + std::fill(offline_a, offline_a + s._options.num_future_actions, 0); + const size_t move_to = s._state.getPly() - 1; + for (int i = 0; i < s._options.num_future_actions; ++i) { + Coord m = s._offline_all_moves[move_to + i]; + offline_a[i] = bf.coord2Action(m); + } + } + + static void extractStateSelfplayVersion( + const ChouFleurStateExtOffline& s, + int64_t* ver) { + //std::cout << "extractStateSelfplayVersion/gf" << std::endl; + *ver = s.curr_request_.vers.black_ver; + } + + static void extractAIModelBlackVersion(const ModelPair& msg, int64_t* ver) { + //std::cout << "extractAIModelBlackVersion/gf" << std::endl; + *ver = msg.black_ver; + } + + static void extractAIModelWhiteVersion(const ModelPair& msg, int64_t* ver) { + //std::cout << "extractAIModelWhiteVersion/gf" << std::endl; + *ver = msg.white_ver; + } + + static void extractSelfplayVersion(const MsgVersion& msg, int64_t* ver) { + //std::cout << "extractSelfPlayVersion/gf" << std::endl; + *ver = msg.model_ver; + } + + void registerExtractor(int batchsize, elf::Extractor& e) { + // Register multiple fields. + std::cout << " registerExtractor" << std::endl; + auto& s = e.addField("s").addExtents( + batchsize, {batchsize, StateForChouFleurX, StateForChouFleurY, StateForChouFleurZ}); // FIXME + if (options_.use_df_feature) { + s.addFunction(extractState) + .addFunction(extractStateExt); + } else { + s.addFunction(extractStateAGZ) + .addFunction(extractStateExtAGZ); + } + + std::cout << "middle - registerExtractor" << std::endl; + unsigned int BOARD_NUM_ACTION = OUTSIZE; //StateForChouFleurNumActions; TODO FIXME + e.addField("a").addExtent(batchsize); + e.addField("rv").addExtent(batchsize); + e.addField("offline_a") + .addExtents(batchsize, {batchsize, static_cast(BOARD_NUM_ACTION)}); //options_.num_future_actions}); + e.addField({"V", "winner", "predicted_value"}).addExtent(batchsize); + e.addField({"pi", "mcts_scores"}) + .addExtents(batchsize, {batchsize, static_cast(BOARD_NUM_ACTION)}); + e.addField({"move_idx", "aug_code", "num_move"}) + .addExtent(batchsize); + + e.addField({"black_ver", "white_ver", "selfplay_ver"}) + .addExtent(batchsize); + + e.addClass() + .addFunction("a", ReplyAction) + .addFunction("pi", ReplyPolicy) + .addFunction("V", ReplyValue) + .addFunction("rv", ReplyVersion); + + e.addClass() + .addFunction("move_idx", extractMoveIdx) + .addFunction("num_move", extractNumMove) + .addFunction("predicted_value", extractPredictedValue) + .addFunction("aug_code", extractAugCode) + .addFunction("winner", extractWinner) + .addFunction("mcts_scores", extractMCTSPi) + .addFunction("offline_a", extractOfflineAction) + .addFunction("selfplay_ver", extractStateSelfplayVersion); + + e.addClass() + .addFunction("black_ver", extractAIModelBlackVersion) + .addFunction("white_ver", extractAIModelWhiteVersion); + + e.addClass().addFunction( + "selfplay_ver", extractSelfplayVersion); + std::cout << " registerExtractor ok" << std::endl; + } + + std::map getParams() const { + unsigned int BOARD_NUM_ACTION = StateForChouFleurNumActions; + return std::map{ + {"num_action", static_cast(BOARD_NUM_ACTION)}, + {"board_size", -1}, + {"num_future_actions", options_.num_future_actions}, + {"num_planes", _num_plane}, + {"our_stone_plane", _our_stone_plane}, + {"opponent_stone_plane", _opponent_stone_plane}, + {"ACTION_SKIP", SA_SKIP}, + {"ACTION_PASS", SA_PASS}, + {"ACTION_RESIGN", SA_RESIGN}, + {"ACTION_CLEAR", SA_CLEAR}, + }; + } + + private: + GameOptions options_; + + int _num_plane; + int _our_stone_plane; + int _opponent_stone_plane; +}; diff --git a/src_cpp/elfgames/tasks/common/game_selfplay.cc b/src_cpp/elfgames/tasks/common/game_selfplay.cc new file mode 100644 index 0000000..eb69bfd --- /dev/null +++ b/src_cpp/elfgames/tasks/common/game_selfplay.cc @@ -0,0 +1,473 @@ +/** + * Copyright (c) 2018-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#include "game_selfplay.h" +#include "../mcts/ai.h" +#include "../mcts/mcts.h" +#include "go_game_specific.h" + +////////////////// GoGame ///////////////////// +ChouFleurGameSelfPlay::ChouFleurGameSelfPlay( + int game_idx, + elf::GameClient* client, + const ContextOptions& context_options, + const GameOptions& options, + ThreadedDispatcher* dispatcher, + GameNotifierBase* notifier) + : ChouFleurGameBase(game_idx, client, context_options, options), + dispatcher_(dispatcher), + notifier_(notifier), + _state_ext(game_idx, options), + logger_(elf::logging::getIndexedLogger( + "elfgames::go::ChouFleurGameSelfPlay-" + std::to_string(game_idx) + "-", + "")) {} + +MCTSChouFleurAI* ChouFleurGameSelfPlay::init_ai( + const std::string& actor_name, + const elf::ai::tree_search::TSOptions& mcts_options, + float puct_override, + int mcts_rollout_per_batch_override, + int mcts_rollout_per_thread_override, + int64_t model_ver) { + logger_->info( + "Initializing actor {}; puct_override: {}; batch_override: {}; " + "per_thread_override: {}", + actor_name, + puct_override, + mcts_rollout_per_batch_override, + mcts_rollout_per_thread_override); + + MCTSActorParams params; + params.actor_name = actor_name; + params.seed = _rng(); + //params.ply_pass_enabled = _options.ply_pass_enabled; + //params.komi = _options.komi; + params.required_version = model_ver; + + elf::ai::tree_search::TSOptions opt = mcts_options; + if (puct_override > 0.0) { + logger_->warn( + "PUCT overridden: {} -> {}", opt.alg_opt.c_puct, puct_override); + opt.alg_opt.c_puct = puct_override; + } + if (mcts_rollout_per_batch_override > 0) { + logger_->warn( + "Batch size overridden: {} -> {}", + opt.num_rollouts_per_batch, + mcts_rollout_per_batch_override); + opt.num_rollouts_per_batch = mcts_rollout_per_batch_override; + } + if (mcts_rollout_per_thread_override > 0) { + logger_->warn( + "Rollouts per thread overridden: {} -> {}", + opt.num_rollouts_per_thread, + mcts_rollout_per_thread_override); + opt.num_rollouts_per_thread = mcts_rollout_per_thread_override; + } + if (opt.verbose) { + opt.log_prefix = "ts-game" + std::to_string(_game_idx) + "-mcts"; + logger_->warn("Log prefix {}", opt.log_prefix); + } + + return new MCTSChouFleurAI(opt, [&](int) { return new MCTSActor(client_, params); }); +} + +Coord ChouFleurGameSelfPlay::mcts_make_diverse_move(MCTSChouFleurAI* mcts_go_ai, Coord c) { + auto policy = mcts_go_ai->getMCTSPolicy(); + + /* FIXME I am not sure of what I am doing here... can I just skip this ? + bool diverse_policy = + _state_ext.state().getPly() <= _options.policy_distri_cutoff; + if (diverse_policy) { + // Sample from the policy. + c = policy.sampleAction(&_rng); + if (show_board) { + cout << "Move changed to [" << c << "][" << coord2str(c) << "][" << + coord2str2(c) << "]" << endl; + } + } + if (_options.policy_distri_training_for_all || diverse_policy) { + // [TODO]: Warning: MCTS Policy might not correspond to move idx. + _state_ext.addMCTSPolicy(policy); + } + */ + + return c; +} + +Coord ChouFleurGameSelfPlay::mcts_update_info(MCTSChouFleurAI* mcts_go_ai, Coord c) { + float predicted_value = mcts_go_ai->getValue(); + + _state_ext.addPredictedValue(predicted_value); + + if (!_options.dump_record_prefix.empty()) { + _state_ext.saveCurrentTree(mcts_go_ai->getCurrentTree()); + } + +/* bool we_are_good = _state_ext.state().nextPlayer() == 1 //S_BLACK FIXME S_BLACK==1 + ? ((getScore() > 0) && (predicted_value > 0.9)) + : ((getScore() < 0) && (predicted_value < -0.9)); + // If the opponent wants pass, and we are in good, we follow. + if (_human_player != nullptr && we_are_good && + _state_ext.state().lastMove() == M_PASS && _options.following_pass) + c = M_PASS;*/ + + // Check the ranking of selected move. + if (notifier_ != nullptr) { + notifier_->OnMCTSResult(c, mcts_go_ai->getLastResult()); + } + return c; +} + +void ChouFleurGameSelfPlay::finish_game(FinishReason reason) { + //std::cout << ("client side ---- let us finish the game") << std::endl; + if (!_state_ext.currRequest().vers.is_selfplay() && + _options.cheat_eval_new_model_wins_half) { + reason = FR_CHEAT_NEWER_WINS_HALF; + } + if (_state_ext.currRequest().vers.is_selfplay() && + _options.cheat_selfplay_random_result) { + reason = FR_CHEAT_SELFPLAY_RANDOM_RESULT; + } + + _state_ext.setFinalValue(reason, &_rng); + _state_ext.showFinishInfo(reason); + +/* if (!_options.dump_record_prefix.empty()) { + _state_ext.dumpSgf(); + }*/ + + if (_options.print_result) { + // lock_guard lock(_mutex); + // cout << endl << (final_value > 0 ? "Black" : "White") << " win. Ply: " << + // _state.getPly() << ", Value: " << final_value << ", Predicted: " << + // predicted_value << endl; + } + + // reset tree if MCTS_AI, otherwise just do nothing + _ai->endGame(_state_ext.state()); + if (_ai2 != nullptr) { + _ai2->endGame(_state_ext.state()); + } + + if (notifier_ != nullptr) { + notifier_->OnGameEnd(_state_ext); + } + // clear state, MCTS polices et.al. + _state_ext.restart(); + //std::cout << ("client side ---- let us finish the game END") << std::endl; +} + +void ChouFleurGameSelfPlay::setAsync() { + _ai->setRequiredVersion(-1); + if (_ai2 != nullptr) + _ai2->setRequiredVersion(-1); + + _state_ext.addCurrentModel(); +} + +void ChouFleurGameSelfPlay::restart() { + const MsgRequest& request = _state_ext.currRequest(); + bool async = request.client_ctrl.async; + + _ai.reset(nullptr); + _ai2.reset(nullptr); + if (_options.mode == "selfplay") { + _ai.reset(init_ai( + "actor_black", + request.vers.mcts_opt, + -1.0, + -1, + -1, + async ? -1 : request.vers.black_ver)); + if (request.vers.white_ver >= 0) { + _ai2.reset(init_ai( + "actor_white", + request.vers.mcts_opt, + _state_ext.options().white_puct, + _state_ext.options().white_mcts_rollout_per_batch, + _state_ext.options().white_mcts_rollout_per_thread, + async ? -1 : request.vers.white_ver)); + } + if (!request.vers.is_selfplay() && request.client_ctrl.player_swap) { + // Swap the two pointer. + swap(_ai, _ai2); + } + } else if (_options.mode == "online") { + _ai.reset(init_ai( + "actor_black", + request.vers.mcts_opt, + -1.0, + -1, + -1, + request.vers.black_ver)); + _human_player.reset(new AI(client_, {"human_actor"})); + } else { + logger_->critical("Unknown mode! {}", _options.mode); + throw std::range_error("Unknown mode"); + } + + _state_ext.restart(); + + /*if (!_options.preload_sgf.empty()) { + // Load an SGF file and follow this sgf while playing. + _preload_sgf.load(_options.preload_sgf); + _sgf_iter = _preload_sgf.begin(); + int i = 0; + while (!_sgf_iter.done() && i < _options.preload_sgf_move_to) { + auto curr = _sgf_iter.getCurrMove(); + if (!_state_ext.forward(curr.move)) { + logger_->critical( + "Board: {}; proposed invalid move: {}", + _state_ext.state().showBoard(), + elf::ai::tree_search::ActionTrait::to_string(curr.move)); + throw std::runtime_error("Preload sgf: move not valid!"); + } + i++; + ++_sgf_iter; + } + }*/ +} + +bool ChouFleurGameSelfPlay::OnReceive(const MsgRequest& request, RestartReply* reply) { + if (*reply == RestartReply::UPDATE_COMPLETE) + return false; + //std::cout << ("on the client side --- OnReceive") << std::endl; + bool is_waiting = request.vers.wait(); + bool is_prev_waiting = _state_ext.currRequest().vers.wait(); + + if (_options.verbose && !(is_waiting && is_prev_waiting)) { + logger_->debug( + "Receive request: {}, old: {}", + (!is_waiting ? request.info() : "[wait]"), + (!is_prev_waiting ? _state_ext.currRequest().info() : "[wait]")); + } + + bool same_vers = (request.vers == _state_ext.currRequest().vers); + bool same_player_swap = + (request.client_ctrl.player_swap == + _state_ext.currRequest().client_ctrl.player_swap); + + bool async = request.client_ctrl.async; + + bool no_restart = + (same_vers || async) && same_player_swap && !is_prev_waiting; + + // Then we need to reset everything. + _state_ext.setRequest(request); + + //std::cout << ("on the client side --- OnReceive END") << std::endl; + if (is_waiting) { + *reply = RestartReply::ONLY_WAIT; + return false; + } else { + if (!no_restart) { + restart(); + *reply = RestartReply::UPDATE_MODEL; + return true; + } else { + if (!async) + *reply = RestartReply::UPDATE_REQUEST_ONLY; + else { + setAsync(); + if (same_vers) + *reply = RestartReply::UPDATE_REQUEST_ONLY; + else + *reply = RestartReply::UPDATE_MODEL_ASYNC; + } + return false; + } + } +} + +void ChouFleurGameSelfPlay::act() { + if (_online_counter % 5 == 0) { + using std::placeholders::_1; + using std::placeholders::_2; + auto f = std::bind(&ChouFleurGameSelfPlay::OnReceive, this, _1, _2); + + do { + dispatcher_->checkMessage(_state_ext.currRequest().vers.wait(), f); + } while (_state_ext.currRequest().vers.wait()); + + // Check request every 5 times. + // Update current state. + if (notifier_ != nullptr) { + // std::cout << "Thread[" << _game_idx << ",ply:" << + // _state_ext.state().getPly() + // << "] state updating: " << _state_ext.getThreadState().info() << + // std::endl; + notifier_->OnStateUpdate(_state_ext.getThreadState()); + } + } + _online_counter++; + + bool show_board = (_options.verbose && _context_options.num_games == 1); + const StateForChouFleur& s = _state_ext.state(); + + if (_human_player != nullptr) { + std::cout << "we see a human" << std::endl; + do { + if (s.terminated()) { + std::cout << "there is a human in the loop ?" << std::endl; + finish_game(FR_ILLEGAL); + return; + } + + BoardFeature bf(s); + ChouFleurReply reply(bf); + _human_player->act(bf, &reply); + // skip the current move, and ask the ai to move. + if (reply.c == M_SKIP) + break; + if (reply.c == M_CLEAR) { + if (!_state_ext.state().justStarted()) { //FIXME: presumably I can just skip this. + finish_game(FR_CLEAR); + } + return; + } + + if (reply.c == M_RESIGN) { + finish_game(FR_RESIGN); + return; + } + // Otherwise we forward. + if (_state_ext.forward(reply.c)) { +// std::cout << "zehash forward" << _state_ext.state().GetHash(); + /* if (_state_ext.state().isTwoPass()) { + // If the human opponent pass, we pass as well. + finish_game(FR_TWO_PASSES); + }*/ + return; + } + logger_->warn("invalid move {}", +// "Invalid move: x = {} y = {} move: {} please try again", +// X(reply.c), +// Y(reply.c), + std::to_string(reply.c)); + } while (!client_->checkPrepareToStop()); + } else { + // If re receive this, then we should not send games anymore + // (otherwise the process never stops) +// std::cout << "zehash " << _state_ext.state().GetHash() << std::endl; + if (client_->checkPrepareToStop()) { + // [TODO] A lot of hack here. We need to fix it later. + AI ai(client_, {"actor_black"}); + BoardFeature bf(s); + ChouFleurReply reply(bf); + ai.act(bf, &reply); +// std::cout << "zehash black ai act" << reply.c << std::endl; + + if (client_->DoStopGames()) + return; + + AI ai_white(client_, {"actor_white"}); + ai_white.act(bf, &reply); +// std::cout << "zehash white ai act" << reply.c << std::endl; + + elf::FuncsWithState funcs = client_->BindStateToFunctions( + {"game_start"}, &_state_ext.currRequest().vers); + client_->sendWait({"game_start"}, &funcs); + + funcs = client_->BindStateToFunctions({"game_end"}, &_state_ext.state()); + client_->sendWait({"game_end"}, &funcs); + + logger_->info("Received command to prepare to stop"); + std::this_thread::sleep_for(std::chrono::seconds(1)); + return; + } + } + + Stone player = s.nextPlayer(); + + Coord c = M_INVALID; + bool use_dga = + (player == S_WHITE && _options.white_use_dga) || + (player == S_BLACK && _options.black_use_dga); + if (use_dga) { + // we use the heuristic hard-coded in Game.h. + //std::cout << "client side --- USE DO GOOD ACTION" << std::endl; + _state_ext.GetState().DoGoodAction(); + } else { + bool use_policy_network_only = + (player == S_WHITE && _options.white_use_policy_network_only) || + (player == S_BLACK && _options.black_use_policy_network_only); + MCTSChouFleurAI* curr_ai = + ((_ai2 != nullptr && player == S_WHITE) ? _ai2.get() : _ai.get()); + + if (use_policy_network_only) { + // Then we only use policy network to move. + curr_ai->actPolicyOnly(s, &c); + std::cout << "side[" << elf::ai::tree_search::ActionTrait::to_string(c) << "]" << std::endl; + } else { + //std::cout << "client side: choose a move for the current board..." << std::endl; + curr_ai->act(s, &c); + //std::cout << "client side: choose a move for the current board...[ " << elf::ai::tree_search::ActionTrait::to_string(c) << "]act" << std::endl; + c = mcts_make_diverse_move(curr_ai, c); + //std::cout << "client side: choose a move for the current board...[ " << elf::ai::tree_search::ActionTrait::to_string(c) << "]diverse" << std::endl; + //std::cout <<"client side: choose a move for the current board... END" << std::endl; + } + //std::cout << "[" << elf::ai::tree_search::ActionTrait::to_string(c) << "]" << std::endl; + //std::cout << ("client side: mcts_update_info") << std::endl; + c = mcts_update_info(curr_ai, c); + //std::cout << ("client side: mcts_update_info END") << std::endl; +//if (show_board) { /*std::cout << " poufpouf"<info( + "Current board:\n{}\n[{}] Propose move <{}>\n", + s.showBoard(), + s.getPly(), + elf::ai::tree_search::ActionTrait::to_string(c)); + } + + const bool shouldResign = _state_ext.shouldResign(&_rng); + if (shouldResign && s.getPly() >= 50) { + finish_game(FR_RESIGN); + return; + } + /*if (_preload_sgf.numMoves() > 0) { + if (_sgf_iter.done()) { + finish_game(FR_MAX_STEP); + return; + } + Coord new_c = _sgf_iter.getCurrMove().move; + logger_->info( + "[{}] Move changes from {} to {}", + s.getPly(), + elf::ai::tree_search::ActionTrait::to_string(c), + elf::ai::tree_search::ActionTrait::to_string(new_c)); + c = new_c; + ++_sgf_iter; + }*/ + + if (!_state_ext.forward(c)) { + logger_->error( + "Something is wrong! Move {} cannot be applied\nCurrent board: " + "{}\n[{}] Propose move {}\n", + c, + s.showBoard(), + s.getPly(), + elf::ai::tree_search::ActionTrait::to_string(c)); + return; + } + } + + if (s.terminated()) { + /*auto reason = s.isTwoPass() + ? FR_TWO_PASSES + : s.getPly() >= BOARD_MAX_MOVE ? FR_MAX_STEP : FR_ILLEGAL;*/ + auto reason = + s.getPly() >= 4000 ? FR_MAX_STEP : FR_RESIGN; // FIXME FR_MAX_STEP if 4000 steps ? +// s.getPly() >= 4000 ? FR_MAX_STEP : FR_ILLEGAL; // FIXME FR_MAX_STEP if 4000 steps ? + finish_game(reason); + } + + if (_options.move_cutoff > 0 && s.getPly() >= _options.move_cutoff) { + finish_game(FR_MAX_STEP); + } +} diff --git a/src_cpp/elfgames/tasks/common/game_selfplay.h b/src_cpp/elfgames/tasks/common/game_selfplay.h new file mode 100644 index 0000000..58d15e0 --- /dev/null +++ b/src_cpp/elfgames/tasks/common/game_selfplay.h @@ -0,0 +1,89 @@ +/** + * Copyright (c) 2018-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#include +#include +#include + +#include "elf/base/dispatcher.h" +#include "elf/legacy/python_options_utils_cpp.h" +#include "elf/logging/IndexedLoggerFactory.h" + +#include "../mcts/mcts.h" +//#include "../sgf/sgf.h" +#include "game_base.h" +#include "game_feature.h" +#include "game_stats.h" +#include "notifier.h" + +// Game interface for ChouFleur. +class ChouFleurGameSelfPlay : public ChouFleurGameBase { + public: + using ThreadedDispatcher = elf::ThreadedDispatcherT; + ChouFleurGameSelfPlay( + int game_idx, + elf::GameClient* client, + const ContextOptions& context_options, + const GameOptions& options, + ThreadedDispatcher* dispatcher, + GameNotifierBase* notifier = nullptr); + + void act() override; + bool OnReceive(const MsgRequest& request, RestartReply* reply); + + std::string showBoard() const { + return _state_ext.state().showBoard(); + } + std::string getNextPlayer() const { + return std::to_string(_state_ext.state().nextPlayer()); + } + std::string getLastMove() const { + return "lastmove"; //coord2str2(_state_ext.lastMove()); + } + float getScore() { + return _state_ext.state().evaluate(); //_options.komi); + } + + float getLastScore() const { + return _state_ext.getLastGameFinalValue(); + } + + private: + void setAsync(); + void restart(); + + MCTSChouFleurAI* init_ai( + const std::string& actor_name, + const elf::ai::tree_search::TSOptions& mcts_opt, + float second_puct, + int second_mcts_rollout_per_batch, + int second_mcts_rollout_per_thread, + int64_t model_ver); + Coord mcts_make_diverse_move(MCTSChouFleurAI* curr_ai, Coord c); + Coord mcts_update_info(MCTSChouFleurAI* mcts_go_ai, Coord c); + void finish_game(FinishReason reason); + + private: + ThreadedDispatcher* dispatcher_ = nullptr; + GameNotifierBase* notifier_ = nullptr; + ChouFleurStateExt _state_ext; + + //Sgf _preload_sgf; + //Sgf::iterator _sgf_iter; + + int _online_counter = 0; + + std::unique_ptr _ai; + // Opponent ai (used for selfplay evaluation) + std::unique_ptr _ai2; + std::unique_ptr _human_player; + + std::shared_ptr logger_; +}; diff --git a/src_cpp/elfgames/tasks/common/game_stats.h b/src_cpp/elfgames/tasks/common/game_stats.h new file mode 100644 index 0000000..f942842 --- /dev/null +++ b/src_cpp/elfgames/tasks/common/game_stats.h @@ -0,0 +1,61 @@ +/** + * Copyright (c) 2018-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include + +#include "game_utils.h" + +class GameStats { + public: + void feedMoveRanking(int ranking) { + std::lock_guard lock(_mutex); + _move_ranking.feed(ranking); + } + + void resetRankingIfNeeded(int num_reset_ranking) { + std::lock_guard lock(_mutex); + if (_move_ranking.total_count > (uint64_t)num_reset_ranking) { + std::cout << std::endl << _move_ranking.info() << std::endl; + _move_ranking.reset(); + } + } + + void feedWinRate(float final_value) { + std::lock_guard lock(_mutex); + _win_rate_stats.feed(final_value); + } + + void feedSgf(const std::string& sgf) { + std::lock_guard lock(_mutex); + _sgfs.push_back(sgf); + } + + // For sender. + WinRateStats getWinRateStats() { + std::lock_guard lock(_mutex); + return _win_rate_stats; + } + + std::vector getPlayedGames() { + std::lock_guard lock(_mutex); + return _sgfs; + } + + private: + std::mutex _mutex; + Ranking _move_ranking; + WinRateStats _win_rate_stats; + std::vector _sgfs; +}; diff --git a/src_cpp/elfgames/tasks/common/game_utils.h b/src_cpp/elfgames/tasks/common/game_utils.h new file mode 100644 index 0000000..06fffab --- /dev/null +++ b/src_cpp/elfgames/tasks/common/game_utils.h @@ -0,0 +1,107 @@ +/** + * Copyright (c) 2018-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#include +#include +#include "elf/legacy/pybind_helper.h" + +struct ResignCheck { + float resign_thres = 0.05; + float never_resign_ratio = 0.1; + + bool never_resign = false; + bool has_calculated_never_resign = false; + + ResignCheck(float thres, float never_resign_ratio) + : resign_thres(thres), never_resign_ratio(never_resign_ratio) {} + + bool check(float value, std::mt19937* rng) { + if (!has_calculated_never_resign) { + std::uniform_real_distribution<> dis(0.0, 1.0); + never_resign = (dis(*rng) < never_resign_ratio); + has_calculated_never_resign = true; + } + + if (never_resign) { + return false; + } + + if (value >= -1.0 + resign_thres) + return false; + + return true; + } + + std::string info() const { + std::stringstream ss; + ss << "[ResThres=" << resign_thres + << "][NeverResignRatio=" << never_resign_ratio + << "][NeverRes=" << never_resign << "]"; + return ss.str(); + } + + void reset() { + never_resign = false; + has_calculated_never_resign = false; + } +}; + +struct Ranking { + std::vector counts; + uint64_t total_count; + + Ranking(int max_rank = 10) : counts(max_rank + 1), total_count(0) {} + + void feed(int r) { + if (r < (int)counts.size()) + counts[r]++; + total_count++; + } + + void reset() { + std::fill(counts.begin(), counts.end(), 0); + total_count = 0; + } + + std::string info() const { + std::stringstream ss; + + ss << "Total count: " << total_count << std::endl; + for (size_t i = 0; i < counts.size(); ++i) { + ss << "[" << i << "]: " << counts[i] << " (" + << 100.0 * counts[i] / total_count << "%)" << std::endl; + } + + return ss.str(); + } +}; + +struct WinRateStats { + uint64_t black_wins = 0, white_wins = 0; + float sum_reward = 0.0; + uint64_t total_games = 0; + + void feed(float reward) { + if (reward > 0) + black_wins++; + else + white_wins++; + sum_reward += reward; + total_games++; + } + + void reset() { + black_wins = white_wins = 0; + sum_reward = 0.0; + total_games = 0; + } + + REGISTER_PYBIND_FIELDS(black_wins, white_wins, sum_reward, total_games); +}; diff --git a/src_cpp/elfgames/tasks/common/go_game_specific.h b/src_cpp/elfgames/tasks/common/go_game_specific.h new file mode 100644 index 0000000..fe6acef --- /dev/null +++ b/src_cpp/elfgames/tasks/common/go_game_specific.h @@ -0,0 +1,276 @@ +/** + * Copyright (c) 2018-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#include +#include +#include "elf/legacy/pybind_helper.h" +#include "elf/utils/utils.h" + +struct GameOptions { + // Seed. + unsigned int seed; + int num_future_actions = 3; + + // For offline training, + // This means how many games to open simultaneously per thread? + // When sending current situations, randomly select one to break any + // correlations. + // For selfplay setting. + // This means how many games are played sequentially in each thread. + int num_games_per_thread = -1; + + // mode == "online": it will open the game in online mode. + // In this mode, the thread will not output the next k moves (since every + // game is new). + // Instead, it will get the action from the neural network to proceed. + // mode == "offline": offline training + // mode == "selfplay": self play. + std::string mode; + + // Use mcts engine. + bool use_mcts = false; + bool use_mcts_ai2 = false; + + // Specify which side uses policy network only. + bool black_use_policy_network_only = false; + bool white_use_policy_network_only = false; + bool black_use_dga = false; + bool white_use_dga = false; + + // -1 is random, 0-7 mean specific data aug. + int data_aug = -1; + + // Before we use the data from the first recorded replay in each thread, + // sample number of moves to fast-forward. + // This is to increase the diversity of the game. + // This number is sampled uniformly from [0, #Num moves * ratio_pre_moves] + float start_ratio_pre_moves = 0.5; + + // Similar as above, but note that it will be applied to any newly loaded game + // (except for the first one). + // This will introduce bias in the dataset. + // Useful when you want that (or when you want to visualize the data). + float ratio_pre_moves = 0.0; + + // Cutoff ply for each loaded game, and start a new one. + int move_cutoff = -1; + + // Cutoff ply for mcts policy / best a + int policy_distri_cutoff = 20; + bool policy_distri_training_for_all = false; + + float resign_thres = 0.05; + float resign_thres_lower_bound = 1e-9; + float resign_thres_upper_bound = 0.50; + float resign_prob_never = 0.1; + float resign_target_fp_rate = 0.05; + int resign_target_hist_size = 2500; + + int num_reset_ranking = 5000; + + std::string preload_sgf; + int preload_sgf_move_to = -1; + + bool use_df_feature = false; + + int q_min_size = 10; + int q_max_size = 1000; + int num_reader = 50; + + float komi = 7.5; + int ply_pass_enabled = 0; + + // Second puct used for ai2, if -1 then use the same puct. + float white_puct = -1.0; + int white_mcts_rollout_per_batch = -1; + int white_mcts_rollout_per_thread = -1; + + int eval_num_games = 400; + float eval_thres = 0.55; + + // Default it is 20 min. During intergration test we could make it shorter. + int client_max_delay_sec = 1200; + + // Initial number of selfplay games for each model used for selfplay. + int selfplay_init_num = 5000; + // Additive number of selfplay after the new model is updated. + int selfplay_update_num = 1000; + + // Whether we use async mode for selfplay. + bool selfplay_async = false; + + // When playing with human (or other programs), if human pass, we also pass. + bool following_pass = false; + + bool cheat_eval_new_model_wins_half = false; + bool cheat_selfplay_random_result = false; + + bool keep_prev_selfplay = false; + + int eval_num_threads = 1; + int expected_num_clients = -1; + + // A list file containing the files to load. + std::vector list_files; + std::string server_addr; + std::string server_id; + int port; + bool verbose = false; + bool print_result = false; + std::string dump_record_prefix; + + std::string time_signature; + + GameOptions() { + time_signature = elf_utils::time_signature(); + } + + std::string info() const { + std::stringstream ss; + ss << "Seed: " << seed << std::endl; + ss << "Time signature: " << time_signature << std::endl; + ss << "Client max delay in sec: " << client_max_delay_sec << std::endl; + ss << "#FutureActions: " << num_future_actions << std::endl; + ss << "#GamePerThread: " << num_games_per_thread << std::endl; + ss << "mode: " << mode << std::endl; + ss << "Selfplay init min #games: " << selfplay_init_num + << ", update #games: " << selfplay_update_num + << ", async: " << elf_utils::print_bool(selfplay_async) << std::endl; + ss << "UseMCTS: " << elf_utils::print_bool(use_mcts) << std::endl; + ss << "Data Aug: " << data_aug << std::endl; + ss << "Start_ratio_pre_moves: " << start_ratio_pre_moves << std::endl; + ss << "ratio_pre_moves: " << ratio_pre_moves << std::endl; + ss << "MoveCutOff: " << move_cutoff << std::endl; + ss << "Use DF feature: " << elf_utils::print_bool(use_df_feature) + << std::endl; + ss << "PolicyDistriCutOff: " << policy_distri_cutoff << std::endl; + + if (expected_num_clients > 0) { + ss << "Expected #client: " << expected_num_clients << std::endl; + } + + if (!list_files.empty()) { + ss << "ListFile[" << list_files.size() << "]: "; + for (const std::string& f : list_files) { + ss << f << ", "; + } + ss << std::endl; + } + + ss << "Server_addr: " << server_addr << ", server_id: " << server_id + << ", port: " << port << std::endl; + ss << "#Reader: " << num_reader << ", Qmin_sz: " << q_min_size + << ", Qmax_sz: " << q_max_size << std::endl; + ss << "Verbose: " << elf_utils::print_bool(verbose) << std::endl; + ss << "Policy distri training for all moves: " + << elf_utils::print_bool(verbose) << std::endl; + ss << "Min Ply from which pass is enabled: " << ply_pass_enabled + << std::endl; + if (print_result) + ss << "PrintResult: " << elf_utils::print_bool(print_result) << std::endl; + if (!dump_record_prefix.empty()) + ss << "dumpRecord: " << dump_record_prefix << std::endl; + if (following_pass) + ss << "Following pass is true" << std::endl; + ss << "Reset move ranking after " << num_reset_ranking << " actions" + << std::endl; + + if (white_puct > 0.0) + ss << "White puct: " << white_puct << std::endl; + + if (white_puct > 0.0) + ss << "White puct: " << white_puct << std::endl; + + ss << "Resign Threshold: " << resign_thres << ", "; + if (resign_prob_never > 0.0) + ss << "Dynamic Resign Threshold, resign_prob_never: " << resign_prob_never + << ", target_fp_rate: " << resign_target_fp_rate + << ", bounded within [" << resign_thres_lower_bound << ", " + << resign_thres_upper_bound << "]" << std::endl; + + if (black_use_policy_network_only) + ss << "Black uses policy network only" << std::endl; + if (white_use_policy_network_only) + ss << "White uses policy network only" << std::endl; + + if (black_use_dga) + ss << "Black uses dga" << std::endl; + if (white_use_dga) + ss << "White uses dga" << std::endl; + if (cheat_eval_new_model_wins_half) + ss << "Cheat mode: New model gets 100% win rate half of the time." + << std::endl; + + if (cheat_selfplay_random_result) + ss << "Cheat selfplay mode: Random outcome." << std::endl; + + ss << std::endl; + + ss << "Komi: " << komi << std::endl; + if (!preload_sgf.empty()) { + ss << "Preload SGF:" << preload_sgf << ", move_to" << preload_sgf_move_to + << std::endl; + } + return ss.str(); + } + + REGISTER_PYBIND_FIELDS( + seed, + mode, + data_aug, + start_ratio_pre_moves, + ratio_pre_moves, + move_cutoff, + num_future_actions, + list_files, + verbose, + num_games_per_thread, + use_mcts, + server_addr, + server_id, + port, + policy_distri_cutoff, + client_max_delay_sec, + q_min_size, + q_max_size, + num_reader, + dump_record_prefix, + use_mcts_ai2, + preload_sgf, + preload_sgf_move_to, + komi, + print_result, + resign_thres, + resign_thres_lower_bound, + resign_thres_upper_bound, + resign_prob_never, + resign_target_fp_rate, + num_reset_ranking, + ply_pass_enabled, + following_pass, + use_df_feature, + policy_distri_training_for_all, + black_use_policy_network_only, + white_use_policy_network_only, + cheat_eval_new_model_wins_half, + cheat_selfplay_random_result, + eval_num_games, + selfplay_init_num, + selfplay_update_num, + selfplay_async, + white_puct, + white_mcts_rollout_per_batch, + white_mcts_rollout_per_thread, + eval_thres, + keep_prev_selfplay, + expected_num_clients, + black_use_dga, + white_use_dga); +}; diff --git a/src_cpp/elfgames/tasks/common/go_state_ext.cc b/src_cpp/elfgames/tasks/common/go_state_ext.cc new file mode 100644 index 0000000..517e7d0 --- /dev/null +++ b/src_cpp/elfgames/tasks/common/go_state_ext.cc @@ -0,0 +1,127 @@ +/** + * Copyright (c) 2018-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#include "go_state_ext.h" + +void replaceAll( + std::string& s, + const std::string& search, + const std::string& replace) { + for (size_t pos = 0;; pos += replace.length()) { + // Locate the substring to replace + pos = s.find(search, pos); + if (pos == std::string::npos) + break; + // Replace by erasing and inserting + s.erase(pos, search.length()); + s.insert(pos, replace); + } +} + +/*std::string ChouFleurStateExt::dumpSgf(const std::string& filename) const { + std::vector moves = _state.getAllMoves(); + + std::stringstream ss; + float value = _state.getFinalValue(); + std::string result; + if (abs(value) == 1.0) { + result = (value > 0.0 ? "B+R" : "W+R"); + } else { + result = + (value > 0.0 ? "B+" + std::to_string(value) + : "W+" + std::to_string(-value)); + } + + std::stringstream ss_overall_comment; + ss_overall_comment << "Filename: " << filename << std::endl; + ss_overall_comment << "Git hash: " << __STR(GIT_COMMIT_HASH) << std::endl; + ss_overall_comment << "Staged: " << __STR(GIT_STAGED) << std::endl; + + ss << "(;SZ[" << BOARD_SIZE << "]RE[" << result + << "]C[" + ss_overall_comment.str() + "]"; + std::string black_name = _options.use_mcts ? "MCTS" : "Policy"; + if (_options.black_use_policy_network_only) + black_name += "(policy only)"; + + bool white_mcts = _options.mode == "selfplay_eval" ? _options.use_mcts_ai2 + : _options.use_mcts; + + std::string white_name = white_mcts ? "MCTS" : "Policy"; + if (_options.white_use_policy_network_only) + white_name += "(policy only)"; + + ss << "PB[" << black_name << "]PW[" << white_name << "]KM[" << _options.komi + << "]"; + + for (size_t i = 0; i < moves.size(); i++) { + std::string color = (i % 2 == 0 ? "B" : "W"); + ss << ";" << color << "[" << coord2str(moves[i]) << "]"; + std::string comments; + comments += std::to_string(i + 1) + ": "; + if (i < _predicted_values.size()) { + comments += "PredV: " + std::to_string(_predicted_values[i]); // + "\n"; + } + if (i < _mcts_policies.size()) { + string mcts_info = _mcts_policies[i].info_packed(coord2str); + replaceAll(mcts_info, "[", "\\["); + replaceAll(mcts_info, "]", "\\]"); + comments += mcts_info; + } + + ss << "C[" << comments << "]"; + } + ss << ")"; + return ss.str(); +}*/ + +void ChouFleurStateExt::showFinishInfo(FinishReason reason) const { + Stone player = _state.nextPlayer(); + std::cout << _state.showBoard() << std::endl; + std::string sgf_record = dumpSgf(""); + std::cout << sgf_record << std::endl; + + std::cout << "[" << _game_idx << ":" << _seq + << "] Current request: " << curr_request_.info() + << ", used_model: "; + for (const auto& i : using_models_) { + std::cout << i << ", "; + } + std::cout << std::endl; + + switch (reason) { + case FR_RESIGN: + std::cout << "Player " << std::to_string(player) << " resigned at " + << _state.getPly() + << " Resign Thres: " << _resign_check.resign_thres; + break; + case FR_MAX_STEP: + std::cout << "Ply: " << _state.getPly() + << " exceeds thread_state.Restarting the game"; + break; + case FR_TWO_PASSES: + std::cout << "Both pass at " << _state.getPly(); + break; + case FR_ILLEGAL: + std::cout << "Illegal move at " << _state.getPly(); + break; + case FR_CLEAR: + std::cout << "Restarting at " << _state.getPly(); + break; + case FR_CHEAT_NEWER_WINS_HALF: + std::cout << "Cheat mode: Version: " << curr_request_.vers.info() + << ", swap: " << curr_request_.client_ctrl.player_swap; + break; + case FR_CHEAT_SELFPLAY_RANDOM_RESULT: + std::cout << "Cheat selfplay mode: Version: " << curr_request_.vers.info() + << ", swap: " << curr_request_.client_ctrl.player_swap; + break; + } + std::cout << ", Value: " << _state.getFinalValue() + << ", Predicted: " << getLastPredictedValue() + << ", ResCheck: " << _resign_check.info() << std::endl; +} diff --git a/src_cpp/elfgames/tasks/common/go_state_ext.h b/src_cpp/elfgames/tasks/common/go_state_ext.h new file mode 100644 index 0000000..bf98140 --- /dev/null +++ b/src_cpp/elfgames/tasks/common/go_state_ext.h @@ -0,0 +1,356 @@ +/** + * Copyright (c) 2018-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#define UNUSED(expr) do { (void)(expr); } while (0) + +#include +#include +#include +#include +#include +#include "../base/go_state.h" +#include "game_utils.h" +#include "go_game_specific.h" +#include "../Game.h" +#include "record.h" + +#include "elf/ai/tree_search/tree_search_base.h" + +enum FinishReason { + FR_RESIGN = 0, + FR_TWO_PASSES, + FR_MAX_STEP, + FR_CLEAR, + FR_ILLEGAL, + FR_CHEAT_NEWER_WINS_HALF, + FR_CHEAT_SELFPLAY_RANDOM_RESULT, +}; + +struct ChouFleurStateExt { + public: + ChouFleurStateExt(int game_idx, const GameOptions& options) + : _game_idx(game_idx), + _last_move_for_the_game(M_INVALID), + _last_value(0.0), + _resign_check(options.resign_thres, options.resign_prob_never), + _options(options) { + restart(); + } + + std::string dumpSgf(const std::string& /*filename*/) const { +// void dumpSgf() const { + /* + std::string filename = _options.dump_record_prefix + "_" + + std::to_string(_game_idx) + "_" + std::to_string(_seq) + "_" + + (_state.getFinalValue() > 0 ? "B" : "W") + ".sgf"; + std::string sgf_record = dumpSgf(filename); + std::ofstream oo(filename); + oo << sgf_record << std::endl;*/ + return std::string("dumpSgf not implemented in ChouFleur"); + } + // void dumpSgf() const {} + void setRequest(const MsgRequest& request) { + curr_request_ = request; + + const auto& ctrl = request.client_ctrl; + + _resign_check.resign_thres = + (ctrl.black_resign_thres + ctrl.white_resign_thres) / 2.0; + _resign_check.never_resign_ratio = ctrl.never_resign_prob; + } + + void addCurrentModel() { + if (curr_request_.vers.black_ver >= 0) + using_models_.insert(curr_request_.vers.black_ver); + if (curr_request_.vers.white_ver >= 0) + using_models_.insert(curr_request_.vers.white_ver); + } + + const MsgRequest& currRequest() const { + return curr_request_; + } + + float setFinalValue(FinishReason reason, std::mt19937* rng) { + UNUSED(reason); + UNUSED(rng); + if (_state.GetStatus() == 3) { return -1.; }; // -1 means that black wins. FIXME + if (_state.GetStatus() == 4) { return 1.; }; // 1 means that white wins. + return 0.; /* + float final_value = 0.0; + _last_move_for_the_game = _state.lastMove(); + + if (reason == FR_RESIGN) { + final_value = _state.nextPlayer() == S_WHITE ? 1.0 : -1.0; + _last_move_for_the_game = M_RESIGN; + } else if ( + reason == FR_CHEAT_NEWER_WINS_HALF && + !curr_request_.vers.is_selfplay()) { + auto h = std::hash{}( + std::to_string(curr_request_.vers.black_ver)) ^ + std::hash{}( + std::to_string(curr_request_.vers.white_ver)); + final_value = h % 2 == 0 ? 1.0 : -1.0; + if (curr_request_.client_ctrl.player_swap) + final_value = -final_value; + } else if ( + reason == FR_CHEAT_SELFPLAY_RANDOM_RESULT && + curr_request_.vers.is_selfplay()) { + final_value = ((*rng)() % 2 == 0 ? 1.0 : -1.0); + } else { + final_value = _state.evaluate(_options.komi); + } + _state.setFinalValue(final_value); + return final_value;*/ + } + + /*Coord lastMove() const { + if (_state.justStarted()) + return _last_move_for_the_game; + else + return _state.lastMove(); + }*/ + + void restart() { + /*_last_value = _state.getFinalValue(); + _state.reset(); + _mcts_policies.clear(); + _predicted_values.clear(); + + using_models_.clear(); + + _resign_check.reset(); + _seq++; + + addCurrentModel();*/ + _state.Initialize(); + } + + Record dumpRecord() const { + Record r; + + r.timestamp = elf_utils::sec_since_epoch_from_now(); + r.thread_id = _game_idx; + r.seq = _seq; + r.request = curr_request_; + + //r.result.reward = _state.getFinalValue(); + if (_state.GetStatus() == 3) { + r.result.content = "black wins"; + r.result.reward = -1; + } else { + if (_state.GetStatus() == 4) { + r.result.content = "white wins"; + r.result.reward = 1; + } else { + if (_state.GetStatus() == 2) { + r.result.content = "draw"; + r.result.reward = 0; + } else { + r.result.content = "in progress"; + r.result.reward = 0; + } + } + } + //r.result.content = _state.GetStatus() == 3 ? "black wins" : "white wins"; //coords2sgfstr(_state.getAllMoves()); + r.result.black_never_resign = _resign_check.never_resign; + r.result.white_never_resign = _resign_check.never_resign; + r.result.using_models = + std::vector(using_models_.begin(), using_models_.end()); + r.result.policies = _mcts_policies; + r.result.num_move = -1; //_state.getPly() - 1; + r.result.values = _predicted_values; + + return r; + } + + ThreadState getThreadState() const { + ThreadState s; + s.thread_id = _game_idx; + s.seq = _seq; + s.move_idx = -1;//_state.getPly() - 1; + s.black = curr_request_.vers.black_ver; + s.white = curr_request_.vers.white_ver; + return s; + } + void saveCurrentTree(const std::string& tree_info) const { + // Dump the tree as well. + std::string filename = _options.dump_record_prefix + "_" + + std::to_string(_game_idx) + "_" + std::to_string(_seq) + "_" + + std::to_string(_state.getPly()) + ".tree"; + std::ofstream oo(filename); + oo << _state.showBoard() << std::endl; + oo << tree_info; + } + + float getLastGameFinalValue() const { + return _last_value; + } + + void addMCTSPolicy( + const elf::ai::tree_search::MCTSPolicy& mcts_policy) { + const auto& policy = mcts_policy.policy; + + // First find the max value + float max_val = 0.0; + for (size_t k = 0; k < policy.size(); k++) { + const auto& entry = policy[k]; + max_val = std::max(max_val, entry.second); + } + + _mcts_policies.emplace_back(); + std::fill( + _mcts_policies.back().prob, + _mcts_policies.back().prob + StateForChouFleurNumActions, + 0); + for (size_t k = 0; k < policy.size(); k++) { + const auto& entry = policy[k]; + unsigned char c = + static_cast(entry.second / max_val * 255); + _mcts_policies.back().prob[entry.first] = c; + } + } + + void addPredictedValue(float predicted_value) { + _predicted_values.push_back(predicted_value); + } + + float getLastPredictedValue() const { + if (_predicted_values.empty()) + return 0.0; + else + return _predicted_values.back(); + } + + bool shouldResign(std::mt19937* rng) { + // Run it after addPredictedValue + float predicted_value = getLastPredictedValue(); + Stone player = _state.nextPlayer(); + return ( + player == S_BLACK ? _resign_check.check(predicted_value, rng) + : _resign_check.check(-predicted_value, rng)); + } + + void showFinishInfo(FinishReason reason) const; + + bool forward(Coord c) { + return _state.forward(c); + } + + StateForChouFleur& GetState() { + return _state; + } + const StateForChouFleur& state() const { + return _state; + } + int seq() const { + return _seq; + } + + bool finished() const { + return _options.num_games_per_thread > 0 && + _seq >= _options.num_games_per_thread; + } + + const GameOptions& options() const { + return _options; + } + + protected: + const int _game_idx; + int _seq = 0; + + StateForChouFleur _state; + Coord _last_move_for_the_game; + + MsgRequest curr_request_; + std::set using_models_; + + float _last_value; + + ResignCheck _resign_check; + GameOptions _options; + + std::vector _mcts_policies; + std::vector _predicted_values; +}; + +class ChouFleurStateExtOffline { + public: + friend class ChouFleurFeature; + + ChouFleurStateExtOffline(int game_idx, const GameOptions& options) + : _game_idx(game_idx), _bf(_state), _options(options) {} + + void fromRecord(const Record& r) { + // std::cout << "Convert to moves: " << r.content << std::endl; + // _offline_all_moves = sgfstr2coords(r.result.content); + _offline_winner = r.result.reward > 0 ? 1.0 : -1.0; + // std::cout << "Convert complete, #move = " << moves.size() << std::endl; + + _mcts_policies = r.result.policies; + curr_request_ = r.request; + _seq = r.seq; + _predicted_values = r.result.values; + _state.Initialize(); + } + + bool switchRandomMove(std::mt19937* rng) { + // Random sample one move + if ((int)_offline_all_moves.size() <= _options.num_future_actions - 1) { + std::cout << "[" << _game_idx << "] #moves " << _offline_all_moves.size() + << " smaller than " << _options.num_future_actions << " - 1" + << std::endl; + return false; + } + size_t move_to = (*rng)() % + (_offline_all_moves.size() - _options.num_future_actions + 1); + switchBeforeMove(move_to); + return true; + } + + /* void generateD4Code(std::mt19937* rng) { + _bf.setD4Code((*rng)() % 8); + }*/ + + void switchBeforeMove(size_t move_to) { + assert(move_to < _offline_all_moves.size()); + + _state.reset(); + for (size_t i = 0; i < move_to; ++i) { + _state.forward(_offline_all_moves[i]); + } + } + + int getNumMoves() const { + return _offline_all_moves.size(); + } + + float getPredictedValue(int move_idx) const { + return _predicted_values[move_idx]; + } + private: + const int _game_idx; +// public: // FIXME this is public just because I am deadly tired right now... + StateForChouFleur _state; + BoardFeature _bf; + protected: + GameOptions _options; + + int _seq; + MsgRequest curr_request_; + + std::vector _offline_all_moves; + public: + float _offline_winner; + + + std::vector _mcts_policies; + std::vector _predicted_values; +}; diff --git a/src_cpp/elfgames/tasks/common/model_pair.h b/src_cpp/elfgames/tasks/common/model_pair.h new file mode 100644 index 0000000..711a9d2 --- /dev/null +++ b/src_cpp/elfgames/tasks/common/model_pair.h @@ -0,0 +1,75 @@ +#pragma once + +#include +#include "elf/ai/tree_search/tree_search_options.h" +#include "elf/utils/json_utils.h" + +struct ModelPair { + int64_t black_ver = -1; + int64_t white_ver = -1; + elf::ai::tree_search::TSOptions mcts_opt; + + bool wait() const { + return black_ver < 0; + } + void set_wait() { + black_ver = white_ver = -1; + } + + bool is_selfplay() const { + return black_ver >= 0 && white_ver == -1; + } + + std::string info() const { + std::stringstream ss; + if (wait()) + ss << "[wait]"; + else if (is_selfplay()) + ss << "[selfplay=" << black_ver << "]"; + else + ss << "[b=" << black_ver << "][w=" << white_ver << "]"; + ss << mcts_opt.info(); + return ss.str(); + } + + friend bool operator==(const ModelPair& p1, const ModelPair& p2) { + return p1.black_ver == p2.black_ver && p1.white_ver == p2.white_ver && + p1.mcts_opt == p2.mcts_opt; + } + friend bool operator!=(const ModelPair& p1, const ModelPair& p2) { + return !(p1 == p2); + } + + void setJsonFields(json& j) const { + JSON_SAVE(j, black_ver); + JSON_SAVE(j, white_ver); + JSON_SAVE_OBJ(j, mcts_opt); + } + + static ModelPair createFromJson(const json& j) { + ModelPair p; + // cout << "extract black_Ver" << endl; + JSON_LOAD(p, j, black_ver); + // cout << "extract white_Ver" << endl; + JSON_LOAD(p, j, white_ver); + // cout << "extract MCTS" << endl; + JSON_LOAD_OBJ(p, j, mcts_opt); + // cout << "extract MCTS complete" << endl; + return p; + } +}; + +namespace std { +template <> +struct hash { + typedef ModelPair argument_type; + typedef std::size_t result_type; + result_type operator()(argument_type const& s) const noexcept { + result_type const h1(std::hash{}(s.black_ver)); + result_type const h2(std::hash{}(s.white_ver)); + result_type const h3( + std::hash{}(s.mcts_opt)); + return h1 ^ (h2 << 1) ^ (h3 << 2); + } +}; +} // namespace std diff --git a/src_cpp/elfgames/tasks/common/notifier.h b/src_cpp/elfgames/tasks/common/notifier.h new file mode 100644 index 0000000..efff29f --- /dev/null +++ b/src_cpp/elfgames/tasks/common/notifier.h @@ -0,0 +1,14 @@ +#pragma once + +#include "../mcts/mcts.h" +#include "elf/ai/tree_search/mcts.h" +#include "go_state_ext.h" +#include "record.h" + +class GameNotifierBase { + public: + using MCTSResult = elf::ai::tree_search::MCTSResultT; + virtual void OnGameEnd(const ChouFleurStateExt&) {} + virtual void OnStateUpdate(const ThreadState&) {} + virtual void OnMCTSResult(Coord, const MCTSResult&) {} +}; diff --git a/src_cpp/elfgames/tasks/common/record.h b/src_cpp/elfgames/tasks/common/record.h new file mode 100644 index 0000000..b0a927f --- /dev/null +++ b/src_cpp/elfgames/tasks/common/record.h @@ -0,0 +1,488 @@ +/** + * Copyright (c) 2018-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#include +#include +#include +#include +#include + +#include +#include "model_pair.h" + +#include "../base/board.h" +#include "../base/common.h" + +#include "../Game.h" + +using json = nlohmann::json; + +enum ClientType { + CLIENT_INVALID, + CLIENT_SELFPLAY_ONLY, + CLIENT_EVAL_THEN_SELFPLAY +}; + +struct ClientCtrl { + ClientType client_type = CLIENT_SELFPLAY_ONLY; + // -1 means to use all the threads. + int num_game_thread_used = -1; + + float black_resign_thres = 0.0; + float white_resign_thres = 0.0; + float never_resign_prob = 0.0; + + bool player_swap = false; + bool async = false; + + void setJsonFields(json& j) const { + JSON_SAVE(j, client_type); + JSON_SAVE(j, num_game_thread_used); + JSON_SAVE(j, black_resign_thres); + JSON_SAVE(j, white_resign_thres); + JSON_SAVE(j, never_resign_prob); + JSON_SAVE(j, player_swap); + JSON_SAVE(j, async); + } + static ClientCtrl createFromJson( + const json& j, + bool player_swap_optional = false) { + ClientCtrl ctrl; + JSON_LOAD(ctrl, j, client_type); + JSON_LOAD(ctrl, j, num_game_thread_used); + JSON_LOAD(ctrl, j, black_resign_thres); + JSON_LOAD(ctrl, j, white_resign_thres); + JSON_LOAD(ctrl, j, never_resign_prob); + // For backward compatibility. + if (player_swap_optional) { + JSON_LOAD_OPTIONAL(ctrl, j, player_swap); + } else { + JSON_LOAD(ctrl, j, player_swap); + } + JSON_LOAD_OPTIONAL(ctrl, j, async); + return ctrl; + } + + std::string info() const { + std::stringstream ss; + ss << "[client=" << client_type << "][async=" << async << "]" + << "[#th=" << num_game_thread_used << "]" + << "[b_res_th=" << black_resign_thres + << "][w_res_th=" << white_resign_thres << "][swap=" << player_swap + << "][never_res_pr=" << never_resign_prob << "]"; + return ss.str(); + } + + friend bool operator==(const ClientCtrl& c1, const ClientCtrl& c2) { + return c1.client_type == c2.client_type && + c1.num_game_thread_used == c2.num_game_thread_used && + c1.black_resign_thres == c2.black_resign_thres && + c1.white_resign_thres == c2.white_resign_thres && + c1.never_resign_prob == c2.never_resign_prob && + c1.player_swap == c2.player_swap && c1.async == c2.async; + } + friend bool operator!=(const ClientCtrl& c1, const ClientCtrl& c2) { + return !(c1 == c2); + } +}; + +struct MsgVersion { + int64_t model_ver; + MsgVersion(int ver = -1) : model_ver(ver) {} +}; + +enum RestartReply { + NO_OP, + ONLY_WAIT, + UPDATE_REQUEST_ONLY, + UPDATE_MODEL, + UPDATE_MODEL_ASYNC, + UPDATE_COMPLETE, +}; + +struct MsgRestart { + RestartReply result; + int game_idx; + MsgRestart(RestartReply res = NO_OP, int game_idx = -1) + : result(res), game_idx(game_idx) {} +}; + +struct MsgRequest { + ModelPair vers; + ClientCtrl client_ctrl; + + void setJsonFields(json& j) const { + JSON_SAVE_OBJ(j, vers); + JSON_SAVE_OBJ(j, client_ctrl); + } + + static MsgRequest createFromJson(const json& j) { + MsgRequest request; + JSON_LOAD_OBJ(request, j, vers); + JSON_LOAD_OBJ_ARGS(request, j, client_ctrl, request.vers.is_selfplay()); + return request; + } + + std::string setJsonFields() const { + json j; + setJsonFields(j); + return j.dump(); + } + + std::string info() const { + std::stringstream ss; + ss << client_ctrl.info() << vers.info(); + return ss.str(); + } + + friend bool operator==(const MsgRequest& m1, const MsgRequest& m2) { + return m1.vers == m2.vers && m1.client_ctrl == m2.client_ctrl; + } + + friend bool operator!=(const MsgRequest& m1, const MsgRequest& m2) { + return !(m1 == m2); + } +}; + +struct MsgRequestSeq { + int64_t seq = -1; + MsgRequest request; + + void setJsonFields(json& j) const { + JSON_SAVE_OBJ(j, request); + JSON_SAVE(j, seq); + } + + static MsgRequestSeq createFromJson(const json& j) { + MsgRequestSeq s; + JSON_LOAD_OBJ(s, j, request); + JSON_LOAD(s, j, seq); + return s; + } + std::string dumpJsonString() const { + json j; + setJsonFields(j); + return j.dump(); + } + + std::string info() const { + std::stringstream ss; + ss << "[seq=" << seq << "]" << request.info(); + return ss.str(); + } +}; + +struct CoordRecord { + unsigned char prob[StateForChouFleurNumActions]; +}; + +struct MsgResult { + int num_move = 0; + float reward = 0.0; + bool black_never_resign = false; + bool white_never_resign = false; + // Whether this replay is generated by mutliple models. + std::vector using_models; + std::string content; + std::vector policies; + std::vector values; + + std::string info() const { + std::stringstream ss; + ss << "[num_move=" << num_move << "]"; + ss << "[models="; + for (const auto& i : using_models) + ss << i << ", "; + ss << "]"; + ss << "[reward=" << reward << "][b_no_res=" << black_never_resign + << "][w_no_res=" << white_never_resign + << "] len(content)=" << content.size(); + return ss.str(); + } + + void setJsonFields(json& j) const { + JSON_SAVE(j, num_move); + JSON_SAVE(j, reward); + JSON_SAVE(j, black_never_resign); + JSON_SAVE(j, white_never_resign); + JSON_SAVE(j, using_models); + JSON_SAVE(j, content); + + for (size_t i = 0; i < policies.size(); i++) { + json j1; + for (unsigned char c : policies[i].prob) { + j1.push_back(c); + } + j["policies"].push_back(j1); + } + + JSON_SAVE(j, values); + } + + static MsgResult createFromJson(const json& j) { + MsgResult res; + + // cout << "extract num_moves" << endl; + JSON_LOAD(res, j, num_move); + JSON_LOAD(res, j, reward); + JSON_LOAD(res, j, content); + JSON_LOAD(res, j, black_never_resign); + JSON_LOAD(res, j, white_never_resign); + JSON_LOAD_VEC_OPTIONAL(res, j, using_models); + JSON_LOAD_VEC(res, j, values); + + if (j.find("policies") != j.end()) { + // cout << "extract policies" << endl; + size_t num_policies = j["policies"].size(); + // cout << "Content: " << r.content << endl; + // + for (size_t i = 0; i < num_policies; i++) { + json j1 = j["policies"][i]; + res.policies.emplace_back(); + for (size_t k = 0; k < j1.size(); k++) { + res.policies.back().prob[k] = j1[k]; + } + } + // cout << "extract policies complete: " << num_policies << endl; + } + // cout << "#policies: " << num_policies << " #entries: " << total_entries + // << ", entries/policy: " << (float)(total_entries) / num_policies << + // endl; + return res; + } +}; + +struct Record { + MsgRequest request; + MsgResult result; + + uint64_t timestamp = 0; + uint64_t thread_id = 0; + int seq = 0; + float pri = 0.0; + bool offline = false; + + std::string info() const { + std::stringstream ss; + ss << "[t=" << timestamp << "][id=" << thread_id << "][seq=" << seq + << "][pri=" << pri << "][offline=" << offline << "]" << std::endl; + ss << request.info() << std::endl; + ss << result.info() << std::endl; + return ss.str(); + } + + void setJsonFields(json& j) const { + JSON_SAVE_OBJ(j, request); + JSON_SAVE_OBJ(j, result); + JSON_SAVE(j, timestamp); + JSON_SAVE(j, thread_id); + JSON_SAVE(j, seq); + JSON_SAVE(j, pri); + JSON_SAVE(j, offline); + } + + static Record createFromJson(const json& j) { + Record r; + + JSON_LOAD_OBJ(r, j, request); + JSON_LOAD_OBJ(r, j, result); + JSON_LOAD(r, j, timestamp); + JSON_LOAD(r, j, thread_id); + JSON_LOAD(r, j, seq); + JSON_LOAD(r, j, pri); + JSON_LOAD_OPTIONAL(r, j, offline); + return r; + } + + // Extra serialization. + static std::vector createBatchFromJson(const std::string& json_str) { + return createBatchFromJson(json::parse(json_str)); + } + + static std::vector createBatchFromJson(const json& j) { + // cout << "from json_batch" << endl; + std::vector records; + for (size_t i = 0; i < j.size(); ++i) { + try { + records.push_back(createFromJson(j[i])); + } catch (...) { + } + } + return records; + } + + static bool loadContent(const std::string& f, std::string* msg) { + try { + std::ifstream iFile(f.c_str()); + iFile.seekg(0, std::ios::end); + size_t size = iFile.tellg(); + msg->resize(size, ' '); + iFile.seekg(0); + iFile.read(&(*msg)[0], size); + return true; + } catch (...) { + return false; + } + } + + static bool loadBatchFromJsonFile( + const std::string& f, + std::vector* records) { + assert(records != nullptr); + + try { + std::string buffer; + if (!loadContent(f, &buffer)) { + return false; + } + *records = createBatchFromJson(buffer); + return true; + } catch (...) { + return false; + } + } + + static std::string dumpBatchJsonString( + std::vector::const_iterator b, + std::vector::const_iterator e) { + json j; + for (auto it = b; it != e; ++it) { + json j1; + it->setJsonFields(j1); + j.push_back(j1); + } + return j.dump(); + } +}; + +struct ThreadState { + int thread_id = -1; + // Which game we have played. + int seq = 0; + // Which move we have proceeded. + int move_idx = 0; + + int64_t black = -1; + int64_t white = -1; + + void setJsonFields(json& j) const { + JSON_SAVE(j, thread_id); + JSON_SAVE(j, seq); + JSON_SAVE(j, move_idx); + JSON_SAVE(j, black); + JSON_SAVE(j, white); + } + + static ThreadState createFromJson(const json& j) { + ThreadState state; + JSON_LOAD(state, j, thread_id); + JSON_LOAD(state, j, seq); + JSON_LOAD(state, j, move_idx); + JSON_LOAD(state, j, black); + JSON_LOAD(state, j, white); + return state; + } + + friend bool operator==(const ThreadState& t1, const ThreadState& t2) { + return t1.thread_id == t2.thread_id && t1.seq == t2.seq && + t1.move_idx == t2.move_idx && t1.black == t2.black && + t1.white == t2.white; + } + + friend bool operator!=(const ThreadState& t1, const ThreadState& t2) { + return !(t1 == t2); + } + + std::string info() const { + std::stringstream ss; + ss << "[th_id=" << thread_id << "][seq=" << seq << "][mv_idx=" << move_idx + << "]" + << "[black=" << black << "][white=" << white << "]"; + return ss.str(); + } +}; + +struct Records { + std::string identity; + std::unordered_map states; + std::vector records; + + Records() {} + Records(const std::string& id) : identity(id) {} + + void clear() { + states.clear(); + records.clear(); + } + + void addRecord(Record&& r) { + records.emplace_back(r); + } + + bool isRecordEmpty() const { + return records.empty(); + } + + void updateState(const ThreadState& ts) { + states[ts.thread_id] = ts; + } + + void setJsonFields(json& j) const { + JSON_SAVE(j, identity); + for (const auto& t : states) { + json jj; + t.second.setJsonFields(jj); + j["states"].push_back(jj); + } + + for (const Record& r : records) { + json j1; + r.setJsonFields(j1); + j["records"].push_back(j1); + } + } + + static Records createFromJson(const json& j) { + Records rs; + JSON_LOAD(rs, j, identity); + if (j.find("states") != j.end()) { + for (size_t i = 0; i < j["states"].size(); ++i) { + ThreadState t = ThreadState::createFromJson(j["states"][i]); + rs.states[t.thread_id] = t; + } + } + + if (j.find("records") != j.end()) { + // cout << "from json_batch" << endl; + for (size_t i = 0; i < j["records"].size(); ++i) { + rs.records.push_back(Record::createFromJson(j["records"][i])); + } + } + return rs; + } + + std::string dumpJsonString() const { + json j; + setJsonFields(j); + return j.dump(); + } + + static Records createFromJsonString(const std::string& s) { + json j = json::parse(s); + if (j.find("identity") == j.end()) { + // This is a vector + Records rs(""); + rs.records = Record::createBatchFromJson(s); + return rs; + } else { + return createFromJson(j); + } + } +}; diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/curses.h b/src_cpp/elfgames/tasks/elf2codingenv/include/curses.h new file mode 100644 index 0000000..1512dc4 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/curses.h @@ -0,0 +1,2456 @@ +/**************************************************************************** + * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* $Id: curses.h.in,v 1.257 2017/11/21 00:11:37 tom Exp $ */ + +#ifndef __NCURSES_H +#define __NCURSES_H + +#define CURSES 1 +#define CURSES_H 1 + +/* These are defined only in curses.h, and are used for conditional compiles */ +#define NCURSES_VERSION_MAJOR 6 +#define NCURSES_VERSION_MINOR 1 +#define NCURSES_VERSION_PATCH 20180127 + +/* This is defined in more than one ncurses header, for identification */ +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.1" + +/* + * Identify the mouse encoding version. + */ +#define NCURSES_MOUSE_VERSION 2 + +/* + * Definitions to facilitate DLL's. + */ +#include + +#if 1 +#include +#endif + +/* + * User-definable tweak to disable the include of . + */ +#ifndef NCURSES_ENABLE_STDBOOL_H +#define NCURSES_ENABLE_STDBOOL_H 1 +#endif + +/* + * NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses + * configured using --disable-macros. + */ +#ifndef NCURSES_ATTR_T +#define NCURSES_ATTR_T int +#endif + +/* + * Expands to 'const' if ncurses is configured using --enable-const. Note that + * doing so makes it incompatible with other implementations of X/Open Curses. + */ +#undef NCURSES_CONST +#define NCURSES_CONST const + +#undef NCURSES_INLINE +#define NCURSES_INLINE inline + +/* + * The standard type used for color values, and for color-pairs. The latter + * allows the curses library to enumerate the combinations of foreground and + * background colors used by an application, and is normally the product of the + * total foreground and background colors. + * + * X/Open uses "short" for both of these types, ultimately because they are + * numbers from the SVr4 terminal database, which uses 16-bit signed values. + */ +#undef NCURSES_COLOR_T +#define NCURSES_COLOR_T short + +#undef NCURSES_PAIRS_T +#define NCURSES_PAIRS_T short + +/* + * Definitions used to make WINDOW and similar structs opaque. + */ +#ifndef NCURSES_INTERNALS +#define NCURSES_OPAQUE 0 +#define NCURSES_OPAQUE_FORM 0 +#define NCURSES_OPAQUE_MENU 0 +#define NCURSES_OPAQUE_PANEL 0 +#endif + +/* + * Definition used to optionally suppress wattr* macros to help with the + * transition from ncurses5 to ncurses6 by allowing the header files to + * be shared across development packages for ncursesw in both ABIs. + */ +#ifndef NCURSES_WATTR_MACROS +#define NCURSES_WATTR_MACROS 1 +#endif + +/* + * The reentrant code relies on the opaque setting, but adds features. + */ +#ifndef NCURSES_REENTRANT +#define NCURSES_REENTRANT 0 +#endif + +/* + * Control whether bindings for interop support are added. + */ +#undef NCURSES_INTEROP_FUNCS +#define NCURSES_INTEROP_FUNCS 1 + +/* + * The internal type used for window dimensions. + */ +#undef NCURSES_SIZE_T +#define NCURSES_SIZE_T short + +/* + * Control whether tparm() supports varargs or fixed-parameter list. + */ +#undef NCURSES_TPARM_VARARGS +#define NCURSES_TPARM_VARARGS 1 + +/* + * Control type used for tparm's arguments. While X/Open equates long and + * char* values, this is not always workable for 64-bit platforms. + */ +#undef NCURSES_TPARM_ARG +#define NCURSES_TPARM_ARG intptr_t + +/* + * Control whether ncurses uses wcwidth() for checking width of line-drawing + * characters. + */ +#undef NCURSES_WCWIDTH_GRAPHICS +#define NCURSES_WCWIDTH_GRAPHICS 1 + +/* + * NCURSES_CH_T is used in building the library, but not used otherwise in + * this header file, since that would make the normal/wide-character versions + * of the header incompatible. + */ +#undef NCURSES_CH_T +#define NCURSES_CH_T cchar_t + +#if 1 && defined(_LP64) +typedef unsigned chtype; +typedef unsigned mmask_t; +#else +typedef uint32_t chtype; +typedef uint32_t mmask_t; +#endif + +/* + * We need FILE, etc. Include this before checking any feature symbols. + */ +#include + +/* + * With XPG4, you must define _XOPEN_SOURCE_EXTENDED, it is redundant (or + * conflicting) when _XOPEN_SOURCE is 500 or greater. If NCURSES_WIDECHAR is + * not already defined, e.g., if the platform relies upon nonstandard feature + * test macros, define it at this point if the standard feature test macros + * indicate that it should be defined. + */ +#ifndef NCURSES_WIDECHAR +#if defined(_XOPEN_SOURCE_EXTENDED) || \ + (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 >= 500)) +#define NCURSES_WIDECHAR 1 +#else +#define NCURSES_WIDECHAR 0 +#endif +#endif /* NCURSES_WIDECHAR */ + +#include /* we need va_list */ +#if NCURSES_WIDECHAR +#include /* we want wchar_t */ +#endif + +/* X/Open and SVr4 specify that curses implements 'bool'. However, C++ may also + * implement it. If so, we must use the C++ compiler's type to avoid conflict + * with other interfaces. + * + * A further complication is that may declare 'bool' to be a + * different type, such as an enum which is not necessarily compatible with + * C++. If we have , make 'bool' a macro, so users may #undef it. + * Otherwise, let it remain a typedef to avoid conflicts with other #define's. + * In either case, make a typedef for NCURSES_BOOL which can be used if needed + * from either C or C++. + */ + +#undef TRUE +#define TRUE 1 + +#undef FALSE +#define FALSE 0 + +typedef unsigned char NCURSES_BOOL; + +#if defined(__cplusplus) /* __cplusplus, etc. */ + +/* use the C++ compiler's bool type */ +#define NCURSES_BOOL bool + +#else /* c89, c99, etc. */ + +#if NCURSES_ENABLE_STDBOOL_H +#include +/* use whatever the C compiler decides bool really is */ +#define NCURSES_BOOL bool +#else +/* there is no predefined bool - use our own */ +#undef bool +#define bool NCURSES_BOOL +#endif + +#endif /* !__cplusplus, etc. */ + +#ifdef __cplusplus +extern "C" { +#define NCURSES_CAST(type, value) static_cast(value) +#else +#define NCURSES_CAST(type, value) (type)(value) +#endif + +#define NCURSES_OK_ADDR(p) (0 != NCURSES_CAST(const void*, (p))) + +/* + * X/Open attributes. In the ncurses implementation, they are identical to the + * A_ attributes. + */ +#define WA_ATTRIBUTES A_ATTRIBUTES +#define WA_NORMAL A_NORMAL +#define WA_STANDOUT A_STANDOUT +#define WA_UNDERLINE A_UNDERLINE +#define WA_REVERSE A_REVERSE +#define WA_BLINK A_BLINK +#define WA_DIM A_DIM +#define WA_BOLD A_BOLD +#define WA_ALTCHARSET A_ALTCHARSET +#define WA_INVIS A_INVIS +#define WA_PROTECT A_PROTECT +#define WA_HORIZONTAL A_HORIZONTAL +#define WA_LEFT A_LEFT +#define WA_LOW A_LOW +#define WA_RIGHT A_RIGHT +#define WA_TOP A_TOP +#define WA_VERTICAL A_VERTICAL + +#if 1 +#define WA_ITALIC A_ITALIC /* ncurses extension */ +#endif + +/* colors */ +#define COLOR_BLACK 0 +#define COLOR_RED 1 +#define COLOR_GREEN 2 +#define COLOR_YELLOW 3 +#define COLOR_BLUE 4 +#define COLOR_MAGENTA 5 +#define COLOR_CYAN 6 +#define COLOR_WHITE 7 + +/* line graphics */ + +#if 0 || NCURSES_REENTRANT +NCURSES_WRAPPED_VAR(chtype*, acs_map); +#define acs_map NCURSES_PUBLIC_VAR(acs_map()) +#else +extern NCURSES_EXPORT_VAR(chtype) acs_map[]; +#endif + +#define NCURSES_ACS(c) (acs_map[NCURSES_CAST(unsigned char, (c))]) + +/* VT100 symbols begin here */ +#define ACS_ULCORNER NCURSES_ACS('l') /* upper left corner */ +#define ACS_LLCORNER NCURSES_ACS('m') /* lower left corner */ +#define ACS_URCORNER NCURSES_ACS('k') /* upper right corner */ +#define ACS_LRCORNER NCURSES_ACS('j') /* lower right corner */ +#define ACS_LTEE NCURSES_ACS('t') /* tee pointing right */ +#define ACS_RTEE NCURSES_ACS('u') /* tee pointing left */ +#define ACS_BTEE NCURSES_ACS('v') /* tee pointing up */ +#define ACS_TTEE NCURSES_ACS('w') /* tee pointing down */ +#define ACS_HLINE NCURSES_ACS('q') /* horizontal line */ +#define ACS_VLINE NCURSES_ACS('x') /* vertical line */ +#define ACS_PLUS NCURSES_ACS('n') /* large plus or crossover */ +#define ACS_S1 NCURSES_ACS('o') /* scan line 1 */ +#define ACS_S9 NCURSES_ACS('s') /* scan line 9 */ +#define ACS_DIAMOND NCURSES_ACS('`') /* diamond */ +#define ACS_CKBOARD NCURSES_ACS('a') /* checker board (stipple) */ +#define ACS_DEGREE NCURSES_ACS('f') /* degree symbol */ +#define ACS_PLMINUS NCURSES_ACS('g') /* plus/minus */ +#define ACS_BULLET NCURSES_ACS('~') /* bullet */ +/* Teletype 5410v1 symbols begin here */ +#define ACS_LARROW NCURSES_ACS(',') /* arrow pointing left */ +#define ACS_RARROW NCURSES_ACS('+') /* arrow pointing right */ +#define ACS_DARROW NCURSES_ACS('.') /* arrow pointing down */ +#define ACS_UARROW NCURSES_ACS('-') /* arrow pointing up */ +#define ACS_BOARD NCURSES_ACS('h') /* board of squares */ +#define ACS_LANTERN NCURSES_ACS('i') /* lantern symbol */ +#define ACS_BLOCK NCURSES_ACS('0') /* solid square block */ +/* + * These aren't documented, but a lot of System Vs have them anyway + * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings). + * The ACS_names may not match AT&T's, our source didn't know them. + */ +#define ACS_S3 NCURSES_ACS('p') /* scan line 3 */ +#define ACS_S7 NCURSES_ACS('r') /* scan line 7 */ +#define ACS_LEQUAL NCURSES_ACS('y') /* less/equal */ +#define ACS_GEQUAL NCURSES_ACS('z') /* greater/equal */ +#define ACS_PI NCURSES_ACS('{') /* Pi */ +#define ACS_NEQUAL NCURSES_ACS('|') /* not equal */ +#define ACS_STERLING NCURSES_ACS('}') /* UK pound sign */ + +/* + * Line drawing ACS names are of the form ACS_trbl, where t is the top, r + * is the right, b is the bottom, and l is the left. t, r, b, and l might + * be B (blank), S (single), D (double), or T (thick). The subset defined + * here only uses B and S. + */ +#define ACS_BSSB ACS_ULCORNER +#define ACS_SSBB ACS_LLCORNER +#define ACS_BBSS ACS_URCORNER +#define ACS_SBBS ACS_LRCORNER +#define ACS_SBSS ACS_RTEE +#define ACS_SSSB ACS_LTEE +#define ACS_SSBS ACS_BTEE +#define ACS_BSSS ACS_TTEE +#define ACS_BSBS ACS_HLINE +#define ACS_SBSB ACS_VLINE +#define ACS_SSSS ACS_PLUS + +#undef ERR +#define ERR (-1) + +#undef OK +#define OK (0) + +/* values for the _flags member */ +#define _SUBWIN 0x01 /* is this a sub-window? */ +#define _ENDLINE 0x02 /* is the window flush right? */ +#define _FULLWIN 0x04 /* is the window full-screen? */ +#define _SCROLLWIN 0x08 /* bottom edge is at screen bottom? */ +#define _ISPAD 0x10 /* is this window a pad? */ +#define _HASMOVED 0x20 /* has cursor moved since last refresh? */ +#define _WRAPPED 0x40 /* cursor was just wrappped */ + +/* + * this value is used in the firstchar and lastchar fields to mark + * unchanged lines + */ +#define _NOCHANGE -1 + +/* + * this value is used in the oldindex field to mark lines created by insertions + * and scrolls. + */ +#define _NEWINDEX -1 + +typedef struct screen SCREEN; +typedef struct _win_st WINDOW; + +typedef chtype attr_t; /* ...must be at least as wide as chtype */ + +#if NCURSES_WIDECHAR + +#if 0 +#ifdef mblen /* libutf8.h defines it w/o undefining first */ +#undef mblen +#endif +#include +#endif + +#if 1 +#include /* ...to get mbstate_t, etc. */ +#endif + +#if 0 +typedef unsigned short wchar_t1; +#endif + +#if 0 +typedef unsigned int wint_t1; +#endif + +/* + * cchar_t stores an array of CCHARW_MAX wide characters. The first is + * normally a spacing character. The others are non-spacing. If those + * (spacing and nonspacing) do not fill the array, a null L'\0' follows. + * Otherwise, a null is assumed to follow when extracting via getcchar(). + */ +#define CCHARW_MAX 5 +typedef struct { + attr_t attr; + wchar_t chars[CCHARW_MAX]; +#if 1 +#undef NCURSES_EXT_COLORS +#define NCURSES_EXT_COLORS 20180127 + int ext_color; /* color pair, must be more than 16-bits */ +#endif +} cchar_t; + +#endif /* NCURSES_WIDECHAR */ + +#if !NCURSES_OPAQUE +struct ldat; + +struct _win_st { + NCURSES_SIZE_T _cury, _curx; /* current cursor position */ + + /* window location and size */ + NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */ + NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */ + + short _flags; /* window state flags */ + + /* attribute tracking */ + attr_t _attrs; /* current attribute for non-space character */ + chtype _bkgd; /* current background char/attribute pair */ + + /* option values set by user */ + bool _notimeout; /* no time out on function-key entry? */ + bool _clear; /* consider all data in the window invalid? */ + bool _leaveok; /* OK to not reset cursor on exit? */ + bool _scroll; /* OK to scroll this window? */ + bool _idlok; /* OK to use insert/delete line? */ + bool _idcok; /* OK to use insert/delete char? */ + bool _immed; /* window in immed mode? (not yet used) */ + bool _sync; /* window in sync mode? */ + bool _use_keypad; /* process function keys into KEY_ symbols? */ + int _delay; /* 0 = nodelay, <0 = blocking, >0 = delay */ + + struct ldat* _line; /* the actual line data */ + + /* global screen state */ + NCURSES_SIZE_T _regtop; /* top line of scrolling region */ + NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */ + + /* these are used only if this is a sub-window */ + int _parx; /* x coordinate of this window in parent */ + int _pary; /* y coordinate of this window in parent */ + WINDOW* _parent; /* pointer to parent if a sub-window */ + + /* these are used only if this is a pad */ + struct pdat { + NCURSES_SIZE_T _pad_y, _pad_x; + NCURSES_SIZE_T _pad_top, _pad_left; + NCURSES_SIZE_T _pad_bottom, _pad_right; + } _pad; + + NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */ + +#if NCURSES_WIDECHAR + cchar_t _bkgrnd; /* current background char/attribute pair */ +#if 1 + int _color; /* current color-pair for non-space character */ +#endif +#endif +}; +#endif /* NCURSES_OPAQUE */ + +/* + * This is an extension to support events... + */ +#if 1 +#ifdef NCURSES_WGETCH_EVENTS +#if !defined(__BEOS__) || defined(__HAIKU__) +/* Fix _nc_timed_wait() on BEOS... */ +#define NCURSES_EVENT_VERSION 1 +#endif /* !defined(__BEOS__) */ + +/* + * Bits to set in _nc_event.data.flags + */ +#define _NC_EVENT_TIMEOUT_MSEC 1 +#define _NC_EVENT_FILE 2 +#define _NC_EVENT_FILE_READABLE 2 +#if 0 /* Not supported yet... */ +#define _NC_EVENT_FILE_WRITABLE 4 +#define _NC_EVENT_FILE_EXCEPTION 8 +#endif + +typedef struct { + int type; + union { + long timeout_msec; /* _NC_EVENT_TIMEOUT_MSEC */ + struct { + unsigned int flags; + int fd; + unsigned int result; + } fev; /* _NC_EVENT_FILE */ + } data; +} _nc_event; + +typedef struct { + int count; + int result_flags; /* _NC_EVENT_TIMEOUT_MSEC or _NC_EVENT_FILE_READABLE */ + _nc_event* events[1]; +} _nc_eventlist; + +extern NCURSES_EXPORT(int) + wgetch_events(WINDOW*, _nc_eventlist*); /* experimental */ +extern NCURSES_EXPORT(int) + wgetnstr_events(WINDOW*, char*, int, _nc_eventlist*); /* experimental */ + +#endif /* NCURSES_WGETCH_EVENTS */ +#endif /* NCURSES_EXT_FUNCS */ + +/* + * GCC (and some other compilers) define '__attribute__'; we're using this + * macro to alert the compiler to flag inconsistencies in printf/scanf-like + * function calls. Just in case '__attribute__' isn't defined, make a dummy. + * Old versions of G++ do not accept it anyway, at least not consistently with + * GCC. + */ +#if !(defined(__GNUC__) || defined(__GNUG__) || defined(__attribute__)) +#define __attribute__(p) /* nothing */ +#endif + +/* + * We cannot define these in ncurses_cfg.h, since they require parameters to be + * passed (that is non-portable). If you happen to be using gcc with warnings + * enabled, define + * GCC_PRINTF + * GCC_SCANF + * to improve checking of calls to printw(), etc. + */ +#ifndef GCC_PRINTFLIKE +#if defined(GCC_PRINTF) && !defined(printf) +#define GCC_PRINTFLIKE(fmt, var) __attribute__((format(printf, fmt, var))) +#else +#define GCC_PRINTFLIKE(fmt, var) /*nothing*/ +#endif +#endif + +#ifndef GCC_SCANFLIKE +#if defined(GCC_SCANF) && !defined(scanf) +#define GCC_SCANFLIKE(fmt, var) __attribute__((format(scanf, fmt, var))) +#else +#define GCC_SCANFLIKE(fmt, var) /*nothing*/ +#endif +#endif + +#ifndef GCC_NORETURN +#define GCC_NORETURN /* nothing */ +#endif + +#ifndef GCC_UNUSED +#define GCC_UNUSED /* nothing */ +#endif + +/* + * Curses uses a helper function. Define our type for this to simplify + * extending it for the sp-funcs feature. + */ +typedef int (*NCURSES_OUTC)(int); + +/* + * Function prototypes. This is the complete X/Open Curses list of required + * functions. Those marked `generated' will have sources generated from the + * macro definitions later in this file, in order to satisfy XPG4.2 + * requirements. + */ + +extern NCURSES_EXPORT(int) addch(const chtype); /* generated */ +extern NCURSES_EXPORT(int) addchnstr(const chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) addchstr(const chtype*); /* generated */ +extern NCURSES_EXPORT(int) addnstr(const char*, int); /* generated */ +extern NCURSES_EXPORT(int) addstr(const char*); /* generated */ +extern NCURSES_EXPORT(int) attroff(NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attron(NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attrset(NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) + attr_get(attr_t*, NCURSES_PAIRS_T*, void*); /* generated */ +extern NCURSES_EXPORT(int) attr_off(attr_t, void*); /* generated */ +extern NCURSES_EXPORT(int) attr_on(attr_t, void*); /* generated */ +extern NCURSES_EXPORT(int) + attr_set(attr_t, NCURSES_PAIRS_T, void*); /* generated */ +extern NCURSES_EXPORT(int) baudrate(void); /* implemented */ +extern NCURSES_EXPORT(int) beep(void); /* implemented */ +extern NCURSES_EXPORT(int) bkgd(chtype); /* generated */ +extern NCURSES_EXPORT(void) bkgdset(chtype); /* generated */ +extern NCURSES_EXPORT(int) border( + chtype, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype); /* generated */ +extern NCURSES_EXPORT(int) box(WINDOW*, chtype, chtype); /* generated */ +extern NCURSES_EXPORT(bool) can_change_color(void); /* implemented */ +extern NCURSES_EXPORT(int) cbreak(void); /* implemented */ +extern NCURSES_EXPORT(int) + chgat(int, attr_t, NCURSES_PAIRS_T, const void*); /* generated */ +extern NCURSES_EXPORT(int) clear(void); /* generated */ +extern NCURSES_EXPORT(int) clearok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) clrtobot(void); /* generated */ +extern NCURSES_EXPORT(int) clrtoeol(void); /* generated */ +extern NCURSES_EXPORT(int) color_content( + NCURSES_COLOR_T, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*); /* implemented */ +extern NCURSES_EXPORT(int) color_set(NCURSES_PAIRS_T, void*); /* generated */ +extern NCURSES_EXPORT(int) COLOR_PAIR(int); /* generated */ +extern NCURSES_EXPORT(int) copywin( + const WINDOW*, + WINDOW*, + int, + int, + int, + int, + int, + int, + int); /* implemented */ +extern NCURSES_EXPORT(int) curs_set(int); /* implemented */ +extern NCURSES_EXPORT(int) def_prog_mode(void); /* implemented */ +extern NCURSES_EXPORT(int) def_shell_mode(void); /* implemented */ +extern NCURSES_EXPORT(int) delay_output(int); /* implemented */ +extern NCURSES_EXPORT(int) delch(void); /* generated */ +extern NCURSES_EXPORT(void) delscreen(SCREEN*); /* implemented */ +extern NCURSES_EXPORT(int) delwin(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) deleteln(void); /* generated */ +extern NCURSES_EXPORT(WINDOW*) + derwin(WINDOW*, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) doupdate(void); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) dupwin(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) echo(void); /* implemented */ +extern NCURSES_EXPORT(int) echochar(const chtype); /* generated */ +extern NCURSES_EXPORT(int) erase(void); /* generated */ +extern NCURSES_EXPORT(int) endwin(void); /* implemented */ +extern NCURSES_EXPORT(char) erasechar(void); /* implemented */ +extern NCURSES_EXPORT(void) filter(void); /* implemented */ +extern NCURSES_EXPORT(int) flash(void); /* implemented */ +extern NCURSES_EXPORT(int) flushinp(void); /* implemented */ +extern NCURSES_EXPORT(chtype) getbkgd(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getch(void); /* generated */ +extern NCURSES_EXPORT(int) getnstr(char*, int); /* generated */ +extern NCURSES_EXPORT(int) getstr(char*); /* generated */ +extern NCURSES_EXPORT(WINDOW*) getwin(FILE*); /* implemented */ +extern NCURSES_EXPORT(int) halfdelay(int); /* implemented */ +extern NCURSES_EXPORT(bool) has_colors(void); /* implemented */ +extern NCURSES_EXPORT(bool) has_ic(void); /* implemented */ +extern NCURSES_EXPORT(bool) has_il(void); /* implemented */ +extern NCURSES_EXPORT(int) hline(chtype, int); /* generated */ +extern NCURSES_EXPORT(void) idcok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) idlok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(void) immedok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) inch(void); /* generated */ +extern NCURSES_EXPORT(int) inchnstr(chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) inchstr(chtype*); /* generated */ +extern NCURSES_EXPORT(WINDOW*) initscr(void); /* implemented */ +extern NCURSES_EXPORT(int) init_color( + NCURSES_COLOR_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T); /* implemented */ +extern NCURSES_EXPORT(int) init_pair( + NCURSES_PAIRS_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T); /* implemented */ +extern NCURSES_EXPORT(int) innstr(char*, int); /* generated */ +extern NCURSES_EXPORT(int) insch(chtype); /* generated */ +extern NCURSES_EXPORT(int) insdelln(int); /* generated */ +extern NCURSES_EXPORT(int) insertln(void); /* generated */ +extern NCURSES_EXPORT(int) insnstr(const char*, int); /* generated */ +extern NCURSES_EXPORT(int) insstr(const char*); /* generated */ +extern NCURSES_EXPORT(int) instr(char*); /* generated */ +extern NCURSES_EXPORT(int) intrflush(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(bool) isendwin(void); /* implemented */ +extern NCURSES_EXPORT(bool) is_linetouched(WINDOW*, int); /* implemented */ +extern NCURSES_EXPORT(bool) is_wintouched(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(NCURSES_CONST char*) keyname(int); /* implemented */ +extern NCURSES_EXPORT(int) keypad(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(char) killchar(void); /* implemented */ +extern NCURSES_EXPORT(int) leaveok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(char*) longname(void); /* implemented */ +extern NCURSES_EXPORT(int) meta(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) move(int, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddch(int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) + mvaddchnstr(int, int, const chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddchstr(int, int, const chtype*); /* generated */ +extern NCURSES_EXPORT(int) + mvaddnstr(int, int, const char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddstr(int, int, const char*); /* generated */ +extern NCURSES_EXPORT(int) + mvchgat(int, int, int, attr_t, NCURSES_PAIRS_T, const void*); /* generated + */ +extern NCURSES_EXPORT(int) mvcur(int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) mvdelch(int, int); /* generated */ +extern NCURSES_EXPORT(int) mvderwin(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(int) mvgetch(int, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetnstr(int, int, char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetstr(int, int, char*); /* generated */ +extern NCURSES_EXPORT(int) mvhline(int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(chtype) mvinch(int, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchnstr(int, int, chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchstr(int, int, chtype*); /* generated */ +extern NCURSES_EXPORT(int) mvinnstr(int, int, char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsch(int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) + mvinsnstr(int, int, const char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsstr(int, int, const char*); /* generated */ +extern NCURSES_EXPORT(int) mvinstr(int, int, char*); /* generated */ +extern NCURSES_EXPORT(int) + mvprintw(int, int, const char*, ...) /* implemented */ + GCC_PRINTFLIKE(3, 4); +extern NCURSES_EXPORT(int) + mvscanw(int, int, NCURSES_CONST char*, ...) /* implemented */ + GCC_SCANFLIKE(3, 4); +extern NCURSES_EXPORT(int) mvvline(int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddch(WINDOW*, int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddchnstr(WINDOW*, int, int, const chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddchstr(WINDOW*, int, int, const chtype*); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddnstr(WINDOW*, int, int, const char*, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddstr(WINDOW*, int, int, const char*); /* generated */ +extern NCURSES_EXPORT(int) mvwchgat( + WINDOW*, + int, + int, + int, + attr_t, + NCURSES_PAIRS_T, + const void*); /* generated */ +extern NCURSES_EXPORT(int) mvwdelch(WINDOW*, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetch(WINDOW*, int, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwgetnstr(WINDOW*, int, int, char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetstr(WINDOW*, int, int, char*); /* generated */ +extern NCURSES_EXPORT(int) + mvwhline(WINDOW*, int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvwin(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(chtype) mvwinch(WINDOW*, int, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwinchnstr(WINDOW*, int, int, chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwinchstr(WINDOW*, int, int, chtype*); /* generated */ +extern NCURSES_EXPORT(int) + mvwinnstr(WINDOW*, int, int, char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinsch(WINDOW*, int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) + mvwinsnstr(WINDOW*, int, int, const char*, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwinsstr(WINDOW*, int, int, const char*); /* generated */ +extern NCURSES_EXPORT(int) mvwinstr(WINDOW*, int, int, char*); /* generated */ +extern NCURSES_EXPORT(int) + mvwprintw(WINDOW*, int, int, const char*, ...) /* implemented */ + GCC_PRINTFLIKE(4, 5); +extern NCURSES_EXPORT(int) + mvwscanw(WINDOW*, int, int, NCURSES_CONST char*, ...) /* implemented */ + GCC_SCANFLIKE(4, 5); +extern NCURSES_EXPORT(int) + mvwvline(WINDOW*, int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) napms(int); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) newpad(int, int); /* implemented */ +extern NCURSES_EXPORT(SCREEN*) + newterm(NCURSES_CONST char*, FILE*, FILE*); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) newwin(int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) nl(void); /* implemented */ +extern NCURSES_EXPORT(int) nocbreak(void); /* implemented */ +extern NCURSES_EXPORT(int) nodelay(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) noecho(void); /* implemented */ +extern NCURSES_EXPORT(int) nonl(void); /* implemented */ +extern NCURSES_EXPORT(void) noqiflush(void); /* implemented */ +extern NCURSES_EXPORT(int) noraw(void); /* implemented */ +extern NCURSES_EXPORT(int) notimeout(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) overlay(const WINDOW*, WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) overwrite(const WINDOW*, WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) pair_content( + NCURSES_PAIRS_T, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*); /* implemented */ +extern NCURSES_EXPORT(int) PAIR_NUMBER(int); /* generated */ +extern NCURSES_EXPORT(int) pechochar(WINDOW*, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) + pnoutrefresh(WINDOW*, int, int, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) + prefresh(WINDOW*, int, int, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) printw(const char*, ...) /* implemented */ + GCC_PRINTFLIKE(1, 2); +extern NCURSES_EXPORT(int) putwin(WINDOW*, FILE*); /* implemented */ +extern NCURSES_EXPORT(void) qiflush(void); /* implemented */ +extern NCURSES_EXPORT(int) raw(void); /* implemented */ +extern NCURSES_EXPORT(int) redrawwin(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) refresh(void); /* generated */ +extern NCURSES_EXPORT(int) resetty(void); /* implemented */ +extern NCURSES_EXPORT(int) reset_prog_mode(void); /* implemented */ +extern NCURSES_EXPORT(int) reset_shell_mode(void); /* implemented */ +extern NCURSES_EXPORT(int) + ripoffline(int, int (*)(WINDOW*, int)); /* implemented */ +extern NCURSES_EXPORT(int) savetty(void); /* implemented */ +extern NCURSES_EXPORT(int) scanw(NCURSES_CONST char*, ...) /* implemented */ + GCC_SCANFLIKE(1, 2); +extern NCURSES_EXPORT(int) scr_dump(const char*); /* implemented */ +extern NCURSES_EXPORT(int) scr_init(const char*); /* implemented */ +extern NCURSES_EXPORT(int) scrl(int); /* generated */ +extern NCURSES_EXPORT(int) scroll(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) scrollok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) scr_restore(const char*); /* implemented */ +extern NCURSES_EXPORT(int) scr_set(const char*); /* implemented */ +extern NCURSES_EXPORT(int) setscrreg(int, int); /* generated */ +extern NCURSES_EXPORT(SCREEN*) set_term(SCREEN*); /* implemented */ +extern NCURSES_EXPORT(int) slk_attroff(const chtype); /* implemented */ +extern NCURSES_EXPORT(int) + slk_attr_off(const attr_t, void*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attron(const chtype); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_on(attr_t, void*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attrset(const chtype); /* implemented */ +extern NCURSES_EXPORT(attr_t) slk_attr(void); /* implemented */ +extern NCURSES_EXPORT(int) + slk_attr_set(const attr_t, NCURSES_PAIRS_T, void*); /* implemented */ +extern NCURSES_EXPORT(int) slk_clear(void); /* implemented */ +extern NCURSES_EXPORT(int) slk_color(NCURSES_PAIRS_T); /* implemented */ +extern NCURSES_EXPORT(int) slk_init(int); /* implemented */ +extern NCURSES_EXPORT(char*) slk_label(int); /* implemented */ +extern NCURSES_EXPORT(int) slk_noutrefresh(void); /* implemented */ +extern NCURSES_EXPORT(int) slk_refresh(void); /* implemented */ +extern NCURSES_EXPORT(int) slk_restore(void); /* implemented */ +extern NCURSES_EXPORT(int) slk_set(int, const char*, int); /* implemented */ +extern NCURSES_EXPORT(int) slk_touch(void); /* implemented */ +extern NCURSES_EXPORT(int) standout(void); /* generated */ +extern NCURSES_EXPORT(int) standend(void); /* generated */ +extern NCURSES_EXPORT(int) start_color(void); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) + subpad(WINDOW*, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) + subwin(WINDOW*, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) syncok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) termattrs(void); /* implemented */ +extern NCURSES_EXPORT(char*) termname(void); /* implemented */ +extern NCURSES_EXPORT(void) timeout(int); /* generated */ +extern NCURSES_EXPORT(int) touchline(WINDOW*, int, int); /* generated */ +extern NCURSES_EXPORT(int) touchwin(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) typeahead(int); /* implemented */ +extern NCURSES_EXPORT(int) ungetch(int); /* implemented */ +extern NCURSES_EXPORT(int) untouchwin(WINDOW*); /* generated */ +extern NCURSES_EXPORT(void) use_env(bool); /* implemented */ +extern NCURSES_EXPORT(void) use_tioctl(bool); /* implemented */ +extern NCURSES_EXPORT(int) vidattr(chtype); /* implemented */ +extern NCURSES_EXPORT(int) vidputs(chtype, NCURSES_OUTC); /* implemented */ +extern NCURSES_EXPORT(int) vline(chtype, int); /* generated */ +extern NCURSES_EXPORT(int) + vwprintw(WINDOW*, const char*, va_list); /* implemented */ +extern NCURSES_EXPORT(int) + vw_printw(WINDOW*, const char*, va_list); /* generated */ +extern NCURSES_EXPORT(int) + vwscanw(WINDOW*, NCURSES_CONST char*, va_list); /* implemented */ +extern NCURSES_EXPORT(int) + vw_scanw(WINDOW*, NCURSES_CONST char*, va_list); /* generated */ +extern NCURSES_EXPORT(int) waddch(WINDOW*, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) + waddchnstr(WINDOW*, const chtype*, int); /* implemented */ +extern NCURSES_EXPORT(int) waddchstr(WINDOW*, const chtype*); /* generated */ +extern NCURSES_EXPORT(int) + waddnstr(WINDOW*, const char*, int); /* implemented */ +extern NCURSES_EXPORT(int) waddstr(WINDOW*, const char*); /* generated */ +extern NCURSES_EXPORT(int) wattron(WINDOW*, int); /* generated */ +extern NCURSES_EXPORT(int) wattroff(WINDOW*, int); /* generated */ +extern NCURSES_EXPORT(int) wattrset(WINDOW*, int); /* generated */ +extern NCURSES_EXPORT(int) + wattr_get(WINDOW*, attr_t*, NCURSES_PAIRS_T*, void*); /* generated */ +extern NCURSES_EXPORT(int) wattr_on(WINDOW*, attr_t, void*); /* implemented */ +extern NCURSES_EXPORT(int) wattr_off(WINDOW*, attr_t, void*); /* implemented */ +extern NCURSES_EXPORT(int) + wattr_set(WINDOW*, attr_t, NCURSES_PAIRS_T, void*); /* generated */ +extern NCURSES_EXPORT(int) wbkgd(WINDOW*, chtype); /* implemented */ +extern NCURSES_EXPORT(void) wbkgdset(WINDOW*, chtype); /* implemented */ +extern NCURSES_EXPORT(int) wborder( + WINDOW*, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype); /* implemented */ +extern NCURSES_EXPORT(int) wchgat( + WINDOW*, + int, + attr_t, + NCURSES_PAIRS_T, + const void*); /* implemented */ +extern NCURSES_EXPORT(int) wclear(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wclrtobot(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wclrtoeol(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) + wcolor_set(WINDOW*, NCURSES_PAIRS_T, void*); /* implemented */ +extern NCURSES_EXPORT(void) wcursyncup(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wdelch(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wdeleteln(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) wechochar(WINDOW*, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) werase(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wgetch(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wgetnstr(WINDOW*, char*, int); /* implemented */ +extern NCURSES_EXPORT(int) wgetstr(WINDOW*, char*); /* generated */ +extern NCURSES_EXPORT(int) whline(WINDOW*, chtype, int); /* implemented */ +extern NCURSES_EXPORT(chtype) winch(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) winchnstr(WINDOW*, chtype*, int); /* implemented */ +extern NCURSES_EXPORT(int) winchstr(WINDOW*, chtype*); /* generated */ +extern NCURSES_EXPORT(int) winnstr(WINDOW*, char*, int); /* implemented */ +extern NCURSES_EXPORT(int) winsch(WINDOW*, chtype); /* implemented */ +extern NCURSES_EXPORT(int) winsdelln(WINDOW*, int); /* implemented */ +extern NCURSES_EXPORT(int) winsertln(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) + winsnstr(WINDOW*, const char*, int); /* implemented */ +extern NCURSES_EXPORT(int) winsstr(WINDOW*, const char*); /* generated */ +extern NCURSES_EXPORT(int) winstr(WINDOW*, char*); /* generated */ +extern NCURSES_EXPORT(int) wmove(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(int) wnoutrefresh(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wprintw(WINDOW*, const char*, ...) /* implemented */ + GCC_PRINTFLIKE(2, 3); +extern NCURSES_EXPORT(int) wredrawln(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(int) wrefresh(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) + wscanw(WINDOW*, NCURSES_CONST char*, ...) /* implemented */ + GCC_SCANFLIKE(2, 3); +extern NCURSES_EXPORT(int) wscrl(WINDOW*, int); /* implemented */ +extern NCURSES_EXPORT(int) wsetscrreg(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(int) wstandout(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) wstandend(WINDOW*); /* generated */ +extern NCURSES_EXPORT(void) wsyncdown(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(void) wsyncup(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(void) wtimeout(WINDOW*, int); /* implemented */ +extern NCURSES_EXPORT(int) wtouchln(WINDOW*, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) wvline(WINDOW*, chtype, int); /* implemented */ + +/* + * These are also declared in : + */ +extern NCURSES_EXPORT(int) tigetflag(NCURSES_CONST char*); /* implemented */ +extern NCURSES_EXPORT(int) tigetnum(NCURSES_CONST char*); /* implemented */ +extern NCURSES_EXPORT(char*) tigetstr(NCURSES_CONST char*); /* implemented */ +extern NCURSES_EXPORT(int) putp(const char*); /* implemented */ + +#if NCURSES_TPARM_VARARGS +extern NCURSES_EXPORT(char*) tparm(NCURSES_CONST char*, ...); /* special */ +#else +extern NCURSES_EXPORT(char*) tparm( + NCURSES_CONST char*, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG); /* special */ +extern NCURSES_EXPORT(char*) + tparm_varargs(NCURSES_CONST char*, ...); /* special */ +#endif + +extern NCURSES_EXPORT(char*) tiparm(const char*, ...); /* special */ + +/* + * X/Open says this returns a bool; SVr4 also checked for out-of-range line. + * The macro provides compatibility: + */ +#define is_linetouched(w, l) \ + ((!(w) || ((l) > getmaxy(w)) || ((l) < 0)) ? ERR : (is_linetouched)((w), (l))) + +/* + * These functions are not in X/Open, but we use them in macro definitions: + */ +extern NCURSES_EXPORT(int) getattrs(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getcurx(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getcury(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getbegx(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getbegy(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getmaxx(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getmaxy(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getparx(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getpary(const WINDOW*); /* generated */ + +/* + * vid_attr() was implemented originally based on a draft of X/Open curses. + */ +#if !NCURSES_WIDECHAR +#define vid_attr(a, pair, opts) vidattr(a) +#endif + +/* + * These functions are extensions - not in X/Open Curses. + */ +#if 1 +#undef NCURSES_EXT_FUNCS +#define NCURSES_EXT_FUNCS 20180127 +typedef int (*NCURSES_WINDOW_CB)(WINDOW*, void*); +typedef int (*NCURSES_SCREEN_CB)(SCREEN*, void*); +extern NCURSES_EXPORT(bool) is_term_resized(int, int); +extern NCURSES_EXPORT(char*) keybound(int, int); +extern NCURSES_EXPORT(const char*) curses_version(void); +extern NCURSES_EXPORT(int) alloc_pair(int, int); +extern NCURSES_EXPORT(int) assume_default_colors(int, int); +extern NCURSES_EXPORT(int) define_key(const char*, int); +extern NCURSES_EXPORT(int) extended_color_content(int, int*, int*, int*); +extern NCURSES_EXPORT(int) extended_pair_content(int, int*, int*); +extern NCURSES_EXPORT(int) extended_slk_color(int); +extern NCURSES_EXPORT(int) find_pair(int, int); +extern NCURSES_EXPORT(int) free_pair(int); +extern NCURSES_EXPORT(int) get_escdelay(void); +extern NCURSES_EXPORT(int) init_extended_color(int, int, int, int); +extern NCURSES_EXPORT(int) init_extended_pair(int, int, int); +extern NCURSES_EXPORT(int) key_defined(const char*); +extern NCURSES_EXPORT(int) keyok(int, bool); +extern NCURSES_EXPORT(void) reset_color_pairs(void); +extern NCURSES_EXPORT(int) resize_term(int, int); +extern NCURSES_EXPORT(int) resizeterm(int, int); +extern NCURSES_EXPORT(int) set_escdelay(int); +extern NCURSES_EXPORT(int) set_tabsize(int); +extern NCURSES_EXPORT(int) use_default_colors(void); +extern NCURSES_EXPORT(int) use_extended_names(bool); +extern NCURSES_EXPORT(int) use_legacy_coding(int); +extern NCURSES_EXPORT(int) use_screen(SCREEN*, NCURSES_SCREEN_CB, void*); +extern NCURSES_EXPORT(int) use_window(WINDOW*, NCURSES_WINDOW_CB, void*); +extern NCURSES_EXPORT(int) wresize(WINDOW*, int, int); +extern NCURSES_EXPORT(void) nofilter(void); + +/* + * These extensions provide access to information stored in the WINDOW even + * when NCURSES_OPAQUE is set: + */ +extern NCURSES_EXPORT(WINDOW*) wgetparent(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_cleared(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_idcok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_idlok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_immedok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_keypad(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_leaveok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_nodelay(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_notimeout(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_pad(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_scrollok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_subwin(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_syncok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) wgetdelay(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) + wgetscrreg(const WINDOW*, int*, int*); /* generated */ + +#else +#define curses_version() NCURSES_VERSION +#endif + +/* + * Extra extension-functions, which pass a SCREEN pointer rather than using + * a global variable SP. + */ +#if 1 +#undef NCURSES_SP_FUNCS +#define NCURSES_SP_FUNCS 20180127 +#define NCURSES_SP_NAME(name) name##_sp + +/* Define the sp-funcs helper function */ +#define NCURSES_SP_OUTC NCURSES_SP_NAME(NCURSES_OUTC) +typedef int (*NCURSES_SP_OUTC)(SCREEN*, int); + +extern NCURSES_EXPORT(SCREEN*) new_prescr(void); /* implemented:SP_FUNC */ + +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(baudrate)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(beep)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(can_change_color)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(cbreak)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(curs_set)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(color_content)( + SCREEN*, + NCURSES_PAIRS_T, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(def_prog_mode)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(def_shell_mode)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(delay_output)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(doupdate)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(echo)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(endwin)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char) + NCURSES_SP_NAME(erasechar)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(filter)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(flash)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(flushinp)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW*) + NCURSES_SP_NAME(getwin)(SCREEN*, FILE*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(halfdelay)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(has_colors)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(has_ic)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(has_il)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_color)( + SCREEN*, + NCURSES_COLOR_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_pair)( + SCREEN*, + NCURSES_PAIRS_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + intrflush)(SCREEN*, WINDOW*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(isendwin)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(NCURSES_CONST char*) + NCURSES_SP_NAME(keyname)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char) + NCURSES_SP_NAME(killchar)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(longname)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + mvcur)(SCREEN*, int, int, int, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(napms)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW*) + NCURSES_SP_NAME(newpad)(SCREEN*, int, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(SCREEN*) NCURSES_SP_NAME(newterm)( + SCREEN*, + NCURSES_CONST char*, + FILE*, + FILE*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW*) NCURSES_SP_NAME( + newwin)(SCREEN*, int, int, int, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(nl)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(nocbreak)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(noecho)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(nonl)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(noqiflush)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(noraw)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(pair_content)( + SCREEN*, + NCURSES_PAIRS_T, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(qiflush)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(raw)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(reset_prog_mode)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(reset_shell_mode)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(resetty)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + ripoffline)(SCREEN*, int, int (*)(WINDOW*, int)); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(savetty)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(scr_init)(SCREEN*, const char*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + scr_restore)(SCREEN*, const char*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(scr_set)(SCREEN*, const char*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_attroff)(SCREEN*, const chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_attron)(SCREEN*, const chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_attrset)(SCREEN*, const chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(attr_t) + NCURSES_SP_NAME(slk_attr)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attr_set)( + SCREEN*, + const attr_t, + NCURSES_PAIRS_T, + void*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_clear)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_color)(SCREEN*, NCURSES_PAIRS_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_init)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(slk_label)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_noutrefresh)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_refresh)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_restore)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_set)(SCREEN*, int, const char*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_touch)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(start_color)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(chtype) + NCURSES_SP_NAME(termattrs)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(termname)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(typeahead)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(ungetch)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(use_env)(SCREEN*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(use_tioctl)(SCREEN*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(vidattr)(SCREEN*, chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + vidputs)(SCREEN*, chtype, NCURSES_SP_OUTC); /* implemented:SP_FUNC */ +#if 1 +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(keybound)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + alloc_pair)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + assume_default_colors)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + define_key)(SCREEN*, const char*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_color_content)( + SCREEN*, + int, + int*, + int*, + int*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_pair_content)( + SCREEN*, + int, + int*, + int*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + extended_slk_color)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(get_escdelay)(SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(find_pair)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(free_pair)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_extended_color)( + SCREEN*, + int, + int, + int, + int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + init_extended_pair)(SCREEN*, int, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME( + is_term_resized)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + key_defined)(SCREEN*, const char*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(keyok)(SCREEN*, int, bool); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(nofilter)(SCREEN*); + /* implemented */ /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(reset_color_pairs)(SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + resize_term)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + resizeterm)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(set_escdelay)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(set_tabsize)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(use_default_colors)(SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + use_legacy_coding)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +#endif +#else +#undef NCURSES_SP_FUNCS +#define NCURSES_SP_FUNCS 0 +#define NCURSES_SP_NAME(name) name +#define NCURSES_SP_OUTC NCURSES_OUTC +#endif + +/* attributes */ + +#define NCURSES_ATTR_SHIFT 8 +#define NCURSES_BITS(mask, shift) \ + (NCURSES_CAST(chtype, (mask)) << ((shift) + NCURSES_ATTR_SHIFT)) + +#define A_NORMAL (1U - 1U) +#define A_ATTRIBUTES NCURSES_BITS(~(1U - 1U), 0) +#define A_CHARTEXT (NCURSES_BITS(1U, 0) - 1U) +#define A_COLOR NCURSES_BITS(((1U) << 8) - 1U, 0) +#define A_STANDOUT NCURSES_BITS(1U, 8) +#define A_UNDERLINE NCURSES_BITS(1U, 9) +#define A_REVERSE NCURSES_BITS(1U, 10) +#define A_BLINK NCURSES_BITS(1U, 11) +#define A_DIM NCURSES_BITS(1U, 12) +#define A_BOLD NCURSES_BITS(1U, 13) +#define A_ALTCHARSET NCURSES_BITS(1U, 14) +#define A_INVIS NCURSES_BITS(1U, 15) +#define A_PROTECT NCURSES_BITS(1U, 16) +#define A_HORIZONTAL NCURSES_BITS(1U, 17) +#define A_LEFT NCURSES_BITS(1U, 18) +#define A_LOW NCURSES_BITS(1U, 19) +#define A_RIGHT NCURSES_BITS(1U, 20) +#define A_TOP NCURSES_BITS(1U, 21) +#define A_VERTICAL NCURSES_BITS(1U, 22) + +#if 1 +#define A_ITALIC NCURSES_BITS(1U, 23) /* ncurses extension */ +#endif + +/* + * Most of the pseudo functions are macros that either provide compatibility + * with older versions of curses, or provide inline functionality to improve + * performance. + */ + +/* + * These pseudo functions are always implemented as macros: + */ + +#define getyx(win, y, x) (y = getcury(win), x = getcurx(win)) +#define getbegyx(win, y, x) (y = getbegy(win), x = getbegx(win)) +#define getmaxyx(win, y, x) (y = getmaxy(win), x = getmaxx(win)) +#define getparyx(win, y, x) (y = getpary(win), x = getparx(win)) + +#define getsyx(y, x) \ + do { \ + if (newscr) { \ + if (is_leaveok(newscr)) \ + (y) = (x) = -1; \ + else \ + getyx(newscr, (y), (x)); \ + } \ + } while (0) + +#define setsyx(y, x) \ + do { \ + if (newscr) { \ + if ((y) == -1 && (x) == -1) \ + leaveok(newscr, TRUE); \ + else { \ + leaveok(newscr, FALSE); \ + wmove(newscr, (y), (x)); \ + } \ + } \ + } while (0) + +#ifndef NCURSES_NOMACROS + +/* + * These miscellaneous pseudo functions are provided for compatibility: + */ + +#define wgetstr(w, s) wgetnstr(w, s, -1) +#define getnstr(s, n) wgetnstr(stdscr, s, (n)) + +#define setterm(term) setupterm(term, 1, (int*)0) + +#define fixterm() reset_prog_mode() +#define resetterm() reset_shell_mode() +#define saveterm() def_prog_mode() +#define crmode() cbreak() +#define nocrmode() nocbreak() +#define gettmode() + +/* It seems older SYSV curses versions define these */ +#if !NCURSES_OPAQUE +#define getattrs(win) \ + NCURSES_CAST(int, NCURSES_OK_ADDR(win) ? (win)->_attrs : A_NORMAL) +#define getcurx(win) (NCURSES_OK_ADDR(win) ? (win)->_curx : ERR) +#define getcury(win) (NCURSES_OK_ADDR(win) ? (win)->_cury : ERR) +#define getbegx(win) (NCURSES_OK_ADDR(win) ? (win)->_begx : ERR) +#define getbegy(win) (NCURSES_OK_ADDR(win) ? (win)->_begy : ERR) +#define getmaxx(win) (NCURSES_OK_ADDR(win) ? ((win)->_maxx + 1) : ERR) +#define getmaxy(win) (NCURSES_OK_ADDR(win) ? ((win)->_maxy + 1) : ERR) +#define getparx(win) (NCURSES_OK_ADDR(win) ? (win)->_parx : ERR) +#define getpary(win) (NCURSES_OK_ADDR(win) ? (win)->_pary : ERR) +#endif /* NCURSES_OPAQUE */ + +#define wstandout(win) (wattrset(win, A_STANDOUT)) +#define wstandend(win) (wattrset(win, A_NORMAL)) + +#define wattron(win, at) wattr_on(win, NCURSES_CAST(attr_t, at), NULL) +#define wattroff(win, at) wattr_off(win, NCURSES_CAST(attr_t, at), NULL) + +#if !NCURSES_OPAQUE +#if NCURSES_WATTR_MACROS +#if NCURSES_WIDECHAR && 1 +#define wattrset(win, at) \ + (NCURSES_OK_ADDR(win) ? ((win)->_color = NCURSES_CAST(int, PAIR_NUMBER(at)), \ + (win)->_attrs = NCURSES_CAST(attr_t, at), \ + OK) \ + : ERR) +#else +#define wattrset(win, at) \ + (NCURSES_OK_ADDR(win) ? ((win)->_attrs = NCURSES_CAST(attr_t, at), OK) : ERR) +#endif +#endif /* NCURSES_WATTR_MACROS */ +#endif /* NCURSES_OPAQUE */ + +#define scroll(win) wscrl(win, 1) + +#define touchwin(win) wtouchln((win), 0, getmaxy(win), 1) +#define touchline(win, s, c) wtouchln((win), s, c, 1) +#define untouchwin(win) wtouchln((win), 0, getmaxy(win), 0) + +#define box(win, v, h) wborder(win, v, v, h, h, 0, 0, 0, 0) +#define border(ls, rs, ts, bs, tl, tr, bl, br) \ + wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br) +#define hline(ch, n) whline(stdscr, ch, (n)) +#define vline(ch, n) wvline(stdscr, ch, (n)) + +#define winstr(w, s) winnstr(w, s, -1) +#define winchstr(w, s) winchnstr(w, s, -1) +#define winsstr(w, s) winsnstr(w, s, -1) + +#if !NCURSES_OPAQUE +#define redrawwin(win) \ + wredrawln(win, 0, (NCURSES_OK_ADDR(win) ? (win)->_maxy + 1 : -1)) +#endif /* NCURSES_OPAQUE */ + +#define waddstr(win, str) waddnstr(win, str, -1) +#define waddchstr(win, str) waddchnstr(win, str, -1) + +/* + * These apply to the first 256 color pairs. + */ +#define COLOR_PAIR(n) (NCURSES_BITS((n), 0) & A_COLOR) +#define PAIR_NUMBER(a) \ + (NCURSES_CAST( \ + int, \ + ((NCURSES_CAST(unsigned long, (a)) & A_COLOR) >> NCURSES_ATTR_SHIFT))) + +/* + * pseudo functions for standard screen + */ + +#define addch(ch) waddch(stdscr, (ch)) +#define addchnstr(str, n) waddchnstr(stdscr, (str), (n)) +#define addchstr(str) waddchstr(stdscr, (str)) +#define addnstr(str, n) waddnstr(stdscr, (str), (n)) +#define addstr(str) waddnstr(stdscr, (str), -1) +#define attr_get(ap, cp, o) wattr_get(stdscr, (ap), (cp), (o)) +#define attr_off(a, o) wattr_off(stdscr, (a), (o)) +#define attr_on(a, o) wattr_on(stdscr, (a), (o)) +#define attr_set(a, c, o) wattr_set(stdscr, (a), (c), (o)) +#define attroff(at) wattroff(stdscr, (at)) +#define attron(at) wattron(stdscr, (at)) +#define attrset(at) wattrset(stdscr, (at)) +#define bkgd(ch) wbkgd(stdscr, (ch)) +#define bkgdset(ch) wbkgdset(stdscr, (ch)) +#define chgat(n, a, c, o) wchgat(stdscr, (n), (a), (c), (o)) +#define clear() wclear(stdscr) +#define clrtobot() wclrtobot(stdscr) +#define clrtoeol() wclrtoeol(stdscr) +#define color_set(c, o) wcolor_set(stdscr, (c), (o)) +#define delch() wdelch(stdscr) +#define deleteln() winsdelln(stdscr, -1) +#define echochar(c) wechochar(stdscr, (c)) +#define erase() werase(stdscr) +#define getch() wgetch(stdscr) +#define getstr(str) wgetstr(stdscr, (str)) +#define inch() winch(stdscr) +#define inchnstr(s, n) winchnstr(stdscr, (s), (n)) +#define inchstr(s) winchstr(stdscr, (s)) +#define innstr(s, n) winnstr(stdscr, (s), (n)) +#define insch(c) winsch(stdscr, (c)) +#define insdelln(n) winsdelln(stdscr, (n)) +#define insertln() winsdelln(stdscr, 1) +#define insnstr(s, n) winsnstr(stdscr, (s), (n)) +#define insstr(s) winsstr(stdscr, (s)) +#define instr(s) winstr(stdscr, (s)) +#define move(y, x) wmove(stdscr, (y), (x)) +#define refresh() wrefresh(stdscr) +#define scrl(n) wscrl(stdscr, (n)) +#define setscrreg(t, b) wsetscrreg(stdscr, (t), (b)) +#define standend() wstandend(stdscr) +#define standout() wstandout(stdscr) +#define timeout(delay) wtimeout(stdscr, (delay)) +#define wdeleteln(win) winsdelln(win, -1) +#define winsertln(win) winsdelln(win, 1) + +/* + * mv functions + */ + +#define mvwaddch(win, y, x, ch) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddch((win), (ch))) +#define mvwaddchnstr(win, y, x, str, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddchnstr((win), (str), (n))) +#define mvwaddchstr(win, y, x, str) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddchnstr((win), (str), -1)) +#define mvwaddnstr(win, y, x, str, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddnstr((win), (str), (n))) +#define mvwaddstr(win, y, x, str) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddnstr((win), (str), -1)) +#define mvwchgat(win, y, x, n, a, c, o) \ + (wmove((win), (y), (x)) == ERR ? ERR : wchgat((win), (n), (a), (c), (o))) +#define mvwdelch(win, y, x) (wmove((win), (y), (x)) == ERR ? ERR : wdelch(win)) +#define mvwgetch(win, y, x) (wmove((win), (y), (x)) == ERR ? ERR : wgetch(win)) +#define mvwgetnstr(win, y, x, str, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : wgetnstr((win), (str), (n))) +#define mvwgetstr(win, y, x, str) \ + (wmove((win), (y), (x)) == ERR ? ERR : wgetstr((win), (str))) +#define mvwhline(win, y, x, c, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : whline((win), (c), (n))) +#define mvwinch(win, y, x) \ + (wmove((win), (y), (x)) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win)) +#define mvwinchnstr(win, y, x, s, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : winchnstr((win), (s), (n))) +#define mvwinchstr(win, y, x, s) \ + (wmove((win), (y), (x)) == ERR ? ERR : winchstr((win), (s))) +#define mvwinnstr(win, y, x, s, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : winnstr((win), (s), (n))) +#define mvwinsch(win, y, x, c) \ + (wmove((win), (y), (x)) == ERR ? ERR : winsch((win), (c))) +#define mvwinsnstr(win, y, x, s, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : winsnstr((win), (s), (n))) +#define mvwinsstr(win, y, x, s) \ + (wmove((win), (y), (x)) == ERR ? ERR : winsstr((win), (s))) +#define mvwinstr(win, y, x, s) \ + (wmove((win), (y), (x)) == ERR ? ERR : winstr((win), (s))) +#define mvwvline(win, y, x, c, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : wvline((win), (c), (n))) + +#define mvaddch(y, x, ch) mvwaddch(stdscr, (y), (x), (ch)) +#define mvaddchnstr(y, x, str, n) mvwaddchnstr(stdscr, (y), (x), (str), (n)) +#define mvaddchstr(y, x, str) mvwaddchstr(stdscr, (y), (x), (str)) +#define mvaddnstr(y, x, str, n) mvwaddnstr(stdscr, (y), (x), (str), (n)) +#define mvaddstr(y, x, str) mvwaddstr(stdscr, (y), (x), (str)) +#define mvchgat(y, x, n, a, c, o) mvwchgat(stdscr, (y), (x), (n), (a), (c), (o)) +#define mvdelch(y, x) mvwdelch(stdscr, (y), (x)) +#define mvgetch(y, x) mvwgetch(stdscr, (y), (x)) +#define mvgetnstr(y, x, str, n) mvwgetnstr(stdscr, (y), (x), (str), (n)) +#define mvgetstr(y, x, str) mvwgetstr(stdscr, (y), (x), (str)) +#define mvhline(y, x, c, n) mvwhline(stdscr, (y), (x), (c), (n)) +#define mvinch(y, x) mvwinch(stdscr, (y), (x)) +#define mvinchnstr(y, x, s, n) mvwinchnstr(stdscr, (y), (x), (s), (n)) +#define mvinchstr(y, x, s) mvwinchstr(stdscr, (y), (x), (s)) +#define mvinnstr(y, x, s, n) mvwinnstr(stdscr, (y), (x), (s), (n)) +#define mvinsch(y, x, c) mvwinsch(stdscr, (y), (x), (c)) +#define mvinsnstr(y, x, s, n) mvwinsnstr(stdscr, (y), (x), (s), (n)) +#define mvinsstr(y, x, s) mvwinsstr(stdscr, (y), (x), (s)) +#define mvinstr(y, x, s) mvwinstr(stdscr, (y), (x), (s)) +#define mvvline(y, x, c, n) mvwvline(stdscr, (y), (x), (c), (n)) + +/* + * Some wide-character functions can be implemented without the extensions. + */ +#if !NCURSES_OPAQUE +#define getbkgd(win) (NCURSES_OK_ADDR(win) ? ((win)->_bkgd) : 0) +#endif /* NCURSES_OPAQUE */ + +#define slk_attr_off(a, v) ((v) ? ERR : slk_attroff(a)) +#define slk_attr_on(a, v) ((v) ? ERR : slk_attron(a)) + +#if !NCURSES_OPAQUE +#if NCURSES_WATTR_MACROS +#if NCURSES_WIDECHAR && 1 +#define wattr_set(win, a, p, opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)((win)->_attrs = ((a) & ~A_COLOR), (win)->_color = (opts) ? *(int*)(opts) : (p)), \ + OK) \ + : ERR) +#define wattr_get(win, a, p, opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)(NCURSES_OK_ADDR(a) ? (*(a) = (win)->_attrs) : OK), \ + (void)(NCURSES_OK_ADDR(p) ? (*(p) = (NCURSES_PAIRS_T)(win)->_color) : OK), \ + (void)(NCURSES_OK_ADDR(opts) ? (*(int*)(opts) = (win)->_color) : OK), \ + OK) \ + : ERR) +#else /* !(NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */ +#define wattr_set(win, a, p, opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)((win)->_attrs = (((a) & ~A_COLOR) | (attr_t)COLOR_PAIR(p))), \ + OK) \ + : ERR) +#define wattr_get(win, a, p, opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)(NCURSES_OK_ADDR(a) ? (*(a) = (win)->_attrs) : OK), \ + (void)(NCURSES_OK_ADDR(p) ? (*(p) = (NCURSES_PAIRS_T)PAIR_NUMBER((win)->_attrs)) : OK), \ + OK) \ + : ERR) +#endif /* (NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */ +#endif /* NCURSES_WATTR_MACROS */ +#endif /* NCURSES_OPAQUE */ + +/* + * X/Open curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use + * varargs.h. It adds new calls vw_printw/vw_scanw, which are supposed to + * use POSIX stdarg.h. The ncurses versions of vwprintw/vwscanw already + * use stdarg.h, so... + */ +#define vw_printw vwprintw +#define vw_scanw vwscanw + +/* + * Export fallback function for use in C++ binding. + */ +#if !1 +#define vsscanf(a, b, c) _nc_vsscanf(a, b, c) +NCURSES_EXPORT(int) vsscanf(const char*, const char*, va_list); +#endif + +/* + * These macros are extensions - not in X/Open Curses. + */ +#if 1 +#if !NCURSES_OPAQUE +#define is_cleared(win) (NCURSES_OK_ADDR(win) ? (win)->_clear : FALSE) +#define is_idcok(win) (NCURSES_OK_ADDR(win) ? (win)->_idcok : FALSE) +#define is_idlok(win) (NCURSES_OK_ADDR(win) ? (win)->_idlok : FALSE) +#define is_immedok(win) (NCURSES_OK_ADDR(win) ? (win)->_immed : FALSE) +#define is_keypad(win) (NCURSES_OK_ADDR(win) ? (win)->_use_keypad : FALSE) +#define is_leaveok(win) (NCURSES_OK_ADDR(win) ? (win)->_leaveok : FALSE) +#define is_nodelay(win) (NCURSES_OK_ADDR(win) ? ((win)->_delay == 0) : FALSE) +#define is_notimeout(win) (NCURSES_OK_ADDR(win) ? (win)->_notimeout : FALSE) +#define is_pad(win) \ + (NCURSES_OK_ADDR(win) ? ((win)->_flags & _ISPAD) != 0 : FALSE) +#define is_scrollok(win) (NCURSES_OK_ADDR(win) ? (win)->_scroll : FALSE) +#define is_subwin(win) \ + (NCURSES_OK_ADDR(win) ? ((win)->_flags & _SUBWIN) != 0 : FALSE) +#define is_syncok(win) (NCURSES_OK_ADDR(win) ? (win)->_sync : FALSE) +#define wgetdelay(win) (NCURSES_OK_ADDR(win) ? (win)->_delay : 0) +#define wgetparent(win) (NCURSES_OK_ADDR(win) ? (win)->_parent : 0) +#define wgetscrreg(win, t, b) \ + (NCURSES_OK_ADDR(win) \ + ? (*(t) = (win)->_regtop, *(b) = (win)->_regbottom, OK) \ + : ERR) +#endif +#endif + +#endif /* NCURSES_NOMACROS */ + +/* + * Public variables. + * + * Notes: + * a. ESCDELAY was an undocumented feature under AIX curses. + * It gives the ESC expire time in milliseconds. + * b. ttytype is needed for backward compatibility + */ +#if NCURSES_REENTRANT + +NCURSES_WRAPPED_VAR(WINDOW*, curscr); +NCURSES_WRAPPED_VAR(WINDOW*, newscr); +NCURSES_WRAPPED_VAR(WINDOW*, stdscr); +NCURSES_WRAPPED_VAR(char*, ttytype); +NCURSES_WRAPPED_VAR(int, COLORS); +NCURSES_WRAPPED_VAR(int, COLOR_PAIRS); +NCURSES_WRAPPED_VAR(int, COLS); +NCURSES_WRAPPED_VAR(int, ESCDELAY); +NCURSES_WRAPPED_VAR(int, LINES); +NCURSES_WRAPPED_VAR(int, TABSIZE); + +#define curscr NCURSES_PUBLIC_VAR(curscr()) +#define newscr NCURSES_PUBLIC_VAR(newscr()) +#define stdscr NCURSES_PUBLIC_VAR(stdscr()) +#define ttytype NCURSES_PUBLIC_VAR(ttytype()) +#define COLORS NCURSES_PUBLIC_VAR(COLORS()) +#define COLOR_PAIRS NCURSES_PUBLIC_VAR(COLOR_PAIRS()) +#define COLS NCURSES_PUBLIC_VAR(COLS()) +#define ESCDELAY NCURSES_PUBLIC_VAR(ESCDELAY()) +#define LINES NCURSES_PUBLIC_VAR(LINES()) +#define TABSIZE NCURSES_PUBLIC_VAR(TABSIZE()) + +#else + +extern NCURSES_EXPORT_VAR(WINDOW*) curscr; +extern NCURSES_EXPORT_VAR(WINDOW*) newscr; +extern NCURSES_EXPORT_VAR(WINDOW*) stdscr; +extern NCURSES_EXPORT_VAR(char) ttytype[]; +extern NCURSES_EXPORT_VAR(int) COLORS; +extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS; +extern NCURSES_EXPORT_VAR(int) COLS; +extern NCURSES_EXPORT_VAR(int) ESCDELAY; +extern NCURSES_EXPORT_VAR(int) LINES; +extern NCURSES_EXPORT_VAR(int) TABSIZE; + +#endif + +/* + * Pseudo-character tokens outside ASCII range. The curses wgetch() function + * will return any given one of these only if the corresponding k- capability + * is defined in your terminal's terminfo entry. + * + * Some keys (KEY_A1, etc) are arranged like this: + * a1 up a3 + * left b2 right + * c1 down c3 + * + * A few key codes do not depend upon the terminfo entry. + */ +#define KEY_CODE_YES 0400 /* A wchar_t contains a key code */ +#define KEY_MIN 0401 /* Minimum curses key */ +#define KEY_BREAK 0401 /* Break key (unreliable) */ +#define KEY_SRESET 0530 /* Soft (partial) reset (unreliable) */ +#define KEY_RESET 0531 /* Reset or hard reset (unreliable) */ +/* + * These definitions were generated by ./MKkey_defs.sh ./Caps + */ +#define KEY_DOWN 0402 /* down-arrow key */ +#define KEY_UP 0403 /* up-arrow key */ +#define KEY_LEFT 0404 /* left-arrow key */ +#define KEY_RIGHT 0405 /* right-arrow key */ +#define KEY_HOME 0406 /* home key */ +#define KEY_BACKSPACE 0407 /* backspace key */ +#define KEY_F0 0410 /* Function keys. Space for 64 */ +#define KEY_F(n) (KEY_F0 + (n)) /* Value of function key n */ +#define KEY_DL 0510 /* delete-line key */ +#define KEY_IL 0511 /* insert-line key */ +#define KEY_DC 0512 /* delete-character key */ +#define KEY_IC 0513 /* insert-character key */ +#define KEY_EIC 0514 /* sent by rmir or smir in insert mode */ +#define KEY_CLEAR 0515 /* clear-screen or erase key */ +#define KEY_EOS 0516 /* clear-to-end-of-screen key */ +#define KEY_EOL 0517 /* clear-to-end-of-line key */ +#define KEY_SF 0520 /* scroll-forward key */ +#define KEY_SR 0521 /* scroll-backward key */ +#define KEY_NPAGE 0522 /* next-page key */ +#define KEY_PPAGE 0523 /* previous-page key */ +#define KEY_STAB 0524 /* set-tab key */ +#define KEY_CTAB 0525 /* clear-tab key */ +#define KEY_CATAB 0526 /* clear-all-tabs key */ +#define KEY_ENTER 0527 /* enter/send key */ +#define KEY_PRINT 0532 /* print key */ +#define KEY_LL 0533 /* lower-left key (home down) */ +#define KEY_A1 0534 /* upper left of keypad */ +#define KEY_A3 0535 /* upper right of keypad */ +#define KEY_B2 0536 /* center of keypad */ +#define KEY_C1 0537 /* lower left of keypad */ +#define KEY_C3 0540 /* lower right of keypad */ +#define KEY_BTAB 0541 /* back-tab key */ +#define KEY_BEG 0542 /* begin key */ +#define KEY_CANCEL 0543 /* cancel key */ +#define KEY_CLOSE 0544 /* close key */ +#define KEY_COMMAND 0545 /* command key */ +#define KEY_COPY 0546 /* copy key */ +#define KEY_CREATE 0547 /* create key */ +#define KEY_END 0550 /* end key */ +#define KEY_EXIT 0551 /* exit key */ +#define KEY_FIND 0552 /* find key */ +#define KEY_HELP 0553 /* help key */ +#define KEY_MARK 0554 /* mark key */ +#define KEY_MESSAGE 0555 /* message key */ +#define KEY_MOVE 0556 /* move key */ +#define KEY_NEXT 0557 /* next key */ +#define KEY_OPEN 0560 /* open key */ +#define KEY_OPTIONS 0561 /* options key */ +#define KEY_PREVIOUS 0562 /* previous key */ +#define KEY_REDO 0563 /* redo key */ +#define KEY_REFERENCE 0564 /* reference key */ +#define KEY_REFRESH 0565 /* refresh key */ +#define KEY_REPLACE 0566 /* replace key */ +#define KEY_RESTART 0567 /* restart key */ +#define KEY_RESUME 0570 /* resume key */ +#define KEY_SAVE 0571 /* save key */ +#define KEY_SBEG 0572 /* shifted begin key */ +#define KEY_SCANCEL 0573 /* shifted cancel key */ +#define KEY_SCOMMAND 0574 /* shifted command key */ +#define KEY_SCOPY 0575 /* shifted copy key */ +#define KEY_SCREATE 0576 /* shifted create key */ +#define KEY_SDC 0577 /* shifted delete-character key */ +#define KEY_SDL 0600 /* shifted delete-line key */ +#define KEY_SELECT 0601 /* select key */ +#define KEY_SEND 0602 /* shifted end key */ +#define KEY_SEOL 0603 /* shifted clear-to-end-of-line key */ +#define KEY_SEXIT 0604 /* shifted exit key */ +#define KEY_SFIND 0605 /* shifted find key */ +#define KEY_SHELP 0606 /* shifted help key */ +#define KEY_SHOME 0607 /* shifted home key */ +#define KEY_SIC 0610 /* shifted insert-character key */ +#define KEY_SLEFT 0611 /* shifted left-arrow key */ +#define KEY_SMESSAGE 0612 /* shifted message key */ +#define KEY_SMOVE 0613 /* shifted move key */ +#define KEY_SNEXT 0614 /* shifted next key */ +#define KEY_SOPTIONS 0615 /* shifted options key */ +#define KEY_SPREVIOUS 0616 /* shifted previous key */ +#define KEY_SPRINT 0617 /* shifted print key */ +#define KEY_SREDO 0620 /* shifted redo key */ +#define KEY_SREPLACE 0621 /* shifted replace key */ +#define KEY_SRIGHT 0622 /* shifted right-arrow key */ +#define KEY_SRSUME 0623 /* shifted resume key */ +#define KEY_SSAVE 0624 /* shifted save key */ +#define KEY_SSUSPEND 0625 /* shifted suspend key */ +#define KEY_SUNDO 0626 /* shifted undo key */ +#define KEY_SUSPEND 0627 /* suspend key */ +#define KEY_UNDO 0630 /* undo key */ +#define KEY_MOUSE 0631 /* Mouse event has occurred */ +#define KEY_RESIZE 0632 /* Terminal resize event */ +#define KEY_EVENT 0633 /* We were interrupted by an event */ + +#define KEY_MAX 0777 /* Maximum key value is 0633 */ +/* $Id: curses.wide,v 1.50 2017/03/26 16:05:21 tom Exp $ */ +/* + * vile:cmode: + * This file is part of ncurses, designed to be appended after curses.h.in + * (see that file for the relevant copyright). + */ +#define _XOPEN_CURSES 1 + +#if NCURSES_WIDECHAR + +extern NCURSES_EXPORT_VAR(cchar_t*) _nc_wacs; + +#define NCURSES_WACS(c) (&_nc_wacs[NCURSES_CAST(unsigned char, (c))]) + +#define WACS_BSSB NCURSES_WACS('l') +#define WACS_SSBB NCURSES_WACS('m') +#define WACS_BBSS NCURSES_WACS('k') +#define WACS_SBBS NCURSES_WACS('j') +#define WACS_SBSS NCURSES_WACS('u') +#define WACS_SSSB NCURSES_WACS('t') +#define WACS_SSBS NCURSES_WACS('v') +#define WACS_BSSS NCURSES_WACS('w') +#define WACS_BSBS NCURSES_WACS('q') +#define WACS_SBSB NCURSES_WACS('x') +#define WACS_SSSS NCURSES_WACS('n') + +#define WACS_ULCORNER WACS_BSSB +#define WACS_LLCORNER WACS_SSBB +#define WACS_URCORNER WACS_BBSS +#define WACS_LRCORNER WACS_SBBS +#define WACS_RTEE WACS_SBSS +#define WACS_LTEE WACS_SSSB +#define WACS_BTEE WACS_SSBS +#define WACS_TTEE WACS_BSSS +#define WACS_HLINE WACS_BSBS +#define WACS_VLINE WACS_SBSB +#define WACS_PLUS WACS_SSSS + +#define WACS_S1 NCURSES_WACS('o') /* scan line 1 */ +#define WACS_S9 NCURSES_WACS('s') /* scan line 9 */ +#define WACS_DIAMOND NCURSES_WACS('`') /* diamond */ +#define WACS_CKBOARD NCURSES_WACS('a') /* checker board */ +#define WACS_DEGREE NCURSES_WACS('f') /* degree symbol */ +#define WACS_PLMINUS NCURSES_WACS('g') /* plus/minus */ +#define WACS_BULLET NCURSES_WACS('~') /* bullet */ + +/* Teletype 5410v1 symbols */ +#define WACS_LARROW NCURSES_WACS(',') /* arrow left */ +#define WACS_RARROW NCURSES_WACS('+') /* arrow right */ +#define WACS_DARROW NCURSES_WACS('.') /* arrow down */ +#define WACS_UARROW NCURSES_WACS('-') /* arrow up */ +#define WACS_BOARD NCURSES_WACS('h') /* board of squares */ +#define WACS_LANTERN NCURSES_WACS('i') /* lantern symbol */ +#define WACS_BLOCK NCURSES_WACS('0') /* solid square block */ + +/* ncurses extensions */ +#define WACS_S3 NCURSES_WACS('p') /* scan line 3 */ +#define WACS_S7 NCURSES_WACS('r') /* scan line 7 */ +#define WACS_LEQUAL NCURSES_WACS('y') /* less/equal */ +#define WACS_GEQUAL NCURSES_WACS('z') /* greater/equal */ +#define WACS_PI NCURSES_WACS('{') /* Pi */ +#define WACS_NEQUAL NCURSES_WACS('|') /* not equal */ +#define WACS_STERLING NCURSES_WACS('}') /* UK pound sign */ + +/* double lines */ +#define WACS_BDDB NCURSES_WACS('C') +#define WACS_DDBB NCURSES_WACS('D') +#define WACS_BBDD NCURSES_WACS('B') +#define WACS_DBBD NCURSES_WACS('A') +#define WACS_DBDD NCURSES_WACS('G') +#define WACS_DDDB NCURSES_WACS('F') +#define WACS_DDBD NCURSES_WACS('H') +#define WACS_BDDD NCURSES_WACS('I') +#define WACS_BDBD NCURSES_WACS('R') +#define WACS_DBDB NCURSES_WACS('Y') +#define WACS_DDDD NCURSES_WACS('E') + +#define WACS_D_ULCORNER WACS_BDDB +#define WACS_D_LLCORNER WACS_DDBB +#define WACS_D_URCORNER WACS_BBDD +#define WACS_D_LRCORNER WACS_DBBD +#define WACS_D_RTEE WACS_DBDD +#define WACS_D_LTEE WACS_DDDB +#define WACS_D_BTEE WACS_DDBD +#define WACS_D_TTEE WACS_BDDD +#define WACS_D_HLINE WACS_BDBD +#define WACS_D_VLINE WACS_DBDB +#define WACS_D_PLUS WACS_DDDD + +/* thick lines */ +#define WACS_BTTB NCURSES_WACS('L') +#define WACS_TTBB NCURSES_WACS('M') +#define WACS_BBTT NCURSES_WACS('K') +#define WACS_TBBT NCURSES_WACS('J') +#define WACS_TBTT NCURSES_WACS('U') +#define WACS_TTTB NCURSES_WACS('T') +#define WACS_TTBT NCURSES_WACS('V') +#define WACS_BTTT NCURSES_WACS('W') +#define WACS_BTBT NCURSES_WACS('Q') +#define WACS_TBTB NCURSES_WACS('X') +#define WACS_TTTT NCURSES_WACS('N') + +#define WACS_T_ULCORNER WACS_BTTB +#define WACS_T_LLCORNER WACS_TTBB +#define WACS_T_URCORNER WACS_BBTT +#define WACS_T_LRCORNER WACS_TBBT +#define WACS_T_RTEE WACS_TBTT +#define WACS_T_LTEE WACS_TTTB +#define WACS_T_BTEE WACS_TTBT +#define WACS_T_TTEE WACS_BTTT +#define WACS_T_HLINE WACS_BTBT +#define WACS_T_VLINE WACS_TBTB +#define WACS_T_PLUS WACS_TTTT + +/* + * Function prototypes for wide-character operations. + * + * "generated" comments should include ":WIDEC" to make the corresponding + * functions ifdef'd in lib_gen.c + * + * "implemented" comments do not need this marker. + */ + +extern NCURSES_EXPORT(int) add_wch(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + add_wchnstr(const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) add_wchstr(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) addnwstr(const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) addwstr(const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) bkgrnd(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(void) bkgrndset(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) border_set( + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + box_set(WINDOW*, const cchar_t*, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) echo_wchar(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) erasewchar(wchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) get_wch(wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) get_wstr(wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) getbkgrnd(cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) getcchar( + const cchar_t*, + wchar_t*, + attr_t*, + NCURSES_PAIRS_T*, + void*); /* implemented */ +extern NCURSES_EXPORT(int) getn_wstr(wint_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) hline_set(const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) in_wch(cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) in_wchnstr(cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) in_wchstr(cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) innwstr(wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) ins_nwstr(const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) ins_wch(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) ins_wstr(const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) inwstr(wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(NCURSES_CONST char*) key_name(wchar_t); /* implemented */ +extern NCURSES_EXPORT(int) killwchar(wchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + mvadd_wch(int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvadd_wchnstr(int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvadd_wchstr(int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvaddnwstr(int, int, const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvaddwstr(int, int, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvget_wch(int, int, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvget_wstr(int, int, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvgetn_wstr(int, int, wint_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvhline_set(int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvin_wch(int, int, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvin_wchnstr(int, int, cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvin_wchstr(int, int, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvinnwstr(int, int, wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvins_nwstr(int, int, const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvins_wch(int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvins_wstr(int, int, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvinwstr(int, int, wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvvline_set(int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwadd_wch(WINDOW*, int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwadd_wchnstr( + WINDOW*, + int, + int, + const cchar_t*, + int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwadd_wchstr(WINDOW*, int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwaddnwstr(WINDOW*, int, int, const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwaddwstr(WINDOW*, int, int, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwget_wch(WINDOW*, int, int, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwget_wstr(WINDOW*, int, int, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwgetn_wstr(WINDOW*, int, int, wint_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwhline_set(WINDOW*, int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwin_wch(WINDOW*, int, int, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwin_wchnstr(WINDOW*, int, int, cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwin_wchstr(WINDOW*, int, int, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwinnwstr(WINDOW*, int, int, wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwins_nwstr(WINDOW*, int, int, const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwins_wch(WINDOW*, int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwins_wstr(WINDOW*, int, int, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwinwstr(WINDOW*, int, int, wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwvline_set(WINDOW*, int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + pecho_wchar(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) setcchar( + cchar_t*, + const wchar_t*, + const attr_t, + NCURSES_PAIRS_T, + const void*); /* implemented */ +extern NCURSES_EXPORT(int) slk_wset(int, const wchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(attr_t) term_attrs(void); /* implemented */ +extern NCURSES_EXPORT(int) unget_wch(const wchar_t); /* implemented */ +extern NCURSES_EXPORT(int) + vid_attr(attr_t, NCURSES_PAIRS_T, void*); /* implemented */ +extern NCURSES_EXPORT(int) + vid_puts(attr_t, NCURSES_PAIRS_T, void*, NCURSES_OUTC); /* implemented */ +extern NCURSES_EXPORT(int) vline_set(const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wadd_wch(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + wadd_wchnstr(WINDOW*, const cchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) + wadd_wchstr(WINDOW*, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + waddnwstr(WINDOW*, const wchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) + waddwstr(WINDOW*, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wbkgrnd(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(void) + wbkgrndset(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) wborder_set( + WINDOW*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + wecho_wchar(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) wget_wch(WINDOW*, wint_t*); /* implemented */ +extern NCURSES_EXPORT(int) wget_wstr(WINDOW*, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wgetbkgrnd(WINDOW*, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wgetn_wstr(WINDOW*, wint_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) + whline_set(WINDOW*, const cchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) win_wch(WINDOW*, cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + win_wchnstr(WINDOW*, cchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) win_wchstr(WINDOW*, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) winnwstr(WINDOW*, wchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) + wins_nwstr(WINDOW*, const wchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) wins_wch(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + wins_wstr(WINDOW*, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) winwstr(WINDOW*, wchar_t*); /* implemented */ +extern NCURSES_EXPORT(wchar_t*) wunctrl(cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + wvline_set(WINDOW*, const cchar_t*, int); /* implemented */ + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(attr_t) + NCURSES_SP_NAME(term_attrs)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + unget_wch)(SCREEN*, const wchar_t); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(wchar_t*) + NCURSES_SP_NAME(wunctrl)(SCREEN*, cchar_t*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_attr)( + SCREEN*, + attr_t, + NCURSES_PAIRS_T, + void*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts)( + SCREEN*, + attr_t, + NCURSES_PAIRS_T, + void*, + NCURSES_SP_OUTC); /* implemented:SP_FUNC */ +#endif + +#ifndef NCURSES_NOMACROS + +/* + * XSI curses macros for XPG4 conformance. + */ +#define add_wch(c) wadd_wch(stdscr, (c)) +#define add_wchnstr(str, n) wadd_wchnstr(stdscr, (str), (n)) +#define add_wchstr(str) wadd_wchstr(stdscr, (str)) +#define addnwstr(wstr, n) waddnwstr(stdscr, (wstr), (n)) +#define addwstr(wstr) waddwstr(stdscr, (wstr)) +#define bkgrnd(c) wbkgrnd(stdscr, (c)) +#define bkgrndset(c) wbkgrndset(stdscr, (c)) +#define border_set(l, r, t, b, tl, tr, bl, br) \ + wborder_set(stdscr, (l), (r), (t), (b), tl, tr, bl, br) +#define box_set(w, v, h) wborder_set((w), (v), (v), (h), (h), 0, 0, 0, 0) +#define echo_wchar(c) wecho_wchar(stdscr, (c)) +#define get_wch(c) wget_wch(stdscr, (c)) +#define get_wstr(t) wget_wstr(stdscr, (t)) +#define getbkgrnd(wch) wgetbkgrnd(stdscr, (wch)) +#define getn_wstr(t, n) wgetn_wstr(stdscr, (t), (n)) +#define hline_set(c, n) whline_set(stdscr, (c), (n)) +#define in_wch(c) win_wch(stdscr, (c)) +#define in_wchnstr(c, n) win_wchnstr(stdscr, (c), (n)) +#define in_wchstr(c) win_wchstr(stdscr, (c)) +#define innwstr(c, n) winnwstr(stdscr, (c), (n)) +#define ins_nwstr(t, n) wins_nwstr(stdscr, (t), (n)) +#define ins_wch(c) wins_wch(stdscr, (c)) +#define ins_wstr(t) wins_wstr(stdscr, (t)) +#define inwstr(c) winwstr(stdscr, (c)) +#define vline_set(c, n) wvline_set(stdscr, (c), (n)) +#define wadd_wchstr(win, str) wadd_wchnstr((win), (str), -1) +#define waddwstr(win, wstr) waddnwstr((win), (wstr), -1) +#define wget_wstr(w, t) wgetn_wstr((w), (t), -1) +#define win_wchstr(w, c) win_wchnstr((w), (c), -1) +#define wins_wstr(w, t) wins_nwstr((w), (t), -1) + +#if !NCURSES_OPAQUE +#define wgetbkgrnd(win, wch) \ + (NCURSES_OK_ADDR(wch) ? ((win) ? (*(wch) = (win)->_bkgrnd) : *(wch), OK) \ + : ERR) +#endif + +#define mvadd_wch(y, x, c) mvwadd_wch(stdscr, (y), (x), (c)) +#define mvadd_wchnstr(y, x, s, n) mvwadd_wchnstr(stdscr, (y), (x), (s), (n)) +#define mvadd_wchstr(y, x, s) mvwadd_wchstr(stdscr, (y), (x), (s)) +#define mvaddnwstr(y, x, wstr, n) mvwaddnwstr(stdscr, (y), (x), (wstr), (n)) +#define mvaddwstr(y, x, wstr) mvwaddwstr(stdscr, (y), (x), (wstr)) +#define mvget_wch(y, x, c) mvwget_wch(stdscr, (y), (x), (c)) +#define mvget_wstr(y, x, t) mvwget_wstr(stdscr, (y), (x), (t)) +#define mvgetn_wstr(y, x, t, n) mvwgetn_wstr(stdscr, (y), (x), (t), (n)) +#define mvhline_set(y, x, c, n) mvwhline_set(stdscr, (y), (x), (c), (n)) +#define mvin_wch(y, x, c) mvwin_wch(stdscr, (y), (x), (c)) +#define mvin_wchnstr(y, x, c, n) mvwin_wchnstr(stdscr, (y), (x), (c), (n)) +#define mvin_wchstr(y, x, c) mvwin_wchstr(stdscr, (y), (x), (c)) +#define mvinnwstr(y, x, c, n) mvwinnwstr(stdscr, (y), (x), (c), (n)) +#define mvins_nwstr(y, x, t, n) mvwins_nwstr(stdscr, (y), (x), (t), (n)) +#define mvins_wch(y, x, c) mvwins_wch(stdscr, (y), (x), (c)) +#define mvins_wstr(y, x, t) mvwins_wstr(stdscr, (y), (x), (t)) +#define mvinwstr(y, x, c) mvwinwstr(stdscr, (y), (x), (c)) +#define mvvline_set(y, x, c, n) mvwvline_set(stdscr, (y), (x), (c), (n)) + +#define mvwadd_wch(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : wadd_wch((win), (c))) +#define mvwadd_wchnstr(win, y, x, s, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : wadd_wchnstr((win), (s), (n))) +#define mvwadd_wchstr(win, y, x, s) \ + (wmove(win, (y), (x)) == ERR ? ERR : wadd_wchstr((win), (s))) +#define mvwaddnwstr(win, y, x, wstr, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : waddnwstr((win), (wstr), (n))) +#define mvwaddwstr(win, y, x, wstr) \ + (wmove(win, (y), (x)) == ERR ? ERR : waddwstr((win), (wstr))) +#define mvwget_wch(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : wget_wch((win), (c))) +#define mvwget_wstr(win, y, x, t) \ + (wmove(win, (y), (x)) == ERR ? ERR : wget_wstr((win), (t))) +#define mvwgetn_wstr(win, y, x, t, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : wgetn_wstr((win), (t), (n))) +#define mvwhline_set(win, y, x, c, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : whline_set((win), (c), (n))) +#define mvwin_wch(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : win_wch((win), (c))) +#define mvwin_wchnstr(win, y, x, c, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : win_wchnstr((win), (c), (n))) +#define mvwin_wchstr(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : win_wchstr((win), (c))) +#define mvwinnwstr(win, y, x, c, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : winnwstr((win), (c), (n))) +#define mvwins_nwstr(win, y, x, t, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : wins_nwstr((win), (t), (n))) +#define mvwins_wch(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : wins_wch((win), (c))) +#define mvwins_wstr(win, y, x, t) \ + (wmove(win, (y), (x)) == ERR ? ERR : wins_wstr((win), (t))) +#define mvwinwstr(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : winwstr((win), (c))) +#define mvwvline_set(win, y, x, c, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : wvline_set((win), (c), (n))) + +#endif /* NCURSES_NOMACROS */ + +#if defined(TRACE) || defined(NCURSES_TEST) +extern NCURSES_EXPORT(const char*) _nc_viswbuf(const wchar_t*); +extern NCURSES_EXPORT(const char*) _nc_viswibuf(const wint_t*); +#endif + +#endif /* NCURSES_WIDECHAR */ +/* $Id: curses.tail,v 1.23 2016/02/13 16:37:45 tom Exp $ */ +/* + * vile:cmode: + * This file is part of ncurses, designed to be appended after curses.h.in + * (see that file for the relevant copyright). + */ + +/* mouse interface */ + +#if NCURSES_MOUSE_VERSION > 1 +#define NCURSES_MOUSE_MASK(b, m) ((m) << (((b)-1) * 5)) +#else +#define NCURSES_MOUSE_MASK(b, m) ((m) << (((b)-1) * 6)) +#endif + +#define NCURSES_BUTTON_RELEASED 001L +#define NCURSES_BUTTON_PRESSED 002L +#define NCURSES_BUTTON_CLICKED 004L +#define NCURSES_DOUBLE_CLICKED 010L +#define NCURSES_TRIPLE_CLICKED 020L +#define NCURSES_RESERVED_EVENT 040L + +/* event masks */ +#define BUTTON1_RELEASED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED) +#define BUTTON1_PRESSED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED) +#define BUTTON1_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED) +#define BUTTON1_DOUBLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED) +#define BUTTON1_TRIPLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED) + +#define BUTTON2_RELEASED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED) +#define BUTTON2_PRESSED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED) +#define BUTTON2_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED) +#define BUTTON2_DOUBLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED) +#define BUTTON2_TRIPLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED) + +#define BUTTON3_RELEASED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED) +#define BUTTON3_PRESSED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED) +#define BUTTON3_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED) +#define BUTTON3_DOUBLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED) +#define BUTTON3_TRIPLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED) + +#define BUTTON4_RELEASED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED) +#define BUTTON4_PRESSED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED) +#define BUTTON4_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED) +#define BUTTON4_DOUBLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED) +#define BUTTON4_TRIPLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED) + +/* + * In 32 bits the version-1 scheme does not provide enough space for a 5th + * button, unless we choose to change the ABI by omitting the reserved-events. + */ +#if NCURSES_MOUSE_VERSION > 1 + +#define BUTTON5_RELEASED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED) +#define BUTTON5_PRESSED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED) +#define BUTTON5_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED) +#define BUTTON5_DOUBLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED) +#define BUTTON5_TRIPLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED) + +#define BUTTON_CTRL NCURSES_MOUSE_MASK(6, 0001L) +#define BUTTON_SHIFT NCURSES_MOUSE_MASK(6, 0002L) +#define BUTTON_ALT NCURSES_MOUSE_MASK(6, 0004L) +#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(6, 0010L) + +#else + +#define BUTTON1_RESERVED_EVENT NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT) +#define BUTTON2_RESERVED_EVENT NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT) +#define BUTTON3_RESERVED_EVENT NCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT) +#define BUTTON4_RESERVED_EVENT NCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT) + +#define BUTTON_CTRL NCURSES_MOUSE_MASK(5, 0001L) +#define BUTTON_SHIFT NCURSES_MOUSE_MASK(5, 0002L) +#define BUTTON_ALT NCURSES_MOUSE_MASK(5, 0004L) +#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(5, 0010L) + +#endif + +#define ALL_MOUSE_EVENTS (REPORT_MOUSE_POSITION - 1) + +/* macros to extract single event-bits from masks */ +#define BUTTON_RELEASE(e, x) ((e)&NCURSES_MOUSE_MASK(x, 001)) +#define BUTTON_PRESS(e, x) ((e)&NCURSES_MOUSE_MASK(x, 002)) +#define BUTTON_CLICK(e, x) ((e)&NCURSES_MOUSE_MASK(x, 004)) +#define BUTTON_DOUBLE_CLICK(e, x) ((e)&NCURSES_MOUSE_MASK(x, 010)) +#define BUTTON_TRIPLE_CLICK(e, x) ((e)&NCURSES_MOUSE_MASK(x, 020)) +#define BUTTON_RESERVED_EVENT(e, x) ((e)&NCURSES_MOUSE_MASK(x, 040)) + +typedef struct { + short id; /* ID to distinguish multiple devices */ + int x, y, z; /* event coordinates (character-cell) */ + mmask_t bstate; /* button state bits */ +} MEVENT; + +extern NCURSES_EXPORT(bool) has_mouse(void); +extern NCURSES_EXPORT(int) getmouse(MEVENT*); +extern NCURSES_EXPORT(int) ungetmouse(MEVENT*); +extern NCURSES_EXPORT(mmask_t) mousemask(mmask_t, mmask_t*); +extern NCURSES_EXPORT(bool) wenclose(const WINDOW*, int, int); +extern NCURSES_EXPORT(int) mouseinterval(int); +extern NCURSES_EXPORT(bool) wmouse_trafo(const WINDOW*, int*, int*, bool); +extern NCURSES_EXPORT(bool) mouse_trafo(int*, int*, bool); /* generated */ + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_mouse)(SCREEN*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(getmouse)(SCREEN*, MEVENT*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetmouse)(SCREEN*, MEVENT*); +extern NCURSES_EXPORT(mmask_t) + NCURSES_SP_NAME(mousemask)(SCREEN*, mmask_t, mmask_t*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mouseinterval)(SCREEN*, int); +#endif + +#ifndef NCURSES_NOMACROS +#define mouse_trafo(y, x, to_screen) wmouse_trafo(stdscr, y, x, to_screen) +#endif + +/* other non-XSI functions */ + +extern NCURSES_EXPORT(int) mcprint(char*, int); /* direct data to printer */ +extern NCURSES_EXPORT(int) has_key(int); /* do we have given key? */ + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(has_key)(SCREEN*, int); /* do we have given key? */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(mcprint)(SCREEN*, char*, int); /* direct data to printer */ +#endif + +/* Debugging : use with libncurses_g.a */ + +extern NCURSES_EXPORT(void) _tracef(const char*, ...) GCC_PRINTFLIKE(1, 2); +extern NCURSES_EXPORT(char*) _traceattr(attr_t); +extern NCURSES_EXPORT(char*) _traceattr2(int, chtype); +extern NCURSES_EXPORT(char*) _tracechar(int); +extern NCURSES_EXPORT(char*) _tracechtype(chtype); +extern NCURSES_EXPORT(char*) _tracechtype2(int, chtype); +#if NCURSES_WIDECHAR +#define _tracech_t _tracecchar_t +extern NCURSES_EXPORT(char*) _tracecchar_t(const cchar_t*); +#define _tracech_t2 _tracecchar_t2 +extern NCURSES_EXPORT(char*) _tracecchar_t2(int, const cchar_t*); +#else +#define _tracech_t _tracechtype +#define _tracech_t2 _tracechtype2 +#endif +extern NCURSES_EXPORT(void) trace(const unsigned int); + +/* trace masks */ +#define TRACE_DISABLE 0x0000 /* turn off tracing */ +#define TRACE_TIMES 0x0001 /* trace user and system times of updates */ +#define TRACE_TPUTS 0x0002 /* trace tputs calls */ +#define TRACE_UPDATE 0x0004 /* trace update actions, old & new screens */ +#define TRACE_MOVE 0x0008 /* trace cursor moves and scrolls */ +#define TRACE_CHARPUT 0x0010 /* trace all character outputs */ +#define TRACE_ORDINARY 0x001F /* trace all update actions */ +#define TRACE_CALLS 0x0020 /* trace all curses calls */ +#define TRACE_VIRTPUT 0x0040 /* trace virtual character puts */ +#define TRACE_IEVENT 0x0080 /* trace low-level input processing */ +#define TRACE_BITS 0x0100 /* trace state of TTY control bits */ +#define TRACE_ICALLS 0x0200 /* trace internal/nested calls */ +#define TRACE_CCALLS 0x0400 /* trace per-character calls */ +#define TRACE_DATABASE 0x0800 /* trace read/write of terminfo/termcap data */ +#define TRACE_ATTRS 0x1000 /* trace attribute updates */ + +#define TRACE_SHIFT 13 /* number of bits in the trace masks */ +#define TRACE_MAXIMUM ((1 << TRACE_SHIFT) - 1) /* maximum trace level */ + +#if defined(TRACE) || defined(NCURSES_TEST) +extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable; /* enable optimizations */ +extern NCURSES_EXPORT(const char*) _nc_visbuf(const char*); +#define OPTIMIZE_MVCUR 0x01 /* cursor movement optimization */ +#define OPTIMIZE_HASHMAP 0x02 /* diff hashing to detect scrolls */ +#define OPTIMIZE_SCROLL 0x04 /* scroll optimization */ +#define OPTIMIZE_ALL 0xff /* enable all optimizations (dflt) */ +#endif + +#include + +#ifdef __cplusplus + +#ifndef NCURSES_NOMACROS + +/* these names conflict with STL */ +#undef box +#undef clear +#undef erase +#undef move +#undef refresh + +#endif /* NCURSES_NOMACROS */ +} +#endif + +#endif /* __NCURSES_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/cursesapp.h b/src_cpp/elfgames/tasks/elf2codingenv/include/cursesapp.h new file mode 100644 index 0000000..b2f7bbd --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/cursesapp.h @@ -0,0 +1,174 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998-2005,2011 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1997 * + ****************************************************************************/ + +// $Id: cursesapp.h,v 1.12 2011/09/17 22:12:10 tom Exp $ + +#ifndef NCURSES_CURSESAPP_H_incl +#define NCURSES_CURSESAPP_H_incl + +#include + +class NCURSES_IMPEXP NCursesApplication { + public: + typedef struct _slk_link { // This structure is used to maintain + struct _slk_link* prev; // a stack of SLKs + Soft_Label_Key_Set* SLKs; + } SLK_Link; + + private: + static int rinit(NCursesWindow& w); // Internal Init function for title + static NCursesApplication* theApp; // Global ref. to the application + + static SLK_Link* slk_stack; + + protected: + static NCursesWindow* titleWindow; // The Title Window (if any) + + bool b_Colors; // Is this a color application? + NCursesWindow* Root_Window; // This is the stdscr equiv. + + // Initialization of attributes; + // Rewrite this in your derived class if you prefer other settings + virtual void init(bool bColors); + + // The number of lines for the title window. Default is no title window + // You may rewrite this in your derived class + virtual int titlesize() const { + return 0; + } + + // This method is called to put something into the title window initially + // You may rewrite this in your derived class + virtual void title() {} + + // The layout used for the Soft Label Keys. Default is to have no SLKs. + // You may rewrite this in your derived class + virtual Soft_Label_Key_Set::Label_Layout useSLKs() const { + return Soft_Label_Key_Set::None; + } + + // This method is called to initialize the SLKs. Default is nothing. + // You may rewrite this in your derived class + virtual void init_labels(Soft_Label_Key_Set& S) const { + (void)S; + } + + // Your derived class must implement this method. The return value must + // be the exit value of your application. + virtual int run() = 0; + + // The constructor is protected, so you may use it in your derived + // class constructor. The argument tells whether or not you want colors. + NCursesApplication(bool wantColors = FALSE); + + NCursesApplication& operator=(const NCursesApplication& rhs) { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesApplication(const NCursesApplication& rhs) + : b_Colors(rhs.b_Colors), Root_Window(rhs.Root_Window) {} + + public: + virtual ~NCursesApplication(); + + // Get a pointer to the current application object + static NCursesApplication* getApplication() { + return theApp; + } + + // This method runs the application and returns its exit value + int operator()(void); + + // Process the commandline arguments. The default implementation simply + // ignores them. Your derived class may rewrite this. + virtual void handleArgs(int argc, char* argv[]) { + (void)argc; + (void)argv; + } + + // Does this application use colors? + inline bool useColors() const { + return b_Colors; + } + + // Push the Key Set S onto the SLK Stack. S then becomes the current set + // of Soft Labelled Keys. + void push(Soft_Label_Key_Set& S); + + // Throw away the current set of SLKs and make the previous one the + // new current set. + bool pop(); + + // Retrieve the current set of Soft Labelled Keys. + Soft_Label_Key_Set* top() const; + + // Attributes to use for menu and forms foregrounds + virtual chtype foregrounds() const { + return b_Colors ? static_cast(COLOR_PAIR(1)) : A_BOLD; + } + + // Attributes to use for menu and forms backgrounds + virtual chtype backgrounds() const { + return b_Colors ? static_cast(COLOR_PAIR(2)) : A_NORMAL; + } + + // Attributes to use for inactive (menu) elements + virtual chtype inactives() const { + return b_Colors ? static_cast(COLOR_PAIR(3) | A_DIM) : A_DIM; + } + + // Attributes to use for (form) labels and SLKs + virtual chtype labels() const { + return b_Colors ? static_cast(COLOR_PAIR(4)) : A_NORMAL; + } + + // Attributes to use for form backgrounds + virtual chtype dialog_backgrounds() const { + return b_Colors ? static_cast(COLOR_PAIR(4)) : A_NORMAL; + } + + // Attributes to use as default for (form) window backgrounds + virtual chtype window_backgrounds() const { + return b_Colors ? static_cast(COLOR_PAIR(5)) : A_NORMAL; + } + + // Attributes to use for the title window + virtual chtype screen_titles() const { + return b_Colors ? static_cast(COLOR_PAIR(6)) : A_BOLD; + } +}; + +#endif /* NCURSES_CURSESAPP_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/cursesf.h b/src_cpp/elfgames/tasks/elf2codingenv/include/cursesf.h new file mode 100644 index 0000000..13ac431 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/cursesf.h @@ -0,0 +1,949 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998-2012,2014 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1997 * + ****************************************************************************/ + +// $Id: cursesf.h,v 1.32 2014/08/09 22:06:11 Adam.Jiang Exp $ + +#ifndef NCURSES_CURSESF_H_incl +#define NCURSES_CURSESF_H_incl 1 + +#include + +#ifndef __EXT_QNX +#include +#endif + +extern "C" { +#include +} +// +// ------------------------------------------------------------------------- +// The abstract base class for buitin and user defined Fieldtypes. +// ------------------------------------------------------------------------- +// +class NCURSES_IMPEXP NCursesFormField; // forward declaration + +// Class to represent builtin field types as well as C++ written new +// fieldtypes (see classes UserDefineFieldType... +class NCURSES_IMPEXP NCursesFieldType { + friend class NCursesFormField; + + protected: + FIELDTYPE* fieldtype; + + inline void OnError(int err) const + THROW2(NCursesException const, NCursesFormException) { + if (err != E_OK) + THROW(new NCursesFormException(err)); + } + + NCursesFieldType(FIELDTYPE* f) : fieldtype(f) {} + + virtual ~NCursesFieldType() {} + + // Set the fields f fieldtype to this one. + virtual void set(NCursesFormField& f) = 0; + + public: + NCursesFieldType() : fieldtype(STATIC_CAST(FIELDTYPE*)(0)) {} + + NCursesFieldType& operator=(const NCursesFieldType& rhs) { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesFieldType(const NCursesFieldType& rhs) : fieldtype(rhs.fieldtype) {} +}; + +// +// ------------------------------------------------------------------------- +// The class representing a forms field, wrapping the lowlevel FIELD struct +// ------------------------------------------------------------------------- +// +class NCURSES_IMPEXP NCursesFormField { + friend class NCursesForm; + + protected: + FIELD* field; // lowlevel structure + NCursesFieldType* ftype; // Associated field type + + // Error handler + inline void OnError(int err) const + THROW2(NCursesException const, NCursesFormException) { + if (err != E_OK) + THROW(new NCursesFormException(err)); + } + + public: + // Create a 'Null' field. Can be used to delimit a field list + NCursesFormField() + : field(STATIC_CAST(FIELD*)(0)), + ftype(STATIC_CAST(NCursesFieldType*)(0)) {} + + // Create a new field + NCursesFormField( + int rows, + int ncols, + int first_row = 0, + int first_col = 0, + int offscreen_rows = 0, + int additional_buffers = 0) + : field(0), ftype(STATIC_CAST(NCursesFieldType*)(0)) { + field = ::new_field( + rows, ncols, first_row, first_col, offscreen_rows, additional_buffers); + if (!field) + OnError(errno); + } + + NCursesFormField& operator=(const NCursesFormField& rhs) { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesFormField(const NCursesFormField& rhs) + : field(rhs.field), ftype(rhs.ftype) {} + + virtual ~NCursesFormField(); + + // Duplicate the field at a new position + inline NCursesFormField* dup(int first_row, int first_col) { + NCursesFormField* f = new NCursesFormField(); + if (!f) + OnError(E_SYSTEM_ERROR); + else { + f->ftype = ftype; + f->field = ::dup_field(field, first_row, first_col); + if (!f->field) + OnError(errno); + } + return f; + } + + // Link the field to a new location + inline NCursesFormField* link(int first_row, int first_col) { + NCursesFormField* f = new NCursesFormField(); + if (!f) + OnError(E_SYSTEM_ERROR); + else { + f->ftype = ftype; + f->field = ::link_field(field, first_row, first_col); + if (!f->field) + OnError(errno); + } + return f; + } + + // Get the lowlevel field representation + inline FIELD* get_field() const { + return field; + } + + // Retrieve info about the field + inline void info( + int& rows, + int& ncols, + int& first_row, + int& first_col, + int& offscreen_rows, + int& additional_buffers) const { + OnError( + ::field_info( + field, + &rows, + &ncols, + &first_row, + &first_col, + &offscreen_rows, + &additional_buffers)); + } + + // Retrieve info about the fields dynamic properties. + inline void + dynamic_info(int& dynamic_rows, int& dynamic_cols, int& max_growth) const { + OnError( + ::dynamic_field_info(field, &dynamic_rows, &dynamic_cols, &max_growth)); + } + + // For a dynamic field you may set the maximum growth limit. + // A zero means unlimited growth. + inline void set_maximum_growth(int growth = 0) { + OnError(::set_max_field(field, growth)); + } + + // Move the field to a new position + inline void move(int row, int col) { + OnError(::move_field(field, row, col)); + } + + // Mark the field to start a new page + inline void new_page(bool pageFlag = FALSE) { + OnError(::set_new_page(field, pageFlag)); + } + + // Retrieve whether or not the field starts a new page. + inline bool is_new_page() const { + return ::new_page(field); + } + + // Set the justification for the field + inline void set_justification(int just) { + OnError(::set_field_just(field, just)); + } + + // Retrieve the fields justification + inline int justification() const { + return ::field_just(field); + } + // Set the foreground attribute for the field + inline void set_foreground(chtype foreground) { + OnError(::set_field_fore(field, foreground)); + } + + // Retrieve the fields foreground attribute + inline chtype fore() const { + return ::field_fore(field); + } + + // Set the background attribute for the field + inline void set_background(chtype background) { + OnError(::set_field_back(field, background)); + } + + // Retrieve the fields background attribute + inline chtype back() const { + return ::field_back(field); + } + + // Set the padding character for the field + inline void set_pad_character(int padding) { + OnError(::set_field_pad(field, padding)); + } + + // Retrieve the fields padding character + inline int pad() const { + return ::field_pad(field); + } + + // Switch on the fields options + inline void options_on(Field_Options opts) { + OnError(::field_opts_on(field, opts)); + } + + // Switch off the fields options + inline void options_off(Field_Options opts) { + OnError(::field_opts_off(field, opts)); + } + + // Retrieve the fields options + inline Field_Options options() const { + return ::field_opts(field); + } + + // Set the fields options + inline void set_options(Field_Options opts) { + OnError(::set_field_opts(field, opts)); + } + + // Mark the field as changed + inline void set_changed(bool changeFlag = TRUE) { + OnError(::set_field_status(field, changeFlag)); + } + + // Test whether or not the field is marked as changed + inline bool changed() const { + return ::field_status(field); + } + + // Return the index of the field in the field array of a form + // or -1 if the field is not associated to a form + inline int(index)() const { + return ::field_index(field); + } + + // Store a value in a fields buffer. The default buffer is nr. 0 + inline void set_value(const char* val, int buffer = 0) { + OnError(::set_field_buffer(field, buffer, val)); + } + + // Retrieve the value of a fields buffer. The default buffer is nr. 0 + inline char* value(int buffer = 0) const { + return ::field_buffer(field, buffer); + } + + // Set the validation type of the field. + inline void set_fieldtype(NCursesFieldType& f) { + ftype = &f; + f.set(*this); // A good friend may do that... + } + + // Retrieve the validation type of the field. + inline NCursesFieldType* fieldtype() const { + return ftype; + } +}; + +// This are the built-in hook functions in this C++ binding. In C++ we use +// virtual member functions (see below On_..._Init and On_..._Termination) +// to provide this functionality in an object oriented manner. +extern "C" { +void _nc_xx_frm_init(FORM*); +void _nc_xx_frm_term(FORM*); +void _nc_xx_fld_init(FORM*); +void _nc_xx_fld_term(FORM*); +} + +// +// ------------------------------------------------------------------------- +// The class representing a form, wrapping the lowlevel FORM struct +// ------------------------------------------------------------------------- +// +class NCURSES_IMPEXP NCursesForm : public NCursesPanel { + protected: + FORM* form; // the lowlevel structure + + private: + NCursesWindow* sub; // the subwindow object + bool b_sub_owner; // is this our own subwindow? + bool b_framed; // has the form a border? + bool b_autoDelete; // Delete fields when deleting form? + + NCursesFormField** my_fields; // The array of fields for this form + + // This structure is used for the form's user data field to link the + // FORM* to the C++ object and to provide extra space for a user pointer. + typedef struct { + void* m_user; // the pointer for the user's data + const NCursesForm* m_back; // backward pointer to C++ object + const FORM* m_owner; + } UserHook; + + // Get the backward pointer to the C++ object from a FORM + static inline NCursesForm* getHook(const FORM* f) { + UserHook* hook = reinterpret_cast(::form_userptr(f)); + assert(hook != 0 && hook->m_owner == f); + return const_cast(hook->m_back); + } + + friend void _nc_xx_frm_init(FORM*); + friend void _nc_xx_frm_term(FORM*); + friend void _nc_xx_fld_init(FORM*); + friend void _nc_xx_fld_term(FORM*); + + // Calculate FIELD* array for the menu + FIELD** mapFields(NCursesFormField* nfields[]); + + protected: + // internal routines + inline void set_user(void* user) { + UserHook* uptr = reinterpret_cast(::form_userptr(form)); + assert(uptr != 0 && uptr->m_back == this && uptr->m_owner == form); + uptr->m_user = user; + } + + inline void* get_user() { + UserHook* uptr = reinterpret_cast(::form_userptr(form)); + assert(uptr != 0 && uptr->m_back == this && uptr->m_owner == form); + return uptr->m_user; + } + + void + InitForm(NCursesFormField* Fields[], bool with_frame, bool autoDeleteFields); + + inline void OnError(int err) const + THROW2(NCursesException const, NCursesFormException) { + if (err != E_OK) + THROW(new NCursesFormException(err)); + } + + // this wraps the form_driver call. + virtual int driver(int c); + + // 'Internal' constructor, builds an object without association to a + // field array. + NCursesForm(int nlines, int ncols, int begin_y = 0, int begin_x = 0) + : NCursesPanel(nlines, ncols, begin_y, begin_x), + form(STATIC_CAST(FORM*)(0)), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_fields(0) {} + + public: + // Create form for the default panel. + NCursesForm( + NCursesFormField* Fields[], + bool with_frame = FALSE, // reserve space for a frame? + bool autoDelete_Fields = FALSE) // do automatic cleanup? + : NCursesPanel(), + form(0), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_fields(0) { + InitForm(Fields, with_frame, autoDelete_Fields); + } + + // Create a form in a panel with the given position and size. + NCursesForm( + NCursesFormField* Fields[], + int nlines, + int ncols, + int begin_y, + int begin_x, + bool with_frame = FALSE, // reserve space for a frame? + bool autoDelete_Fields = FALSE) // do automatic cleanup? + : NCursesPanel(nlines, ncols, begin_y, begin_x), + form(0), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_fields(0) { + InitForm(Fields, with_frame, autoDelete_Fields); + } + + NCursesForm& operator=(const NCursesForm& rhs) { + if (this != &rhs) { + *this = rhs; + NCursesPanel::operator=(rhs); + } + return *this; + } + + NCursesForm(const NCursesForm& rhs) + : NCursesPanel(rhs), + form(rhs.form), + sub(rhs.sub), + b_sub_owner(rhs.b_sub_owner), + b_framed(rhs.b_framed), + b_autoDelete(rhs.b_autoDelete), + my_fields(rhs.my_fields) {} + + virtual ~NCursesForm(); + + // Set the default attributes for the form + virtual void setDefaultAttributes(); + + // Retrieve current field of the form. + inline NCursesFormField* current_field() const { + return my_fields[ ::field_index(::current_field(form))]; + } + + // Set the forms subwindow + void setSubWindow(NCursesWindow& sub); + + // Set these fields for the form + inline void setFields(NCursesFormField* Fields[]) { + OnError(::set_form_fields(form, mapFields(Fields))); + } + + // Remove the form from the screen + inline void unpost(void) { + OnError(::unpost_form(form)); + } + + // Post the form to the screen if flag is true, unpost it otherwise + inline void post(bool flag = TRUE) { + OnError(flag ? ::post_form(form) : ::unpost_form(form)); + } + + // Decorations + inline void frame(const char* title = NULL, const char* btitle = NULL) { + if (b_framed) + NCursesPanel::frame(title, btitle); + else + OnError(E_SYSTEM_ERROR); + } + + inline void boldframe(const char* title = NULL, const char* btitle = NULL) { + if (b_framed) + NCursesPanel::boldframe(title, btitle); + else + OnError(E_SYSTEM_ERROR); + } + + inline void label(const char* topLabel, const char* bottomLabel) { + if (b_framed) + NCursesPanel::label(topLabel, bottomLabel); + else + OnError(E_SYSTEM_ERROR); + } + + // ----- + // Hooks + // ----- + + // Called after the form gets repositioned in its window. + // This is especially true if the form is posted. + virtual void On_Form_Init(); + + // Called before the form gets repositioned in its window. + // This is especially true if the form is unposted. + virtual void On_Form_Termination(); + + // Called after the field became the current field + virtual void On_Field_Init(NCursesFormField& field); + + // Called before this field is left as current field. + virtual void On_Field_Termination(NCursesFormField& field); + + // Calculate required window size for the form. + void scale(int& rows, int& ncols) const { + OnError(::scale_form(form, &rows, &ncols)); + } + + // Retrieve number of fields in the form. + int count() const { + return ::field_count(form); + } + + // Make the page the current page of the form. + void set_page(int pageNum) { + OnError(::set_form_page(form, pageNum)); + } + + // Retrieve current page number + int page() const { + return ::form_page(form); + } + + // Switch on the forms options + inline void options_on(Form_Options opts) { + OnError(::form_opts_on(form, opts)); + } + + // Switch off the forms options + inline void options_off(Form_Options opts) { + OnError(::form_opts_off(form, opts)); + } + + // Retrieve the forms options + inline Form_Options options() const { + return ::form_opts(form); + } + + // Set the forms options + inline void set_options(Form_Options opts) { + OnError(::set_form_opts(form, opts)); + } + + // Are there more data in the current field after the data shown + inline bool data_ahead() const { + return ::data_ahead(form); + } + + // Are there more data in the current field before the data shown + inline bool data_behind() const { + return ::data_behind(form); + } + + // Position the cursor to the current field + inline void position_cursor() { + OnError(::pos_form_cursor(form)); + } + // Set the current field + inline void set_current(NCursesFormField& F) { + OnError(::set_current_field(form, F.field)); + } + + // Provide a default key virtualization. Translate the keyboard + // code c into a form request code. + // The default implementation provides a hopefully straightforward + // mapping for the most common keystrokes and form requests. + virtual int virtualize(int c); + + // Operators + inline NCursesFormField* operator[](int i) const { + if ((i < 0) || (i >= ::field_count(form))) + OnError(E_BAD_ARGUMENT); + return my_fields[i]; + } + + // Perform the menu's operation + // Return the field where you left the form. + virtual NCursesFormField* operator()(void); + + // Exception handlers. The default is a Beep. + virtual void On_Request_Denied(int c) const; + virtual void On_Invalid_Field(int c) const; + virtual void On_Unknown_Command(int c) const; +}; + +// +// ------------------------------------------------------------------------- +// This is the typical C++ typesafe way to allow to attach +// user data to a field of a form. Its assumed that the user +// data belongs to some class T. Use T as template argument +// to create a UserField. +// ------------------------------------------------------------------------- +template +class NCURSES_IMPEXP NCursesUserField : public NCursesFormField { + public: + NCursesUserField( + int rows, + int ncols, + int first_row = 0, + int first_col = 0, + const T* p_UserData = STATIC_CAST(T*)(0), + int offscreen_rows = 0, + int additional_buffers = 0) + : NCursesFormField( + rows, + ncols, + first_row, + first_col, + offscreen_rows, + additional_buffers) { + if (field) + OnError(::set_field_userptr(field, STATIC_CAST(void*)(p_UserData))); + } + + virtual ~NCursesUserField(){}; + + inline const T* UserData(void) const { + return reinterpret_cast(::field_userptr(field)); + } + + inline virtual void setUserData(const T* p_UserData) { + if (field) + OnError(::set_field_userptr(field, STATIC_CAST(void*)(p_UserData))); + } +}; +// +// ------------------------------------------------------------------------- +// The same mechanism is used to attach user data to a form +// ------------------------------------------------------------------------- +// +template +class NCURSES_IMPEXP NCursesUserForm : public NCursesForm { + protected: + // 'Internal' constructor, builds an object without association to a + // field array. + NCursesUserForm( + int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = STATIC_CAST(T*)(0)) + : NCursesForm(nlines, ncols, begin_y, begin_x) { + if (form) + set_user(const_cast(reinterpret_cast(p_UserData))); + } + + public: + NCursesUserForm( + NCursesFormField* Fields[], + const T* p_UserData = STATIC_CAST(T*)(0), + bool with_frame = FALSE, + bool autoDelete_Fields = FALSE) + : NCursesForm(Fields, with_frame, autoDelete_Fields) { + if (form) + set_user(const_cast(reinterpret_cast(p_UserData))); + }; + + NCursesUserForm( + NCursesFormField* Fields[], + int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = STATIC_CAST(T*)(0), + bool with_frame = FALSE, + bool autoDelete_Fields = FALSE) + : NCursesForm( + Fields, + nlines, + ncols, + begin_y, + begin_x, + with_frame, + autoDelete_Fields) { + if (form) + set_user(const_cast(reinterpret_cast(p_UserData))); + }; + + virtual ~NCursesUserForm(){}; + + inline T* UserData(void) { + return reinterpret_cast(get_user()); + }; + + inline virtual void setUserData(const T* p_UserData) { + if (form) + set_user(const_cast(reinterpret_cast(p_UserData))); + } +}; +// +// ------------------------------------------------------------------------- +// Builtin Fieldtypes +// ------------------------------------------------------------------------- +// +class NCURSES_IMPEXP Alpha_Field : public NCursesFieldType { + private: + int min_field_width; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(), fieldtype, min_field_width)); + } + + public: + Alpha_Field(int width) + : NCursesFieldType(TYPE_ALPHA), min_field_width(width) {} +}; + +class NCURSES_IMPEXP Alphanumeric_Field : public NCursesFieldType { + private: + int min_field_width; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(), fieldtype, min_field_width)); + } + + public: + Alphanumeric_Field(int width) + : NCursesFieldType(TYPE_ALNUM), min_field_width(width) {} +}; + +class NCURSES_IMPEXP Integer_Field : public NCursesFieldType { + private: + int precision; + long lower_limit, upper_limit; + + void set(NCursesFormField& f) { + OnError( + ::set_field_type( + f.get_field(), fieldtype, precision, lower_limit, upper_limit)); + } + + public: + Integer_Field(int prec, long low = 0L, long high = 0L) + : NCursesFieldType(TYPE_INTEGER), + precision(prec), + lower_limit(low), + upper_limit(high) {} +}; + +class NCURSES_IMPEXP Numeric_Field : public NCursesFieldType { + private: + int precision; + double lower_limit, upper_limit; + + void set(NCursesFormField& f) { + OnError( + ::set_field_type( + f.get_field(), fieldtype, precision, lower_limit, upper_limit)); + } + + public: + Numeric_Field(int prec, double low = 0.0, double high = 0.0) + : NCursesFieldType(TYPE_NUMERIC), + precision(prec), + lower_limit(low), + upper_limit(high) {} +}; + +class NCURSES_IMPEXP Regular_Expression_Field : public NCursesFieldType { + private: + char* regex; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(), fieldtype, regex)); + } + + void copy_regex(const char* source) { + regex = new char[1 + ::strlen(source)]; + (::strcpy)(regex, source); + } + + public: + Regular_Expression_Field(const char* expr) + : NCursesFieldType(TYPE_REGEXP), regex(NULL) { + copy_regex(expr); + } + + Regular_Expression_Field& operator=(const Regular_Expression_Field& rhs) { + if (this != &rhs) { + *this = rhs; + copy_regex(rhs.regex); + NCursesFieldType::operator=(rhs); + } + return *this; + } + + Regular_Expression_Field(const Regular_Expression_Field& rhs) + : NCursesFieldType(rhs), regex(NULL) { + copy_regex(rhs.regex); + } + + ~Regular_Expression_Field() { + delete[] regex; + } +}; + +class NCURSES_IMPEXP Enumeration_Field : public NCursesFieldType { + private: + const char** list; + int case_sensitive; + int non_unique_matches; + + void set(NCursesFormField& f) { + OnError( + ::set_field_type( + f.get_field(), + fieldtype, + list, + case_sensitive, + non_unique_matches)); + } + + public: + Enumeration_Field( + const char* enums[], + bool case_sens = FALSE, + bool non_unique = FALSE) + : NCursesFieldType(TYPE_ENUM), + list(enums), + case_sensitive(case_sens ? -1 : 0), + non_unique_matches(non_unique ? -1 : 0) {} + + Enumeration_Field& operator=(const Enumeration_Field& rhs) { + if (this != &rhs) { + *this = rhs; + NCursesFieldType::operator=(rhs); + } + return *this; + } + + Enumeration_Field(const Enumeration_Field& rhs) + : NCursesFieldType(rhs), + list(rhs.list), + case_sensitive(rhs.case_sensitive), + non_unique_matches(rhs.non_unique_matches) {} +}; + +class NCURSES_IMPEXP IPV4_Address_Field : public NCursesFieldType { + private: + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(), fieldtype)); + } + + public: + IPV4_Address_Field() : NCursesFieldType(TYPE_IPV4) {} +}; + +extern "C" { +bool _nc_xx_fld_fcheck(FIELD*, const void*); +bool _nc_xx_fld_ccheck(int c, const void*); +void* _nc_xx_fld_makearg(va_list*); +} + +// +// ------------------------------------------------------------------------- +// Abstract base class for User-Defined Fieldtypes +// ------------------------------------------------------------------------- +// +class NCURSES_IMPEXP UserDefinedFieldType : public NCursesFieldType { + friend class UDF_Init; // Internal helper to set up statics + private: + // For all C++ defined fieldtypes we need only one generic lowlevel + // FIELDTYPE* element. + static FIELDTYPE* generic_fieldtype; + + protected: + // This are the functions required by the low level libforms functions + // to construct a fieldtype. + friend bool _nc_xx_fld_fcheck(FIELD*, const void*); + friend bool _nc_xx_fld_ccheck(int c, const void*); + friend void* _nc_xx_fld_makearg(va_list*); + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(), fieldtype, &f)); + } + + protected: + // Redefine this function to do a field validation. The argument + // is a reference to the field you should validate. + virtual bool field_check(NCursesFormField& f) = 0; + + // Redefine this function to do a character validation. The argument + // is the character to be validated. + virtual bool char_check(int c) = 0; + + public: + UserDefinedFieldType() : NCursesFieldType(generic_fieldtype) {} +}; + +extern "C" { +bool _nc_xx_next_choice(FIELD*, const void*); +bool _nc_xx_prev_choice(FIELD*, const void*); +} + +// +// ------------------------------------------------------------------------- +// Abstract base class for User-Defined Fieldtypes with Choice functions +// ------------------------------------------------------------------------- +// +class NCURSES_IMPEXP UserDefinedFieldType_With_Choice + : public UserDefinedFieldType { + friend class UDF_Init; // Internal helper to set up statics + private: + // For all C++ defined fieldtypes with choice functions we need only one + // generic lowlevel FIELDTYPE* element. + static FIELDTYPE* generic_fieldtype_with_choice; + + // This are the functions required by the low level libforms functions + // to construct a fieldtype with choice functions. + friend bool _nc_xx_next_choice(FIELD*, const void*); + friend bool _nc_xx_prev_choice(FIELD*, const void*); + + protected: + // Redefine this function to do the retrieval of the next choice value. + // The argument is a reference to the field tobe examined. + virtual bool next(NCursesFormField& f) = 0; + + // Redefine this function to do the retrieval of the previous choice value. + // The argument is a reference to the field tobe examined. + virtual bool previous(NCursesFormField& f) = 0; + + public: + UserDefinedFieldType_With_Choice() { + fieldtype = generic_fieldtype_with_choice; + } +}; + +#endif /* NCURSES_CURSESF_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/cursesm.h b/src_cpp/elfgames/tasks/elf2codingenv/include/cursesm.h new file mode 100644 index 0000000..5e643ab --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/cursesm.h @@ -0,0 +1,650 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998-2012,2014 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1997 * + ****************************************************************************/ + +// $Id: cursesm.h,v 1.30 2014/08/09 22:06:18 Adam.Jiang Exp $ + +#ifndef NCURSES_CURSESM_H_incl +#define NCURSES_CURSESM_H_incl 1 + +#include + +extern "C" { +#include +} +// +// ------------------------------------------------------------------------- +// This wraps the ITEM type of +// ------------------------------------------------------------------------- +// +class NCURSES_IMPEXP NCursesMenuItem { + friend class NCursesMenu; + + protected: + ITEM* item; + + inline void OnError(int err) const + THROW2(NCursesException const, NCursesMenuException) { + if (err != E_OK) + THROW(new NCursesMenuException(err)); + } + + public: + NCursesMenuItem(const char* p_name = NULL, const char* p_descript = NULL) + : item(0) { + item = p_name ? ::new_item(p_name, p_descript) : STATIC_CAST(ITEM*)(0); + if (p_name && !item) + OnError(E_SYSTEM_ERROR); + } + // Create an item. If you pass both parameters as NULL, a delimiting + // item is constructed which can be used to terminate a list of + // NCursesMenu objects. + + NCursesMenuItem& operator=(const NCursesMenuItem& rhs) { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesMenuItem(const NCursesMenuItem& rhs) : item(0) { + (void)rhs; + } + + virtual ~NCursesMenuItem(); + // Release the items memory + + inline const char* name() const { + return ::item_name(item); + } + // Name of the item + + inline const char* description() const { + return ::item_description(item); + } + // Description of the item + + inline int(index)(void) const { + return ::item_index(item); + } + // Index of the item in an item array (or -1) + + inline void options_on(Item_Options opts) { + OnError(::item_opts_on(item, opts)); + } + // Switch on the items options + + inline void options_off(Item_Options opts) { + OnError(::item_opts_off(item, opts)); + } + // Switch off the item's option + + inline Item_Options options() const { + return ::item_opts(item); + } + // Retrieve the items options + + inline void set_options(Item_Options opts) { + OnError(::set_item_opts(item, opts)); + } + // Set the items options + + inline void set_value(bool f) { + OnError(::set_item_value(item, f)); + } + // Set/Reset the items selection state + + inline bool value() const { + return ::item_value(item); + } + // Retrieve the items selection state + + inline bool visible() const { + return ::item_visible(item); + } + // Retrieve visibility of the item + + virtual bool action(); + // Perform an action associated with this item; you may use this in an + // user supplied driver for a menu; you may derive from this class and + // overload action() to supply items with different actions. + // If an action returns true, the menu will be exited. The default action + // is to do nothing. +}; + +// Prototype for an items callback function. +typedef bool ITEMCALLBACK(NCursesMenuItem&); + +// If you don't like to create a child class for individual items to +// overload action(), you may use this class and provide a callback +// function pointer for items. +class NCURSES_IMPEXP NCursesMenuCallbackItem : public NCursesMenuItem { + private: + ITEMCALLBACK* p_fct; + + public: + NCursesMenuCallbackItem( + ITEMCALLBACK* fct = NULL, + const char* p_name = NULL, + const char* p_descript = NULL) + : NCursesMenuItem(p_name, p_descript), p_fct(fct) {} + + NCursesMenuCallbackItem& operator=(const NCursesMenuCallbackItem& rhs) { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesMenuCallbackItem(const NCursesMenuCallbackItem& rhs) + : NCursesMenuItem(rhs), p_fct(0) {} + + virtual ~NCursesMenuCallbackItem(); + + bool action(); +}; + +// This are the built-in hook functions in this C++ binding. In C++ we use +// virtual member functions (see below On_..._Init and On_..._Termination) +// to provide this functionality in an object oriented manner. +extern "C" { +void _nc_xx_mnu_init(MENU*); +void _nc_xx_mnu_term(MENU*); +void _nc_xx_itm_init(MENU*); +void _nc_xx_itm_term(MENU*); +} + +// +// ------------------------------------------------------------------------- +// This wraps the MENU type of +// ------------------------------------------------------------------------- +// +class NCURSES_IMPEXP NCursesMenu : public NCursesPanel { + protected: + MENU* menu; + + private: + NCursesWindow* sub; // the subwindow object + bool b_sub_owner; // is this our own subwindow? + bool b_framed; // has the menu a border? + bool b_autoDelete; // Delete items when deleting menu? + + NCursesMenuItem** my_items; // The array of items for this menu + + // This structure is used for the menu's user data field to link the + // MENU* to the C++ object and to provide extra space for a user pointer. + typedef struct { + void* m_user; // the pointer for the user's data + const NCursesMenu* m_back; // backward pointer to C++ object + const MENU* m_owner; + } UserHook; + + // Get the backward pointer to the C++ object from a MENU + static inline NCursesMenu* getHook(const MENU* m) { + UserHook* hook = STATIC_CAST(UserHook*)(::menu_userptr(m)); + assert(hook != 0 && hook->m_owner == m); + return const_cast(hook->m_back); + } + + friend void _nc_xx_mnu_init(MENU*); + friend void _nc_xx_mnu_term(MENU*); + friend void _nc_xx_itm_init(MENU*); + friend void _nc_xx_itm_term(MENU*); + + // Calculate ITEM* array for the menu + ITEM** mapItems(NCursesMenuItem* nitems[]); + + protected: + // internal routines + inline void set_user(void* user) { + UserHook* uptr = STATIC_CAST(UserHook*)(::menu_userptr(menu)); + assert(uptr != 0 && uptr->m_back == this && uptr->m_owner == menu); + uptr->m_user = user; + } + + inline void* get_user() { + UserHook* uptr = STATIC_CAST(UserHook*)(::menu_userptr(menu)); + assert(uptr != 0 && uptr->m_back == this && uptr->m_owner == menu); + return uptr->m_user; + } + + void InitMenu(NCursesMenuItem* menu[], bool with_frame, bool autoDeleteItems); + + inline void OnError(int err) const + THROW2(NCursesException const, NCursesMenuException) { + if (err != E_OK) + THROW(new NCursesMenuException(this, err)); + } + + // this wraps the menu_driver call. + virtual int driver(int c); + + // 'Internal' constructor to create a menu without association to + // an array of items. + NCursesMenu(int nlines, int ncols, int begin_y = 0, int begin_x = 0) + : NCursesPanel(nlines, ncols, begin_y, begin_x), + menu(STATIC_CAST(MENU*)(0)), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_items(0) {} + + public: + // Make a full window size menu + NCursesMenu( + NCursesMenuItem* Items[], + bool with_frame = FALSE, // Reserve space for a frame? + bool autoDelete_Items = FALSE) // Autocleanup of Items? + : NCursesPanel(), + menu(0), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_items(0) { + InitMenu(Items, with_frame, autoDelete_Items); + } + + // Make a menu with a window of this size. + NCursesMenu( + NCursesMenuItem* Items[], + int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + bool with_frame = FALSE, // Reserve space for a frame? + bool autoDelete_Items = FALSE) // Autocleanup of Items? + : NCursesPanel(nlines, ncols, begin_y, begin_x), + menu(0), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_items(0) { + InitMenu(Items, with_frame, autoDelete_Items); + } + + NCursesMenu& operator=(const NCursesMenu& rhs) { + if (this != &rhs) { + *this = rhs; + NCursesPanel::operator=(rhs); + } + return *this; + } + + NCursesMenu(const NCursesMenu& rhs) + : NCursesPanel(rhs), + menu(rhs.menu), + sub(rhs.sub), + b_sub_owner(rhs.b_sub_owner), + b_framed(rhs.b_framed), + b_autoDelete(rhs.b_autoDelete), + my_items(rhs.my_items) {} + + virtual ~NCursesMenu(); + + // Retrieve the menus subwindow + inline NCursesWindow& subWindow() const { + assert(sub != NULL); + return *sub; + } + + // Set the menus subwindow + void setSubWindow(NCursesWindow& sub); + + // Set these items for the menu + inline void setItems(NCursesMenuItem* Items[]) { + OnError(::set_menu_items(menu, mapItems(Items))); + } + + // Remove the menu from the screen + inline void unpost(void) { + OnError(::unpost_menu(menu)); + } + + // Post the menu to the screen if flag is true, unpost it otherwise + inline void post(bool flag = TRUE) { + flag ? OnError(::post_menu(menu)) : OnError(::unpost_menu(menu)); + } + + // Get the numer of rows and columns for this menu + inline void scale(int& mrows, int& mcols) const { + OnError(::scale_menu(menu, &mrows, &mcols)); + } + + // Set the format of this menu + inline void set_format(int mrows, int mcols) { + OnError(::set_menu_format(menu, mrows, mcols)); + } + + // Get the format of this menu + inline void menu_format(int& rows, int& ncols) { + ::menu_format(menu, &rows, &ncols); + } + + // Items of the menu + inline NCursesMenuItem* items() const { + return *my_items; + } + + // Get the number of items in this menu + inline int count() const { + return ::item_count(menu); + } + + // Get the current item (i.e. the one the cursor is located) + inline NCursesMenuItem* current_item() const { + return my_items[ ::item_index(::current_item(menu))]; + } + + // Get the marker string + inline const char* mark() const { + return ::menu_mark(menu); + } + + // Set the marker string + inline void set_mark(const char* marker) { + OnError(::set_menu_mark(menu, marker)); + } + + // Get the name of the request code c + inline static const char* request_name(int c) { + return ::menu_request_name(c); + } + + // Get the current pattern + inline char* pattern() const { + return ::menu_pattern(menu); + } + + // true if there is a pattern match, false otherwise. + bool set_pattern(const char* pat); + + // set the default attributes for the menu + // i.e. set fore, back and grey attribute + virtual void setDefaultAttributes(); + + // Get the menus background attributes + inline chtype back() const { + return ::menu_back(menu); + } + + // Get the menus foreground attributes + inline chtype fore() const { + return ::menu_fore(menu); + } + + // Get the menus grey attributes (used for unselectable items) + inline chtype grey() const { + return ::menu_grey(menu); + } + + // Set the menus background attributes + inline chtype set_background(chtype a) { + return ::set_menu_back(menu, a); + } + + // Set the menus foreground attributes + inline chtype set_foreground(chtype a) { + return ::set_menu_fore(menu, a); + } + + // Set the menus grey attributes (used for unselectable items) + inline chtype set_grey(chtype a) { + return ::set_menu_grey(menu, a); + } + + inline void options_on(Menu_Options opts) { + OnError(::menu_opts_on(menu, opts)); + } + + inline void options_off(Menu_Options opts) { + OnError(::menu_opts_off(menu, opts)); + } + + inline Menu_Options options() const { + return ::menu_opts(menu); + } + + inline void set_options(Menu_Options opts) { + OnError(::set_menu_opts(menu, opts)); + } + + inline int pad() const { + return ::menu_pad(menu); + } + + inline void set_pad(int padch) { + OnError(::set_menu_pad(menu, padch)); + } + + // Position the cursor to the current item + inline void position_cursor() const { + OnError(::pos_menu_cursor(menu)); + } + + // Set the current item + inline void set_current(NCursesMenuItem& I) { + OnError(::set_current_item(menu, I.item)); + } + + // Get the current top row of the menu + inline int top_row(void) const { + return ::top_row(menu); + } + + // Set the current top row of the menu + inline void set_top_row(int row) { + OnError(::set_top_row(menu, row)); + } + + // spacing control + // Set the spacing for the menu + inline void setSpacing(int spc_description, int spc_rows, int spc_columns) { + OnError(::set_menu_spacing(menu, spc_description, spc_rows, spc_columns)); + } + + // Get the spacing info for the menu + inline void Spacing(int& spc_description, int& spc_rows, int& spc_columns) + const { + OnError(::menu_spacing(menu, &spc_description, &spc_rows, &spc_columns)); + } + + // Decorations + inline void frame(const char* title = NULL, const char* btitle = NULL) { + if (b_framed) + NCursesPanel::frame(title, btitle); + else + OnError(E_SYSTEM_ERROR); + } + + inline void boldframe(const char* title = NULL, const char* btitle = NULL) { + if (b_framed) + NCursesPanel::boldframe(title, btitle); + else + OnError(E_SYSTEM_ERROR); + } + + inline void label(const char* topLabel, const char* bottomLabel) { + if (b_framed) + NCursesPanel::label(topLabel, bottomLabel); + else + OnError(E_SYSTEM_ERROR); + } + + // ----- + // Hooks + // ----- + + // Called after the menu gets repositioned in its window. + // This is especially true if the menu is posted. + virtual void On_Menu_Init(); + + // Called before the menu gets repositioned in its window. + // This is especially true if the menu is unposted. + virtual void On_Menu_Termination(); + + // Called after the item became the current item + virtual void On_Item_Init(NCursesMenuItem& item); + + // Called before this item is left as current item. + virtual void On_Item_Termination(NCursesMenuItem& item); + + // Provide a default key virtualization. Translate the keyboard + // code c into a menu request code. + // The default implementation provides a hopefully straightforward + // mapping for the most common keystrokes and menu requests. + virtual int virtualize(int c); + + // Operators + inline NCursesMenuItem* operator[](int i) const { + if ((i < 0) || (i >= ::item_count(menu))) + OnError(E_BAD_ARGUMENT); + return (my_items[i]); + } + + // Perform the menu's operation + // Return the item where you left the selection mark for a single + // selection menu, or NULL for a multivalued menu. + virtual NCursesMenuItem* operator()(void); + + // -------------------- + // Exception handlers + // Called by operator() + // -------------------- + + // Called if the request is denied + virtual void On_Request_Denied(int c) const; + + // Called if the item is not selectable + virtual void On_Not_Selectable(int c) const; + + // Called if pattern doesn't match + virtual void On_No_Match(int c) const; + + // Called if the command is unknown + virtual void On_Unknown_Command(int c) const; +}; +// +// ------------------------------------------------------------------------- +// This is the typical C++ typesafe way to allow to attach +// user data to an item of a menu. Its assumed that the user +// data belongs to some class T. Use T as template argument +// to create a UserItem. +// ------------------------------------------------------------------------- +// +template +class NCURSES_IMPEXP NCursesUserItem : public NCursesMenuItem { + public: + NCursesUserItem( + const char* p_name, + const char* p_descript = NULL, + const T* p_UserData = STATIC_CAST(T*)(0)) + : NCursesMenuItem(p_name, p_descript) { + if (item) + OnError( + ::set_item_userptr( + item, + const_cast(reinterpret_cast(p_UserData)))); + } + + virtual ~NCursesUserItem() {} + + inline const T* UserData(void) const { + return reinterpret_cast(::item_userptr(item)); + }; + + inline virtual void setUserData(const T* p_UserData) { + if (item) + OnError( + ::set_item_userptr( + item, + const_cast(reinterpret_cast(p_UserData)))); + } +}; +// +// ------------------------------------------------------------------------- +// The same mechanism is used to attach user data to a menu +// ------------------------------------------------------------------------- +// +template +class NCURSES_IMPEXP NCursesUserMenu : public NCursesMenu { + protected: + NCursesUserMenu( + int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = STATIC_CAST(T*)(0)) + : NCursesMenu(nlines, ncols, begin_y, begin_x) { + if (menu) + set_user(const_cast(reinterpret_cast(p_UserData))); + } + + public: + NCursesUserMenu( + NCursesMenuItem* Items[], + const T* p_UserData = STATIC_CAST(T*)(0), + bool with_frame = FALSE, + bool autoDelete_Items = FALSE) + : NCursesMenu(Items, with_frame, autoDelete_Items) { + if (menu) + set_user(const_cast(reinterpret_cast(p_UserData))); + }; + + NCursesUserMenu( + NCursesMenuItem* Items[], + int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = STATIC_CAST(T*)(0), + bool with_frame = FALSE) + : NCursesMenu(Items, nlines, ncols, begin_y, begin_x, with_frame) { + if (menu) + set_user(const_cast(reinterpret_cast(p_UserData))); + }; + + virtual ~NCursesUserMenu(){}; + + inline T* UserData(void) { + return reinterpret_cast(get_user()); + }; + + inline virtual void setUserData(const T* p_UserData) { + if (menu) + set_user(const_cast(reinterpret_cast(p_UserData))); + } +}; + +#endif /* NCURSES_CURSESM_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/cursesp.h b/src_cpp/elfgames/tasks/elf2codingenv/include/cursesp.h new file mode 100644 index 0000000..a2c9b16 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/cursesp.h @@ -0,0 +1,238 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998-2012,2014 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1997 * + ****************************************************************************/ + +#ifndef NCURSES_CURSESP_H_incl +#define NCURSES_CURSESP_H_incl 1 + +// $Id: cursesp.h,v 1.31 2014/08/09 22:06:26 Adam.Jiang Exp $ + +#include + +extern "C" { +#include +} + +class NCURSES_IMPEXP NCursesPanel : public NCursesWindow { + protected: + PANEL* p; + static NCursesPanel* dummy; + + private: + // This structure is used for the panel's user data field to link the + // PANEL* to the C++ object and to provide extra space for a user pointer. + typedef struct { + void* m_user; // the pointer for the user's data + const NCursesPanel* m_back; // backward pointer to C++ object + const PANEL* m_owner; // the panel itself + } UserHook; + + inline UserHook* UserPointer() { + UserHook* uptr = + reinterpret_cast(const_cast(::panel_userptr(p))); + return uptr; + } + + void init(); // Initialize the panel object + + protected: + void set_user(void* user) { + UserHook* uptr = UserPointer(); + if (uptr != 0 && uptr->m_back == this && uptr->m_owner == p) { + uptr->m_user = user; + } + } + // Set the user pointer of the panel. + + void* get_user() { + UserHook* uptr = UserPointer(); + void* result = 0; + if (uptr != 0 && uptr->m_back == this && uptr->m_owner == p) + result = uptr->m_user; + return result; + } + + void OnError(int err) const + THROW2(NCursesException const, NCursesPanelException) { + if (err == ERR) + THROW(new NCursesPanelException(this, err)); + } + // If err is equal to the curses error indicator ERR, an error handler + // is called. + + // Get a keystroke. Default implementation calls getch() + virtual int getKey(void); + + public: + NCursesPanel(int nlines, int ncols, int begin_y = 0, int begin_x = 0) + : NCursesWindow(nlines, ncols, begin_y, begin_x), p(0) { + init(); + } + // Create a panel with this size starting at the requested position. + + NCursesPanel() : NCursesWindow(::stdscr), p(0) { + init(); + } + // This constructor creates the default Panel associated with the + // ::stdscr window + + NCursesPanel& operator=(const NCursesPanel& rhs) { + if (this != &rhs) { + *this = rhs; + NCursesWindow::operator=(rhs); + } + return *this; + } + + NCursesPanel(const NCursesPanel& rhs) : NCursesWindow(rhs), p(rhs.p) {} + + virtual ~NCursesPanel(); + + // basic manipulation + inline void hide() { + OnError(::hide_panel(p)); + } + // Hide the panel. It stays in the stack but becomes invisible. + + inline void show() { + OnError(::show_panel(p)); + } + // Show the panel, i.e. make it visible. + + inline void top() { + OnError(::top_panel(p)); + } + // Make this panel the top panel in the stack. + + inline void bottom() { + OnError(::bottom_panel(p)); + } + // Make this panel the bottom panel in the stack. + // N.B.: The panel associated with ::stdscr is always on the bottom. So + // actually bottom() makes the panel the first above ::stdscr. + + virtual int mvwin(int y, int x) { + OnError(::move_panel(p, y, x)); + return OK; + } + + inline bool hidden() const { + return (::panel_hidden(p) ? TRUE : FALSE); + } + // Return TRUE if the panel is hidden, FALSE otherwise. + + /* The functions panel_above() and panel_below() are not reflected in + the NCursesPanel class. The reason for this is, that we cannot + assume that a panel retrieved by those operations is one wrapped + by a C++ class. Although this situation might be handled, we also + need a reverse mapping from PANEL to NCursesPanel which needs some + redesign of the low level stuff. At the moment, we define them in the + interface but they will always produce an error. */ + inline NCursesPanel& above() const { + OnError(ERR); + return *dummy; + } + + inline NCursesPanel& below() const { + OnError(ERR); + return *dummy; + } + + // Those two are rewrites of the corresponding virtual members of + // NCursesWindow + virtual int refresh(); + // Propagate all panel changes to the virtual screen and update the + // physical screen. + + virtual int noutrefresh(); + // Propagate all panel changes to the virtual screen. + + static void redraw(); + // Redraw all panels. + + // decorations + virtual void frame(const char* title = NULL, const char* btitle = NULL); + // Put a frame around the panel and put the title centered in the top line + // and btitle in the bottom line. + + virtual void boldframe(const char* title = NULL, const char* btitle = NULL); + // Same as frame(), but use highlighted attributes. + + virtual void label(const char* topLabel, const char* bottomLabel); + // Put the title centered in the top line and btitle in the bottom line. + + virtual void centertext(int row, const char* label); + // Put the label text centered in the specified row. +}; + +/* We use templates to provide a typesafe mechanism to associate + * user data with a panel. A NCursesUserPanel is a panel + * associated with some user data of type T. + */ +template +class NCursesUserPanel : public NCursesPanel { + public: + NCursesUserPanel( + int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = STATIC_CAST(T*)(0)) + : NCursesPanel(nlines, ncols, begin_y, begin_x) { + if (p) + set_user(const_cast(reinterpret_cast(p_UserData))); + }; + // This creates an user panel of the requested size with associated + // user data pointed to by p_UserData. + + NCursesUserPanel(const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesPanel() { + if (p) + set_user(const_cast(reinterpret_cast(p_UserData))); + }; + // This creates an user panel associated with the ::stdscr and user data + // pointed to by p_UserData. + + virtual ~NCursesUserPanel(){}; + + T* UserData(void) { + return reinterpret_cast(get_user()); + }; + // Retrieve the user data associated with the panel. + + virtual void setUserData(const T* p_UserData) { + if (p) + set_user(const_cast(reinterpret_cast(p_UserData))); + } + // Associate the user panel with the user data pointed to by p_UserData. +}; + +#endif /* NCURSES_CURSESP_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/cursesw.h b/src_cpp/elfgames/tasks/elf2codingenv/include/cursesw.h new file mode 100644 index 0000000..6a2ed25 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/cursesw.h @@ -0,0 +1,2005 @@ +// * This makes emacs happy -*-Mode: C++;-*- +// vile:cppmode +/**************************************************************************** + * Copyright (c) 1998-2014,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +#ifndef NCURSES_CURSESW_H_incl +#define NCURSES_CURSESW_H_incl 1 + +// $Id: cursesw.h,v 1.53 2017/11/21 00:37:23 tom Exp $ + +extern "C" { +#include +} + +#include + +/* SCO 3.2v4 curses.h includes term.h, which defines lines as a macro. + Undefine it here, because NCursesWindow uses lines as a method. */ +#undef lines + +/* "Convert" macros to inlines. We'll define it as another symbol to avoid + * conflict with library symbols. + */ +#undef UNDEF +#define UNDEF(name) CUR_##name + +#ifdef addch +inline int UNDEF(addch)(chtype ch) { + return addch(ch); +} +#undef addch +#define addch UNDEF(addch) +#endif + +#ifdef addchstr +inline int UNDEF(addchstr)(chtype* at) { + return addchstr(at); +} +#undef addchstr +#define addchstr UNDEF(addchstr) +#endif + +#ifdef addnstr +inline int UNDEF(addnstr)(const char* str, int n) { + return addnstr(str, n); +} +#undef addnstr +#define addnstr UNDEF(addnstr) +#endif + +#ifdef addstr +inline int UNDEF(addstr)(const char* str) { + return addstr(str); +} +#undef addstr +#define addstr UNDEF(addstr) +#endif + +#ifdef attroff +inline int UNDEF(attroff)(chtype at) { + return attroff(at); +} +#undef attroff +#define attroff UNDEF(attroff) +#endif + +#ifdef attron +inline int UNDEF(attron)(chtype at) { + return attron(at); +} +#undef attron +#define attron UNDEF(attron) +#endif + +#ifdef attrset +inline chtype UNDEF(attrset)(chtype at) { + return attrset(at); +} +#undef attrset +#define attrset UNDEF(attrset) +#endif + +#ifdef bkgd +inline int UNDEF(bkgd)(chtype ch) { + return bkgd(ch); +} +#undef bkgd +#define bkgd UNDEF(bkgd) +#endif + +#ifdef bkgdset +inline void UNDEF(bkgdset)(chtype ch) { + bkgdset(ch); +} +#undef bkgdset +#define bkgdset UNDEF(bkgdset) +#endif + +#ifdef border +inline int UNDEF(border)( + chtype ls, + chtype rs, + chtype ts, + chtype bs, + chtype tl, + chtype tr, + chtype bl, + chtype br) { + return border(ls, rs, ts, bs, tl, tr, bl, br); +} +#undef border +#define border UNDEF(border) +#endif + +#ifdef box +inline int UNDEF(box)(WINDOW* win, int v, int h) { + return box(win, v, h); +} +#undef box +#define box UNDEF(box) +#endif + +#ifdef chgat +inline int UNDEF( + chgat)(int n, attr_t attr, NCURSES_PAIRS_T color, const void* opts) { + return chgat(n, attr, color, opts); +} +#undef chgat +#define chgat UNDEF(chgat) +#endif + +#ifdef clear +inline int UNDEF(clear)() { + return clear(); +} +#undef clear +#define clear UNDEF(clear) +#endif + +#ifdef clearok +inline int UNDEF(clearok)(WINDOW* win, bool bf) { + return clearok(win, bf); +} +#undef clearok +#define clearok UNDEF(clearok) +#else +extern "C" NCURSES_IMPEXP int NCURSES_API clearok(WINDOW*, bool); +#endif + +#ifdef clrtobot +inline int UNDEF(clrtobot)() { + return clrtobot(); +} +#undef clrtobot +#define clrtobot UNDEF(clrtobot) +#endif + +#ifdef clrtoeol +inline int UNDEF(clrtoeol)() { + return clrtoeol(); +} +#undef clrtoeol +#define clrtoeol UNDEF(clrtoeol) +#endif + +#ifdef color_set +inline chtype UNDEF(color_set)(NCURSES_PAIRS_T p, void* opts) { + return color_set(p, opts); +} +#undef color_set +#define color_set UNDEF(color_set) +#endif + +#ifdef crmode +inline int UNDEF(crmode)(void) { + return crmode(); +} +#undef crmode +#define crmode UNDEF(crmode) +#endif + +#ifdef delch +inline int UNDEF(delch)() { + return delch(); +} +#undef delch +#define delch UNDEF(delch) +#endif + +#ifdef deleteln +inline int UNDEF(deleteln)() { + return deleteln(); +} +#undef deleteln +#define deleteln UNDEF(deleteln) +#endif + +#ifdef echochar +inline int UNDEF(echochar)(chtype ch) { + return echochar(ch); +} +#undef echochar +#define echochar UNDEF(echochar) +#endif + +#ifdef erase +inline int UNDEF(erase)() { + return erase(); +} +#undef erase +#define erase UNDEF(erase) +#endif + +#ifdef fixterm +inline int UNDEF(fixterm)(void) { + return fixterm(); +} +#undef fixterm +#define fixterm UNDEF(fixterm) +#endif + +#ifdef flushok +inline int UNDEF(flushok)(WINDOW* _win, bool _bf) { + return flushok(_win, _bf); +} +#undef flushok +#define flushok UNDEF(flushok) +#else +#define _no_flushok +#endif + +#ifdef getattrs +inline int UNDEF(getattrs)(WINDOW* win) { + return getattrs(win); +} +#undef getattrs +#define getattrs UNDEF(getattrs) +#endif + +#ifdef getbegyx +inline void UNDEF(getbegyx)(WINDOW* win, int& y, int& x) { + getbegyx(win, y, x); +} +#undef getbegyx +#define getbegyx UNDEF(getbegyx) +#endif + +#ifdef getbkgd +inline chtype UNDEF(getbkgd)(const WINDOW* win) { + return getbkgd(win); +} +#undef getbkgd +#define getbkgd UNDEF(getbkgd) +#endif + +#ifdef getch +inline int UNDEF(getch)() { + return getch(); +} +#undef getch +#define getch UNDEF(getch) +#endif + +#ifdef getmaxyx +inline void UNDEF(getmaxyx)(WINDOW* win, int& y, int& x) { + getmaxyx(win, y, x); +} +#undef getmaxyx +#define getmaxyx UNDEF(getmaxyx) +#endif + +#ifdef getnstr +inline int UNDEF(getnstr)(char* _str, int n) { + return getnstr(_str, n); +} +#undef getnstr +#define getnstr UNDEF(getnstr) +#endif + +#ifdef getparyx +inline void UNDEF(getparyx)(WINDOW* win, int& y, int& x) { + getparyx(win, y, x); +} +#undef getparyx +#define getparyx UNDEF(getparyx) +#endif + +#ifdef getstr +inline int UNDEF(getstr)(char* _str) { + return getstr(_str); +} +#undef getstr +#define getstr UNDEF(getstr) +#endif + +#ifdef getyx +inline void UNDEF(getyx)(const WINDOW* win, int& y, int& x) { + getyx(win, y, x); +} +#undef getyx +#define getyx UNDEF(getyx) +#endif + +#ifdef hline +inline int UNDEF(hline)(chtype ch, int n) { + return hline(ch, n); +} +#undef hline +#define hline UNDEF(hline) +#endif + +#ifdef inch +inline chtype UNDEF(inch)() { + return inch(); +} +#undef inch +#define inch UNDEF(inch) +#endif + +#ifdef inchstr +inline int UNDEF(inchstr)(chtype* str) { + return inchstr(str); +} +#undef inchstr +#define inchstr UNDEF(inchstr) +#endif + +#ifdef innstr +inline int UNDEF(innstr)(char* _str, int n) { + return innstr(_str, n); +} +#undef innstr +#define innstr UNDEF(innstr) +#endif + +#ifdef insch +inline int UNDEF(insch)(chtype c) { + return insch(c); +} +#undef insch +#define insch UNDEF(insch) +#endif + +#ifdef insdelln +inline int UNDEF(insdelln)(int n) { + return insdelln(n); +} +#undef insdelln +#define insdelln UNDEF(insdelln) +#endif + +#ifdef insertln +inline int UNDEF(insertln)() { + return insertln(); +} +#undef insertln +#define insertln UNDEF(insertln) +#endif + +#ifdef insnstr +inline int UNDEF(insnstr)(const char* _str, int n) { + return insnstr(_str, n); +} +#undef insnstr +#define insnstr UNDEF(insnstr) +#endif + +#ifdef insstr +inline int UNDEF(insstr)(const char* _str) { + return insstr(_str); +} +#undef insstr +#define insstr UNDEF(insstr) +#endif + +#ifdef instr +inline int UNDEF(instr)(char* _str) { + return instr(_str); +} +#undef instr +#define instr UNDEF(instr) +#endif + +#ifdef intrflush +inline void UNDEF(intrflush)(WINDOW* win, bool bf) { + intrflush(); +} +#undef intrflush +#define intrflush UNDEF(intrflush) +#endif + +#ifdef is_linetouched +inline int UNDEF(is_linetouched)(WINDOW* w, int l) { + return is_linetouched(w, l); +} +#undef is_linetouched +#define is_linetouched UNDEF(is_linetouched) +#endif + +#ifdef leaveok +inline int UNDEF(leaveok)(WINDOW* win, bool bf) { + return leaveok(win, bf); +} +#undef leaveok +#define leaveok UNDEF(leaveok) +#else +extern "C" NCURSES_IMPEXP int NCURSES_API leaveok(WINDOW* win, bool bf); +#endif + +#ifdef move +inline int UNDEF(move)(int x, int y) { + return move(x, y); +} +#undef move +#define move UNDEF(move) +#endif + +#ifdef mvaddch +inline int UNDEF(mvaddch)(int y, int x, chtype ch) { + return mvaddch(y, x, ch); +} +#undef mvaddch +#define mvaddch UNDEF(mvaddch) +#endif + +#ifdef mvaddnstr +inline int UNDEF(mvaddnstr)(int y, int x, const char* str, int n) { + return mvaddnstr(y, x, str, n); +} +#undef mvaddnstr +#define mvaddnstr UNDEF(mvaddnstr) +#endif + +#ifdef mvaddstr +inline int UNDEF(mvaddstr)(int y, int x, const char* str) { + return mvaddstr(y, x, str); +} +#undef mvaddstr +#define mvaddstr UNDEF(mvaddstr) +#endif + +#ifdef mvchgat +inline int UNDEF(mvchgat)( + int y, + int x, + int n, + attr_t attr, + NCURSES_PAIRS_T color, + const void* opts) { + return mvchgat(y, x, n, attr, color, opts); +} +#undef mvchgat +#define mvchgat UNDEF(mvchgat) +#endif + +#ifdef mvdelch +inline int UNDEF(mvdelch)(int y, int x) { + return mvdelch(y, x); +} +#undef mvdelch +#define mvdelch UNDEF(mvdelch) +#endif + +#ifdef mvgetch +inline int UNDEF(mvgetch)(int y, int x) { + return mvgetch(y, x); +} +#undef mvgetch +#define mvgetch UNDEF(mvgetch) +#endif + +#ifdef mvgetnstr +inline int UNDEF(mvgetnstr)(int y, int x, char* str, int n) { + return mvgetnstr(y, x, str, n); +} +#undef mvgetnstr +#define mvgetnstr UNDEF(mvgetnstr) +#endif + +#ifdef mvgetstr +inline int UNDEF(mvgetstr)(int y, int x, char* str) { + return mvgetstr(y, x, str); +} +#undef mvgetstr +#define mvgetstr UNDEF(mvgetstr) +#endif + +#ifdef mvinch +inline chtype UNDEF(mvinch)(int y, int x) { + return mvinch(y, x); +} +#undef mvinch +#define mvinch UNDEF(mvinch) +#endif + +#ifdef mvinnstr +inline int UNDEF(mvinnstr)(int y, int x, char* _str, int n) { + return mvinnstr(y, x, _str, n); +} +#undef mvinnstr +#define mvinnstr UNDEF(mvinnstr) +#endif + +#ifdef mvinsch +inline int UNDEF(mvinsch)(int y, int x, chtype c) { + return mvinsch(y, x, c); +} +#undef mvinsch +#define mvinsch UNDEF(mvinsch) +#endif + +#ifdef mvinsnstr +inline int UNDEF(mvinsnstr)(int y, int x, const char* _str, int n) { + return mvinsnstr(y, x, _str, n); +} +#undef mvinsnstr +#define mvinsnstr UNDEF(mvinsnstr) +#endif + +#ifdef mvinsstr +inline int UNDEF(mvinsstr)(int y, int x, const char* _str) { + return mvinsstr(y, x, _str); +} +#undef mvinsstr +#define mvinsstr UNDEF(mvinsstr) +#endif + +#ifdef mvwaddch +inline int UNDEF(mvwaddch)(WINDOW* win, int y, int x, const chtype ch) { + return mvwaddch(win, y, x, ch); +} +#undef mvwaddch +#define mvwaddch UNDEF(mvwaddch) +#endif + +#ifdef mvwaddchnstr +inline int UNDEF( + mvwaddchnstr)(WINDOW* win, int y, int x, const chtype* str, int n) { + return mvwaddchnstr(win, y, x, str, n); +} +#undef mvwaddchnstr +#define mvwaddchnstr UNDEF(mvwaddchnstr) +#endif + +#ifdef mvwaddchstr +inline int UNDEF(mvwaddchstr)(WINDOW* win, int y, int x, const chtype* str) { + return mvwaddchstr(win, y, x, str); +} +#undef mvwaddchstr +#define mvwaddchstr UNDEF(mvwaddchstr) +#endif + +#ifdef mvwaddnstr +inline int UNDEF( + mvwaddnstr)(WINDOW* win, int y, int x, const char* str, int n) { + return mvwaddnstr(win, y, x, str, n); +} +#undef mvwaddnstr +#define mvwaddnstr UNDEF(mvwaddnstr) +#endif + +#ifdef mvwaddstr +inline int UNDEF(mvwaddstr)(WINDOW* win, int y, int x, const char* str) { + return mvwaddstr(win, y, x, str); +} +#undef mvwaddstr +#define mvwaddstr UNDEF(mvwaddstr) +#endif + +#ifdef mvwchgat +inline int UNDEF(mvwchgat)( + WINDOW* win, + int y, + int x, + int n, + attr_t attr, + NCURSES_PAIRS_T color, + const void* opts) { + return mvwchgat(win, y, x, n, attr, color, opts); +} +#undef mvwchgat +#define mvwchgat UNDEF(mvwchgat) +#endif + +#ifdef mvwdelch +inline int UNDEF(mvwdelch)(WINDOW* win, int y, int x) { + return mvwdelch(win, y, x); +} +#undef mvwdelch +#define mvwdelch UNDEF(mvwdelch) +#endif + +#ifdef mvwgetch +inline int UNDEF(mvwgetch)(WINDOW* win, int y, int x) { + return mvwgetch(win, y, x); +} +#undef mvwgetch +#define mvwgetch UNDEF(mvwgetch) +#endif + +#ifdef mvwgetnstr +inline int UNDEF(mvwgetnstr)(WINDOW* win, int y, int x, char* str, int n) { + return mvwgetnstr(win, y, x, str, n); +} +#undef mvwgetnstr +#define mvwgetnstr UNDEF(mvwgetnstr) +#endif + +#ifdef mvwgetstr +inline int UNDEF(mvwgetstr)(WINDOW* win, int y, int x, char* str) { + return mvwgetstr(win, y, x, str); +} +#undef mvwgetstr +#define mvwgetstr UNDEF(mvwgetstr) +#endif + +#ifdef mvwhline +inline int UNDEF(mvwhline)(WINDOW* win, int y, int x, chtype c, int n) { + return mvwhline(win, y, x, c, n); +} +#undef mvwhline +#define mvwhline UNDEF(mvwhline) +#endif + +#ifdef mvwinch +inline chtype UNDEF(mvwinch)(WINDOW* win, int y, int x) { + return mvwinch(win, y, x); +} +#undef mvwinch +#define mvwinch UNDEF(mvwinch) +#endif + +#ifdef mvwinchnstr +inline int UNDEF(mvwinchnstr)(WINDOW* win, int y, int x, chtype* str, int n) { + return mvwinchnstr(win, y, x, str, n); +} +#undef mvwinchnstr +#define mvwinchnstr UNDEF(mvwinchnstr) +#endif + +#ifdef mvwinchstr +inline int UNDEF(mvwinchstr)(WINDOW* win, int y, int x, chtype* str) { + return mvwinchstr(win, y, x, str); +} +#undef mvwinchstr +#define mvwinchstr UNDEF(mvwinchstr) +#endif + +#ifdef mvwinnstr +inline int UNDEF(mvwinnstr)(WINDOW* win, int y, int x, char* _str, int n) { + return mvwinnstr(win, y, x, _str, n); +} +#undef mvwinnstr +#define mvwinnstr UNDEF(mvwinnstr) +#endif + +#ifdef mvwinsch +inline int UNDEF(mvwinsch)(WINDOW* win, int y, int x, chtype c) { + return mvwinsch(win, y, x, c); +} +#undef mvwinsch +#define mvwinsch UNDEF(mvwinsch) +#endif + +#ifdef mvwinsnstr +inline int UNDEF(mvwinsnstr)(WINDOW* w, int y, int x, const char* _str, int n) { + return mvwinsnstr(w, y, x, _str, n); +} +#undef mvwinsnstr +#define mvwinsnstr UNDEF(mvwinsnstr) +#endif + +#ifdef mvwinsstr +inline int UNDEF(mvwinsstr)(WINDOW* w, int y, int x, const char* _str) { + return mvwinsstr(w, y, x, _str); +} +#undef mvwinsstr +#define mvwinsstr UNDEF(mvwinsstr) +#endif + +#ifdef mvwvline +inline int UNDEF(mvwvline)(WINDOW* win, int y, int x, chtype c, int n) { + return mvwvline(win, y, x, c, n); +} +#undef mvwvline +#define mvwvline UNDEF(mvwvline) +#endif + +#ifdef napms +inline void UNDEF(napms)(unsigned long x) { + napms(x); +} +#undef napms +#define napms UNDEF(napms) +#endif + +#ifdef nocrmode +inline int UNDEF(nocrmode)(void) { + return nocrmode(); +} +#undef nocrmode +#define nocrmode UNDEF(nocrmode) +#endif + +#ifdef nodelay +inline void UNDEF(nodelay)() { + nodelay(); +} +#undef nodelay +#define nodelay UNDEF(nodelay) +#endif + +#ifdef redrawwin +inline int UNDEF(redrawwin)(WINDOW* win) { + return redrawwin(win); +} +#undef redrawwin +#define redrawwin UNDEF(redrawwin) +#endif + +#ifdef refresh +inline int UNDEF(refresh)() { + return refresh(); +} +#undef refresh +#define refresh UNDEF(refresh) +#endif + +#ifdef resetterm +inline int UNDEF(resetterm)(void) { + return resetterm(); +} +#undef resetterm +#define resetterm UNDEF(resetterm) +#endif + +#ifdef saveterm +inline int UNDEF(saveterm)(void) { + return saveterm(); +} +#undef saveterm +#define saveterm UNDEF(saveterm) +#endif + +#ifdef scrl +inline int UNDEF(scrl)(int l) { + return scrl(l); +} +#undef scrl +#define scrl UNDEF(scrl) +#endif + +#ifdef scroll +inline int UNDEF(scroll)(WINDOW* win) { + return scroll(win); +} +#undef scroll +#define scroll UNDEF(scroll) +#endif + +#ifdef scrollok +inline int UNDEF(scrollok)(WINDOW* win, bool bf) { + return scrollok(win, bf); +} +#undef scrollok +#define scrollok UNDEF(scrollok) +#else +#if defined(__NCURSES_H) +extern "C" NCURSES_IMPEXP int NCURSES_API scrollok(WINDOW*, bool); +#else +extern "C" NCURSES_IMPEXP int NCURSES_API scrollok(WINDOW*, char); +#endif +#endif + +#ifdef setscrreg +inline int UNDEF(setscrreg)(int t, int b) { + return setscrreg(t, b); +} +#undef setscrreg +#define setscrreg UNDEF(setscrreg) +#endif + +#ifdef standend +inline int UNDEF(standend)() { + return standend(); +} +#undef standend +#define standend UNDEF(standend) +#endif + +#ifdef standout +inline int UNDEF(standout)() { + return standout(); +} +#undef standout +#define standout UNDEF(standout) +#endif + +#ifdef subpad +inline WINDOW* UNDEF(subpad)(WINDOW* p, int l, int c, int y, int x) { + return derwin(p, l, c, y, x); +} +#undef subpad +#define subpad UNDEF(subpad) +#endif + +#ifdef timeout +inline void UNDEF(timeout)(int delay) { + timeout(delay); +} +#undef timeout +#define timeout UNDEF(timeout) +#endif + +#ifdef touchline +inline int UNDEF(touchline)(WINDOW* win, int s, int c) { + return touchline(win, s, c); +} +#undef touchline +#define touchline UNDEF(touchline) +#endif + +#ifdef touchwin +inline int UNDEF(touchwin)(WINDOW* win) { + return touchwin(win); +} +#undef touchwin +#define touchwin UNDEF(touchwin) +#endif + +#ifdef untouchwin +inline int UNDEF(untouchwin)(WINDOW* win) { + return untouchwin(win); +} +#undef untouchwin +#define untouchwin UNDEF(untouchwin) +#endif + +#ifdef vline +inline int UNDEF(vline)(chtype ch, int n) { + return vline(ch, n); +} +#undef vline +#define vline UNDEF(vline) +#endif + +#ifdef waddchstr +inline int UNDEF(waddchstr)(WINDOW* win, chtype* at) { + return waddchstr(win, at); +} +#undef waddchstr +#define waddchstr UNDEF(waddchstr) +#endif + +#ifdef waddstr +inline int UNDEF(waddstr)(WINDOW* win, char* str) { + return waddstr(win, str); +} +#undef waddstr +#define waddstr UNDEF(waddstr) +#endif + +#ifdef wattroff +inline int UNDEF(wattroff)(WINDOW* win, int att) { + return wattroff(win, att); +} +#undef wattroff +#define wattroff UNDEF(wattroff) +#endif + +#ifdef wattrset +inline int UNDEF(wattrset)(WINDOW* win, int att) { + return wattrset(win, att); +} +#undef wattrset +#define wattrset UNDEF(wattrset) +#endif + +#ifdef winch +inline chtype UNDEF(winch)(const WINDOW* win) { + return winch(win); +} +#undef winch +#define winch UNDEF(winch) +#endif + +#ifdef winchnstr +inline int UNDEF(winchnstr)(WINDOW* win, chtype* str, int n) { + return winchnstr(win, str, n); +} +#undef winchnstr +#define winchnstr UNDEF(winchnstr) +#endif + +#ifdef winchstr +inline int UNDEF(winchstr)(WINDOW* win, chtype* str) { + return winchstr(win, str); +} +#undef winchstr +#define winchstr UNDEF(winchstr) +#endif + +#ifdef winsstr +inline int UNDEF(winsstr)(WINDOW* w, const char* _str) { + return winsstr(w, _str); +} +#undef winsstr +#define winsstr UNDEF(winsstr) +#endif + +#ifdef wstandend +inline int UNDEF(wstandend)(WINDOW* win) { + return wstandend(win); +} +#undef wstandend +#define wstandend UNDEF(wstandend) +#endif + +#ifdef wstandout +inline int UNDEF(wstandout)(WINDOW* win) { + return wstandout(win); +} +#undef wstandout +#define wstandout UNDEF(wstandout) +#endif + +/* + * + * C++ class for windows. + * + */ + +extern "C" int _nc_ripoffline(int, int (*init)(WINDOW*, int)); +extern "C" int _nc_xx_ripoff_init(WINDOW*, int); +extern "C" int _nc_has_mouse(void); + +class NCURSES_IMPEXP NCursesWindow { + friend class NCursesMenu; + friend class NCursesForm; + + private: + static bool b_initialized; + static void initialize(); + void constructing(); + friend int _nc_xx_ripoff_init(WINDOW*, int); + + void set_keyboard(); + + NCURSES_COLOR_T getcolor(int getback) const; + NCURSES_PAIRS_T getPair() const; + + static int + setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back, NCURSES_PAIRS_T pair); + static int colorInitialized; + + // This private constructor is only used during the initialization + // of windows generated by ripoffline() calls. + NCursesWindow(WINDOW* win, int ncols); + + protected: + virtual void err_handler(const char*) const THROWS(NCursesException); + // Signal an error with the given message text. + + static long count; // count of all active windows: + // We rely on the c++ promise that + // all otherwise uninitialized + // static class vars are set to 0 + + WINDOW* w; // the curses WINDOW + + bool alloced; // TRUE if we own the WINDOW + + NCursesWindow* par; // parent, if subwindow + NCursesWindow* subwins; // head of subwindows list + NCursesWindow* sib; // next subwindow of parent + + void kill_subwindows(); // disable all subwindows + // Destroy all subwindows. + + /* Only for use by derived classes. They are then in charge to + fill the member variables correctly. */ + NCursesWindow(); + + public: + NCursesWindow(WINDOW* window); // useful only for stdscr + + NCursesWindow( + int nlines, // number of lines + int ncols, // number of columns + int begin_y, // line origin + int begin_x); // col origin + + NCursesWindow( + NCursesWindow& par, // parent window + int nlines, // number of lines + int ncols, // number of columns + int begin_y, // absolute or relative + int begin_x, // origins: + char absrel = 'a'); // if `a', begin_y & begin_x are + // absolute screen pos, else if `r', they are relative to par origin + + NCursesWindow( + NCursesWindow& par, // parent window + bool do_box = TRUE); + // this is the very common case that we want to create the subwindow that + // is two lines and two columns smaller and begins at (1,1). + // We may automatically request the box around it. + + NCursesWindow& operator=(const NCursesWindow& rhs) { + if (this != &rhs) + *this = rhs; + return *this; + } + + NCursesWindow(const NCursesWindow& rhs) + : w(rhs.w), + alloced(rhs.alloced), + par(rhs.par), + subwins(rhs.subwins), + sib(rhs.sib) {} + + virtual ~NCursesWindow(); + + NCursesWindow Clone(); + // Make an exact copy of the window. + + // Initialization. + static void useColors(void); + // Call this routine very early if you want to have colors. + + static int ripoffline(int ripoff_lines, int (*init)(NCursesWindow& win)); + // This function is used to generate a window of ripped-of lines. + // If the argument is positive, lines are removed from the top, if it + // is negative lines are removed from the bottom. This enhances the + // lowlevel ripoffline() function because it uses the internal + // implementation that allows to remove more than just a single line. + // This function must be called before any other ncurses function. The + // creation of the window is deferred until ncurses gets initialized. + // The initialization function is then called. + + // ------------------------------------------------------------------------- + // terminal status + // ------------------------------------------------------------------------- + int lines() const { + initialize(); + return LINES; + } + // Number of lines on terminal, *not* window + + int cols() const { + initialize(); + return COLS; + } + // Number of cols on terminal, *not* window + + int tabsize() const { + initialize(); + return TABSIZE; + } + // Size of a tab on terminal, *not* window + + static int NumberOfColors(); + // Number of available colors + + int colors() const { + return NumberOfColors(); + } + // Number of available colors + + // ------------------------------------------------------------------------- + // window status + // ------------------------------------------------------------------------- + int height() const { + return maxy() + 1; + } + // Number of lines in this window + + int width() const { + return maxx() + 1; + } + // Number of columns in this window + + int begx() const { + return getbegx(w); + } + // Column of top left corner relative to stdscr + + int begy() const { + return getbegy(w); + } + // Line of top left corner relative to stdscr + + int curx() const { + return getcurx(w); + } + // Column of top left corner relative to stdscr + + int cury() const { + return getcury(w); + } + // Line of top left corner relative to stdscr + + int maxx() const { + return getmaxx(w) == ERR ? ERR : getmaxx(w) - 1; + } + // Largest x coord in window + + int maxy() const { + return getmaxy(w) == ERR ? ERR : getmaxy(w) - 1; + } + // Largest y coord in window + + NCURSES_PAIRS_T getcolor() const; + // Actual color pair + + NCURSES_COLOR_T foreground() const { + return getcolor(0); + } + // Actual foreground color + + NCURSES_COLOR_T background() const { + return getcolor(1); + } + // Actual background color + + int setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back); + // Set color palette entry + + int setcolor(NCURSES_PAIRS_T pair); + // Set actually used palette entry + + // ------------------------------------------------------------------------- + // window positioning + // ------------------------------------------------------------------------- + virtual int mvwin(int begin_y, int begin_x) { + return ::mvwin(w, begin_y, begin_x); + } + // Move window to new position with the new position as top left corner. + // This is virtual because it is redefined in NCursesPanel. + + // ------------------------------------------------------------------------- + // coordinate positioning + // ------------------------------------------------------------------------- + int move(int y, int x) { + return ::wmove(w, y, x); + } + // Move cursor the this position + + void getyx(int& y, int& x) const { + ::getyx(w, y, x); + } + // Get current position of the cursor + + void getbegyx(int& y, int& x) const { + ::getbegyx(w, y, x); + } + // Get beginning of the window + + void getmaxyx(int& y, int& x) const { + ::getmaxyx(w, y, x); + } + // Get size of the window + + void getparyx(int& y, int& x) const { + ::getparyx(w, y, x); + } + // Get parent's beginning of the window + + int mvcur(int oldrow, int oldcol, int newrow, int newcol) const { + return ::mvcur(oldrow, oldcol, newrow, newcol); + } + // Perform lowlevel cursor motion that takes effect immediately. + + // ------------------------------------------------------------------------- + // input + // ------------------------------------------------------------------------- + int getch() { + return ::wgetch(w); + } + // Get a keystroke from the window. + + int getch(int y, int x) { + return ::mvwgetch(w, y, x); + } + // Move cursor to position and get a keystroke from the window + + int getstr(char* str, int n = -1) { + return ::wgetnstr(w, str, n); + } + // Read a series of characters into str until a newline or carriage return + // is received. Read at most n characters. If n is negative, the limit is + // ignored. + + int getstr(int y, int x, char* str, int n = -1) { + return ::mvwgetnstr(w, y, x, str, n); + } + // Move the cursor to the requested position and then perform the getstr() + // as described above. + + int instr(char* s, int n = -1) { + return ::winnstr(w, s, n); + } + // Get a string of characters from the window into the buffer s. Retrieve + // at most n characters, if n is negative retrieve all characters up to the + // end of the current line. Attributes are stripped from the characters. + + int instr(int y, int x, char* s, int n = -1) { + return ::mvwinnstr(w, y, x, s, n); + } + // Move the cursor to the requested position and then perform the instr() + // as described above. + + int scanw(const char* fmt, ...) +// Perform a scanw function from the window. +#if __GNUG__ >= 2 + __attribute__((format(scanf, 2, 3))); +#else + ; +#endif + + int scanw(const char*, va_list); + // Perform a scanw function from the window. + + int scanw(int y, int x, const char* fmt, ...) +// Move the cursor to the requested position and then perform a scanw +// from the window. +#if __GNUG__ >= 2 + __attribute__((format(scanf, 4, 5))); +#else + ; +#endif + + int scanw(int y, int x, const char* fmt, va_list); + // Move the cursor to the requested position and then perform a scanw + // from the window. + + // ------------------------------------------------------------------------- + // output + // ------------------------------------------------------------------------- + int addch(const chtype ch) { + return ::waddch(w, ch); + } + // Put attributed character to the window. + + int addch(int y, int x, const chtype ch) { + return ::mvwaddch(w, y, x, ch); + } + // Move cursor to the requested position and then put attributed character + // to the window. + + int echochar(const chtype ch) { + return ::wechochar(w, ch); + } + // Put attributed character to the window and refresh it immediately. + + int addstr(const char* str, int n = -1) { + return ::waddnstr(w, str, n); + } + // Write the string str to the window, stop writing if the terminating + // NUL or the limit n is reached. If n is negative, it is ignored. + + int addstr(int y, int x, const char* str, int n = -1) { + return ::mvwaddnstr(w, y, x, str, n); + } + // Move the cursor to the requested position and then perform the addchstr + // as described above. + + int addchstr(const chtype* str, int n = -1) { + return ::waddchnstr(w, str, n); + } + // Write the string str to the window, stop writing if the terminating + // NUL or the limit n is reached. If n is negative, it is ignored. + + int addchstr(int y, int x, const chtype* str, int n = -1) { + return ::mvwaddchnstr(w, y, x, str, n); + } + // Move the cursor to the requested position and then perform the addchstr + // as described above. + + int printw(const char* fmt, ...) +// Do a formatted print to the window. +#if (__GNUG__ >= 2) && !defined(printf) + __attribute__((format(printf, 2, 3))); +#else + ; +#endif + + int printw(int y, int x, const char* fmt, ...) +// Move the cursor and then do a formatted print to the window. +#if (__GNUG__ >= 2) && !defined(printf) + __attribute__((format(printf, 4, 5))); +#else + ; +#endif + + int printw(const char* fmt, va_list args); + // Do a formatted print to the window. + + int printw(int y, int x, const char* fmt, va_list args); + // Move the cursor and then do a formatted print to the window. + + chtype inch() const { + return ::winch(w); + } + // Retrieve attributed character under the current cursor position. + + chtype inch(int y, int x) { + return ::mvwinch(w, y, x); + } + // Move cursor to requested position and then retrieve attributed character + // at this position. + + int inchstr(chtype* str, int n = -1) { + return ::winchnstr(w, str, n); + } + // Read the string str from the window, stop reading if the terminating + // NUL or the limit n is reached. If n is negative, it is ignored. + + int inchstr(int y, int x, chtype* str, int n = -1) { + return ::mvwinchnstr(w, y, x, str, n); + } + // Move the cursor to the requested position and then perform the inchstr + // as described above. + + int insch(chtype ch) { + return ::winsch(w, ch); + } + // Insert attributed character into the window before current cursor + // position. + + int insch(int y, int x, chtype ch) { + return ::mvwinsch(w, y, x, ch); + } + // Move cursor to requested position and then insert the attributed + // character before that position. + + int insertln() { + return ::winsdelln(w, 1); + } + // Insert an empty line above the current line. + + int insdelln(int n = 1) { + return ::winsdelln(w, n); + } + // If n>0 insert that many lines above the current line. If n<0 delete + // that many lines beginning with the current line. + + int insstr(const char* s, int n = -1) { + return ::winsnstr(w, s, n); + } + // Insert the string into the window before the current cursor position. + // Insert stops at end of string or when the limit n is reached. If n is + // negative, it is ignored. + + int insstr(int y, int x, const char* s, int n = -1) { + return ::mvwinsnstr(w, y, x, s, n); + } + // Move the cursor to the requested position and then perform the insstr() + // as described above. + + int attron(chtype at) { + return ::wattron(w, at); + } + // Switch on the window attributes; + + int attroff(chtype at) { + return ::wattroff(w, static_cast(at)); + } + // Switch off the window attributes; + + int attrset(chtype at) { + return ::wattrset(w, static_cast(at)); + } + // Set the window attributes; + + chtype attrget() { + return ::getattrs(w); + } + // Get the window attributes; + + int color_set(NCURSES_PAIRS_T color_pair_number, void* opts = NULL) { + return ::wcolor_set(w, color_pair_number, opts); + } + // Set the window color attribute; + + int chgat( + int n, + attr_t attr, + NCURSES_PAIRS_T color, + const void* opts = NULL) { + return ::wchgat(w, n, attr, color, opts); + } + // Change the attributes of the next n characters in the current line. If + // n is negative or greater than the number of remaining characters in the + // line, the attributes will be changed up to the end of the line. + + int chgat( + int y, + int x, + int n, + attr_t attr, + NCURSES_PAIRS_T color, + const void* opts = NULL) { + return ::mvwchgat(w, y, x, n, attr, color, opts); + } + // Move the cursor to the requested position and then perform chgat() as + // described above. + + // ------------------------------------------------------------------------- + // background + // ------------------------------------------------------------------------- + chtype getbkgd() const { + return ::getbkgd(w); + } + // Get current background setting. + + int bkgd(const chtype ch) { + return ::wbkgd(w, ch); + } + // Set the background property and apply it to the window. + + void bkgdset(chtype ch) { + ::wbkgdset(w, ch); + } + // Set the background property. + + // ------------------------------------------------------------------------- + // borders + // ------------------------------------------------------------------------- + int box(chtype vert = 0, chtype hor = 0) { + return ::wborder(w, vert, vert, hor, hor, 0, 0, 0, 0); + } + // Draw a box around the window with the given vertical and horizontal + // drawing characters. If you specify a zero as character, curses will try + // to find a "nice" character. + + int border( + chtype left = 0, + chtype right = 0, + chtype top = 0, + chtype bottom = 0, + chtype top_left = 0, + chtype top_right = 0, + chtype bottom_left = 0, + chtype bottom_right = 0) { + return ::wborder( + w, + left, + right, + top, + bottom, + top_left, + top_right, + bottom_left, + bottom_right); + } + // Draw a border around the window with the given characters for the + // various parts of the border. If you pass zero for a character, curses + // will try to find "nice" characters. + + // ------------------------------------------------------------------------- + // lines and boxes + // ------------------------------------------------------------------------- + int hline(int len, chtype ch = 0) { + return ::whline(w, ch, len); + } + // Draw a horizontal line of len characters with the given character. If + // you pass zero for the character, curses will try to find a "nice" one. + + int hline(int y, int x, int len, chtype ch = 0) { + return ::mvwhline(w, y, x, ch, len); + } + // Move the cursor to the requested position and then draw a horizontal line. + + int vline(int len, chtype ch = 0) { + return ::wvline(w, ch, len); + } + // Draw a vertical line of len characters with the given character. If + // you pass zero for the character, curses will try to find a "nice" one. + + int vline(int y, int x, int len, chtype ch = 0) { + return ::mvwvline(w, y, x, ch, len); + } + // Move the cursor to the requested position and then draw a vertical line. + + // ------------------------------------------------------------------------- + // erasure + // ------------------------------------------------------------------------- + int erase() { + return ::werase(w); + } + // Erase the window. + + int clear() { + return ::wclear(w); + } + // Clear the window. + + int clearok(bool bf) { + return ::clearok(w, bf); + } + // Set/Reset the clear flag. If set, the next refresh() will clear the + // screen. + + int clrtobot() { + return ::wclrtobot(w); + } + // Clear to the end of the window. + + int clrtoeol() { + return ::wclrtoeol(w); + } + // Clear to the end of the line. + + int delch() { + return ::wdelch(w); + } + // Delete character under the cursor. + + int delch(int y, int x) { + return ::mvwdelch(w, y, x); + } + // Move cursor to requested position and delete the character under the + // cursor. + + int deleteln() { + return ::winsdelln(w, -1); + } + // Delete the current line. + + // ------------------------------------------------------------------------- + // screen control + // ------------------------------------------------------------------------- + int scroll(int amount = 1) { + return ::wscrl(w, amount); + } + // Scroll amount lines. If amount is positive, scroll up, otherwise + // scroll down. + + int scrollok(bool bf) { + return ::scrollok(w, bf); + } + // If bf is TRUE, window scrolls if cursor is moved off the bottom + // edge of the window or a scrolling region, otherwise the cursor is left + // at the bottom line. + + int setscrreg(int from, int to) { + return ::wsetscrreg(w, from, to); + } + // Define a soft scrolling region. + + int idlok(bool bf) { + return ::idlok(w, bf); + } + // If bf is TRUE, use insert/delete line hardware support if possible. + // Otherwise do it in software. + + void idcok(bool bf) { + ::idcok(w, bf); + } + // If bf is TRUE, use insert/delete character hardware support if possible. + // Otherwise do it in software. + + int touchline(int s, int c) { + return ::touchline(w, s, c); + } + // Mark the given lines as modified. + + int touchwin() { + return ::wtouchln(w, 0, height(), 1); + } + // Mark the whole window as modified. + + int untouchwin() { + return ::wtouchln(w, 0, height(), 0); + } + // Mark the whole window as unmodified. + + int touchln(int s, int cnt, bool changed = TRUE) { + return ::wtouchln(w, s, cnt, static_cast(changed ? 1 : 0)); + } + // Mark cnt lines beginning from line s as changed or unchanged, depending + // on the value of the changed flag. + + bool is_linetouched(int line) const { + return (::is_linetouched(w, line) == TRUE ? TRUE : FALSE); + } + // Return TRUE if line is marked as changed, FALSE otherwise + + bool is_wintouched() const { + return (::is_wintouched(w) ? TRUE : FALSE); + } + // Return TRUE if window is marked as changed, FALSE otherwise + + int leaveok(bool bf) { + return ::leaveok(w, bf); + } + // If bf is TRUE, curses will leave the cursor after an update whereever + // it is after the update. + + int redrawln(int from, int n) { + return ::wredrawln(w, from, n); + } + // Redraw n lines starting from the requested line + + int redrawwin() { + return ::wredrawln(w, 0, height()); + } + // Redraw the whole window + + int doupdate() { + return ::doupdate(); + } + // Do all outputs to make the physical screen looking like the virtual one + + void syncdown() { + ::wsyncdown(w); + } + // Propagate the changes down to all descendant windows + + void syncup() { + ::wsyncup(w); + } + // Propagate the changes up in the hierarchy + + void cursyncup() { + ::wcursyncup(w); + } + // Position the cursor in all ancestor windows corresponding to our setting + + int syncok(bool bf) { + return ::syncok(w, bf); + } +// If called with bf=TRUE, syncup() is called whenever the window is changed + +#ifndef _no_flushok + int flushok(bool bf) { + return ::flushok(w, bf); + } +#endif + + void immedok(bool bf) { + ::immedok(w, bf); + } + // If called with bf=TRUE, any change in the window will cause an + // automatic immediate refresh() + + int intrflush(bool bf) { + return ::intrflush(w, bf); + } + + int keypad(bool bf) { + return ::keypad(w, bf); + } + // If called with bf=TRUE, the application will interpret function keys. + + int nodelay(bool bf) { + return ::nodelay(w, bf); + } + + int meta(bool bf) { + return ::meta(w, bf); + } + // If called with bf=TRUE, keys may generate 8-Bit characters. Otherwise + // 7-Bit characters are generated. + + int standout() { + return ::wstandout(w); + } + // Enable "standout" attributes + + int standend() { + return ::wstandend(w); + } + // Disable "standout" attributes + + // ------------------------------------------------------------------------- + // The next two are virtual, because we redefine them in the + // NCursesPanel class. + // ------------------------------------------------------------------------- + virtual int refresh() { + return ::wrefresh(w); + } + // Propagate the changes in this window to the virtual screen and call + // doupdate(). This is redefined in NCursesPanel. + + virtual int noutrefresh() { + return ::wnoutrefresh(w); + } + // Propagate the changes in this window to the virtual screen. This is + // redefined in NCursesPanel. + + // ------------------------------------------------------------------------- + // multiple window control + // ------------------------------------------------------------------------- + int overlay(NCursesWindow& win) { + return ::overlay(w, win.w); + } + // Overlay this window over win. + + int overwrite(NCursesWindow& win) { + return ::overwrite(w, win.w); + } + // Overwrite win with this window. + + int copywin( + NCursesWindow& win, + int sminrow, + int smincol, + int dminrow, + int dmincol, + int dmaxrow, + int dmaxcol, + bool overlaywin = TRUE) { + return ::copywin( + w, + win.w, + sminrow, + smincol, + dminrow, + dmincol, + dmaxrow, + dmaxcol, + static_cast(overlaywin ? 1 : 0)); + } +// Overlay or overwrite the rectangle in win given by dminrow,dmincol, +// dmaxrow,dmaxcol with the rectangle in this window beginning at +// sminrow,smincol. + +// ------------------------------------------------------------------------- +// Extended functions +// ------------------------------------------------------------------------- +#if defined(NCURSES_EXT_FUNCS) && (NCURSES_EXT_FUNCS != 0) + int wresize(int newLines, int newColumns) { + return ::wresize(w, newLines, newColumns); + } +#endif + + // ------------------------------------------------------------------------- + // Mouse related + // ------------------------------------------------------------------------- + bool has_mouse() const; + // Return TRUE if terminal supports a mouse, FALSE otherwise + + // ------------------------------------------------------------------------- + // traversal support + // ------------------------------------------------------------------------- + NCursesWindow* child() { + return subwins; + } + // Get the first child window. + + NCursesWindow* sibling() { + return sib; + } + // Get the next child of my parent. + + NCursesWindow* parent() { + return par; + } + // Get my parent. + + bool isDescendant(NCursesWindow& win); + // Return TRUE if win is a descendant of this. +}; + +// ------------------------------------------------------------------------- +// We leave this here for compatibility reasons. +// ------------------------------------------------------------------------- +class NCURSES_IMPEXP NCursesColorWindow : public NCursesWindow { + public: + NCursesColorWindow(WINDOW*& window) // useful only for stdscr + : NCursesWindow(window) { + useColors(); + } + + NCursesColorWindow( + int nlines, // number of lines + int ncols, // number of columns + int begin_y, // line origin + int begin_x) // col origin + : NCursesWindow(nlines, ncols, begin_y, begin_x) { + useColors(); + } + + NCursesColorWindow( + NCursesWindow& parentWin, // parent window + int nlines, // number of lines + int ncols, // number of columns + int begin_y, // absolute or relative + int begin_x, // origins: + char absrel = 'a') // if `a', by & bx are + : NCursesWindow( + parentWin, + nlines, + ncols, // absolute screen pos, + begin_y, + begin_x, // else if `r', they are + absrel) { // relative to par origin + useColors(); + } +}; + +// These enum definitions really belong inside the NCursesPad class, but only +// recent compilers support that feature. + +typedef enum { + REQ_PAD_REFRESH = KEY_MAX + 1, + REQ_PAD_UP, + REQ_PAD_DOWN, + REQ_PAD_LEFT, + REQ_PAD_RIGHT, + REQ_PAD_EXIT +} Pad_Request; + +const Pad_Request PAD_LOW = REQ_PAD_REFRESH; // lowest op-code +const Pad_Request PAD_HIGH = REQ_PAD_EXIT; // highest op-code + +// ------------------------------------------------------------------------- +// Pad Support. We allow an association of a pad with a "real" window +// through which the pad may be viewed. +// ------------------------------------------------------------------------- +class NCURSES_IMPEXP NCursesPad : public NCursesWindow { + private: + NCursesWindow* viewWin; // the "viewport" window + NCursesWindow* viewSub; // the "viewport" subwindow + + int h_gridsize, v_gridsize; + + protected: + int min_row, min_col; // top left row/col of the pads display area + + NCursesWindow* Win(void) const { + // Get the window into which the pad should be copied (if any) + return (viewSub ? viewSub : (viewWin ? viewWin : 0)); + } + + NCursesWindow* getWindow(void) const { + return viewWin; + } + + NCursesWindow* getSubWindow(void) const { + return viewSub; + } + + virtual int driver(int key); // Virtualize keystroke key + // The driver translates the keystroke c into an Pad_Request + + virtual void OnUnknownOperation(int pad_req) { + (void)pad_req; + ::beep(); + } + // This is called if the driver returns an unknown op-code + + virtual void OnNavigationError(int pad_req) { + (void)pad_req; + ::beep(); + } + // This is called if a navigation request couldn't be satisfied + + virtual void OnOperation(int pad_req) { + (void)pad_req; + }; + // OnOperation is called if a Pad_Operation was executed and just before + // the refresh() operation is done. + + public: + NCursesPad(int nlines, int ncols); + // create a pad with the given size + + NCursesPad& operator=(const NCursesPad& rhs) { + if (this != &rhs) { + *this = rhs; + NCursesWindow::operator=(rhs); + } + return *this; + } + + NCursesPad(const NCursesPad& rhs) + : NCursesWindow(rhs), + viewWin(rhs.viewWin), + viewSub(rhs.viewSub), + h_gridsize(rhs.h_gridsize), + v_gridsize(rhs.v_gridsize), + min_row(rhs.min_row), + min_col(rhs.min_col) {} + + virtual ~NCursesPad() {} + + int echochar(const chtype ch) { + return ::pechochar(w, ch); + } + // Put the attributed character onto the pad and immediately do a + // prefresh(). + + int refresh(); + // If a viewport is defined the pad is displayed in this window, otherwise + // this is a noop. + + int refresh( + int pminrow, + int pmincol, + int sminrow, + int smincol, + int smaxrow, + int smaxcol) { + return ::prefresh(w, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol); + } + // The coordinates sminrow,smincol,smaxrow,smaxcol describe a rectangle + // on the screen. refresh copies a rectangle of this size beginning + // with top left corner pminrow,pmincol onto the screen and calls doupdate(). + + int noutrefresh(); + // If a viewport is defined the pad is displayed in this window, otherwise + // this is a noop. + + int noutrefresh( + int pminrow, + int pmincol, + int sminrow, + int smincol, + int smaxrow, + int smaxcol) { + return ::pnoutrefresh( + w, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol); + } + // Does the same as refresh() but without calling doupdate(). + + virtual void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1); + // Add the window "view" as viewing window to the pad. + + virtual void setSubWindow(NCursesWindow& sub); + // Use the subwindow "sub" of the viewport window for the actual viewing. + // The full viewport window is usually used to provide some decorations + // like frames, titles etc. + + virtual void operator()(void); + // Perform Pad's operation +}; + +// A FramedPad is constructed always with a viewport window. This viewport +// will be framed (by a box() command) and the interior of the box is the +// viewport subwindow. On the frame we display scrollbar sliders. +class NCURSES_IMPEXP NCursesFramedPad : public NCursesPad { + protected: + virtual void OnOperation(int pad_req); + + public: + NCursesFramedPad( + NCursesWindow& win, + int nlines, + int ncols, + int v_grid = 1, + int h_grid = 1) + : NCursesPad(nlines, ncols) { + NCursesPad::setWindow(win, v_grid, h_grid); + NCursesPad::setSubWindow(*(new NCursesWindow(win))); + } + // Construct the FramedPad with the given Window win as viewport. + + virtual ~NCursesFramedPad() { + delete getSubWindow(); + } + + void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1) { + (void)view; + (void)v_grid; + (void)h_grid; + err_handler("Operation not allowed"); + } + // Disable this call; the viewport is already defined + + void setSubWindow(NCursesWindow& sub) { + (void)sub; + err_handler("Operation not allowed"); + } + // Disable this call; the viewport subwindow is already defined +}; + +#endif /* NCURSES_CURSESW_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/cursslk.h b/src_cpp/elfgames/tasks/elf2codingenv/include/cursslk.h new file mode 100644 index 0000000..204c7c6 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/cursslk.h @@ -0,0 +1,232 @@ +// * this is for making emacs happy: -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1997 * + ****************************************************************************/ + +// $Id: cursslk.h,v 1.13 2005/05/28 21:58:18 tom Exp $ + +#ifndef NCURSES_CURSSLK_H_incl +#define NCURSES_CURSSLK_H_incl + +#include + +class NCURSES_IMPEXP Soft_Label_Key_Set { + public: + // This inner class represents the attributes of a Soft Label Key (SLK) + class NCURSES_IMPEXP Soft_Label_Key { + friend class Soft_Label_Key_Set; + + public: + typedef enum { Left = 0, Center = 1, Right = 2 } Justification; + + private: + char* label; // The Text of the Label + Justification format; // The Justification + int num; // The number of the Label + + Soft_Label_Key() : label(NULL), format(Left), num(-1) {} + + virtual ~Soft_Label_Key() { + delete[] label; + }; + + public: + // Set the text of the Label + Soft_Label_Key& operator=(char* text); + + // Set the Justification of the Label + Soft_Label_Key& operator=(Justification just) { + format = just; + return *this; + } + + // Retrieve the text of the label + inline char* operator()(void) const { + return label; + } + + Soft_Label_Key& operator=(const Soft_Label_Key& rhs) { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + Soft_Label_Key(const Soft_Label_Key& rhs) + : label(NULL), format(rhs.format), num(rhs.num) { + *this = rhs.label; + } + }; + + public: + typedef enum { + None = -1, + Three_Two_Three = 0, + Four_Four = 1, + PC_Style = 2, + PC_Style_With_Index = 3 + } Label_Layout; + + private: + static long NCURSES_IMPEXP count; // Number of Key Sets + static Label_Layout NCURSES_IMPEXP format; // Layout of the Key Sets + static int NCURSES_IMPEXP num_labels; // Number Of Labels in Key Sets + bool NCURSES_IMPEXP b_attrInit; // Are attributes initialized + + Soft_Label_Key* slk_array; // The array of SLK's + + // Init the Key Set + void init(); + + // Activate or Deactivate Label# i, Label counting starts with 1! + void activate_label(int i, bool bf = TRUE); + + // Activate of Deactivate all Labels + void activate_labels(bool bf); + + protected: + inline void Error(const char* msg) const THROWS(NCursesException) { + THROW(new NCursesException(msg)); + } + + // Remove SLK's from screen + void clear() { + if (ERR == ::slk_clear()) + Error("slk_clear"); + } + + // Restore them + void restore() { + if (ERR == ::slk_restore()) + Error("slk_restore"); + } + + public: + // Construct a Key Set, use the most comfortable layout as default. + // You must create a Soft_Label_Key_Set before you create any object of + // the NCursesWindow, NCursesPanel or derived classes. (Actually before + // ::initscr() is called). + Soft_Label_Key_Set(Label_Layout fmt); + + // This constructor assumes, that you already constructed a Key Set + // with a layout by the constructor above. This layout will be reused. + NCURSES_IMPEXP Soft_Label_Key_Set(); + + Soft_Label_Key_Set& operator=(const Soft_Label_Key_Set& rhs) { + if (this != &rhs) { + *this = rhs; + init(); // allocate a new slk_array[] + } + return *this; + } + + Soft_Label_Key_Set(const Soft_Label_Key_Set& rhs) + : b_attrInit(rhs.b_attrInit), slk_array(NULL) { + init(); // allocate a new slk_array[] + } + + virtual ~Soft_Label_Key_Set(); + + // Get Label# i. Label counting starts with 1! + NCURSES_IMPEXP Soft_Label_Key& operator[](int i); + + // Retrieve number of Labels + inline int labels() const { + return num_labels; + } + + // Refresh the SLK portion of the screen + inline void refresh() { + if (ERR == ::slk_refresh()) + Error("slk_refresh"); + } + + // Mark the SLK portion of the screen for refresh, defer actual refresh + // until next update call. + inline void noutrefresh() { + if (ERR == ::slk_noutrefresh()) + Error("slk_noutrefresh"); + } + + // Mark the whole SLK portion of the screen as modified + inline void touch() { + if (ERR == ::slk_touch()) + Error("slk_touch"); + } + + // Activate Label# i + inline void show(int i) { + activate_label(i, FALSE); + activate_label(i, TRUE); + } + + // Hide Label# i + inline void hide(int i) { + activate_label(i, FALSE); + } + + // Show all Labels + inline void show() { + activate_labels(FALSE); + activate_labels(TRUE); + } + + // Hide all Labels + inline void hide() { + activate_labels(FALSE); + } + + inline void attron(attr_t attrs) { + if (ERR == ::slk_attron(attrs)) + Error("slk_attron"); + } + + inline void attroff(attr_t attrs) { + if (ERR == ::slk_attroff(attrs)) + Error("slk_attroff"); + } + + inline void attrset(attr_t attrs) { + if (ERR == ::slk_attrset(attrs)) + Error("slk_attrset"); + } + + inline void color(short color_pair_number) { + if (ERR == ::slk_color(color_pair_number)) + Error("slk_color"); + } + + inline attr_t attr() const { + return ::slk_attr(); + } +}; + +#endif /* NCURSES_CURSSLK_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/default.h b/src_cpp/elfgames/tasks/elf2codingenv/include/default.h new file mode 100644 index 0000000..50f3349 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/default.h @@ -0,0 +1,27 @@ +/* + * default.h -- + * + * This file defines the defaults for all options for all of + * the Tk widgets. + * + * Copyright (c) 1991-1994 The Regents of the University of California. + * Copyright (c) 1994 Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _DEFAULT +#define _DEFAULT + +#ifdef _WIN32 +#include "tkWinDefault.h" +#else +#if defined(MAC_OSX_TK) +#include "tkMacOSXDefault.h" +#else +#include "tkUnixDefault.h" +#endif +#endif + +#endif /* _DEFAULT */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/editline/readline.h b/src_cpp/elfgames/tasks/elf2codingenv/include/editline/readline.h new file mode 100644 index 0000000..b0ba650 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/editline/readline.h @@ -0,0 +1,224 @@ +/* $NetBSD: readline.h,v 1.41 2016/10/28 18:32:35 christos Exp $ */ + +/*- + * Copyright (c) 1997 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jaromir Dolecek. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ +#ifndef _READLINE_H_ +#define _READLINE_H_ + +#include +#include + +/* list of readline stuff supported by editline library's readline wrapper */ + +/* typedefs */ +typedef int Function(const char*, int); +typedef void VFunction(void); +typedef void rl_vcpfunc_t(char*); +typedef char** rl_completion_func_t(const char*, int, int); +typedef char* rl_compentry_func_t(const char*, int); +typedef int rl_command_func_t(int, int); + +/* only supports length */ +typedef struct { int length; } HISTORY_STATE; + +typedef void* histdata_t; + +typedef struct _hist_entry { + const char* line; + histdata_t data; +} HIST_ENTRY; + +typedef struct _keymap_entry { + char type; +#define ISFUNC 0 +#define ISKMAP 1 +#define ISMACR 2 + Function* function; +} KEYMAP_ENTRY; + +#define KEYMAP_SIZE 256 + +typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE]; +typedef KEYMAP_ENTRY* Keymap; + +#define control_character_threshold 0x20 +#define control_character_bit 0x40 + +#ifndef CTRL +#include +#if !defined(__sun) && !defined(__hpux) && !defined(_AIX) +#include +#endif +#ifndef CTRL +#define CTRL(c) ((c)&037) +#endif +#endif +#ifndef UNCTRL +#define UNCTRL(c) (((c) - 'a' + 'A') | control_character_bit) +#endif + +#define RUBOUT 0x7f +#define ABORT_CHAR CTRL('G') +#define RL_READLINE_VERSION 0x0402 +#define RL_PROMPT_START_IGNORE '\1' +#define RL_PROMPT_END_IGNORE '\2' + +/* global variables used by readline enabled applications */ +#ifdef __cplusplus +extern "C" { +#endif +extern const char* rl_library_version; +extern int rl_readline_version; +extern char* rl_readline_name; +extern FILE* rl_instream; +extern FILE* rl_outstream; +extern char* rl_line_buffer; +extern int rl_point, rl_end; +extern int history_base, history_length; +extern int max_input_history; +extern char* rl_basic_word_break_characters; +extern char* rl_completer_word_break_characters; +extern char* rl_completer_quote_characters; +extern rl_compentry_func_t* rl_completion_entry_function; +extern char* (*rl_completion_word_break_hook)(void); +extern rl_completion_func_t* rl_attempted_completion_function; +extern int rl_attempted_completion_over; +extern int rl_completion_type; +extern int rl_completion_query_items; +extern char* rl_special_prefixes; +extern int rl_completion_append_character; +extern int rl_inhibit_completion; +extern Function* rl_pre_input_hook; +extern Function* rl_startup_hook; +extern char* rl_terminal_name; +extern int rl_already_prompted; +extern char* rl_prompt; +extern int rl_done; +/* + * The following is not implemented + */ +extern int rl_catch_signals; +extern int rl_catch_sigwinch; +extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, + emacs_ctlx_keymap; +extern int rl_filename_completion_desired; +extern int rl_ignore_completion_duplicates; +extern int (*rl_getc_function)(FILE*); +extern VFunction* rl_redisplay_function; +extern VFunction* rl_completion_display_matches_hook; +extern VFunction* rl_prep_term_function; +extern VFunction* rl_deprep_term_function; +extern int readline_echoing_p; +extern int _rl_print_completions_horizontally; + +/* supported functions */ +char* readline(const char*); +int rl_initialize(void); + +void using_history(void); +int add_history(const char*); +void clear_history(void); +void stifle_history(int); +int unstifle_history(void); +int history_is_stifled(void); +int where_history(void); +HIST_ENTRY* current_history(void); +HIST_ENTRY* history_get(int); +HIST_ENTRY* remove_history(int); +HIST_ENTRY* replace_history_entry(int, const char*, histdata_t); +int history_total_bytes(void); +int history_set_pos(int); +HIST_ENTRY* previous_history(void); +HIST_ENTRY* next_history(void); +HIST_ENTRY** history_list(void); +int history_search(const char*, int); +int history_search_prefix(const char*, int); +int history_search_pos(const char*, int, int); +int read_history(const char*); +int write_history(const char*); +int history_truncate_file(const char*, int); +int history_expand(char*, char**); +char** history_tokenize(const char*); +const char* get_history_event(const char*, int*, int); +char* history_arg_extract(int, int, const char*); + +char* tilde_expand(char*); +char* filename_completion_function(const char*, int); +char* username_completion_function(const char*, int); +int rl_complete(int, int); +int rl_read_key(void); +char** completion_matches(const char*, rl_compentry_func_t*); +void rl_display_match_list(char**, int, int); + +int rl_insert(int, int); +int rl_insert_text(const char*); +void rl_reset_terminal(const char*); +int rl_bind_key(int, rl_command_func_t*); +int rl_newline(int, int); +void rl_callback_read_char(void); +void rl_callback_handler_install(const char*, rl_vcpfunc_t*); +void rl_callback_handler_remove(void); +void rl_redisplay(void); +int rl_get_previous_history(int, int); +void rl_prep_terminal(int); +void rl_deprep_terminal(void); +int rl_read_init_file(const char*); +int rl_parse_and_bind(const char*); +int rl_variable_bind(const char*, const char*); +void rl_stuff_char(int); +int rl_add_defun(const char*, rl_command_func_t*, int); +HISTORY_STATE* history_get_history_state(void); +void rl_get_screen_size(int*, int*); +void rl_set_screen_size(int, int); +char* rl_filename_completion_function(const char*, int); +int _rl_abort_internal(void); +int _rl_qsort_string_compare(char**, char**); +char** rl_completion_matches(const char*, rl_compentry_func_t*); +void rl_forced_update_display(void); +int rl_set_prompt(const char*); +int rl_on_new_line(void); + +/* + * The following are not implemented + */ +int rl_kill_text(int, int); +Keymap rl_get_keymap(void); +void rl_set_keymap(Keymap); +Keymap rl_make_bare_keymap(void); +int rl_generic_bind(int, const char*, const char*, Keymap); +int rl_bind_key_in_map(int, rl_command_func_t*, Keymap); +void rl_cleanup_after_signal(void); +void rl_free_line_state(void); +int rl_set_keyboard_input_timeout(int); + +#ifdef __cplusplus +} +#endif + +#endif /* _READLINE_H_ */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/eti.h b/src_cpp/elfgames/tasks/elf2codingenv/include/eti.h new file mode 100644 index 0000000..3e44a9f --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/eti.h @@ -0,0 +1,54 @@ +/**************************************************************************** + * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1995,1997 * + ****************************************************************************/ + +/* $Id: eti.h,v 1.8 2003/10/25 15:24:29 tom Exp $ */ + +#ifndef NCURSES_ETI_H_incl +#define NCURSES_ETI_H_incl 1 + +#define E_OK (0) +#define E_SYSTEM_ERROR (-1) +#define E_BAD_ARGUMENT (-2) +#define E_POSTED (-3) +#define E_CONNECTED (-4) +#define E_BAD_STATE (-5) +#define E_NO_ROOM (-6) +#define E_NOT_POSTED (-7) +#define E_UNKNOWN_COMMAND (-8) +#define E_NO_MATCH (-9) +#define E_NOT_SELECTABLE (-10) +#define E_NOT_CONNECTED (-11) +#define E_REQUEST_DENIED (-12) +#define E_INVALID_FIELD (-13) +#define E_CURRENT (-14) + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/etip.h b/src_cpp/elfgames/tasks/elf2codingenv/include/etip.h new file mode 100644 index 0000000..fdb98a0 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/etip.h @@ -0,0 +1,333 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998-2012,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1997 * + ****************************************************************************/ + +// $Id: etip.h.in,v 1.41 2017/06/24 21:57:16 tom Exp $ + +#ifndef NCURSES_ETIP_H_incl +#define NCURSES_ETIP_H_incl 1 + +// These are substituted at configure/build time +#ifndef HAVE_BUILTIN_H +#define HAVE_BUILTIN_H 0 +#endif + +#ifndef HAVE_GXX_BUILTIN_H +#define HAVE_GXX_BUILTIN_H 0 +#endif + +#ifndef HAVE_GPP_BUILTIN_H +#define HAVE_GPP_BUILTIN_H 0 +#endif + +#ifndef HAVE_IOSTREAM +#define HAVE_IOSTREAM 1 +#endif + +#ifndef HAVE_TYPEINFO +#define HAVE_TYPEINFO 1 +#endif + +#ifndef HAVE_VALUES_H +#define HAVE_VALUES_H 0 +#endif + +#ifndef ETIP_NEEDS_MATH_H +#define ETIP_NEEDS_MATH_H 0 +#endif + +#ifndef ETIP_NEEDS_MATH_EXCEPTION +#define ETIP_NEEDS_MATH_EXCEPTION 0 +#endif + +#ifndef CPP_HAS_PARAM_INIT +#define CPP_HAS_PARAM_INIT 0 +#endif + +#ifndef CPP_HAS_STATIC_CAST +#define CPP_HAS_STATIC_CAST 1 +#endif + +#ifndef IOSTREAM_NAMESPACE +#define IOSTREAM_NAMESPACE 1 +#endif + +#ifdef __GNUG__ +#if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8)) +#if HAVE_TYPEINFO +#include +#endif +#endif +#endif + +#if defined(__GNUG__) +#if HAVE_BUILTIN_H || HAVE_GXX_BUILTIN_H || HAVE_GPP_BUILTIN_H +#if ETIP_NEEDS_MATH_H +#if ETIP_NEEDS_MATH_EXCEPTION +#undef exception +#define exception math_exception +#endif +#include +#endif +#undef exception +#define exception builtin_exception +#if HAVE_GPP_BUILTIN_H +#include +#elif HAVE_GXX_BUILTIN_H +#include +#else +#include +#endif +#undef exception +#endif +#elif defined(__SUNPRO_CC) +#include +#endif + +#include + +extern "C" { +#if HAVE_VALUES_H +#include +#endif + +#include +#include +#include +} + +// Language features +#if CPP_HAS_PARAM_INIT +#define NCURSES_PARAM_INIT(value) = value +#else +#define NCURSES_PARAM_INIT(value) /*nothing*/ +#endif + +#if CPP_HAS_STATIC_CAST +#define STATIC_CAST(s) static_cast +#else +#define STATIC_CAST(s) (s) +#endif + +// Forward Declarations +class NCURSES_IMPEXP NCursesPanel; +class NCURSES_IMPEXP NCursesMenu; +class NCURSES_IMPEXP NCursesForm; + +class NCURSES_IMPEXP NCursesException { + public: + const char* message; + int errorno; + + NCursesException(const char* msg, int err) : message(msg), errorno(err){}; + + NCursesException(const char* msg) : message(msg), errorno(E_SYSTEM_ERROR){}; + + NCursesException& operator=(const NCursesException& rhs) { + errorno = rhs.errorno; + return *this; + } + + NCursesException(const NCursesException& rhs) + : message(rhs.message), errorno(rhs.errorno) {} + + virtual const char* classname() const { + return "NCursesWindow"; + } + + virtual ~NCursesException() {} +}; + +class NCURSES_IMPEXP NCursesPanelException : public NCursesException { + public: + const NCursesPanel* p; + + NCursesPanelException(const char* msg, int err) + : NCursesException(msg, err), p(0){}; + + NCursesPanelException(const NCursesPanel* panel, const char* msg, int err) + : NCursesException(msg, err), p(panel){}; + + NCursesPanelException(int err) + : NCursesException("panel library error", err), p(0){}; + + NCursesPanelException(const NCursesPanel* panel, int err) + : NCursesException("panel library error", err), p(panel){}; + + NCursesPanelException& operator=(const NCursesPanelException& rhs) { + if (this != &rhs) { + NCursesException::operator=(rhs); + p = rhs.p; + } + return *this; + } + + NCursesPanelException(const NCursesPanelException& rhs) + : NCursesException(rhs), p(rhs.p) {} + + virtual const char* classname() const { + return "NCursesPanel"; + } + + virtual ~NCursesPanelException() {} +}; + +class NCURSES_IMPEXP NCursesMenuException : public NCursesException { + public: + const NCursesMenu* m; + + NCursesMenuException(const char* msg, int err) + : NCursesException(msg, err), m(0){}; + + NCursesMenuException(const NCursesMenu* menu, const char* msg, int err) + : NCursesException(msg, err), m(menu){}; + + NCursesMenuException(int err) + : NCursesException("menu library error", err), m(0){}; + + NCursesMenuException(const NCursesMenu* menu, int err) + : NCursesException("menu library error", err), m(menu){}; + + NCursesMenuException& operator=(const NCursesMenuException& rhs) { + if (this != &rhs) { + NCursesException::operator=(rhs); + m = rhs.m; + } + return *this; + } + + NCursesMenuException(const NCursesMenuException& rhs) + : NCursesException(rhs), m(rhs.m) {} + + virtual const char* classname() const { + return "NCursesMenu"; + } + + virtual ~NCursesMenuException() {} +}; + +class NCURSES_IMPEXP NCursesFormException : public NCursesException { + public: + const NCursesForm* f; + + NCursesFormException(const char* msg, int err) + : NCursesException(msg, err), f(0){}; + + NCursesFormException(const NCursesForm* form, const char* msg, int err) + : NCursesException(msg, err), f(form){}; + + NCursesFormException(int err) + : NCursesException("form library error", err), f(0){}; + + NCursesFormException(const NCursesForm* form, int err) + : NCursesException("form library error", err), f(form){}; + + NCursesFormException& operator=(const NCursesFormException& rhs) { + if (this != &rhs) { + NCursesException::operator=(rhs); + f = rhs.f; + } + return *this; + } + + NCursesFormException(const NCursesFormException& rhs) + : NCursesException(rhs), f(rhs.f) {} + + virtual const char* classname() const { + return "NCursesForm"; + } + + virtual ~NCursesFormException() {} +}; + +#if !( \ + (defined(__GNUG__) && defined(__EXCEPTIONS) && (__GNUG__ < 7)) || \ + defined(__SUNPRO_CC)) +#if HAVE_IOSTREAM +#include +#if IOSTREAM_NAMESPACE +using std::cerr; +using std::endl; +#endif +#else +#include +#endif +extern "C" void exit(int); +#endif + +inline void THROW(const NCursesException* e) { +#if defined(__GNUG__) && defined(__EXCEPTIONS) +#if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8)) + (*lib_error_handler)(e ? e->classname() : "", e ? e->message : ""); +#elif (__GNUG__ >= 7) + // g++ 7.0 warns about deprecation, but lacks the predefined symbols + ::endwin(); + std::cerr << "Found a problem - goodbye" << std::endl; + exit(EXIT_FAILURE); +#else +#define CPP_HAS_TRY_CATCH 1 +#endif +#elif defined(__SUNPRO_CC) +#if !defined(__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT < 5) + genericerror(1, ((e != 0) ? (char*)(e->message) : "")); +#else +#define CPP_HAS_TRY_CATCH 1 +#endif +#else + if (e) + cerr << e->message << endl; + exit(0); +#endif + +#ifndef CPP_HAS_TRY_CATCH +#define CPP_HAS_TRY_CATCH 0 +#define NCURSES_CPP_TRY /* nothing */ +#define NCURSES_CPP_CATCH(e) if (false) +#define THROWS(s) /* nothing */ +#define THROW2(s, t) /* nothing */ +#elif CPP_HAS_TRY_CATCH + throw * e; +#define NCURSES_CPP_TRY try +#define NCURSES_CPP_CATCH(e) catch (e) +#if defined(__cpp_noexcept_function_type) && \ + (__cpp_noexcept_function_type >= 201510) +// C++17 deprecates the usage of throw(). +#define THROWS(s) /* nothing */ +#define THROW2(s, t) /* nothing */ +#else +#define THROWS(s) throw(s) +#define THROW2(s, t) throw(s, t) +#endif +#endif +} + +#endif /* NCURSES_ETIP_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/fakemysql.h b/src_cpp/elfgames/tasks/elf2codingenv/include/fakemysql.h new file mode 100644 index 0000000..24cfe0b --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/fakemysql.h @@ -0,0 +1,337 @@ +/* + * fakemysql.h -- + * + * Fake definitions of the MySQL API sufficient to build tdbc::mysql + * without having an MySQL installation on the build system. This file + * comprises only data type, constant and function definitions. + * + * The programmers of this file believe that it contains material not + * subject to copyright under the doctrines of scenes a faire and + * of merger of idea and expression. Accordingly, this file is in the + * public domain. + * + *----------------------------------------------------------------------------- + */ + +#ifndef FAKEMYSQL_H_INCLUDED +#define FAKEMYSQL_H_INCLUDED + +#include + +#ifndef MODULE_SCOPE +#define MODULE_SCOPE extern +#endif + +MODULE_SCOPE Tcl_LoadHandle MysqlInitStubs(Tcl_Interp*); + +#ifdef _WIN32 +#define STDCALL __stdcall +#else +#define STDCALL /* nothing */ +#endif + +enum enum_field_types { + MYSQL_TYPE_DECIMAL = 0, + MYSQL_TYPE_TINY = 1, + MYSQL_TYPE_SHORT = 2, + MYSQL_TYPE_LONG = 3, + MYSQL_TYPE_FLOAT = 4, + MYSQL_TYPE_DOUBLE = 5, + MYSQL_TYPE_NULL = 6, + MYSQL_TYPE_TIMESTAMP = 7, + MYSQL_TYPE_LONGLONG = 8, + MYSQL_TYPE_INT24 = 9, + MYSQL_TYPE_DATE = 10, + MYSQL_TYPE_TIME = 11, + MYSQL_TYPE_DATETIME = 12, + MYSQL_TYPE_YEAR = 13, + MYSQL_TYPE_NEWDATE = 14, + MYSQL_TYPE_VARCHAR = 15, + MYSQL_TYPE_BIT = 16, + MYSQL_TYPE_NEWDECIMAL = 246, + MYSQL_TYPE_ENUM = 247, + MYSQL_TYPE_SET = 248, + MYSQL_TYPE_TINY_BLOB = 249, + MYSQL_TYPE_MEDIUM_BLOB = 250, + MYSQL_TYPE_LONG_BLOB = 251, + MYSQL_TYPE_BLOB = 252, + MYSQL_TYPE_VAR_STRING = 253, + MYSQL_TYPE_STRING = 254, + MYSQL_TYPE_GEOMETRY = 255 +}; + +enum mysql_option { + MYSQL_SET_CHARSET_NAME = 7, +}; + +enum mysql_status { + MYSQL_STATUS_READY = 0, +}; + +#define CLIENT_COMPRESS 32 +#define CLIENT_INTERACTIVE 1024 +#define MYSQL_DATA_TRUNCATED 101 +#define MYSQL_ERRMSG_SIZE 512 +#define MYSQL_NO_DATA 100 +#define SCRAMBLE_LENGTH 20 +#define SQLSTATE_LENGTH 5 + +typedef struct st_list LIST; +typedef struct st_mem_root MEM_ROOT; +typedef struct st_mysql MYSQL; +typedef struct st_mysql_bind MYSQL_BIND; +typedef struct st_mysql_field MYSQL_FIELD; +typedef struct st_mysql_res MYSQL_RES; +typedef char** MYSQL_ROW; +typedef struct st_mysql_stmt MYSQL_STMT; +typedef char my_bool; +#ifndef Socket_defined +typedef int my_socket; +#define INVALID_SOCKET -1 +#endif +typedef Tcl_WideUInt my_ulonglong; +typedef struct st_net NET; +typedef struct st_used_mem USED_MEM; +typedef struct st_vio Vio; + +struct st_mem_root { + USED_MEM* free; + USED_MEM* used; + USED_MEM* pre_alloc; + size_t min_malloc; + size_t block_size; + unsigned int block_num; + unsigned int first_block_usage; + void (*error_handler)(void); +}; + +struct st_mysql_options { + unsigned int connect_timeout; + unsigned int read_timeout; + unsigned int write_timeout; + unsigned int port; + unsigned int protocol; + unsigned long client_flag; + char* host; + char* user; + char* password; + char* unix_socket; + char* db; + struct st_dynamic_array* init_commands; + char* my_cnf_file; + char* my_cnf_group; + char* charset_dir; + char* charset_name; + char* ssl_key; + char* ssl_cert; + char* ssl_ca; + char* ssl_capath; + char* ssl_cipher; + char* shared_memory_base_name; + unsigned long max_allowed_packet; + my_bool use_ssl; + my_bool compress, named_pipe; + my_bool rpl_probe; + my_bool rpl_parse; + my_bool no_master_reads; +#if !defined(CHECK_EMBEDDED_DIFFERENCES) || defined(EMBEDDED_LIBRARY) + my_bool separate_thread; +#endif + enum mysql_option methods_to_use; + char* client_ip; + my_bool secure_auth; + my_bool report_data_truncation; + int (*local_infile_init)(void**, const char*, void*); + int (*local_infile_read)(void*, char*, unsigned int); + void (*local_infile_end)(void*); + int (*local_infile_error)(void*, char*, unsigned int); + void* local_infile_userdata; + void* extension; +}; + +struct st_net { +#if !defined(CHECK_EMBEDDED_DIFFERENCES) || !defined(EMBEDDED_LIBRARY) + Vio* vio; + unsigned char* buff; + unsigned char* buff_end; + unsigned char* write_pos; + unsigned char* read_pos; + my_socket fd; + unsigned long remain_in_buf; + unsigned long length; + unsigned long buf_length; + unsigned long where_b; + unsigned long max_packet; + unsigned long max_packet_size; + unsigned int pkt_nr; + unsigned int compress_pkt_nr; + unsigned int write_timeout; + unsigned int read_timeout; + unsigned int retry_count; + int fcntl; + unsigned int* return_status; + unsigned char reading_or_writing; + char save_char; + my_bool unused0; + my_bool unused; + my_bool compress; + my_bool unused1; +#endif + unsigned char* query_cache_query; + unsigned int last_errno; + unsigned char error; + my_bool unused2; + my_bool return_errno; + char last_error[MYSQL_ERRMSG_SIZE]; + char sqlstate[SQLSTATE_LENGTH + 1]; + void* extension; +#if defined(MYSQL_SERVER) && !defined(EMBEDDED_LIBRARY) + my_bool skip_big_packet; +#endif +}; + +/* + * st_mysql differs between 5.0 and 5.1, but the 5.0 version is a + * strict subset, we don't use any of the 5.1 fields, and we don't + * ever allocate the structure ourselves. + */ + +struct st_mysql { + NET net; + unsigned char* connector_fd; + char* host; + char* user; + char* passwd; + char* unix_socket; + char* server_version; + char* host_info; + char* info; + char* db; + struct charset_info_st* charset; + MYSQL_FIELD* fields; + MEM_ROOT field_alloc; + my_ulonglong affected_rows; + my_ulonglong insert_id; + my_ulonglong extra_info; + unsigned long thread_id; + unsigned long packet_length; + unsigned int port; + unsigned long client_flag; + unsigned long server_capabilities; + unsigned int protocol_version; + unsigned int field_count; + unsigned int server_status; + unsigned int server_language; + unsigned int warning_count; + struct st_mysql_options options; + enum mysql_status status; + my_bool free_me; + my_bool reconnect; + char scramble[SCRAMBLE_LENGTH + 1]; + my_bool rpl_pivot; + struct st_mysql* master; + struct st_mysql* next_slave; + struct st_mysql* last_used_slave; + struct st_mysql* last_used_con; + LIST* stmts; + const struct st_mysql_methods* methods; + void* thd; + my_bool* unbuffered_fetch_owner; + char* info_buffer; +}; + +/* + * There are different version of the MYSQL_BIND structure before and after + * MySQL 5.1. We go after the fields of the structure using accessor functions + * so that the code in this file is compatible with both versions. + */ + +struct st_mysql_bind_51 { /* Post-5.1 */ + unsigned long* length; + my_bool* is_null; + void* buffer; + my_bool* error; + unsigned char* row_ptr; + void (*store_param_func)(NET* net, MYSQL_BIND* param); + void (*fetch_result)(MYSQL_BIND*, MYSQL_FIELD*, unsigned char**); + void (*skip_result)(MYSQL_BIND*, MYSQL_FIELD*, unsigned char**); + unsigned long buffer_length; + unsigned long offset; + unsigned long length_value; + unsigned int param_number; + unsigned int pack_length; + enum enum_field_types buffer_type; + my_bool error_value; + my_bool is_unsigned; + my_bool long_data_used; + my_bool is_null_value; + void* extension; +}; + +struct st_mysql_bind_50 { /* Pre-5.1 */ + unsigned long* length; + my_bool* is_null; + void* buffer; + my_bool* error; + enum enum_field_types buffer_type; + unsigned long buffer_length; + unsigned char* row_ptr; + unsigned long offset; + unsigned long length_value; + unsigned int param_number; + unsigned int pack_length; + my_bool error_value; + my_bool is_unsigned; + my_bool long_data_used; + my_bool is_null_value; + void (*store_param_func)(NET* net, MYSQL_BIND* param); + void (*fetch_result)(MYSQL_BIND*, MYSQL_FIELD*, unsigned char**); + void (*skip_result)(MYSQL_BIND*, MYSQL_FIELD*, unsigned char**); +}; + +/* + * There are also different versions of the MYSQL_FIELD structure; fortunately, + * the 5.1 version is a strict extension of the 5.0 version. + */ + +struct st_mysql_field { + char* name; + char* org_name; + char* table; + char* org_table; + char* db; + char* catalog; + char* def; + unsigned long length; + unsigned long max_length; + unsigned int name_length; + unsigned int org_name_length; + unsigned int table_length; + unsigned int org_table_length; + unsigned int db_length; + unsigned int catalog_length; + unsigned int def_length; + unsigned int flags; + unsigned int decimals; + unsigned int charsetnr; + enum enum_field_types type; +}; +struct st_mysql_field_50 { + struct st_mysql_field field; +}; +struct st_mysql_field_51 { + struct st_mysql_field field; + void* extension; +}; +#define NOT_NULL_FLAG 1 + +#define IS_NUM(t) \ + ((t) <= MYSQL_TYPE_INT24 || (t) == MYSQL_TYPE_YEAR || \ + (t) == MYSQL_TYPE_NEWDECIMAL) + +#define mysql_library_init mysql_server_init +#define mysql_library_end mysql_server_end + +#include "mysqlStubs.h" + +#endif /* not FAKEMYSQL_H_INCLUDED */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/fakepq.h b/src_cpp/elfgames/tasks/elf2codingenv/include/fakepq.h new file mode 100644 index 0000000..a405896 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/fakepq.h @@ -0,0 +1,46 @@ +/* + * fakepq.h -- + * + * Minimal replacement for 'pq-fe.h' in the PostgreSQL client + * without having a PostgreSQL installation on the build system. + * This file comprises only data type, constant and function definitions. + * + * The programmers of this file believe that it contains material not + * subject to copyright under the doctrines of scenes a faire and + * of merger of idea and expression. Accordingly, this file is in the + * public domain. + * + *----------------------------------------------------------------------------- + */ + +#ifndef FAKEPQ_H_INCLUDED +#define FAKEPQ_H_INCLUDED + +#ifndef MODULE_SCOPE +#define MODULE_SCOPE extern +#endif + +MODULE_SCOPE Tcl_LoadHandle PostgresqlInitStubs(Tcl_Interp*); + +typedef enum { + CONNECTION_OK = 0, +} ConnStatusType; +typedef enum { + PGRES_EMPTY_QUERY = 0, + PGRES_BAD_RESPONSE = 5, + PGRES_NONFATAL_ERROR = 6, + PGRES_FATAL_ERROR = 7, +} ExecStatusType; +typedef unsigned int Oid; +typedef struct pg_conn PGconn; +typedef struct pg_result PGresult; +typedef void (*PQnoticeProcessor)(void*, const PGresult*); + +#define PG_DIAG_SQLSTATE 'C' +#define PG_DIAG_MESSAGE_PRIMARY 'M' + +#include "pqStubs.h" + +MODULE_SCOPE const pqStubDefs* pqStubs; + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/fakesql.h b/src_cpp/elfgames/tasks/elf2codingenv/include/fakesql.h new file mode 100644 index 0000000..dabf0fd --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/fakesql.h @@ -0,0 +1,276 @@ +/* + * fakesql.h -- + * + * Include file that defines the subset of SQL/CLI that TDBC + * uses, so that tdbc::odbc can build without an explicit ODBC + * dependency. It comprises only data type, constant and + * function declarations. + * + * The programmers of this file believe that it contains material not + * subject to copyright under the doctrines of scenes a faire and + * of merger of idea and expression. Accordingly, this file is in the + * public domain. + * + *----------------------------------------------------------------------------- + */ + +#ifndef FAKESQL_H_INCLUDED +#define FAKESQL_H_INCLUDED + +#include + +#ifndef MODULE_SCOPE +#define MODULE_SCOPE extern +#endif + +/* Limits */ + +#define SQL_MAX_DSN_LENGTH 32 +#define SQL_MAX_MESSAGE_LENGTH 512 + +/* Fundamental data types */ + +#ifndef _WIN32 +typedef int BOOL; +typedef unsigned int DWORD; +typedef void* HANDLE; +typedef HANDLE HWND; +typedef unsigned short WCHAR; +typedef char* LPSTR; +typedef WCHAR* LPWSTR; +typedef const char* LPCSTR; +typedef const WCHAR* LPCWSTR; +typedef unsigned short WORD; +#endif +typedef void* PVOID; +typedef short RETCODE; +typedef long SDWORD; +typedef short SWORD; +typedef unsigned short USHORT; +typedef USHORT UWORD; + +/* ODBC data types */ + +typedef Tcl_WideInt SQLBIGINT; +typedef unsigned char SQLCHAR; +typedef double SQLDOUBLE; +typedef void* SQLHANDLE; +typedef SDWORD SQLINTEGER; +typedef PVOID SQLPOINTER; +typedef SWORD SQLSMALLINT; +typedef Tcl_WideUInt SQLUBIGINT; +typedef unsigned char SQLUCHAR; +typedef unsigned int SQLUINTEGER; +typedef UWORD SQLUSMALLINT; +typedef WCHAR SQLWCHAR; + +typedef SQLSMALLINT SQLRETURN; + +/* TODO - Check how the SQLLEN and SQLULEN types are handled on + * 64-bit Unix. */ + +#if defined(__WIN64) +typedef Tcl_WideInt SQLLEN; +typedef Tcl_WideUInt SQLULEN; +#else +typedef SQLINTEGER SQLLEN; +typedef SQLUINTEGER SQLULEN; +#endif + +/* Handle types */ + +typedef SQLHANDLE SQLHENV; +typedef SQLHANDLE SQLHDBC; +typedef SQLHANDLE SQLHSTMT; +typedef HWND SQLHWND; + +#define SQL_HANDLE_DBC 2 +#define SQL_HANDLE_ENV 1 +#define SQL_HANDLE_STMT 3 + +/* Null handles */ + +#define SQL_NULL_HANDLE ((SQLHANDLE)0) +#define SQL_NULL_HENV ((SQLHENV)0) +#define SQL_NULL_HSTMT ((SQLHSTMT)0) + +/* SQL data types */ + +enum _SQL_DATATYPE { + SQL_BIGINT = -5, + SQL_BINARY = -2, + SQL_BIT = -7, + SQL_CHAR = 1, + SQL_DATE = 9, + SQL_DECIMAL = 3, + SQL_DOUBLE = 8, + SQL_FLOAT = 6, + SQL_INTEGER = 4, + SQL_LONGVARBINARY = -4, + SQL_LONGVARCHAR = -1, + SQL_NUMERIC = 2, + SQL_REAL = 7, + SQL_SMALLINT = 5, + SQL_TIME = 10, + SQL_TIMESTAMP = 11, + SQL_TINYINT = -6, + SQL_VARBINARY = -3, + SQL_VARCHAR = 12, + SQL_WCHAR = -8, + SQL_WVARCHAR = -9, + SQL_WLONGVARCHAR = -10, +}; + +/* C data types */ + +#define SQL_SIGNED_OFFSET (-20) + +#define SQL_C_BINARY SQL_BINARY +#define SQL_C_CHAR SQL_CHAR +#define SQL_C_DOUBLE SQL_DOUBLE +#define SQL_C_LONG SQL_INTEGER +#define SQL_C_SBIGINT SQL_BIGINT + SQL_SIGNED_OFFSET +#define SQL_C_SLONG SQL_INTEGER + SQL_SIGNED_OFFSET +#define SQL_C_WCHAR SQL_WCHAR + +/* Parameter transmission diretions */ + +#define SQL_PARAM_INPUT 1 + +/* Status returns */ + +#define SQL_ERROR (-1) +#define SQL_NO_DATA 100 +#define SQL_NO_TOTAL (-4) +#define SQL_SUCCESS 0 +#define SQL_SUCCESS_WITH_INFO 1 + +/* Diagnostic fields */ + +enum _SQL_DIAG { + SQL_DIAG_SQLSTATE = 4, +}; + +/* Transaction isolation levels */ + +#define SQL_TXN_READ_COMMITTED 2 +#define SQL_TXN_READ_UNCOMMITTED 1 +#define SQL_TXN_REPEATABLE_READ 4 +#define SQL_TXN_SERIALIZABLE 8 + +/* Access modes */ + +#define SQL_MODE_READ_ONLY 1UL +#define SQL_MODE_READ_WRITE 0UL + +/* ODBC properties */ + +#define SQL_ACCESS_MODE 101 +#define SQL_AUTOCOMMIT 102 +#define SQL_TXN_ISOLATION 108 + +/* ODBC attributes */ + +#define SQL_ATTR_ACCESS_MODE SQL_ACCESS_MODE +#define SQL_ATTR_CONNECTION_TIMEOUT 113 +#define SQL_ATTR_ODBC_VERSION 200 +#define SQL_ATTR_TXN_ISOLATION SQL_TXN_ISOLATION + +/* Nullable? */ + +#define SQL_NULLABLE_UNKNOWN 2 + +/* Placeholder for length of missing data */ + +#define SQL_NULL_DATA (-1) + +/* ODBC versions */ + +#define SQL_OV_ODBC3 3UL + +/* SQLDriverConnect flags */ + +#define SQL_DRIVER_COMPLETE_REQUIRED 3 +#define SQL_DRIVER_NOPROMPT 0 + +/* SQLGetTypeInfo flags */ + +#define SQL_ALL_TYPES 0 + +/* Transaction actions */ + +#define SQL_COMMIT 0 +#define SQL_ROLLBACK 1 + +/* Data source fetch flags */ + +#define SQL_FETCH_FIRST 2 +#define SQL_FETCH_FIRST_SYSTEM 32 +#define SQL_FETCH_FIRST_USER 31 +#define SQL_FETCH_NEXT 1 + +/* ODBCINST actions */ + +#define ODBC_ADD_DSN 1 +#define ODBC_CONFIG_DSN 2 +#define ODBC_REMOVE_DSN 3 +#define ODBC_ADD_SYS_DSN 4 +#define ODBC_CONFIG_SYS_DSN 5 +#define ODBC_REMOVE_SYS_DSN 6 + +/* ODBCINST errors */ + +#define ODBC_ERROR_GENERAL_ERR 1 +#define ODBC_ERROR_INVALID_BUFF_LEN 2 +#define ODBC_ERROR_INVALID_HWND 3 +#define ODBC_ERROR_INVALID_STR 4 +#define ODBC_ERROR_INVALID_REQUEST_TYPE 5 +#define ODBC_ERROR_COMPONENT_NOT_FOUND 6 +#define ODBC_ERROR_INVALID_NAME 7 +#define ODBC_ERROR_INVALID_KEYWORD_VALUE 8 +#define ODBC_ERROR_INVALID_DSN 9 +#define ODBC_ERROR_INVALID_INF 10 +#define ODBC_ERROR_REQUEST_FAILED 11 +#define ODBC_ERROR_INVALID_PATH 12 +#define ODBC_ERROR_LOAD_LIB_FAILED 13 +#define ODBC_ERROR_INVALID_PARAM_SEQUENCE 14 +#define ODBC_ERROR_INVALID_LOG_FILE 15 +#define ODBC_ERROR_USER_CANCELED 16 +#define ODBC_ERROR_USAGE_UPDATE_FAILED 17 +#define ODBC_ERROR_CREATE_DSN_FAILED 18 +#define ODBC_ERROR_WRITING_SYSINFO_FAILED 19 +#define ODBC_ERROR_REMOVE_DSN_FAILED 20 +#define ODBC_ERROR_OUT_OF_MEM 21 +#define ODBC_ERROR_OUTPUT_STRING_TRUNCATED 22 + +/* ODBC client library entry points */ + +#ifdef _WIN32 +#define SQL_API __stdcall +#define INSTAPI __stdcall +#else +#define SQL_API /* nothing */ +#define INSTAPI /* nothing */ +#endif + +#include "odbcStubs.h" +MODULE_SCOPE const odbcStubDefs* odbcStubs; + +/* + * Additional entry points in ODBCINST - all of these are optional + * and resolved with Tcl_FindSymbol, not directly in Tcl_LoadLibrary. + */ + +MODULE_SCOPE BOOL(INSTAPI* SQLConfigDataSourceW)(HWND, WORD, LPCWSTR, LPCWSTR); +MODULE_SCOPE BOOL(INSTAPI* SQLConfigDataSource)(HWND, WORD, LPCSTR, LPCSTR); +MODULE_SCOPE BOOL( + INSTAPI* SQLInstallerErrorW)(WORD, DWORD*, LPWSTR, WORD, WORD*); +MODULE_SCOPE BOOL(INSTAPI* SQLInstallerError)(WORD, DWORD*, LPSTR, WORD, WORD*); + +/* + * Function that initialises the stubs + */ + +MODULE_SCOPE Tcl_LoadHandle OdbcInitStubs(Tcl_Interp*, Tcl_LoadHandle*); + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ffi.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ffi.h new file mode 100644 index 0000000..dc23e5a --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ffi.h @@ -0,0 +1,483 @@ +/* -----------------------------------------------------------------*-C-*- + libffi 3.2.1 - Copyright (c) 2011, 2014 Anthony Green + - Copyright (c) 1996-2003, 2007, 2008 Red Hat, 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, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +/* ------------------------------------------------------------------- + The basic API is described in the README file. + + The raw API is designed to bypass some of the argument packing + and unpacking on architectures for which it can be avoided. + + The closure API allows interpreted functions to be packaged up + inside a C function pointer, so that they can be called as C functions, + with no understanding on the client side that they are interpreted. + It can also be used in other cases in which it is necessary to package + up a user specified parameter and a function pointer as a single + function pointer. + + The closure API must be implemented in order to get its functionality, + e.g. for use by gij. Routines are provided to emulate the raw API + if the underlying platform doesn't allow faster implementation. + + More details on the raw and cloure API can be found in: + + http://gcc.gnu.org/ml/java/1999-q3/msg00138.html + + and + + http://gcc.gnu.org/ml/java/1999-q3/msg00174.html + -------------------------------------------------------------------- */ + +#ifndef LIBFFI_H +#define LIBFFI_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Specify which architecture libffi is configured for. */ +#ifndef X86_64 +#define X86_64 +#endif + +/* ---- System configuration information --------------------------------- */ + +#include + +#ifndef LIBFFI_ASM + +#if defined(_MSC_VER) && !defined(__clang__) +#define __attribute__(X) +#endif + +#include +#include + +/* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). + But we can find it either under the correct ANSI name, or under GNU + C's internal name. */ + +#define FFI_64_BIT_MAX 9223372036854775807 + +#ifdef LONG_LONG_MAX +#define FFI_LONG_LONG_MAX LONG_LONG_MAX +#else +#ifdef LLONG_MAX +#define FFI_LONG_LONG_MAX LLONG_MAX +#ifdef _AIX52 /* or newer has C99 LLONG_MAX */ +#undef FFI_64_BIT_MAX +#define FFI_64_BIT_MAX 9223372036854775807LL +#endif /* _AIX52 or newer */ +#else +#ifdef __GNUC__ +#define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ +#endif +#ifdef _AIX /* AIX 5.1 and earlier have LONGLONG_MAX */ +#ifndef __PPC64__ +#if defined(__IBMC__) || defined(__IBMCPP__) +#define FFI_LONG_LONG_MAX LONGLONG_MAX +#endif +#endif /* __PPC64__ */ +#undef FFI_64_BIT_MAX +#define FFI_64_BIT_MAX 9223372036854775807LL +#endif +#endif +#endif + +/* The closure code assumes that this works on pointers, i.e. a size_t */ +/* can hold a pointer. */ + +typedef struct _ffi_type { + size_t size; + unsigned short alignment; + unsigned short type; + struct _ffi_type** elements; +} ffi_type; + +#ifndef LIBFFI_HIDE_BASIC_TYPES +#if SCHAR_MAX == 127 +#define ffi_type_uchar ffi_type_uint8 +#define ffi_type_schar ffi_type_sint8 +#else +#error "char size not supported" +#endif + +#if SHRT_MAX == 32767 +#define ffi_type_ushort ffi_type_uint16 +#define ffi_type_sshort ffi_type_sint16 +#elif SHRT_MAX == 2147483647 +#define ffi_type_ushort ffi_type_uint32 +#define ffi_type_sshort ffi_type_sint32 +#else +#error "short size not supported" +#endif + +#if INT_MAX == 32767 +#define ffi_type_uint ffi_type_uint16 +#define ffi_type_sint ffi_type_sint16 +#elif INT_MAX == 2147483647 +#define ffi_type_uint ffi_type_uint32 +#define ffi_type_sint ffi_type_sint32 +#elif INT_MAX == 9223372036854775807 +#define ffi_type_uint ffi_type_uint64 +#define ffi_type_sint ffi_type_sint64 +#else +#error "int size not supported" +#endif + +#if LONG_MAX == 2147483647 +#if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX +#error "no 64-bit data type supported" +#endif +#elif LONG_MAX != FFI_64_BIT_MAX +#error "long size not supported" +#endif + +#if LONG_MAX == 2147483647 +#define ffi_type_ulong ffi_type_uint32 +#define ffi_type_slong ffi_type_sint32 +#elif LONG_MAX == FFI_64_BIT_MAX +#define ffi_type_ulong ffi_type_uint64 +#define ffi_type_slong ffi_type_sint64 +#else +#error "long size not supported" +#endif + +/* Need minimal decorations for DLLs to works on Windows. */ +/* GCC has autoimport and autoexport. Rely on Libtool to */ +/* help MSVC export from a DLL, but always declare data */ +/* to be imported for MSVC clients. This costs an extra */ +/* indirection for MSVC clients using the static version */ +/* of the library, but don't worry about that. Besides, */ +/* as a workaround, they can define FFI_BUILDING if they */ +/* *know* they are going to link with the static library. */ +#if defined _MSC_VER && !defined FFI_BUILDING +#define FFI_EXTERN extern __declspec(dllimport) +#else +#define FFI_EXTERN extern +#endif + +/* These are defined in types.c */ +FFI_EXTERN ffi_type ffi_type_void; +FFI_EXTERN ffi_type ffi_type_uint8; +FFI_EXTERN ffi_type ffi_type_sint8; +FFI_EXTERN ffi_type ffi_type_uint16; +FFI_EXTERN ffi_type ffi_type_sint16; +FFI_EXTERN ffi_type ffi_type_uint32; +FFI_EXTERN ffi_type ffi_type_sint32; +FFI_EXTERN ffi_type ffi_type_uint64; +FFI_EXTERN ffi_type ffi_type_sint64; +FFI_EXTERN ffi_type ffi_type_float; +FFI_EXTERN ffi_type ffi_type_double; +FFI_EXTERN ffi_type ffi_type_pointer; + +#if 1 +FFI_EXTERN ffi_type ffi_type_longdouble; +#else +#define ffi_type_longdouble ffi_type_double +#endif + +#ifdef FFI_TARGET_HAS_COMPLEX_TYPE +FFI_EXTERN ffi_type ffi_type_complex_float; +FFI_EXTERN ffi_type ffi_type_complex_double; +#if 1 +FFI_EXTERN ffi_type ffi_type_complex_longdouble; +#else +#define ffi_type_complex_longdouble ffi_type_complex_double +#endif +#endif +#endif /* LIBFFI_HIDE_BASIC_TYPES */ + +typedef enum { FFI_OK = 0, FFI_BAD_TYPEDEF, FFI_BAD_ABI } ffi_status; + +typedef unsigned FFI_TYPE; + +typedef struct { + ffi_abi abi; + unsigned nargs; + ffi_type** arg_types; + ffi_type* rtype; + unsigned bytes; + unsigned flags; +#ifdef FFI_EXTRA_CIF_FIELDS + FFI_EXTRA_CIF_FIELDS; +#endif +} ffi_cif; + +#if 0 +/* Used to adjust size/alignment of ffi types. */ +void ffi_prep_types (ffi_abi abi); +#endif + +/* Used internally, but overridden by some architectures */ +ffi_status ffi_prep_cif_core( + ffi_cif* cif, + ffi_abi abi, + unsigned int isvariadic, + unsigned int nfixedargs, + unsigned int ntotalargs, + ffi_type* rtype, + ffi_type** atypes); + +/* ---- Definitions for the raw API -------------------------------------- */ + +#ifndef FFI_SIZEOF_ARG +#if LONG_MAX == 2147483647 +#define FFI_SIZEOF_ARG 4 +#elif LONG_MAX == FFI_64_BIT_MAX +#define FFI_SIZEOF_ARG 8 +#endif +#endif + +#ifndef FFI_SIZEOF_JAVA_RAW +#define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG +#endif + +typedef union { + ffi_sarg sint; + ffi_arg uint; + float flt; + char data[FFI_SIZEOF_ARG]; + void* ptr; +} ffi_raw; + +#if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8 +/* This is a special case for mips64/n32 ABI (and perhaps others) where + sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */ +typedef union { + signed int sint; + unsigned int uint; + float flt; + char data[FFI_SIZEOF_JAVA_RAW]; + void* ptr; +} ffi_java_raw; +#else +typedef ffi_raw ffi_java_raw; +#endif + +void ffi_raw_call( + ffi_cif* cif, + void (*fn)(void), + void* rvalue, + ffi_raw* avalue); + +void ffi_ptrarray_to_raw(ffi_cif* cif, void** args, ffi_raw* raw); +void ffi_raw_to_ptrarray(ffi_cif* cif, ffi_raw* raw, void** args); +size_t ffi_raw_size(ffi_cif* cif); + +/* This is analogous to the raw API, except it uses Java parameter */ +/* packing, even on 64-bit machines. I.e. on 64-bit machines */ +/* longs and doubles are followed by an empty 64-bit word. */ + +void ffi_java_raw_call( + ffi_cif* cif, + void (*fn)(void), + void* rvalue, + ffi_java_raw* avalue); + +void ffi_java_ptrarray_to_raw(ffi_cif* cif, void** args, ffi_java_raw* raw); +void ffi_java_raw_to_ptrarray(ffi_cif* cif, ffi_java_raw* raw, void** args); +size_t ffi_java_raw_size(ffi_cif* cif); + +/* ---- Definitions for closures ----------------------------------------- */ + +#if FFI_CLOSURES + +#ifdef _MSC_VER +__declspec(align(8)) +#endif + typedef struct { +#if 0 + void *trampoline_table; + void *trampoline_table_entry; +#else + char tramp[FFI_TRAMPOLINE_SIZE]; +#endif + ffi_cif* cif; + void (*fun)(ffi_cif*, void*, void**, void*); + void* user_data; +#ifdef __GNUC__ +} ffi_closure __attribute__((aligned(8))); +#else +} ffi_closure; +#ifdef __sgi +#pragma pack 0 +#endif +#endif + +void* ffi_closure_alloc(size_t size, void** code); +void ffi_closure_free(void*); + +ffi_status ffi_prep_closure( + ffi_closure*, + ffi_cif*, + void (*fun)(ffi_cif*, void*, void**, void*), + void* user_data); + +ffi_status ffi_prep_closure_loc( + ffi_closure*, + ffi_cif*, + void (*fun)(ffi_cif*, void*, void**, void*), + void* user_data, + void* codeloc); + +#ifdef __sgi +#pragma pack 8 +#endif +typedef struct { +#if 0 + void *trampoline_table; + void *trampoline_table_entry; +#else + char tramp[FFI_TRAMPOLINE_SIZE]; +#endif + ffi_cif* cif; + +#if !FFI_NATIVE_RAW_API + + /* if this is enabled, then a raw closure has the same layout + as a regular closure. We use this to install an intermediate + handler to do the transaltion, void** -> ffi_raw*. */ + + void (*translate_args)(ffi_cif*, void*, void**, void*); + void* this_closure; + +#endif + + void (*fun)(ffi_cif*, void*, ffi_raw*, void*); + void* user_data; + +} ffi_raw_closure; + +typedef struct { +#if 0 + void *trampoline_table; + void *trampoline_table_entry; +#else + char tramp[FFI_TRAMPOLINE_SIZE]; +#endif + + ffi_cif* cif; + +#if !FFI_NATIVE_RAW_API + + /* if this is enabled, then a raw closure has the same layout + as a regular closure. We use this to install an intermediate + handler to do the transaltion, void** -> ffi_raw*. */ + + void (*translate_args)(ffi_cif*, void*, void**, void*); + void* this_closure; + +#endif + + void (*fun)(ffi_cif*, void*, ffi_java_raw*, void*); + void* user_data; + +} ffi_java_raw_closure; + +ffi_status ffi_prep_raw_closure( + ffi_raw_closure*, + ffi_cif* cif, + void (*fun)(ffi_cif*, void*, ffi_raw*, void*), + void* user_data); + +ffi_status ffi_prep_raw_closure_loc( + ffi_raw_closure*, + ffi_cif* cif, + void (*fun)(ffi_cif*, void*, ffi_raw*, void*), + void* user_data, + void* codeloc); + +ffi_status ffi_prep_java_raw_closure( + ffi_java_raw_closure*, + ffi_cif* cif, + void (*fun)(ffi_cif*, void*, ffi_java_raw*, void*), + void* user_data); + +ffi_status ffi_prep_java_raw_closure_loc( + ffi_java_raw_closure*, + ffi_cif* cif, + void (*fun)(ffi_cif*, void*, ffi_java_raw*, void*), + void* user_data, + void* codeloc); + +#endif /* FFI_CLOSURES */ + +/* ---- Public interface definition -------------------------------------- */ + +ffi_status ffi_prep_cif( + ffi_cif* cif, + ffi_abi abi, + unsigned int nargs, + ffi_type* rtype, + ffi_type** atypes); + +ffi_status ffi_prep_cif_var( + ffi_cif* cif, + ffi_abi abi, + unsigned int nfixedargs, + unsigned int ntotalargs, + ffi_type* rtype, + ffi_type** atypes); + +void ffi_call(ffi_cif* cif, void (*fn)(void), void* rvalue, void** avalue); + +/* Useful for eliminating compiler warnings */ +#define FFI_FN(f) ((void (*)(void))f) + +/* ---- Definitions shared with assembly code ---------------------------- */ + +#endif + +/* If these change, update src/mips/ffitarget.h. */ +#define FFI_TYPE_VOID 0 +#define FFI_TYPE_INT 1 +#define FFI_TYPE_FLOAT 2 +#define FFI_TYPE_DOUBLE 3 +#if 1 +#define FFI_TYPE_LONGDOUBLE 4 +#else +#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE +#endif +#define FFI_TYPE_UINT8 5 +#define FFI_TYPE_SINT8 6 +#define FFI_TYPE_UINT16 7 +#define FFI_TYPE_SINT16 8 +#define FFI_TYPE_UINT32 9 +#define FFI_TYPE_SINT32 10 +#define FFI_TYPE_UINT64 11 +#define FFI_TYPE_SINT64 12 +#define FFI_TYPE_STRUCT 13 +#define FFI_TYPE_POINTER 14 +#define FFI_TYPE_COMPLEX 15 + +/* This should always refer to the last type code (for sanity checks) */ +#define FFI_TYPE_LAST FFI_TYPE_COMPLEX + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ffitarget.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ffitarget.h new file mode 100644 index 0000000..e2ab47f --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ffitarget.h @@ -0,0 +1,150 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 2012, 2014 Anthony Green + Copyright (c) 1996-2003, 2010 Red Hat, Inc. + Copyright (C) 2008 Free Software Foundation, Inc. + + Target configuration macros for x86 and x86-64. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_H +#error \ + "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + +/* ---- System specific configurations ----------------------------------- */ + +/* For code common to all platforms on x86 and x86_64. */ +#define X86_ANY + +#if defined(X86_64) && defined(__i386__) +#undef X86_64 +#define X86 +#endif + +#ifdef X86_WIN64 +#define FFI_SIZEOF_ARG 8 +#define USE_BUILTIN_FFS 0 /* not yet implemented in mingw-64 */ +#endif + +#define FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION +#define FFI_TARGET_HAS_COMPLEX_TYPE + +/* ---- Generic type definitions ----------------------------------------- */ + +#ifndef LIBFFI_ASM +#ifdef X86_WIN64 +#ifdef _MSC_VER +typedef unsigned __int64 ffi_arg; +typedef __int64 ffi_sarg; +#else +typedef unsigned long long ffi_arg; +typedef long long ffi_sarg; +#endif +#else +#if defined __x86_64__ && defined __ILP32__ +#define FFI_SIZEOF_ARG 8 +#define FFI_SIZEOF_JAVA_RAW 4 +typedef unsigned long long ffi_arg; +typedef long long ffi_sarg; +#else +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; +#endif +#endif + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + +/* ---- Intel x86 Win32 ---------- */ +#ifdef X86_WIN32 + FFI_SYSV, + FFI_STDCALL, + FFI_THISCALL, + FFI_FASTCALL, + FFI_MS_CDECL, + FFI_PASCAL, + FFI_REGISTER, + FFI_LAST_ABI, +#ifdef _MSC_VER + FFI_DEFAULT_ABI = FFI_MS_CDECL +#else + FFI_DEFAULT_ABI = FFI_SYSV +#endif + +#elif defined(X86_WIN64) + FFI_WIN64, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_WIN64 + +#else + /* ---- Intel x86 and AMD x86-64 - */ + FFI_SYSV, + FFI_UNIX64, /* Unix variants all use the same ABI for x86-64 */ + FFI_THISCALL, + FFI_FASTCALL, + FFI_STDCALL, + FFI_PASCAL, + FFI_REGISTER, + FFI_LAST_ABI, +#if defined(__i386__) || defined(__i386) + FFI_DEFAULT_ABI = FFI_SYSV +#else + FFI_DEFAULT_ABI = FFI_UNIX64 +#endif +#endif +} ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1) +#define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2) +#define FFI_TYPE_SMALL_STRUCT_4B (FFI_TYPE_LAST + 3) +#define FFI_TYPE_MS_STRUCT (FFI_TYPE_LAST + 4) + +#if defined(X86_64) || (defined(__x86_64__) && defined(X86_DARWIN)) +#define FFI_TRAMPOLINE_SIZE 24 +#define FFI_NATIVE_RAW_API 0 +#else +#ifdef X86_WIN32 +#define FFI_TRAMPOLINE_SIZE 52 +#else +#ifdef X86_WIN64 +#define FFI_TRAMPOLINE_SIZE 29 +#define FFI_NATIVE_RAW_API 0 +#define FFI_NO_RAW_API 1 +#else +#define FFI_TRAMPOLINE_SIZE 10 +#endif +#endif +#ifndef X86_WIN64 +#define FFI_NATIVE_RAW_API 1 /* x86 has native raw api support */ +#endif +#endif + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/form.h b/src_cpp/elfgames/tasks/elf2codingenv/include/form.h new file mode 100644 index 0000000..4beba75 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/form.h @@ -0,0 +1,450 @@ +/**************************************************************************** + * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1995,1997 * + ****************************************************************************/ + +/* $Id: form.h,v 0.27 2017/02/11 16:35:42 tom Exp $ */ + +#ifndef FORM_H +#define FORM_H +/* *INDENT-OFF*/ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef FORM_PRIV_H +typedef void* FIELD_CELL; +#endif + +#ifndef NCURSES_FIELD_INTERNALS +#define NCURSES_FIELD_INTERNALS /* nothing */ +#endif + +typedef int Form_Options; +typedef int Field_Options; + +/********** +* _PAGE * +**********/ + +typedef struct pagenode +#if !NCURSES_OPAQUE_FORM +{ + short pmin; /* index of first field on page */ + short pmax; /* index of last field on page */ + short smin; /* index of top leftmost field on page */ + short smax; /* index of bottom rightmost field on page */ +} +#endif /* !NCURSES_OPAQUE_FORM */ +_PAGE; + +/********** +* FIELD * +**********/ + +typedef struct fieldnode +#if 1 /* not yet: !NCURSES_OPAQUE_FORM */ +{ + unsigned short status; /* flags */ + short rows; /* size in rows */ + short cols; /* size in cols */ + short frow; /* first row */ + short fcol; /* first col */ + int drows; /* dynamic rows */ + int dcols; /* dynamic cols */ + int maxgrow; /* maximum field growth */ + int nrow; /* off-screen rows */ + short nbuf; /* additional buffers */ + short just; /* justification */ + short page; /* page on form */ + short index; /* into form -> field */ + int pad; /* pad character */ + chtype fore; /* foreground attribute */ + chtype back; /* background attribute */ + Field_Options opts; /* options */ + struct fieldnode* snext; /* sorted order pointer */ + struct fieldnode* sprev; /* sorted order pointer */ + struct fieldnode* link; /* linked field chain */ + struct formnode* form; /* containing form */ + struct typenode* type; /* field type */ + void* arg; /* argument for type */ + FIELD_CELL* buf; /* field buffers */ + void* usrptr; /* user pointer */ + /* + * The wide-character configuration requires extra information. Because + * there are existing applications that manipulate the members of FIELD + * directly, we cannot make the struct opaque, except by changing the ABI. + * Offsets of members up to this point are the same in the narrow- and + * wide-character configuration. But note that the type of buf depends on + * the configuration, and is made opaque for that reason. + */ + NCURSES_FIELD_INTERNALS +} +#endif /* NCURSES_OPAQUE_FORM */ +FIELD; + +/********* +* FORM * +*********/ + +typedef struct formnode +#if 1 /* not yet: !NCURSES_OPAQUE_FORM */ +{ + unsigned short status; /* flags */ + short rows; /* size in rows */ + short cols; /* size in cols */ + int currow; /* current row in field window */ + int curcol; /* current col in field window */ + int toprow; /* in scrollable field window */ + int begincol; /* in horiz. scrollable field */ + short maxfield; /* number of fields */ + short maxpage; /* number of pages */ + short curpage; /* index into page */ + Form_Options opts; /* options */ + WINDOW* win; /* window */ + WINDOW* sub; /* subwindow */ + WINDOW* w; /* window for current field */ + FIELD** field; /* field [maxfield] */ + FIELD* current; /* current field */ + _PAGE* page; /* page [maxpage] */ + void* usrptr; /* user pointer */ + + void (*forminit)(struct formnode*); + void (*formterm)(struct formnode*); + void (*fieldinit)(struct formnode*); + void (*fieldterm)(struct formnode*); + +} +#endif /* !NCURSES_OPAQUE_FORM */ +FORM; + +/************** +* FIELDTYPE * +**************/ + +typedef struct typenode +#if !NCURSES_OPAQUE_FORM +{ + unsigned short status; /* flags */ + long ref; /* reference count */ + struct typenode* left; /* ptr to operand for | */ + struct typenode* right; /* ptr to operand for | */ + + void* (*makearg)(va_list*); /* make fieldtype arg */ + void* (*copyarg)(const void*); /* copy fieldtype arg */ + void (*freearg)(void*); /* free fieldtype arg */ + +#if NCURSES_INTEROP_FUNCS + union { + bool (*ofcheck)(FIELD*, const void*); /* field validation */ + bool (*gfcheck)(FORM*, FIELD*, const void*); /* generic field validation */ + } fieldcheck; + union { + bool (*occheck)(int, const void*); /* character validation */ + bool (*gccheck)( + int, + FORM*, + FIELD*, + const void*); /* generic char validation */ + } charcheck; + union { + bool (*onext)(FIELD*, const void*); /* enumerate next value */ + bool (*gnext)(FORM*, FIELD*, const void*); /* generic enumerate next */ + } enum_next; + union { + bool (*oprev)(FIELD*, const void*); /* enumerate prev value */ + bool (*gprev)(FORM*, FIELD*, const void*); /* generic enumerate prev */ + } enum_prev; + void* (*genericarg)(void*); /* Alternate Arg method */ +#else + bool (*fcheck)(FIELD*, const void*); /* field validation */ + bool (*ccheck)(int, const void*); /* character validation */ + + bool (*next)(FIELD*, const void*); /* enumerate next value */ + bool (*prev)(FIELD*, const void*); /* enumerate prev value */ +#endif +} +#endif /* !NCURSES_OPAQUE_FORM */ +FIELDTYPE; + +typedef void (*Form_Hook)(FORM*); + +/*************************** +* miscellaneous #defines * +***************************/ + +/* field justification */ +#define NO_JUSTIFICATION (0) +#define JUSTIFY_LEFT (1) +#define JUSTIFY_CENTER (2) +#define JUSTIFY_RIGHT (3) + +/* field options */ +#define O_VISIBLE (0x0001U) +#define O_ACTIVE (0x0002U) +#define O_PUBLIC (0x0004U) +#define O_EDIT (0x0008U) +#define O_WRAP (0x0010U) +#define O_BLANK (0x0020U) +#define O_AUTOSKIP (0x0040U) +#define O_NULLOK (0x0080U) +#define O_PASSOK (0x0100U) +#define O_STATIC (0x0200U) +#define O_DYNAMIC_JUSTIFY (0x0400U) /* ncurses extension */ +#define O_NO_LEFT_STRIP (0x0800U) /* ncurses extension */ + +/* form options */ +#define O_NL_OVERLOAD (0x0001U) +#define O_BS_OVERLOAD (0x0002U) + +/* form driver commands */ +#define REQ_NEXT_PAGE (KEY_MAX + 1) /* move to next page */ +#define REQ_PREV_PAGE (KEY_MAX + 2) /* move to previous page */ +#define REQ_FIRST_PAGE (KEY_MAX + 3) /* move to first page */ +#define REQ_LAST_PAGE (KEY_MAX + 4) /* move to last page */ + +#define REQ_NEXT_FIELD (KEY_MAX + 5) /* move to next field */ +#define REQ_PREV_FIELD (KEY_MAX + 6) /* move to previous field */ +#define REQ_FIRST_FIELD (KEY_MAX + 7) /* move to first field */ +#define REQ_LAST_FIELD (KEY_MAX + 8) /* move to last field */ +#define REQ_SNEXT_FIELD (KEY_MAX + 9) /* move to sorted next field */ +#define REQ_SPREV_FIELD (KEY_MAX + 10) /* move to sorted prev field */ +#define REQ_SFIRST_FIELD (KEY_MAX + 11) /* move to sorted first field */ +#define REQ_SLAST_FIELD (KEY_MAX + 12) /* move to sorted last field */ +#define REQ_LEFT_FIELD (KEY_MAX + 13) /* move to left to field */ +#define REQ_RIGHT_FIELD (KEY_MAX + 14) /* move to right to field */ +#define REQ_UP_FIELD (KEY_MAX + 15) /* move to up to field */ +#define REQ_DOWN_FIELD (KEY_MAX + 16) /* move to down to field */ + +#define REQ_NEXT_CHAR (KEY_MAX + 17) /* move to next char in field */ +#define REQ_PREV_CHAR (KEY_MAX + 18) /* move to prev char in field */ +#define REQ_NEXT_LINE (KEY_MAX + 19) /* move to next line in field */ +#define REQ_PREV_LINE (KEY_MAX + 20) /* move to prev line in field */ +#define REQ_NEXT_WORD (KEY_MAX + 21) /* move to next word in field */ +#define REQ_PREV_WORD (KEY_MAX + 22) /* move to prev word in field */ +#define REQ_BEG_FIELD (KEY_MAX + 23) /* move to first char in field */ +#define REQ_END_FIELD (KEY_MAX + 24) /* move after last char in fld */ +#define REQ_BEG_LINE (KEY_MAX + 25) /* move to beginning of line */ +#define REQ_END_LINE (KEY_MAX + 26) /* move after last char in line */ +#define REQ_LEFT_CHAR (KEY_MAX + 27) /* move left in field */ +#define REQ_RIGHT_CHAR (KEY_MAX + 28) /* move right in field */ +#define REQ_UP_CHAR (KEY_MAX + 29) /* move up in field */ +#define REQ_DOWN_CHAR (KEY_MAX + 30) /* move down in field */ + +#define REQ_NEW_LINE (KEY_MAX + 31) /* insert/overlay new line */ +#define REQ_INS_CHAR (KEY_MAX + 32) /* insert blank char at cursor */ +#define REQ_INS_LINE (KEY_MAX + 33) /* insert blank line at cursor */ +#define REQ_DEL_CHAR (KEY_MAX + 34) /* delete char at cursor */ +#define REQ_DEL_PREV (KEY_MAX + 35) /* delete char before cursor */ +#define REQ_DEL_LINE (KEY_MAX + 36) /* delete line at cursor */ +#define REQ_DEL_WORD (KEY_MAX + 37) /* delete word at cursor */ +#define REQ_CLR_EOL (KEY_MAX + 38) /* clear to end of line */ +#define REQ_CLR_EOF (KEY_MAX + 39) /* clear to end of field */ +#define REQ_CLR_FIELD (KEY_MAX + 40) /* clear entire field */ +#define REQ_OVL_MODE (KEY_MAX + 41) /* begin overlay mode */ +#define REQ_INS_MODE (KEY_MAX + 42) /* begin insert mode */ +#define REQ_SCR_FLINE (KEY_MAX + 43) /* scroll field forward a line */ +#define REQ_SCR_BLINE (KEY_MAX + 44) /* scroll field backward a line */ +#define REQ_SCR_FPAGE (KEY_MAX + 45) /* scroll field forward a page */ +#define REQ_SCR_BPAGE (KEY_MAX + 46) /* scroll field backward a page */ +#define REQ_SCR_FHPAGE (KEY_MAX + 47) /* scroll field forward half page */ +#define REQ_SCR_BHPAGE (KEY_MAX + 48) /* scroll field backward half page */ +#define REQ_SCR_FCHAR (KEY_MAX + 49) /* horizontal scroll char */ +#define REQ_SCR_BCHAR (KEY_MAX + 50) /* horizontal scroll char */ +#define REQ_SCR_HFLINE (KEY_MAX + 51) /* horizontal scroll line */ +#define REQ_SCR_HBLINE (KEY_MAX + 52) /* horizontal scroll line */ +#define REQ_SCR_HFHALF (KEY_MAX + 53) /* horizontal scroll half line */ +#define REQ_SCR_HBHALF (KEY_MAX + 54) /* horizontal scroll half line */ + +#define REQ_VALIDATION (KEY_MAX + 55) /* validate field */ +#define REQ_NEXT_CHOICE (KEY_MAX + 56) /* display next field choice */ +#define REQ_PREV_CHOICE (KEY_MAX + 57) /* display prev field choice */ + +#define MIN_FORM_COMMAND (KEY_MAX + 1) /* used by form_driver */ +#define MAX_FORM_COMMAND (KEY_MAX + 57) /* used by form_driver */ + +#if defined(MAX_COMMAND) +#if (MAX_FORM_COMMAND > MAX_COMMAND) +#error Something is wrong -- MAX_FORM_COMMAND is greater than MAX_COMMAND +#elif (MAX_COMMAND != (KEY_MAX + 128)) +#error Something is wrong -- MAX_COMMAND is already inconsistently defined. +#endif +#else +#define MAX_COMMAND (KEY_MAX + 128) +#endif + +/************************* +* standard field types * +*************************/ +extern NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ALPHA; +extern NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ALNUM; +extern NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ENUM; +extern NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_INTEGER; +extern NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_NUMERIC; +extern NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_REGEXP; + +/************************************ +* built-in additional field types * +* They are not defined in SVr4 * +************************************/ +extern NCURSES_EXPORT_VAR( + FIELDTYPE*) TYPE_IPV4; /* Internet IP Version 4 address */ + +/*********************** +* FIELDTYPE routines * +***********************/ +extern NCURSES_EXPORT(FIELDTYPE*) new_fieldtype( + bool (*const field_check)(FIELD*, const void*), + bool (*const char_check)(int, const void*)); +extern NCURSES_EXPORT(FIELDTYPE*) link_fieldtype(FIELDTYPE*, FIELDTYPE*); + +extern NCURSES_EXPORT(int) free_fieldtype(FIELDTYPE*); +extern NCURSES_EXPORT(int) set_fieldtype_arg( + FIELDTYPE*, + void* (*const make_arg)(va_list*), + void* (*const copy_arg)(const void*), + void (*const free_arg)(void*)); +extern NCURSES_EXPORT(int) set_fieldtype_choice( + FIELDTYPE*, + bool (*const next_choice)(FIELD*, const void*), + bool (*const prev_choice)(FIELD*, const void*)); + +/******************* +* FIELD routines * +*******************/ +extern NCURSES_EXPORT(FIELD*) new_field(int, int, int, int, int, int); +extern NCURSES_EXPORT(FIELD*) dup_field(FIELD*, int, int); +extern NCURSES_EXPORT(FIELD*) link_field(FIELD*, int, int); + +extern NCURSES_EXPORT(int) free_field(FIELD*); +extern NCURSES_EXPORT(int) + field_info(const FIELD*, int*, int*, int*, int*, int*, int*); +extern NCURSES_EXPORT(int) dynamic_field_info(const FIELD*, int*, int*, int*); +extern NCURSES_EXPORT(int) set_max_field(FIELD*, int); +extern NCURSES_EXPORT(int) move_field(FIELD*, int, int); +extern NCURSES_EXPORT(int) set_field_type(FIELD*, FIELDTYPE*, ...); +extern NCURSES_EXPORT(int) set_new_page(FIELD*, bool); +extern NCURSES_EXPORT(int) set_field_just(FIELD*, int); +extern NCURSES_EXPORT(int) field_just(const FIELD*); +extern NCURSES_EXPORT(int) set_field_fore(FIELD*, chtype); +extern NCURSES_EXPORT(int) set_field_back(FIELD*, chtype); +extern NCURSES_EXPORT(int) set_field_pad(FIELD*, int); +extern NCURSES_EXPORT(int) field_pad(const FIELD*); +extern NCURSES_EXPORT(int) set_field_buffer(FIELD*, int, const char*); +extern NCURSES_EXPORT(int) set_field_status(FIELD*, bool); +extern NCURSES_EXPORT(int) set_field_userptr(FIELD*, void*); +extern NCURSES_EXPORT(int) set_field_opts(FIELD*, Field_Options); +extern NCURSES_EXPORT(int) field_opts_on(FIELD*, Field_Options); +extern NCURSES_EXPORT(int) field_opts_off(FIELD*, Field_Options); + +extern NCURSES_EXPORT(chtype) field_fore(const FIELD*); +extern NCURSES_EXPORT(chtype) field_back(const FIELD*); + +extern NCURSES_EXPORT(bool) new_page(const FIELD*); +extern NCURSES_EXPORT(bool) field_status(const FIELD*); + +extern NCURSES_EXPORT(void*) field_arg(const FIELD*); + +extern NCURSES_EXPORT(void*) field_userptr(const FIELD*); + +extern NCURSES_EXPORT(FIELDTYPE*) field_type(const FIELD*); + +extern NCURSES_EXPORT(char*) field_buffer(const FIELD*, int); + +extern NCURSES_EXPORT(Field_Options) field_opts(const FIELD*); + +/****************** +* FORM routines * +******************/ + +extern NCURSES_EXPORT(FORM*) new_form(FIELD**); + +extern NCURSES_EXPORT(FIELD**) form_fields(const FORM*); +extern NCURSES_EXPORT(FIELD*) current_field(const FORM*); + +extern NCURSES_EXPORT(WINDOW*) form_win(const FORM*); +extern NCURSES_EXPORT(WINDOW*) form_sub(const FORM*); + +extern NCURSES_EXPORT(Form_Hook) form_init(const FORM*); +extern NCURSES_EXPORT(Form_Hook) form_term(const FORM*); +extern NCURSES_EXPORT(Form_Hook) field_init(const FORM*); +extern NCURSES_EXPORT(Form_Hook) field_term(const FORM*); + +extern NCURSES_EXPORT(int) free_form(FORM*); +extern NCURSES_EXPORT(int) set_form_fields(FORM*, FIELD**); +extern NCURSES_EXPORT(int) field_count(const FORM*); +extern NCURSES_EXPORT(int) set_form_win(FORM*, WINDOW*); +extern NCURSES_EXPORT(int) set_form_sub(FORM*, WINDOW*); +extern NCURSES_EXPORT(int) set_current_field(FORM*, FIELD*); +extern NCURSES_EXPORT(int) unfocus_current_field(FORM*); +extern NCURSES_EXPORT(int) field_index(const FIELD*); +extern NCURSES_EXPORT(int) set_form_page(FORM*, int); +extern NCURSES_EXPORT(int) form_page(const FORM*); +extern NCURSES_EXPORT(int) scale_form(const FORM*, int*, int*); +extern NCURSES_EXPORT(int) set_form_init(FORM*, Form_Hook); +extern NCURSES_EXPORT(int) set_form_term(FORM*, Form_Hook); +extern NCURSES_EXPORT(int) set_field_init(FORM*, Form_Hook); +extern NCURSES_EXPORT(int) set_field_term(FORM*, Form_Hook); +extern NCURSES_EXPORT(int) post_form(FORM*); +extern NCURSES_EXPORT(int) unpost_form(FORM*); +extern NCURSES_EXPORT(int) pos_form_cursor(FORM*); +extern NCURSES_EXPORT(int) form_driver(FORM*, int); +#if NCURSES_WIDECHAR +extern NCURSES_EXPORT(int) form_driver_w(FORM*, int, wchar_t); +#endif +extern NCURSES_EXPORT(int) set_form_userptr(FORM*, void*); +extern NCURSES_EXPORT(int) set_form_opts(FORM*, Form_Options); +extern NCURSES_EXPORT(int) form_opts_on(FORM*, Form_Options); +extern NCURSES_EXPORT(int) form_opts_off(FORM*, Form_Options); +extern NCURSES_EXPORT(int) form_request_by_name(const char*); + +extern NCURSES_EXPORT(const char*) form_request_name(int); + +extern NCURSES_EXPORT(void*) form_userptr(const FORM*); + +extern NCURSES_EXPORT(Form_Options) form_opts(const FORM*); + +extern NCURSES_EXPORT(bool) data_ahead(const FORM*); +extern NCURSES_EXPORT(bool) data_behind(const FORM*); + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(FORM*) NCURSES_SP_NAME(new_form)(SCREEN*, FIELD**); +#endif + +#ifdef __cplusplus +} +#endif +/* *INDENT-ON*/ + +#endif /* FORM_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/histedit.h b/src_cpp/elfgames/tasks/elf2codingenv/include/histedit.h new file mode 100644 index 0000000..6260842 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/histedit.h @@ -0,0 +1,311 @@ +/* $NetBSD: histedit.h,v 1.56 2016/04/19 19:50:53 christos Exp $ */ + +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Christos Zoulas of Cornell University. + * + * 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. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * @(#)histedit.h 8.2 (Berkeley) 1/3/94 + */ + +/* + * histedit.h: Line editor and history interface. + */ +#ifndef _HISTEDIT_H_ +#define _HISTEDIT_H_ + +#define LIBEDIT_MAJOR 2 +#define LIBEDIT_MINOR 11 + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * ==== Editing ==== + */ + +typedef struct editline EditLine; + +/* + * For user-defined function interface + */ +typedef struct lineinfo { + const char* buffer; + const char* cursor; + const char* lastchar; +} LineInfo; + +/* + * EditLine editor function return codes. + * For user-defined function interface + */ +#define CC_NORM 0 +#define CC_NEWLINE 1 +#define CC_EOF 2 +#define CC_ARGHACK 3 +#define CC_REFRESH 4 +#define CC_CURSOR 5 +#define CC_ERROR 6 +#define CC_FATAL 7 +#define CC_REDISPLAY 8 +#define CC_REFRESH_BEEP 9 + +/* + * Initialization, cleanup, and resetting + */ +EditLine* el_init(const char*, FILE*, FILE*, FILE*); +EditLine* el_init_fd(const char*, FILE*, FILE*, FILE*, int, int, int); +void el_end(EditLine*); +void el_reset(EditLine*); + +/* + * Get a line, a character or push a string back in the input queue + */ +const char* el_gets(EditLine*, int*); +int el_getc(EditLine*, char*); +void el_push(EditLine*, const char*); + +/* + * Beep! + */ +void el_beep(EditLine*); + +/* + * High level function internals control + * Parses argc, argv array and executes builtin editline commands + */ +int el_parse(EditLine*, int, const char**); + +/* + * Low level editline access functions + */ +int el_set(EditLine*, int, ...); +int el_get(EditLine*, int, ...); +unsigned char _el_fn_complete(EditLine*, int); + +/* + * el_set/el_get parameters + * + * When using el_wset/el_wget (as opposed to el_set/el_get): + * Char is wchar_t, otherwise it is char. + * prompt_func is el_wpfunc_t, otherwise it is el_pfunc_t . + + * Prompt function prototypes are: + * typedef char *(*el_pfunct_t) (EditLine *); + * typedef wchar_t *(*el_wpfunct_t) (EditLine *); + * + * For operations that support set or set/get, the argument types listed are for + * the "set" operation. For "get", each listed type must be a pointer. + * E.g. EL_EDITMODE takes an int when set, but an int* when get. + * + * Operations that only support "get" have the correct argument types listed. + */ +#define EL_PROMPT 0 /* , prompt_func); set/get */ +#define EL_TERMINAL 1 /* , const char *); set/get */ +#define EL_EDITOR 2 /* , const Char *); set/get */ +#define EL_SIGNAL 3 /* , int); set/get */ +#define EL_BIND 4 /* , const Char *, ..., NULL); set */ +#define EL_TELLTC 5 /* , const Char *, ..., NULL); set */ +#define EL_SETTC 6 /* , const Char *, ..., NULL); set */ +#define EL_ECHOTC 7 /* , const Char *, ..., NULL); set */ +#define EL_SETTY 8 /* , const Char *, ..., NULL); set */ +#define EL_ADDFN 9 /* , const Char *, const Char, set */ +/* el_func_t); */ +#define EL_HIST 10 /* , hist_fun_t, const void *); set */ +#define EL_EDITMODE 11 /* , int); set/get */ +#define EL_RPROMPT 12 /* , prompt_func); set/get */ +#define EL_GETCFN 13 /* , el_rfunc_t); set/get */ +#define EL_CLIENTDATA 14 /* , void *); set/get */ +#define EL_UNBUFFERED 15 /* , int); set/get */ +#define EL_PREP_TERM 16 /* , int); set */ +#define EL_GETTC 17 /* , const Char *, ..., NULL); get */ +#define EL_GETFP 18 /* , int, FILE **); get */ +#define EL_SETFP 19 /* , int, FILE *); set */ +#define EL_REFRESH 20 /* , void); set */ +#define EL_PROMPT_ESC 21 /* , prompt_func, Char); set/get */ +#define EL_RPROMPT_ESC 22 /* , prompt_func, Char); set/get */ +#define EL_RESIZE 23 /* , el_zfunc_t, void *); set */ +#define EL_ALIAS_TEXT 24 /* , el_afunc_t, void *); set */ + +#define EL_BUILTIN_GETCFN (NULL) + +/* + * Source named file or $PWD/.editrc or $HOME/.editrc + */ +int el_source(EditLine*, const char*); + +/* + * Must be called when the terminal changes size; If EL_SIGNAL + * is set this is done automatically otherwise it is the responsibility + * of the application + */ +void el_resize(EditLine*); + +/* + * User-defined function interface. + */ +const LineInfo* el_line(EditLine*); +int el_insertstr(EditLine*, const char*); +void el_deletestr(EditLine*, int); + +/* + * ==== History ==== + */ + +typedef struct history History; + +typedef struct HistEvent { + int num; + const char* str; +} HistEvent; + +/* + * History access functions. + */ +History* history_init(void); +void history_end(History*); + +int history(History*, HistEvent*, int, ...); + +#define H_FUNC 0 /* , UTSL */ +#define H_SETSIZE 1 /* , const int); */ +#define H_GETSIZE 2 /* , void); */ +#define H_FIRST 3 /* , void); */ +#define H_LAST 4 /* , void); */ +#define H_PREV 5 /* , void); */ +#define H_NEXT 6 /* , void); */ +#define H_CURR 8 /* , const int); */ +#define H_SET 7 /* , int); */ +#define H_ADD 9 /* , const wchar_t *); */ +#define H_ENTER 10 /* , const wchar_t *); */ +#define H_APPEND 11 /* , const wchar_t *); */ +#define H_END 12 /* , void); */ +#define H_NEXT_STR 13 /* , const wchar_t *); */ +#define H_PREV_STR 14 /* , const wchar_t *); */ +#define H_NEXT_EVENT 15 /* , const int); */ +#define H_PREV_EVENT 16 /* , const int); */ +#define H_LOAD 17 /* , const char *); */ +#define H_SAVE 18 /* , const char *); */ +#define H_CLEAR 19 /* , void); */ +#define H_SETUNIQUE 20 /* , int); */ +#define H_GETUNIQUE 21 /* , void); */ +#define H_DEL 22 /* , int); */ +#define H_NEXT_EVDATA 23 /* , const int, histdata_t *); */ +#define H_DELDATA 24 /* , int, histdata_t *);*/ +#define H_REPLACE 25 /* , const char *, histdata_t); */ +#define H_SAVE_FP 26 /* , FILE *); */ + +/* + * ==== Tokenization ==== + */ + +typedef struct tokenizer Tokenizer; + +/* + * String tokenization functions, using simplified sh(1) quoting rules + */ +Tokenizer* tok_init(const char*); +void tok_end(Tokenizer*); +void tok_reset(Tokenizer*); +int tok_line(Tokenizer*, const LineInfo*, int*, const char***, int*, int*); +int tok_str(Tokenizer*, const char*, int*, const char***); + +/* + * Begin Wide Character Support + */ +#include +#include + +/* + * ==== Editing ==== + */ +typedef struct lineinfow { + const wchar_t* buffer; + const wchar_t* cursor; + const wchar_t* lastchar; +} LineInfoW; + +typedef int (*el_rfunc_t)(EditLine*, wchar_t*); + +const wchar_t* el_wgets(EditLine*, int*); +int el_wgetc(EditLine*, wchar_t*); +void el_wpush(EditLine*, const wchar_t*); + +int el_wparse(EditLine*, int, const wchar_t**); + +int el_wset(EditLine*, int, ...); +int el_wget(EditLine*, int, ...); + +int el_cursor(EditLine*, int); +const LineInfoW* el_wline(EditLine*); +int el_winsertstr(EditLine*, const wchar_t*); +#define el_wdeletestr el_deletestr + +/* + * ==== History ==== + */ +typedef struct histeventW { + int num; + const wchar_t* str; +} HistEventW; + +typedef struct historyW HistoryW; + +HistoryW* history_winit(void); +void history_wend(HistoryW*); + +int history_w(HistoryW*, HistEventW*, int, ...); + +/* + * ==== Tokenization ==== + */ +typedef struct tokenizerW TokenizerW; + +/* Wide character tokenizer support */ +TokenizerW* tok_winit(const wchar_t*); +void tok_wend(TokenizerW*); +void tok_wreset(TokenizerW*); +int tok_wline( + TokenizerW*, + const LineInfoW*, + int*, + const wchar_t***, + int*, + int*); +int tok_wstr(TokenizerW*, const wchar_t*, int*, const wchar_t***); + +#ifdef __cplusplus +} +#endif + +#endif /* _HISTEDIT_H_ */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/itcl.h b/src_cpp/elfgames/tasks/elf2codingenv/include/itcl.h new file mode 100644 index 0000000..8908912 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/itcl.h @@ -0,0 +1,201 @@ +/* + * itcl.h -- + * + * This file contains definitions for the C-implemeted part of a Itcl + * this version of [incr Tcl] (Itcl) is a completely new implementation + * based on TclOO extension of Tcl 8.5 + * It tries to provide the same interfaces as the original implementation + * of Michael J. McLennan + * Some small pieces of code are taken from that implementation + * + * Copyright (c) 2007 by Arnulf P. Wiedemann + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +/* + * ------------------------------------------------------------------------ + * PACKAGE: [incr Tcl] + * DESCRIPTION: Object-Oriented Extensions to Tcl + * + * [incr Tcl] provides object-oriented extensions to Tcl, much as + * C++ provides object-oriented extensions to C. It provides a means + * of encapsulating related procedures together with their shared data + * in a local namespace that is hidden from the outside world. It + * promotes code re-use through inheritance. More than anything else, + * it encourages better organization of Tcl applications through the + * object-oriented paradigm, leading to code that is easier to + * understand and maintain. + * + * ADDING [incr Tcl] TO A Tcl-BASED APPLICATION: + * + * To add [incr Tcl] facilities to a Tcl application, modify the + * Tcl_AppInit() routine as follows: + * + * 1) Include this header file near the top of the file containing + * Tcl_AppInit(): + * + * #include "itcl.h" +* + * 2) Within the body of Tcl_AppInit(), add the following lines: + * + * if (Itcl_Init(interp) == TCL_ERROR) { + * return TCL_ERROR; + * } + * + * 3) Link your application with libitcl.a + * + * NOTE: An example file "tclAppInit.c" containing the changes shown + * above is included in this distribution. + * + *--------------------------------------------------------------------- + */ + +#ifndef ITCL_H_INCLUDED +#define ITCL_H_INCLUDED + +#include + +#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 6) +#error Itcl 4 build requires tcl.h from Tcl 8.6 or later +#endif + +/* + * For C++ compilers, use extern "C" + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef TCL_ALPHA_RELEASE +#define TCL_ALPHA_RELEASE 0 +#endif +#ifndef TCL_BETA_RELEASE +#define TCL_BETA_RELEASE 1 +#endif +#ifndef TCL_FINAL_RELEASE +#define TCL_FINAL_RELEASE 2 +#endif + +#define ITCL_MAJOR_VERSION 4 +#define ITCL_MINOR_VERSION 1 +#define ITCL_RELEASE_LEVEL TCL_FINAL_RELEASE +#define ITCL_RELEASE_SERIAL 0 + +#define ITCL_VERSION "4.1" +#define ITCL_PATCH_LEVEL "4.1.0" + +/* + * A special definition used to allow this header file to be included from + * windows resource files so that they can obtain version information. + * RC_INVOKED is defined by default by the windows RC tool. + * + * Resource compilers don't like all the C stuff, like typedefs and function + * declarations, that occur below, so block them out. + */ + +#ifndef RC_INVOKED + +#define ITCL_NAMESPACE "::itcl" + +#ifndef ITCLAPI +#if defined(BUILD_itcl) +#define ITCLAPI MODULE_SCOPE +#else +#define ITCLAPI extern +#undef USE_ITCL_STUBS +#define USE_ITCL_STUBS 1 +#endif +#endif + +#if defined(BUILD_itcl) && !defined(STATIC_BUILD) +#define ITCL_EXTERN extern DLLEXPORT +#else +#define ITCL_EXTERN extern +#endif + +ITCL_EXTERN int Itcl_Init(Tcl_Interp* interp); +ITCL_EXTERN int Itcl_SafeInit(Tcl_Interp* interp); + +/* + * Protection levels: + * + * ITCL_PUBLIC - accessible from any namespace + * ITCL_PROTECTED - accessible from namespace that imports in "protected" mode + * ITCL_PRIVATE - accessible only within the namespace that contains it + */ +#define ITCL_PUBLIC 1 +#define ITCL_PROTECTED 2 +#define ITCL_PRIVATE 3 +#define ITCL_DEFAULT_PROTECT 4 + +/* + * Generic stack. + */ +typedef struct Itcl_Stack { + ClientData* values; /* values on stack */ + int len; /* number of values on stack */ + int max; /* maximum size of stack */ + ClientData space[5]; /* initial space for stack data */ +} Itcl_Stack; + +#define Itcl_GetStackSize(stackPtr) ((stackPtr)->len) + +/* + * Generic linked list. + */ +struct Itcl_List; +typedef struct Itcl_ListElem { + struct Itcl_List* owner; /* list containing this element */ + ClientData value; /* value associated with this element */ + struct Itcl_ListElem* prev; /* previous element in linked list */ + struct Itcl_ListElem* next; /* next element in linked list */ +} Itcl_ListElem; + +typedef struct Itcl_List { + int validate; /* validation stamp */ + int num; /* number of elements */ + struct Itcl_ListElem* head; /* previous element in linked list */ + struct Itcl_ListElem* tail; /* next element in linked list */ +} Itcl_List; + +#define Itcl_FirstListElem(listPtr) ((listPtr)->head) +#define Itcl_LastListElem(listPtr) ((listPtr)->tail) +#define Itcl_NextListElem(elemPtr) ((elemPtr)->next) +#define Itcl_PrevListElem(elemPtr) ((elemPtr)->prev) +#define Itcl_GetListLength(listPtr) ((listPtr)->num) +#define Itcl_GetListValue(elemPtr) ((elemPtr)->value) + +/* + * Token representing the state of an interpreter. + */ +typedef struct Itcl_InterpState_* Itcl_InterpState; + +/* + * Include all the public API, generated from itcl.decls. + */ + +#include "itclDecls.h" + +#ifdef ITCL_PRESERVE_DEBUG +#undef Itcl_PreserveData +#undef Itcl_ReleaseData +void ItclDbgPreserveData(ClientData cdata, int line, const char* file); +void ItclDbgReleaseData(ClientData cdata, int line, const char* file); +#define Itcl_PreserveData(addr) ItclDbgPreserveData(addr, __LINE__, __FILE__) +#define Itcl_ReleaseData(addr) ItclDbgReleaseData(addr, __LINE__, __FILE__) +#endif + +#endif /* RC_INVOKED */ + +/* + * end block for C++ + */ + +#ifdef __cplusplus +} +#endif + +#endif /* ITCL_H_INCLUDED */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/itcl2TclOO.h b/src_cpp/elfgames/tasks/elf2codingenv/include/itcl2TclOO.h new file mode 100644 index 0000000..b7a2cee --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/itcl2TclOO.h @@ -0,0 +1,75 @@ + +#ifndef _TCLINT +typedef void(ProcErrorProc)(Tcl_Interp* interp, Tcl_Obj* procNameObj); +#endif + +#ifndef TCL_OO_INTERNAL_H +typedef int(TclOO_PreCallProc)( + ClientData clientData, + Tcl_Interp* interp, + Tcl_ObjectContext context, + Tcl_CallFrame* framePtr, + int* isFinished); +typedef int(TclOO_PostCallProc)( + ClientData clientData, + Tcl_Interp* interp, + Tcl_ObjectContext context, + Tcl_Namespace* namespacePtr, + int result); +#endif + +MODULE_SCOPE int Itcl_NRRunCallbacks(Tcl_Interp* interp, void* rootPtr); +MODULE_SCOPE void* Itcl_GetCurrentCallbackPtr(Tcl_Interp* interp); +MODULE_SCOPE Tcl_Method Itcl_NewProcClassMethod( + Tcl_Interp* interp, + Tcl_Class clsPtr, + TclOO_PreCallProc* preCallPtr, + TclOO_PostCallProc* postCallPtr, + ProcErrorProc* errProc, + ClientData clientData, + Tcl_Obj* nameObj, + Tcl_Obj* argsObj, + Tcl_Obj* bodyObj, + ClientData* clientData2); +MODULE_SCOPE Tcl_Method Itcl_NewProcMethod( + Tcl_Interp* interp, + Tcl_Object oPtr, + TclOO_PreCallProc* preCallPtr, + TclOO_PostCallProc* postCallPtr, + ProcErrorProc* errProc, + ClientData clientData, + Tcl_Obj* nameObj, + Tcl_Obj* argsObj, + Tcl_Obj* bodyObj, + ClientData* clientData2); +MODULE_SCOPE int Itcl_PublicObjectCmd( + ClientData clientData, + Tcl_Interp* interp, + Tcl_Class clsPtr, + int objc, + Tcl_Obj* const* objv); +MODULE_SCOPE Tcl_Method Itcl_NewForwardClassMethod( + Tcl_Interp* interp, + Tcl_Class clsPtr, + int flags, + Tcl_Obj* nameObj, + Tcl_Obj* prefixObj); +MODULE_SCOPE int Itcl_SelfCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const* objv); +MODULE_SCOPE int Itcl_IsMethodCallFrame(Tcl_Interp* interp); +MODULE_SCOPE int Itcl_InvokeEnsembleMethod( + Tcl_Interp* interp, + Tcl_Namespace* nsPtr, + Tcl_Obj* namePtr, + Tcl_Proc* procPtr, + int objc, + Tcl_Obj* const* objv); +MODULE_SCOPE int Itcl_InvokeProcedureMethod( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const* objv); +MODULE_SCOPE void Itcl_IncrObjectRefCount(Tcl_Object ptr); diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/itclDecls.h b/src_cpp/elfgames/tasks/elf2codingenv/include/itclDecls.h new file mode 100644 index 0000000..740bcea --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/itclDecls.h @@ -0,0 +1,200 @@ +/* + * This file is (mostly) automatically generated from itcl.decls. + */ + +#ifndef _ITCLDECLS +#define _ITCLDECLS + +#if defined(USE_ITCL_STUBS) + +ITCLAPI const char* Itcl_InitStubs(Tcl_Interp*, const char* version, int exact); +#else + +#define Itcl_InitStubs(interp, version, exact) \ + Tcl_PkgRequire(interp, "itcl", version, exact) + +#endif + +/* !BEGIN!: Do not edit below this line. */ + +#define ITCL_STUBS_EPOCH 0 +#define ITCL_STUBS_REVISION 150 + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Exported function declarations: + */ + +/* Slot 0 is reserved */ +/* Slot 1 is reserved */ +/* 2 */ +ITCLAPI int Itcl_RegisterC( + Tcl_Interp* interp, + const char* name, + Tcl_CmdProc* proc, + ClientData clientData, + Tcl_CmdDeleteProc* deleteProc); +/* 3 */ +ITCLAPI int Itcl_RegisterObjC( + Tcl_Interp* interp, + const char* name, + Tcl_ObjCmdProc* proc, + ClientData clientData, + Tcl_CmdDeleteProc* deleteProc); +/* 4 */ +ITCLAPI int Itcl_FindC( + Tcl_Interp* interp, + const char* name, + Tcl_CmdProc** argProcPtr, + Tcl_ObjCmdProc** objProcPtr, + ClientData* cDataPtr); +/* 5 */ +ITCLAPI void Itcl_InitStack(Itcl_Stack* stack); +/* 6 */ +ITCLAPI void Itcl_DeleteStack(Itcl_Stack* stack); +/* 7 */ +ITCLAPI void Itcl_PushStack(ClientData cdata, Itcl_Stack* stack); +/* 8 */ +ITCLAPI ClientData Itcl_PopStack(Itcl_Stack* stack); +/* 9 */ +ITCLAPI ClientData Itcl_PeekStack(Itcl_Stack* stack); +/* 10 */ +ITCLAPI ClientData Itcl_GetStackValue(Itcl_Stack* stack, int pos); +/* 11 */ +ITCLAPI void Itcl_InitList(Itcl_List* listPtr); +/* 12 */ +ITCLAPI void Itcl_DeleteList(Itcl_List* listPtr); +/* 13 */ +ITCLAPI Itcl_ListElem* Itcl_CreateListElem(Itcl_List* listPtr); +/* 14 */ +ITCLAPI Itcl_ListElem* Itcl_DeleteListElem(Itcl_ListElem* elemPtr); +/* 15 */ +ITCLAPI Itcl_ListElem* Itcl_InsertList(Itcl_List* listPtr, ClientData val); +/* 16 */ +ITCLAPI Itcl_ListElem* Itcl_InsertListElem(Itcl_ListElem* pos, ClientData val); +/* 17 */ +ITCLAPI Itcl_ListElem* Itcl_AppendList(Itcl_List* listPtr, ClientData val); +/* 18 */ +ITCLAPI Itcl_ListElem* Itcl_AppendListElem(Itcl_ListElem* pos, ClientData val); +/* 19 */ +ITCLAPI void Itcl_SetListValue(Itcl_ListElem* elemPtr, ClientData val); +/* 20 */ +ITCLAPI void Itcl_EventuallyFree(ClientData cdata, Tcl_FreeProc* fproc); +/* 21 */ +ITCLAPI void Itcl_PreserveData(ClientData cdata); +/* 22 */ +ITCLAPI void Itcl_ReleaseData(ClientData cdata); +/* 23 */ +ITCLAPI Itcl_InterpState Itcl_SaveInterpState(Tcl_Interp* interp, int status); +/* 24 */ +ITCLAPI int Itcl_RestoreInterpState(Tcl_Interp* interp, Itcl_InterpState state); +/* 25 */ +ITCLAPI void Itcl_DiscardInterpState(Itcl_InterpState state); + +typedef struct { const struct ItclIntStubs* itclIntStubs; } ItclStubHooks; + +typedef struct ItclStubs { + int magic; + int epoch; + int revision; + const ItclStubHooks* hooks; + + void (*reserved0)(void); + void (*reserved1)(void); + int (*itcl_RegisterC)( + Tcl_Interp* interp, + const char* name, + Tcl_CmdProc* proc, + ClientData clientData, + Tcl_CmdDeleteProc* deleteProc); /* 2 */ + int (*itcl_RegisterObjC)( + Tcl_Interp* interp, + const char* name, + Tcl_ObjCmdProc* proc, + ClientData clientData, + Tcl_CmdDeleteProc* deleteProc); /* 3 */ + int (*itcl_FindC)( + Tcl_Interp* interp, + const char* name, + Tcl_CmdProc** argProcPtr, + Tcl_ObjCmdProc** objProcPtr, + ClientData* cDataPtr); /* 4 */ + void (*itcl_InitStack)(Itcl_Stack* stack); /* 5 */ + void (*itcl_DeleteStack)(Itcl_Stack* stack); /* 6 */ + void (*itcl_PushStack)(ClientData cdata, Itcl_Stack* stack); /* 7 */ + ClientData (*itcl_PopStack)(Itcl_Stack* stack); /* 8 */ + ClientData (*itcl_PeekStack)(Itcl_Stack* stack); /* 9 */ + ClientData (*itcl_GetStackValue)(Itcl_Stack* stack, int pos); /* 10 */ + void (*itcl_InitList)(Itcl_List* listPtr); /* 11 */ + void (*itcl_DeleteList)(Itcl_List* listPtr); /* 12 */ + Itcl_ListElem* (*itcl_CreateListElem)(Itcl_List* listPtr); /* 13 */ + Itcl_ListElem* (*itcl_DeleteListElem)(Itcl_ListElem* elemPtr); /* 14 */ + Itcl_ListElem* ( + *itcl_InsertList)(Itcl_List* listPtr, ClientData val); /* 15 */ + Itcl_ListElem* ( + *itcl_InsertListElem)(Itcl_ListElem* pos, ClientData val); /* 16 */ + Itcl_ListElem* ( + *itcl_AppendList)(Itcl_List* listPtr, ClientData val); /* 17 */ + Itcl_ListElem* ( + *itcl_AppendListElem)(Itcl_ListElem* pos, ClientData val); /* 18 */ + void (*itcl_SetListValue)(Itcl_ListElem* elemPtr, ClientData val); /* 19 */ + void (*itcl_EventuallyFree)(ClientData cdata, Tcl_FreeProc* fproc); /* 20 */ + void (*itcl_PreserveData)(ClientData cdata); /* 21 */ + void (*itcl_ReleaseData)(ClientData cdata); /* 22 */ + Itcl_InterpState ( + *itcl_SaveInterpState)(Tcl_Interp* interp, int status); /* 23 */ + int (*itcl_RestoreInterpState)( + Tcl_Interp* interp, + Itcl_InterpState state); /* 24 */ + void (*itcl_DiscardInterpState)(Itcl_InterpState state); /* 25 */ +} ItclStubs; + +extern const ItclStubs* itclStubsPtr; + +#ifdef __cplusplus +} +#endif + +#if defined(USE_ITCL_STUBS) + +/* + * Inline function declarations: + */ + +/* Slot 0 is reserved */ +/* Slot 1 is reserved */ +#define Itcl_RegisterC (itclStubsPtr->itcl_RegisterC) /* 2 */ +#define Itcl_RegisterObjC (itclStubsPtr->itcl_RegisterObjC) /* 3 */ +#define Itcl_FindC (itclStubsPtr->itcl_FindC) /* 4 */ +#define Itcl_InitStack (itclStubsPtr->itcl_InitStack) /* 5 */ +#define Itcl_DeleteStack (itclStubsPtr->itcl_DeleteStack) /* 6 */ +#define Itcl_PushStack (itclStubsPtr->itcl_PushStack) /* 7 */ +#define Itcl_PopStack (itclStubsPtr->itcl_PopStack) /* 8 */ +#define Itcl_PeekStack (itclStubsPtr->itcl_PeekStack) /* 9 */ +#define Itcl_GetStackValue (itclStubsPtr->itcl_GetStackValue) /* 10 */ +#define Itcl_InitList (itclStubsPtr->itcl_InitList) /* 11 */ +#define Itcl_DeleteList (itclStubsPtr->itcl_DeleteList) /* 12 */ +#define Itcl_CreateListElem (itclStubsPtr->itcl_CreateListElem) /* 13 */ +#define Itcl_DeleteListElem (itclStubsPtr->itcl_DeleteListElem) /* 14 */ +#define Itcl_InsertList (itclStubsPtr->itcl_InsertList) /* 15 */ +#define Itcl_InsertListElem (itclStubsPtr->itcl_InsertListElem) /* 16 */ +#define Itcl_AppendList (itclStubsPtr->itcl_AppendList) /* 17 */ +#define Itcl_AppendListElem (itclStubsPtr->itcl_AppendListElem) /* 18 */ +#define Itcl_SetListValue (itclStubsPtr->itcl_SetListValue) /* 19 */ +#define Itcl_EventuallyFree (itclStubsPtr->itcl_EventuallyFree) /* 20 */ +#define Itcl_PreserveData (itclStubsPtr->itcl_PreserveData) /* 21 */ +#define Itcl_ReleaseData (itclStubsPtr->itcl_ReleaseData) /* 22 */ +#define Itcl_SaveInterpState (itclStubsPtr->itcl_SaveInterpState) /* 23 */ +#define Itcl_RestoreInterpState (itclStubsPtr->itcl_RestoreInterpState) /* 24 \ + */ +#define Itcl_DiscardInterpState (itclStubsPtr->itcl_DiscardInterpState) /* 25 \ + */ + +#endif /* defined(USE_ITCL_STUBS) */ + +/* !END!: Do not edit above this line. */ + +#endif /* _ITCLDECLS */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/itclInt.h b/src_cpp/elfgames/tasks/elf2codingenv/include/itclInt.h new file mode 100644 index 0000000..461ab69 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/itclInt.h @@ -0,0 +1,995 @@ +/* + * itclInt.h -- + * + * This file contains internal definitions for the C-implemented part of a + * Itcl + * + * Copyright (c) 2007 by Arnulf P. Wiedemann + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_STDINT_H +#include +#endif + +/* + * Used to tag functions that are only to be visible within the module being + * built and not outside it (where this is supported by the linker). + */ + +#ifndef MODULE_SCOPE +#ifdef __cplusplus +#define MODULE_SCOPE extern "C" +#else +#define MODULE_SCOPE extern +#endif +#endif + +#include +#include +#include +#include "itcl.h" +#include "itclMigrate2TclCore.h" +#include "itclTclIntStubsFcn.h" + +/* + * Utility macros: STRINGIFY takes an argument and wraps it in "" (double + * quotation marks). + */ + +#ifndef STRINGIFY +#define STRINGIFY(x) STRINGIFY1(x) +#define STRINGIFY1(x) #x +#endif + +/* + * Since the Tcl/Tk distribution doesn't perform any asserts, + * dynamic loading can fail to find the __assert function. + * As a workaround, we'll include our own. + */ + +#undef assert +#define DEBUG 1 +#ifndef DEBUG +#define assert(EX) ((void)0) +#else +#define assert(EX) \ + (void)((EX) || (Itcl_Assert(STRINGIFY(EX), __FILE__, __LINE__), 0)) +#endif /* DEBUG */ + +#define ITCL_INTERP_DATA "itcl_data" +#define ITCL_TK_VERSION "8.6" + +/* + * Convenience macros for iterating through hash tables. FOREACH_HASH_DECLS + * sets up the declarations needed for the main macro, FOREACH_HASH, which + * does the actual iteration. FOREACH_HASH_VALUE is a restricted version that + * only iterates over values. + */ + +#define FOREACH_HASH_DECLS \ + Tcl_HashEntry* hPtr; \ + Tcl_HashSearch search +#define FOREACH_HASH(key, val, tablePtr) \ + for (hPtr = Tcl_FirstHashEntry((tablePtr), &search); \ + hPtr != NULL ? ((key) = (void*)Tcl_GetHashKey((tablePtr), hPtr), \ + (val) = Tcl_GetHashValue(hPtr), \ + 1) \ + : 0; \ + hPtr = Tcl_NextHashEntry(&search)) +#define FOREACH_HASH_VALUE(val, tablePtr) \ + for (hPtr = Tcl_FirstHashEntry((tablePtr), &search); \ + hPtr != NULL ? ((val) = Tcl_GetHashValue(hPtr), 1) : 0; \ + hPtr = Tcl_NextHashEntry(&search)) + +/* + * What sort of size of things we like to allocate. + */ + +#define ALLOC_CHUNK 8 + +#define ITCL_VARIABLES_NAMESPACE "::itcl::internal::variables" +#define ITCL_COMMANDS_NAMESPACE "::itcl::internal::commands" + +#ifdef ITCL_PRESERVE_DEBUG +#define ITCL_PRESERVE_BUCKET_SIZE 50 +#define ITCL_PRESERVE_INCR 1 +#define ITCL_PRESERVE_DECR -1 +#define ITCL_PRESERVE_DELETED 0 + +typedef struct ItclPreserveInfoEntry { + int type; + int line; + const char* fileName; +} ItclPreserveInfoEntry; + +typedef struct ItclPreserveInfo { + int refCount; + ClientData clientData; + int size; + int numEntries; + ItclPreserveInfoEntry* entries; +} ItclPreserveInfo; + +#endif + +typedef struct ItclFoundation { + Itcl_Stack methodCallStack; + Tcl_Command dispatchCommand; +} ItclFoundation; + +typedef struct ItclArgList { + struct ItclArgList* nextPtr; /* pointer to next argument */ + Tcl_Obj* namePtr; /* name of the argument */ + Tcl_Obj* defaultValuePtr; /* default value or NULL if none */ +} ItclArgList; + +/* + * Common info for managing all known objects. + * Each interpreter has one of these data structures stored as + * clientData in the "itcl" namespace. It is also accessible + * as associated data via the key ITCL_INTERP_DATA. + */ +struct ItclClass; +struct ItclObject; +struct ItclMemberFunc; +struct EnsembleInfo; +struct ItclDelegatedOption; +struct ItclDelegatedFunction; + +typedef struct ItclObjectInfo { + Tcl_Interp* interp; /* interpreter that manages this info */ + Tcl_HashTable objects; /* list of all known objects key is + * ioPtr */ + Tcl_HashTable objectCmds; /* list of known objects using accessCmd */ + Tcl_HashTable unused5; /* list of known objects using namePtr */ + Tcl_HashTable classes; /* list of all known classes, + * key is iclsPtr */ + Tcl_HashTable nameClasses; /* maps from fullNamePtr to iclsPtr */ + Tcl_HashTable namespaceClasses; /* maps from nsPtr to iclsPtr */ + Tcl_HashTable procMethods; /* maps from procPtr to mFunc */ + Tcl_HashTable instances; /* maps from instanceNumber to ioPtr */ + Tcl_HashTable unused8; /* maps from ioPtr to instanceNumber */ + Tcl_HashTable frameContext; /* maps frame to context stack */ + Tcl_HashTable classTypes; /* maps from class type i.e. "widget" + * to define value i.e. ITCL_WIDGET */ + int protection; /* protection level currently in effect */ + int useOldResolvers; /* whether to use the "old" style + * resolvers or the CallFrame resolvers */ + Itcl_Stack clsStack; /* stack of class definitions currently + * being parsed */ + Itcl_Stack unused; /* Removed */ + Itcl_Stack unused6; /* obsolete field */ + struct ItclObject* currIoPtr; /* object currently being constructed + * set only during calling of constructors + * otherwise NULL */ + Tcl_ObjectMetadataType* class_meta_type; + /* type for getting the Itcl class info + * from a TclOO Tcl_Object */ + const Tcl_ObjectMetadataType* object_meta_type; + /* type for getting the Itcl object info + * from a TclOO Tcl_Object */ + Tcl_Object unused1; /* the root object of Itcl */ + Tcl_Class clazzClassPtr; /* the root class of Itcl */ + struct EnsembleInfo* ensembleInfo; + struct ItclClass* currContextIclsPtr; + /* context class for delegated option + * handling */ + int currClassFlags; /* flags for the class just in creation */ + int buildingWidget; /* set if in construction of a widget */ + int unparsedObjc; /* number options not parsed by + ItclExtendedConfigure/-Cget function */ + Tcl_Obj** unparsedObjv; /* options not parsed by + ItclExtendedConfigure/-Cget function */ + int functionFlags; /* used for creating of ItclMemberCode */ + int unused7; /* used for having a unique key for objects + * for use in mytypemethod etc. */ + struct ItclDelegatedOption* currIdoPtr; + /* the current delegated option info */ + int inOptionHandling; /* used to indicate for type/widget ... + * that there is an option processing + * and methods are allowed to be called */ + /* these are the Tcl_Obj Ptrs for the clazz unknown procedure */ + /* need to store them to be able to free them at the end */ + int itclWidgetInitted; /* set to 1 if itclWidget.tcl has already + * been called + */ + int itclHullCmdsInitted; /* set to 1 if itclHullCmds.tcl has already + * been called + */ + Tcl_Obj* unused2; + Tcl_Obj* unused3; + Tcl_Obj* unused4; + Tcl_Obj* infoVarsPtr; + Tcl_Obj* infoVars3Ptr; + Tcl_Obj* infoVars4Ptr; + Tcl_Obj* typeDestructorArgumentPtr; + struct ItclObject* lastIoPtr; /* last object constructed */ + Tcl_Command infoCmd; +} ItclObjectInfo; + +typedef struct EnsembleInfo { + Tcl_HashTable ensembles; /* list of all known ensembles */ + Tcl_HashTable subEnsembles; /* list of all known subensembles */ + int numEnsembles; + Tcl_Namespace* ensembleNsPtr; +} EnsembleInfo; +/* + * Representation for each [incr Tcl] class. + */ +#define ITCL_CLASS 0x1 +#define ITCL_TYPE 0x2 +#define ITCL_WIDGET 0x4 +#define ITCL_WIDGETADAPTOR 0x8 +#define ITCL_ECLASS 0x10 +#define ITCL_NWIDGET 0x20 +#define ITCL_WIDGET_FRAME 0x40 +#define ITCL_WIDGET_LABEL_FRAME 0x80 +#define ITCL_WIDGET_TOPLEVEL 0x100 +#define ITCL_WIDGET_TTK_FRAME 0x200 +#define ITCL_WIDGET_TTK_LABEL_FRAME 0x400 +#define ITCL_WIDGET_TTK_TOPLEVEL 0x800 +#define ITCL_CLASS_IS_DELETED 0x1000 +#define ITCL_CLASS_IS_DESTROYED 0x2000 +#define ITCL_CLASS_NS_IS_DESTROYED 0x4000 +#define ITCL_CLASS_IS_RENAMED 0x8000 +#define ITCL_CLASS_IS_FREED 0x10000 +#define ITCL_CLASS_DERIVED_RELEASED 0x20000 +#define ITCL_CLASS_NS_TEARDOWN 0x40000 +#define ITCL_CLASS_NO_VARNS_DELETE 0x80000 +#define ITCL_CLASS_SHOULD_VARNS_DELETE 0x100000 +#define ITCL_CLASS_DESTRUCTOR_CALLED 0x400000 + +typedef struct ItclClass { + Tcl_Obj* namePtr; /* class name */ + Tcl_Obj* fullNamePtr; /* fully qualified class name */ + Tcl_Interp* interp; /* interpreter that manages this info */ + Tcl_Namespace* nsPtr; /* namespace representing class scope */ + Tcl_Command accessCmd; /* access command for creating instances */ + Tcl_Command thisCmd; /* needed for deletion of class */ + + struct ItclObjectInfo* infoPtr; + /* info about all known objects + * and other stuff like stacks */ + Itcl_List bases; /* list of base classes */ + Itcl_List derived; /* list of all derived classes */ + Tcl_HashTable heritage; /* table of all base classes. Look up + * by pointer to class definition. This + * provides fast lookup for inheritance + * tests. */ + Tcl_Obj* initCode; /* initialization code for new objs */ + Tcl_HashTable variables; /* definitions for all data members + in this class. Look up simple string + names and get back ItclVariable* ptrs */ + Tcl_HashTable options; /* definitions for all option members + in this class. Look up simple string + names and get back ItclOption* ptrs */ + Tcl_HashTable components; /* definitions for all component members + in this class. Look up simple string + names and get back ItclComponent* ptrs */ + Tcl_HashTable functions; /* definitions for all member functions + in this class. Look up simple string + names and get back ItclMemberFunc* ptrs */ + Tcl_HashTable delegatedOptions; /* definitions for all delegated options + in this class. Look up simple string + names and get back + ItclDelegatedOption * ptrs */ + Tcl_HashTable delegatedFunctions; /* definitions for all delegated methods + or procs in this class. Look up simple + string names and get back + ItclDelegatedFunction * ptrs */ + Tcl_HashTable methodVariables; /* definitions for all methodvariable members + in this class. Look up simple string + names and get back + ItclMethodVariable* ptrs */ + int numInstanceVars; /* number of instance vars in variables + table */ + Tcl_HashTable classCommons; /* used for storing variable namespace + * string for Tcl_Resolve */ + Tcl_HashTable resolveVars; /* all possible names for variables in + * this class (e.g., x, foo::x, etc.) */ + Tcl_HashTable resolveCmds; /* all possible names for functions in + * this class (e.g., x, foo::x, etc.) */ + Tcl_HashTable contextCache; /* cache for function contexts */ + struct ItclMemberFunc* unused2; + /* the class constructor or NULL */ + struct ItclMemberFunc* unused3; + /* the class destructor or NULL */ + struct ItclMemberFunc* unused1; + Tcl_Resolve* resolvePtr; + Tcl_Obj* widgetClassPtr; /* class name for widget if class is a + * ::itcl::widget */ + Tcl_Obj* hullTypePtr; /* hulltype name for widget if class is a + * ::itcl::widget */ + Tcl_Object oPtr; /* TclOO class object */ + Tcl_Class clsPtr; /* TclOO class */ + int numCommons; /* number of commons in this class */ + int numVariables; /* number of variables in this class */ + int numOptions; /* number of options in this class */ + int unique; /* unique number for #auto generation */ + int flags; /* maintains class status */ + int callRefCount; /* prevent deleting of class if refcount>1 */ + Tcl_Obj* typeConstructorPtr; /* initialization for types */ + int destructorHasBeenCalled; /* prevent multiple invocations of destrcutor */ + int refCount; +} ItclClass; + +typedef struct ItclHierIter { + ItclClass* current; /* current position in hierarchy */ + Itcl_Stack stack; /* stack used for traversal */ +} ItclHierIter; + +#define ITCL_OBJECT_IS_DELETED 0x01 +#define ITCL_OBJECT_IS_DESTRUCTED 0x02 +#define ITCL_OBJECT_IS_DESTROYED 0x04 +#define ITCL_OBJECT_IS_RENAMED 0x08 +#define ITCL_OBJECT_CLASS_DESTRUCTED 0x10 +#define ITCL_TCLOO_OBJECT_IS_DELETED 0x20 +#define ITCL_OBJECT_DESTRUCT_ERROR 0x40 +#define ITCL_OBJECT_SHOULD_VARNS_DELETE 0x80 +#define ITCL_OBJECT_ROOT_METHOD 0x8000 + +/* + * Representation for each [incr Tcl] object. + */ +typedef struct ItclObject { + ItclClass* iclsPtr; /* most-specific class */ + Tcl_Command accessCmd; /* object access command */ + + Tcl_HashTable* constructed; /* temp storage used during construction */ + Tcl_HashTable* destructed; /* temp storage used during destruction */ + Tcl_HashTable objectVariables; + /* used for storing Tcl_Var entries for + * variable resolving, key is ivPtr of + * variable, value is varPtr */ + Tcl_HashTable objectOptions; /* definitions for all option members + in this object. Look up option namePtr + names and get back ItclOption* ptrs */ + Tcl_HashTable objectComponents; /* definitions for all component members + in this object. Look up component namePtr + names and get back ItclComponent* ptrs */ + Tcl_HashTable objectMethodVariables; + /* definitions for all methodvariable members + in this object. Look up methodvariable + namePtr names and get back + ItclMethodVariable* ptrs */ + Tcl_HashTable objectDelegatedOptions; + /* definitions for all delegated option + members in this object. Look up option + namePtr names and get back + ItclOption* ptrs */ + Tcl_HashTable objectDelegatedFunctions; + /* definitions for all delegated function + members in this object. Look up function + namePtr names and get back + ItclMemberFunc * ptrs */ + Tcl_HashTable contextCache; /* cache for function contexts */ + Tcl_Obj* namePtr; + Tcl_Obj* origNamePtr; /* the original name before any rename */ + Tcl_Obj* createNamePtr; /* the temp name before any rename + * mostly used for widgetadaptor + * because that hijackes the name + * often when installing the hull */ + Tcl_Interp* interp; + ItclObjectInfo* infoPtr; + Tcl_Obj* varNsNamePtr; + Tcl_Object oPtr; /* the TclOO object */ + Tcl_Resolve* resolvePtr; + int flags; + int callRefCount; /* prevent deleting of object if refcount > 1 */ + Tcl_Obj* hullWindowNamePtr; /* the window path name for the hull + * (before renaming in installhull) */ + int destructorHasBeenCalled; /* is set when the destructor is called + * to avoid callin destructor twice */ + int noComponentTrace; /* don't call component traces if + * setting components in DelegationInstall */ + int hadConstructorError; /* needed for multiple calls of CallItclObjectCmd */ +} ItclObject; + +#define ITCL_IGNORE_ERRS 0x002 /* useful for construction/destruction */ + +typedef struct ItclResolveInfo { + int flags; + ItclClass* iclsPtr; + ItclObject* ioPtr; +} ItclResolveInfo; + +#define ITCL_RESOLVE_CLASS 0x01 +#define ITCL_RESOLVE_OBJECT 0x02 + +/* + * Implementation for any code body in an [incr Tcl] class. + */ +typedef struct ItclMemberCode { + int flags; /* flags describing implementation */ + int argcount; /* number of args in arglist */ + int maxargcount; /* max number of args in arglist */ + Tcl_Obj* usagePtr; /* usage string for error messages */ + Tcl_Obj* argumentPtr; /* the function arguments */ + Tcl_Obj* bodyPtr; /* the function body */ + ItclArgList* argListPtr; /* the parsed arguments */ + union { + Tcl_CmdProc* argCmd; /* (argc,argv) C implementation */ + Tcl_ObjCmdProc* objCmd; /* (objc,objv) C implementation */ + } cfunc; + ClientData clientData; /* client data for C implementations */ +} ItclMemberCode; + +/* + * Flag bits for ItclMemberCode: + */ +#define ITCL_IMPLEMENT_NONE 0x001 /* no implementation */ +#define ITCL_IMPLEMENT_TCL 0x002 /* Tcl implementation */ +#define ITCL_IMPLEMENT_ARGCMD 0x004 /* (argc,argv) C implementation */ +#define ITCL_IMPLEMENT_OBJCMD 0x008 /* (objc,objv) C implementation */ +#define ITCL_IMPLEMENT_C 0x00c /* either kind of C implementation */ + +#define Itcl_IsMemberCodeImplemented(mcode) \ + (((mcode)->flags & ITCL_IMPLEMENT_NONE) == 0) + +/* + * Flag bits for ItclMember: functions and variables + */ +#define ITCL_COMMON \ + 0x010 /* non-zero => is a "proc" or common \ + * variable */ + +/* + * Flag bits for ItclMember: functions + */ +#define ITCL_CONSTRUCTOR 0x020 /* non-zero => is a constructor */ +#define ITCL_DESTRUCTOR 0x040 /* non-zero => is a destructor */ +#define ITCL_ARG_SPEC 0x080 /* non-zero => has an argument spec */ +#define ITCL_BODY_SPEC 0x100 /* non-zero => has an body spec */ +#define ITCL_BUILTIN 0x400 /* non-zero => built-in method */ +#define ITCL_COMPONENT 0x800 /* non-zero => component */ +#define ITCL_TYPE_METHOD 0x1000 /* non-zero => typemethod */ +#define ITCL_METHOD 0x2000 /* non-zero => method */ + +/* + * Flag bits for ItclMember: variables + */ +#define ITCL_THIS_VAR 0x20 /* non-zero => built-in "this" variable */ +#define ITCL_OPTIONS_VAR \ + 0x40 /* non-zero => built-in "itcl_options" \ + * variable */ +#define ITCL_TYPE_VAR 0x80 /* non-zero => built-in "type" variable */ +/* no longer used ??? */ +#define ITCL_SELF_VAR 0x100 /* non-zero => built-in "self" variable */ +#define ITCL_SELFNS_VAR \ + 0x200 /* non-zero => built-in "selfns" \ + * variable */ +#define ITCL_WIN_VAR 0x400 /* non-zero => built-in "win" variable */ +#define ITCL_COMPONENT_VAR 0x800 /* non-zero => component variable */ +#define ITCL_HULL_VAR \ + 0x1000 /* non-zero => built-in "itcl_hull" \ + * variable */ +#define ITCL_OPTION_READONLY 0x2000 /* non-zero => readonly */ +#define ITCL_VARIABLE 0x4000 /* non-zero => normal variable */ +#define ITCL_TYPE_VARIABLE 0x8000 /* non-zero => typevariable */ +#define ITCL_OPTION_INITTED \ + 0x10000 /* non-zero => option has been initialized */ +#define ITCL_OPTION_COMP_VAR \ + 0x20000 /* variable to collect option components of extendedclass */ + +/* + * Instance components. + */ +struct ItclVariable; +typedef struct ItclComponent { + Tcl_Obj* namePtr; /* member name */ + struct ItclVariable* ivPtr; /* variable for this component */ + int flags; + int haveKeptOptions; + Tcl_HashTable keptOptions; /* table of options to keep */ +} ItclComponent; + +#define ITCL_COMPONENT_INHERIT 0x01 +#define ITCL_COMPONENT_PUBLIC 0x02 + +typedef struct ItclDelegatedFunction { + Tcl_Obj* namePtr; + ItclComponent* icPtr; + Tcl_Obj* asPtr; + Tcl_Obj* usingPtr; + Tcl_HashTable exceptions; + int flags; +} ItclDelegatedFunction; + +/* + * Representation of member functions in an [incr Tcl] class. + */ +typedef struct ItclMemberFunc { + Tcl_Obj* namePtr; /* member name */ + Tcl_Obj* fullNamePtr; /* member name with "class::" qualifier */ + ItclClass* iclsPtr; /* class containing this member */ + int protection; /* protection level */ + int flags; /* flags describing member (see above) */ + ItclObjectInfo* infoPtr; + ItclMemberCode* codePtr; /* code associated with member */ + Tcl_Command accessCmd; /* Tcl command installed for this function */ + int argcount; /* number of args in arglist */ + int maxargcount; /* max number of args in arglist */ + Tcl_Obj* usagePtr; /* usage string for error messages */ + Tcl_Obj* argumentPtr; /* the function arguments */ + Tcl_Obj* + builtinArgumentPtr; /* the function arguments for builtin functions */ + Tcl_Obj* origArgsPtr; /* the argument string of the original definition */ + Tcl_Obj* bodyPtr; /* the function body */ + ItclArgList* argListPtr; /* the parsed arguments */ + ItclClass* declaringClassPtr; /* the class which declared the method/proc */ + ClientData tmPtr; /* TclOO methodPtr */ + ItclDelegatedFunction* idmPtr; + /* if the function is delegated != NULL */ + int refCount; +} ItclMemberFunc; + +/* + * Instance variables. + */ +typedef struct ItclVariable { + Tcl_Obj* namePtr; /* member name */ + Tcl_Obj* fullNamePtr; /* member name with "class::" qualifier */ + ItclClass* iclsPtr; /* class containing this member */ + ItclObjectInfo* infoPtr; + ItclMemberCode* codePtr; /* code associated with member */ + Tcl_Obj* init; /* initial value */ + Tcl_Obj* arrayInitPtr; /* initial value if variable should be array */ + int protection; /* protection level */ + int flags; /* flags describing member (see below) */ + int initted; /* is set when first time initted, to check + * for example itcl_hull var, which can be only + * initialized once */ +} ItclVariable; + +struct ItclOption; + +typedef struct ItclDelegatedOption { + Tcl_Obj* namePtr; + Tcl_Obj* resourceNamePtr; + Tcl_Obj* classNamePtr; + struct ItclOption* ioptPtr; /* the option name or null for "*" */ + ItclComponent* icPtr; /* the component where the delegation goes + * to */ + Tcl_Obj* asPtr; + Tcl_HashTable exceptions; /* exceptions from delegation */ +} ItclDelegatedOption; + +/* + * Instance options. + */ +typedef struct ItclOption { + /* within a class hierarchy there must be only + * one option with the same name !! */ + Tcl_Obj* namePtr; /* member name */ + Tcl_Obj* fullNamePtr; /* member name with "class::" qualifier */ + Tcl_Obj* resourceNamePtr; + Tcl_Obj* classNamePtr; + ItclClass* iclsPtr; /* class containing this member */ + int protection; /* protection level */ + int flags; /* flags describing member (see below) */ + ItclMemberCode* codePtr; /* code associated with member */ + Tcl_Obj* defaultValuePtr; /* initial value */ + Tcl_Obj* cgetMethodPtr; + Tcl_Obj* cgetMethodVarPtr; + Tcl_Obj* configureMethodPtr; + Tcl_Obj* configureMethodVarPtr; + Tcl_Obj* validateMethodPtr; + Tcl_Obj* validateMethodVarPtr; + ItclDelegatedOption* idoPtr; + /* if the option is delegated != NULL */ +} ItclOption; + +/* + * Instance methodvariables. + */ +typedef struct ItclMethodVariable { + Tcl_Obj* namePtr; /* member name */ + Tcl_Obj* fullNamePtr; /* member name with "class::" qualifier */ + ItclClass* iclsPtr; /* class containing this member */ + int protection; /* protection level */ + int flags; /* flags describing member (see below) */ + Tcl_Obj* defaultValuePtr; + Tcl_Obj* callbackPtr; +} ItclMethodVariable; + +#define VAR_TYPE_VARIABLE 1 +#define VAR_TYPE_COMMON 2 + +typedef struct ItclClassVarInfo { + int type; + int protection; + int varNum; + Tcl_Namespace* nsPtr; + Tcl_Namespace* declaringNsPtr; +} ItclClassVarInfo; + +#define CMD_TYPE_METHOD 1 +#define CMD_TYPE_PROC 2 + +typedef struct ItclClassCmdInfo { + int type; + int protection; + int cmdNum; + Tcl_Namespace* nsPtr; + Tcl_Namespace* declaringNsPtr; +} ItclClassCmdInfo; + +/* + * Instance variable lookup entry. + */ +typedef struct ItclVarLookup { + ItclVariable* ivPtr; /* variable definition */ + int usage; /* number of uses for this record */ + int accessible; /* non-zero => accessible from class with + * this lookup record in its resolveVars */ + char* leastQualName; /* simplist name for this variable, with + * the fewest qualifiers. This string is + * taken from the resolveVars table, so + * it shouldn't be freed. */ + int varNum; + ItclClassVarInfo* classVarInfoPtr; + Tcl_Var varPtr; +} ItclVarLookup; + +/* + * Instance command lookup entry. + */ +typedef struct ItclCmdLookup { + ItclMemberFunc* imPtr; /* function definition */ + int cmdNum; + ItclClassCmdInfo* classCmdInfoPtr; + Tcl_Command cmdPtr; +} ItclCmdLookup; + +typedef struct ItclCallContext { + int objectFlags; + Tcl_Namespace* nsPtr; + ItclObject* ioPtr; + ItclMemberFunc* imPtr; + int refCount; +} ItclCallContext; + +/* + * The macro below is used to modify a "char" value (e.g. by casting + * it to an unsigned character) so that it can be used safely with + * macros such as isspace. + */ + +#define UCHAR(c) ((unsigned char)(c)) +/* + * Macros used to cast between pointers and integers (e.g. when storing an int + * in ClientData), on 64-bit architectures they avoid gcc warning about "cast + * to/from pointer from/to integer of different size". + */ + +#if !defined(INT2PTR) && !defined(PTR2INT) +#if defined(HAVE_INTPTR_T) || defined(intptr_t) +#define INT2PTR(p) ((void*)(intptr_t)(p)) +#define PTR2INT(p) ((int)(intptr_t)(p)) +#else +#define INT2PTR(p) ((void*)(p)) +#define PTR2INT(p) ((int)(p)) +#endif +#endif + +#ifdef ITCL_DEBUG +MODULE_SCOPE int _itcl_debug_level; +MODULE_SCOPE void +ItclShowArgs(int level, const char* str, int objc, Tcl_Obj* const* objv); +#else +#define ItclShowArgs(a, b, c, d) +#endif + +MODULE_SCOPE Tcl_ObjCmdProc ItclCallCCommand; +MODULE_SCOPE Tcl_ObjCmdProc ItclObjectUnknownCommand; +MODULE_SCOPE int ItclCheckCallProc( + ClientData clientData, + Tcl_Interp* interp, + Tcl_ObjectContext contextPtr, + Tcl_CallFrame* framePtr, + int* isFinished); + +MODULE_SCOPE void ItclPreserveIMF(ItclMemberFunc* imPtr); +MODULE_SCOPE void ItclReleaseIMF(ClientData imPtr); + +MODULE_SCOPE void ItclPreserveClass(ItclClass* iclsPtr); +MODULE_SCOPE void ItclReleaseClass(ClientData iclsPtr); + +MODULE_SCOPE ItclFoundation* ItclGetFoundation(Tcl_Interp* interp); +MODULE_SCOPE Tcl_ObjCmdProc ItclClassCommandDispatcher; +MODULE_SCOPE Tcl_Command Itcl_CmdAliasProc( + Tcl_Interp* interp, + Tcl_Namespace* nsPtr, + const char* cmdName, + ClientData clientData); +MODULE_SCOPE Tcl_Var Itcl_VarAliasProc( + Tcl_Interp* interp, + Tcl_Namespace* nsPtr, + const char* VarName, + ClientData clientData); +MODULE_SCOPE int ItclIsClass(Tcl_Interp* interp, Tcl_Command cmd); +MODULE_SCOPE int ItclCheckCallMethod( + ClientData clientData, + Tcl_Interp* interp, + Tcl_ObjectContext contextPtr, + Tcl_CallFrame* framePtr, + int* isFinished); +MODULE_SCOPE int ItclAfterCallMethod( + ClientData clientData, + Tcl_Interp* interp, + Tcl_ObjectContext contextPtr, + Tcl_Namespace* nsPtr, + int result); +MODULE_SCOPE void ItclReportObjectUsage( + Tcl_Interp* interp, + ItclObject* contextIoPtr, + Tcl_Namespace* callerNsPtr, + Tcl_Namespace* contextNsPtr); +MODULE_SCOPE int ItclMapMethodNameProc( + Tcl_Interp* interp, + Tcl_Object oPtr, + Tcl_Class* startClsPtr, + Tcl_Obj* methodObj); +MODULE_SCOPE int ItclCreateArgList( + Tcl_Interp* interp, + const char* str, + int* argcPtr, + int* maxArgcPtr, + Tcl_Obj** usagePtr, + ItclArgList** arglistPtrPtr, + ItclMemberFunc* imPtr, + const char* commandName); +MODULE_SCOPE int ItclObjectCmd( + ClientData clientData, + Tcl_Interp* interp, + Tcl_Object oPtr, + Tcl_Class clsPtr, + int objc, + Tcl_Obj* const* objv); +MODULE_SCOPE int ItclCreateObject( + Tcl_Interp* interp, + const char* name, + ItclClass* iclsPtr, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE void ItclDeleteObjectVariablesNamespace( + Tcl_Interp* interp, + ItclObject* ioPtr); +MODULE_SCOPE void ItclDeleteClassVariablesNamespace( + Tcl_Interp* interp, + ItclClass* iclsPtr); +MODULE_SCOPE int ItclInfoInit(Tcl_Interp* interp, ItclObjectInfo* infoPtr); + +struct Tcl_ResolvedVarInfo; +MODULE_SCOPE int Itcl_ClassCmdResolver( + Tcl_Interp* interp, + const char* name, + Tcl_Namespace* nsPtr, + int flags, + Tcl_Command* rPtr); +MODULE_SCOPE int Itcl_ClassVarResolver( + Tcl_Interp* interp, + const char* name, + Tcl_Namespace* nsPtr, + int flags, + Tcl_Var* rPtr); +MODULE_SCOPE int Itcl_ClassCompiledVarResolver( + Tcl_Interp* interp, + const char* name, + int length, + Tcl_Namespace* nsPtr, + struct Tcl_ResolvedVarInfo** rPtr); +MODULE_SCOPE int Itcl_ClassCmdResolver2( + Tcl_Interp* interp, + const char* name, + Tcl_Namespace* nsPtr, + int flags, + Tcl_Command* rPtr); +MODULE_SCOPE int Itcl_ClassVarResolver2( + Tcl_Interp* interp, + const char* name, + Tcl_Namespace* nsPtr, + int flags, + Tcl_Var* rPtr); +MODULE_SCOPE int Itcl_ClassCompiledVarResolver2( + Tcl_Interp* interp, + const char* name, + int length, + Tcl_Namespace* nsPtr, + struct Tcl_ResolvedVarInfo** rPtr); +MODULE_SCOPE int ItclSetParserResolver(Tcl_Namespace* nsPtr); +MODULE_SCOPE void ItclProcErrorProc(Tcl_Interp* interp, Tcl_Obj* procNameObj); +MODULE_SCOPE int +Itcl_CreateOption(Tcl_Interp* interp, ItclClass* iclsPtr, ItclOption* ioptPtr); +MODULE_SCOPE int Itcl_CreateMethodVariable( + Tcl_Interp* interp, + ItclClass* iclsPtr, + Tcl_Obj* name, + Tcl_Obj* defaultPtr, + Tcl_Obj* callbackPtr, + ItclMethodVariable** imvPtr); +MODULE_SCOPE int +DelegationInstall(Tcl_Interp* interp, ItclObject* ioPtr, ItclClass* iclsPtr); +MODULE_SCOPE const char* ItclGetCommonInstanceVar( + Tcl_Interp* interp, + const char* name, + const char* name2, + ItclObject* contextIoPtr, + ItclClass* contextIclsPtr); +MODULE_SCOPE int ItclCreateMethod( + Tcl_Interp* interp, + ItclClass* iclsPtr, + Tcl_Obj* namePtr, + const char* arglist, + const char* body, + ItclMemberFunc** imPtrPtr); +MODULE_SCOPE int Itcl_WidgetParseInit( + Tcl_Interp* interp, + ItclObjectInfo* infoPtr); +MODULE_SCOPE void ItclDeleteObjectMetadata(ClientData clientData); +MODULE_SCOPE void ItclDeleteClassMetadata(ClientData clientData); +MODULE_SCOPE void ItclDeleteArgList(ItclArgList* arglistPtr); +MODULE_SCOPE int Itcl_ClassOptionCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int DelegatedOptionsInstall( + Tcl_Interp* interp, + ItclClass* iclsPtr); +MODULE_SCOPE int Itcl_HandleDelegateOptionCmd( + Tcl_Interp* interp, + ItclObject* ioPtr, + ItclClass* iclsPtr, + ItclDelegatedOption** idoPtrPtr, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Itcl_HandleDelegateMethodCmd( + Tcl_Interp* interp, + ItclObject* ioPtr, + ItclClass* iclsPtr, + ItclDelegatedFunction** idmPtrPtr, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int DelegateFunction( + Tcl_Interp* interp, + ItclObject* ioPtr, + ItclClass* iclsPtr, + Tcl_Obj* componentNamePtr, + ItclDelegatedFunction* idmPtr); +MODULE_SCOPE int ItclInitObjectMethodVariables( + Tcl_Interp* interp, + ItclObject* ioPtr, + ItclClass* iclsPtr, + const char* name); +MODULE_SCOPE int InitTclOOFunctionPointers(Tcl_Interp* interp); +MODULE_SCOPE ItclOption* ItclNewOption( + Tcl_Interp* interp, + ItclObject* ioPtr, + ItclClass* iclsPtr, + Tcl_Obj* namePtr, + const char* resourceName, + const char* className, + char* init, + ItclMemberCode* mCodePtr); +MODULE_SCOPE int ItclParseOption( + ItclObjectInfo* infoPtr, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[], + ItclClass* iclsPtr, + ItclObject* ioPtr, + ItclOption** ioptPtrPtr); +MODULE_SCOPE void ItclDestroyClassNamesp(ClientData cdata); +MODULE_SCOPE int ExpandDelegateAs( + Tcl_Interp* interp, + ItclObject* ioPtr, + ItclClass* iclsPtr, + ItclDelegatedFunction* idmPtr, + const char* funcName, + Tcl_Obj* listPtr); +MODULE_SCOPE int ItclCheckForInitializedComponents( + Tcl_Interp* interp, + ItclClass* iclsPtr, + ItclObject* ioPtr); +MODULE_SCOPE int ItclCreateDelegatedFunction( + Tcl_Interp* interp, + ItclClass* iclsPtr, + Tcl_Obj* methodNamePtr, + ItclComponent* icPtr, + Tcl_Obj* targetPtr, + Tcl_Obj* usingPtr, + Tcl_Obj* exceptionsPtr, + ItclDelegatedFunction** idmPtrPtr); +MODULE_SCOPE void ItclDeleteDelegatedOption(char* cdata); +MODULE_SCOPE void Itcl_FinishList(); +MODULE_SCOPE void ItclDeleteDelegatedFunction(ItclDelegatedFunction* idmPtr); +MODULE_SCOPE void ItclFinishEnsemble(ItclObjectInfo* infoPtr); +MODULE_SCOPE int Itcl_EnsembleDeleteCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int ItclAddClassesDictInfo(Tcl_Interp* interp, ItclClass* iclsPtr); +MODULE_SCOPE int ItclDeleteClassesDictInfo( + Tcl_Interp* interp, + ItclClass* iclsPtr); +MODULE_SCOPE int ItclAddObjectsDictInfo(Tcl_Interp* interp, ItclObject* ioPtr); +MODULE_SCOPE int ItclDeleteObjectsDictInfo( + Tcl_Interp* interp, + ItclObject* ioPtr); +MODULE_SCOPE int ItclAddOptionDictInfo( + Tcl_Interp* interp, + ItclClass* iclsPtr, + ItclOption* ioptPtr); +MODULE_SCOPE int ItclAddDelegatedOptionDictInfo( + Tcl_Interp* interp, + ItclClass* iclsPtr, + ItclDelegatedOption* idoPtr); +MODULE_SCOPE int ItclAddClassComponentDictInfo( + Tcl_Interp* interp, + ItclClass* iclsPtr, + ItclComponent* icPtr); +MODULE_SCOPE int ItclAddClassVariableDictInfo( + Tcl_Interp* interp, + ItclClass* iclsPtr, + ItclVariable* ivPtr); +MODULE_SCOPE int ItclAddClassFunctionDictInfo( + Tcl_Interp* interp, + ItclClass* iclsPtr, + ItclMemberFunc* imPtr); +MODULE_SCOPE int ItclAddClassDelegatedFunctionDictInfo( + Tcl_Interp* interp, + ItclClass* iclsPtr, + ItclDelegatedFunction* idmPtr); +MODULE_SCOPE int ItclClassCreateObject( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiMyProcCmd; +MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiInstallComponentCmd; +MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiCallInstanceCmd; +MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiGetInstanceVarCmd; +MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiMyTypeMethodCmd; +MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiMyMethodCmd; +MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiMyTypeVarCmd; +MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiMyVarCmd; +MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiItclHullCmd; +MODULE_SCOPE Tcl_ObjCmdProc Itcl_ThisCmd; +MODULE_SCOPE Tcl_ObjCmdProc Itcl_ExtendedClassCmd; +MODULE_SCOPE Tcl_ObjCmdProc Itcl_TypeClassCmd; +MODULE_SCOPE Tcl_ObjCmdProc Itcl_AddObjectOptionCmd; +MODULE_SCOPE Tcl_ObjCmdProc Itcl_AddDelegatedOptionCmd; +MODULE_SCOPE Tcl_ObjCmdProc Itcl_AddDelegatedFunctionCmd; +MODULE_SCOPE Tcl_ObjCmdProc Itcl_SetComponentCmd; +MODULE_SCOPE Tcl_ObjCmdProc Itcl_ClassHullTypeCmd; +MODULE_SCOPE Tcl_ObjCmdProc Itcl_ClassWidgetClassCmd; + +typedef int(ItclRootMethodProc)( + ItclObject* ioPtr, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); + +MODULE_SCOPE const Tcl_MethodType itclRootMethodType; +MODULE_SCOPE ItclRootMethodProc ItclUnknownGuts; +MODULE_SCOPE ItclRootMethodProc ItclConstructGuts; +MODULE_SCOPE ItclRootMethodProc ItclInfoGuts; + +#include "itcl2TclOO.h" +#ifdef NEW_PROTO_RESOLVER +#include "itclVarsAndCmds.h" +#endif + +/* + * Include all the private API, generated from itcl.decls. + */ + +#include "itclIntDecls.h" diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/itclIntDecls.h b/src_cpp/elfgames/tasks/elf2codingenv/include/itclIntDecls.h new file mode 100644 index 0000000..b49d4d2 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/itclIntDecls.h @@ -0,0 +1,1495 @@ +/* + * This file is (mostly) automatically generated from itcl.decls. + */ + +#ifndef _ITCLINTDECLS +#define _ITCLINTDECLS + +/* !BEGIN!: Do not edit below this line. */ + +#define ITCLINT_STUBS_EPOCH 0 +#define ITCLINT_STUBS_REVISION 150 + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Exported function declarations: + */ + +/* 0 */ +ITCLAPI int Itcl_IsClassNamespace(Tcl_Namespace* namesp); +/* 1 */ +ITCLAPI int Itcl_IsClass(Tcl_Command cmd); +/* 2 */ +ITCLAPI ItclClass* +Itcl_FindClass(Tcl_Interp* interp, const char* path, int autoload); +/* 3 */ +ITCLAPI int +Itcl_FindObject(Tcl_Interp* interp, const char* name, ItclObject** roPtr); +/* 4 */ +ITCLAPI int Itcl_IsObject(Tcl_Command cmd); +/* 5 */ +ITCLAPI int Itcl_ObjectIsa(ItclObject* contextObj, ItclClass* cdefn); +/* 6 */ +ITCLAPI int Itcl_Protection(Tcl_Interp* interp, int newLevel); +/* 7 */ +ITCLAPI const char* Itcl_ProtectionStr(int pLevel); +/* 8 */ +ITCLAPI int Itcl_CanAccess(ItclMemberFunc* memberPtr, Tcl_Namespace* fromNsPtr); +/* 9 */ +ITCLAPI int Itcl_CanAccessFunc(ItclMemberFunc* mfunc, Tcl_Namespace* fromNsPtr); +/* Slot 10 is reserved */ +/* 11 */ +ITCLAPI void Itcl_ParseNamespPath( + const char* name, + Tcl_DString* buffer, + const char** head, + const char** tail); +/* 12 */ +ITCLAPI int Itcl_DecodeScopedCommand( + Tcl_Interp* interp, + const char* name, + Tcl_Namespace** rNsPtr, + char** rCmdPtr); +/* 13 */ +ITCLAPI int Itcl_EvalArgs(Tcl_Interp* interp, int objc, Tcl_Obj* const objv[]); +/* 14 */ +ITCLAPI Tcl_Obj* Itcl_CreateArgs( + Tcl_Interp* interp, + const char* string, + int objc, + Tcl_Obj* const objv[]); +/* Slot 15 is reserved */ +/* Slot 16 is reserved */ +/* 17 */ +ITCLAPI int Itcl_GetContext( + Tcl_Interp* interp, + ItclClass** iclsPtrPtr, + ItclObject** ioPtrPtr); +/* 18 */ +ITCLAPI void Itcl_InitHierIter(ItclHierIter* iter, ItclClass* iclsPtr); +/* 19 */ +ITCLAPI void Itcl_DeleteHierIter(ItclHierIter* iter); +/* 20 */ +ITCLAPI ItclClass* Itcl_AdvanceHierIter(ItclHierIter* iter); +/* 21 */ +ITCLAPI int Itcl_FindClassesCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 22 */ +ITCLAPI int Itcl_FindObjectsCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* Slot 23 is reserved */ +/* 24 */ +ITCLAPI int Itcl_DelClassCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 25 */ +ITCLAPI int Itcl_DelObjectCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 26 */ +ITCLAPI int Itcl_ScopeCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 27 */ +ITCLAPI int Itcl_CodeCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 28 */ +ITCLAPI int Itcl_StubCreateCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 29 */ +ITCLAPI int Itcl_StubExistsCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 30 */ +ITCLAPI int Itcl_IsStub(Tcl_Command cmd); +/* 31 */ +ITCLAPI int Itcl_CreateClass( + Tcl_Interp* interp, + const char* path, + ItclObjectInfo* info, + ItclClass** rPtr); +/* 32 */ +ITCLAPI int Itcl_DeleteClass(Tcl_Interp* interp, ItclClass* iclsPtr); +/* 33 */ +ITCLAPI Tcl_Namespace* Itcl_FindClassNamespace( + Tcl_Interp* interp, + const char* path); +/* 34 */ +ITCLAPI int Itcl_HandleClass( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* Slot 35 is reserved */ +/* Slot 36 is reserved */ +/* Slot 37 is reserved */ +/* 38 */ +ITCLAPI void Itcl_BuildVirtualTables(ItclClass* iclsPtr); +/* 39 */ +ITCLAPI int Itcl_CreateVariable( + Tcl_Interp* interp, + ItclClass* iclsPtr, + Tcl_Obj* name, + char* init, + char* config, + ItclVariable** ivPtr); +/* 40 */ +ITCLAPI void Itcl_DeleteVariable(char* cdata); +/* 41 */ +ITCLAPI const char* Itcl_GetCommonVar( + Tcl_Interp* interp, + const char* name, + ItclClass* contextClass); +/* Slot 42 is reserved */ +/* Slot 43 is reserved */ +/* 44 */ +ITCLAPI int Itcl_CreateObject( + Tcl_Interp* interp, + const char* name, + ItclClass* iclsPtr, + int objc, + Tcl_Obj* const objv[], + ItclObject** rioPtr); +/* 45 */ +ITCLAPI int Itcl_DeleteObject(Tcl_Interp* interp, ItclObject* contextObj); +/* 46 */ +ITCLAPI int +Itcl_DestructObject(Tcl_Interp* interp, ItclObject* contextObj, int flags); +/* Slot 47 is reserved */ +/* 48 */ +ITCLAPI const char* Itcl_GetInstanceVar( + Tcl_Interp* interp, + const char* name, + ItclObject* contextIoPtr, + ItclClass* contextIclsPtr); +/* Slot 49 is reserved */ +/* 50 */ +ITCLAPI int Itcl_BodyCmd( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 51 */ +ITCLAPI int Itcl_ConfigBodyCmd( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 52 */ +ITCLAPI int Itcl_CreateMethod( + Tcl_Interp* interp, + ItclClass* iclsPtr, + Tcl_Obj* namePtr, + const char* arglist, + const char* body); +/* 53 */ +ITCLAPI int Itcl_CreateProc( + Tcl_Interp* interp, + ItclClass* iclsPtr, + Tcl_Obj* namePtr, + const char* arglist, + const char* body); +/* 54 */ +ITCLAPI int Itcl_CreateMemberFunc( + Tcl_Interp* interp, + ItclClass* iclsPtr, + Tcl_Obj* name, + const char* arglist, + const char* body, + ItclMemberFunc** mfuncPtr); +/* 55 */ +ITCLAPI int Itcl_ChangeMemberFunc( + Tcl_Interp* interp, + ItclMemberFunc* mfunc, + const char* arglist, + const char* body); +/* 56 */ +ITCLAPI void Itcl_DeleteMemberFunc(char* cdata); +/* 57 */ +ITCLAPI int Itcl_CreateMemberCode( + Tcl_Interp* interp, + ItclClass* iclsPtr, + const char* arglist, + const char* body, + ItclMemberCode** mcodePtr); +/* 58 */ +ITCLAPI void Itcl_DeleteMemberCode(char* cdata); +/* 59 */ +ITCLAPI int Itcl_GetMemberCode(Tcl_Interp* interp, ItclMemberFunc* mfunc); +/* Slot 60 is reserved */ +/* 61 */ +ITCLAPI int Itcl_EvalMemberCode( + Tcl_Interp* interp, + ItclMemberFunc* mfunc, + ItclObject* contextObj, + int objc, + Tcl_Obj* const objv[]); +/* Slot 62 is reserved */ +/* Slot 63 is reserved */ +/* Slot 64 is reserved */ +/* Slot 65 is reserved */ +/* Slot 66 is reserved */ +/* 67 */ +ITCLAPI void Itcl_GetMemberFuncUsage( + ItclMemberFunc* mfunc, + ItclObject* contextObj, + Tcl_Obj* objPtr); +/* 68 */ +ITCLAPI int Itcl_ExecMethod( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 69 */ +ITCLAPI int Itcl_ExecProc( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* Slot 70 is reserved */ +/* 71 */ +ITCLAPI int Itcl_ConstructBase( + Tcl_Interp* interp, + ItclObject* contextObj, + ItclClass* contextClass); +/* 72 */ +ITCLAPI int Itcl_InvokeMethodIfExists( + Tcl_Interp* interp, + const char* name, + ItclClass* contextClass, + ItclObject* contextObj, + int objc, + Tcl_Obj* const objv[]); +/* Slot 73 is reserved */ +/* 74 */ +ITCLAPI int Itcl_ReportFuncErrors( + Tcl_Interp* interp, + ItclMemberFunc* mfunc, + ItclObject* contextObj, + int result); +/* 75 */ +ITCLAPI int Itcl_ParseInit(Tcl_Interp* interp, ItclObjectInfo* info); +/* 76 */ +ITCLAPI int Itcl_ClassCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 77 */ +ITCLAPI int Itcl_ClassInheritCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 78 */ +ITCLAPI int Itcl_ClassProtectionCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 79 */ +ITCLAPI int Itcl_ClassConstructorCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 80 */ +ITCLAPI int Itcl_ClassDestructorCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 81 */ +ITCLAPI int Itcl_ClassMethodCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 82 */ +ITCLAPI int Itcl_ClassProcCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 83 */ +ITCLAPI int Itcl_ClassVariableCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 84 */ +ITCLAPI int Itcl_ClassCommonCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 85 */ +ITCLAPI int Itcl_ParseVarResolver( + Tcl_Interp* interp, + const char* name, + Tcl_Namespace* contextNs, + int flags, + Tcl_Var* rPtr); +/* 86 */ +ITCLAPI int Itcl_BiInit(Tcl_Interp* interp, ItclObjectInfo* infoPtr); +/* 87 */ +ITCLAPI int Itcl_InstallBiMethods(Tcl_Interp* interp, ItclClass* cdefn); +/* 88 */ +ITCLAPI int Itcl_BiIsaCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 89 */ +ITCLAPI int Itcl_BiConfigureCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 90 */ +ITCLAPI int Itcl_BiCgetCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 91 */ +ITCLAPI int Itcl_BiChainCmd( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 92 */ +ITCLAPI int Itcl_BiInfoClassCmd( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 93 */ +ITCLAPI int Itcl_BiInfoInheritCmd( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 94 */ +ITCLAPI int Itcl_BiInfoHeritageCmd( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 95 */ +ITCLAPI int Itcl_BiInfoFunctionCmd( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 96 */ +ITCLAPI int Itcl_BiInfoVariableCmd( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 97 */ +ITCLAPI int Itcl_BiInfoBodyCmd( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 98 */ +ITCLAPI int Itcl_BiInfoArgsCmd( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* Slot 99 is reserved */ +/* 100 */ +ITCLAPI int Itcl_EnsembleInit(Tcl_Interp* interp); +/* 101 */ +ITCLAPI int Itcl_CreateEnsemble(Tcl_Interp* interp, const char* ensName); +/* 102 */ +ITCLAPI int Itcl_AddEnsemblePart( + Tcl_Interp* interp, + const char* ensName, + const char* partName, + const char* usageInfo, + Tcl_ObjCmdProc* objProc, + ClientData clientData, + Tcl_CmdDeleteProc* deleteProc); +/* 103 */ +ITCLAPI int Itcl_GetEnsemblePart( + Tcl_Interp* interp, + const char* ensName, + const char* partName, + Tcl_CmdInfo* infoPtr); +/* 104 */ +ITCLAPI int Itcl_IsEnsemble(Tcl_CmdInfo* infoPtr); +/* 105 */ +ITCLAPI int +Itcl_GetEnsembleUsage(Tcl_Interp* interp, const char* ensName, Tcl_Obj* objPtr); +/* 106 */ +ITCLAPI int Itcl_GetEnsembleUsageForObj( + Tcl_Interp* interp, + Tcl_Obj* ensObjPtr, + Tcl_Obj* objPtr); +/* 107 */ +ITCLAPI int Itcl_EnsembleCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 108 */ +ITCLAPI int Itcl_EnsPartCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 109 */ +ITCLAPI int Itcl_EnsembleErrorCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* Slot 110 is reserved */ +/* Slot 111 is reserved */ +/* Slot 112 is reserved */ +/* Slot 113 is reserved */ +/* Slot 114 is reserved */ +/* 115 */ +ITCLAPI void +Itcl_Assert(const char* testExpr, const char* fileName, int lineNum); +/* 116 */ +ITCLAPI int Itcl_IsObjectCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 117 */ +ITCLAPI int Itcl_IsClassCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* Slot 118 is reserved */ +/* Slot 119 is reserved */ +/* Slot 120 is reserved */ +/* Slot 121 is reserved */ +/* Slot 122 is reserved */ +/* Slot 123 is reserved */ +/* Slot 124 is reserved */ +/* Slot 125 is reserved */ +/* Slot 126 is reserved */ +/* Slot 127 is reserved */ +/* Slot 128 is reserved */ +/* Slot 129 is reserved */ +/* Slot 130 is reserved */ +/* Slot 131 is reserved */ +/* Slot 132 is reserved */ +/* Slot 133 is reserved */ +/* Slot 134 is reserved */ +/* Slot 135 is reserved */ +/* Slot 136 is reserved */ +/* Slot 137 is reserved */ +/* Slot 138 is reserved */ +/* Slot 139 is reserved */ +/* 140 */ +ITCLAPI int Itcl_FilterAddCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 141 */ +ITCLAPI int Itcl_FilterDeleteCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 142 */ +ITCLAPI int Itcl_ForwardAddCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 143 */ +ITCLAPI int Itcl_ForwardDeleteCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 144 */ +ITCLAPI int Itcl_MixinAddCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 145 */ +ITCLAPI int Itcl_MixinDeleteCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* Slot 146 is reserved */ +/* Slot 147 is reserved */ +/* Slot 148 is reserved */ +/* Slot 149 is reserved */ +/* Slot 150 is reserved */ +/* 151 */ +ITCLAPI int Itcl_BiInfoUnknownCmd( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 152 */ +ITCLAPI int Itcl_BiInfoVarsCmd( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 153 */ +ITCLAPI int +Itcl_CanAccess2(ItclClass* iclsPtr, int protection, Tcl_Namespace* fromNsPtr); +/* Slot 154 is reserved */ +/* Slot 155 is reserved */ +/* Slot 156 is reserved */ +/* Slot 157 is reserved */ +/* Slot 158 is reserved */ +/* Slot 159 is reserved */ +/* 160 */ +ITCLAPI int Itcl_SetCallFrameResolver( + Tcl_Interp* interp, + Tcl_Resolve* resolvePtr); +/* 161 */ +ITCLAPI int ItclEnsembleSubCmd( + ClientData clientData, + Tcl_Interp* interp, + const char* ensembleName, + int objc, + Tcl_Obj* const* objv, + const char* functionName); +/* 162 */ +ITCLAPI Tcl_Namespace* Itcl_GetUplevelNamespace(Tcl_Interp* interp, int level); +/* 163 */ +ITCLAPI ClientData Itcl_GetCallFrameClientData(Tcl_Interp* interp); +/* Slot 164 is reserved */ +/* 165 */ +ITCLAPI int Itcl_SetCallFrameNamespace( + Tcl_Interp* interp, + Tcl_Namespace* nsPtr); +/* 166 */ +ITCLAPI int Itcl_GetCallFrameObjc(Tcl_Interp* interp); +/* 167 */ +ITCLAPI Tcl_Obj* const* Itcl_GetCallFrameObjv(Tcl_Interp* interp); +/* 168 */ +ITCLAPI int Itcl_NWidgetCmd( + ClientData infoPtr, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 169 */ +ITCLAPI int Itcl_AddOptionCmd( + ClientData infoPtr, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 170 */ +ITCLAPI int Itcl_AddComponentCmd( + ClientData infoPtr, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 171 */ +ITCLAPI int Itcl_BiInfoOptionCmd( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 172 */ +ITCLAPI int Itcl_BiInfoComponentCmd( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 173 */ +ITCLAPI int Itcl_RenameCommand( + Tcl_Interp* interp, + const char* oldName, + const char* newName); +/* 174 */ +ITCLAPI int Itcl_PushCallFrame( + Tcl_Interp* interp, + Tcl_CallFrame* framePtr, + Tcl_Namespace* nsPtr, + int isProcCallFrame); +/* 175 */ +ITCLAPI void Itcl_PopCallFrame(Tcl_Interp* interp); +/* 176 */ +ITCLAPI Tcl_CallFrame* Itcl_GetUplevelCallFrame(Tcl_Interp* interp, int level); +/* 177 */ +ITCLAPI Tcl_CallFrame* Itcl_ActivateCallFrame( + Tcl_Interp* interp, + Tcl_CallFrame* framePtr); +/* 178 */ +ITCLAPI const char* ItclSetInstanceVar( + Tcl_Interp* interp, + const char* name, + const char* name2, + const char* value, + ItclObject* contextIoPtr, + ItclClass* contextIclsPtr); +/* 179 */ +ITCLAPI Tcl_Obj* ItclCapitalize(const char* str); +/* 180 */ +ITCLAPI int ItclClassBaseCmd( + ClientData clientData, + Tcl_Interp* interp, + int flags, + int objc, + Tcl_Obj* const objv[], + ItclClass** iclsPtrPtr); +/* 181 */ +ITCLAPI int ItclCreateComponent( + Tcl_Interp* interp, + ItclClass* iclsPtr, + Tcl_Obj* componentPtr, + int type, + ItclComponent** icPtrPtr); +/* 182 */ +ITCLAPI void Itcl_SetContext(Tcl_Interp* interp, ItclObject* ioPtr); +/* 183 */ +ITCLAPI void Itcl_UnsetContext(Tcl_Interp* interp); +/* 184 */ +ITCLAPI const char* ItclGetInstanceVar( + Tcl_Interp* interp, + const char* name, + const char* name2, + ItclObject* ioPtr, + ItclClass* iclsPtr); + +typedef struct ItclIntStubs { + int magic; + int epoch; + int revision; + void* hooks; + + int (*itcl_IsClassNamespace)(Tcl_Namespace* namesp); /* 0 */ + int (*itcl_IsClass)(Tcl_Command cmd); /* 1 */ + ItclClass* (*itcl_FindClass)( + Tcl_Interp* interp, + const char* path, + int autoload); /* 2 */ + int (*itcl_FindObject)( + Tcl_Interp* interp, + const char* name, + ItclObject** roPtr); /* 3 */ + int (*itcl_IsObject)(Tcl_Command cmd); /* 4 */ + int (*itcl_ObjectIsa)(ItclObject* contextObj, ItclClass* cdefn); /* 5 */ + int (*itcl_Protection)(Tcl_Interp* interp, int newLevel); /* 6 */ + const char* (*itcl_ProtectionStr)(int pLevel); /* 7 */ + int (*itcl_CanAccess)( + ItclMemberFunc* memberPtr, + Tcl_Namespace* fromNsPtr); /* 8 */ + int (*itcl_CanAccessFunc)( + ItclMemberFunc* mfunc, + Tcl_Namespace* fromNsPtr); /* 9 */ + void (*reserved10)(void); + void (*itcl_ParseNamespPath)( + const char* name, + Tcl_DString* buffer, + const char** head, + const char** tail); /* 11 */ + int (*itcl_DecodeScopedCommand)( + Tcl_Interp* interp, + const char* name, + Tcl_Namespace** rNsPtr, + char** rCmdPtr); /* 12 */ + int (*itcl_EvalArgs)( + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 13 */ + Tcl_Obj* (*itcl_CreateArgs)( + Tcl_Interp* interp, + const char* string, + int objc, + Tcl_Obj* const objv[]); /* 14 */ + void (*reserved15)(void); + void (*reserved16)(void); + int (*itcl_GetContext)( + Tcl_Interp* interp, + ItclClass** iclsPtrPtr, + ItclObject** ioPtrPtr); /* 17 */ + void (*itcl_InitHierIter)(ItclHierIter* iter, ItclClass* iclsPtr); /* 18 */ + void (*itcl_DeleteHierIter)(ItclHierIter* iter); /* 19 */ + ItclClass* (*itcl_AdvanceHierIter)(ItclHierIter* iter); /* 20 */ + int (*itcl_FindClassesCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 21 */ + int (*itcl_FindObjectsCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 22 */ + void (*reserved23)(void); + int (*itcl_DelClassCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 24 */ + int (*itcl_DelObjectCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 25 */ + int (*itcl_ScopeCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 26 */ + int (*itcl_CodeCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 27 */ + int (*itcl_StubCreateCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 28 */ + int (*itcl_StubExistsCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 29 */ + int (*itcl_IsStub)(Tcl_Command cmd); /* 30 */ + int (*itcl_CreateClass)( + Tcl_Interp* interp, + const char* path, + ItclObjectInfo* info, + ItclClass** rPtr); /* 31 */ + int (*itcl_DeleteClass)(Tcl_Interp* interp, ItclClass* iclsPtr); /* 32 */ + Tcl_Namespace* ( + *itcl_FindClassNamespace)(Tcl_Interp* interp, const char* path); /* 33 */ + int (*itcl_HandleClass)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 34 */ + void (*reserved35)(void); + void (*reserved36)(void); + void (*reserved37)(void); + void (*itcl_BuildVirtualTables)(ItclClass* iclsPtr); /* 38 */ + int (*itcl_CreateVariable)( + Tcl_Interp* interp, + ItclClass* iclsPtr, + Tcl_Obj* name, + char* init, + char* config, + ItclVariable** ivPtr); /* 39 */ + void (*itcl_DeleteVariable)(char* cdata); /* 40 */ + const char* (*itcl_GetCommonVar)( + Tcl_Interp* interp, + const char* name, + ItclClass* contextClass); /* 41 */ + void (*reserved42)(void); + void (*reserved43)(void); + int (*itcl_CreateObject)( + Tcl_Interp* interp, + const char* name, + ItclClass* iclsPtr, + int objc, + Tcl_Obj* const objv[], + ItclObject** rioPtr); /* 44 */ + int (*itcl_DeleteObject)(Tcl_Interp* interp, ItclObject* contextObj); /* 45 */ + int (*itcl_DestructObject)( + Tcl_Interp* interp, + ItclObject* contextObj, + int flags); /* 46 */ + void (*reserved47)(void); + const char* (*itcl_GetInstanceVar)( + Tcl_Interp* interp, + const char* name, + ItclObject* contextIoPtr, + ItclClass* contextIclsPtr); /* 48 */ + void (*reserved49)(void); + int (*itcl_BodyCmd)( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 50 */ + int (*itcl_ConfigBodyCmd)( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 51 */ + int (*itcl_CreateMethod)( + Tcl_Interp* interp, + ItclClass* iclsPtr, + Tcl_Obj* namePtr, + const char* arglist, + const char* body); /* 52 */ + int (*itcl_CreateProc)( + Tcl_Interp* interp, + ItclClass* iclsPtr, + Tcl_Obj* namePtr, + const char* arglist, + const char* body); /* 53 */ + int (*itcl_CreateMemberFunc)( + Tcl_Interp* interp, + ItclClass* iclsPtr, + Tcl_Obj* name, + const char* arglist, + const char* body, + ItclMemberFunc** mfuncPtr); /* 54 */ + int (*itcl_ChangeMemberFunc)( + Tcl_Interp* interp, + ItclMemberFunc* mfunc, + const char* arglist, + const char* body); /* 55 */ + void (*itcl_DeleteMemberFunc)(char* cdata); /* 56 */ + int (*itcl_CreateMemberCode)( + Tcl_Interp* interp, + ItclClass* iclsPtr, + const char* arglist, + const char* body, + ItclMemberCode** mcodePtr); /* 57 */ + void (*itcl_DeleteMemberCode)(char* cdata); /* 58 */ + int (*itcl_GetMemberCode)(Tcl_Interp* interp, ItclMemberFunc* mfunc); /* 59 */ + void (*reserved60)(void); + int (*itcl_EvalMemberCode)( + Tcl_Interp* interp, + ItclMemberFunc* mfunc, + ItclObject* contextObj, + int objc, + Tcl_Obj* const objv[]); /* 61 */ + void (*reserved62)(void); + void (*reserved63)(void); + void (*reserved64)(void); + void (*reserved65)(void); + void (*reserved66)(void); + void (*itcl_GetMemberFuncUsage)( + ItclMemberFunc* mfunc, + ItclObject* contextObj, + Tcl_Obj* objPtr); /* 67 */ + int (*itcl_ExecMethod)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 68 */ + int (*itcl_ExecProc)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 69 */ + void (*reserved70)(void); + int (*itcl_ConstructBase)( + Tcl_Interp* interp, + ItclObject* contextObj, + ItclClass* contextClass); /* 71 */ + int (*itcl_InvokeMethodIfExists)( + Tcl_Interp* interp, + const char* name, + ItclClass* contextClass, + ItclObject* contextObj, + int objc, + Tcl_Obj* const objv[]); /* 72 */ + void (*reserved73)(void); + int (*itcl_ReportFuncErrors)( + Tcl_Interp* interp, + ItclMemberFunc* mfunc, + ItclObject* contextObj, + int result); /* 74 */ + int (*itcl_ParseInit)(Tcl_Interp* interp, ItclObjectInfo* info); /* 75 */ + int (*itcl_ClassCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 76 */ + int (*itcl_ClassInheritCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 77 */ + int (*itcl_ClassProtectionCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 78 */ + int (*itcl_ClassConstructorCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 79 */ + int (*itcl_ClassDestructorCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 80 */ + int (*itcl_ClassMethodCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 81 */ + int (*itcl_ClassProcCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 82 */ + int (*itcl_ClassVariableCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 83 */ + int (*itcl_ClassCommonCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 84 */ + int (*itcl_ParseVarResolver)( + Tcl_Interp* interp, + const char* name, + Tcl_Namespace* contextNs, + int flags, + Tcl_Var* rPtr); /* 85 */ + int (*itcl_BiInit)(Tcl_Interp* interp, ItclObjectInfo* infoPtr); /* 86 */ + int (*itcl_InstallBiMethods)(Tcl_Interp* interp, ItclClass* cdefn); /* 87 */ + int (*itcl_BiIsaCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 88 */ + int (*itcl_BiConfigureCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 89 */ + int (*itcl_BiCgetCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 90 */ + int (*itcl_BiChainCmd)( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 91 */ + int (*itcl_BiInfoClassCmd)( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 92 */ + int (*itcl_BiInfoInheritCmd)( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 93 */ + int (*itcl_BiInfoHeritageCmd)( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 94 */ + int (*itcl_BiInfoFunctionCmd)( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 95 */ + int (*itcl_BiInfoVariableCmd)( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 96 */ + int (*itcl_BiInfoBodyCmd)( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 97 */ + int (*itcl_BiInfoArgsCmd)( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 98 */ + void (*reserved99)(void); + int (*itcl_EnsembleInit)(Tcl_Interp* interp); /* 100 */ + int (*itcl_CreateEnsemble)(Tcl_Interp* interp, const char* ensName); /* 101 */ + int (*itcl_AddEnsemblePart)( + Tcl_Interp* interp, + const char* ensName, + const char* partName, + const char* usageInfo, + Tcl_ObjCmdProc* objProc, + ClientData clientData, + Tcl_CmdDeleteProc* deleteProc); /* 102 */ + int (*itcl_GetEnsemblePart)( + Tcl_Interp* interp, + const char* ensName, + const char* partName, + Tcl_CmdInfo* infoPtr); /* 103 */ + int (*itcl_IsEnsemble)(Tcl_CmdInfo* infoPtr); /* 104 */ + int (*itcl_GetEnsembleUsage)( + Tcl_Interp* interp, + const char* ensName, + Tcl_Obj* objPtr); /* 105 */ + int (*itcl_GetEnsembleUsageForObj)( + Tcl_Interp* interp, + Tcl_Obj* ensObjPtr, + Tcl_Obj* objPtr); /* 106 */ + int (*itcl_EnsembleCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 107 */ + int (*itcl_EnsPartCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 108 */ + int (*itcl_EnsembleErrorCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 109 */ + void (*reserved110)(void); + void (*reserved111)(void); + void (*reserved112)(void); + void (*reserved113)(void); + void (*reserved114)(void); + void (*itcl_Assert)( + const char* testExpr, + const char* fileName, + int lineNum); /* 115 */ + int (*itcl_IsObjectCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 116 */ + int (*itcl_IsClassCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 117 */ + void (*reserved118)(void); + void (*reserved119)(void); + void (*reserved120)(void); + void (*reserved121)(void); + void (*reserved122)(void); + void (*reserved123)(void); + void (*reserved124)(void); + void (*reserved125)(void); + void (*reserved126)(void); + void (*reserved127)(void); + void (*reserved128)(void); + void (*reserved129)(void); + void (*reserved130)(void); + void (*reserved131)(void); + void (*reserved132)(void); + void (*reserved133)(void); + void (*reserved134)(void); + void (*reserved135)(void); + void (*reserved136)(void); + void (*reserved137)(void); + void (*reserved138)(void); + void (*reserved139)(void); + int (*itcl_FilterAddCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 140 */ + int (*itcl_FilterDeleteCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 141 */ + int (*itcl_ForwardAddCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 142 */ + int (*itcl_ForwardDeleteCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 143 */ + int (*itcl_MixinAddCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 144 */ + int (*itcl_MixinDeleteCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 145 */ + void (*reserved146)(void); + void (*reserved147)(void); + void (*reserved148)(void); + void (*reserved149)(void); + void (*reserved150)(void); + int (*itcl_BiInfoUnknownCmd)( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 151 */ + int (*itcl_BiInfoVarsCmd)( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 152 */ + int (*itcl_CanAccess2)( + ItclClass* iclsPtr, + int protection, + Tcl_Namespace* fromNsPtr); /* 153 */ + void (*reserved154)(void); + void (*reserved155)(void); + void (*reserved156)(void); + void (*reserved157)(void); + void (*reserved158)(void); + void (*reserved159)(void); + int (*itcl_SetCallFrameResolver)( + Tcl_Interp* interp, + Tcl_Resolve* resolvePtr); /* 160 */ + int (*itclEnsembleSubCmd)( + ClientData clientData, + Tcl_Interp* interp, + const char* ensembleName, + int objc, + Tcl_Obj* const* objv, + const char* functionName); /* 161 */ + Tcl_Namespace* ( + *itcl_GetUplevelNamespace)(Tcl_Interp* interp, int level); /* 162 */ + ClientData (*itcl_GetCallFrameClientData)(Tcl_Interp* interp); /* 163 */ + void (*reserved164)(void); + int (*itcl_SetCallFrameNamespace)( + Tcl_Interp* interp, + Tcl_Namespace* nsPtr); /* 165 */ + int (*itcl_GetCallFrameObjc)(Tcl_Interp* interp); /* 166 */ + Tcl_Obj* const* (*itcl_GetCallFrameObjv)(Tcl_Interp* interp); /* 167 */ + int (*itcl_NWidgetCmd)( + ClientData infoPtr, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 168 */ + int (*itcl_AddOptionCmd)( + ClientData infoPtr, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 169 */ + int (*itcl_AddComponentCmd)( + ClientData infoPtr, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 170 */ + int (*itcl_BiInfoOptionCmd)( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 171 */ + int (*itcl_BiInfoComponentCmd)( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 172 */ + int (*itcl_RenameCommand)( + Tcl_Interp* interp, + const char* oldName, + const char* newName); /* 173 */ + int (*itcl_PushCallFrame)( + Tcl_Interp* interp, + Tcl_CallFrame* framePtr, + Tcl_Namespace* nsPtr, + int isProcCallFrame); /* 174 */ + void (*itcl_PopCallFrame)(Tcl_Interp* interp); /* 175 */ + Tcl_CallFrame* ( + *itcl_GetUplevelCallFrame)(Tcl_Interp* interp, int level); /* 176 */ + Tcl_CallFrame* (*itcl_ActivateCallFrame)( + Tcl_Interp* interp, + Tcl_CallFrame* framePtr); /* 177 */ + const char* (*itclSetInstanceVar)( + Tcl_Interp* interp, + const char* name, + const char* name2, + const char* value, + ItclObject* contextIoPtr, + ItclClass* contextIclsPtr); /* 178 */ + Tcl_Obj* (*itclCapitalize)(const char* str); /* 179 */ + int (*itclClassBaseCmd)( + ClientData clientData, + Tcl_Interp* interp, + int flags, + int objc, + Tcl_Obj* const objv[], + ItclClass** iclsPtrPtr); /* 180 */ + int (*itclCreateComponent)( + Tcl_Interp* interp, + ItclClass* iclsPtr, + Tcl_Obj* componentPtr, + int type, + ItclComponent** icPtrPtr); /* 181 */ + void (*itcl_SetContext)(Tcl_Interp* interp, ItclObject* ioPtr); /* 182 */ + void (*itcl_UnsetContext)(Tcl_Interp* interp); /* 183 */ + const char* (*itclGetInstanceVar)( + Tcl_Interp* interp, + const char* name, + const char* name2, + ItclObject* ioPtr, + ItclClass* iclsPtr); /* 184 */ +} ItclIntStubs; + +extern const ItclIntStubs* itclIntStubsPtr; + +#ifdef __cplusplus +} +#endif + +#if defined(USE_ITCL_STUBS) + +/* + * Inline function declarations: + */ + +#define Itcl_IsClassNamespace (itclIntStubsPtr->itcl_IsClassNamespace) /* 0 */ +#define Itcl_IsClass (itclIntStubsPtr->itcl_IsClass) /* 1 */ +#define Itcl_FindClass (itclIntStubsPtr->itcl_FindClass) /* 2 */ +#define Itcl_FindObject (itclIntStubsPtr->itcl_FindObject) /* 3 */ +#define Itcl_IsObject (itclIntStubsPtr->itcl_IsObject) /* 4 */ +#define Itcl_ObjectIsa (itclIntStubsPtr->itcl_ObjectIsa) /* 5 */ +#define Itcl_Protection (itclIntStubsPtr->itcl_Protection) /* 6 */ +#define Itcl_ProtectionStr (itclIntStubsPtr->itcl_ProtectionStr) /* 7 */ +#define Itcl_CanAccess (itclIntStubsPtr->itcl_CanAccess) /* 8 */ +#define Itcl_CanAccessFunc (itclIntStubsPtr->itcl_CanAccessFunc) /* 9 */ +/* Slot 10 is reserved */ +#define Itcl_ParseNamespPath (itclIntStubsPtr->itcl_ParseNamespPath) /* 11 */ +#define Itcl_DecodeScopedCommand \ + (itclIntStubsPtr->itcl_DecodeScopedCommand) /* 12 */ +#define Itcl_EvalArgs (itclIntStubsPtr->itcl_EvalArgs) /* 13 */ +#define Itcl_CreateArgs (itclIntStubsPtr->itcl_CreateArgs) /* 14 */ +/* Slot 15 is reserved */ +/* Slot 16 is reserved */ +#define Itcl_GetContext (itclIntStubsPtr->itcl_GetContext) /* 17 */ +#define Itcl_InitHierIter (itclIntStubsPtr->itcl_InitHierIter) /* 18 */ +#define Itcl_DeleteHierIter (itclIntStubsPtr->itcl_DeleteHierIter) /* 19 */ +#define Itcl_AdvanceHierIter (itclIntStubsPtr->itcl_AdvanceHierIter) /* 20 */ +#define Itcl_FindClassesCmd (itclIntStubsPtr->itcl_FindClassesCmd) /* 21 */ +#define Itcl_FindObjectsCmd (itclIntStubsPtr->itcl_FindObjectsCmd) /* 22 */ +/* Slot 23 is reserved */ +#define Itcl_DelClassCmd (itclIntStubsPtr->itcl_DelClassCmd) /* 24 */ +#define Itcl_DelObjectCmd (itclIntStubsPtr->itcl_DelObjectCmd) /* 25 */ +#define Itcl_ScopeCmd (itclIntStubsPtr->itcl_ScopeCmd) /* 26 */ +#define Itcl_CodeCmd (itclIntStubsPtr->itcl_CodeCmd) /* 27 */ +#define Itcl_StubCreateCmd (itclIntStubsPtr->itcl_StubCreateCmd) /* 28 */ +#define Itcl_StubExistsCmd (itclIntStubsPtr->itcl_StubExistsCmd) /* 29 */ +#define Itcl_IsStub (itclIntStubsPtr->itcl_IsStub) /* 30 */ +#define Itcl_CreateClass (itclIntStubsPtr->itcl_CreateClass) /* 31 */ +#define Itcl_DeleteClass (itclIntStubsPtr->itcl_DeleteClass) /* 32 */ +#define Itcl_FindClassNamespace \ + (itclIntStubsPtr->itcl_FindClassNamespace) /* 33 */ +#define Itcl_HandleClass (itclIntStubsPtr->itcl_HandleClass) /* 34 */ +/* Slot 35 is reserved */ +/* Slot 36 is reserved */ +/* Slot 37 is reserved */ +#define Itcl_BuildVirtualTables \ + (itclIntStubsPtr->itcl_BuildVirtualTables) /* 38 */ +#define Itcl_CreateVariable (itclIntStubsPtr->itcl_CreateVariable) /* 39 */ +#define Itcl_DeleteVariable (itclIntStubsPtr->itcl_DeleteVariable) /* 40 */ +#define Itcl_GetCommonVar (itclIntStubsPtr->itcl_GetCommonVar) /* 41 */ +/* Slot 42 is reserved */ +/* Slot 43 is reserved */ +#define Itcl_CreateObject (itclIntStubsPtr->itcl_CreateObject) /* 44 */ +#define Itcl_DeleteObject (itclIntStubsPtr->itcl_DeleteObject) /* 45 */ +#define Itcl_DestructObject (itclIntStubsPtr->itcl_DestructObject) /* 46 */ +/* Slot 47 is reserved */ +#define Itcl_GetInstanceVar (itclIntStubsPtr->itcl_GetInstanceVar) /* 48 */ +/* Slot 49 is reserved */ +#define Itcl_BodyCmd (itclIntStubsPtr->itcl_BodyCmd) /* 50 */ +#define Itcl_ConfigBodyCmd (itclIntStubsPtr->itcl_ConfigBodyCmd) /* 51 */ +#define Itcl_CreateMethod (itclIntStubsPtr->itcl_CreateMethod) /* 52 */ +#define Itcl_CreateProc (itclIntStubsPtr->itcl_CreateProc) /* 53 */ +#define Itcl_CreateMemberFunc (itclIntStubsPtr->itcl_CreateMemberFunc) /* 54 \ + */ +#define Itcl_ChangeMemberFunc (itclIntStubsPtr->itcl_ChangeMemberFunc) /* 55 \ + */ +#define Itcl_DeleteMemberFunc (itclIntStubsPtr->itcl_DeleteMemberFunc) /* 56 \ + */ +#define Itcl_CreateMemberCode (itclIntStubsPtr->itcl_CreateMemberCode) /* 57 \ + */ +#define Itcl_DeleteMemberCode (itclIntStubsPtr->itcl_DeleteMemberCode) /* 58 \ + */ +#define Itcl_GetMemberCode (itclIntStubsPtr->itcl_GetMemberCode) /* 59 */ +/* Slot 60 is reserved */ +#define Itcl_EvalMemberCode (itclIntStubsPtr->itcl_EvalMemberCode) /* 61 */ +/* Slot 62 is reserved */ +/* Slot 63 is reserved */ +/* Slot 64 is reserved */ +/* Slot 65 is reserved */ +/* Slot 66 is reserved */ +#define Itcl_GetMemberFuncUsage \ + (itclIntStubsPtr->itcl_GetMemberFuncUsage) /* 67 */ +#define Itcl_ExecMethod (itclIntStubsPtr->itcl_ExecMethod) /* 68 */ +#define Itcl_ExecProc (itclIntStubsPtr->itcl_ExecProc) /* 69 */ +/* Slot 70 is reserved */ +#define Itcl_ConstructBase (itclIntStubsPtr->itcl_ConstructBase) /* 71 */ +#define Itcl_InvokeMethodIfExists \ + (itclIntStubsPtr->itcl_InvokeMethodIfExists) /* 72 */ +/* Slot 73 is reserved */ +#define Itcl_ReportFuncErrors (itclIntStubsPtr->itcl_ReportFuncErrors) /* 74 \ + */ +#define Itcl_ParseInit (itclIntStubsPtr->itcl_ParseInit) /* 75 */ +#define Itcl_ClassCmd (itclIntStubsPtr->itcl_ClassCmd) /* 76 */ +#define Itcl_ClassInheritCmd (itclIntStubsPtr->itcl_ClassInheritCmd) /* 77 */ +#define Itcl_ClassProtectionCmd \ + (itclIntStubsPtr->itcl_ClassProtectionCmd) /* 78 */ +#define Itcl_ClassConstructorCmd \ + (itclIntStubsPtr->itcl_ClassConstructorCmd) /* 79 */ +#define Itcl_ClassDestructorCmd \ + (itclIntStubsPtr->itcl_ClassDestructorCmd) /* 80 */ +#define Itcl_ClassMethodCmd (itclIntStubsPtr->itcl_ClassMethodCmd) /* 81 */ +#define Itcl_ClassProcCmd (itclIntStubsPtr->itcl_ClassProcCmd) /* 82 */ +#define Itcl_ClassVariableCmd (itclIntStubsPtr->itcl_ClassVariableCmd) /* 83 \ + */ +#define Itcl_ClassCommonCmd (itclIntStubsPtr->itcl_ClassCommonCmd) /* 84 */ +#define Itcl_ParseVarResolver (itclIntStubsPtr->itcl_ParseVarResolver) /* 85 \ + */ +#define Itcl_BiInit (itclIntStubsPtr->itcl_BiInit) /* 86 */ +#define Itcl_InstallBiMethods (itclIntStubsPtr->itcl_InstallBiMethods) /* 87 \ + */ +#define Itcl_BiIsaCmd (itclIntStubsPtr->itcl_BiIsaCmd) /* 88 */ +#define Itcl_BiConfigureCmd (itclIntStubsPtr->itcl_BiConfigureCmd) /* 89 */ +#define Itcl_BiCgetCmd (itclIntStubsPtr->itcl_BiCgetCmd) /* 90 */ +#define Itcl_BiChainCmd (itclIntStubsPtr->itcl_BiChainCmd) /* 91 */ +#define Itcl_BiInfoClassCmd (itclIntStubsPtr->itcl_BiInfoClassCmd) /* 92 */ +#define Itcl_BiInfoInheritCmd (itclIntStubsPtr->itcl_BiInfoInheritCmd) /* 93 \ + */ +#define Itcl_BiInfoHeritageCmd \ + (itclIntStubsPtr->itcl_BiInfoHeritageCmd) /* 94 */ +#define Itcl_BiInfoFunctionCmd \ + (itclIntStubsPtr->itcl_BiInfoFunctionCmd) /* 95 */ +#define Itcl_BiInfoVariableCmd \ + (itclIntStubsPtr->itcl_BiInfoVariableCmd) /* 96 */ +#define Itcl_BiInfoBodyCmd (itclIntStubsPtr->itcl_BiInfoBodyCmd) /* 97 */ +#define Itcl_BiInfoArgsCmd (itclIntStubsPtr->itcl_BiInfoArgsCmd) /* 98 */ +/* Slot 99 is reserved */ +#define Itcl_EnsembleInit (itclIntStubsPtr->itcl_EnsembleInit) /* 100 */ +#define Itcl_CreateEnsemble (itclIntStubsPtr->itcl_CreateEnsemble) /* 101 */ +#define Itcl_AddEnsemblePart (itclIntStubsPtr->itcl_AddEnsemblePart) /* 102 */ +#define Itcl_GetEnsemblePart (itclIntStubsPtr->itcl_GetEnsemblePart) /* 103 */ +#define Itcl_IsEnsemble (itclIntStubsPtr->itcl_IsEnsemble) /* 104 */ +#define Itcl_GetEnsembleUsage (itclIntStubsPtr->itcl_GetEnsembleUsage) /* 105 \ + */ +#define Itcl_GetEnsembleUsageForObj \ + (itclIntStubsPtr->itcl_GetEnsembleUsageForObj) /* 106 */ +#define Itcl_EnsembleCmd (itclIntStubsPtr->itcl_EnsembleCmd) /* 107 */ +#define Itcl_EnsPartCmd (itclIntStubsPtr->itcl_EnsPartCmd) /* 108 */ +#define Itcl_EnsembleErrorCmd (itclIntStubsPtr->itcl_EnsembleErrorCmd) /* 109 \ + */ +/* Slot 110 is reserved */ +/* Slot 111 is reserved */ +/* Slot 112 is reserved */ +/* Slot 113 is reserved */ +/* Slot 114 is reserved */ +#define Itcl_Assert (itclIntStubsPtr->itcl_Assert) /* 115 */ +#define Itcl_IsObjectCmd (itclIntStubsPtr->itcl_IsObjectCmd) /* 116 */ +#define Itcl_IsClassCmd (itclIntStubsPtr->itcl_IsClassCmd) /* 117 */ +/* Slot 118 is reserved */ +/* Slot 119 is reserved */ +/* Slot 120 is reserved */ +/* Slot 121 is reserved */ +/* Slot 122 is reserved */ +/* Slot 123 is reserved */ +/* Slot 124 is reserved */ +/* Slot 125 is reserved */ +/* Slot 126 is reserved */ +/* Slot 127 is reserved */ +/* Slot 128 is reserved */ +/* Slot 129 is reserved */ +/* Slot 130 is reserved */ +/* Slot 131 is reserved */ +/* Slot 132 is reserved */ +/* Slot 133 is reserved */ +/* Slot 134 is reserved */ +/* Slot 135 is reserved */ +/* Slot 136 is reserved */ +/* Slot 137 is reserved */ +/* Slot 138 is reserved */ +/* Slot 139 is reserved */ +#define Itcl_FilterAddCmd (itclIntStubsPtr->itcl_FilterAddCmd) /* 140 */ +#define Itcl_FilterDeleteCmd (itclIntStubsPtr->itcl_FilterDeleteCmd) /* 141 */ +#define Itcl_ForwardAddCmd (itclIntStubsPtr->itcl_ForwardAddCmd) /* 142 */ +#define Itcl_ForwardDeleteCmd (itclIntStubsPtr->itcl_ForwardDeleteCmd) /* 143 \ + */ +#define Itcl_MixinAddCmd (itclIntStubsPtr->itcl_MixinAddCmd) /* 144 */ +#define Itcl_MixinDeleteCmd (itclIntStubsPtr->itcl_MixinDeleteCmd) /* 145 */ +/* Slot 146 is reserved */ +/* Slot 147 is reserved */ +/* Slot 148 is reserved */ +/* Slot 149 is reserved */ +/* Slot 150 is reserved */ +#define Itcl_BiInfoUnknownCmd (itclIntStubsPtr->itcl_BiInfoUnknownCmd) /* 151 \ + */ +#define Itcl_BiInfoVarsCmd (itclIntStubsPtr->itcl_BiInfoVarsCmd) /* 152 */ +#define Itcl_CanAccess2 (itclIntStubsPtr->itcl_CanAccess2) /* 153 */ +/* Slot 154 is reserved */ +/* Slot 155 is reserved */ +/* Slot 156 is reserved */ +/* Slot 157 is reserved */ +/* Slot 158 is reserved */ +/* Slot 159 is reserved */ +#define Itcl_SetCallFrameResolver \ + (itclIntStubsPtr->itcl_SetCallFrameResolver) /* 160 */ +#define ItclEnsembleSubCmd (itclIntStubsPtr->itclEnsembleSubCmd) /* 161 */ +#define Itcl_GetUplevelNamespace \ + (itclIntStubsPtr->itcl_GetUplevelNamespace) /* 162 */ +#define Itcl_GetCallFrameClientData \ + (itclIntStubsPtr->itcl_GetCallFrameClientData) /* 163 */ +/* Slot 164 is reserved */ +#define Itcl_SetCallFrameNamespace \ + (itclIntStubsPtr->itcl_SetCallFrameNamespace) /* 165 */ +#define Itcl_GetCallFrameObjc (itclIntStubsPtr->itcl_GetCallFrameObjc) /* 166 \ + */ +#define Itcl_GetCallFrameObjv (itclIntStubsPtr->itcl_GetCallFrameObjv) /* 167 \ + */ +#define Itcl_NWidgetCmd (itclIntStubsPtr->itcl_NWidgetCmd) /* 168 */ +#define Itcl_AddOptionCmd (itclIntStubsPtr->itcl_AddOptionCmd) /* 169 */ +#define Itcl_AddComponentCmd (itclIntStubsPtr->itcl_AddComponentCmd) /* 170 */ +#define Itcl_BiInfoOptionCmd (itclIntStubsPtr->itcl_BiInfoOptionCmd) /* 171 */ +#define Itcl_BiInfoComponentCmd \ + (itclIntStubsPtr->itcl_BiInfoComponentCmd) /* 172 */ +#define Itcl_RenameCommand (itclIntStubsPtr->itcl_RenameCommand) /* 173 */ +#define Itcl_PushCallFrame (itclIntStubsPtr->itcl_PushCallFrame) /* 174 */ +#define Itcl_PopCallFrame (itclIntStubsPtr->itcl_PopCallFrame) /* 175 */ +#define Itcl_GetUplevelCallFrame \ + (itclIntStubsPtr->itcl_GetUplevelCallFrame) /* 176 */ +#define Itcl_ActivateCallFrame \ + (itclIntStubsPtr->itcl_ActivateCallFrame) /* 177 */ +#define ItclSetInstanceVar (itclIntStubsPtr->itclSetInstanceVar) /* 178 */ +#define ItclCapitalize (itclIntStubsPtr->itclCapitalize) /* 179 */ +#define ItclClassBaseCmd (itclIntStubsPtr->itclClassBaseCmd) /* 180 */ +#define ItclCreateComponent (itclIntStubsPtr->itclCreateComponent) /* 181 */ +#define Itcl_SetContext (itclIntStubsPtr->itcl_SetContext) /* 182 */ +#define Itcl_UnsetContext (itclIntStubsPtr->itcl_UnsetContext) /* 183 */ +#define ItclGetInstanceVar (itclIntStubsPtr->itclGetInstanceVar) /* 184 */ + +#endif /* defined(USE_ITCL_STUBS) */ + +/* !END!: Do not edit above this line. */ + +#endif /* _ITCLINTDECLS */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/itclMigrate2TclCore.h b/src_cpp/elfgames/tasks/elf2codingenv/include/itclMigrate2TclCore.h new file mode 100644 index 0000000..f6043e5 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/itclMigrate2TclCore.h @@ -0,0 +1,105 @@ +#ifndef ITCL_USE_MODIFIED_TCL_H +/* this is just to provide the definition. This struct is only used if + * infoPtr->useOldResolvers == 0 which is not the default + */ +#define FRAME_HAS_RESOLVER 0x100 +typedef Tcl_Command(Tcl_CmdAliasProc)( + Tcl_Interp* interp, + Tcl_Namespace* nsPtr, + const char* cmdName, + ClientData clientData); +typedef Tcl_Var(Tcl_VarAliasProc)( + Tcl_Interp* interp, + Tcl_Namespace* nsPtr, + const char* varName, + ClientData clientData); + +#ifndef _TCL_RESOLVE_DEFINED +typedef struct Tcl_Resolve { + Tcl_VarAliasProc* varProcPtr; + Tcl_CmdAliasProc* cmdProcPtr; + ClientData clientData; +} Tcl_Resolve; +#define _TCL_RESOLVE_DEFINED 1 +#endif +#endif + +#ifndef _TCLINT +struct Tcl_ResolvedVarInfo; + +typedef Tcl_Var(Tcl_ResolveRuntimeVarProc)( + Tcl_Interp* interp, + struct Tcl_ResolvedVarInfo* vinfoPtr); + +typedef void(Tcl_ResolveVarDeleteProc)(struct Tcl_ResolvedVarInfo* vinfoPtr); + +/* + * The following structure encapsulates the routines needed to resolve a + * variable reference at runtime. Any variable specific state will typically + * be appended to this structure. + */ + +typedef struct Tcl_ResolvedVarInfo { + Tcl_ResolveRuntimeVarProc* fetchProc; + Tcl_ResolveVarDeleteProc* deleteProc; +} Tcl_ResolvedVarInfo; + +typedef int(Tcl_ResolveCompiledVarProc)( + Tcl_Interp* interp, + const char* name, + int length, + Tcl_Namespace* context, + Tcl_ResolvedVarInfo** rPtr); + +typedef int(Tcl_ResolveVarProc)( + Tcl_Interp* interp, + const char* name, + Tcl_Namespace* context, + int flags, + Tcl_Var* rPtr); + +typedef int(Tcl_ResolveCmdProc)( + Tcl_Interp* interp, + const char* name, + Tcl_Namespace* context, + int flags, + Tcl_Command* rPtr); + +typedef struct Tcl_ResolverInfo { + Tcl_ResolveCmdProc* cmdResProc; + /* Procedure handling command name + * resolution. */ + Tcl_ResolveVarProc* varResProc; + /* Procedure handling variable name resolution + * for variables that can only be handled at + * runtime. */ + Tcl_ResolveCompiledVarProc* compiledVarResProc; + /* Procedure handling variable name resolution + * at compile time. */ +} Tcl_ResolverInfo; +#endif + +/* here come the definitions for code which should be migrated to Tcl core */ +/* these functions DO NOT exist and are not published */ +#ifndef _TCL_PROC_DEFINED +typedef struct Tcl_Proc_* Tcl_Proc; +#define _TCL_PROC_DEFINED 1 +#endif + +#define Tcl_SetProcCmd _Tcl_SetProcCmd + +MODULE_SCOPE Tcl_Var Tcl_NewNamespaceVar( + Tcl_Interp* interp, + Tcl_Namespace* nsPtr, + const char* varName); +MODULE_SCOPE void Itcl_PreserveVar(Tcl_Var var); +MODULE_SCOPE void Itcl_ReleaseVar(Tcl_Var var); +MODULE_SCOPE int Itcl_IsCallFrameArgument(Tcl_Interp* interp, const char* name); +MODULE_SCOPE int Itcl_GetCallVarFrameObjc(Tcl_Interp* interp); +MODULE_SCOPE int Itcl_IsVarLink(Tcl_Var var); +MODULE_SCOPE int Itcl_IsCallFrameLinkVar(Tcl_Interp* interp, const char* name); +MODULE_SCOPE Tcl_Obj* const* Itcl_GetCallVarFrameObjv(Tcl_Interp* interp); +#define Tcl_SetNamespaceResolver _Tcl_SetNamespaceResolver +MODULE_SCOPE int _Tcl_SetNamespaceResolver( + Tcl_Namespace* nsPtr, + struct Tcl_Resolve* resolvePtr); diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/itclTclIntStubsFcn.h b/src_cpp/elfgames/tasks/elf2codingenv/include/itclTclIntStubsFcn.h new file mode 100644 index 0000000..e2870dc --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/itclTclIntStubsFcn.h @@ -0,0 +1,50 @@ +/* these functions are Tcl internal stubs so make an Itcl_* wrapper */ +MODULE_SCOPE void +Itcl_GetVariableFullName(Tcl_Interp* interp, Tcl_Var variable, Tcl_Obj* objPtr); +MODULE_SCOPE Tcl_Var Itcl_FindNamespaceVar( + Tcl_Interp* interp, + const char* name, + Tcl_Namespace* contextNsPtr, + int flags); +MODULE_SCOPE void Itcl_SetNamespaceResolvers( + Tcl_Namespace* namespacePtr, + Tcl_ResolveCmdProc* cmdProc, + Tcl_ResolveVarProc* varProc, + Tcl_ResolveCompiledVarProc* compiledVarProc); + +#ifndef _TCL_PROC_DEFINED +typedef struct Tcl_Proc_* Tcl_Proc; +#define _TCL_PROC_DEFINED 1 +#endif +#ifndef _TCL_RESOLVE_DEFINED +struct Tcl_Resolve; +#endif + +#define Tcl_GetOriginalCommand _Tcl_GetOriginalCommand +#define Tcl_CreateProc _Tcl_CreateProc +#define Tcl_ProcDeleteProc _Tcl_ProcDeleteProc +#define Tcl_GetObjInterpProc _Tcl_GetObjInterpProc + +MODULE_SCOPE Tcl_Command _Tcl_GetOriginalCommand(Tcl_Command command); +MODULE_SCOPE int _Tcl_CreateProc( + Tcl_Interp* interp, + Tcl_Namespace* nsPtr, + const char* procName, + Tcl_Obj* argsPtr, + Tcl_Obj* bodyPtr, + Tcl_Proc* procPtrPtr); +MODULE_SCOPE void _Tcl_ProcDeleteProc(ClientData clientData); +MODULE_SCOPE void* _Tcl_GetObjInterpProc(void); +MODULE_SCOPE int +Tcl_RenameCommand(Tcl_Interp* interp, const char* oldName, const char* newName); +MODULE_SCOPE Tcl_HashTable* Itcl_GetNamespaceChildTable(Tcl_Namespace* nsPtr); +MODULE_SCOPE Tcl_HashTable* Itcl_GetNamespaceCommandTable(Tcl_Namespace* nsPtr); +MODULE_SCOPE int Itcl_InitRewriteEnsemble( + Tcl_Interp* interp, + int numRemoved, + int numInserted, + int objc, + Tcl_Obj* const* objv); +MODULE_SCOPE void Itcl_ResetRewriteEnsemble( + Tcl_Interp* interp, + int isRootEnsemble); diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ks_names.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ks_names.h new file mode 100644 index 0000000..eafa610 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ks_names.h @@ -0,0 +1,320 @@ +/* + * This file should be maintained in sync with xlib/X11/keysymdefs.h + * + * Note that this should be done manually only, because in some cases + * keysymdefs.h defines the same integer for multiple keysyms, e.g.: + * + * #define XK_Greek_LAMDA 0x7cb + * #define XK_Greek_LAMBDA 0x7cb + * + * #define XK_Cyrillic_DZHE 0x6bf + * #define XK_Serbian_DZE 0x6bf (deprecated) + * + */ +{"BackSpace", 0xFF08}, {"Tab", 0xFF09}, {"Linefeed", 0xFF0A}, {"Clear", 0xFF0B}, + {"Return", 0xFF0D}, {"Pause", 0xFF13}, {"Scroll_Lock", 0xFF14}, + {"Sys_Req", 0xFF15}, {"Escape", 0xFF1B}, {"Delete", 0xFFFF}, + {"Multi_key", 0xFF20}, {"Kanji", 0xFF21}, {"Home", 0xFF50}, + {"Left", 0xFF51}, {"Up", 0xFF52}, {"Right", 0xFF53}, {"Down", 0xFF54}, + {"Prior", 0xFF55}, {"Next", 0xFF56}, {"End", 0xFF57}, {"Begin", 0xFF58}, + {"Win_L", 0xFF5B}, {"Win_R", 0xFF5C}, {"App", 0xFF5D}, {"Select", 0xFF60}, + {"Print", 0xFF61}, {"Execute", 0xFF62}, {"Insert", 0xFF63}, + {"Undo", 0xFF65}, {"Redo", 0xFF66}, {"Menu", 0xFF67}, {"Find", 0xFF68}, + {"Cancel", 0xFF69}, {"Help", 0xFF6A}, {"Break", 0xFF6B}, + {"Mode_switch", 0xFF7E}, {"script_switch", 0xFF7E}, {"Num_Lock", 0xFF7F}, + {"KP_Space", 0xFF80}, {"KP_Tab", 0xFF89}, {"KP_Enter", 0xFF8D}, + {"KP_F1", 0xFF91}, {"KP_F2", 0xFF92}, {"KP_F3", 0xFF93}, {"KP_F4", 0xFF94}, + {"KP_Equal", 0xFFBD}, {"KP_Multiply", 0xFFAA}, {"KP_Add", 0xFFAB}, + {"KP_Separator", 0xFFAC}, {"KP_Subtract", 0xFFAD}, {"KP_Decimal", 0xFFAE}, + {"KP_Divide", 0xFFAF}, {"KP_0", 0xFFB0}, {"KP_1", 0xFFB1}, {"KP_2", 0xFFB2}, + {"KP_3", 0xFFB3}, {"KP_4", 0xFFB4}, {"KP_5", 0xFFB5}, {"KP_6", 0xFFB6}, + {"KP_7", 0xFFB7}, {"KP_8", 0xFFB8}, {"KP_9", 0xFFB9}, {"F1", 0xFFBE}, + {"F2", 0xFFBF}, {"F3", 0xFFC0}, {"F4", 0xFFC1}, {"F5", 0xFFC2}, + {"F6", 0xFFC3}, {"F7", 0xFFC4}, {"F8", 0xFFC5}, {"F9", 0xFFC6}, + {"F10", 0xFFC7}, {"F11", 0xFFC8}, {"L1", 0xFFC8}, {"F12", 0xFFC9}, + {"L2", 0xFFC9}, {"F13", 0xFFCA}, {"L3", 0xFFCA}, {"F14", 0xFFCB}, + {"L4", 0xFFCB}, {"F15", 0xFFCC}, {"L5", 0xFFCC}, {"F16", 0xFFCD}, + {"L6", 0xFFCD}, {"F17", 0xFFCE}, {"L7", 0xFFCE}, {"F18", 0xFFCF}, + {"L8", 0xFFCF}, {"F19", 0xFFD0}, {"L9", 0xFFD0}, {"F20", 0xFFD1}, + {"L10", 0xFFD1}, {"F21", 0xFFD2}, {"R1", 0xFFD2}, {"F22", 0xFFD3}, + {"R2", 0xFFD3}, {"F23", 0xFFD4}, {"R3", 0xFFD4}, {"F24", 0xFFD5}, + {"R4", 0xFFD5}, {"F25", 0xFFD6}, {"R5", 0xFFD6}, {"F26", 0xFFD7}, + {"R6", 0xFFD7}, {"F27", 0xFFD8}, {"R7", 0xFFD8}, {"F28", 0xFFD9}, + {"R8", 0xFFD9}, {"F29", 0xFFDA}, {"R9", 0xFFDA}, {"F30", 0xFFDB}, + {"R10", 0xFFDB}, {"F31", 0xFFDC}, {"R11", 0xFFDC}, {"F32", 0xFFDD}, + {"R12", 0xFFDD}, {"F33", 0xFFDE}, {"R13", 0xFFDE}, {"F34", 0xFFDF}, + {"R14", 0xFFDF}, {"F35", 0xFFE0}, {"R15", 0xFFE0}, {"Shift_L", 0xFFE1}, + {"Shift_R", 0xFFE2}, {"Control_L", 0xFFE3}, {"Control_R", 0xFFE4}, + {"Caps_Lock", 0xFFE5}, {"Shift_Lock", 0xFFE6}, {"Meta_L", 0xFFE7}, + {"Meta_R", 0xFFE8}, {"Alt_L", 0xFFE9}, {"Alt_R", 0xFFEA}, + {"Super_L", 0xFFEB}, {"Super_R", 0xFFEC}, {"Hyper_L", 0xFFED}, + {"Hyper_R", 0xFFEE}, {"space", 0x020}, {"exclam", 0x021}, + {"quotedbl", 0x022}, {"numbersign", 0x023}, {"dollar", 0x024}, + {"percent", 0x025}, {"ampersand", 0x026}, {"quoteright", 0x027}, + {"parenleft", 0x028}, {"parenright", 0x029}, {"asterisk", 0x02a}, + {"plus", 0x02b}, {"comma", 0x02c}, {"minus", 0x02d}, {"period", 0x02e}, + {"slash", 0x02f}, {"0", 0x030}, {"1", 0x031}, {"2", 0x032}, {"3", 0x033}, + {"4", 0x034}, {"5", 0x035}, {"6", 0x036}, {"7", 0x037}, {"8", 0x038}, + {"9", 0x039}, {"colon", 0x03a}, {"semicolon", 0x03b}, {"less", 0x03c}, + {"equal", 0x03d}, {"greater", 0x03e}, {"question", 0x03f}, {"at", 0x040}, + {"A", 0x041}, {"B", 0x042}, {"C", 0x043}, {"D", 0x044}, {"E", 0x045}, + {"F", 0x046}, {"G", 0x047}, {"H", 0x048}, {"I", 0x049}, {"J", 0x04a}, + {"K", 0x04b}, {"L", 0x04c}, {"M", 0x04d}, {"N", 0x04e}, {"O", 0x04f}, + {"P", 0x050}, {"Q", 0x051}, {"R", 0x052}, {"S", 0x053}, {"T", 0x054}, + {"U", 0x055}, {"V", 0x056}, {"W", 0x057}, {"X", 0x058}, {"Y", 0x059}, + {"Z", 0x05a}, {"bracketleft", 0x05b}, {"backslash", 0x05c}, + {"bracketright", 0x05d}, {"asciicircum", 0x05e}, {"underscore", 0x05f}, + {"quoteleft", 0x060}, {"a", 0x061}, {"b", 0x062}, {"c", 0x063}, + {"d", 0x064}, {"e", 0x065}, {"f", 0x066}, {"g", 0x067}, {"h", 0x068}, + {"i", 0x069}, {"j", 0x06a}, {"k", 0x06b}, {"l", 0x06c}, {"m", 0x06d}, + {"n", 0x06e}, {"o", 0x06f}, {"p", 0x070}, {"q", 0x071}, {"r", 0x072}, + {"s", 0x073}, {"t", 0x074}, {"u", 0x075}, {"v", 0x076}, {"w", 0x077}, + {"x", 0x078}, {"y", 0x079}, {"z", 0x07a}, {"braceleft", 0x07b}, + {"bar", 0x07c}, {"braceright", 0x07d}, {"asciitilde", 0x07e}, + {"nobreakspace", 0x0a0}, {"exclamdown", 0x0a1}, {"cent", 0x0a2}, + {"sterling", 0x0a3}, {"currency", 0x0a4}, {"yen", 0x0a5}, + {"brokenbar", 0x0a6}, {"section", 0x0a7}, {"diaeresis", 0x0a8}, + {"copyright", 0x0a9}, {"ordfeminine", 0x0aa}, {"guillemotleft", 0x0ab}, + {"notsign", 0x0ac}, {"hyphen", 0x0ad}, {"registered", 0x0ae}, + {"macron", 0x0af}, {"degree", 0x0b0}, {"plusminus", 0x0b1}, + {"twosuperior", 0x0b2}, {"threesuperior", 0x0b3}, {"acute", 0x0b4}, + {"mu", 0x0b5}, {"paragraph", 0x0b6}, {"periodcentered", 0x0b7}, + {"cedilla", 0x0b8}, {"onesuperior", 0x0b9}, {"masculine", 0x0ba}, + {"guillemotright", 0x0bb}, {"onequarter", 0x0bc}, {"onehalf", 0x0bd}, + {"threequarters", 0x0be}, {"questiondown", 0x0bf}, {"Agrave", 0x0c0}, + {"Aacute", 0x0c1}, {"Acircumflex", 0x0c2}, {"Atilde", 0x0c3}, + {"Adiaeresis", 0x0c4}, {"Aring", 0x0c5}, {"AE", 0x0c6}, {"Ccedilla", 0x0c7}, + {"Egrave", 0x0c8}, {"Eacute", 0x0c9}, {"Ecircumflex", 0x0ca}, + {"Ediaeresis", 0x0cb}, {"Igrave", 0x0cc}, {"Iacute", 0x0cd}, + {"Icircumflex", 0x0ce}, {"Idiaeresis", 0x0cf}, {"Eth", 0x0d0}, + {"Ntilde", 0x0d1}, {"Ograve", 0x0d2}, {"Oacute", 0x0d3}, + {"Ocircumflex", 0x0d4}, {"Otilde", 0x0d5}, {"Odiaeresis", 0x0d6}, + {"multiply", 0x0d7}, {"Ooblique", 0x0d8}, {"Ugrave", 0x0d9}, + {"Uacute", 0x0da}, {"Ucircumflex", 0x0db}, {"Udiaeresis", 0x0dc}, + {"Yacute", 0x0dd}, {"Thorn", 0x0de}, {"ssharp", 0x0df}, {"agrave", 0x0e0}, + {"aacute", 0x0e1}, {"acircumflex", 0x0e2}, {"atilde", 0x0e3}, + {"adiaeresis", 0x0e4}, {"aring", 0x0e5}, {"ae", 0x0e6}, {"ccedilla", 0x0e7}, + {"egrave", 0x0e8}, {"eacute", 0x0e9}, {"ecircumflex", 0x0ea}, + {"ediaeresis", 0x0eb}, {"igrave", 0x0ec}, {"iacute", 0x0ed}, + {"icircumflex", 0x0ee}, {"idiaeresis", 0x0ef}, {"eth", 0x0f0}, + {"ntilde", 0x0f1}, {"ograve", 0x0f2}, {"oacute", 0x0f3}, + {"ocircumflex", 0x0f4}, {"otilde", 0x0f5}, {"odiaeresis", 0x0f6}, + {"division", 0x0f7}, {"oslash", 0x0f8}, {"ugrave", 0x0f9}, + {"uacute", 0x0fa}, {"ucircumflex", 0x0fb}, {"udiaeresis", 0x0fc}, + {"yacute", 0x0fd}, {"thorn", 0x0fe}, {"ydiaeresis", 0x0ff}, + {"Aogonek", 0x1a1}, {"breve", 0x1a2}, {"Lstroke", 0x1a3}, {"Lcaron", 0x1a5}, + {"Sacute", 0x1a6}, {"Scaron", 0x1a9}, {"Scedilla", 0x1aa}, + {"Tcaron", 0x1ab}, {"Zacute", 0x1ac}, {"Zcaron", 0x1ae}, + {"Zabovedot", 0x1af}, {"aogonek", 0x1b1}, {"ogonek", 0x1b2}, + {"lstroke", 0x1b3}, {"lcaron", 0x1b5}, {"sacute", 0x1b6}, {"caron", 0x1b7}, + {"scaron", 0x1b9}, {"scedilla", 0x1ba}, {"tcaron", 0x1bb}, + {"zacute", 0x1bc}, {"doubleacute", 0x1bd}, {"zcaron", 0x1be}, + {"zabovedot", 0x1bf}, {"Racute", 0x1c0}, {"Abreve", 0x1c3}, + {"Cacute", 0x1c6}, {"Ccaron", 0x1c8}, {"Eogonek", 0x1ca}, {"Ecaron", 0x1cc}, + {"Dcaron", 0x1cf}, {"Nacute", 0x1d1}, {"Ncaron", 0x1d2}, + {"Odoubleacute", 0x1d5}, {"Rcaron", 0x1d8}, {"Uring", 0x1d9}, + {"Udoubleacute", 0x1db}, {"Tcedilla", 0x1de}, {"racute", 0x1e0}, + {"abreve", 0x1e3}, {"cacute", 0x1e6}, {"ccaron", 0x1e8}, {"eogonek", 0x1ea}, + {"ecaron", 0x1ec}, {"dcaron", 0x1ef}, {"nacute", 0x1f1}, {"ncaron", 0x1f2}, + {"odoubleacute", 0x1f5}, {"udoubleacute", 0x1fb}, {"rcaron", 0x1f8}, + {"uring", 0x1f9}, {"tcedilla", 0x1fe}, {"abovedot", 0x1ff}, + {"Hstroke", 0x2a1}, {"Hcircumflex", 0x2a6}, {"Iabovedot", 0x2a9}, + {"Gbreve", 0x2ab}, {"Jcircumflex", 0x2ac}, {"hstroke", 0x2b1}, + {"hcircumflex", 0x2b6}, {"idotless", 0x2b9}, {"gbreve", 0x2bb}, + {"jcircumflex", 0x2bc}, {"Cabovedot", 0x2c5}, {"Ccircumflex", 0x2c6}, + {"Gabovedot", 0x2d5}, {"Gcircumflex", 0x2d8}, {"Ubreve", 0x2dd}, + {"Scircumflex", 0x2de}, {"cabovedot", 0x2e5}, {"ccircumflex", 0x2e6}, + {"gabovedot", 0x2f5}, {"gcircumflex", 0x2f8}, {"ubreve", 0x2fd}, + {"scircumflex", 0x2fe}, {"kappa", 0x3a2}, {"Rcedilla", 0x3a3}, + {"Itilde", 0x3a5}, {"Lcedilla", 0x3a6}, {"Emacron", 0x3aa}, + {"Gcedilla", 0x3ab}, {"Tslash", 0x3ac}, {"rcedilla", 0x3b3}, + {"itilde", 0x3b5}, {"lcedilla", 0x3b6}, {"emacron", 0x3ba}, + {"gacute", 0x3bb}, {"tslash", 0x3bc}, {"ENG", 0x3bd}, {"eng", 0x3bf}, + {"Amacron", 0x3c0}, {"Iogonek", 0x3c7}, {"Eabovedot", 0x3cc}, + {"Imacron", 0x3cf}, {"Ncedilla", 0x3d1}, {"Omacron", 0x3d2}, + {"Kcedilla", 0x3d3}, {"Uogonek", 0x3d9}, {"Utilde", 0x3dd}, + {"Umacron", 0x3de}, {"amacron", 0x3e0}, {"iogonek", 0x3e7}, + {"eabovedot", 0x3ec}, {"imacron", 0x3ef}, {"ncedilla", 0x3f1}, + {"omacron", 0x3f2}, {"kcedilla", 0x3f3}, {"uogonek", 0x3f9}, + {"utilde", 0x3fd}, {"umacron", 0x3fe}, {"overline", 0x47e}, + {"kana_fullstop", 0x4a1}, {"kana_openingbracket", 0x4a2}, + {"kana_closingbracket", 0x4a3}, {"kana_comma", 0x4a4}, + {"kana_middledot", 0x4a5}, {"kana_WO", 0x4a6}, {"kana_a", 0x4a7}, + {"kana_i", 0x4a8}, {"kana_u", 0x4a9}, {"kana_e", 0x4aa}, {"kana_o", 0x4ab}, + {"kana_ya", 0x4ac}, {"kana_yu", 0x4ad}, {"kana_yo", 0x4ae}, + {"kana_tu", 0x4af}, {"prolongedsound", 0x4b0}, {"kana_A", 0x4b1}, + {"kana_I", 0x4b2}, {"kana_U", 0x4b3}, {"kana_E", 0x4b4}, {"kana_O", 0x4b5}, + {"kana_KA", 0x4b6}, {"kana_KI", 0x4b7}, {"kana_KU", 0x4b8}, + {"kana_KE", 0x4b9}, {"kana_KO", 0x4ba}, {"kana_SA", 0x4bb}, + {"kana_SHI", 0x4bc}, {"kana_SU", 0x4bd}, {"kana_SE", 0x4be}, + {"kana_SO", 0x4bf}, {"kana_TA", 0x4c0}, {"kana_TI", 0x4c1}, + {"kana_TU", 0x4c2}, {"kana_TE", 0x4c3}, {"kana_TO", 0x4c4}, + {"kana_NA", 0x4c5}, {"kana_NI", 0x4c6}, {"kana_NU", 0x4c7}, + {"kana_NE", 0x4c8}, {"kana_NO", 0x4c9}, {"kana_HA", 0x4ca}, + {"kana_HI", 0x4cb}, {"kana_HU", 0x4cc}, {"kana_HE", 0x4cd}, + {"kana_HO", 0x4ce}, {"kana_MA", 0x4cf}, {"kana_MI", 0x4d0}, + {"kana_MU", 0x4d1}, {"kana_ME", 0x4d2}, {"kana_MO", 0x4d3}, + {"kana_YA", 0x4d4}, {"kana_YU", 0x4d5}, {"kana_YO", 0x4d6}, + {"kana_RA", 0x4d7}, {"kana_RI", 0x4d8}, {"kana_RU", 0x4d9}, + {"kana_RE", 0x4da}, {"kana_RO", 0x4db}, {"kana_WA", 0x4dc}, + {"kana_N", 0x4dd}, {"voicedsound", 0x4de}, {"semivoicedsound", 0x4df}, + {"kana_switch", 0xFF7E}, {"Arabic_comma", 0x5ac}, + {"Arabic_semicolon", 0x5bb}, {"Arabic_question_mark", 0x5bf}, + {"Arabic_hamza", 0x5c1}, {"Arabic_maddaonalef", 0x5c2}, + {"Arabic_hamzaonalef", 0x5c3}, {"Arabic_hamzaonwaw", 0x5c4}, + {"Arabic_hamzaunderalef", 0x5c5}, {"Arabic_hamzaonyeh", 0x5c6}, + {"Arabic_alef", 0x5c7}, {"Arabic_beh", 0x5c8}, {"Arabic_tehmarbuta", 0x5c9}, + {"Arabic_teh", 0x5ca}, {"Arabic_theh", 0x5cb}, {"Arabic_jeem", 0x5cc}, + {"Arabic_hah", 0x5cd}, {"Arabic_khah", 0x5ce}, {"Arabic_dal", 0x5cf}, + {"Arabic_thal", 0x5d0}, {"Arabic_ra", 0x5d1}, {"Arabic_zain", 0x5d2}, + {"Arabic_seen", 0x5d3}, {"Arabic_sheen", 0x5d4}, {"Arabic_sad", 0x5d5}, + {"Arabic_dad", 0x5d6}, {"Arabic_tah", 0x5d7}, {"Arabic_zah", 0x5d8}, + {"Arabic_ain", 0x5d9}, {"Arabic_ghain", 0x5da}, {"Arabic_tatweel", 0x5e0}, + {"Arabic_feh", 0x5e1}, {"Arabic_qaf", 0x5e2}, {"Arabic_kaf", 0x5e3}, + {"Arabic_lam", 0x5e4}, {"Arabic_meem", 0x5e5}, {"Arabic_noon", 0x5e6}, + {"Arabic_heh", 0x5e7}, {"Arabic_waw", 0x5e8}, {"Arabic_alefmaksura", 0x5e9}, + {"Arabic_yeh", 0x5ea}, {"Arabic_fathatan", 0x5eb}, + {"Arabic_dammatan", 0x5ec}, {"Arabic_kasratan", 0x5ed}, + {"Arabic_fatha", 0x5ee}, {"Arabic_damma", 0x5ef}, {"Arabic_kasra", 0x5f0}, + {"Arabic_shadda", 0x5f1}, {"Arabic_sukun", 0x5f2}, + {"Arabic_switch", 0xFF7E}, {"Serbian_dje", 0x6a1}, {"Macedonia_gje", 0x6a2}, + {"Cyrillic_io", 0x6a3}, {"Ukranian_je", 0x6a4}, {"Macedonia_dse", 0x6a5}, + {"Ukranian_i", 0x6a6}, {"Ukranian_yi", 0x6a7}, {"Serbian_je", 0x6a8}, + {"Serbian_lje", 0x6a9}, {"Serbian_nje", 0x6aa}, {"Serbian_tshe", 0x6ab}, + {"Macedonia_kje", 0x6ac}, {"Byelorussian_shortu", 0x6ae}, + {"Serbian_dze", 0x6af}, {"numerosign", 0x6b0}, {"Serbian_DJE", 0x6b1}, + {"Macedonia_GJE", 0x6b2}, {"Cyrillic_IO", 0x6b3}, {"Ukranian_JE", 0x6b4}, + {"Macedonia_DSE", 0x6b5}, {"Ukranian_I", 0x6b6}, {"Ukranian_YI", 0x6b7}, + {"Serbian_JE", 0x6b8}, {"Serbian_LJE", 0x6b9}, {"Serbian_NJE", 0x6ba}, + {"Serbian_TSHE", 0x6bb}, {"Macedonia_KJE", 0x6bc}, + {"Byelorussian_SHORTU", 0x6be}, {"Serbian_DZE", 0x6bf}, + {"Cyrillic_yu", 0x6c0}, {"Cyrillic_a", 0x6c1}, {"Cyrillic_be", 0x6c2}, + {"Cyrillic_tse", 0x6c3}, {"Cyrillic_de", 0x6c4}, {"Cyrillic_ie", 0x6c5}, + {"Cyrillic_ef", 0x6c6}, {"Cyrillic_ghe", 0x6c7}, {"Cyrillic_ha", 0x6c8}, + {"Cyrillic_i", 0x6c9}, {"Cyrillic_shorti", 0x6ca}, {"Cyrillic_ka", 0x6cb}, + {"Cyrillic_el", 0x6cc}, {"Cyrillic_em", 0x6cd}, {"Cyrillic_en", 0x6ce}, + {"Cyrillic_o", 0x6cf}, {"Cyrillic_pe", 0x6d0}, {"Cyrillic_ya", 0x6d1}, + {"Cyrillic_er", 0x6d2}, {"Cyrillic_es", 0x6d3}, {"Cyrillic_te", 0x6d4}, + {"Cyrillic_u", 0x6d5}, {"Cyrillic_zhe", 0x6d6}, {"Cyrillic_ve", 0x6d7}, + {"Cyrillic_softsign", 0x6d8}, {"Cyrillic_yeru", 0x6d9}, + {"Cyrillic_ze", 0x6da}, {"Cyrillic_sha", 0x6db}, {"Cyrillic_e", 0x6dc}, + {"Cyrillic_shcha", 0x6dd}, {"Cyrillic_che", 0x6de}, + {"Cyrillic_hardsign", 0x6df}, {"Cyrillic_YU", 0x6e0}, {"Cyrillic_A", 0x6e1}, + {"Cyrillic_BE", 0x6e2}, {"Cyrillic_TSE", 0x6e3}, {"Cyrillic_DE", 0x6e4}, + {"Cyrillic_IE", 0x6e5}, {"Cyrillic_EF", 0x6e6}, {"Cyrillic_GHE", 0x6e7}, + {"Cyrillic_HA", 0x6e8}, {"Cyrillic_I", 0x6e9}, {"Cyrillic_SHORTI", 0x6ea}, + {"Cyrillic_KA", 0x6eb}, {"Cyrillic_EL", 0x6ec}, {"Cyrillic_EM", 0x6ed}, + {"Cyrillic_EN", 0x6ee}, {"Cyrillic_O", 0x6ef}, {"Cyrillic_PE", 0x6f0}, + {"Cyrillic_YA", 0x6f1}, {"Cyrillic_ER", 0x6f2}, {"Cyrillic_ES", 0x6f3}, + {"Cyrillic_TE", 0x6f4}, {"Cyrillic_U", 0x6f5}, {"Cyrillic_ZHE", 0x6f6}, + {"Cyrillic_VE", 0x6f7}, {"Cyrillic_SOFTSIGN", 0x6f8}, + {"Cyrillic_YERU", 0x6f9}, {"Cyrillic_ZE", 0x6fa}, {"Cyrillic_SHA", 0x6fb}, + {"Cyrillic_E", 0x6fc}, {"Cyrillic_SHCHA", 0x6fd}, {"Cyrillic_CHE", 0x6fe}, + {"Cyrillic_HARDSIGN", 0x6ff}, {"Greek_ALPHAaccent", 0x7a1}, + {"Greek_EPSILONaccent", 0x7a2}, {"Greek_ETAaccent", 0x7a3}, + {"Greek_IOTAaccent", 0x7a4}, {"Greek_IOTAdiaeresis", 0x7a5}, + {"Greek_IOTAaccentdiaeresis", 0x7a6}, {"Greek_OMICRONaccent", 0x7a7}, + {"Greek_UPSILONaccent", 0x7a8}, {"Greek_UPSILONdieresis", 0x7a9}, + {"Greek_UPSILONaccentdieresis", 0x7aa}, {"Greek_OMEGAaccent", 0x7ab}, + {"Greek_alphaaccent", 0x7b1}, {"Greek_epsilonaccent", 0x7b2}, + {"Greek_etaaccent", 0x7b3}, {"Greek_iotaaccent", 0x7b4}, + {"Greek_iotadieresis", 0x7b5}, {"Greek_iotaaccentdieresis", 0x7b6}, + {"Greek_omicronaccent", 0x7b7}, {"Greek_upsilonaccent", 0x7b8}, + {"Greek_upsilondieresis", 0x7b9}, {"Greek_upsilonaccentdieresis", 0x7ba}, + {"Greek_omegaaccent", 0x7bb}, {"Greek_ALPHA", 0x7c1}, {"Greek_BETA", 0x7c2}, + {"Greek_GAMMA", 0x7c3}, {"Greek_DELTA", 0x7c4}, {"Greek_EPSILON", 0x7c5}, + {"Greek_ZETA", 0x7c6}, {"Greek_ETA", 0x7c7}, {"Greek_THETA", 0x7c8}, + {"Greek_IOTA", 0x7c9}, {"Greek_KAPPA", 0x7ca}, {"Greek_LAMBDA", 0x7cb}, + {"Greek_MU", 0x7cc}, {"Greek_NU", 0x7cd}, {"Greek_XI", 0x7ce}, + {"Greek_OMICRON", 0x7cf}, {"Greek_PI", 0x7d0}, {"Greek_RHO", 0x7d1}, + {"Greek_SIGMA", 0x7d2}, {"Greek_TAU", 0x7d4}, {"Greek_UPSILON", 0x7d5}, + {"Greek_PHI", 0x7d6}, {"Greek_CHI", 0x7d7}, {"Greek_PSI", 0x7d8}, + {"Greek_OMEGA", 0x7d9}, {"Greek_alpha", 0x7e1}, {"Greek_beta", 0x7e2}, + {"Greek_gamma", 0x7e3}, {"Greek_delta", 0x7e4}, {"Greek_epsilon", 0x7e5}, + {"Greek_zeta", 0x7e6}, {"Greek_eta", 0x7e7}, {"Greek_theta", 0x7e8}, + {"Greek_iota", 0x7e9}, {"Greek_kappa", 0x7ea}, {"Greek_lambda", 0x7eb}, + {"Greek_mu", 0x7ec}, {"Greek_nu", 0x7ed}, {"Greek_xi", 0x7ee}, + {"Greek_omicron", 0x7ef}, {"Greek_pi", 0x7f0}, {"Greek_rho", 0x7f1}, + {"Greek_sigma", 0x7f2}, {"Greek_finalsmallsigma", 0x7f3}, + {"Greek_tau", 0x7f4}, {"Greek_upsilon", 0x7f5}, {"Greek_phi", 0x7f6}, + {"Greek_chi", 0x7f7}, {"Greek_psi", 0x7f8}, {"Greek_omega", 0x7f9}, + {"Greek_switch", 0xFF7E}, {"leftradical", 0x8a1}, {"topleftradical", 0x8a2}, + {"horizconnector", 0x8a3}, {"topintegral", 0x8a4}, {"botintegral", 0x8a5}, + {"vertconnector", 0x8a6}, {"topleftsqbracket", 0x8a7}, + {"botleftsqbracket", 0x8a8}, {"toprightsqbracket", 0x8a9}, + {"botrightsqbracket", 0x8aa}, {"topleftparens", 0x8ab}, + {"botleftparens", 0x8ac}, {"toprightparens", 0x8ad}, + {"botrightparens", 0x8ae}, {"leftmiddlecurlybrace", 0x8af}, + {"rightmiddlecurlybrace", 0x8b0}, {"topleftsummation", 0x8b1}, + {"botleftsummation", 0x8b2}, {"topvertsummationconnector", 0x8b3}, + {"botvertsummationconnector", 0x8b4}, {"toprightsummation", 0x8b5}, + {"botrightsummation", 0x8b6}, {"rightmiddlesummation", 0x8b7}, + {"lessthanequal", 0x8bc}, {"notequal", 0x8bd}, {"greaterthanequal", 0x8be}, + {"integral", 0x8bf}, {"therefore", 0x8c0}, {"variation", 0x8c1}, + {"infinity", 0x8c2}, {"nabla", 0x8c5}, {"approximate", 0x8c8}, + {"similarequal", 0x8c9}, {"ifonlyif", 0x8cd}, {"implies", 0x8ce}, + {"identical", 0x8cf}, {"radical", 0x8d6}, {"includedin", 0x8da}, + {"includes", 0x8db}, {"intersection", 0x8dc}, {"union", 0x8dd}, + {"logicaland", 0x8de}, {"logicalor", 0x8df}, {"partialderivative", 0x8ef}, + {"function", 0x8f6}, {"leftarrow", 0x8fb}, {"uparrow", 0x8fc}, + {"rightarrow", 0x8fd}, {"downarrow", 0x8fe}, {"blank", 0x9df}, + {"soliddiamond", 0x9e0}, {"checkerboard", 0x9e1}, {"ht", 0x9e2}, + {"ff", 0x9e3}, {"cr", 0x9e4}, {"lf", 0x9e5}, {"nl", 0x9e8}, {"vt", 0x9e9}, + {"lowrightcorner", 0x9ea}, {"uprightcorner", 0x9eb}, + {"upleftcorner", 0x9ec}, {"lowleftcorner", 0x9ed}, {"crossinglines", 0x9ee}, + {"horizlinescan1", 0x9ef}, {"horizlinescan3", 0x9f0}, + {"horizlinescan5", 0x9f1}, {"horizlinescan7", 0x9f2}, + {"horizlinescan9", 0x9f3}, {"leftt", 0x9f4}, {"rightt", 0x9f5}, + {"bott", 0x9f6}, {"topt", 0x9f7}, {"vertbar", 0x9f8}, {"emspace", 0xaa1}, + {"enspace", 0xaa2}, {"em3space", 0xaa3}, {"em4space", 0xaa4}, + {"digitspace", 0xaa5}, {"punctspace", 0xaa6}, {"thinspace", 0xaa7}, + {"hairspace", 0xaa8}, {"emdash", 0xaa9}, {"endash", 0xaaa}, + {"signifblank", 0xaac}, {"ellipsis", 0xaae}, {"doubbaselinedot", 0xaaf}, + {"onethird", 0xab0}, {"twothirds", 0xab1}, {"onefifth", 0xab2}, + {"twofifths", 0xab3}, {"threefifths", 0xab4}, {"fourfifths", 0xab5}, + {"onesixth", 0xab6}, {"fivesixths", 0xab7}, {"careof", 0xab8}, + {"figdash", 0xabb}, {"leftanglebracket", 0xabc}, {"decimalpoint", 0xabd}, + {"rightanglebracket", 0xabe}, {"marker", 0xabf}, {"oneeighth", 0xac3}, + {"threeeighths", 0xac4}, {"fiveeighths", 0xac5}, {"seveneighths", 0xac6}, + {"trademark", 0xac9}, {"signaturemark", 0xaca}, + {"trademarkincircle", 0xacb}, {"leftopentriangle", 0xacc}, + {"rightopentriangle", 0xacd}, {"emopencircle", 0xace}, + {"emopenrectangle", 0xacf}, {"leftsinglequotemark", 0xad0}, + {"rightsinglequotemark", 0xad1}, {"leftdoublequotemark", 0xad2}, + {"rightdoublequotemark", 0xad3}, {"prescription", 0xad4}, + {"minutes", 0xad6}, {"seconds", 0xad7}, {"latincross", 0xad9}, + {"hexagram", 0xada}, {"filledrectbullet", 0xadb}, + {"filledlefttribullet", 0xadc}, {"filledrighttribullet", 0xadd}, + {"emfilledcircle", 0xade}, {"emfilledrect", 0xadf}, + {"enopencircbullet", 0xae0}, {"enopensquarebullet", 0xae1}, + {"openrectbullet", 0xae2}, {"opentribulletup", 0xae3}, + {"opentribulletdown", 0xae4}, {"openstar", 0xae5}, + {"enfilledcircbullet", 0xae6}, {"enfilledsqbullet", 0xae7}, + {"filledtribulletup", 0xae8}, {"filledtribulletdown", 0xae9}, + {"leftpointer", 0xaea}, {"rightpointer", 0xaeb}, {"club", 0xaec}, + {"diamond", 0xaed}, {"heart", 0xaee}, {"maltesecross", 0xaf0}, + {"dagger", 0xaf1}, {"doubledagger", 0xaf2}, {"checkmark", 0xaf3}, + {"ballotcross", 0xaf4}, {"musicalsharp", 0xaf5}, {"musicalflat", 0xaf6}, + {"malesymbol", 0xaf7}, {"femalesymbol", 0xaf8}, {"telephone", 0xaf9}, + {"telephonerecorder", 0xafa}, {"phonographcopyright", 0xafb}, + {"caret", 0xafc}, {"singlelowquotemark", 0xafd}, + {"doublelowquotemark", 0xafe}, {"cursor", 0xaff}, {"leftcaret", 0xba3}, + {"rightcaret", 0xba6}, {"downcaret", 0xba8}, {"upcaret", 0xba9}, + {"overbar", 0xbc0}, {"downtack", 0xbc2}, {"upshoe", 0xbc3}, + {"downstile", 0xbc4}, {"underbar", 0xbc6}, {"jot", 0xbca}, {"quad", 0xbcc}, + {"uptack", 0xbce}, {"circle", 0xbcf}, {"upstile", 0xbd3}, + {"downshoe", 0xbd6}, {"rightshoe", 0xbd8}, {"leftshoe", 0xbda}, + {"lefttack", 0xbdc}, {"righttack", 0xbfc}, {"hebrew_aleph", 0xce0}, + {"hebrew_beth", 0xce1}, {"hebrew_gimmel", 0xce2}, {"hebrew_daleth", 0xce3}, + {"hebrew_he", 0xce4}, {"hebrew_waw", 0xce5}, {"hebrew_zayin", 0xce6}, + {"hebrew_het", 0xce7}, {"hebrew_teth", 0xce8}, {"hebrew_yod", 0xce9}, + {"hebrew_finalkaph", 0xcea}, {"hebrew_kaph", 0xceb}, + {"hebrew_lamed", 0xcec}, {"hebrew_finalmem", 0xced}, {"hebrew_mem", 0xcee}, + {"hebrew_finalnun", 0xcef}, {"hebrew_nun", 0xcf0}, {"hebrew_samekh", 0xcf1}, + {"hebrew_ayin", 0xcf2}, {"hebrew_finalpe", 0xcf3}, {"hebrew_pe", 0xcf4}, + {"hebrew_finalzadi", 0xcf5}, {"hebrew_zadi", 0xcf6}, {"hebrew_kuf", 0xcf7}, + {"hebrew_resh", 0xcf8}, {"hebrew_shin", 0xcf9}, {"hebrew_taf", 0xcfa}, + {"Hebrew_switch", 0xFF7E}, {"XF86AudioLowerVolume", 0x1008FF11}, + {"XF86AudioMute", 0x1008FF12}, {"XF86AudioRaiseVolume", 0x1008FF13}, + {"XF86AudioPlay", 0x1008FF14}, {"XF86AudioStop", 0x1008FF15}, + {"XF86AudioPrev", 0x1008FF16}, {"XF86AudioNext", 0x1008FF17}, diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/lzma.h b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma.h new file mode 100644 index 0000000..4cbb4d0 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma.h @@ -0,0 +1,319 @@ +/** + * \file api/lzma.h + * \brief The public API of liblzma data compression library + * + * liblzma is a public domain general-purpose data compression library with + * a zlib-like API. The native file format is .xz, but also the old .lzma + * format and raw (no headers) streams are supported. Multiple compression + * algorithms (filters) are supported. Currently LZMA2 is the primary filter. + * + * liblzma is part of XZ Utils . XZ Utils includes + * a gzip-like command line tool named xz and some other tools. XZ Utils + * is developed and maintained by Lasse Collin. + * + * Major parts of liblzma are based on Igor Pavlov's public domain LZMA SDK + * . + * + * The SHA-256 implementation is based on the public domain code found from + * 7-Zip , which has a modified version of the public + * domain SHA-256 code found from Crypto++ . + * The SHA-256 code in Crypto++ was written by Kevin Springle and Wei Dai. + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + */ + +#ifndef LZMA_H +#define LZMA_H + +/***************************** + * Required standard headers * + *****************************/ + +/* + * liblzma API headers need some standard types and macros. To allow + * including lzma.h without requiring the application to include other + * headers first, lzma.h includes the required standard headers unless + * they already seem to be included already or if LZMA_MANUAL_HEADERS + * has been defined. + * + * Here's what types and macros are needed and from which headers: + * - stddef.h: size_t, NULL + * - stdint.h: uint8_t, uint32_t, uint64_t, UINT32_C(n), uint64_C(n), + * UINT32_MAX, UINT64_MAX + * + * However, inttypes.h is a little more portable than stdint.h, although + * inttypes.h declares some unneeded things compared to plain stdint.h. + * + * The hacks below aren't perfect, specifically they assume that inttypes.h + * exists and that it typedefs at least uint8_t, uint32_t, and uint64_t, + * and that, in case of incomplete inttypes.h, unsigned int is 32-bit. + * If the application already takes care of setting up all the types and + * macros properly (for example by using gnulib's stdint.h or inttypes.h), + * we try to detect that the macros are already defined and don't include + * inttypes.h here again. However, you may define LZMA_MANUAL_HEADERS to + * force this file to never include any system headers. + * + * Some could argue that liblzma API should provide all the required types, + * for example lzma_uint64, LZMA_UINT64_C(n), and LZMA_UINT64_MAX. This was + * seen as an unnecessary mess, since most systems already provide all the + * necessary types and macros in the standard headers. + * + * Note that liblzma API still has lzma_bool, because using stdbool.h would + * break C89 and C++ programs on many systems. sizeof(bool) in C99 isn't + * necessarily the same as sizeof(bool) in C++. + */ + +#ifndef LZMA_MANUAL_HEADERS +/* + * I suppose this works portably also in C++. Note that in C++, + * we need to get size_t into the global namespace. + */ +#include + +/* + * Skip inttypes.h if we already have all the required macros. If we + * have the macros, we assume that we have the matching typedefs too. + */ +#if !defined(UINT32_C) || !defined(UINT64_C) || !defined(UINT32_MAX) || \ + !defined(UINT64_MAX) +/* + * MSVC versions older than 2013 have no C99 support, and + * thus they cannot be used to compile liblzma. Using an + * existing liblzma.dll with old MSVC can work though(*), + * but we need to define the required standard integer + * types here in a MSVC-specific way. + * + * (*) If you do this, the existing liblzma.dll probably uses + * a different runtime library than your MSVC-built + * application. Mixing runtimes is generally bad, but + * in this case it should work as long as you avoid + * the few rarely-needed liblzma functions that allocate + * memory and expect the caller to free it using free(). + */ +#if defined(_WIN32) && defined(_MSC_VER) && _MSC_VER < 1800 +typedef unsigned __int8 uint8_t; +typedef unsigned __int32 uint32_t; +typedef unsigned __int64 uint64_t; +#else +/* Use the standard inttypes.h. */ +#ifdef __cplusplus +/* + * C99 sections 7.18.2 and 7.18.4 specify + * that C++ implementations define the limit + * and constant macros only if specifically + * requested. Note that if you want the + * format macros (PRIu64 etc.) too, you need + * to define __STDC_FORMAT_MACROS before + * including lzma.h, since re-including + * inttypes.h with __STDC_FORMAT_MACROS + * defined doesn't necessarily work. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif +#ifndef __STDC_CONSTANT_MACROS +#define __STDC_CONSTANT_MACROS 1 +#endif +#endif + +#include +#endif + +/* + * Some old systems have only the typedefs in inttypes.h, and + * lack all the macros. For those systems, we need a few more + * hacks. We assume that unsigned int is 32-bit and unsigned + * long is either 32-bit or 64-bit. If these hacks aren't + * enough, the application has to setup the types manually + * before including lzma.h. + */ +#ifndef UINT32_C +#if defined(_WIN32) && defined(_MSC_VER) +#define UINT32_C(n) n##UI32 +#else +#define UINT32_C(n) n##U +#endif +#endif + +#ifndef UINT64_C +#if defined(_WIN32) && defined(_MSC_VER) +#define UINT64_C(n) n##UI64 +#else +/* Get ULONG_MAX. */ +#include +#if ULONG_MAX == 4294967295UL +#define UINT64_C(n) n##ULL +#else +#define UINT64_C(n) n##UL +#endif +#endif +#endif + +#ifndef UINT32_MAX +#define UINT32_MAX (UINT32_C(4294967295)) +#endif + +#ifndef UINT64_MAX +#define UINT64_MAX (UINT64_C(18446744073709551615)) +#endif +#endif +#endif /* ifdef LZMA_MANUAL_HEADERS */ + +/****************** + * LZMA_API macro * + ******************/ + +/* + * Some systems require that the functions and function pointers are + * declared specially in the headers. LZMA_API_IMPORT is for importing + * symbols and LZMA_API_CALL is to specify the calling convention. + * + * By default it is assumed that the application will link dynamically + * against liblzma. #define LZMA_API_STATIC in your application if you + * want to link against static liblzma. If you don't care about portability + * to operating systems like Windows, or at least don't care about linking + * against static liblzma on them, don't worry about LZMA_API_STATIC. That + * is, most developers will never need to use LZMA_API_STATIC. + * + * The GCC variants are a special case on Windows (Cygwin and MinGW). + * We rely on GCC doing the right thing with its auto-import feature, + * and thus don't use __declspec(dllimport). This way developers don't + * need to worry about LZMA_API_STATIC. Also the calling convention is + * omitted on Cygwin but not on MinGW. + */ +#ifndef LZMA_API_IMPORT +#if !defined(LZMA_API_STATIC) && defined(_WIN32) && !defined(__GNUC__) +#define LZMA_API_IMPORT __declspec(dllimport) +#else +#define LZMA_API_IMPORT +#endif +#endif + +#ifndef LZMA_API_CALL +#if defined(_WIN32) && !defined(__CYGWIN__) +#define LZMA_API_CALL __cdecl +#else +#define LZMA_API_CALL +#endif +#endif + +#ifndef LZMA_API +#define LZMA_API(type) LZMA_API_IMPORT type LZMA_API_CALL +#endif + +/*********** + * nothrow * + ***********/ + +/* + * None of the functions in liblzma may throw an exception. Even + * the functions that use callback functions won't throw exceptions, + * because liblzma would break if a callback function threw an exception. + */ +#ifndef lzma_nothrow +#if defined(__cplusplus) +#if __cplusplus >= 201103L +#define lzma_nothrow noexcept +#else +#define lzma_nothrow throw() +#endif +#elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) +#define lzma_nothrow __attribute__((__nothrow__)) +#else +#define lzma_nothrow +#endif +#endif + +/******************** + * GNU C extensions * + ********************/ + +/* + * GNU C extensions are used conditionally in the public API. It doesn't + * break anything if these are sometimes enabled and sometimes not, only + * affects warnings and optimizations. + */ +#if __GNUC__ >= 3 +#ifndef lzma_attribute +#define lzma_attribute(attr) __attribute__(attr) +#endif + +/* warn_unused_result was added in GCC 3.4. */ +#ifndef lzma_attr_warn_unused_result +#if __GNUC__ == 3 && __GNUC_MINOR__ < 4 +#define lzma_attr_warn_unused_result +#endif +#endif + +#else +#ifndef lzma_attribute +#define lzma_attribute(attr) +#endif +#endif + +#ifndef lzma_attr_pure +#define lzma_attr_pure lzma_attribute((__pure__)) +#endif + +#ifndef lzma_attr_const +#define lzma_attr_const lzma_attribute((__const__)) +#endif + +#ifndef lzma_attr_warn_unused_result +#define lzma_attr_warn_unused_result lzma_attribute((__warn_unused_result__)) +#endif + +/************** + * Subheaders * + **************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Subheaders check that this is defined. It is to prevent including + * them directly from applications. + */ +#define LZMA_H_INTERNAL 1 + +/* Basic features */ +#include "lzma/base.h" +#include "lzma/check.h" +#include "lzma/version.h" +#include "lzma/vli.h" + +/* Filters */ +#include "lzma/bcj.h" +#include "lzma/delta.h" +#include "lzma/filter.h" +#include "lzma/lzma12.h" + +/* Container formats */ +#include "lzma/container.h" + +/* Advanced features */ +#include "lzma/block.h" +#include "lzma/index.h" +#include "lzma/index_hash.h" +#include "lzma/stream_flags.h" + +/* Hardware information */ +#include "lzma/hardware.h" + +/* + * All subheaders included. Undefine LZMA_H_INTERNAL to prevent applications + * re-including the subheaders. + */ +#undef LZMA_H_INTERNAL + +#ifdef __cplusplus +} +#endif + +#endif /* ifndef LZMA_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/base.h b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/base.h new file mode 100644 index 0000000..1381281 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/base.h @@ -0,0 +1,646 @@ +/** + * \file lzma/base.h + * \brief Data types and functions used in many places in liblzma API + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +#error Never include this file directly. Use instead. +#endif + +/** + * \brief Boolean + * + * This is here because C89 doesn't have stdbool.h. To set a value for + * variables having type lzma_bool, you can use + * - C99's `true' and `false' from stdbool.h; + * - C++'s internal `true' and `false'; or + * - integers one (true) and zero (false). + */ +typedef unsigned char lzma_bool; + +/** + * \brief Type of reserved enumeration variable in structures + * + * To avoid breaking library ABI when new features are added, several + * structures contain extra variables that may be used in future. Since + * sizeof(enum) can be different than sizeof(int), and sizeof(enum) may + * even vary depending on the range of enumeration constants, we specify + * a separate type to be used for reserved enumeration variables. All + * enumeration constants in liblzma API will be non-negative and less + * than 128, which should guarantee that the ABI won't break even when + * new constants are added to existing enumerations. + */ +typedef enum { LZMA_RESERVED_ENUM = 0 } lzma_reserved_enum; + +/** + * \brief Return values used by several functions in liblzma + * + * Check the descriptions of specific functions to find out which return + * values they can return. With some functions the return values may have + * more specific meanings than described here; those differences are + * described per-function basis. + */ +typedef enum { + LZMA_OK = 0, + /**< + * \brief Operation completed successfully + */ + + LZMA_STREAM_END = 1, + /**< + * \brief End of stream was reached + * + * In encoder, LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, or + * LZMA_FINISH was finished. In decoder, this indicates + * that all the data was successfully decoded. + * + * In all cases, when LZMA_STREAM_END is returned, the last + * output bytes should be picked from strm->next_out. + */ + + LZMA_NO_CHECK = 2, + /**< + * \brief Input stream has no integrity check + * + * This return value can be returned only if the + * LZMA_TELL_NO_CHECK flag was used when initializing + * the decoder. LZMA_NO_CHECK is just a warning, and + * the decoding can be continued normally. + * + * It is possible to call lzma_get_check() immediately after + * lzma_code has returned LZMA_NO_CHECK. The result will + * naturally be LZMA_CHECK_NONE, but the possibility to call + * lzma_get_check() may be convenient in some applications. + */ + + LZMA_UNSUPPORTED_CHECK = 3, + /**< + * \brief Cannot calculate the integrity check + * + * The usage of this return value is different in encoders + * and decoders. + * + * Encoders can return this value only from the initialization + * function. If initialization fails with this value, the + * encoding cannot be done, because there's no way to produce + * output with the correct integrity check. + * + * Decoders can return this value only from lzma_code() and + * only if the LZMA_TELL_UNSUPPORTED_CHECK flag was used when + * initializing the decoder. The decoding can still be + * continued normally even if the check type is unsupported, + * but naturally the check will not be validated, and possible + * errors may go undetected. + * + * With decoder, it is possible to call lzma_get_check() + * immediately after lzma_code() has returned + * LZMA_UNSUPPORTED_CHECK. This way it is possible to find + * out what the unsupported Check ID was. + */ + + LZMA_GET_CHECK = 4, + /**< + * \brief Integrity check type is now available + * + * This value can be returned only by the lzma_code() function + * and only if the decoder was initialized with the + * LZMA_TELL_ANY_CHECK flag. LZMA_GET_CHECK tells the + * application that it may now call lzma_get_check() to find + * out the Check ID. This can be used, for example, to + * implement a decoder that accepts only files that have + * strong enough integrity check. + */ + + LZMA_MEM_ERROR = 5, + /**< + * \brief Cannot allocate memory + * + * Memory allocation failed, or the size of the allocation + * would be greater than SIZE_MAX. + * + * Due to internal implementation reasons, the coding cannot + * be continued even if more memory were made available after + * LZMA_MEM_ERROR. + */ + + LZMA_MEMLIMIT_ERROR = 6, + /** + * \brief Memory usage limit was reached + * + * Decoder would need more memory than allowed by the + * specified memory usage limit. To continue decoding, + * the memory usage limit has to be increased with + * lzma_memlimit_set(). + */ + + LZMA_FORMAT_ERROR = 7, + /**< + * \brief File format not recognized + * + * The decoder did not recognize the input as supported file + * format. This error can occur, for example, when trying to + * decode .lzma format file with lzma_stream_decoder, + * because lzma_stream_decoder accepts only the .xz format. + */ + + LZMA_OPTIONS_ERROR = 8, + /**< + * \brief Invalid or unsupported options + * + * Invalid or unsupported options, for example + * - unsupported filter(s) or filter options; or + * - reserved bits set in headers (decoder only). + * + * Rebuilding liblzma with more features enabled, or + * upgrading to a newer version of liblzma may help. + */ + + LZMA_DATA_ERROR = 9, + /**< + * \brief Data is corrupt + * + * The usage of this return value is different in encoders + * and decoders. In both encoder and decoder, the coding + * cannot continue after this error. + * + * Encoders return this if size limits of the target file + * format would be exceeded. These limits are huge, thus + * getting this error from an encoder is mostly theoretical. + * For example, the maximum compressed and uncompressed + * size of a .xz Stream is roughly 8 EiB (2^63 bytes). + * + * Decoders return this error if the input data is corrupt. + * This can mean, for example, invalid CRC32 in headers + * or invalid check of uncompressed data. + */ + + LZMA_BUF_ERROR = 10, + /**< + * \brief No progress is possible + * + * This error code is returned when the coder cannot consume + * any new input and produce any new output. The most common + * reason for this error is that the input stream being + * decoded is truncated or corrupt. + * + * This error is not fatal. Coding can be continued normally + * by providing more input and/or more output space, if + * possible. + * + * Typically the first call to lzma_code() that can do no + * progress returns LZMA_OK instead of LZMA_BUF_ERROR. Only + * the second consecutive call doing no progress will return + * LZMA_BUF_ERROR. This is intentional. + * + * With zlib, Z_BUF_ERROR may be returned even if the + * application is doing nothing wrong, so apps will need + * to handle Z_BUF_ERROR specially. The above hack + * guarantees that liblzma never returns LZMA_BUF_ERROR + * to properly written applications unless the input file + * is truncated or corrupt. This should simplify the + * applications a little. + */ + + LZMA_PROG_ERROR = 11, + /**< + * \brief Programming error + * + * This indicates that the arguments given to the function are + * invalid or the internal state of the decoder is corrupt. + * - Function arguments are invalid or the structures + * pointed by the argument pointers are invalid + * e.g. if strm->next_out has been set to NULL and + * strm->avail_out > 0 when calling lzma_code(). + * - lzma_* functions have been called in wrong order + * e.g. lzma_code() was called right after lzma_end(). + * - If errors occur randomly, the reason might be flaky + * hardware. + * + * If you think that your code is correct, this error code + * can be a sign of a bug in liblzma. See the documentation + * how to report bugs. + */ +} lzma_ret; + +/** + * \brief The `action' argument for lzma_code() + * + * After the first use of LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, LZMA_FULL_BARRIER, + * or LZMA_FINISH, the same `action' must is used until lzma_code() returns + * LZMA_STREAM_END. Also, the amount of input (that is, strm->avail_in) must + * not be modified by the application until lzma_code() returns + * LZMA_STREAM_END. Changing the `action' or modifying the amount of input + * will make lzma_code() return LZMA_PROG_ERROR. + */ +typedef enum { + LZMA_RUN = 0, + /**< + * \brief Continue coding + * + * Encoder: Encode as much input as possible. Some internal + * buffering will probably be done (depends on the filter + * chain in use), which causes latency: the input used won't + * usually be decodeable from the output of the same + * lzma_code() call. + * + * Decoder: Decode as much input as possible and produce as + * much output as possible. + */ + + LZMA_SYNC_FLUSH = 1, + /**< + * \brief Make all the input available at output + * + * Normally the encoder introduces some latency. + * LZMA_SYNC_FLUSH forces all the buffered data to be + * available at output without resetting the internal + * state of the encoder. This way it is possible to use + * compressed stream for example for communication over + * network. + * + * Only some filters support LZMA_SYNC_FLUSH. Trying to use + * LZMA_SYNC_FLUSH with filters that don't support it will + * make lzma_code() return LZMA_OPTIONS_ERROR. For example, + * LZMA1 doesn't support LZMA_SYNC_FLUSH but LZMA2 does. + * + * Using LZMA_SYNC_FLUSH very often can dramatically reduce + * the compression ratio. With some filters (for example, + * LZMA2), fine-tuning the compression options may help + * mitigate this problem significantly (for example, + * match finder with LZMA2). + * + * Decoders don't support LZMA_SYNC_FLUSH. + */ + + LZMA_FULL_FLUSH = 2, + /**< + * \brief Finish encoding of the current Block + * + * All the input data going to the current Block must have + * been given to the encoder (the last bytes can still be + * pending in *next_in). Call lzma_code() with LZMA_FULL_FLUSH + * until it returns LZMA_STREAM_END. Then continue normally + * with LZMA_RUN or finish the Stream with LZMA_FINISH. + * + * This action is currently supported only by Stream encoder + * and easy encoder (which uses Stream encoder). If there is + * no unfinished Block, no empty Block is created. + */ + + LZMA_FULL_BARRIER = 4, + /**< + * \brief Finish encoding of the current Block + * + * This is like LZMA_FULL_FLUSH except that this doesn't + * necessarily wait until all the input has been made + * available via the output buffer. That is, lzma_code() + * might return LZMA_STREAM_END as soon as all the input + * has been consumed (avail_in == 0). + * + * LZMA_FULL_BARRIER is useful with a threaded encoder if + * one wants to split the .xz Stream into Blocks at specific + * offsets but doesn't care if the output isn't flushed + * immediately. Using LZMA_FULL_BARRIER allows keeping + * the threads busy while LZMA_FULL_FLUSH would make + * lzma_code() wait until all the threads have finished + * until more data could be passed to the encoder. + * + * With a lzma_stream initialized with the single-threaded + * lzma_stream_encoder() or lzma_easy_encoder(), + * LZMA_FULL_BARRIER is an alias for LZMA_FULL_FLUSH. + */ + + LZMA_FINISH = 3 + /**< + * \brief Finish the coding operation + * + * All the input data must have been given to the encoder + * (the last bytes can still be pending in next_in). + * Call lzma_code() with LZMA_FINISH until it returns + * LZMA_STREAM_END. Once LZMA_FINISH has been used, + * the amount of input must no longer be changed by + * the application. + * + * When decoding, using LZMA_FINISH is optional unless the + * LZMA_CONCATENATED flag was used when the decoder was + * initialized. When LZMA_CONCATENATED was not used, the only + * effect of LZMA_FINISH is that the amount of input must not + * be changed just like in the encoder. + */ +} lzma_action; + +/** + * \brief Custom functions for memory handling + * + * A pointer to lzma_allocator may be passed via lzma_stream structure + * to liblzma, and some advanced functions take a pointer to lzma_allocator + * as a separate function argument. The library will use the functions + * specified in lzma_allocator for memory handling instead of the default + * malloc() and free(). C++ users should note that the custom memory + * handling functions must not throw exceptions. + * + * Single-threaded mode only: liblzma doesn't make an internal copy of + * lzma_allocator. Thus, it is OK to change these function pointers in + * the middle of the coding process, but obviously it must be done + * carefully to make sure that the replacement `free' can deallocate + * memory allocated by the earlier `alloc' function(s). + * + * Multithreaded mode: liblzma might internally store pointers to the + * lzma_allocator given via the lzma_stream structure. The application + * must not change the allocator pointer in lzma_stream or the contents + * of the pointed lzma_allocator structure until lzma_end() has been used + * to free the memory associated with that lzma_stream. The allocation + * functions might be called simultaneously from multiple threads, and + * thus they must be thread safe. + */ +typedef struct { + /** + * \brief Pointer to a custom memory allocation function + * + * If you don't want a custom allocator, but still want + * custom free(), set this to NULL and liblzma will use + * the standard malloc(). + * + * \param opaque lzma_allocator.opaque (see below) + * \param nmemb Number of elements like in calloc(). liblzma + * will always set nmemb to 1, so it is safe to + * ignore nmemb in a custom allocator if you like. + * The nmemb argument exists only for + * compatibility with zlib and libbzip2. + * \param size Size of an element in bytes. + * liblzma never sets this to zero. + * + * \return Pointer to the beginning of a memory block of + * `size' bytes, or NULL if allocation fails + * for some reason. When allocation fails, functions + * of liblzma return LZMA_MEM_ERROR. + * + * The allocator should not waste time zeroing the allocated buffers. + * This is not only about speed, but also memory usage, since the + * operating system kernel doesn't necessarily allocate the requested + * memory in physical memory until it is actually used. With small + * input files, liblzma may actually need only a fraction of the + * memory that it requested for allocation. + * + * \note LZMA_MEM_ERROR is also used when the size of the + * allocation would be greater than SIZE_MAX. Thus, + * don't assume that the custom allocator must have + * returned NULL if some function from liblzma + * returns LZMA_MEM_ERROR. + */ + void*(LZMA_API_CALL* alloc)(void* opaque, size_t nmemb, size_t size); + + /** + * \brief Pointer to a custom memory freeing function + * + * If you don't want a custom freeing function, but still + * want a custom allocator, set this to NULL and liblzma + * will use the standard free(). + * + * \param opaque lzma_allocator.opaque (see below) + * \param ptr Pointer returned by lzma_allocator.alloc(), + * or when it is set to NULL, a pointer returned + * by the standard malloc(). + */ + void(LZMA_API_CALL* free)(void* opaque, void* ptr); + + /** + * \brief Pointer passed to .alloc() and .free() + * + * opaque is passed as the first argument to lzma_allocator.alloc() + * and lzma_allocator.free(). This intended to ease implementing + * custom memory allocation functions for use with liblzma. + * + * If you don't need this, you should set this to NULL. + */ + void* opaque; + +} lzma_allocator; + +/** + * \brief Internal data structure + * + * The contents of this structure is not visible outside the library. + */ +typedef struct lzma_internal_s lzma_internal; + +/** + * \brief Passing data to and from liblzma + * + * The lzma_stream structure is used for + * - passing pointers to input and output buffers to liblzma; + * - defining custom memory hander functions; and + * - holding a pointer to coder-specific internal data structures. + * + * Typical usage: + * + * - After allocating lzma_stream (on stack or with malloc()), it must be + * initialized to LZMA_STREAM_INIT (see LZMA_STREAM_INIT for details). + * + * - Initialize a coder to the lzma_stream, for example by using + * lzma_easy_encoder() or lzma_auto_decoder(). Some notes: + * - In contrast to zlib, strm->next_in and strm->next_out are + * ignored by all initialization functions, thus it is safe + * to not initialize them yet. + * - The initialization functions always set strm->total_in and + * strm->total_out to zero. + * - If the initialization function fails, no memory is left allocated + * that would require freeing with lzma_end() even if some memory was + * associated with the lzma_stream structure when the initialization + * function was called. + * + * - Use lzma_code() to do the actual work. + * + * - Once the coding has been finished, the existing lzma_stream can be + * reused. It is OK to reuse lzma_stream with different initialization + * function without calling lzma_end() first. Old allocations are + * automatically freed. + * + * - Finally, use lzma_end() to free the allocated memory. lzma_end() never + * frees the lzma_stream structure itself. + * + * Application may modify the values of total_in and total_out as it wants. + * They are updated by liblzma to match the amount of data read and + * written but aren't used for anything else except as a possible return + * values from lzma_get_progress(). + */ +typedef struct { + const uint8_t* next_in; /**< Pointer to the next input byte. */ + size_t avail_in; /**< Number of available input bytes in next_in. */ + uint64_t total_in; /**< Total number of bytes read by liblzma. */ + + uint8_t* next_out; /**< Pointer to the next output position. */ + size_t avail_out; /**< Amount of free space in next_out. */ + uint64_t total_out; /**< Total number of bytes written by liblzma. */ + + /** + * \brief Custom memory allocation functions + * + * In most cases this is NULL which makes liblzma use + * the standard malloc() and free(). + * + * \note In 5.0.x this is not a const pointer. + */ + const lzma_allocator* allocator; + + /** Internal state is not visible to applications. */ + lzma_internal* internal; + + /* + * Reserved space to allow possible future extensions without + * breaking the ABI. Excluding the initialization of this structure, + * you should not touch these, because the names of these variables + * may change. + */ + void* reserved_ptr1; + void* reserved_ptr2; + void* reserved_ptr3; + void* reserved_ptr4; + uint64_t reserved_int1; + uint64_t reserved_int2; + size_t reserved_int3; + size_t reserved_int4; + lzma_reserved_enum reserved_enum1; + lzma_reserved_enum reserved_enum2; + +} lzma_stream; + +/** + * \brief Initialization for lzma_stream + * + * When you declare an instance of lzma_stream, you can immediately + * initialize it so that initialization functions know that no memory + * has been allocated yet: + * + * lzma_stream strm = LZMA_STREAM_INIT; + * + * If you need to initialize a dynamically allocated lzma_stream, you can use + * memset(strm_pointer, 0, sizeof(lzma_stream)). Strictly speaking, this + * violates the C standard since NULL may have different internal + * representation than zero, but it should be portable enough in practice. + * Anyway, for maximum portability, you can use something like this: + * + * lzma_stream tmp = LZMA_STREAM_INIT; + * *strm = tmp; + */ +#define LZMA_STREAM_INIT \ + { \ + NULL, 0, 0, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, \ + LZMA_RESERVED_ENUM, LZMA_RESERVED_ENUM \ + } + +/** + * \brief Encode or decode data + * + * Once the lzma_stream has been successfully initialized (e.g. with + * lzma_stream_encoder()), the actual encoding or decoding is done + * using this function. The application has to update strm->next_in, + * strm->avail_in, strm->next_out, and strm->avail_out to pass input + * to and get output from liblzma. + * + * See the description of the coder-specific initialization function to find + * out what `action' values are supported by the coder. + */ +extern LZMA_API(lzma_ret) lzma_code(lzma_stream* strm, lzma_action action) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Free memory allocated for the coder data structures + * + * \param strm Pointer to lzma_stream that is at least initialized + * with LZMA_STREAM_INIT. + * + * After lzma_end(strm), strm->internal is guaranteed to be NULL. No other + * members of the lzma_stream structure are touched. + * + * \note zlib indicates an error if application end()s unfinished + * stream structure. liblzma doesn't do this, and assumes that + * application knows what it is doing. + */ +extern LZMA_API(void) lzma_end(lzma_stream* strm) lzma_nothrow; + +/** + * \brief Get progress information + * + * In single-threaded mode, applications can get progress information from + * strm->total_in and strm->total_out. In multi-threaded mode this is less + * useful because a significant amount of both input and output data gets + * buffered internally by liblzma. This makes total_in and total_out give + * misleading information and also makes the progress indicator updates + * non-smooth. + * + * This function gives realistic progress information also in multi-threaded + * mode by taking into account the progress made by each thread. In + * single-threaded mode *progress_in and *progress_out are set to + * strm->total_in and strm->total_out, respectively. + */ +extern LZMA_API(void) lzma_get_progress( + lzma_stream* strm, + uint64_t* progress_in, + uint64_t* progress_out) lzma_nothrow; + +/** + * \brief Get the memory usage of decoder filter chain + * + * This function is currently supported only when *strm has been initialized + * with a function that takes a memlimit argument. With other functions, you + * should use e.g. lzma_raw_encoder_memusage() or lzma_raw_decoder_memusage() + * to estimate the memory requirements. + * + * This function is useful e.g. after LZMA_MEMLIMIT_ERROR to find out how big + * the memory usage limit should have been to decode the input. Note that + * this may give misleading information if decoding .xz Streams that have + * multiple Blocks, because each Block can have different memory requirements. + * + * \return How much memory is currently allocated for the filter + * decoders. If no filter chain is currently allocated, + * some non-zero value is still returned, which is less than + * or equal to what any filter chain would indicate as its + * memory requirement. + * + * If this function isn't supported by *strm or some other error + * occurs, zero is returned. + */ +extern LZMA_API(uint64_t) + lzma_memusage(const lzma_stream* strm) lzma_nothrow lzma_attr_pure; + +/** + * \brief Get the current memory usage limit + * + * This function is supported only when *strm has been initialized with + * a function that takes a memlimit argument. + * + * \return On success, the current memory usage limit is returned + * (always non-zero). On error, zero is returned. + */ +extern LZMA_API(uint64_t) + lzma_memlimit_get(const lzma_stream* strm) lzma_nothrow lzma_attr_pure; + +/** + * \brief Set the memory usage limit + * + * This function is supported only when *strm has been initialized with + * a function that takes a memlimit argument. + * + * liblzma 5.2.3 and earlier has a bug where memlimit value of 0 causes + * this function to do nothing (leaving the limit unchanged) and still + * return LZMA_OK. Later versions treat 0 as if 1 had been specified (so + * lzma_memlimit_get() will return 1 even if you specify 0 here). + * + * \return - LZMA_OK: New memory usage limit successfully set. + * - LZMA_MEMLIMIT_ERROR: The new limit is too small. + * The limit was not changed. + * - LZMA_PROG_ERROR: Invalid arguments, e.g. *strm doesn't + * support memory usage limit. + */ +extern LZMA_API(lzma_ret) + lzma_memlimit_set(lzma_stream* strm, uint64_t memlimit) lzma_nothrow; diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/bcj.h b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/bcj.h new file mode 100644 index 0000000..6389aeb --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/bcj.h @@ -0,0 +1,88 @@ +/** + * \file lzma/bcj.h + * \brief Branch/Call/Jump conversion filters + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +#error Never include this file directly. Use instead. +#endif + +/* Filter IDs for lzma_filter.id */ + +#define LZMA_FILTER_X86 LZMA_VLI_C(0x04) +/**< + * Filter for x86 binaries + */ + +#define LZMA_FILTER_POWERPC LZMA_VLI_C(0x05) +/**< + * Filter for Big endian PowerPC binaries + */ + +#define LZMA_FILTER_IA64 LZMA_VLI_C(0x06) +/**< + * Filter for IA-64 (Itanium) binaries. + */ + +#define LZMA_FILTER_ARM LZMA_VLI_C(0x07) +/**< + * Filter for ARM binaries. + */ + +#define LZMA_FILTER_ARMTHUMB LZMA_VLI_C(0x08) +/**< + * Filter for ARM-Thumb binaries. + */ + +#define LZMA_FILTER_SPARC LZMA_VLI_C(0x09) +/**< + * Filter for SPARC binaries. + */ + +/** + * \brief Options for BCJ filters + * + * The BCJ filters never change the size of the data. Specifying options + * for them is optional: if pointer to options is NULL, default value is + * used. You probably never need to specify options to BCJ filters, so just + * set the options pointer to NULL and be happy. + * + * If options with non-default values have been specified when encoding, + * the same options must also be specified when decoding. + * + * \note At the moment, none of the BCJ filters support + * LZMA_SYNC_FLUSH. If LZMA_SYNC_FLUSH is specified, + * LZMA_OPTIONS_ERROR will be returned. If there is need, + * partial support for LZMA_SYNC_FLUSH can be added in future. + * Partial means that flushing would be possible only at + * offsets that are multiple of 2, 4, or 16 depending on + * the filter, except x86 which cannot be made to support + * LZMA_SYNC_FLUSH predictably. + */ +typedef struct { + /** + * \brief Start offset for conversions + * + * This setting is useful only when the same filter is used + * _separately_ for multiple sections of the same executable file, + * and the sections contain cross-section branch/call/jump + * instructions. In that case it is beneficial to set the start + * offset of the non-first sections so that the relative addresses + * of the cross-section branch/call/jump instructions will use the + * same absolute addresses as in the first section. + * + * When the pointer to options is NULL, the default value (zero) + * is used. + */ + uint32_t start_offset; + +} lzma_options_bcj; diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/block.h b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/block.h new file mode 100644 index 0000000..65270c0 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/block.h @@ -0,0 +1,578 @@ +/** + * \file lzma/block.h + * \brief .xz Block handling + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +#error Never include this file directly. Use instead. +#endif + +/** + * \brief Options for the Block and Block Header encoders and decoders + * + * Different Block handling functions use different parts of this structure. + * Some read some members, other functions write, and some do both. Only the + * members listed for reading need to be initialized when the specified + * functions are called. The members marked for writing will be assigned + * new values at some point either by calling the given function or by + * later calls to lzma_code(). + */ +typedef struct { + /** + * \brief Block format version + * + * To prevent API and ABI breakages when new features are needed, + * a version number is used to indicate which fields in this + * structure are in use: + * - liblzma >= 5.0.0: version = 0 is supported. + * - liblzma >= 5.1.4beta: Support for version = 1 was added, + * which adds the ignore_check field. + * + * If version is greater than one, most Block related functions + * will return LZMA_OPTIONS_ERROR (lzma_block_header_decode() works + * with any version value). + * + * Read by: + * - All functions that take pointer to lzma_block as argument, + * including lzma_block_header_decode(). + * + * Written by: + * - lzma_block_header_decode() + */ + uint32_t version; + + /** + * \brief Size of the Block Header field + * + * This is always a multiple of four. + * + * Read by: + * - lzma_block_header_encode() + * - lzma_block_header_decode() + * - lzma_block_compressed_size() + * - lzma_block_unpadded_size() + * - lzma_block_total_size() + * - lzma_block_decoder() + * - lzma_block_buffer_decode() + * + * Written by: + * - lzma_block_header_size() + * - lzma_block_buffer_encode() + */ + uint32_t header_size; +#define LZMA_BLOCK_HEADER_SIZE_MIN 8 +#define LZMA_BLOCK_HEADER_SIZE_MAX 1024 + + /** + * \brief Type of integrity Check + * + * The Check ID is not stored into the Block Header, thus its value + * must be provided also when decoding. + * + * Read by: + * - lzma_block_header_encode() + * - lzma_block_header_decode() + * - lzma_block_compressed_size() + * - lzma_block_unpadded_size() + * - lzma_block_total_size() + * - lzma_block_encoder() + * - lzma_block_decoder() + * - lzma_block_buffer_encode() + * - lzma_block_buffer_decode() + */ + lzma_check check; + + /** + * \brief Size of the Compressed Data in bytes + * + * Encoding: If this is not LZMA_VLI_UNKNOWN, Block Header encoder + * will store this value to the Block Header. Block encoder doesn't + * care about this value, but will set it once the encoding has been + * finished. + * + * Decoding: If this is not LZMA_VLI_UNKNOWN, Block decoder will + * verify that the size of the Compressed Data field matches + * compressed_size. + * + * Usually you don't know this value when encoding in streamed mode, + * and thus cannot write this field into the Block Header. + * + * In non-streamed mode you can reserve space for this field before + * encoding the actual Block. After encoding the data, finish the + * Block by encoding the Block Header. Steps in detail: + * + * - Set compressed_size to some big enough value. If you don't know + * better, use LZMA_VLI_MAX, but remember that bigger values take + * more space in Block Header. + * + * - Call lzma_block_header_size() to see how much space you need to + * reserve for the Block Header. + * + * - Encode the Block using lzma_block_encoder() and lzma_code(). + * It sets compressed_size to the correct value. + * + * - Use lzma_block_header_encode() to encode the Block Header. + * Because space was reserved in the first step, you don't need + * to call lzma_block_header_size() anymore, because due to + * reserving, header_size has to be big enough. If it is "too big", + * lzma_block_header_encode() will add enough Header Padding to + * make Block Header to match the size specified by header_size. + * + * Read by: + * - lzma_block_header_size() + * - lzma_block_header_encode() + * - lzma_block_compressed_size() + * - lzma_block_unpadded_size() + * - lzma_block_total_size() + * - lzma_block_decoder() + * - lzma_block_buffer_decode() + * + * Written by: + * - lzma_block_header_decode() + * - lzma_block_compressed_size() + * - lzma_block_encoder() + * - lzma_block_decoder() + * - lzma_block_buffer_encode() + * - lzma_block_buffer_decode() + */ + lzma_vli compressed_size; + + /** + * \brief Uncompressed Size in bytes + * + * This is handled very similarly to compressed_size above. + * + * uncompressed_size is needed by fewer functions than + * compressed_size. This is because uncompressed_size isn't + * needed to validate that Block stays within proper limits. + * + * Read by: + * - lzma_block_header_size() + * - lzma_block_header_encode() + * - lzma_block_decoder() + * - lzma_block_buffer_decode() + * + * Written by: + * - lzma_block_header_decode() + * - lzma_block_encoder() + * - lzma_block_decoder() + * - lzma_block_buffer_encode() + * - lzma_block_buffer_decode() + */ + lzma_vli uncompressed_size; + + /** + * \brief Array of filters + * + * There can be 1-4 filters. The end of the array is marked with + * .id = LZMA_VLI_UNKNOWN. + * + * Read by: + * - lzma_block_header_size() + * - lzma_block_header_encode() + * - lzma_block_encoder() + * - lzma_block_decoder() + * - lzma_block_buffer_encode() + * - lzma_block_buffer_decode() + * + * Written by: + * - lzma_block_header_decode(): Note that this does NOT free() + * the old filter options structures. All unused filters[] will + * have .id == LZMA_VLI_UNKNOWN and .options == NULL. If + * decoding fails, all filters[] are guaranteed to be + * LZMA_VLI_UNKNOWN and NULL. + * + * \note Because of the array is terminated with + * .id = LZMA_VLI_UNKNOWN, the actual array must + * have LZMA_FILTERS_MAX + 1 members or the Block + * Header decoder will overflow the buffer. + */ + lzma_filter* filters; + + /** + * \brief Raw value stored in the Check field + * + * After successful coding, the first lzma_check_size(check) bytes + * of this array contain the raw value stored in the Check field. + * + * Note that CRC32 and CRC64 are stored in little endian byte order. + * Take it into account if you display the Check values to the user. + * + * Written by: + * - lzma_block_encoder() + * - lzma_block_decoder() + * - lzma_block_buffer_encode() + * - lzma_block_buffer_decode() + */ + uint8_t raw_check[LZMA_CHECK_SIZE_MAX]; + + /* + * Reserved space to allow possible future extensions without + * breaking the ABI. You should not touch these, because the names + * of these variables may change. These are and will never be used + * with the currently supported options, so it is safe to leave these + * uninitialized. + */ + void* reserved_ptr1; + void* reserved_ptr2; + void* reserved_ptr3; + uint32_t reserved_int1; + uint32_t reserved_int2; + lzma_vli reserved_int3; + lzma_vli reserved_int4; + lzma_vli reserved_int5; + lzma_vli reserved_int6; + lzma_vli reserved_int7; + lzma_vli reserved_int8; + lzma_reserved_enum reserved_enum1; + lzma_reserved_enum reserved_enum2; + lzma_reserved_enum reserved_enum3; + lzma_reserved_enum reserved_enum4; + + /** + * \brief A flag to Block decoder to not verify the Check field + * + * This field is supported by liblzma >= 5.1.4beta if .version >= 1. + * + * If this is set to true, the integrity check won't be calculated + * and verified. Unless you know what you are doing, you should + * leave this to false. (A reason to set this to true is when the + * file integrity is verified externally anyway and you want to + * speed up the decompression, which matters mostly when using + * SHA-256 as the integrity check.) + * + * If .version >= 1, read by: + * - lzma_block_decoder() + * - lzma_block_buffer_decode() + * + * Written by (.version is ignored): + * - lzma_block_header_decode() always sets this to false + */ + lzma_bool ignore_check; + + lzma_bool reserved_bool2; + lzma_bool reserved_bool3; + lzma_bool reserved_bool4; + lzma_bool reserved_bool5; + lzma_bool reserved_bool6; + lzma_bool reserved_bool7; + lzma_bool reserved_bool8; + +} lzma_block; + +/** + * \brief Decode the Block Header Size field + * + * To decode Block Header using lzma_block_header_decode(), the size of the + * Block Header has to be known and stored into lzma_block.header_size. + * The size can be calculated from the first byte of a Block using this macro. + * Note that if the first byte is 0x00, it indicates beginning of Index; use + * this macro only when the byte is not 0x00. + * + * There is no encoding macro, because Block Header encoder is enough for that. + */ +#define lzma_block_header_size_decode(b) (((uint32_t)(b) + 1) * 4) + +/** + * \brief Calculate Block Header Size + * + * Calculate the minimum size needed for the Block Header field using the + * settings specified in the lzma_block structure. Note that it is OK to + * increase the calculated header_size value as long as it is a multiple of + * four and doesn't exceed LZMA_BLOCK_HEADER_SIZE_MAX. Increasing header_size + * just means that lzma_block_header_encode() will add Header Padding. + * + * \return - LZMA_OK: Size calculated successfully and stored to + * block->header_size. + * - LZMA_OPTIONS_ERROR: Unsupported version, filters or + * filter options. + * - LZMA_PROG_ERROR: Invalid values like compressed_size == 0. + * + * \note This doesn't check that all the options are valid i.e. this + * may return LZMA_OK even if lzma_block_header_encode() or + * lzma_block_encoder() would fail. If you want to validate the + * filter chain, consider using lzma_memlimit_encoder() which as + * a side-effect validates the filter chain. + */ +extern LZMA_API(lzma_ret) lzma_block_header_size(lzma_block* block) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Encode Block Header + * + * The caller must have calculated the size of the Block Header already with + * lzma_block_header_size(). If a value larger than the one calculated by + * lzma_block_header_size() is used, the Block Header will be padded to the + * specified size. + * + * \param out Beginning of the output buffer. This must be + * at least block->header_size bytes. + * \param block Block options to be encoded. + * + * \return - LZMA_OK: Encoding was successful. block->header_size + * bytes were written to output buffer. + * - LZMA_OPTIONS_ERROR: Invalid or unsupported options. + * - LZMA_PROG_ERROR: Invalid arguments, for example + * block->header_size is invalid or block->filters is NULL. + */ +extern LZMA_API(lzma_ret) + lzma_block_header_encode(const lzma_block* block, uint8_t* out) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Decode Block Header + * + * block->version should (usually) be set to the highest value supported + * by the application. If the application sets block->version to a value + * higher than supported by the current liblzma version, this function will + * downgrade block->version to the highest value supported by it. Thus one + * should check the value of block->version after calling this function if + * block->version was set to a non-zero value and the application doesn't + * otherwise know that the liblzma version being used is new enough to + * support the specified block->version. + * + * The size of the Block Header must have already been decoded with + * lzma_block_header_size_decode() macro and stored to block->header_size. + * + * The integrity check type from Stream Header must have been stored + * to block->check. + * + * block->filters must have been allocated, but they don't need to be + * initialized (possible existing filter options are not freed). + * + * \param block Destination for Block options. + * \param allocator lzma_allocator for custom allocator functions. + * Set to NULL to use malloc() (and also free() + * if an error occurs). + * \param in Beginning of the input buffer. This must be + * at least block->header_size bytes. + * + * \return - LZMA_OK: Decoding was successful. block->header_size + * bytes were read from the input buffer. + * - LZMA_OPTIONS_ERROR: The Block Header specifies some + * unsupported options such as unsupported filters. This can + * happen also if block->version was set to a too low value + * compared to what would be required to properly represent + * the information stored in the Block Header. + * - LZMA_DATA_ERROR: Block Header is corrupt, for example, + * the CRC32 doesn't match. + * - LZMA_PROG_ERROR: Invalid arguments, for example + * block->header_size is invalid or block->filters is NULL. + */ +extern LZMA_API(lzma_ret) lzma_block_header_decode( + lzma_block* block, + const lzma_allocator* allocator, + const uint8_t* in) lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Validate and set Compressed Size according to Unpadded Size + * + * Block Header stores Compressed Size, but Index has Unpadded Size. If the + * application has already parsed the Index and is now decoding Blocks, + * it can calculate Compressed Size from Unpadded Size. This function does + * exactly that with error checking: + * + * - Compressed Size calculated from Unpadded Size must be positive integer, + * that is, Unpadded Size must be big enough that after Block Header and + * Check fields there's still at least one byte for Compressed Size. + * + * - If Compressed Size was present in Block Header, the new value + * calculated from Unpadded Size is compared against the value + * from Block Header. + * + * \note This function must be called _after_ decoding the Block Header + * field so that it can properly validate Compressed Size if it + * was present in Block Header. + * + * \return - LZMA_OK: block->compressed_size was set successfully. + * - LZMA_DATA_ERROR: unpadded_size is too small compared to + * block->header_size and lzma_check_size(block->check). + * - LZMA_PROG_ERROR: Some values are invalid. For example, + * block->header_size must be a multiple of four and + * between 8 and 1024 inclusive. + */ +extern LZMA_API(lzma_ret) + lzma_block_compressed_size(lzma_block* block, lzma_vli unpadded_size) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Calculate Unpadded Size + * + * The Index field stores Unpadded Size and Uncompressed Size. The latter + * can be taken directly from the lzma_block structure after coding a Block, + * but Unpadded Size needs to be calculated from Block Header Size, + * Compressed Size, and size of the Check field. This is where this function + * is needed. + * + * \return Unpadded Size on success, or zero on error. + */ +extern LZMA_API(lzma_vli) lzma_block_unpadded_size(const lzma_block* block) + lzma_nothrow lzma_attr_pure; + +/** + * \brief Calculate the total encoded size of a Block + * + * This is equivalent to lzma_block_unpadded_size() except that the returned + * value includes the size of the Block Padding field. + * + * \return On success, total encoded size of the Block. On error, + * zero is returned. + */ +extern LZMA_API(lzma_vli) + lzma_block_total_size(const lzma_block* block) lzma_nothrow lzma_attr_pure; + +/** + * \brief Initialize .xz Block encoder + * + * Valid actions for lzma_code() are LZMA_RUN, LZMA_SYNC_FLUSH (only if the + * filter chain supports it), and LZMA_FINISH. + * + * \return - LZMA_OK: All good, continue with lzma_code(). + * - LZMA_MEM_ERROR + * - LZMA_OPTIONS_ERROR + * - LZMA_UNSUPPORTED_CHECK: block->check specifies a Check ID + * that is not supported by this buid of liblzma. Initializing + * the encoder failed. + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) + lzma_block_encoder(lzma_stream* strm, lzma_block* block) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Initialize .xz Block decoder + * + * Valid actions for lzma_code() are LZMA_RUN and LZMA_FINISH. Using + * LZMA_FINISH is not required. It is supported only for convenience. + * + * \return - LZMA_OK: All good, continue with lzma_code(). + * - LZMA_UNSUPPORTED_CHECK: Initialization was successful, but + * the given Check ID is not supported, thus Check will be + * ignored. + * - LZMA_PROG_ERROR + * - LZMA_MEM_ERROR + */ +extern LZMA_API(lzma_ret) + lzma_block_decoder(lzma_stream* strm, lzma_block* block) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Calculate maximum output size for single-call Block encoding + * + * This is equivalent to lzma_stream_buffer_bound() but for .xz Blocks. + * See the documentation of lzma_stream_buffer_bound(). + */ +extern LZMA_API(size_t) + lzma_block_buffer_bound(size_t uncompressed_size) lzma_nothrow; + +/** + * \brief Single-call .xz Block encoder + * + * In contrast to the multi-call encoder initialized with + * lzma_block_encoder(), this function encodes also the Block Header. This + * is required to make it possible to write appropriate Block Header also + * in case the data isn't compressible, and different filter chain has to be + * used to encode the data in uncompressed form using uncompressed chunks + * of the LZMA2 filter. + * + * When the data isn't compressible, header_size, compressed_size, and + * uncompressed_size are set just like when the data was compressible, but + * it is possible that header_size is too small to hold the filter chain + * specified in block->filters, because that isn't necessarily the filter + * chain that was actually used to encode the data. lzma_block_unpadded_size() + * still works normally, because it doesn't read the filters array. + * + * \param block Block options: block->version, block->check, + * and block->filters must have been initialized. + * \param allocator lzma_allocator for custom allocator functions. + * Set to NULL to use malloc() and free(). + * \param in Beginning of the input buffer + * \param in_size Size of the input buffer + * \param out Beginning of the output buffer + * \param out_pos The next byte will be written to out[*out_pos]. + * *out_pos is updated only if encoding succeeds. + * \param out_size Size of the out buffer; the first byte into + * which no data is written to is out[out_size]. + * + * \return - LZMA_OK: Encoding was successful. + * - LZMA_BUF_ERROR: Not enough output buffer space. + * - LZMA_UNSUPPORTED_CHECK + * - LZMA_OPTIONS_ERROR + * - LZMA_MEM_ERROR + * - LZMA_DATA_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_block_buffer_encode( + lzma_block* block, + const lzma_allocator* allocator, + const uint8_t* in, + size_t in_size, + uint8_t* out, + size_t* out_pos, + size_t out_size) lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Single-call uncompressed .xz Block encoder + * + * This is like lzma_block_buffer_encode() except this doesn't try to + * compress the data and instead encodes the data using LZMA2 uncompressed + * chunks. The required output buffer size can be determined with + * lzma_block_buffer_bound(). + * + * Since the data won't be compressed, this function ignores block->filters. + * This function doesn't take lzma_allocator because this function doesn't + * allocate any memory from the heap. + */ +extern LZMA_API(lzma_ret) lzma_block_uncomp_encode( + lzma_block* block, + const uint8_t* in, + size_t in_size, + uint8_t* out, + size_t* out_pos, + size_t out_size) lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Single-call .xz Block decoder + * + * This is single-call equivalent of lzma_block_decoder(), and requires that + * the caller has already decoded Block Header and checked its memory usage. + * + * \param block Block options just like with lzma_block_decoder(). + * \param allocator lzma_allocator for custom allocator functions. + * Set to NULL to use malloc() and free(). + * \param in Beginning of the input buffer + * \param in_pos The next byte will be read from in[*in_pos]. + * *in_pos is updated only if decoding succeeds. + * \param in_size Size of the input buffer; the first byte that + * won't be read is in[in_size]. + * \param out Beginning of the output buffer + * \param out_pos The next byte will be written to out[*out_pos]. + * *out_pos is updated only if encoding succeeds. + * \param out_size Size of the out buffer; the first byte into + * which no data is written to is out[out_size]. + * + * \return - LZMA_OK: Decoding was successful. + * - LZMA_OPTIONS_ERROR + * - LZMA_DATA_ERROR + * - LZMA_MEM_ERROR + * - LZMA_BUF_ERROR: Output buffer was too small. + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_block_buffer_decode( + lzma_block* block, + const lzma_allocator* allocator, + const uint8_t* in, + size_t* in_pos, + size_t in_size, + uint8_t* out, + size_t* out_pos, + size_t out_size) lzma_nothrow; diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/check.h b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/check.h new file mode 100644 index 0000000..9bb1f77 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/check.h @@ -0,0 +1,141 @@ +/** + * \file lzma/check.h + * \brief Integrity checks + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +#error Never include this file directly. Use instead. +#endif + +/** + * \brief Type of the integrity check (Check ID) + * + * The .xz format supports multiple types of checks that are calculated + * from the uncompressed data. They vary in both speed and ability to + * detect errors. + */ +typedef enum { + LZMA_CHECK_NONE = 0, + /**< + * No Check is calculated. + * + * Size of the Check field: 0 bytes + */ + + LZMA_CHECK_CRC32 = 1, + /**< + * CRC32 using the polynomial from the IEEE 802.3 standard + * + * Size of the Check field: 4 bytes + */ + + LZMA_CHECK_CRC64 = 4, + /**< + * CRC64 using the polynomial from the ECMA-182 standard + * + * Size of the Check field: 8 bytes + */ + + LZMA_CHECK_SHA256 = 10 + /**< + * SHA-256 + * + * Size of the Check field: 32 bytes + */ +} lzma_check; + +/** + * \brief Maximum valid Check ID + * + * The .xz file format specification specifies 16 Check IDs (0-15). Some + * of them are only reserved, that is, no actual Check algorithm has been + * assigned. When decoding, liblzma still accepts unknown Check IDs for + * future compatibility. If a valid but unsupported Check ID is detected, + * liblzma can indicate a warning; see the flags LZMA_TELL_NO_CHECK, + * LZMA_TELL_UNSUPPORTED_CHECK, and LZMA_TELL_ANY_CHECK in container.h. + */ +#define LZMA_CHECK_ID_MAX 15 + +/** + * \brief Test if the given Check ID is supported + * + * Return true if the given Check ID is supported by this liblzma build. + * Otherwise false is returned. It is safe to call this with a value that + * is not in the range [0, 15]; in that case the return value is always false. + * + * You can assume that LZMA_CHECK_NONE and LZMA_CHECK_CRC32 are always + * supported (even if liblzma is built with limited features). + */ +extern LZMA_API(lzma_bool) + lzma_check_is_supported(lzma_check check) lzma_nothrow lzma_attr_const; + +/** + * \brief Get the size of the Check field with the given Check ID + * + * Although not all Check IDs have a check algorithm associated, the size of + * every Check is already frozen. This function returns the size (in bytes) of + * the Check field with the specified Check ID. The values are: + * { 0, 4, 4, 4, 8, 8, 8, 16, 16, 16, 32, 32, 32, 64, 64, 64 } + * + * If the argument is not in the range [0, 15], UINT32_MAX is returned. + */ +extern LZMA_API(uint32_t) + lzma_check_size(lzma_check check) lzma_nothrow lzma_attr_const; + +/** + * \brief Maximum size of a Check field + */ +#define LZMA_CHECK_SIZE_MAX 64 + +/** + * \brief Calculate CRC32 + * + * Calculate CRC32 using the polynomial from the IEEE 802.3 standard. + * + * \param buf Pointer to the input buffer + * \param size Size of the input buffer + * \param crc Previously returned CRC value. This is used to + * calculate the CRC of a big buffer in smaller chunks. + * Set to zero when starting a new calculation. + * + * \return Updated CRC value, which can be passed to this function + * again to continue CRC calculation. + */ +extern LZMA_API(uint32_t) + lzma_crc32(const uint8_t* buf, size_t size, uint32_t crc) + lzma_nothrow lzma_attr_pure; + +/** + * \brief Calculate CRC64 + * + * Calculate CRC64 using the polynomial from the ECMA-182 standard. + * + * This function is used similarly to lzma_crc32(). See its documentation. + */ +extern LZMA_API(uint64_t) + lzma_crc64(const uint8_t* buf, size_t size, uint64_t crc) + lzma_nothrow lzma_attr_pure; + +/* + * SHA-256 functions are currently not exported to public API. + * Contact Lasse Collin if you think it should be. + */ + +/** + * \brief Get the type of the integrity check + * + * This function can be called only immediately after lzma_code() has + * returned LZMA_NO_CHECK, LZMA_UNSUPPORTED_CHECK, or LZMA_GET_CHECK. + * Calling this function in any other situation has undefined behavior. + */ +extern LZMA_API(lzma_check) + lzma_get_check(const lzma_stream* strm) lzma_nothrow; diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/container.h b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/container.h new file mode 100644 index 0000000..30b8fb0 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/container.h @@ -0,0 +1,621 @@ +/** + * \file lzma/container.h + * \brief File formats + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +#error Never include this file directly. Use instead. +#endif + +/************ + * Encoding * + ************/ + +/** + * \brief Default compression preset + * + * It's not straightforward to recommend a default preset, because in some + * cases keeping the resource usage relatively low is more important that + * getting the maximum compression ratio. + */ +#define LZMA_PRESET_DEFAULT UINT32_C(6) + +/** + * \brief Mask for preset level + * + * This is useful only if you need to extract the level from the preset + * variable. That should be rare. + */ +#define LZMA_PRESET_LEVEL_MASK UINT32_C(0x1F) + +/* + * Preset flags + * + * Currently only one flag is defined. + */ + +/** + * \brief Extreme compression preset + * + * This flag modifies the preset to make the encoding significantly slower + * while improving the compression ratio only marginally. This is useful + * when you don't mind wasting time to get as small result as possible. + * + * This flag doesn't affect the memory usage requirements of the decoder (at + * least not significantly). The memory usage of the encoder may be increased + * a little but only at the lowest preset levels (0-3). + */ +#define LZMA_PRESET_EXTREME (UINT32_C(1) << 31) + +/** + * \brief Multithreading options + */ +typedef struct { + /** + * \brief Flags + * + * Set this to zero if no flags are wanted. + * + * No flags are currently supported. + */ + uint32_t flags; + + /** + * \brief Number of worker threads to use + */ + uint32_t threads; + + /** + * \brief Maximum uncompressed size of a Block + * + * The encoder will start a new .xz Block every block_size bytes. + * Using LZMA_FULL_FLUSH or LZMA_FULL_BARRIER with lzma_code() + * the caller may tell liblzma to start a new Block earlier. + * + * With LZMA2, a recommended block size is 2-4 times the LZMA2 + * dictionary size. With very small dictionaries, it is recommended + * to use at least 1 MiB block size for good compression ratio, even + * if this is more than four times the dictionary size. Note that + * these are only recommendations for typical use cases; feel free + * to use other values. Just keep in mind that using a block size + * less than the LZMA2 dictionary size is waste of RAM. + * + * Set this to 0 to let liblzma choose the block size depending + * on the compression options. For LZMA2 it will be 3*dict_size + * or 1 MiB, whichever is more. + * + * For each thread, about 3 * block_size bytes of memory will be + * allocated. This may change in later liblzma versions. If so, + * the memory usage will probably be reduced, not increased. + */ + uint64_t block_size; + + /** + * \brief Timeout to allow lzma_code() to return early + * + * Multithreading can make liblzma to consume input and produce + * output in a very bursty way: it may first read a lot of input + * to fill internal buffers, then no input or output occurs for + * a while. + * + * In single-threaded mode, lzma_code() won't return until it has + * either consumed all the input or filled the output buffer. If + * this is done in multithreaded mode, it may cause a call + * lzma_code() to take even tens of seconds, which isn't acceptable + * in all applications. + * + * To avoid very long blocking times in lzma_code(), a timeout + * (in milliseconds) may be set here. If lzma_code() would block + * longer than this number of milliseconds, it will return with + * LZMA_OK. Reasonable values are 100 ms or more. The xz command + * line tool uses 300 ms. + * + * If long blocking times are fine for you, set timeout to a special + * value of 0, which will disable the timeout mechanism and will make + * lzma_code() block until all the input is consumed or the output + * buffer has been filled. + * + * \note Even with a timeout, lzma_code() might sometimes take + * somewhat long time to return. No timing guarantees + * are made. + */ + uint32_t timeout; + + /** + * \brief Compression preset (level and possible flags) + * + * The preset is set just like with lzma_easy_encoder(). + * The preset is ignored if filters below is non-NULL. + */ + uint32_t preset; + + /** + * \brief Filter chain (alternative to a preset) + * + * If this is NULL, the preset above is used. Otherwise the preset + * is ignored and the filter chain specified here is used. + */ + const lzma_filter* filters; + + /** + * \brief Integrity check type + * + * See check.h for available checks. The xz command line tool + * defaults to LZMA_CHECK_CRC64, which is a good choice if you + * are unsure. + */ + lzma_check check; + + /* + * Reserved space to allow possible future extensions without + * breaking the ABI. You should not touch these, because the names + * of these variables may change. These are and will never be used + * with the currently supported options, so it is safe to leave these + * uninitialized. + */ + lzma_reserved_enum reserved_enum1; + lzma_reserved_enum reserved_enum2; + lzma_reserved_enum reserved_enum3; + uint32_t reserved_int1; + uint32_t reserved_int2; + uint32_t reserved_int3; + uint32_t reserved_int4; + uint64_t reserved_int5; + uint64_t reserved_int6; + uint64_t reserved_int7; + uint64_t reserved_int8; + void* reserved_ptr1; + void* reserved_ptr2; + void* reserved_ptr3; + void* reserved_ptr4; + +} lzma_mt; + +/** + * \brief Calculate approximate memory usage of easy encoder + * + * This function is a wrapper for lzma_raw_encoder_memusage(). + * + * \param preset Compression preset (level and possible flags) + * + * \return Number of bytes of memory required for the given + * preset when encoding. If an error occurs, for example + * due to unsupported preset, UINT64_MAX is returned. + */ +extern LZMA_API(uint64_t) + lzma_easy_encoder_memusage(uint32_t preset) lzma_nothrow lzma_attr_pure; + +/** + * \brief Calculate approximate decoder memory usage of a preset + * + * This function is a wrapper for lzma_raw_decoder_memusage(). + * + * \param preset Compression preset (level and possible flags) + * + * \return Number of bytes of memory required to decompress a file + * that was compressed using the given preset. If an error + * occurs, for example due to unsupported preset, UINT64_MAX + * is returned. + */ +extern LZMA_API(uint64_t) + lzma_easy_decoder_memusage(uint32_t preset) lzma_nothrow lzma_attr_pure; + +/** + * \brief Initialize .xz Stream encoder using a preset number + * + * This function is intended for those who just want to use the basic features + * if liblzma (that is, most developers out there). + * + * \param strm Pointer to lzma_stream that is at least initialized + * with LZMA_STREAM_INIT. + * \param preset Compression preset to use. A preset consist of level + * number and zero or more flags. Usually flags aren't + * used, so preset is simply a number [0, 9] which match + * the options -0 ... -9 of the xz command line tool. + * Additional flags can be be set using bitwise-or with + * the preset level number, e.g. 6 | LZMA_PRESET_EXTREME. + * \param check Integrity check type to use. See check.h for available + * checks. The xz command line tool defaults to + * LZMA_CHECK_CRC64, which is a good choice if you are + * unsure. LZMA_CHECK_CRC32 is good too as long as the + * uncompressed file is not many gigabytes. + * + * \return - LZMA_OK: Initialization succeeded. Use lzma_code() to + * encode your data. + * - LZMA_MEM_ERROR: Memory allocation failed. + * - LZMA_OPTIONS_ERROR: The given compression preset is not + * supported by this build of liblzma. + * - LZMA_UNSUPPORTED_CHECK: The given check type is not + * supported by this liblzma build. + * - LZMA_PROG_ERROR: One or more of the parameters have values + * that will never be valid. For example, strm == NULL. + * + * If initialization fails (return value is not LZMA_OK), all the memory + * allocated for *strm by liblzma is always freed. Thus, there is no need + * to call lzma_end() after failed initialization. + * + * If initialization succeeds, use lzma_code() to do the actual encoding. + * Valid values for `action' (the second argument of lzma_code()) are + * LZMA_RUN, LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, and LZMA_FINISH. In future, + * there may be compression levels or flags that don't support LZMA_SYNC_FLUSH. + */ +extern LZMA_API(lzma_ret) + lzma_easy_encoder(lzma_stream* strm, uint32_t preset, lzma_check check) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Single-call .xz Stream encoding using a preset number + * + * The maximum required output buffer size can be calculated with + * lzma_stream_buffer_bound(). + * + * \param preset Compression preset to use. See the description + * in lzma_easy_encoder(). + * \param check Type of the integrity check to calculate from + * uncompressed data. + * \param allocator lzma_allocator for custom allocator functions. + * Set to NULL to use malloc() and free(). + * \param in Beginning of the input buffer + * \param in_size Size of the input buffer + * \param out Beginning of the output buffer + * \param out_pos The next byte will be written to out[*out_pos]. + * *out_pos is updated only if encoding succeeds. + * \param out_size Size of the out buffer; the first byte into + * which no data is written to is out[out_size]. + * + * \return - LZMA_OK: Encoding was successful. + * - LZMA_BUF_ERROR: Not enough output buffer space. + * - LZMA_UNSUPPORTED_CHECK + * - LZMA_OPTIONS_ERROR + * - LZMA_MEM_ERROR + * - LZMA_DATA_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_easy_buffer_encode( + uint32_t preset, + lzma_check check, + const lzma_allocator* allocator, + const uint8_t* in, + size_t in_size, + uint8_t* out, + size_t* out_pos, + size_t out_size) lzma_nothrow; + +/** + * \brief Initialize .xz Stream encoder using a custom filter chain + * + * \param strm Pointer to properly prepared lzma_stream + * \param filters Array of filters. This must be terminated with + * filters[n].id = LZMA_VLI_UNKNOWN. See filter.h for + * more information. + * \param check Type of the integrity check to calculate from + * uncompressed data. + * + * \return - LZMA_OK: Initialization was successful. + * - LZMA_MEM_ERROR + * - LZMA_UNSUPPORTED_CHECK + * - LZMA_OPTIONS_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_stream_encoder( + lzma_stream* strm, + const lzma_filter* filters, + lzma_check check) lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Calculate approximate memory usage of multithreaded .xz encoder + * + * Since doing the encoding in threaded mode doesn't affect the memory + * requirements of single-threaded decompressor, you can use + * lzma_easy_decoder_memusage(options->preset) or + * lzma_raw_decoder_memusage(options->filters) to calculate + * the decompressor memory requirements. + * + * \param options Compression options + * + * \return Number of bytes of memory required for encoding with the + * given options. If an error occurs, for example due to + * unsupported preset or filter chain, UINT64_MAX is returned. + */ +extern LZMA_API(uint64_t) lzma_stream_encoder_mt_memusage( + const lzma_mt* options) lzma_nothrow lzma_attr_pure; + +/** + * \brief Initialize multithreaded .xz Stream encoder + * + * This provides the functionality of lzma_easy_encoder() and + * lzma_stream_encoder() as a single function for multithreaded use. + * + * The supported actions for lzma_code() are LZMA_RUN, LZMA_FULL_FLUSH, + * LZMA_FULL_BARRIER, and LZMA_FINISH. Support for LZMA_SYNC_FLUSH might be + * added in the future. + * + * \param strm Pointer to properly prepared lzma_stream + * \param options Pointer to multithreaded compression options + * + * \return - LZMA_OK + * - LZMA_MEM_ERROR + * - LZMA_UNSUPPORTED_CHECK + * - LZMA_OPTIONS_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) + lzma_stream_encoder_mt(lzma_stream* strm, const lzma_mt* options) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Initialize .lzma encoder (legacy file format) + * + * The .lzma format is sometimes called the LZMA_Alone format, which is the + * reason for the name of this function. The .lzma format supports only the + * LZMA1 filter. There is no support for integrity checks like CRC32. + * + * Use this function if and only if you need to create files readable by + * legacy LZMA tools such as LZMA Utils 4.32.x. Moving to the .xz format + * is strongly recommended. + * + * The valid action values for lzma_code() are LZMA_RUN and LZMA_FINISH. + * No kind of flushing is supported, because the file format doesn't make + * it possible. + * + * \return - LZMA_OK + * - LZMA_MEM_ERROR + * - LZMA_OPTIONS_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) + lzma_alone_encoder(lzma_stream* strm, const lzma_options_lzma* options) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Calculate output buffer size for single-call Stream encoder + * + * When trying to compress uncompressible data, the encoded size will be + * slightly bigger than the input data. This function calculates how much + * output buffer space is required to be sure that lzma_stream_buffer_encode() + * doesn't return LZMA_BUF_ERROR. + * + * The calculated value is not exact, but it is guaranteed to be big enough. + * The actual maximum output space required may be slightly smaller (up to + * about 100 bytes). This should not be a problem in practice. + * + * If the calculated maximum size doesn't fit into size_t or would make the + * Stream grow past LZMA_VLI_MAX (which should never happen in practice), + * zero is returned to indicate the error. + * + * \note The limit calculated by this function applies only to + * single-call encoding. Multi-call encoding may (and probably + * will) have larger maximum expansion when encoding + * uncompressible data. Currently there is no function to + * calculate the maximum expansion of multi-call encoding. + */ +extern LZMA_API(size_t) + lzma_stream_buffer_bound(size_t uncompressed_size) lzma_nothrow; + +/** + * \brief Single-call .xz Stream encoder + * + * \param filters Array of filters. This must be terminated with + * filters[n].id = LZMA_VLI_UNKNOWN. See filter.h + * for more information. + * \param check Type of the integrity check to calculate from + * uncompressed data. + * \param allocator lzma_allocator for custom allocator functions. + * Set to NULL to use malloc() and free(). + * \param in Beginning of the input buffer + * \param in_size Size of the input buffer + * \param out Beginning of the output buffer + * \param out_pos The next byte will be written to out[*out_pos]. + * *out_pos is updated only if encoding succeeds. + * \param out_size Size of the out buffer; the first byte into + * which no data is written to is out[out_size]. + * + * \return - LZMA_OK: Encoding was successful. + * - LZMA_BUF_ERROR: Not enough output buffer space. + * - LZMA_UNSUPPORTED_CHECK + * - LZMA_OPTIONS_ERROR + * - LZMA_MEM_ERROR + * - LZMA_DATA_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_stream_buffer_encode( + lzma_filter* filters, + lzma_check check, + const lzma_allocator* allocator, + const uint8_t* in, + size_t in_size, + uint8_t* out, + size_t* out_pos, + size_t out_size) lzma_nothrow lzma_attr_warn_unused_result; + +/************ + * Decoding * + ************/ + +/** + * This flag makes lzma_code() return LZMA_NO_CHECK if the input stream + * being decoded has no integrity check. Note that when used with + * lzma_auto_decoder(), all .lzma files will trigger LZMA_NO_CHECK + * if LZMA_TELL_NO_CHECK is used. + */ +#define LZMA_TELL_NO_CHECK UINT32_C(0x01) + +/** + * This flag makes lzma_code() return LZMA_UNSUPPORTED_CHECK if the input + * stream has an integrity check, but the type of the integrity check is not + * supported by this liblzma version or build. Such files can still be + * decoded, but the integrity check cannot be verified. + */ +#define LZMA_TELL_UNSUPPORTED_CHECK UINT32_C(0x02) + +/** + * This flag makes lzma_code() return LZMA_GET_CHECK as soon as the type + * of the integrity check is known. The type can then be got with + * lzma_get_check(). + */ +#define LZMA_TELL_ANY_CHECK UINT32_C(0x04) + +/** + * This flag makes lzma_code() not calculate and verify the integrity check + * of the compressed data in .xz files. This means that invalid integrity + * check values won't be detected and LZMA_DATA_ERROR won't be returned in + * such cases. + * + * This flag only affects the checks of the compressed data itself; the CRC32 + * values in the .xz headers will still be verified normally. + * + * Don't use this flag unless you know what you are doing. Possible reasons + * to use this flag: + * + * - Trying to recover data from a corrupt .xz file. + * + * - Speeding up decompression, which matters mostly with SHA-256 + * or with files that have compressed extremely well. It's recommended + * to not use this flag for this purpose unless the file integrity is + * verified externally in some other way. + * + * Support for this flag was added in liblzma 5.1.4beta. + */ +#define LZMA_IGNORE_CHECK UINT32_C(0x10) + +/** + * This flag enables decoding of concatenated files with file formats that + * allow concatenating compressed files as is. From the formats currently + * supported by liblzma, only the .xz format allows concatenated files. + * Concatenated files are not allowed with the legacy .lzma format. + * + * This flag also affects the usage of the `action' argument for lzma_code(). + * When LZMA_CONCATENATED is used, lzma_code() won't return LZMA_STREAM_END + * unless LZMA_FINISH is used as `action'. Thus, the application has to set + * LZMA_FINISH in the same way as it does when encoding. + * + * If LZMA_CONCATENATED is not used, the decoders still accept LZMA_FINISH + * as `action' for lzma_code(), but the usage of LZMA_FINISH isn't required. + */ +#define LZMA_CONCATENATED UINT32_C(0x08) + +/** + * \brief Initialize .xz Stream decoder + * + * \param strm Pointer to properly prepared lzma_stream + * \param memlimit Memory usage limit as bytes. Use UINT64_MAX + * to effectively disable the limiter. liblzma + * 5.2.3 and earlier don't allow 0 here and return + * LZMA_PROG_ERROR; later versions treat 0 as if 1 + * had been specified. + * \param flags Bitwise-or of zero or more of the decoder flags: + * LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK, + * LZMA_TELL_ANY_CHECK, LZMA_CONCATENATED + * + * \return - LZMA_OK: Initialization was successful. + * - LZMA_MEM_ERROR: Cannot allocate memory. + * - LZMA_OPTIONS_ERROR: Unsupported flags + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) + lzma_stream_decoder(lzma_stream* strm, uint64_t memlimit, uint32_t flags) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Decode .xz Streams and .lzma files with autodetection + * + * This decoder autodetects between the .xz and .lzma file formats, and + * calls lzma_stream_decoder() or lzma_alone_decoder() once the type + * of the input file has been detected. + * + * \param strm Pointer to properly prepared lzma_stream + * \param memlimit Memory usage limit as bytes. Use UINT64_MAX + * to effectively disable the limiter. liblzma + * 5.2.3 and earlier don't allow 0 here and return + * LZMA_PROG_ERROR; later versions treat 0 as if 1 + * had been specified. + * \param flags Bitwise-or of flags, or zero for no flags. + * + * \return - LZMA_OK: Initialization was successful. + * - LZMA_MEM_ERROR: Cannot allocate memory. + * - LZMA_OPTIONS_ERROR: Unsupported flags + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) + lzma_auto_decoder(lzma_stream* strm, uint64_t memlimit, uint32_t flags) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Initialize .lzma decoder (legacy file format) + * + * \param strm Pointer to properly prepared lzma_stream + * \param memlimit Memory usage limit as bytes. Use UINT64_MAX + * to effectively disable the limiter. liblzma + * 5.2.3 and earlier don't allow 0 here and return + * LZMA_PROG_ERROR; later versions treat 0 as if 1 + * had been specified. + * + * Valid `action' arguments to lzma_code() are LZMA_RUN and LZMA_FINISH. + * There is no need to use LZMA_FINISH, but it's allowed because it may + * simplify certain types of applications. + * + * \return - LZMA_OK + * - LZMA_MEM_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) + lzma_alone_decoder(lzma_stream* strm, uint64_t memlimit) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Single-call .xz Stream decoder + * + * \param memlimit Pointer to how much memory the decoder is allowed + * to allocate. The value pointed by this pointer is + * modified if and only if LZMA_MEMLIMIT_ERROR is + * returned. + * \param flags Bitwise-or of zero or more of the decoder flags: + * LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK, + * LZMA_CONCATENATED. Note that LZMA_TELL_ANY_CHECK + * is not allowed and will return LZMA_PROG_ERROR. + * \param allocator lzma_allocator for custom allocator functions. + * Set to NULL to use malloc() and free(). + * \param in Beginning of the input buffer + * \param in_pos The next byte will be read from in[*in_pos]. + * *in_pos is updated only if decoding succeeds. + * \param in_size Size of the input buffer; the first byte that + * won't be read is in[in_size]. + * \param out Beginning of the output buffer + * \param out_pos The next byte will be written to out[*out_pos]. + * *out_pos is updated only if decoding succeeds. + * \param out_size Size of the out buffer; the first byte into + * which no data is written to is out[out_size]. + * + * \return - LZMA_OK: Decoding was successful. + * - LZMA_FORMAT_ERROR + * - LZMA_OPTIONS_ERROR + * - LZMA_DATA_ERROR + * - LZMA_NO_CHECK: This can be returned only if using + * the LZMA_TELL_NO_CHECK flag. + * - LZMA_UNSUPPORTED_CHECK: This can be returned only if using + * the LZMA_TELL_UNSUPPORTED_CHECK flag. + * - LZMA_MEM_ERROR + * - LZMA_MEMLIMIT_ERROR: Memory usage limit was reached. + * The minimum required memlimit value was stored to *memlimit. + * - LZMA_BUF_ERROR: Output buffer was too small. + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_stream_buffer_decode( + uint64_t* memlimit, + uint32_t flags, + const lzma_allocator* allocator, + const uint8_t* in, + size_t* in_pos, + size_t in_size, + uint8_t* out, + size_t* out_pos, + size_t out_size) lzma_nothrow lzma_attr_warn_unused_result; diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/delta.h b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/delta.h new file mode 100644 index 0000000..dd66b3b --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/delta.h @@ -0,0 +1,72 @@ +/** + * \file lzma/delta.h + * \brief Delta filter + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +#error Never include this file directly. Use instead. +#endif + +/** + * \brief Filter ID + * + * Filter ID of the Delta filter. This is used as lzma_filter.id. + */ +#define LZMA_FILTER_DELTA LZMA_VLI_C(0x03) + +/** + * \brief Type of the delta calculation + * + * Currently only byte-wise delta is supported. Other possible types could + * be, for example, delta of 16/32/64-bit little/big endian integers, but + * these are not currently planned since byte-wise delta is almost as good. + */ +typedef enum { LZMA_DELTA_TYPE_BYTE } lzma_delta_type; + +/** + * \brief Options for the Delta filter + * + * These options are needed by both encoder and decoder. + */ +typedef struct { + /** For now, this must always be LZMA_DELTA_TYPE_BYTE. */ + lzma_delta_type type; + + /** + * \brief Delta distance + * + * With the only currently supported type, LZMA_DELTA_TYPE_BYTE, + * the distance is as bytes. + * + * Examples: + * - 16-bit stereo audio: distance = 4 bytes + * - 24-bit RGB image data: distance = 3 bytes + */ + uint32_t dist; +#define LZMA_DELTA_DIST_MIN 1 +#define LZMA_DELTA_DIST_MAX 256 + + /* + * Reserved space to allow possible future extensions without + * breaking the ABI. You should not touch these, because the names + * of these variables may change. These are and will never be used + * when type is LZMA_DELTA_TYPE_BYTE, so it is safe to leave these + * uninitialized. + */ + uint32_t reserved_int1; + uint32_t reserved_int2; + uint32_t reserved_int3; + uint32_t reserved_int4; + void* reserved_ptr1; + void* reserved_ptr2; + +} lzma_options_delta; diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/filter.h b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/filter.h new file mode 100644 index 0000000..94adcc9 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/filter.h @@ -0,0 +1,426 @@ +/** + * \file lzma/filter.h + * \brief Common filter related types and functions + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +#error Never include this file directly. Use instead. +#endif + +/** + * \brief Maximum number of filters in a chain + * + * A filter chain can have 1-4 filters, of which three are allowed to change + * the size of the data. Usually only one or two filters are needed. + */ +#define LZMA_FILTERS_MAX 4 + +/** + * \brief Filter options + * + * This structure is used to pass Filter ID and a pointer filter's + * options to liblzma. A few functions work with a single lzma_filter + * structure, while most functions expect a filter chain. + * + * A filter chain is indicated with an array of lzma_filter structures. + * The array is terminated with .id = LZMA_VLI_UNKNOWN. Thus, the filter + * array must have LZMA_FILTERS_MAX + 1 elements (that is, five) to + * be able to hold any arbitrary filter chain. This is important when + * using lzma_block_header_decode() from block.h, because too small + * array would make liblzma write past the end of the filters array. + */ +typedef struct { + /** + * \brief Filter ID + * + * Use constants whose name begin with `LZMA_FILTER_' to specify + * different filters. In an array of lzma_filter structures, use + * LZMA_VLI_UNKNOWN to indicate end of filters. + * + * \note This is not an enum, because on some systems enums + * cannot be 64-bit. + */ + lzma_vli id; + + /** + * \brief Pointer to filter-specific options structure + * + * If the filter doesn't need options, set this to NULL. If id is + * set to LZMA_VLI_UNKNOWN, options is ignored, and thus + * doesn't need be initialized. + */ + void* options; + +} lzma_filter; + +/** + * \brief Test if the given Filter ID is supported for encoding + * + * Return true if the give Filter ID is supported for encoding by this + * liblzma build. Otherwise false is returned. + * + * There is no way to list which filters are available in this particular + * liblzma version and build. It would be useless, because the application + * couldn't know what kind of options the filter would need. + */ +extern LZMA_API(lzma_bool) + lzma_filter_encoder_is_supported(lzma_vli id) lzma_nothrow lzma_attr_const; + +/** + * \brief Test if the given Filter ID is supported for decoding + * + * Return true if the give Filter ID is supported for decoding by this + * liblzma build. Otherwise false is returned. + */ +extern LZMA_API(lzma_bool) + lzma_filter_decoder_is_supported(lzma_vli id) lzma_nothrow lzma_attr_const; + +/** + * \brief Copy the filters array + * + * Copy the Filter IDs and filter-specific options from src to dest. + * Up to LZMA_FILTERS_MAX filters are copied, plus the terminating + * .id == LZMA_VLI_UNKNOWN. Thus, dest should have at least + * LZMA_FILTERS_MAX + 1 elements space unless the caller knows that + * src is smaller than that. + * + * Unless the filter-specific options is NULL, the Filter ID has to be + * supported by liblzma, because liblzma needs to know the size of every + * filter-specific options structure. The filter-specific options are not + * validated. If options is NULL, any unsupported Filter IDs are copied + * without returning an error. + * + * Old filter-specific options in dest are not freed, so dest doesn't + * need to be initialized by the caller in any way. + * + * If an error occurs, memory possibly already allocated by this function + * is always freed. + * + * \return - LZMA_OK + * - LZMA_MEM_ERROR + * - LZMA_OPTIONS_ERROR: Unsupported Filter ID and its options + * is not NULL. + * - LZMA_PROG_ERROR: src or dest is NULL. + */ +extern LZMA_API(lzma_ret) lzma_filters_copy( + const lzma_filter* src, + lzma_filter* dest, + const lzma_allocator* allocator) lzma_nothrow; + +/** + * \brief Calculate approximate memory requirements for raw encoder + * + * This function can be used to calculate the memory requirements for + * Block and Stream encoders too because Block and Stream encoders don't + * need significantly more memory than raw encoder. + * + * \param filters Array of filters terminated with + * .id == LZMA_VLI_UNKNOWN. + * + * \return Number of bytes of memory required for the given + * filter chain when encoding. If an error occurs, + * for example due to unsupported filter chain, + * UINT64_MAX is returned. + */ +extern LZMA_API(uint64_t) lzma_raw_encoder_memusage(const lzma_filter* filters) + lzma_nothrow lzma_attr_pure; + +/** + * \brief Calculate approximate memory requirements for raw decoder + * + * This function can be used to calculate the memory requirements for + * Block and Stream decoders too because Block and Stream decoders don't + * need significantly more memory than raw decoder. + * + * \param filters Array of filters terminated with + * .id == LZMA_VLI_UNKNOWN. + * + * \return Number of bytes of memory required for the given + * filter chain when decoding. If an error occurs, + * for example due to unsupported filter chain, + * UINT64_MAX is returned. + */ +extern LZMA_API(uint64_t) lzma_raw_decoder_memusage(const lzma_filter* filters) + lzma_nothrow lzma_attr_pure; + +/** + * \brief Initialize raw encoder + * + * This function may be useful when implementing custom file formats. + * + * \param strm Pointer to properly prepared lzma_stream + * \param filters Array of lzma_filter structures. The end of the + * array must be marked with .id = LZMA_VLI_UNKNOWN. + * + * The `action' with lzma_code() can be LZMA_RUN, LZMA_SYNC_FLUSH (if the + * filter chain supports it), or LZMA_FINISH. + * + * \return - LZMA_OK + * - LZMA_MEM_ERROR + * - LZMA_OPTIONS_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) + lzma_raw_encoder(lzma_stream* strm, const lzma_filter* filters) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Initialize raw decoder + * + * The initialization of raw decoder goes similarly to raw encoder. + * + * The `action' with lzma_code() can be LZMA_RUN or LZMA_FINISH. Using + * LZMA_FINISH is not required, it is supported just for convenience. + * + * \return - LZMA_OK + * - LZMA_MEM_ERROR + * - LZMA_OPTIONS_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) + lzma_raw_decoder(lzma_stream* strm, const lzma_filter* filters) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Update the filter chain in the encoder + * + * This function is for advanced users only. This function has two slightly + * different purposes: + * + * - After LZMA_FULL_FLUSH when using Stream encoder: Set a new filter + * chain, which will be used starting from the next Block. + * + * - After LZMA_SYNC_FLUSH using Raw, Block, or Stream encoder: Change + * the filter-specific options in the middle of encoding. The actual + * filters in the chain (Filter IDs) cannot be changed. In the future, + * it might become possible to change the filter options without + * using LZMA_SYNC_FLUSH. + * + * While rarely useful, this function may be called also when no data has + * been compressed yet. In that case, this function will behave as if + * LZMA_FULL_FLUSH (Stream encoder) or LZMA_SYNC_FLUSH (Raw or Block + * encoder) had been used right before calling this function. + * + * \return - LZMA_OK + * - LZMA_MEM_ERROR + * - LZMA_MEMLIMIT_ERROR + * - LZMA_OPTIONS_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) + lzma_filters_update(lzma_stream* strm, const lzma_filter* filters) + lzma_nothrow; + +/** + * \brief Single-call raw encoder + * + * \param filters Array of lzma_filter structures. The end of the + * array must be marked with .id = LZMA_VLI_UNKNOWN. + * \param allocator lzma_allocator for custom allocator functions. + * Set to NULL to use malloc() and free(). + * \param in Beginning of the input buffer + * \param in_size Size of the input buffer + * \param out Beginning of the output buffer + * \param out_pos The next byte will be written to out[*out_pos]. + * *out_pos is updated only if encoding succeeds. + * \param out_size Size of the out buffer; the first byte into + * which no data is written to is out[out_size]. + * + * \return - LZMA_OK: Encoding was successful. + * - LZMA_BUF_ERROR: Not enough output buffer space. + * - LZMA_OPTIONS_ERROR + * - LZMA_MEM_ERROR + * - LZMA_DATA_ERROR + * - LZMA_PROG_ERROR + * + * \note There is no function to calculate how big output buffer + * would surely be big enough. (lzma_stream_buffer_bound() + * works only for lzma_stream_buffer_encode(); raw encoder + * won't necessarily meet that bound.) + */ +extern LZMA_API(lzma_ret) lzma_raw_buffer_encode( + const lzma_filter* filters, + const lzma_allocator* allocator, + const uint8_t* in, + size_t in_size, + uint8_t* out, + size_t* out_pos, + size_t out_size) lzma_nothrow; + +/** + * \brief Single-call raw decoder + * + * \param filters Array of lzma_filter structures. The end of the + * array must be marked with .id = LZMA_VLI_UNKNOWN. + * \param allocator lzma_allocator for custom allocator functions. + * Set to NULL to use malloc() and free(). + * \param in Beginning of the input buffer + * \param in_pos The next byte will be read from in[*in_pos]. + * *in_pos is updated only if decoding succeeds. + * \param in_size Size of the input buffer; the first byte that + * won't be read is in[in_size]. + * \param out Beginning of the output buffer + * \param out_pos The next byte will be written to out[*out_pos]. + * *out_pos is updated only if encoding succeeds. + * \param out_size Size of the out buffer; the first byte into + * which no data is written to is out[out_size]. + */ +extern LZMA_API(lzma_ret) lzma_raw_buffer_decode( + const lzma_filter* filters, + const lzma_allocator* allocator, + const uint8_t* in, + size_t* in_pos, + size_t in_size, + uint8_t* out, + size_t* out_pos, + size_t out_size) lzma_nothrow; + +/** + * \brief Get the size of the Filter Properties field + * + * This function may be useful when implementing custom file formats + * using the raw encoder and decoder. + * + * \param size Pointer to uint32_t to hold the size of the properties + * \param filter Filter ID and options (the size of the properties may + * vary depending on the options) + * + * \return - LZMA_OK + * - LZMA_OPTIONS_ERROR + * - LZMA_PROG_ERROR + * + * \note This function validates the Filter ID, but does not + * necessarily validate the options. Thus, it is possible + * that this returns LZMA_OK while the following call to + * lzma_properties_encode() returns LZMA_OPTIONS_ERROR. + */ +extern LZMA_API(lzma_ret) + lzma_properties_size(uint32_t* size, const lzma_filter* filter) + lzma_nothrow; + +/** + * \brief Encode the Filter Properties field + * + * \param filter Filter ID and options + * \param props Buffer to hold the encoded options. The size of + * buffer must have been already determined with + * lzma_properties_size(). + * + * \return - LZMA_OK + * - LZMA_OPTIONS_ERROR + * - LZMA_PROG_ERROR + * + * \note Even this function won't validate more options than actually + * necessary. Thus, it is possible that encoding the properties + * succeeds but using the same options to initialize the encoder + * will fail. + * + * \note If lzma_properties_size() indicated that the size + * of the Filter Properties field is zero, calling + * lzma_properties_encode() is not required, but it + * won't do any harm either. + */ +extern LZMA_API(lzma_ret) + lzma_properties_encode(const lzma_filter* filter, uint8_t* props) + lzma_nothrow; + +/** + * \brief Decode the Filter Properties field + * + * \param filter filter->id must have been set to the correct + * Filter ID. filter->options doesn't need to be + * initialized (it's not freed by this function). The + * decoded options will be stored to filter->options. + * filter->options is set to NULL if there are no + * properties or if an error occurs. + * \param allocator Custom memory allocator used to allocate the + * options. Set to NULL to use the default malloc(), + * and in case of an error, also free(). + * \param props Input buffer containing the properties. + * \param props_size Size of the properties. This must be the exact + * size; giving too much or too little input will + * return LZMA_OPTIONS_ERROR. + * + * \return - LZMA_OK + * - LZMA_OPTIONS_ERROR + * - LZMA_MEM_ERROR + */ +extern LZMA_API(lzma_ret) lzma_properties_decode( + lzma_filter* filter, + const lzma_allocator* allocator, + const uint8_t* props, + size_t props_size) lzma_nothrow; + +/** + * \brief Calculate encoded size of a Filter Flags field + * + * Knowing the size of Filter Flags is useful to know when allocating + * memory to hold the encoded Filter Flags. + * + * \param size Pointer to integer to hold the calculated size + * \param filter Filter ID and associated options whose encoded + * size is to be calculated + * + * \return - LZMA_OK: *size set successfully. Note that this doesn't + * guarantee that filter->options is valid, thus + * lzma_filter_flags_encode() may still fail. + * - LZMA_OPTIONS_ERROR: Unknown Filter ID or unsupported options. + * - LZMA_PROG_ERROR: Invalid options + * + * \note If you need to calculate size of List of Filter Flags, + * you need to loop over every lzma_filter entry. + */ +extern LZMA_API(lzma_ret) + lzma_filter_flags_size(uint32_t* size, const lzma_filter* filter) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Encode Filter Flags into given buffer + * + * In contrast to some functions, this doesn't allocate the needed buffer. + * This is due to how this function is used internally by liblzma. + * + * \param filter Filter ID and options to be encoded + * \param out Beginning of the output buffer + * \param out_pos out[*out_pos] is the next write position. This + * is updated by the encoder. + * \param out_size out[out_size] is the first byte to not write. + * + * \return - LZMA_OK: Encoding was successful. + * - LZMA_OPTIONS_ERROR: Invalid or unsupported options. + * - LZMA_PROG_ERROR: Invalid options or not enough output + * buffer space (you should have checked it with + * lzma_filter_flags_size()). + */ +extern LZMA_API(lzma_ret) lzma_filter_flags_encode( + const lzma_filter* filter, + uint8_t* out, + size_t* out_pos, + size_t out_size) lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Decode Filter Flags from given buffer + * + * The decoded result is stored into *filter. The old value of + * filter->options is not free()d. + * + * \return - LZMA_OK + * - LZMA_OPTIONS_ERROR + * - LZMA_MEM_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_filter_flags_decode( + lzma_filter* filter, + const lzma_allocator* allocator, + const uint8_t* in, + size_t* in_pos, + size_t in_size) lzma_nothrow lzma_attr_warn_unused_result; diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/hardware.h b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/hardware.h new file mode 100644 index 0000000..23e4442 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/hardware.h @@ -0,0 +1,62 @@ +/** + * \file lzma/hardware.h + * \brief Hardware information + * + * Since liblzma can consume a lot of system resources, it also provides + * ways to limit the resource usage. Applications linking against liblzma + * need to do the actual decisions how much resources to let liblzma to use. + * To ease making these decisions, liblzma provides functions to find out + * the relevant capabilities of the underlaying hardware. Currently there + * is only a function to find out the amount of RAM, but in the future there + * will be also a function to detect how many concurrent threads the system + * can run. + * + * \note On some operating systems, these function may temporarily + * load a shared library or open file descriptor(s) to find out + * the requested hardware information. Unless the application + * assumes that specific file descriptors are not touched by + * other threads, this should have no effect on thread safety. + * Possible operations involving file descriptors will restart + * the syscalls if they return EINTR. + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +#error Never include this file directly. Use instead. +#endif + +/** + * \brief Get the total amount of physical memory (RAM) in bytes + * + * This function may be useful when determining a reasonable memory + * usage limit for decompressing or how much memory it is OK to use + * for compressing. + * + * \return On success, the total amount of physical memory in bytes + * is returned. If the amount of RAM cannot be determined, + * zero is returned. This can happen if an error occurs + * or if there is no code in liblzma to detect the amount + * of RAM on the specific operating system. + */ +extern LZMA_API(uint64_t) lzma_physmem(void) lzma_nothrow; + +/** + * \brief Get the number of processor cores or threads + * + * This function may be useful when determining how many threads to use. + * If the hardware supports more than one thread per CPU core, the number + * of hardware threads is returned if that information is available. + * + * \brief On success, the number of available CPU threads or cores is + * returned. If this information isn't available or an error + * occurs, zero is returned. + */ +extern LZMA_API(uint32_t) lzma_cputhreads(void) lzma_nothrow; diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/index.h b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/index.h new file mode 100644 index 0000000..673aad1 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/index.h @@ -0,0 +1,667 @@ +/** + * \file lzma/index.h + * \brief Handling of .xz Index and related information + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +#error Never include this file directly. Use instead. +#endif + +/** + * \brief Opaque data type to hold the Index(es) and other information + * + * lzma_index often holds just one .xz Index and possibly the Stream Flags + * of the same Stream and size of the Stream Padding field. However, + * multiple lzma_indexes can be concatenated with lzma_index_cat() and then + * there may be information about multiple Streams in the same lzma_index. + * + * Notes about thread safety: Only one thread may modify lzma_index at + * a time. All functions that take non-const pointer to lzma_index + * modify it. As long as no thread is modifying the lzma_index, getting + * information from the same lzma_index can be done from multiple threads + * at the same time with functions that take a const pointer to + * lzma_index or use lzma_index_iter. The same iterator must be used + * only by one thread at a time, of course, but there can be as many + * iterators for the same lzma_index as needed. + */ +typedef struct lzma_index_s lzma_index; + +/** + * \brief Iterator to get information about Blocks and Streams + */ +typedef struct { + struct { + /** + * \brief Pointer to Stream Flags + * + * This is NULL if Stream Flags have not been set for + * this Stream with lzma_index_stream_flags(). + */ + const lzma_stream_flags* flags; + + const void* reserved_ptr1; + const void* reserved_ptr2; + const void* reserved_ptr3; + + /** + * \brief Stream number in the lzma_index + * + * The first Stream is 1. + */ + lzma_vli number; + + /** + * \brief Number of Blocks in the Stream + * + * If this is zero, the block structure below has + * undefined values. + */ + lzma_vli block_count; + + /** + * \brief Compressed start offset of this Stream + * + * The offset is relative to the beginning of the lzma_index + * (i.e. usually the beginning of the .xz file). + */ + lzma_vli compressed_offset; + + /** + * \brief Uncompressed start offset of this Stream + * + * The offset is relative to the beginning of the lzma_index + * (i.e. usually the beginning of the .xz file). + */ + lzma_vli uncompressed_offset; + + /** + * \brief Compressed size of this Stream + * + * This includes all headers except the possible + * Stream Padding after this Stream. + */ + lzma_vli compressed_size; + + /** + * \brief Uncompressed size of this Stream + */ + lzma_vli uncompressed_size; + + /** + * \brief Size of Stream Padding after this Stream + * + * If it hasn't been set with lzma_index_stream_padding(), + * this defaults to zero. Stream Padding is always + * a multiple of four bytes. + */ + lzma_vli padding; + + lzma_vli reserved_vli1; + lzma_vli reserved_vli2; + lzma_vli reserved_vli3; + lzma_vli reserved_vli4; + } stream; + + struct { + /** + * \brief Block number in the file + * + * The first Block is 1. + */ + lzma_vli number_in_file; + + /** + * \brief Compressed start offset of this Block + * + * This offset is relative to the beginning of the + * lzma_index (i.e. usually the beginning of the .xz file). + * Normally this is where you should seek in the .xz file + * to start decompressing this Block. + */ + lzma_vli compressed_file_offset; + + /** + * \brief Uncompressed start offset of this Block + * + * This offset is relative to the beginning of the lzma_index + * (i.e. usually the beginning of the .xz file). + * + * When doing random-access reading, it is possible that + * the target offset is not exactly at Block boundary. One + * will need to compare the target offset against + * uncompressed_file_offset or uncompressed_stream_offset, + * and possibly decode and throw away some amount of data + * before reaching the target offset. + */ + lzma_vli uncompressed_file_offset; + + /** + * \brief Block number in this Stream + * + * The first Block is 1. + */ + lzma_vli number_in_stream; + + /** + * \brief Compressed start offset of this Block + * + * This offset is relative to the beginning of the Stream + * containing this Block. + */ + lzma_vli compressed_stream_offset; + + /** + * \brief Uncompressed start offset of this Block + * + * This offset is relative to the beginning of the Stream + * containing this Block. + */ + lzma_vli uncompressed_stream_offset; + + /** + * \brief Uncompressed size of this Block + * + * You should pass this to the Block decoder if you will + * decode this Block. It will allow the Block decoder to + * validate the uncompressed size. + */ + lzma_vli uncompressed_size; + + /** + * \brief Unpadded size of this Block + * + * You should pass this to the Block decoder if you will + * decode this Block. It will allow the Block decoder to + * validate the unpadded size. + */ + lzma_vli unpadded_size; + + /** + * \brief Total compressed size + * + * This includes all headers and padding in this Block. + * This is useful if you need to know how many bytes + * the Block decoder will actually read. + */ + lzma_vli total_size; + + lzma_vli reserved_vli1; + lzma_vli reserved_vli2; + lzma_vli reserved_vli3; + lzma_vli reserved_vli4; + + const void* reserved_ptr1; + const void* reserved_ptr2; + const void* reserved_ptr3; + const void* reserved_ptr4; + } block; + + /* + * Internal data which is used to store the state of the iterator. + * The exact format may vary between liblzma versions, so don't + * touch these in any way. + */ + union { + const void* p; + size_t s; + lzma_vli v; + } internal[6]; +} lzma_index_iter; + +/** + * \brief Operation mode for lzma_index_iter_next() + */ +typedef enum { + LZMA_INDEX_ITER_ANY = 0, + /**< + * \brief Get the next Block or Stream + * + * Go to the next Block if the current Stream has at least + * one Block left. Otherwise go to the next Stream even if + * it has no Blocks. If the Stream has no Blocks + * (lzma_index_iter.stream.block_count == 0), + * lzma_index_iter.block will have undefined values. + */ + + LZMA_INDEX_ITER_STREAM = 1, + /**< + * \brief Get the next Stream + * + * Go to the next Stream even if the current Stream has + * unread Blocks left. If the next Stream has at least one + * Block, the iterator will point to the first Block. + * If there are no Blocks, lzma_index_iter.block will have + * undefined values. + */ + + LZMA_INDEX_ITER_BLOCK = 2, + /**< + * \brief Get the next Block + * + * Go to the next Block if the current Stream has at least + * one Block left. If the current Stream has no Blocks left, + * the next Stream with at least one Block is located and + * the iterator will be made to point to the first Block of + * that Stream. + */ + + LZMA_INDEX_ITER_NONEMPTY_BLOCK = 3 + /**< + * \brief Get the next non-empty Block + * + * This is like LZMA_INDEX_ITER_BLOCK except that it will + * skip Blocks whose Uncompressed Size is zero. + */ + +} lzma_index_iter_mode; + +/** + * \brief Calculate memory usage of lzma_index + * + * On disk, the size of the Index field depends on both the number of Records + * stored and how big values the Records store (due to variable-length integer + * encoding). When the Index is kept in lzma_index structure, the memory usage + * depends only on the number of Records/Blocks stored in the Index(es), and + * in case of concatenated lzma_indexes, the number of Streams. The size in + * RAM is almost always significantly bigger than in the encoded form on disk. + * + * This function calculates an approximate amount of memory needed hold + * the given number of Streams and Blocks in lzma_index structure. This + * value may vary between CPU architectures and also between liblzma versions + * if the internal implementation is modified. + */ +extern LZMA_API(uint64_t) + lzma_index_memusage(lzma_vli streams, lzma_vli blocks) lzma_nothrow; + +/** + * \brief Calculate the memory usage of an existing lzma_index + * + * This is a shorthand for lzma_index_memusage(lzma_index_stream_count(i), + * lzma_index_block_count(i)). + */ +extern LZMA_API(uint64_t) lzma_index_memused(const lzma_index* i) lzma_nothrow; + +/** + * \brief Allocate and initialize a new lzma_index structure + * + * \return On success, a pointer to an empty initialized lzma_index is + * returned. If allocation fails, NULL is returned. + */ +extern LZMA_API(lzma_index*) + lzma_index_init(const lzma_allocator* allocator) lzma_nothrow; + +/** + * \brief Deallocate lzma_index + * + * If i is NULL, this does nothing. + */ +extern LZMA_API(void) + lzma_index_end(lzma_index* i, const lzma_allocator* allocator) lzma_nothrow; + +/** + * \brief Add a new Block to lzma_index + * + * \param i Pointer to a lzma_index structure + * \param allocator Pointer to lzma_allocator, or NULL to + * use malloc() + * \param unpadded_size Unpadded Size of a Block. This can be + * calculated with lzma_block_unpadded_size() + * after encoding or decoding the Block. + * \param uncompressed_size Uncompressed Size of a Block. This can be + * taken directly from lzma_block structure + * after encoding or decoding the Block. + * + * Appending a new Block does not invalidate iterators. For example, + * if an iterator was pointing to the end of the lzma_index, after + * lzma_index_append() it is possible to read the next Block with + * an existing iterator. + * + * \return - LZMA_OK + * - LZMA_MEM_ERROR + * - LZMA_DATA_ERROR: Compressed or uncompressed size of the + * Stream or size of the Index field would grow too big. + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_index_append( + lzma_index* i, + const lzma_allocator* allocator, + lzma_vli unpadded_size, + lzma_vli uncompressed_size) lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Set the Stream Flags + * + * Set the Stream Flags of the last (and typically the only) Stream + * in lzma_index. This can be useful when reading information from the + * lzma_index, because to decode Blocks, knowing the integrity check type + * is needed. + * + * The given Stream Flags are copied into internal preallocated structure + * in the lzma_index, thus the caller doesn't need to keep the *stream_flags + * available after calling this function. + * + * \return - LZMA_OK + * - LZMA_OPTIONS_ERROR: Unsupported stream_flags->version. + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_index_stream_flags( + lzma_index* i, + const lzma_stream_flags* stream_flags) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Get the types of integrity Checks + * + * If lzma_index_stream_flags() is used to set the Stream Flags for + * every Stream, lzma_index_checks() can be used to get a bitmask to + * indicate which Check types have been used. It can be useful e.g. if + * showing the Check types to the user. + * + * The bitmask is 1 << check_id, e.g. CRC32 is 1 << 1 and SHA-256 is 1 << 10. + */ +extern LZMA_API(uint32_t) + lzma_index_checks(const lzma_index* i) lzma_nothrow lzma_attr_pure; + +/** + * \brief Set the amount of Stream Padding + * + * Set the amount of Stream Padding of the last (and typically the only) + * Stream in the lzma_index. This is needed when planning to do random-access + * reading within multiple concatenated Streams. + * + * By default, the amount of Stream Padding is assumed to be zero bytes. + * + * \return - LZMA_OK + * - LZMA_DATA_ERROR: The file size would grow too big. + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) + lzma_index_stream_padding(lzma_index* i, lzma_vli stream_padding) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Get the number of Streams + */ +extern LZMA_API(lzma_vli) + lzma_index_stream_count(const lzma_index* i) lzma_nothrow lzma_attr_pure; + +/** + * \brief Get the number of Blocks + * + * This returns the total number of Blocks in lzma_index. To get number + * of Blocks in individual Streams, use lzma_index_iter. + */ +extern LZMA_API(lzma_vli) + lzma_index_block_count(const lzma_index* i) lzma_nothrow lzma_attr_pure; + +/** + * \brief Get the size of the Index field as bytes + * + * This is needed to verify the Backward Size field in the Stream Footer. + */ +extern LZMA_API(lzma_vli) + lzma_index_size(const lzma_index* i) lzma_nothrow lzma_attr_pure; + +/** + * \brief Get the total size of the Stream + * + * If multiple lzma_indexes have been combined, this works as if the Blocks + * were in a single Stream. This is useful if you are going to combine + * Blocks from multiple Streams into a single new Stream. + */ +extern LZMA_API(lzma_vli) + lzma_index_stream_size(const lzma_index* i) lzma_nothrow lzma_attr_pure; + +/** + * \brief Get the total size of the Blocks + * + * This doesn't include the Stream Header, Stream Footer, Stream Padding, + * or Index fields. + */ +extern LZMA_API(lzma_vli) + lzma_index_total_size(const lzma_index* i) lzma_nothrow lzma_attr_pure; + +/** + * \brief Get the total size of the file + * + * When no lzma_indexes have been combined with lzma_index_cat() and there is + * no Stream Padding, this function is identical to lzma_index_stream_size(). + * If multiple lzma_indexes have been combined, this includes also the headers + * of each separate Stream and the possible Stream Padding fields. + */ +extern LZMA_API(lzma_vli) + lzma_index_file_size(const lzma_index* i) lzma_nothrow lzma_attr_pure; + +/** + * \brief Get the uncompressed size of the file + */ +extern LZMA_API(lzma_vli) lzma_index_uncompressed_size(const lzma_index* i) + lzma_nothrow lzma_attr_pure; + +/** + * \brief Initialize an iterator + * + * \param iter Pointer to a lzma_index_iter structure + * \param i lzma_index to which the iterator will be associated + * + * This function associates the iterator with the given lzma_index, and calls + * lzma_index_iter_rewind() on the iterator. + * + * This function doesn't allocate any memory, thus there is no + * lzma_index_iter_end(). The iterator is valid as long as the + * associated lzma_index is valid, that is, until lzma_index_end() or + * using it as source in lzma_index_cat(). Specifically, lzma_index doesn't + * become invalid if new Blocks are added to it with lzma_index_append() or + * if it is used as the destination in lzma_index_cat(). + * + * It is safe to make copies of an initialized lzma_index_iter, for example, + * to easily restart reading at some particular position. + */ +extern LZMA_API(void) + lzma_index_iter_init(lzma_index_iter* iter, const lzma_index* i) + lzma_nothrow; + +/** + * \brief Rewind the iterator + * + * Rewind the iterator so that next call to lzma_index_iter_next() will + * return the first Block or Stream. + */ +extern LZMA_API(void) + lzma_index_iter_rewind(lzma_index_iter* iter) lzma_nothrow; + +/** + * \brief Get the next Block or Stream + * + * \param iter Iterator initialized with lzma_index_iter_init() + * \param mode Specify what kind of information the caller wants + * to get. See lzma_index_iter_mode for details. + * + * \return If next Block or Stream matching the mode was found, *iter + * is updated and this function returns false. If no Block or + * Stream matching the mode is found, *iter is not modified + * and this function returns true. If mode is set to an unknown + * value, *iter is not modified and this function returns true. + */ +extern LZMA_API(lzma_bool) + lzma_index_iter_next(lzma_index_iter* iter, lzma_index_iter_mode mode) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Locate a Block + * + * If it is possible to seek in the .xz file, it is possible to parse + * the Index field(s) and use lzma_index_iter_locate() to do random-access + * reading with granularity of Block size. + * + * \param iter Iterator that was earlier initialized with + * lzma_index_iter_init(). + * \param target Uncompressed target offset which the caller would + * like to locate from the Stream + * + * If the target is smaller than the uncompressed size of the Stream (can be + * checked with lzma_index_uncompressed_size()): + * - Information about the Stream and Block containing the requested + * uncompressed offset is stored into *iter. + * - Internal state of the iterator is adjusted so that + * lzma_index_iter_next() can be used to read subsequent Blocks or Streams. + * - This function returns false. + * + * If target is greater than the uncompressed size of the Stream, *iter + * is not modified, and this function returns true. + */ +extern LZMA_API(lzma_bool) + lzma_index_iter_locate(lzma_index_iter* iter, lzma_vli target) lzma_nothrow; + +/** + * \brief Concatenate lzma_indexes + * + * Concatenating lzma_indexes is useful when doing random-access reading in + * multi-Stream .xz file, or when combining multiple Streams into single + * Stream. + * + * \param dest lzma_index after which src is appended + * \param src lzma_index to be appended after dest. If this + * function succeeds, the memory allocated for src + * is freed or moved to be part of dest, and all + * iterators pointing to src will become invalid. + * \param allocator Custom memory allocator; can be NULL to use + * malloc() and free(). + * + * \return - LZMA_OK: lzma_indexes were concatenated successfully. + * src is now a dangling pointer. + * - LZMA_DATA_ERROR: *dest would grow too big. + * - LZMA_MEM_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_index_cat( + lzma_index* dest, + lzma_index* src, + const lzma_allocator* allocator) lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Duplicate lzma_index + * + * \return A copy of the lzma_index, or NULL if memory allocation failed. + */ +extern LZMA_API(lzma_index*) + lzma_index_dup(const lzma_index* i, const lzma_allocator* allocator) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Initialize .xz Index encoder + * + * \param strm Pointer to properly prepared lzma_stream + * \param i Pointer to lzma_index which should be encoded. + * + * The valid `action' values for lzma_code() are LZMA_RUN and LZMA_FINISH. + * It is enough to use only one of them (you can choose freely). + * + * \return - LZMA_OK: Initialization succeeded, continue with lzma_code(). + * - LZMA_MEM_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) + lzma_index_encoder(lzma_stream* strm, const lzma_index* i) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Initialize .xz Index decoder + * + * \param strm Pointer to properly prepared lzma_stream + * \param i The decoded Index will be made available via + * this pointer. Initially this function will + * set *i to NULL (the old value is ignored). If + * decoding succeeds (lzma_code() returns + * LZMA_STREAM_END), *i will be set to point + * to a new lzma_index, which the application + * has to later free with lzma_index_end(). + * \param memlimit How much memory the resulting lzma_index is + * allowed to require. liblzma 5.2.3 and earlier + * don't allow 0 here and return LZMA_PROG_ERROR; + * later versions treat 0 as if 1 had been specified. + * + * Valid `action' arguments to lzma_code() are LZMA_RUN and LZMA_FINISH. + * There is no need to use LZMA_FINISH, but it's allowed because it may + * simplify certain types of applications. + * + * \return - LZMA_OK: Initialization succeeded, continue with lzma_code(). + * - LZMA_MEM_ERROR + * - LZMA_PROG_ERROR + * + * liblzma 5.2.3 and older list also LZMA_MEMLIMIT_ERROR here + * but that error code has never been possible from this + * initialization function. + */ +extern LZMA_API(lzma_ret) + lzma_index_decoder(lzma_stream* strm, lzma_index** i, uint64_t memlimit) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Single-call .xz Index encoder + * + * \param i lzma_index to be encoded + * \param out Beginning of the output buffer + * \param out_pos The next byte will be written to out[*out_pos]. + * *out_pos is updated only if encoding succeeds. + * \param out_size Size of the out buffer; the first byte into + * which no data is written to is out[out_size]. + * + * \return - LZMA_OK: Encoding was successful. + * - LZMA_BUF_ERROR: Output buffer is too small. Use + * lzma_index_size() to find out how much output + * space is needed. + * - LZMA_PROG_ERROR + * + * \note This function doesn't take allocator argument since all + * the internal data is allocated on stack. + */ +extern LZMA_API(lzma_ret) lzma_index_buffer_encode( + const lzma_index* i, + uint8_t* out, + size_t* out_pos, + size_t out_size) lzma_nothrow; + +/** + * \brief Single-call .xz Index decoder + * + * \param i If decoding succeeds, *i will point to a new + * lzma_index, which the application has to + * later free with lzma_index_end(). If an error + * occurs, *i will be NULL. The old value of *i + * is always ignored and thus doesn't need to be + * initialized by the caller. + * \param memlimit Pointer to how much memory the resulting + * lzma_index is allowed to require. The value + * pointed by this pointer is modified if and only + * if LZMA_MEMLIMIT_ERROR is returned. + * \param allocator Pointer to lzma_allocator, or NULL to use malloc() + * \param in Beginning of the input buffer + * \param in_pos The next byte will be read from in[*in_pos]. + * *in_pos is updated only if decoding succeeds. + * \param in_size Size of the input buffer; the first byte that + * won't be read is in[in_size]. + * + * \return - LZMA_OK: Decoding was successful. + * - LZMA_MEM_ERROR + * - LZMA_MEMLIMIT_ERROR: Memory usage limit was reached. + * The minimum required memlimit value was stored to *memlimit. + * - LZMA_DATA_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_index_buffer_decode( + lzma_index** i, + uint64_t* memlimit, + const lzma_allocator* allocator, + const uint8_t* in, + size_t* in_pos, + size_t in_size) lzma_nothrow; diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/index_hash.h b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/index_hash.h new file mode 100644 index 0000000..c013e46 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/index_hash.h @@ -0,0 +1,104 @@ +/** + * \file lzma/index_hash.h + * \brief Validate Index by using a hash function + * + * Hashing makes it possible to use constant amount of memory to validate + * Index of arbitrary size. + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +#error Never include this file directly. Use instead. +#endif + +/** + * \brief Opaque data type to hold the Index hash + */ +typedef struct lzma_index_hash_s lzma_index_hash; + +/** + * \brief Allocate and initialize a new lzma_index_hash structure + * + * If index_hash is NULL, a new lzma_index_hash structure is allocated, + * initialized, and a pointer to it returned. If allocation fails, NULL + * is returned. + * + * If index_hash is non-NULL, it is reinitialized and the same pointer + * returned. In this case, return value cannot be NULL or a different + * pointer than the index_hash that was given as an argument. + */ +extern LZMA_API(lzma_index_hash*) lzma_index_hash_init( + lzma_index_hash* index_hash, + const lzma_allocator* allocator) lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Deallocate lzma_index_hash structure + */ +extern LZMA_API(void) lzma_index_hash_end( + lzma_index_hash* index_hash, + const lzma_allocator* allocator) lzma_nothrow; + +/** + * \brief Add a new Record to an Index hash + * + * \param index Pointer to a lzma_index_hash structure + * \param unpadded_size Unpadded Size of a Block + * \param uncompressed_size Uncompressed Size of a Block + * + * \return - LZMA_OK + * - LZMA_DATA_ERROR: Compressed or uncompressed size of the + * Stream or size of the Index field would grow too big. + * - LZMA_PROG_ERROR: Invalid arguments or this function is being + * used when lzma_index_hash_decode() has already been used. + */ +extern LZMA_API(lzma_ret) lzma_index_hash_append( + lzma_index_hash* index_hash, + lzma_vli unpadded_size, + lzma_vli uncompressed_size) lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Decode and validate the Index field + * + * After telling the sizes of all Blocks with lzma_index_hash_append(), + * the actual Index field is decoded with this function. Specifically, + * once decoding of the Index field has been started, no more Records + * can be added using lzma_index_hash_append(). + * + * This function doesn't use lzma_stream structure to pass the input data. + * Instead, the input buffer is specified using three arguments. This is + * because it matches better the internal APIs of liblzma. + * + * \param index_hash Pointer to a lzma_index_hash structure + * \param in Pointer to the beginning of the input buffer + * \param in_pos in[*in_pos] is the next byte to process + * \param in_size in[in_size] is the first byte not to process + * + * \return - LZMA_OK: So far good, but more input is needed. + * - LZMA_STREAM_END: Index decoded successfully and it matches + * the Records given with lzma_index_hash_append(). + * - LZMA_DATA_ERROR: Index is corrupt or doesn't match the + * information given with lzma_index_hash_append(). + * - LZMA_BUF_ERROR: Cannot progress because *in_pos >= in_size. + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_index_hash_decode( + lzma_index_hash* index_hash, + const uint8_t* in, + size_t* in_pos, + size_t in_size) lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Get the size of the Index field as bytes + * + * This is needed to verify the Backward Size field in the Stream Footer. + */ +extern LZMA_API(lzma_vli) lzma_index_hash_size( + const lzma_index_hash* index_hash) lzma_nothrow lzma_attr_pure; diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/lzma12.h b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/lzma12.h new file mode 100644 index 0000000..975f6e4 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/lzma12.h @@ -0,0 +1,413 @@ +/** + * \file lzma/lzma12.h + * \brief LZMA1 and LZMA2 filters + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +#error Never include this file directly. Use instead. +#endif + +/** + * \brief LZMA1 Filter ID + * + * LZMA1 is the very same thing as what was called just LZMA in LZMA Utils, + * 7-Zip, and LZMA SDK. It's called LZMA1 here to prevent developers from + * accidentally using LZMA when they actually want LZMA2. + * + * LZMA1 shouldn't be used for new applications unless you _really_ know + * what you are doing. LZMA2 is almost always a better choice. + */ +#define LZMA_FILTER_LZMA1 LZMA_VLI_C(0x4000000000000001) + +/** + * \brief LZMA2 Filter ID + * + * Usually you want this instead of LZMA1. Compared to LZMA1, LZMA2 adds + * support for LZMA_SYNC_FLUSH, uncompressed chunks (smaller expansion + * when trying to compress uncompressible data), possibility to change + * lc/lp/pb in the middle of encoding, and some other internal improvements. + */ +#define LZMA_FILTER_LZMA2 LZMA_VLI_C(0x21) + +/** + * \brief Match finders + * + * Match finder has major effect on both speed and compression ratio. + * Usually hash chains are faster than binary trees. + * + * If you will use LZMA_SYNC_FLUSH often, the hash chains may be a better + * choice, because binary trees get much higher compression ratio penalty + * with LZMA_SYNC_FLUSH. + * + * The memory usage formulas are only rough estimates, which are closest to + * reality when dict_size is a power of two. The formulas are more complex + * in reality, and can also change a little between liblzma versions. Use + * lzma_raw_encoder_memusage() to get more accurate estimate of memory usage. + */ +typedef enum { + LZMA_MF_HC3 = 0x03, + /**< + * \brief Hash Chain with 2- and 3-byte hashing + * + * Minimum nice_len: 3 + * + * Memory usage: + * - dict_size <= 16 MiB: dict_size * 7.5 + * - dict_size > 16 MiB: dict_size * 5.5 + 64 MiB + */ + + LZMA_MF_HC4 = 0x04, + /**< + * \brief Hash Chain with 2-, 3-, and 4-byte hashing + * + * Minimum nice_len: 4 + * + * Memory usage: + * - dict_size <= 32 MiB: dict_size * 7.5 + * - dict_size > 32 MiB: dict_size * 6.5 + */ + + LZMA_MF_BT2 = 0x12, + /**< + * \brief Binary Tree with 2-byte hashing + * + * Minimum nice_len: 2 + * + * Memory usage: dict_size * 9.5 + */ + + LZMA_MF_BT3 = 0x13, + /**< + * \brief Binary Tree with 2- and 3-byte hashing + * + * Minimum nice_len: 3 + * + * Memory usage: + * - dict_size <= 16 MiB: dict_size * 11.5 + * - dict_size > 16 MiB: dict_size * 9.5 + 64 MiB + */ + + LZMA_MF_BT4 = 0x14 + /**< + * \brief Binary Tree with 2-, 3-, and 4-byte hashing + * + * Minimum nice_len: 4 + * + * Memory usage: + * - dict_size <= 32 MiB: dict_size * 11.5 + * - dict_size > 32 MiB: dict_size * 10.5 + */ +} lzma_match_finder; + +/** + * \brief Test if given match finder is supported + * + * Return true if the given match finder is supported by this liblzma build. + * Otherwise false is returned. It is safe to call this with a value that + * isn't listed in lzma_match_finder enumeration; the return value will be + * false. + * + * There is no way to list which match finders are available in this + * particular liblzma version and build. It would be useless, because + * a new match finder, which the application developer wasn't aware, + * could require giving additional options to the encoder that the older + * match finders don't need. + */ +extern LZMA_API(lzma_bool) lzma_mf_is_supported(lzma_match_finder match_finder) + lzma_nothrow lzma_attr_const; + +/** + * \brief Compression modes + * + * This selects the function used to analyze the data produced by the match + * finder. + */ +typedef enum { + LZMA_MODE_FAST = 1, + /**< + * \brief Fast compression + * + * Fast mode is usually at its best when combined with + * a hash chain match finder. + */ + + LZMA_MODE_NORMAL = 2 + /**< + * \brief Normal compression + * + * This is usually notably slower than fast mode. Use this + * together with binary tree match finders to expose the + * full potential of the LZMA1 or LZMA2 encoder. + */ +} lzma_mode; + +/** + * \brief Test if given compression mode is supported + * + * Return true if the given compression mode is supported by this liblzma + * build. Otherwise false is returned. It is safe to call this with a value + * that isn't listed in lzma_mode enumeration; the return value will be false. + * + * There is no way to list which modes are available in this particular + * liblzma version and build. It would be useless, because a new compression + * mode, which the application developer wasn't aware, could require giving + * additional options to the encoder that the older modes don't need. + */ +extern LZMA_API(lzma_bool) + lzma_mode_is_supported(lzma_mode mode) lzma_nothrow lzma_attr_const; + +/** + * \brief Options specific to the LZMA1 and LZMA2 filters + * + * Since LZMA1 and LZMA2 share most of the code, it's simplest to share + * the options structure too. For encoding, all but the reserved variables + * need to be initialized unless specifically mentioned otherwise. + * lzma_lzma_preset() can be used to get a good starting point. + * + * For raw decoding, both LZMA1 and LZMA2 need dict_size, preset_dict, and + * preset_dict_size (if preset_dict != NULL). LZMA1 needs also lc, lp, and pb. + */ +typedef struct { + /** + * \brief Dictionary size in bytes + * + * Dictionary size indicates how many bytes of the recently processed + * uncompressed data is kept in memory. One method to reduce size of + * the uncompressed data is to store distance-length pairs, which + * indicate what data to repeat from the dictionary buffer. Thus, + * the bigger the dictionary, the better the compression ratio + * usually is. + * + * Maximum size of the dictionary depends on multiple things: + * - Memory usage limit + * - Available address space (not a problem on 64-bit systems) + * - Selected match finder (encoder only) + * + * Currently the maximum dictionary size for encoding is 1.5 GiB + * (i.e. (UINT32_C(1) << 30) + (UINT32_C(1) << 29)) even on 64-bit + * systems for certain match finder implementation reasons. In the + * future, there may be match finders that support bigger + * dictionaries. + * + * Decoder already supports dictionaries up to 4 GiB - 1 B (i.e. + * UINT32_MAX), so increasing the maximum dictionary size of the + * encoder won't cause problems for old decoders. + * + * Because extremely small dictionaries sizes would have unneeded + * overhead in the decoder, the minimum dictionary size is 4096 bytes. + * + * \note When decoding, too big dictionary does no other harm + * than wasting memory. + */ + uint32_t dict_size; +#define LZMA_DICT_SIZE_MIN UINT32_C(4096) +#define LZMA_DICT_SIZE_DEFAULT (UINT32_C(1) << 23) + + /** + * \brief Pointer to an initial dictionary + * + * It is possible to initialize the LZ77 history window using + * a preset dictionary. It is useful when compressing many + * similar, relatively small chunks of data independently from + * each other. The preset dictionary should contain typical + * strings that occur in the files being compressed. The most + * probable strings should be near the end of the preset dictionary. + * + * This feature should be used only in special situations. For + * now, it works correctly only with raw encoding and decoding. + * Currently none of the container formats supported by + * liblzma allow preset dictionary when decoding, thus if + * you create a .xz or .lzma file with preset dictionary, it + * cannot be decoded with the regular decoder functions. In the + * future, the .xz format will likely get support for preset + * dictionary though. + */ + const uint8_t* preset_dict; + + /** + * \brief Size of the preset dictionary + * + * Specifies the size of the preset dictionary. If the size is + * bigger than dict_size, only the last dict_size bytes are + * processed. + * + * This variable is read only when preset_dict is not NULL. + * If preset_dict is not NULL but preset_dict_size is zero, + * no preset dictionary is used (identical to only setting + * preset_dict to NULL). + */ + uint32_t preset_dict_size; + + /** + * \brief Number of literal context bits + * + * How many of the highest bits of the previous uncompressed + * eight-bit byte (also known as `literal') are taken into + * account when predicting the bits of the next literal. + * + * E.g. in typical English text, an upper-case letter is + * often followed by a lower-case letter, and a lower-case + * letter is usually followed by another lower-case letter. + * In the US-ASCII character set, the highest three bits are 010 + * for upper-case letters and 011 for lower-case letters. + * When lc is at least 3, the literal coding can take advantage of + * this property in the uncompressed data. + * + * There is a limit that applies to literal context bits and literal + * position bits together: lc + lp <= 4. Without this limit the + * decoding could become very slow, which could have security related + * results in some cases like email servers doing virus scanning. + * This limit also simplifies the internal implementation in liblzma. + * + * There may be LZMA1 streams that have lc + lp > 4 (maximum possible + * lc would be 8). It is not possible to decode such streams with + * liblzma. + */ + uint32_t lc; +#define LZMA_LCLP_MIN 0 +#define LZMA_LCLP_MAX 4 +#define LZMA_LC_DEFAULT 3 + + /** + * \brief Number of literal position bits + * + * lp affects what kind of alignment in the uncompressed data is + * assumed when encoding literals. A literal is a single 8-bit byte. + * See pb below for more information about alignment. + */ + uint32_t lp; +#define LZMA_LP_DEFAULT 0 + + /** + * \brief Number of position bits + * + * pb affects what kind of alignment in the uncompressed data is + * assumed in general. The default means four-byte alignment + * (2^ pb =2^2=4), which is often a good choice when there's + * no better guess. + * + * When the aligment is known, setting pb accordingly may reduce + * the file size a little. E.g. with text files having one-byte + * alignment (US-ASCII, ISO-8859-*, UTF-8), setting pb=0 can + * improve compression slightly. For UTF-16 text, pb=1 is a good + * choice. If the alignment is an odd number like 3 bytes, pb=0 + * might be the best choice. + * + * Even though the assumed alignment can be adjusted with pb and + * lp, LZMA1 and LZMA2 still slightly favor 16-byte alignment. + * It might be worth taking into account when designing file formats + * that are likely to be often compressed with LZMA1 or LZMA2. + */ + uint32_t pb; +#define LZMA_PB_MIN 0 +#define LZMA_PB_MAX 4 +#define LZMA_PB_DEFAULT 2 + + /** Compression mode */ + lzma_mode mode; + + /** + * \brief Nice length of a match + * + * This determines how many bytes the encoder compares from the match + * candidates when looking for the best match. Once a match of at + * least nice_len bytes long is found, the encoder stops looking for + * better candidates and encodes the match. (Naturally, if the found + * match is actually longer than nice_len, the actual length is + * encoded; it's not truncated to nice_len.) + * + * Bigger values usually increase the compression ratio and + * compression time. For most files, 32 to 128 is a good value, + * which gives very good compression ratio at good speed. + * + * The exact minimum value depends on the match finder. The maximum + * is 273, which is the maximum length of a match that LZMA1 and + * LZMA2 can encode. + */ + uint32_t nice_len; + + /** Match finder ID */ + lzma_match_finder mf; + + /** + * \brief Maximum search depth in the match finder + * + * For every input byte, match finder searches through the hash chain + * or binary tree in a loop, each iteration going one step deeper in + * the chain or tree. The searching stops if + * - a match of at least nice_len bytes long is found; + * - all match candidates from the hash chain or binary tree have + * been checked; or + * - maximum search depth is reached. + * + * Maximum search depth is needed to prevent the match finder from + * wasting too much time in case there are lots of short match + * candidates. On the other hand, stopping the search before all + * candidates have been checked can reduce compression ratio. + * + * Setting depth to zero tells liblzma to use an automatic default + * value, that depends on the selected match finder and nice_len. + * The default is in the range [4, 200] or so (it may vary between + * liblzma versions). + * + * Using a bigger depth value than the default can increase + * compression ratio in some cases. There is no strict maximum value, + * but high values (thousands or millions) should be used with care: + * the encoder could remain fast enough with typical input, but + * malicious input could cause the match finder to slow down + * dramatically, possibly creating a denial of service attack. + */ + uint32_t depth; + + /* + * Reserved space to allow possible future extensions without + * breaking the ABI. You should not touch these, because the names + * of these variables may change. These are and will never be used + * with the currently supported options, so it is safe to leave these + * uninitialized. + */ + uint32_t reserved_int1; + uint32_t reserved_int2; + uint32_t reserved_int3; + uint32_t reserved_int4; + uint32_t reserved_int5; + uint32_t reserved_int6; + uint32_t reserved_int7; + uint32_t reserved_int8; + lzma_reserved_enum reserved_enum1; + lzma_reserved_enum reserved_enum2; + lzma_reserved_enum reserved_enum3; + lzma_reserved_enum reserved_enum4; + void* reserved_ptr1; + void* reserved_ptr2; + +} lzma_options_lzma; + +/** + * \brief Set a compression preset to lzma_options_lzma structure + * + * 0 is the fastest and 9 is the slowest. These match the switches -0 .. -9 + * of the xz command line tool. In addition, it is possible to bitwise-or + * flags to the preset. Currently only LZMA_PRESET_EXTREME is supported. + * The flags are defined in container.h, because the flags are used also + * with lzma_easy_encoder(). + * + * The preset values are subject to changes between liblzma versions. + * + * This function is available only if LZMA1 or LZMA2 encoder has been enabled + * when building liblzma. + * + * \return On success, false is returned. If the preset is not + * supported, true is returned. + */ +extern LZMA_API(lzma_bool) + lzma_lzma_preset(lzma_options_lzma* options, uint32_t preset) lzma_nothrow; diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/stream_flags.h b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/stream_flags.h new file mode 100644 index 0000000..0069c46 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/stream_flags.h @@ -0,0 +1,216 @@ +/** + * \file lzma/stream_flags.h + * \brief .xz Stream Header and Stream Footer encoder and decoder + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +#error Never include this file directly. Use instead. +#endif + +/** + * \brief Size of Stream Header and Stream Footer + * + * Stream Header and Stream Footer have the same size and they are not + * going to change even if a newer version of the .xz file format is + * developed in future. + */ +#define LZMA_STREAM_HEADER_SIZE 12 + +/** + * \brief Options for encoding/decoding Stream Header and Stream Footer + */ +typedef struct { + /** + * \brief Stream Flags format version + * + * To prevent API and ABI breakages if new features are needed in + * Stream Header or Stream Footer, a version number is used to + * indicate which fields in this structure are in use. For now, + * version must always be zero. With non-zero version, the + * lzma_stream_header_encode() and lzma_stream_footer_encode() + * will return LZMA_OPTIONS_ERROR. + * + * lzma_stream_header_decode() and lzma_stream_footer_decode() + * will always set this to the lowest value that supports all the + * features indicated by the Stream Flags field. The application + * must check that the version number set by the decoding functions + * is supported by the application. Otherwise it is possible that + * the application will decode the Stream incorrectly. + */ + uint32_t version; + + /** + * \brief Backward Size + * + * Backward Size must be a multiple of four bytes. In this Stream + * format version, Backward Size is the size of the Index field. + * + * Backward Size isn't actually part of the Stream Flags field, but + * it is convenient to include in this structure anyway. Backward + * Size is present only in the Stream Footer. There is no need to + * initialize backward_size when encoding Stream Header. + * + * lzma_stream_header_decode() always sets backward_size to + * LZMA_VLI_UNKNOWN so that it is convenient to use + * lzma_stream_flags_compare() when both Stream Header and Stream + * Footer have been decoded. + */ + lzma_vli backward_size; +#define LZMA_BACKWARD_SIZE_MIN 4 +#define LZMA_BACKWARD_SIZE_MAX (LZMA_VLI_C(1) << 34) + + /** + * \brief Check ID + * + * This indicates the type of the integrity check calculated from + * uncompressed data. + */ + lzma_check check; + + /* + * Reserved space to allow possible future extensions without + * breaking the ABI. You should not touch these, because the + * names of these variables may change. + * + * (We will never be able to use all of these since Stream Flags + * is just two bytes plus Backward Size of four bytes. But it's + * nice to have the proper types when they are needed.) + */ + lzma_reserved_enum reserved_enum1; + lzma_reserved_enum reserved_enum2; + lzma_reserved_enum reserved_enum3; + lzma_reserved_enum reserved_enum4; + lzma_bool reserved_bool1; + lzma_bool reserved_bool2; + lzma_bool reserved_bool3; + lzma_bool reserved_bool4; + lzma_bool reserved_bool5; + lzma_bool reserved_bool6; + lzma_bool reserved_bool7; + lzma_bool reserved_bool8; + uint32_t reserved_int1; + uint32_t reserved_int2; + +} lzma_stream_flags; + +/** + * \brief Encode Stream Header + * + * \param options Stream Header options to be encoded. + * options->backward_size is ignored and doesn't + * need to be initialized. + * \param out Beginning of the output buffer of + * LZMA_STREAM_HEADER_SIZE bytes. + * + * \return - LZMA_OK: Encoding was successful. + * - LZMA_OPTIONS_ERROR: options->version is not supported by + * this liblzma version. + * - LZMA_PROG_ERROR: Invalid options. + */ +extern LZMA_API(lzma_ret) + lzma_stream_header_encode(const lzma_stream_flags* options, uint8_t* out) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Encode Stream Footer + * + * \param options Stream Footer options to be encoded. + * \param out Beginning of the output buffer of + * LZMA_STREAM_HEADER_SIZE bytes. + * + * \return - LZMA_OK: Encoding was successful. + * - LZMA_OPTIONS_ERROR: options->version is not supported by + * this liblzma version. + * - LZMA_PROG_ERROR: Invalid options. + */ +extern LZMA_API(lzma_ret) + lzma_stream_footer_encode(const lzma_stream_flags* options, uint8_t* out) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Decode Stream Header + * + * \param options Target for the decoded Stream Header options. + * \param in Beginning of the input buffer of + * LZMA_STREAM_HEADER_SIZE bytes. + * + * options->backward_size is always set to LZMA_VLI_UNKNOWN. This is to + * help comparing Stream Flags from Stream Header and Stream Footer with + * lzma_stream_flags_compare(). + * + * \return - LZMA_OK: Decoding was successful. + * - LZMA_FORMAT_ERROR: Magic bytes don't match, thus the given + * buffer cannot be Stream Header. + * - LZMA_DATA_ERROR: CRC32 doesn't match, thus the header + * is corrupt. + * - LZMA_OPTIONS_ERROR: Unsupported options are present + * in the header. + * + * \note When decoding .xz files that contain multiple Streams, it may + * make sense to print "file format not recognized" only if + * decoding of the Stream Header of the _first_ Stream gives + * LZMA_FORMAT_ERROR. If non-first Stream Header gives + * LZMA_FORMAT_ERROR, the message used for LZMA_DATA_ERROR is + * probably more appropriate. + * + * For example, Stream decoder in liblzma uses LZMA_DATA_ERROR if + * LZMA_FORMAT_ERROR is returned by lzma_stream_header_decode() + * when decoding non-first Stream. + */ +extern LZMA_API(lzma_ret) + lzma_stream_header_decode(lzma_stream_flags* options, const uint8_t* in) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Decode Stream Footer + * + * \param options Target for the decoded Stream Header options. + * \param in Beginning of the input buffer of + * LZMA_STREAM_HEADER_SIZE bytes. + * + * \return - LZMA_OK: Decoding was successful. + * - LZMA_FORMAT_ERROR: Magic bytes don't match, thus the given + * buffer cannot be Stream Footer. + * - LZMA_DATA_ERROR: CRC32 doesn't match, thus the Stream Footer + * is corrupt. + * - LZMA_OPTIONS_ERROR: Unsupported options are present + * in Stream Footer. + * + * \note If Stream Header was already decoded successfully, but + * decoding Stream Footer returns LZMA_FORMAT_ERROR, the + * application should probably report some other error message + * than "file format not recognized", since the file more likely + * is corrupt (possibly truncated). Stream decoder in liblzma + * uses LZMA_DATA_ERROR in this situation. + */ +extern LZMA_API(lzma_ret) + lzma_stream_footer_decode(lzma_stream_flags* options, const uint8_t* in) + lzma_nothrow lzma_attr_warn_unused_result; + +/** + * \brief Compare two lzma_stream_flags structures + * + * backward_size values are compared only if both are not + * LZMA_VLI_UNKNOWN. + * + * \return - LZMA_OK: Both are equal. If either had backward_size set + * to LZMA_VLI_UNKNOWN, backward_size values were not + * compared or validated. + * - LZMA_DATA_ERROR: The structures differ. + * - LZMA_OPTIONS_ERROR: version in either structure is greater + * than the maximum supported version (currently zero). + * - LZMA_PROG_ERROR: Invalid value, e.g. invalid check or + * backward_size. + */ +extern LZMA_API(lzma_ret) lzma_stream_flags_compare( + const lzma_stream_flags* a, + const lzma_stream_flags* b) lzma_nothrow lzma_attr_pure; diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/version.h b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/version.h new file mode 100644 index 0000000..a22d621 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/version.h @@ -0,0 +1,117 @@ +/** + * \file lzma/version.h + * \brief Version number + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +#error Never include this file directly. Use instead. +#endif + +/* + * Version number split into components + */ +#define LZMA_VERSION_MAJOR 5 +#define LZMA_VERSION_MINOR 2 +#define LZMA_VERSION_PATCH 4 +#define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_STABLE + +#ifndef LZMA_VERSION_COMMIT +#define LZMA_VERSION_COMMIT "" +#endif + +/* + * Map symbolic stability levels to integers. + */ +#define LZMA_VERSION_STABILITY_ALPHA 0 +#define LZMA_VERSION_STABILITY_BETA 1 +#define LZMA_VERSION_STABILITY_STABLE 2 + +/** + * \brief Compile-time version number + * + * The version number is of format xyyyzzzs where + * - x = major + * - yyy = minor + * - zzz = revision + * - s indicates stability: 0 = alpha, 1 = beta, 2 = stable + * + * The same xyyyzzz triplet is never reused with different stability levels. + * For example, if 5.1.0alpha has been released, there will never be 5.1.0beta + * or 5.1.0 stable. + * + * \note The version number of liblzma has nothing to with + * the version number of Igor Pavlov's LZMA SDK. + */ +#define LZMA_VERSION \ + (LZMA_VERSION_MAJOR * UINT32_C(10000000) + \ + LZMA_VERSION_MINOR * UINT32_C(10000) + LZMA_VERSION_PATCH * UINT32_C(10) + \ + LZMA_VERSION_STABILITY) + +/* + * Macros to construct the compile-time version string + */ +#if LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_ALPHA +#define LZMA_VERSION_STABILITY_STRING "alpha" +#elif LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_BETA +#define LZMA_VERSION_STABILITY_STRING "beta" +#elif LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_STABLE +#define LZMA_VERSION_STABILITY_STRING "" +#else +#error Incorrect LZMA_VERSION_STABILITY +#endif + +#define LZMA_VERSION_STRING_C_(major, minor, patch, stability, commit) \ + #major "." #minor "." #patch stability commit + +#define LZMA_VERSION_STRING_C(major, minor, patch, stability, commit) \ + LZMA_VERSION_STRING_C_(major, minor, patch, stability, commit) + +/** + * \brief Compile-time version as a string + * + * This can be for example "4.999.5alpha", "4.999.8beta", or "5.0.0" (stable + * versions don't have any "stable" suffix). In future, a snapshot built + * from source code repository may include an additional suffix, for example + * "4.999.8beta-21-g1d92". The commit ID won't be available in numeric form + * in LZMA_VERSION macro. + */ +#define LZMA_VERSION_STRING \ + LZMA_VERSION_STRING_C( \ + LZMA_VERSION_MAJOR, \ + LZMA_VERSION_MINOR, \ + LZMA_VERSION_PATCH, \ + LZMA_VERSION_STABILITY_STRING, \ + LZMA_VERSION_COMMIT) + +/* #ifndef is needed for use with windres (MinGW or Cygwin). */ +#ifndef LZMA_H_INTERNAL_RC + +/** + * \brief Run-time version number as an integer + * + * Return the value of LZMA_VERSION macro at the compile time of liblzma. + * This allows the application to compare if it was built against the same, + * older, or newer version of liblzma that is currently running. + */ +extern LZMA_API(uint32_t) + lzma_version_number(void) lzma_nothrow lzma_attr_const; + +/** + * \brief Run-time version as a string + * + * This function may be useful if you want to display which version of + * liblzma your application is currently using. + */ +extern LZMA_API(const char*) + lzma_version_string(void) lzma_nothrow lzma_attr_const; + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/vli.h b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/vli.h new file mode 100644 index 0000000..73ad034 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/lzma/vli.h @@ -0,0 +1,167 @@ +/** + * \file lzma/vli.h + * \brief Variable-length integer handling + * + * In the .xz format, most integers are encoded in a variable-length + * representation, which is sometimes called little endian base-128 encoding. + * This saves space when smaller values are more likely than bigger values. + * + * The encoding scheme encodes seven bits to every byte, using minimum + * number of bytes required to represent the given value. Encodings that use + * non-minimum number of bytes are invalid, thus every integer has exactly + * one encoded representation. The maximum number of bits in a VLI is 63, + * thus the vli argument must be less than or equal to UINT64_MAX / 2. You + * should use LZMA_VLI_MAX for clarity. + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +#error Never include this file directly. Use instead. +#endif + +/** + * \brief Maximum supported value of a variable-length integer + */ +#define LZMA_VLI_MAX (UINT64_MAX / 2) + +/** + * \brief VLI value to denote that the value is unknown + */ +#define LZMA_VLI_UNKNOWN UINT64_MAX + +/** + * \brief Maximum supported encoded length of variable length integers + */ +#define LZMA_VLI_BYTES_MAX 9 + +/** + * \brief VLI constant suffix + */ +#define LZMA_VLI_C(n) UINT64_C(n) + +/** + * \brief Variable-length integer type + * + * Valid VLI values are in the range [0, LZMA_VLI_MAX]. Unknown value is + * indicated with LZMA_VLI_UNKNOWN, which is the maximum value of the + * underlaying integer type. + * + * lzma_vli will be uint64_t for the foreseeable future. If a bigger size + * is needed in the future, it is guaranteed that 2 * LZMA_VLI_MAX will + * not overflow lzma_vli. This simplifies integer overflow detection. + */ +typedef uint64_t lzma_vli; + +/** + * \brief Validate a variable-length integer + * + * This is useful to test that application has given acceptable values + * for example in the uncompressed_size and compressed_size variables. + * + * \return True if the integer is representable as VLI or if it + * indicates unknown value. + */ +#define lzma_vli_is_valid(vli) \ + ((vli) <= LZMA_VLI_MAX || (vli) == LZMA_VLI_UNKNOWN) + +/** + * \brief Encode a variable-length integer + * + * This function has two modes: single-call and multi-call. Single-call mode + * encodes the whole integer at once; it is an error if the output buffer is + * too small. Multi-call mode saves the position in *vli_pos, and thus it is + * possible to continue encoding if the buffer becomes full before the whole + * integer has been encoded. + * + * \param vli Integer to be encoded + * \param vli_pos How many VLI-encoded bytes have already been written + * out. When starting to encode a new integer in + * multi-call mode, *vli_pos must be set to zero. + * To use single-call encoding, set vli_pos to NULL. + * \param out Beginning of the output buffer + * \param out_pos The next byte will be written to out[*out_pos]. + * \param out_size Size of the out buffer; the first byte into + * which no data is written to is out[out_size]. + * + * \return Slightly different return values are used in multi-call and + * single-call modes. + * + * Single-call (vli_pos == NULL): + * - LZMA_OK: Integer successfully encoded. + * - LZMA_PROG_ERROR: Arguments are not sane. This can be due + * to too little output space; single-call mode doesn't use + * LZMA_BUF_ERROR, since the application should have checked + * the encoded size with lzma_vli_size(). + * + * Multi-call (vli_pos != NULL): + * - LZMA_OK: So far all OK, but the integer is not + * completely written out yet. + * - LZMA_STREAM_END: Integer successfully encoded. + * - LZMA_BUF_ERROR: No output space was provided. + * - LZMA_PROG_ERROR: Arguments are not sane. + */ +extern LZMA_API(lzma_ret) lzma_vli_encode( + lzma_vli vli, + size_t* vli_pos, + uint8_t* out, + size_t* out_pos, + size_t out_size) lzma_nothrow; + +/** + * \brief Decode a variable-length integer + * + * Like lzma_vli_encode(), this function has single-call and multi-call modes. + * + * \param vli Pointer to decoded integer. The decoder will + * initialize it to zero when *vli_pos == 0, so + * application isn't required to initialize *vli. + * \param vli_pos How many bytes have already been decoded. When + * starting to decode a new integer in multi-call + * mode, *vli_pos must be initialized to zero. To + * use single-call decoding, set vli_pos to NULL. + * \param in Beginning of the input buffer + * \param in_pos The next byte will be read from in[*in_pos]. + * \param in_size Size of the input buffer; the first byte that + * won't be read is in[in_size]. + * + * \return Slightly different return values are used in multi-call and + * single-call modes. + * + * Single-call (vli_pos == NULL): + * - LZMA_OK: Integer successfully decoded. + * - LZMA_DATA_ERROR: Integer is corrupt. This includes hitting + * the end of the input buffer before the whole integer was + * decoded; providing no input at all will use LZMA_DATA_ERROR. + * - LZMA_PROG_ERROR: Arguments are not sane. + * + * Multi-call (vli_pos != NULL): + * - LZMA_OK: So far all OK, but the integer is not + * completely decoded yet. + * - LZMA_STREAM_END: Integer successfully decoded. + * - LZMA_DATA_ERROR: Integer is corrupt. + * - LZMA_BUF_ERROR: No input was provided. + * - LZMA_PROG_ERROR: Arguments are not sane. + */ +extern LZMA_API(lzma_ret) lzma_vli_decode( + lzma_vli* vli, + size_t* vli_pos, + const uint8_t* in, + size_t* in_pos, + size_t in_size) lzma_nothrow; + +/** + * \brief Get the number of bytes required to encode a VLI + * + * \return Number of bytes on success (1-9). If vli isn't valid, + * zero is returned. + */ +extern LZMA_API(uint32_t) + lzma_vli_size(lzma_vli vli) lzma_nothrow lzma_attr_pure; diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/menu.h b/src_cpp/elfgames/tasks/elf2codingenv/include/menu.h new file mode 100644 index 0000000..6f81485 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/menu.h @@ -0,0 +1,266 @@ +/**************************************************************************** + * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1995,1997 * + ****************************************************************************/ + +/* $Id: menu.h,v 1.23 2017/02/11 16:54:04 tom Exp $ */ + +#ifndef ETI_MENU +#define ETI_MENU + +#ifdef AMIGA +#define TEXT TEXT_ncurses +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef int Menu_Options; +typedef int Item_Options; + +/* Menu options: */ +#define O_ONEVALUE (0x01) +#define O_SHOWDESC (0x02) +#define O_ROWMAJOR (0x04) +#define O_IGNORECASE (0x08) +#define O_SHOWMATCH (0x10) +#define O_NONCYCLIC (0x20) +#define O_MOUSE_MENU (0x40) + +/* Item options: */ +#define O_SELECTABLE (0x01) + +#if !NCURSES_OPAQUE_MENU +typedef struct { + const char* str; + unsigned short length; +} TEXT; +#endif /* !NCURSES_OPAQUE_MENU */ + +struct tagMENU; + +typedef struct tagITEM +#if !NCURSES_OPAQUE_MENU +{ + TEXT name; /* name of menu item */ + TEXT description; /* description of item, optional in display */ + struct tagMENU* imenu; /* Pointer to parent menu */ + void* userptr; /* Pointer to user defined per item data */ + Item_Options opt; /* Item options */ + short index; /* Item number if connected to a menu */ + short y; /* y and x location of item in menu */ + short x; + bool value; /* Selection value */ + + struct tagITEM* left; /* neighbor items */ + struct tagITEM* right; + struct tagITEM* up; + struct tagITEM* down; + +} +#endif /* !NCURSES_OPAQUE_MENU */ +ITEM; + +typedef void (*Menu_Hook)(struct tagMENU*); + +typedef struct tagMENU +#if 1 /* not yet: !NCURSES_OPAQUE_MENU */ +{ + short height; /* Nr. of chars high */ + short width; /* Nr. of chars wide */ + short rows; /* Nr. of items high */ + short cols; /* Nr. of items wide */ + short frows; /* Nr. of formatted items high */ + short fcols; /* Nr. of formatted items wide */ + short arows; /* Nr. of items high (actual) */ + short namelen; /* Max. name length */ + short desclen; /* Max. description length */ + short marklen; /* Length of mark, if any */ + short itemlen; /* Length of one item */ + short spc_desc; /* Spacing for descriptor */ + short spc_cols; /* Spacing for columns */ + short spc_rows; /* Spacing for rows */ + char* pattern; /* Buffer to store match chars */ + short pindex; /* Index into pattern buffer */ + WINDOW* win; /* Window containing menu */ + WINDOW* sub; /* Subwindow for menu display */ + WINDOW* userwin; /* User's window */ + WINDOW* usersub; /* User's subwindow */ + ITEM** items; /* array of items */ + short nitems; /* Nr. of items in menu */ + ITEM* curitem; /* Current item */ + short toprow; /* Top row of menu */ + chtype fore; /* Selection attribute */ + chtype back; /* Nonselection attribute */ + chtype grey; /* Inactive attribute */ + unsigned char pad; /* Pad character */ + + Menu_Hook menuinit; /* User hooks */ + Menu_Hook menuterm; + Menu_Hook iteminit; + Menu_Hook itemterm; + + void* userptr; /* Pointer to menus user data */ + char* mark; /* Pointer to marker string */ + + Menu_Options opt; /* Menu options */ + unsigned short status; /* Internal state of menu */ +} +#endif /* !NCURSES_OPAQUE_MENU */ +MENU; + +/* Define keys */ + +#define REQ_LEFT_ITEM (KEY_MAX + 1) +#define REQ_RIGHT_ITEM (KEY_MAX + 2) +#define REQ_UP_ITEM (KEY_MAX + 3) +#define REQ_DOWN_ITEM (KEY_MAX + 4) +#define REQ_SCR_ULINE (KEY_MAX + 5) +#define REQ_SCR_DLINE (KEY_MAX + 6) +#define REQ_SCR_DPAGE (KEY_MAX + 7) +#define REQ_SCR_UPAGE (KEY_MAX + 8) +#define REQ_FIRST_ITEM (KEY_MAX + 9) +#define REQ_LAST_ITEM (KEY_MAX + 10) +#define REQ_NEXT_ITEM (KEY_MAX + 11) +#define REQ_PREV_ITEM (KEY_MAX + 12) +#define REQ_TOGGLE_ITEM (KEY_MAX + 13) +#define REQ_CLEAR_PATTERN (KEY_MAX + 14) +#define REQ_BACK_PATTERN (KEY_MAX + 15) +#define REQ_NEXT_MATCH (KEY_MAX + 16) +#define REQ_PREV_MATCH (KEY_MAX + 17) + +#define MIN_MENU_COMMAND (KEY_MAX + 1) +#define MAX_MENU_COMMAND (KEY_MAX + 17) + +/* + * Some AT&T code expects MAX_COMMAND to be out-of-band not + * just for menu commands but for forms ones as well. + */ +#if defined(MAX_COMMAND) +#if (MAX_MENU_COMMAND > MAX_COMMAND) +#error Something is wrong -- MAX_MENU_COMMAND is greater than MAX_COMMAND +#elif (MAX_COMMAND != (KEY_MAX + 128)) +#error Something is wrong -- MAX_COMMAND is already inconsistently defined. +#endif +#else +#define MAX_COMMAND (KEY_MAX + 128) +#endif + +/* --------- prototypes for libmenu functions ----------------------------- */ + +extern NCURSES_EXPORT(ITEM**) menu_items(const MENU*); +extern NCURSES_EXPORT(ITEM*) current_item(const MENU*); +extern NCURSES_EXPORT(ITEM*) new_item(const char*, const char*); + +extern NCURSES_EXPORT(MENU*) new_menu(ITEM**); + +extern NCURSES_EXPORT(Item_Options) item_opts(const ITEM*); +extern NCURSES_EXPORT(Menu_Options) menu_opts(const MENU*); + +extern NCURSES_EXPORT(Menu_Hook) item_init(const MENU*); +extern NCURSES_EXPORT(Menu_Hook) item_term(const MENU*); +extern NCURSES_EXPORT(Menu_Hook) menu_init(const MENU*); +extern NCURSES_EXPORT(Menu_Hook) menu_term(const MENU*); + +extern NCURSES_EXPORT(WINDOW*) menu_sub(const MENU*); +extern NCURSES_EXPORT(WINDOW*) menu_win(const MENU*); + +extern NCURSES_EXPORT(const char*) item_description(const ITEM*); +extern NCURSES_EXPORT(const char*) item_name(const ITEM*); +extern NCURSES_EXPORT(const char*) menu_mark(const MENU*); +extern NCURSES_EXPORT(const char*) menu_request_name(int); + +extern NCURSES_EXPORT(char*) menu_pattern(const MENU*); + +extern NCURSES_EXPORT(void*) menu_userptr(const MENU*); +extern NCURSES_EXPORT(void*) item_userptr(const ITEM*); + +extern NCURSES_EXPORT(chtype) menu_back(const MENU*); +extern NCURSES_EXPORT(chtype) menu_fore(const MENU*); +extern NCURSES_EXPORT(chtype) menu_grey(const MENU*); + +extern NCURSES_EXPORT(int) free_item(ITEM*); +extern NCURSES_EXPORT(int) free_menu(MENU*); +extern NCURSES_EXPORT(int) item_count(const MENU*); +extern NCURSES_EXPORT(int) item_index(const ITEM*); +extern NCURSES_EXPORT(int) item_opts_off(ITEM*, Item_Options); +extern NCURSES_EXPORT(int) item_opts_on(ITEM*, Item_Options); +extern NCURSES_EXPORT(int) menu_driver(MENU*, int); +extern NCURSES_EXPORT(int) menu_opts_off(MENU*, Menu_Options); +extern NCURSES_EXPORT(int) menu_opts_on(MENU*, Menu_Options); +extern NCURSES_EXPORT(int) menu_pad(const MENU*); +extern NCURSES_EXPORT(int) pos_menu_cursor(const MENU*); +extern NCURSES_EXPORT(int) post_menu(MENU*); +extern NCURSES_EXPORT(int) scale_menu(const MENU*, int*, int*); +extern NCURSES_EXPORT(int) set_current_item(MENU* menu, ITEM* item); +extern NCURSES_EXPORT(int) set_item_init(MENU*, Menu_Hook); +extern NCURSES_EXPORT(int) set_item_opts(ITEM*, Item_Options); +extern NCURSES_EXPORT(int) set_item_term(MENU*, Menu_Hook); +extern NCURSES_EXPORT(int) set_item_userptr(ITEM*, void*); +extern NCURSES_EXPORT(int) set_item_value(ITEM*, bool); +extern NCURSES_EXPORT(int) set_menu_back(MENU*, chtype); +extern NCURSES_EXPORT(int) set_menu_fore(MENU*, chtype); +extern NCURSES_EXPORT(int) set_menu_format(MENU*, int, int); +extern NCURSES_EXPORT(int) set_menu_grey(MENU*, chtype); +extern NCURSES_EXPORT(int) set_menu_init(MENU*, Menu_Hook); +extern NCURSES_EXPORT(int) set_menu_items(MENU*, ITEM**); +extern NCURSES_EXPORT(int) set_menu_mark(MENU*, const char*); +extern NCURSES_EXPORT(int) set_menu_opts(MENU*, Menu_Options); +extern NCURSES_EXPORT(int) set_menu_pad(MENU*, int); +extern NCURSES_EXPORT(int) set_menu_pattern(MENU*, const char*); +extern NCURSES_EXPORT(int) set_menu_sub(MENU*, WINDOW*); +extern NCURSES_EXPORT(int) set_menu_term(MENU*, Menu_Hook); +extern NCURSES_EXPORT(int) set_menu_userptr(MENU*, void*); +extern NCURSES_EXPORT(int) set_menu_win(MENU*, WINDOW*); +extern NCURSES_EXPORT(int) set_top_row(MENU*, int); +extern NCURSES_EXPORT(int) top_row(const MENU*); +extern NCURSES_EXPORT(int) unpost_menu(MENU*); +extern NCURSES_EXPORT(int) menu_request_by_name(const char*); +extern NCURSES_EXPORT(int) set_menu_spacing(MENU*, int, int, int); +extern NCURSES_EXPORT(int) menu_spacing(const MENU*, int*, int*, int*); + +extern NCURSES_EXPORT(bool) item_value(const ITEM*); +extern NCURSES_EXPORT(bool) item_visible(const ITEM*); + +extern NCURSES_EXPORT(void) menu_format(const MENU*, int*, int*); + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(MENU*) NCURSES_SP_NAME(new_menu)(SCREEN*, ITEM**); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* ETI_MENU */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/mysqlStubs.h b/src_cpp/elfgames/tasks/elf2codingenv/include/mysqlStubs.h new file mode 100644 index 0000000..9089c9b --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/mysqlStubs.h @@ -0,0 +1,122 @@ +/* + *----------------------------------------------------------------------------- + * + * ../generic/mysqlStubs.h -- + * + * Stubs for procedures in mysqlStubDefs.txt + * + * Generated by genExtStubs.tcl: DO NOT EDIT + * 2017-05-26 05:57:32Z + * + *----------------------------------------------------------------------------- + */ + +typedef struct mysqlStubDefs { + /* Functions from libraries: mysqlclient_r mysqlclient mysql */ + + int(STDCALL* mysql_server_initPtr)(int, char**, char**); + void(STDCALL* mysql_server_endPtr)(void); + my_ulonglong(STDCALL* mysql_affected_rowsPtr)(MYSQL*); + my_bool(STDCALL* mysql_autocommitPtr)(MYSQL*, my_bool); + my_bool(STDCALL* mysql_change_userPtr)( + MYSQL*, + const char*, + const char*, + const char*); + my_bool(STDCALL* mysql_closePtr)(MYSQL*); + my_bool(STDCALL* mysql_commitPtr)(MYSQL*); + unsigned int(STDCALL* mysql_errnoPtr)(MYSQL*); + const char*(STDCALL* mysql_errorPtr)(MYSQL*); + MYSQL_FIELD*(STDCALL* mysql_fetch_fieldsPtr)(MYSQL_RES*); + unsigned long*(STDCALL* mysql_fetch_lengthsPtr)(MYSQL_RES*); + MYSQL_ROW(STDCALL* mysql_fetch_rowPtr)(MYSQL_RES*); + unsigned int(STDCALL* mysql_field_countPtr)(MYSQL*); + void(STDCALL* mysql_free_resultPtr)(MYSQL_RES*); + unsigned long(STDCALL* mysql_get_client_versionPtr)(void); + MYSQL*(STDCALL* mysql_initPtr)(MYSQL*); + MYSQL_RES*(STDCALL* mysql_list_fieldsPtr)(MYSQL*, const char*, const char*); + MYSQL_RES*(STDCALL* mysql_list_tablesPtr)(MYSQL*, const char*); + unsigned int(STDCALL* mysql_num_fieldsPtr)(MYSQL_RES*); + int(STDCALL* mysql_optionsPtr)(MYSQL*, enum mysql_option, const void*); + int(STDCALL* mysql_queryPtr)(MYSQL*, const char*); + MYSQL*(STDCALL* mysql_real_connectPtr)( + MYSQL*, + const char*, + const char*, + const char*, + const char*, + unsigned int, + const char*, + unsigned long); + my_bool(STDCALL* mysql_rollbackPtr)(MYSQL*); + int(STDCALL* mysql_select_dbPtr)(MYSQL*, const char*); + const char*(STDCALL* mysql_sqlstatePtr)(MYSQL*); + my_bool(STDCALL* mysql_ssl_setPtr)( + MYSQL*, + const char*, + const char*, + const char*, + const char*, + const char*); + my_ulonglong(STDCALL* mysql_stmt_affected_rowsPtr)(MYSQL_STMT*); + my_bool(STDCALL* mysql_stmt_bind_paramPtr)(MYSQL_STMT*, MYSQL_BIND*); + my_bool(STDCALL* mysql_stmt_bind_resultPtr)(MYSQL_STMT*, MYSQL_BIND*); + my_bool(STDCALL* mysql_stmt_closePtr)(MYSQL_STMT*); + unsigned int(STDCALL* mysql_stmt_errnoPtr)(MYSQL_STMT*); + const char*(STDCALL* mysql_stmt_errorPtr)(MYSQL_STMT*); + int(STDCALL* mysql_stmt_executePtr)(MYSQL_STMT*); + int(STDCALL* mysql_stmt_fetchPtr)(MYSQL_STMT*); + int(STDCALL* mysql_stmt_fetch_columnPtr)( + MYSQL_STMT*, + MYSQL_BIND*, + unsigned int, + unsigned long); + MYSQL_STMT*(STDCALL* mysql_stmt_initPtr)(MYSQL*); + int(STDCALL* mysql_stmt_preparePtr)(MYSQL_STMT*, const char*, unsigned long); + MYSQL_RES*(STDCALL* mysql_stmt_result_metadataPtr)(MYSQL_STMT*); + const char*(STDCALL* mysql_stmt_sqlstatePtr)(MYSQL_STMT*); + int(STDCALL* mysql_stmt_store_resultPtr)(MYSQL_STMT*); + MYSQL_RES*(STDCALL* mysql_store_resultPtr)(MYSQL*); +} mysqlStubDefs; +#define mysql_server_init (mysqlStubs->mysql_server_initPtr) +#define mysql_server_end (mysqlStubs->mysql_server_endPtr) +#define mysql_affected_rows (mysqlStubs->mysql_affected_rowsPtr) +#define mysql_autocommit (mysqlStubs->mysql_autocommitPtr) +#define mysql_change_user (mysqlStubs->mysql_change_userPtr) +#define mysql_close (mysqlStubs->mysql_closePtr) +#define mysql_commit (mysqlStubs->mysql_commitPtr) +#define mysql_errno (mysqlStubs->mysql_errnoPtr) +#define mysql_error (mysqlStubs->mysql_errorPtr) +#define mysql_fetch_fields (mysqlStubs->mysql_fetch_fieldsPtr) +#define mysql_fetch_lengths (mysqlStubs->mysql_fetch_lengthsPtr) +#define mysql_fetch_row (mysqlStubs->mysql_fetch_rowPtr) +#define mysql_field_count (mysqlStubs->mysql_field_countPtr) +#define mysql_free_result (mysqlStubs->mysql_free_resultPtr) +#define mysql_get_client_version (mysqlStubs->mysql_get_client_versionPtr) +#define mysql_init (mysqlStubs->mysql_initPtr) +#define mysql_list_fields (mysqlStubs->mysql_list_fieldsPtr) +#define mysql_list_tables (mysqlStubs->mysql_list_tablesPtr) +#define mysql_num_fields (mysqlStubs->mysql_num_fieldsPtr) +#define mysql_options (mysqlStubs->mysql_optionsPtr) +#define mysql_query (mysqlStubs->mysql_queryPtr) +#define mysql_real_connect (mysqlStubs->mysql_real_connectPtr) +#define mysql_rollback (mysqlStubs->mysql_rollbackPtr) +#define mysql_select_db (mysqlStubs->mysql_select_dbPtr) +#define mysql_sqlstate (mysqlStubs->mysql_sqlstatePtr) +#define mysql_ssl_set (mysqlStubs->mysql_ssl_setPtr) +#define mysql_stmt_affected_rows (mysqlStubs->mysql_stmt_affected_rowsPtr) +#define mysql_stmt_bind_param (mysqlStubs->mysql_stmt_bind_paramPtr) +#define mysql_stmt_bind_result (mysqlStubs->mysql_stmt_bind_resultPtr) +#define mysql_stmt_close (mysqlStubs->mysql_stmt_closePtr) +#define mysql_stmt_errno (mysqlStubs->mysql_stmt_errnoPtr) +#define mysql_stmt_error (mysqlStubs->mysql_stmt_errorPtr) +#define mysql_stmt_execute (mysqlStubs->mysql_stmt_executePtr) +#define mysql_stmt_fetch (mysqlStubs->mysql_stmt_fetchPtr) +#define mysql_stmt_fetch_column (mysqlStubs->mysql_stmt_fetch_columnPtr) +#define mysql_stmt_init (mysqlStubs->mysql_stmt_initPtr) +#define mysql_stmt_prepare (mysqlStubs->mysql_stmt_preparePtr) +#define mysql_stmt_result_metadata (mysqlStubs->mysql_stmt_result_metadataPtr) +#define mysql_stmt_sqlstate (mysqlStubs->mysql_stmt_sqlstatePtr) +#define mysql_stmt_store_result (mysqlStubs->mysql_stmt_store_resultPtr) +#define mysql_store_result (mysqlStubs->mysql_store_resultPtr) +MODULE_SCOPE const mysqlStubDefs* mysqlStubs; diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/nc_tparm.h b/src_cpp/elfgames/tasks/elf2codingenv/include/nc_tparm.h new file mode 100644 index 0000000..c3f414b --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/nc_tparm.h @@ -0,0 +1,120 @@ +/**************************************************************************** + * Copyright (c) 2006-2012,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Thomas E. Dickey 2006 * + ****************************************************************************/ + +/* $Id: nc_tparm.h,v 1.8 2017/07/22 17:09:46 tom Exp $ */ + +#ifndef NC_TPARM_included +#define NC_TPARM_included 1 + +#include +#include + +/* + * Cast parameters past the formatting-string for tparm() to match the + * assumption of the varargs code. + */ +#ifndef TPARM_ARG +#ifdef NCURSES_TPARM_ARG +#define TPARM_ARG NCURSES_TPARM_ARG +#else +#define TPARM_ARG long +#endif +#endif /* TPARAM_ARG */ + +#define TPARM_N(n) (TPARM_ARG)(n) + +#define TPARM_9(a, b, c, d, e, f, g, h, i, j) \ + tparm( \ + a, \ + TPARM_N(b), \ + TPARM_N(c), \ + TPARM_N(d), \ + TPARM_N(e), \ + TPARM_N(f), \ + TPARM_N(g), \ + TPARM_N(h), \ + TPARM_N(i), \ + TPARM_N(j)) + +#if NCURSES_TPARM_VARARGS +#define TPARM_8(a, b, c, d, e, f, g, h, i) \ + tparm( \ + a, \ + TPARM_N(b), \ + TPARM_N(c), \ + TPARM_N(d), \ + TPARM_N(e), \ + TPARM_N(f), \ + TPARM_N(g), \ + TPARM_N(h), \ + TPARM_N(i)) +#define TPARM_7(a, b, c, d, e, f, g, h) \ + tparm( \ + a, \ + TPARM_N(b), \ + TPARM_N(c), \ + TPARM_N(d), \ + TPARM_N(e), \ + TPARM_N(f), \ + TPARM_N(g), \ + TPARM_N(h)) +#define TPARM_6(a, b, c, d, e, f, g) \ + tparm( \ + a, \ + TPARM_N(b), \ + TPARM_N(c), \ + TPARM_N(d), \ + TPARM_N(e), \ + TPARM_N(f), \ + TPARM_N(g)) +#define TPARM_5(a, b, c, d, e, f) \ + tparm(a, TPARM_N(b), TPARM_N(c), TPARM_N(d), TPARM_N(e), TPARM_N(f)) +#define TPARM_4(a, b, c, d, e) \ + tparm(a, TPARM_N(b), TPARM_N(c), TPARM_N(d), TPARM_N(e)) +#define TPARM_3(a, b, c, d) tparm(a, TPARM_N(b), TPARM_N(c), TPARM_N(d)) +#define TPARM_2(a, b, c) tparm(a, TPARM_N(b), TPARM_N(c)) +#define TPARM_1(a, b) tparm(a, TPARM_N(b)) +#define TPARM_0(a) tparm(a) +#else +#define TPARM_8(a, b, c, d, e, f, g, h, i) TPARM_9(a, b, c, d, e, f, g, h, i, 0) +#define TPARM_7(a, b, c, d, e, f, g, h) TPARM_8(a, b, c, d, e, f, g, h, 0) +#define TPARM_6(a, b, c, d, e, f, g) TPARM_7(a, b, c, d, e, f, g, 0) +#define TPARM_5(a, b, c, d, e, f) TPARM_6(a, b, c, d, e, f, 0) +#define TPARM_4(a, b, c, d, e) TPARM_5(a, b, c, d, e, 0) +#define TPARM_3(a, b, c, d) TPARM_4(a, b, c, d, 0) +#define TPARM_2(a, b, c) TPARM_3(a, b, c, 0) +#define TPARM_1(a, b) TPARM_2(a, b, 0) +#define TPARM_1(a, b) TPARM_2(a, b, 0) +#define TPARM_0(a) TPARM_1(a, 0) +#endif + +#endif /* NC_TPARM_included */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses.h new file mode 100644 index 0000000..1512dc4 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses.h @@ -0,0 +1,2456 @@ +/**************************************************************************** + * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* $Id: curses.h.in,v 1.257 2017/11/21 00:11:37 tom Exp $ */ + +#ifndef __NCURSES_H +#define __NCURSES_H + +#define CURSES 1 +#define CURSES_H 1 + +/* These are defined only in curses.h, and are used for conditional compiles */ +#define NCURSES_VERSION_MAJOR 6 +#define NCURSES_VERSION_MINOR 1 +#define NCURSES_VERSION_PATCH 20180127 + +/* This is defined in more than one ncurses header, for identification */ +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.1" + +/* + * Identify the mouse encoding version. + */ +#define NCURSES_MOUSE_VERSION 2 + +/* + * Definitions to facilitate DLL's. + */ +#include + +#if 1 +#include +#endif + +/* + * User-definable tweak to disable the include of . + */ +#ifndef NCURSES_ENABLE_STDBOOL_H +#define NCURSES_ENABLE_STDBOOL_H 1 +#endif + +/* + * NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses + * configured using --disable-macros. + */ +#ifndef NCURSES_ATTR_T +#define NCURSES_ATTR_T int +#endif + +/* + * Expands to 'const' if ncurses is configured using --enable-const. Note that + * doing so makes it incompatible with other implementations of X/Open Curses. + */ +#undef NCURSES_CONST +#define NCURSES_CONST const + +#undef NCURSES_INLINE +#define NCURSES_INLINE inline + +/* + * The standard type used for color values, and for color-pairs. The latter + * allows the curses library to enumerate the combinations of foreground and + * background colors used by an application, and is normally the product of the + * total foreground and background colors. + * + * X/Open uses "short" for both of these types, ultimately because they are + * numbers from the SVr4 terminal database, which uses 16-bit signed values. + */ +#undef NCURSES_COLOR_T +#define NCURSES_COLOR_T short + +#undef NCURSES_PAIRS_T +#define NCURSES_PAIRS_T short + +/* + * Definitions used to make WINDOW and similar structs opaque. + */ +#ifndef NCURSES_INTERNALS +#define NCURSES_OPAQUE 0 +#define NCURSES_OPAQUE_FORM 0 +#define NCURSES_OPAQUE_MENU 0 +#define NCURSES_OPAQUE_PANEL 0 +#endif + +/* + * Definition used to optionally suppress wattr* macros to help with the + * transition from ncurses5 to ncurses6 by allowing the header files to + * be shared across development packages for ncursesw in both ABIs. + */ +#ifndef NCURSES_WATTR_MACROS +#define NCURSES_WATTR_MACROS 1 +#endif + +/* + * The reentrant code relies on the opaque setting, but adds features. + */ +#ifndef NCURSES_REENTRANT +#define NCURSES_REENTRANT 0 +#endif + +/* + * Control whether bindings for interop support are added. + */ +#undef NCURSES_INTEROP_FUNCS +#define NCURSES_INTEROP_FUNCS 1 + +/* + * The internal type used for window dimensions. + */ +#undef NCURSES_SIZE_T +#define NCURSES_SIZE_T short + +/* + * Control whether tparm() supports varargs or fixed-parameter list. + */ +#undef NCURSES_TPARM_VARARGS +#define NCURSES_TPARM_VARARGS 1 + +/* + * Control type used for tparm's arguments. While X/Open equates long and + * char* values, this is not always workable for 64-bit platforms. + */ +#undef NCURSES_TPARM_ARG +#define NCURSES_TPARM_ARG intptr_t + +/* + * Control whether ncurses uses wcwidth() for checking width of line-drawing + * characters. + */ +#undef NCURSES_WCWIDTH_GRAPHICS +#define NCURSES_WCWIDTH_GRAPHICS 1 + +/* + * NCURSES_CH_T is used in building the library, but not used otherwise in + * this header file, since that would make the normal/wide-character versions + * of the header incompatible. + */ +#undef NCURSES_CH_T +#define NCURSES_CH_T cchar_t + +#if 1 && defined(_LP64) +typedef unsigned chtype; +typedef unsigned mmask_t; +#else +typedef uint32_t chtype; +typedef uint32_t mmask_t; +#endif + +/* + * We need FILE, etc. Include this before checking any feature symbols. + */ +#include + +/* + * With XPG4, you must define _XOPEN_SOURCE_EXTENDED, it is redundant (or + * conflicting) when _XOPEN_SOURCE is 500 or greater. If NCURSES_WIDECHAR is + * not already defined, e.g., if the platform relies upon nonstandard feature + * test macros, define it at this point if the standard feature test macros + * indicate that it should be defined. + */ +#ifndef NCURSES_WIDECHAR +#if defined(_XOPEN_SOURCE_EXTENDED) || \ + (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 >= 500)) +#define NCURSES_WIDECHAR 1 +#else +#define NCURSES_WIDECHAR 0 +#endif +#endif /* NCURSES_WIDECHAR */ + +#include /* we need va_list */ +#if NCURSES_WIDECHAR +#include /* we want wchar_t */ +#endif + +/* X/Open and SVr4 specify that curses implements 'bool'. However, C++ may also + * implement it. If so, we must use the C++ compiler's type to avoid conflict + * with other interfaces. + * + * A further complication is that may declare 'bool' to be a + * different type, such as an enum which is not necessarily compatible with + * C++. If we have , make 'bool' a macro, so users may #undef it. + * Otherwise, let it remain a typedef to avoid conflicts with other #define's. + * In either case, make a typedef for NCURSES_BOOL which can be used if needed + * from either C or C++. + */ + +#undef TRUE +#define TRUE 1 + +#undef FALSE +#define FALSE 0 + +typedef unsigned char NCURSES_BOOL; + +#if defined(__cplusplus) /* __cplusplus, etc. */ + +/* use the C++ compiler's bool type */ +#define NCURSES_BOOL bool + +#else /* c89, c99, etc. */ + +#if NCURSES_ENABLE_STDBOOL_H +#include +/* use whatever the C compiler decides bool really is */ +#define NCURSES_BOOL bool +#else +/* there is no predefined bool - use our own */ +#undef bool +#define bool NCURSES_BOOL +#endif + +#endif /* !__cplusplus, etc. */ + +#ifdef __cplusplus +extern "C" { +#define NCURSES_CAST(type, value) static_cast(value) +#else +#define NCURSES_CAST(type, value) (type)(value) +#endif + +#define NCURSES_OK_ADDR(p) (0 != NCURSES_CAST(const void*, (p))) + +/* + * X/Open attributes. In the ncurses implementation, they are identical to the + * A_ attributes. + */ +#define WA_ATTRIBUTES A_ATTRIBUTES +#define WA_NORMAL A_NORMAL +#define WA_STANDOUT A_STANDOUT +#define WA_UNDERLINE A_UNDERLINE +#define WA_REVERSE A_REVERSE +#define WA_BLINK A_BLINK +#define WA_DIM A_DIM +#define WA_BOLD A_BOLD +#define WA_ALTCHARSET A_ALTCHARSET +#define WA_INVIS A_INVIS +#define WA_PROTECT A_PROTECT +#define WA_HORIZONTAL A_HORIZONTAL +#define WA_LEFT A_LEFT +#define WA_LOW A_LOW +#define WA_RIGHT A_RIGHT +#define WA_TOP A_TOP +#define WA_VERTICAL A_VERTICAL + +#if 1 +#define WA_ITALIC A_ITALIC /* ncurses extension */ +#endif + +/* colors */ +#define COLOR_BLACK 0 +#define COLOR_RED 1 +#define COLOR_GREEN 2 +#define COLOR_YELLOW 3 +#define COLOR_BLUE 4 +#define COLOR_MAGENTA 5 +#define COLOR_CYAN 6 +#define COLOR_WHITE 7 + +/* line graphics */ + +#if 0 || NCURSES_REENTRANT +NCURSES_WRAPPED_VAR(chtype*, acs_map); +#define acs_map NCURSES_PUBLIC_VAR(acs_map()) +#else +extern NCURSES_EXPORT_VAR(chtype) acs_map[]; +#endif + +#define NCURSES_ACS(c) (acs_map[NCURSES_CAST(unsigned char, (c))]) + +/* VT100 symbols begin here */ +#define ACS_ULCORNER NCURSES_ACS('l') /* upper left corner */ +#define ACS_LLCORNER NCURSES_ACS('m') /* lower left corner */ +#define ACS_URCORNER NCURSES_ACS('k') /* upper right corner */ +#define ACS_LRCORNER NCURSES_ACS('j') /* lower right corner */ +#define ACS_LTEE NCURSES_ACS('t') /* tee pointing right */ +#define ACS_RTEE NCURSES_ACS('u') /* tee pointing left */ +#define ACS_BTEE NCURSES_ACS('v') /* tee pointing up */ +#define ACS_TTEE NCURSES_ACS('w') /* tee pointing down */ +#define ACS_HLINE NCURSES_ACS('q') /* horizontal line */ +#define ACS_VLINE NCURSES_ACS('x') /* vertical line */ +#define ACS_PLUS NCURSES_ACS('n') /* large plus or crossover */ +#define ACS_S1 NCURSES_ACS('o') /* scan line 1 */ +#define ACS_S9 NCURSES_ACS('s') /* scan line 9 */ +#define ACS_DIAMOND NCURSES_ACS('`') /* diamond */ +#define ACS_CKBOARD NCURSES_ACS('a') /* checker board (stipple) */ +#define ACS_DEGREE NCURSES_ACS('f') /* degree symbol */ +#define ACS_PLMINUS NCURSES_ACS('g') /* plus/minus */ +#define ACS_BULLET NCURSES_ACS('~') /* bullet */ +/* Teletype 5410v1 symbols begin here */ +#define ACS_LARROW NCURSES_ACS(',') /* arrow pointing left */ +#define ACS_RARROW NCURSES_ACS('+') /* arrow pointing right */ +#define ACS_DARROW NCURSES_ACS('.') /* arrow pointing down */ +#define ACS_UARROW NCURSES_ACS('-') /* arrow pointing up */ +#define ACS_BOARD NCURSES_ACS('h') /* board of squares */ +#define ACS_LANTERN NCURSES_ACS('i') /* lantern symbol */ +#define ACS_BLOCK NCURSES_ACS('0') /* solid square block */ +/* + * These aren't documented, but a lot of System Vs have them anyway + * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings). + * The ACS_names may not match AT&T's, our source didn't know them. + */ +#define ACS_S3 NCURSES_ACS('p') /* scan line 3 */ +#define ACS_S7 NCURSES_ACS('r') /* scan line 7 */ +#define ACS_LEQUAL NCURSES_ACS('y') /* less/equal */ +#define ACS_GEQUAL NCURSES_ACS('z') /* greater/equal */ +#define ACS_PI NCURSES_ACS('{') /* Pi */ +#define ACS_NEQUAL NCURSES_ACS('|') /* not equal */ +#define ACS_STERLING NCURSES_ACS('}') /* UK pound sign */ + +/* + * Line drawing ACS names are of the form ACS_trbl, where t is the top, r + * is the right, b is the bottom, and l is the left. t, r, b, and l might + * be B (blank), S (single), D (double), or T (thick). The subset defined + * here only uses B and S. + */ +#define ACS_BSSB ACS_ULCORNER +#define ACS_SSBB ACS_LLCORNER +#define ACS_BBSS ACS_URCORNER +#define ACS_SBBS ACS_LRCORNER +#define ACS_SBSS ACS_RTEE +#define ACS_SSSB ACS_LTEE +#define ACS_SSBS ACS_BTEE +#define ACS_BSSS ACS_TTEE +#define ACS_BSBS ACS_HLINE +#define ACS_SBSB ACS_VLINE +#define ACS_SSSS ACS_PLUS + +#undef ERR +#define ERR (-1) + +#undef OK +#define OK (0) + +/* values for the _flags member */ +#define _SUBWIN 0x01 /* is this a sub-window? */ +#define _ENDLINE 0x02 /* is the window flush right? */ +#define _FULLWIN 0x04 /* is the window full-screen? */ +#define _SCROLLWIN 0x08 /* bottom edge is at screen bottom? */ +#define _ISPAD 0x10 /* is this window a pad? */ +#define _HASMOVED 0x20 /* has cursor moved since last refresh? */ +#define _WRAPPED 0x40 /* cursor was just wrappped */ + +/* + * this value is used in the firstchar and lastchar fields to mark + * unchanged lines + */ +#define _NOCHANGE -1 + +/* + * this value is used in the oldindex field to mark lines created by insertions + * and scrolls. + */ +#define _NEWINDEX -1 + +typedef struct screen SCREEN; +typedef struct _win_st WINDOW; + +typedef chtype attr_t; /* ...must be at least as wide as chtype */ + +#if NCURSES_WIDECHAR + +#if 0 +#ifdef mblen /* libutf8.h defines it w/o undefining first */ +#undef mblen +#endif +#include +#endif + +#if 1 +#include /* ...to get mbstate_t, etc. */ +#endif + +#if 0 +typedef unsigned short wchar_t1; +#endif + +#if 0 +typedef unsigned int wint_t1; +#endif + +/* + * cchar_t stores an array of CCHARW_MAX wide characters. The first is + * normally a spacing character. The others are non-spacing. If those + * (spacing and nonspacing) do not fill the array, a null L'\0' follows. + * Otherwise, a null is assumed to follow when extracting via getcchar(). + */ +#define CCHARW_MAX 5 +typedef struct { + attr_t attr; + wchar_t chars[CCHARW_MAX]; +#if 1 +#undef NCURSES_EXT_COLORS +#define NCURSES_EXT_COLORS 20180127 + int ext_color; /* color pair, must be more than 16-bits */ +#endif +} cchar_t; + +#endif /* NCURSES_WIDECHAR */ + +#if !NCURSES_OPAQUE +struct ldat; + +struct _win_st { + NCURSES_SIZE_T _cury, _curx; /* current cursor position */ + + /* window location and size */ + NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */ + NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */ + + short _flags; /* window state flags */ + + /* attribute tracking */ + attr_t _attrs; /* current attribute for non-space character */ + chtype _bkgd; /* current background char/attribute pair */ + + /* option values set by user */ + bool _notimeout; /* no time out on function-key entry? */ + bool _clear; /* consider all data in the window invalid? */ + bool _leaveok; /* OK to not reset cursor on exit? */ + bool _scroll; /* OK to scroll this window? */ + bool _idlok; /* OK to use insert/delete line? */ + bool _idcok; /* OK to use insert/delete char? */ + bool _immed; /* window in immed mode? (not yet used) */ + bool _sync; /* window in sync mode? */ + bool _use_keypad; /* process function keys into KEY_ symbols? */ + int _delay; /* 0 = nodelay, <0 = blocking, >0 = delay */ + + struct ldat* _line; /* the actual line data */ + + /* global screen state */ + NCURSES_SIZE_T _regtop; /* top line of scrolling region */ + NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */ + + /* these are used only if this is a sub-window */ + int _parx; /* x coordinate of this window in parent */ + int _pary; /* y coordinate of this window in parent */ + WINDOW* _parent; /* pointer to parent if a sub-window */ + + /* these are used only if this is a pad */ + struct pdat { + NCURSES_SIZE_T _pad_y, _pad_x; + NCURSES_SIZE_T _pad_top, _pad_left; + NCURSES_SIZE_T _pad_bottom, _pad_right; + } _pad; + + NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */ + +#if NCURSES_WIDECHAR + cchar_t _bkgrnd; /* current background char/attribute pair */ +#if 1 + int _color; /* current color-pair for non-space character */ +#endif +#endif +}; +#endif /* NCURSES_OPAQUE */ + +/* + * This is an extension to support events... + */ +#if 1 +#ifdef NCURSES_WGETCH_EVENTS +#if !defined(__BEOS__) || defined(__HAIKU__) +/* Fix _nc_timed_wait() on BEOS... */ +#define NCURSES_EVENT_VERSION 1 +#endif /* !defined(__BEOS__) */ + +/* + * Bits to set in _nc_event.data.flags + */ +#define _NC_EVENT_TIMEOUT_MSEC 1 +#define _NC_EVENT_FILE 2 +#define _NC_EVENT_FILE_READABLE 2 +#if 0 /* Not supported yet... */ +#define _NC_EVENT_FILE_WRITABLE 4 +#define _NC_EVENT_FILE_EXCEPTION 8 +#endif + +typedef struct { + int type; + union { + long timeout_msec; /* _NC_EVENT_TIMEOUT_MSEC */ + struct { + unsigned int flags; + int fd; + unsigned int result; + } fev; /* _NC_EVENT_FILE */ + } data; +} _nc_event; + +typedef struct { + int count; + int result_flags; /* _NC_EVENT_TIMEOUT_MSEC or _NC_EVENT_FILE_READABLE */ + _nc_event* events[1]; +} _nc_eventlist; + +extern NCURSES_EXPORT(int) + wgetch_events(WINDOW*, _nc_eventlist*); /* experimental */ +extern NCURSES_EXPORT(int) + wgetnstr_events(WINDOW*, char*, int, _nc_eventlist*); /* experimental */ + +#endif /* NCURSES_WGETCH_EVENTS */ +#endif /* NCURSES_EXT_FUNCS */ + +/* + * GCC (and some other compilers) define '__attribute__'; we're using this + * macro to alert the compiler to flag inconsistencies in printf/scanf-like + * function calls. Just in case '__attribute__' isn't defined, make a dummy. + * Old versions of G++ do not accept it anyway, at least not consistently with + * GCC. + */ +#if !(defined(__GNUC__) || defined(__GNUG__) || defined(__attribute__)) +#define __attribute__(p) /* nothing */ +#endif + +/* + * We cannot define these in ncurses_cfg.h, since they require parameters to be + * passed (that is non-portable). If you happen to be using gcc with warnings + * enabled, define + * GCC_PRINTF + * GCC_SCANF + * to improve checking of calls to printw(), etc. + */ +#ifndef GCC_PRINTFLIKE +#if defined(GCC_PRINTF) && !defined(printf) +#define GCC_PRINTFLIKE(fmt, var) __attribute__((format(printf, fmt, var))) +#else +#define GCC_PRINTFLIKE(fmt, var) /*nothing*/ +#endif +#endif + +#ifndef GCC_SCANFLIKE +#if defined(GCC_SCANF) && !defined(scanf) +#define GCC_SCANFLIKE(fmt, var) __attribute__((format(scanf, fmt, var))) +#else +#define GCC_SCANFLIKE(fmt, var) /*nothing*/ +#endif +#endif + +#ifndef GCC_NORETURN +#define GCC_NORETURN /* nothing */ +#endif + +#ifndef GCC_UNUSED +#define GCC_UNUSED /* nothing */ +#endif + +/* + * Curses uses a helper function. Define our type for this to simplify + * extending it for the sp-funcs feature. + */ +typedef int (*NCURSES_OUTC)(int); + +/* + * Function prototypes. This is the complete X/Open Curses list of required + * functions. Those marked `generated' will have sources generated from the + * macro definitions later in this file, in order to satisfy XPG4.2 + * requirements. + */ + +extern NCURSES_EXPORT(int) addch(const chtype); /* generated */ +extern NCURSES_EXPORT(int) addchnstr(const chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) addchstr(const chtype*); /* generated */ +extern NCURSES_EXPORT(int) addnstr(const char*, int); /* generated */ +extern NCURSES_EXPORT(int) addstr(const char*); /* generated */ +extern NCURSES_EXPORT(int) attroff(NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attron(NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attrset(NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) + attr_get(attr_t*, NCURSES_PAIRS_T*, void*); /* generated */ +extern NCURSES_EXPORT(int) attr_off(attr_t, void*); /* generated */ +extern NCURSES_EXPORT(int) attr_on(attr_t, void*); /* generated */ +extern NCURSES_EXPORT(int) + attr_set(attr_t, NCURSES_PAIRS_T, void*); /* generated */ +extern NCURSES_EXPORT(int) baudrate(void); /* implemented */ +extern NCURSES_EXPORT(int) beep(void); /* implemented */ +extern NCURSES_EXPORT(int) bkgd(chtype); /* generated */ +extern NCURSES_EXPORT(void) bkgdset(chtype); /* generated */ +extern NCURSES_EXPORT(int) border( + chtype, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype); /* generated */ +extern NCURSES_EXPORT(int) box(WINDOW*, chtype, chtype); /* generated */ +extern NCURSES_EXPORT(bool) can_change_color(void); /* implemented */ +extern NCURSES_EXPORT(int) cbreak(void); /* implemented */ +extern NCURSES_EXPORT(int) + chgat(int, attr_t, NCURSES_PAIRS_T, const void*); /* generated */ +extern NCURSES_EXPORT(int) clear(void); /* generated */ +extern NCURSES_EXPORT(int) clearok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) clrtobot(void); /* generated */ +extern NCURSES_EXPORT(int) clrtoeol(void); /* generated */ +extern NCURSES_EXPORT(int) color_content( + NCURSES_COLOR_T, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*); /* implemented */ +extern NCURSES_EXPORT(int) color_set(NCURSES_PAIRS_T, void*); /* generated */ +extern NCURSES_EXPORT(int) COLOR_PAIR(int); /* generated */ +extern NCURSES_EXPORT(int) copywin( + const WINDOW*, + WINDOW*, + int, + int, + int, + int, + int, + int, + int); /* implemented */ +extern NCURSES_EXPORT(int) curs_set(int); /* implemented */ +extern NCURSES_EXPORT(int) def_prog_mode(void); /* implemented */ +extern NCURSES_EXPORT(int) def_shell_mode(void); /* implemented */ +extern NCURSES_EXPORT(int) delay_output(int); /* implemented */ +extern NCURSES_EXPORT(int) delch(void); /* generated */ +extern NCURSES_EXPORT(void) delscreen(SCREEN*); /* implemented */ +extern NCURSES_EXPORT(int) delwin(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) deleteln(void); /* generated */ +extern NCURSES_EXPORT(WINDOW*) + derwin(WINDOW*, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) doupdate(void); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) dupwin(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) echo(void); /* implemented */ +extern NCURSES_EXPORT(int) echochar(const chtype); /* generated */ +extern NCURSES_EXPORT(int) erase(void); /* generated */ +extern NCURSES_EXPORT(int) endwin(void); /* implemented */ +extern NCURSES_EXPORT(char) erasechar(void); /* implemented */ +extern NCURSES_EXPORT(void) filter(void); /* implemented */ +extern NCURSES_EXPORT(int) flash(void); /* implemented */ +extern NCURSES_EXPORT(int) flushinp(void); /* implemented */ +extern NCURSES_EXPORT(chtype) getbkgd(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getch(void); /* generated */ +extern NCURSES_EXPORT(int) getnstr(char*, int); /* generated */ +extern NCURSES_EXPORT(int) getstr(char*); /* generated */ +extern NCURSES_EXPORT(WINDOW*) getwin(FILE*); /* implemented */ +extern NCURSES_EXPORT(int) halfdelay(int); /* implemented */ +extern NCURSES_EXPORT(bool) has_colors(void); /* implemented */ +extern NCURSES_EXPORT(bool) has_ic(void); /* implemented */ +extern NCURSES_EXPORT(bool) has_il(void); /* implemented */ +extern NCURSES_EXPORT(int) hline(chtype, int); /* generated */ +extern NCURSES_EXPORT(void) idcok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) idlok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(void) immedok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) inch(void); /* generated */ +extern NCURSES_EXPORT(int) inchnstr(chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) inchstr(chtype*); /* generated */ +extern NCURSES_EXPORT(WINDOW*) initscr(void); /* implemented */ +extern NCURSES_EXPORT(int) init_color( + NCURSES_COLOR_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T); /* implemented */ +extern NCURSES_EXPORT(int) init_pair( + NCURSES_PAIRS_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T); /* implemented */ +extern NCURSES_EXPORT(int) innstr(char*, int); /* generated */ +extern NCURSES_EXPORT(int) insch(chtype); /* generated */ +extern NCURSES_EXPORT(int) insdelln(int); /* generated */ +extern NCURSES_EXPORT(int) insertln(void); /* generated */ +extern NCURSES_EXPORT(int) insnstr(const char*, int); /* generated */ +extern NCURSES_EXPORT(int) insstr(const char*); /* generated */ +extern NCURSES_EXPORT(int) instr(char*); /* generated */ +extern NCURSES_EXPORT(int) intrflush(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(bool) isendwin(void); /* implemented */ +extern NCURSES_EXPORT(bool) is_linetouched(WINDOW*, int); /* implemented */ +extern NCURSES_EXPORT(bool) is_wintouched(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(NCURSES_CONST char*) keyname(int); /* implemented */ +extern NCURSES_EXPORT(int) keypad(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(char) killchar(void); /* implemented */ +extern NCURSES_EXPORT(int) leaveok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(char*) longname(void); /* implemented */ +extern NCURSES_EXPORT(int) meta(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) move(int, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddch(int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) + mvaddchnstr(int, int, const chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddchstr(int, int, const chtype*); /* generated */ +extern NCURSES_EXPORT(int) + mvaddnstr(int, int, const char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddstr(int, int, const char*); /* generated */ +extern NCURSES_EXPORT(int) + mvchgat(int, int, int, attr_t, NCURSES_PAIRS_T, const void*); /* generated + */ +extern NCURSES_EXPORT(int) mvcur(int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) mvdelch(int, int); /* generated */ +extern NCURSES_EXPORT(int) mvderwin(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(int) mvgetch(int, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetnstr(int, int, char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetstr(int, int, char*); /* generated */ +extern NCURSES_EXPORT(int) mvhline(int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(chtype) mvinch(int, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchnstr(int, int, chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchstr(int, int, chtype*); /* generated */ +extern NCURSES_EXPORT(int) mvinnstr(int, int, char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsch(int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) + mvinsnstr(int, int, const char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsstr(int, int, const char*); /* generated */ +extern NCURSES_EXPORT(int) mvinstr(int, int, char*); /* generated */ +extern NCURSES_EXPORT(int) + mvprintw(int, int, const char*, ...) /* implemented */ + GCC_PRINTFLIKE(3, 4); +extern NCURSES_EXPORT(int) + mvscanw(int, int, NCURSES_CONST char*, ...) /* implemented */ + GCC_SCANFLIKE(3, 4); +extern NCURSES_EXPORT(int) mvvline(int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddch(WINDOW*, int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddchnstr(WINDOW*, int, int, const chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddchstr(WINDOW*, int, int, const chtype*); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddnstr(WINDOW*, int, int, const char*, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddstr(WINDOW*, int, int, const char*); /* generated */ +extern NCURSES_EXPORT(int) mvwchgat( + WINDOW*, + int, + int, + int, + attr_t, + NCURSES_PAIRS_T, + const void*); /* generated */ +extern NCURSES_EXPORT(int) mvwdelch(WINDOW*, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetch(WINDOW*, int, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwgetnstr(WINDOW*, int, int, char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetstr(WINDOW*, int, int, char*); /* generated */ +extern NCURSES_EXPORT(int) + mvwhline(WINDOW*, int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvwin(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(chtype) mvwinch(WINDOW*, int, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwinchnstr(WINDOW*, int, int, chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwinchstr(WINDOW*, int, int, chtype*); /* generated */ +extern NCURSES_EXPORT(int) + mvwinnstr(WINDOW*, int, int, char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinsch(WINDOW*, int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) + mvwinsnstr(WINDOW*, int, int, const char*, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwinsstr(WINDOW*, int, int, const char*); /* generated */ +extern NCURSES_EXPORT(int) mvwinstr(WINDOW*, int, int, char*); /* generated */ +extern NCURSES_EXPORT(int) + mvwprintw(WINDOW*, int, int, const char*, ...) /* implemented */ + GCC_PRINTFLIKE(4, 5); +extern NCURSES_EXPORT(int) + mvwscanw(WINDOW*, int, int, NCURSES_CONST char*, ...) /* implemented */ + GCC_SCANFLIKE(4, 5); +extern NCURSES_EXPORT(int) + mvwvline(WINDOW*, int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) napms(int); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) newpad(int, int); /* implemented */ +extern NCURSES_EXPORT(SCREEN*) + newterm(NCURSES_CONST char*, FILE*, FILE*); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) newwin(int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) nl(void); /* implemented */ +extern NCURSES_EXPORT(int) nocbreak(void); /* implemented */ +extern NCURSES_EXPORT(int) nodelay(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) noecho(void); /* implemented */ +extern NCURSES_EXPORT(int) nonl(void); /* implemented */ +extern NCURSES_EXPORT(void) noqiflush(void); /* implemented */ +extern NCURSES_EXPORT(int) noraw(void); /* implemented */ +extern NCURSES_EXPORT(int) notimeout(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) overlay(const WINDOW*, WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) overwrite(const WINDOW*, WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) pair_content( + NCURSES_PAIRS_T, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*); /* implemented */ +extern NCURSES_EXPORT(int) PAIR_NUMBER(int); /* generated */ +extern NCURSES_EXPORT(int) pechochar(WINDOW*, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) + pnoutrefresh(WINDOW*, int, int, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) + prefresh(WINDOW*, int, int, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) printw(const char*, ...) /* implemented */ + GCC_PRINTFLIKE(1, 2); +extern NCURSES_EXPORT(int) putwin(WINDOW*, FILE*); /* implemented */ +extern NCURSES_EXPORT(void) qiflush(void); /* implemented */ +extern NCURSES_EXPORT(int) raw(void); /* implemented */ +extern NCURSES_EXPORT(int) redrawwin(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) refresh(void); /* generated */ +extern NCURSES_EXPORT(int) resetty(void); /* implemented */ +extern NCURSES_EXPORT(int) reset_prog_mode(void); /* implemented */ +extern NCURSES_EXPORT(int) reset_shell_mode(void); /* implemented */ +extern NCURSES_EXPORT(int) + ripoffline(int, int (*)(WINDOW*, int)); /* implemented */ +extern NCURSES_EXPORT(int) savetty(void); /* implemented */ +extern NCURSES_EXPORT(int) scanw(NCURSES_CONST char*, ...) /* implemented */ + GCC_SCANFLIKE(1, 2); +extern NCURSES_EXPORT(int) scr_dump(const char*); /* implemented */ +extern NCURSES_EXPORT(int) scr_init(const char*); /* implemented */ +extern NCURSES_EXPORT(int) scrl(int); /* generated */ +extern NCURSES_EXPORT(int) scroll(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) scrollok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) scr_restore(const char*); /* implemented */ +extern NCURSES_EXPORT(int) scr_set(const char*); /* implemented */ +extern NCURSES_EXPORT(int) setscrreg(int, int); /* generated */ +extern NCURSES_EXPORT(SCREEN*) set_term(SCREEN*); /* implemented */ +extern NCURSES_EXPORT(int) slk_attroff(const chtype); /* implemented */ +extern NCURSES_EXPORT(int) + slk_attr_off(const attr_t, void*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attron(const chtype); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_on(attr_t, void*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attrset(const chtype); /* implemented */ +extern NCURSES_EXPORT(attr_t) slk_attr(void); /* implemented */ +extern NCURSES_EXPORT(int) + slk_attr_set(const attr_t, NCURSES_PAIRS_T, void*); /* implemented */ +extern NCURSES_EXPORT(int) slk_clear(void); /* implemented */ +extern NCURSES_EXPORT(int) slk_color(NCURSES_PAIRS_T); /* implemented */ +extern NCURSES_EXPORT(int) slk_init(int); /* implemented */ +extern NCURSES_EXPORT(char*) slk_label(int); /* implemented */ +extern NCURSES_EXPORT(int) slk_noutrefresh(void); /* implemented */ +extern NCURSES_EXPORT(int) slk_refresh(void); /* implemented */ +extern NCURSES_EXPORT(int) slk_restore(void); /* implemented */ +extern NCURSES_EXPORT(int) slk_set(int, const char*, int); /* implemented */ +extern NCURSES_EXPORT(int) slk_touch(void); /* implemented */ +extern NCURSES_EXPORT(int) standout(void); /* generated */ +extern NCURSES_EXPORT(int) standend(void); /* generated */ +extern NCURSES_EXPORT(int) start_color(void); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) + subpad(WINDOW*, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) + subwin(WINDOW*, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) syncok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) termattrs(void); /* implemented */ +extern NCURSES_EXPORT(char*) termname(void); /* implemented */ +extern NCURSES_EXPORT(void) timeout(int); /* generated */ +extern NCURSES_EXPORT(int) touchline(WINDOW*, int, int); /* generated */ +extern NCURSES_EXPORT(int) touchwin(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) typeahead(int); /* implemented */ +extern NCURSES_EXPORT(int) ungetch(int); /* implemented */ +extern NCURSES_EXPORT(int) untouchwin(WINDOW*); /* generated */ +extern NCURSES_EXPORT(void) use_env(bool); /* implemented */ +extern NCURSES_EXPORT(void) use_tioctl(bool); /* implemented */ +extern NCURSES_EXPORT(int) vidattr(chtype); /* implemented */ +extern NCURSES_EXPORT(int) vidputs(chtype, NCURSES_OUTC); /* implemented */ +extern NCURSES_EXPORT(int) vline(chtype, int); /* generated */ +extern NCURSES_EXPORT(int) + vwprintw(WINDOW*, const char*, va_list); /* implemented */ +extern NCURSES_EXPORT(int) + vw_printw(WINDOW*, const char*, va_list); /* generated */ +extern NCURSES_EXPORT(int) + vwscanw(WINDOW*, NCURSES_CONST char*, va_list); /* implemented */ +extern NCURSES_EXPORT(int) + vw_scanw(WINDOW*, NCURSES_CONST char*, va_list); /* generated */ +extern NCURSES_EXPORT(int) waddch(WINDOW*, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) + waddchnstr(WINDOW*, const chtype*, int); /* implemented */ +extern NCURSES_EXPORT(int) waddchstr(WINDOW*, const chtype*); /* generated */ +extern NCURSES_EXPORT(int) + waddnstr(WINDOW*, const char*, int); /* implemented */ +extern NCURSES_EXPORT(int) waddstr(WINDOW*, const char*); /* generated */ +extern NCURSES_EXPORT(int) wattron(WINDOW*, int); /* generated */ +extern NCURSES_EXPORT(int) wattroff(WINDOW*, int); /* generated */ +extern NCURSES_EXPORT(int) wattrset(WINDOW*, int); /* generated */ +extern NCURSES_EXPORT(int) + wattr_get(WINDOW*, attr_t*, NCURSES_PAIRS_T*, void*); /* generated */ +extern NCURSES_EXPORT(int) wattr_on(WINDOW*, attr_t, void*); /* implemented */ +extern NCURSES_EXPORT(int) wattr_off(WINDOW*, attr_t, void*); /* implemented */ +extern NCURSES_EXPORT(int) + wattr_set(WINDOW*, attr_t, NCURSES_PAIRS_T, void*); /* generated */ +extern NCURSES_EXPORT(int) wbkgd(WINDOW*, chtype); /* implemented */ +extern NCURSES_EXPORT(void) wbkgdset(WINDOW*, chtype); /* implemented */ +extern NCURSES_EXPORT(int) wborder( + WINDOW*, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype); /* implemented */ +extern NCURSES_EXPORT(int) wchgat( + WINDOW*, + int, + attr_t, + NCURSES_PAIRS_T, + const void*); /* implemented */ +extern NCURSES_EXPORT(int) wclear(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wclrtobot(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wclrtoeol(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) + wcolor_set(WINDOW*, NCURSES_PAIRS_T, void*); /* implemented */ +extern NCURSES_EXPORT(void) wcursyncup(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wdelch(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wdeleteln(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) wechochar(WINDOW*, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) werase(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wgetch(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wgetnstr(WINDOW*, char*, int); /* implemented */ +extern NCURSES_EXPORT(int) wgetstr(WINDOW*, char*); /* generated */ +extern NCURSES_EXPORT(int) whline(WINDOW*, chtype, int); /* implemented */ +extern NCURSES_EXPORT(chtype) winch(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) winchnstr(WINDOW*, chtype*, int); /* implemented */ +extern NCURSES_EXPORT(int) winchstr(WINDOW*, chtype*); /* generated */ +extern NCURSES_EXPORT(int) winnstr(WINDOW*, char*, int); /* implemented */ +extern NCURSES_EXPORT(int) winsch(WINDOW*, chtype); /* implemented */ +extern NCURSES_EXPORT(int) winsdelln(WINDOW*, int); /* implemented */ +extern NCURSES_EXPORT(int) winsertln(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) + winsnstr(WINDOW*, const char*, int); /* implemented */ +extern NCURSES_EXPORT(int) winsstr(WINDOW*, const char*); /* generated */ +extern NCURSES_EXPORT(int) winstr(WINDOW*, char*); /* generated */ +extern NCURSES_EXPORT(int) wmove(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(int) wnoutrefresh(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wprintw(WINDOW*, const char*, ...) /* implemented */ + GCC_PRINTFLIKE(2, 3); +extern NCURSES_EXPORT(int) wredrawln(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(int) wrefresh(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) + wscanw(WINDOW*, NCURSES_CONST char*, ...) /* implemented */ + GCC_SCANFLIKE(2, 3); +extern NCURSES_EXPORT(int) wscrl(WINDOW*, int); /* implemented */ +extern NCURSES_EXPORT(int) wsetscrreg(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(int) wstandout(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) wstandend(WINDOW*); /* generated */ +extern NCURSES_EXPORT(void) wsyncdown(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(void) wsyncup(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(void) wtimeout(WINDOW*, int); /* implemented */ +extern NCURSES_EXPORT(int) wtouchln(WINDOW*, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) wvline(WINDOW*, chtype, int); /* implemented */ + +/* + * These are also declared in : + */ +extern NCURSES_EXPORT(int) tigetflag(NCURSES_CONST char*); /* implemented */ +extern NCURSES_EXPORT(int) tigetnum(NCURSES_CONST char*); /* implemented */ +extern NCURSES_EXPORT(char*) tigetstr(NCURSES_CONST char*); /* implemented */ +extern NCURSES_EXPORT(int) putp(const char*); /* implemented */ + +#if NCURSES_TPARM_VARARGS +extern NCURSES_EXPORT(char*) tparm(NCURSES_CONST char*, ...); /* special */ +#else +extern NCURSES_EXPORT(char*) tparm( + NCURSES_CONST char*, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG); /* special */ +extern NCURSES_EXPORT(char*) + tparm_varargs(NCURSES_CONST char*, ...); /* special */ +#endif + +extern NCURSES_EXPORT(char*) tiparm(const char*, ...); /* special */ + +/* + * X/Open says this returns a bool; SVr4 also checked for out-of-range line. + * The macro provides compatibility: + */ +#define is_linetouched(w, l) \ + ((!(w) || ((l) > getmaxy(w)) || ((l) < 0)) ? ERR : (is_linetouched)((w), (l))) + +/* + * These functions are not in X/Open, but we use them in macro definitions: + */ +extern NCURSES_EXPORT(int) getattrs(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getcurx(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getcury(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getbegx(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getbegy(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getmaxx(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getmaxy(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getparx(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getpary(const WINDOW*); /* generated */ + +/* + * vid_attr() was implemented originally based on a draft of X/Open curses. + */ +#if !NCURSES_WIDECHAR +#define vid_attr(a, pair, opts) vidattr(a) +#endif + +/* + * These functions are extensions - not in X/Open Curses. + */ +#if 1 +#undef NCURSES_EXT_FUNCS +#define NCURSES_EXT_FUNCS 20180127 +typedef int (*NCURSES_WINDOW_CB)(WINDOW*, void*); +typedef int (*NCURSES_SCREEN_CB)(SCREEN*, void*); +extern NCURSES_EXPORT(bool) is_term_resized(int, int); +extern NCURSES_EXPORT(char*) keybound(int, int); +extern NCURSES_EXPORT(const char*) curses_version(void); +extern NCURSES_EXPORT(int) alloc_pair(int, int); +extern NCURSES_EXPORT(int) assume_default_colors(int, int); +extern NCURSES_EXPORT(int) define_key(const char*, int); +extern NCURSES_EXPORT(int) extended_color_content(int, int*, int*, int*); +extern NCURSES_EXPORT(int) extended_pair_content(int, int*, int*); +extern NCURSES_EXPORT(int) extended_slk_color(int); +extern NCURSES_EXPORT(int) find_pair(int, int); +extern NCURSES_EXPORT(int) free_pair(int); +extern NCURSES_EXPORT(int) get_escdelay(void); +extern NCURSES_EXPORT(int) init_extended_color(int, int, int, int); +extern NCURSES_EXPORT(int) init_extended_pair(int, int, int); +extern NCURSES_EXPORT(int) key_defined(const char*); +extern NCURSES_EXPORT(int) keyok(int, bool); +extern NCURSES_EXPORT(void) reset_color_pairs(void); +extern NCURSES_EXPORT(int) resize_term(int, int); +extern NCURSES_EXPORT(int) resizeterm(int, int); +extern NCURSES_EXPORT(int) set_escdelay(int); +extern NCURSES_EXPORT(int) set_tabsize(int); +extern NCURSES_EXPORT(int) use_default_colors(void); +extern NCURSES_EXPORT(int) use_extended_names(bool); +extern NCURSES_EXPORT(int) use_legacy_coding(int); +extern NCURSES_EXPORT(int) use_screen(SCREEN*, NCURSES_SCREEN_CB, void*); +extern NCURSES_EXPORT(int) use_window(WINDOW*, NCURSES_WINDOW_CB, void*); +extern NCURSES_EXPORT(int) wresize(WINDOW*, int, int); +extern NCURSES_EXPORT(void) nofilter(void); + +/* + * These extensions provide access to information stored in the WINDOW even + * when NCURSES_OPAQUE is set: + */ +extern NCURSES_EXPORT(WINDOW*) wgetparent(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_cleared(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_idcok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_idlok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_immedok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_keypad(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_leaveok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_nodelay(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_notimeout(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_pad(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_scrollok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_subwin(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_syncok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) wgetdelay(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) + wgetscrreg(const WINDOW*, int*, int*); /* generated */ + +#else +#define curses_version() NCURSES_VERSION +#endif + +/* + * Extra extension-functions, which pass a SCREEN pointer rather than using + * a global variable SP. + */ +#if 1 +#undef NCURSES_SP_FUNCS +#define NCURSES_SP_FUNCS 20180127 +#define NCURSES_SP_NAME(name) name##_sp + +/* Define the sp-funcs helper function */ +#define NCURSES_SP_OUTC NCURSES_SP_NAME(NCURSES_OUTC) +typedef int (*NCURSES_SP_OUTC)(SCREEN*, int); + +extern NCURSES_EXPORT(SCREEN*) new_prescr(void); /* implemented:SP_FUNC */ + +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(baudrate)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(beep)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(can_change_color)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(cbreak)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(curs_set)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(color_content)( + SCREEN*, + NCURSES_PAIRS_T, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(def_prog_mode)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(def_shell_mode)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(delay_output)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(doupdate)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(echo)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(endwin)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char) + NCURSES_SP_NAME(erasechar)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(filter)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(flash)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(flushinp)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW*) + NCURSES_SP_NAME(getwin)(SCREEN*, FILE*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(halfdelay)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(has_colors)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(has_ic)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(has_il)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_color)( + SCREEN*, + NCURSES_COLOR_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_pair)( + SCREEN*, + NCURSES_PAIRS_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + intrflush)(SCREEN*, WINDOW*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(isendwin)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(NCURSES_CONST char*) + NCURSES_SP_NAME(keyname)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char) + NCURSES_SP_NAME(killchar)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(longname)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + mvcur)(SCREEN*, int, int, int, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(napms)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW*) + NCURSES_SP_NAME(newpad)(SCREEN*, int, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(SCREEN*) NCURSES_SP_NAME(newterm)( + SCREEN*, + NCURSES_CONST char*, + FILE*, + FILE*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW*) NCURSES_SP_NAME( + newwin)(SCREEN*, int, int, int, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(nl)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(nocbreak)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(noecho)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(nonl)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(noqiflush)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(noraw)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(pair_content)( + SCREEN*, + NCURSES_PAIRS_T, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(qiflush)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(raw)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(reset_prog_mode)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(reset_shell_mode)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(resetty)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + ripoffline)(SCREEN*, int, int (*)(WINDOW*, int)); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(savetty)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(scr_init)(SCREEN*, const char*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + scr_restore)(SCREEN*, const char*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(scr_set)(SCREEN*, const char*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_attroff)(SCREEN*, const chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_attron)(SCREEN*, const chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_attrset)(SCREEN*, const chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(attr_t) + NCURSES_SP_NAME(slk_attr)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attr_set)( + SCREEN*, + const attr_t, + NCURSES_PAIRS_T, + void*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_clear)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_color)(SCREEN*, NCURSES_PAIRS_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_init)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(slk_label)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_noutrefresh)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_refresh)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_restore)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_set)(SCREEN*, int, const char*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_touch)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(start_color)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(chtype) + NCURSES_SP_NAME(termattrs)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(termname)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(typeahead)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(ungetch)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(use_env)(SCREEN*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(use_tioctl)(SCREEN*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(vidattr)(SCREEN*, chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + vidputs)(SCREEN*, chtype, NCURSES_SP_OUTC); /* implemented:SP_FUNC */ +#if 1 +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(keybound)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + alloc_pair)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + assume_default_colors)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + define_key)(SCREEN*, const char*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_color_content)( + SCREEN*, + int, + int*, + int*, + int*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_pair_content)( + SCREEN*, + int, + int*, + int*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + extended_slk_color)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(get_escdelay)(SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(find_pair)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(free_pair)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_extended_color)( + SCREEN*, + int, + int, + int, + int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + init_extended_pair)(SCREEN*, int, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME( + is_term_resized)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + key_defined)(SCREEN*, const char*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(keyok)(SCREEN*, int, bool); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(nofilter)(SCREEN*); + /* implemented */ /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(reset_color_pairs)(SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + resize_term)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + resizeterm)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(set_escdelay)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(set_tabsize)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(use_default_colors)(SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + use_legacy_coding)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +#endif +#else +#undef NCURSES_SP_FUNCS +#define NCURSES_SP_FUNCS 0 +#define NCURSES_SP_NAME(name) name +#define NCURSES_SP_OUTC NCURSES_OUTC +#endif + +/* attributes */ + +#define NCURSES_ATTR_SHIFT 8 +#define NCURSES_BITS(mask, shift) \ + (NCURSES_CAST(chtype, (mask)) << ((shift) + NCURSES_ATTR_SHIFT)) + +#define A_NORMAL (1U - 1U) +#define A_ATTRIBUTES NCURSES_BITS(~(1U - 1U), 0) +#define A_CHARTEXT (NCURSES_BITS(1U, 0) - 1U) +#define A_COLOR NCURSES_BITS(((1U) << 8) - 1U, 0) +#define A_STANDOUT NCURSES_BITS(1U, 8) +#define A_UNDERLINE NCURSES_BITS(1U, 9) +#define A_REVERSE NCURSES_BITS(1U, 10) +#define A_BLINK NCURSES_BITS(1U, 11) +#define A_DIM NCURSES_BITS(1U, 12) +#define A_BOLD NCURSES_BITS(1U, 13) +#define A_ALTCHARSET NCURSES_BITS(1U, 14) +#define A_INVIS NCURSES_BITS(1U, 15) +#define A_PROTECT NCURSES_BITS(1U, 16) +#define A_HORIZONTAL NCURSES_BITS(1U, 17) +#define A_LEFT NCURSES_BITS(1U, 18) +#define A_LOW NCURSES_BITS(1U, 19) +#define A_RIGHT NCURSES_BITS(1U, 20) +#define A_TOP NCURSES_BITS(1U, 21) +#define A_VERTICAL NCURSES_BITS(1U, 22) + +#if 1 +#define A_ITALIC NCURSES_BITS(1U, 23) /* ncurses extension */ +#endif + +/* + * Most of the pseudo functions are macros that either provide compatibility + * with older versions of curses, or provide inline functionality to improve + * performance. + */ + +/* + * These pseudo functions are always implemented as macros: + */ + +#define getyx(win, y, x) (y = getcury(win), x = getcurx(win)) +#define getbegyx(win, y, x) (y = getbegy(win), x = getbegx(win)) +#define getmaxyx(win, y, x) (y = getmaxy(win), x = getmaxx(win)) +#define getparyx(win, y, x) (y = getpary(win), x = getparx(win)) + +#define getsyx(y, x) \ + do { \ + if (newscr) { \ + if (is_leaveok(newscr)) \ + (y) = (x) = -1; \ + else \ + getyx(newscr, (y), (x)); \ + } \ + } while (0) + +#define setsyx(y, x) \ + do { \ + if (newscr) { \ + if ((y) == -1 && (x) == -1) \ + leaveok(newscr, TRUE); \ + else { \ + leaveok(newscr, FALSE); \ + wmove(newscr, (y), (x)); \ + } \ + } \ + } while (0) + +#ifndef NCURSES_NOMACROS + +/* + * These miscellaneous pseudo functions are provided for compatibility: + */ + +#define wgetstr(w, s) wgetnstr(w, s, -1) +#define getnstr(s, n) wgetnstr(stdscr, s, (n)) + +#define setterm(term) setupterm(term, 1, (int*)0) + +#define fixterm() reset_prog_mode() +#define resetterm() reset_shell_mode() +#define saveterm() def_prog_mode() +#define crmode() cbreak() +#define nocrmode() nocbreak() +#define gettmode() + +/* It seems older SYSV curses versions define these */ +#if !NCURSES_OPAQUE +#define getattrs(win) \ + NCURSES_CAST(int, NCURSES_OK_ADDR(win) ? (win)->_attrs : A_NORMAL) +#define getcurx(win) (NCURSES_OK_ADDR(win) ? (win)->_curx : ERR) +#define getcury(win) (NCURSES_OK_ADDR(win) ? (win)->_cury : ERR) +#define getbegx(win) (NCURSES_OK_ADDR(win) ? (win)->_begx : ERR) +#define getbegy(win) (NCURSES_OK_ADDR(win) ? (win)->_begy : ERR) +#define getmaxx(win) (NCURSES_OK_ADDR(win) ? ((win)->_maxx + 1) : ERR) +#define getmaxy(win) (NCURSES_OK_ADDR(win) ? ((win)->_maxy + 1) : ERR) +#define getparx(win) (NCURSES_OK_ADDR(win) ? (win)->_parx : ERR) +#define getpary(win) (NCURSES_OK_ADDR(win) ? (win)->_pary : ERR) +#endif /* NCURSES_OPAQUE */ + +#define wstandout(win) (wattrset(win, A_STANDOUT)) +#define wstandend(win) (wattrset(win, A_NORMAL)) + +#define wattron(win, at) wattr_on(win, NCURSES_CAST(attr_t, at), NULL) +#define wattroff(win, at) wattr_off(win, NCURSES_CAST(attr_t, at), NULL) + +#if !NCURSES_OPAQUE +#if NCURSES_WATTR_MACROS +#if NCURSES_WIDECHAR && 1 +#define wattrset(win, at) \ + (NCURSES_OK_ADDR(win) ? ((win)->_color = NCURSES_CAST(int, PAIR_NUMBER(at)), \ + (win)->_attrs = NCURSES_CAST(attr_t, at), \ + OK) \ + : ERR) +#else +#define wattrset(win, at) \ + (NCURSES_OK_ADDR(win) ? ((win)->_attrs = NCURSES_CAST(attr_t, at), OK) : ERR) +#endif +#endif /* NCURSES_WATTR_MACROS */ +#endif /* NCURSES_OPAQUE */ + +#define scroll(win) wscrl(win, 1) + +#define touchwin(win) wtouchln((win), 0, getmaxy(win), 1) +#define touchline(win, s, c) wtouchln((win), s, c, 1) +#define untouchwin(win) wtouchln((win), 0, getmaxy(win), 0) + +#define box(win, v, h) wborder(win, v, v, h, h, 0, 0, 0, 0) +#define border(ls, rs, ts, bs, tl, tr, bl, br) \ + wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br) +#define hline(ch, n) whline(stdscr, ch, (n)) +#define vline(ch, n) wvline(stdscr, ch, (n)) + +#define winstr(w, s) winnstr(w, s, -1) +#define winchstr(w, s) winchnstr(w, s, -1) +#define winsstr(w, s) winsnstr(w, s, -1) + +#if !NCURSES_OPAQUE +#define redrawwin(win) \ + wredrawln(win, 0, (NCURSES_OK_ADDR(win) ? (win)->_maxy + 1 : -1)) +#endif /* NCURSES_OPAQUE */ + +#define waddstr(win, str) waddnstr(win, str, -1) +#define waddchstr(win, str) waddchnstr(win, str, -1) + +/* + * These apply to the first 256 color pairs. + */ +#define COLOR_PAIR(n) (NCURSES_BITS((n), 0) & A_COLOR) +#define PAIR_NUMBER(a) \ + (NCURSES_CAST( \ + int, \ + ((NCURSES_CAST(unsigned long, (a)) & A_COLOR) >> NCURSES_ATTR_SHIFT))) + +/* + * pseudo functions for standard screen + */ + +#define addch(ch) waddch(stdscr, (ch)) +#define addchnstr(str, n) waddchnstr(stdscr, (str), (n)) +#define addchstr(str) waddchstr(stdscr, (str)) +#define addnstr(str, n) waddnstr(stdscr, (str), (n)) +#define addstr(str) waddnstr(stdscr, (str), -1) +#define attr_get(ap, cp, o) wattr_get(stdscr, (ap), (cp), (o)) +#define attr_off(a, o) wattr_off(stdscr, (a), (o)) +#define attr_on(a, o) wattr_on(stdscr, (a), (o)) +#define attr_set(a, c, o) wattr_set(stdscr, (a), (c), (o)) +#define attroff(at) wattroff(stdscr, (at)) +#define attron(at) wattron(stdscr, (at)) +#define attrset(at) wattrset(stdscr, (at)) +#define bkgd(ch) wbkgd(stdscr, (ch)) +#define bkgdset(ch) wbkgdset(stdscr, (ch)) +#define chgat(n, a, c, o) wchgat(stdscr, (n), (a), (c), (o)) +#define clear() wclear(stdscr) +#define clrtobot() wclrtobot(stdscr) +#define clrtoeol() wclrtoeol(stdscr) +#define color_set(c, o) wcolor_set(stdscr, (c), (o)) +#define delch() wdelch(stdscr) +#define deleteln() winsdelln(stdscr, -1) +#define echochar(c) wechochar(stdscr, (c)) +#define erase() werase(stdscr) +#define getch() wgetch(stdscr) +#define getstr(str) wgetstr(stdscr, (str)) +#define inch() winch(stdscr) +#define inchnstr(s, n) winchnstr(stdscr, (s), (n)) +#define inchstr(s) winchstr(stdscr, (s)) +#define innstr(s, n) winnstr(stdscr, (s), (n)) +#define insch(c) winsch(stdscr, (c)) +#define insdelln(n) winsdelln(stdscr, (n)) +#define insertln() winsdelln(stdscr, 1) +#define insnstr(s, n) winsnstr(stdscr, (s), (n)) +#define insstr(s) winsstr(stdscr, (s)) +#define instr(s) winstr(stdscr, (s)) +#define move(y, x) wmove(stdscr, (y), (x)) +#define refresh() wrefresh(stdscr) +#define scrl(n) wscrl(stdscr, (n)) +#define setscrreg(t, b) wsetscrreg(stdscr, (t), (b)) +#define standend() wstandend(stdscr) +#define standout() wstandout(stdscr) +#define timeout(delay) wtimeout(stdscr, (delay)) +#define wdeleteln(win) winsdelln(win, -1) +#define winsertln(win) winsdelln(win, 1) + +/* + * mv functions + */ + +#define mvwaddch(win, y, x, ch) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddch((win), (ch))) +#define mvwaddchnstr(win, y, x, str, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddchnstr((win), (str), (n))) +#define mvwaddchstr(win, y, x, str) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddchnstr((win), (str), -1)) +#define mvwaddnstr(win, y, x, str, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddnstr((win), (str), (n))) +#define mvwaddstr(win, y, x, str) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddnstr((win), (str), -1)) +#define mvwchgat(win, y, x, n, a, c, o) \ + (wmove((win), (y), (x)) == ERR ? ERR : wchgat((win), (n), (a), (c), (o))) +#define mvwdelch(win, y, x) (wmove((win), (y), (x)) == ERR ? ERR : wdelch(win)) +#define mvwgetch(win, y, x) (wmove((win), (y), (x)) == ERR ? ERR : wgetch(win)) +#define mvwgetnstr(win, y, x, str, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : wgetnstr((win), (str), (n))) +#define mvwgetstr(win, y, x, str) \ + (wmove((win), (y), (x)) == ERR ? ERR : wgetstr((win), (str))) +#define mvwhline(win, y, x, c, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : whline((win), (c), (n))) +#define mvwinch(win, y, x) \ + (wmove((win), (y), (x)) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win)) +#define mvwinchnstr(win, y, x, s, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : winchnstr((win), (s), (n))) +#define mvwinchstr(win, y, x, s) \ + (wmove((win), (y), (x)) == ERR ? ERR : winchstr((win), (s))) +#define mvwinnstr(win, y, x, s, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : winnstr((win), (s), (n))) +#define mvwinsch(win, y, x, c) \ + (wmove((win), (y), (x)) == ERR ? ERR : winsch((win), (c))) +#define mvwinsnstr(win, y, x, s, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : winsnstr((win), (s), (n))) +#define mvwinsstr(win, y, x, s) \ + (wmove((win), (y), (x)) == ERR ? ERR : winsstr((win), (s))) +#define mvwinstr(win, y, x, s) \ + (wmove((win), (y), (x)) == ERR ? ERR : winstr((win), (s))) +#define mvwvline(win, y, x, c, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : wvline((win), (c), (n))) + +#define mvaddch(y, x, ch) mvwaddch(stdscr, (y), (x), (ch)) +#define mvaddchnstr(y, x, str, n) mvwaddchnstr(stdscr, (y), (x), (str), (n)) +#define mvaddchstr(y, x, str) mvwaddchstr(stdscr, (y), (x), (str)) +#define mvaddnstr(y, x, str, n) mvwaddnstr(stdscr, (y), (x), (str), (n)) +#define mvaddstr(y, x, str) mvwaddstr(stdscr, (y), (x), (str)) +#define mvchgat(y, x, n, a, c, o) mvwchgat(stdscr, (y), (x), (n), (a), (c), (o)) +#define mvdelch(y, x) mvwdelch(stdscr, (y), (x)) +#define mvgetch(y, x) mvwgetch(stdscr, (y), (x)) +#define mvgetnstr(y, x, str, n) mvwgetnstr(stdscr, (y), (x), (str), (n)) +#define mvgetstr(y, x, str) mvwgetstr(stdscr, (y), (x), (str)) +#define mvhline(y, x, c, n) mvwhline(stdscr, (y), (x), (c), (n)) +#define mvinch(y, x) mvwinch(stdscr, (y), (x)) +#define mvinchnstr(y, x, s, n) mvwinchnstr(stdscr, (y), (x), (s), (n)) +#define mvinchstr(y, x, s) mvwinchstr(stdscr, (y), (x), (s)) +#define mvinnstr(y, x, s, n) mvwinnstr(stdscr, (y), (x), (s), (n)) +#define mvinsch(y, x, c) mvwinsch(stdscr, (y), (x), (c)) +#define mvinsnstr(y, x, s, n) mvwinsnstr(stdscr, (y), (x), (s), (n)) +#define mvinsstr(y, x, s) mvwinsstr(stdscr, (y), (x), (s)) +#define mvinstr(y, x, s) mvwinstr(stdscr, (y), (x), (s)) +#define mvvline(y, x, c, n) mvwvline(stdscr, (y), (x), (c), (n)) + +/* + * Some wide-character functions can be implemented without the extensions. + */ +#if !NCURSES_OPAQUE +#define getbkgd(win) (NCURSES_OK_ADDR(win) ? ((win)->_bkgd) : 0) +#endif /* NCURSES_OPAQUE */ + +#define slk_attr_off(a, v) ((v) ? ERR : slk_attroff(a)) +#define slk_attr_on(a, v) ((v) ? ERR : slk_attron(a)) + +#if !NCURSES_OPAQUE +#if NCURSES_WATTR_MACROS +#if NCURSES_WIDECHAR && 1 +#define wattr_set(win, a, p, opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)((win)->_attrs = ((a) & ~A_COLOR), (win)->_color = (opts) ? *(int*)(opts) : (p)), \ + OK) \ + : ERR) +#define wattr_get(win, a, p, opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)(NCURSES_OK_ADDR(a) ? (*(a) = (win)->_attrs) : OK), \ + (void)(NCURSES_OK_ADDR(p) ? (*(p) = (NCURSES_PAIRS_T)(win)->_color) : OK), \ + (void)(NCURSES_OK_ADDR(opts) ? (*(int*)(opts) = (win)->_color) : OK), \ + OK) \ + : ERR) +#else /* !(NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */ +#define wattr_set(win, a, p, opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)((win)->_attrs = (((a) & ~A_COLOR) | (attr_t)COLOR_PAIR(p))), \ + OK) \ + : ERR) +#define wattr_get(win, a, p, opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)(NCURSES_OK_ADDR(a) ? (*(a) = (win)->_attrs) : OK), \ + (void)(NCURSES_OK_ADDR(p) ? (*(p) = (NCURSES_PAIRS_T)PAIR_NUMBER((win)->_attrs)) : OK), \ + OK) \ + : ERR) +#endif /* (NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */ +#endif /* NCURSES_WATTR_MACROS */ +#endif /* NCURSES_OPAQUE */ + +/* + * X/Open curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use + * varargs.h. It adds new calls vw_printw/vw_scanw, which are supposed to + * use POSIX stdarg.h. The ncurses versions of vwprintw/vwscanw already + * use stdarg.h, so... + */ +#define vw_printw vwprintw +#define vw_scanw vwscanw + +/* + * Export fallback function for use in C++ binding. + */ +#if !1 +#define vsscanf(a, b, c) _nc_vsscanf(a, b, c) +NCURSES_EXPORT(int) vsscanf(const char*, const char*, va_list); +#endif + +/* + * These macros are extensions - not in X/Open Curses. + */ +#if 1 +#if !NCURSES_OPAQUE +#define is_cleared(win) (NCURSES_OK_ADDR(win) ? (win)->_clear : FALSE) +#define is_idcok(win) (NCURSES_OK_ADDR(win) ? (win)->_idcok : FALSE) +#define is_idlok(win) (NCURSES_OK_ADDR(win) ? (win)->_idlok : FALSE) +#define is_immedok(win) (NCURSES_OK_ADDR(win) ? (win)->_immed : FALSE) +#define is_keypad(win) (NCURSES_OK_ADDR(win) ? (win)->_use_keypad : FALSE) +#define is_leaveok(win) (NCURSES_OK_ADDR(win) ? (win)->_leaveok : FALSE) +#define is_nodelay(win) (NCURSES_OK_ADDR(win) ? ((win)->_delay == 0) : FALSE) +#define is_notimeout(win) (NCURSES_OK_ADDR(win) ? (win)->_notimeout : FALSE) +#define is_pad(win) \ + (NCURSES_OK_ADDR(win) ? ((win)->_flags & _ISPAD) != 0 : FALSE) +#define is_scrollok(win) (NCURSES_OK_ADDR(win) ? (win)->_scroll : FALSE) +#define is_subwin(win) \ + (NCURSES_OK_ADDR(win) ? ((win)->_flags & _SUBWIN) != 0 : FALSE) +#define is_syncok(win) (NCURSES_OK_ADDR(win) ? (win)->_sync : FALSE) +#define wgetdelay(win) (NCURSES_OK_ADDR(win) ? (win)->_delay : 0) +#define wgetparent(win) (NCURSES_OK_ADDR(win) ? (win)->_parent : 0) +#define wgetscrreg(win, t, b) \ + (NCURSES_OK_ADDR(win) \ + ? (*(t) = (win)->_regtop, *(b) = (win)->_regbottom, OK) \ + : ERR) +#endif +#endif + +#endif /* NCURSES_NOMACROS */ + +/* + * Public variables. + * + * Notes: + * a. ESCDELAY was an undocumented feature under AIX curses. + * It gives the ESC expire time in milliseconds. + * b. ttytype is needed for backward compatibility + */ +#if NCURSES_REENTRANT + +NCURSES_WRAPPED_VAR(WINDOW*, curscr); +NCURSES_WRAPPED_VAR(WINDOW*, newscr); +NCURSES_WRAPPED_VAR(WINDOW*, stdscr); +NCURSES_WRAPPED_VAR(char*, ttytype); +NCURSES_WRAPPED_VAR(int, COLORS); +NCURSES_WRAPPED_VAR(int, COLOR_PAIRS); +NCURSES_WRAPPED_VAR(int, COLS); +NCURSES_WRAPPED_VAR(int, ESCDELAY); +NCURSES_WRAPPED_VAR(int, LINES); +NCURSES_WRAPPED_VAR(int, TABSIZE); + +#define curscr NCURSES_PUBLIC_VAR(curscr()) +#define newscr NCURSES_PUBLIC_VAR(newscr()) +#define stdscr NCURSES_PUBLIC_VAR(stdscr()) +#define ttytype NCURSES_PUBLIC_VAR(ttytype()) +#define COLORS NCURSES_PUBLIC_VAR(COLORS()) +#define COLOR_PAIRS NCURSES_PUBLIC_VAR(COLOR_PAIRS()) +#define COLS NCURSES_PUBLIC_VAR(COLS()) +#define ESCDELAY NCURSES_PUBLIC_VAR(ESCDELAY()) +#define LINES NCURSES_PUBLIC_VAR(LINES()) +#define TABSIZE NCURSES_PUBLIC_VAR(TABSIZE()) + +#else + +extern NCURSES_EXPORT_VAR(WINDOW*) curscr; +extern NCURSES_EXPORT_VAR(WINDOW*) newscr; +extern NCURSES_EXPORT_VAR(WINDOW*) stdscr; +extern NCURSES_EXPORT_VAR(char) ttytype[]; +extern NCURSES_EXPORT_VAR(int) COLORS; +extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS; +extern NCURSES_EXPORT_VAR(int) COLS; +extern NCURSES_EXPORT_VAR(int) ESCDELAY; +extern NCURSES_EXPORT_VAR(int) LINES; +extern NCURSES_EXPORT_VAR(int) TABSIZE; + +#endif + +/* + * Pseudo-character tokens outside ASCII range. The curses wgetch() function + * will return any given one of these only if the corresponding k- capability + * is defined in your terminal's terminfo entry. + * + * Some keys (KEY_A1, etc) are arranged like this: + * a1 up a3 + * left b2 right + * c1 down c3 + * + * A few key codes do not depend upon the terminfo entry. + */ +#define KEY_CODE_YES 0400 /* A wchar_t contains a key code */ +#define KEY_MIN 0401 /* Minimum curses key */ +#define KEY_BREAK 0401 /* Break key (unreliable) */ +#define KEY_SRESET 0530 /* Soft (partial) reset (unreliable) */ +#define KEY_RESET 0531 /* Reset or hard reset (unreliable) */ +/* + * These definitions were generated by ./MKkey_defs.sh ./Caps + */ +#define KEY_DOWN 0402 /* down-arrow key */ +#define KEY_UP 0403 /* up-arrow key */ +#define KEY_LEFT 0404 /* left-arrow key */ +#define KEY_RIGHT 0405 /* right-arrow key */ +#define KEY_HOME 0406 /* home key */ +#define KEY_BACKSPACE 0407 /* backspace key */ +#define KEY_F0 0410 /* Function keys. Space for 64 */ +#define KEY_F(n) (KEY_F0 + (n)) /* Value of function key n */ +#define KEY_DL 0510 /* delete-line key */ +#define KEY_IL 0511 /* insert-line key */ +#define KEY_DC 0512 /* delete-character key */ +#define KEY_IC 0513 /* insert-character key */ +#define KEY_EIC 0514 /* sent by rmir or smir in insert mode */ +#define KEY_CLEAR 0515 /* clear-screen or erase key */ +#define KEY_EOS 0516 /* clear-to-end-of-screen key */ +#define KEY_EOL 0517 /* clear-to-end-of-line key */ +#define KEY_SF 0520 /* scroll-forward key */ +#define KEY_SR 0521 /* scroll-backward key */ +#define KEY_NPAGE 0522 /* next-page key */ +#define KEY_PPAGE 0523 /* previous-page key */ +#define KEY_STAB 0524 /* set-tab key */ +#define KEY_CTAB 0525 /* clear-tab key */ +#define KEY_CATAB 0526 /* clear-all-tabs key */ +#define KEY_ENTER 0527 /* enter/send key */ +#define KEY_PRINT 0532 /* print key */ +#define KEY_LL 0533 /* lower-left key (home down) */ +#define KEY_A1 0534 /* upper left of keypad */ +#define KEY_A3 0535 /* upper right of keypad */ +#define KEY_B2 0536 /* center of keypad */ +#define KEY_C1 0537 /* lower left of keypad */ +#define KEY_C3 0540 /* lower right of keypad */ +#define KEY_BTAB 0541 /* back-tab key */ +#define KEY_BEG 0542 /* begin key */ +#define KEY_CANCEL 0543 /* cancel key */ +#define KEY_CLOSE 0544 /* close key */ +#define KEY_COMMAND 0545 /* command key */ +#define KEY_COPY 0546 /* copy key */ +#define KEY_CREATE 0547 /* create key */ +#define KEY_END 0550 /* end key */ +#define KEY_EXIT 0551 /* exit key */ +#define KEY_FIND 0552 /* find key */ +#define KEY_HELP 0553 /* help key */ +#define KEY_MARK 0554 /* mark key */ +#define KEY_MESSAGE 0555 /* message key */ +#define KEY_MOVE 0556 /* move key */ +#define KEY_NEXT 0557 /* next key */ +#define KEY_OPEN 0560 /* open key */ +#define KEY_OPTIONS 0561 /* options key */ +#define KEY_PREVIOUS 0562 /* previous key */ +#define KEY_REDO 0563 /* redo key */ +#define KEY_REFERENCE 0564 /* reference key */ +#define KEY_REFRESH 0565 /* refresh key */ +#define KEY_REPLACE 0566 /* replace key */ +#define KEY_RESTART 0567 /* restart key */ +#define KEY_RESUME 0570 /* resume key */ +#define KEY_SAVE 0571 /* save key */ +#define KEY_SBEG 0572 /* shifted begin key */ +#define KEY_SCANCEL 0573 /* shifted cancel key */ +#define KEY_SCOMMAND 0574 /* shifted command key */ +#define KEY_SCOPY 0575 /* shifted copy key */ +#define KEY_SCREATE 0576 /* shifted create key */ +#define KEY_SDC 0577 /* shifted delete-character key */ +#define KEY_SDL 0600 /* shifted delete-line key */ +#define KEY_SELECT 0601 /* select key */ +#define KEY_SEND 0602 /* shifted end key */ +#define KEY_SEOL 0603 /* shifted clear-to-end-of-line key */ +#define KEY_SEXIT 0604 /* shifted exit key */ +#define KEY_SFIND 0605 /* shifted find key */ +#define KEY_SHELP 0606 /* shifted help key */ +#define KEY_SHOME 0607 /* shifted home key */ +#define KEY_SIC 0610 /* shifted insert-character key */ +#define KEY_SLEFT 0611 /* shifted left-arrow key */ +#define KEY_SMESSAGE 0612 /* shifted message key */ +#define KEY_SMOVE 0613 /* shifted move key */ +#define KEY_SNEXT 0614 /* shifted next key */ +#define KEY_SOPTIONS 0615 /* shifted options key */ +#define KEY_SPREVIOUS 0616 /* shifted previous key */ +#define KEY_SPRINT 0617 /* shifted print key */ +#define KEY_SREDO 0620 /* shifted redo key */ +#define KEY_SREPLACE 0621 /* shifted replace key */ +#define KEY_SRIGHT 0622 /* shifted right-arrow key */ +#define KEY_SRSUME 0623 /* shifted resume key */ +#define KEY_SSAVE 0624 /* shifted save key */ +#define KEY_SSUSPEND 0625 /* shifted suspend key */ +#define KEY_SUNDO 0626 /* shifted undo key */ +#define KEY_SUSPEND 0627 /* suspend key */ +#define KEY_UNDO 0630 /* undo key */ +#define KEY_MOUSE 0631 /* Mouse event has occurred */ +#define KEY_RESIZE 0632 /* Terminal resize event */ +#define KEY_EVENT 0633 /* We were interrupted by an event */ + +#define KEY_MAX 0777 /* Maximum key value is 0633 */ +/* $Id: curses.wide,v 1.50 2017/03/26 16:05:21 tom Exp $ */ +/* + * vile:cmode: + * This file is part of ncurses, designed to be appended after curses.h.in + * (see that file for the relevant copyright). + */ +#define _XOPEN_CURSES 1 + +#if NCURSES_WIDECHAR + +extern NCURSES_EXPORT_VAR(cchar_t*) _nc_wacs; + +#define NCURSES_WACS(c) (&_nc_wacs[NCURSES_CAST(unsigned char, (c))]) + +#define WACS_BSSB NCURSES_WACS('l') +#define WACS_SSBB NCURSES_WACS('m') +#define WACS_BBSS NCURSES_WACS('k') +#define WACS_SBBS NCURSES_WACS('j') +#define WACS_SBSS NCURSES_WACS('u') +#define WACS_SSSB NCURSES_WACS('t') +#define WACS_SSBS NCURSES_WACS('v') +#define WACS_BSSS NCURSES_WACS('w') +#define WACS_BSBS NCURSES_WACS('q') +#define WACS_SBSB NCURSES_WACS('x') +#define WACS_SSSS NCURSES_WACS('n') + +#define WACS_ULCORNER WACS_BSSB +#define WACS_LLCORNER WACS_SSBB +#define WACS_URCORNER WACS_BBSS +#define WACS_LRCORNER WACS_SBBS +#define WACS_RTEE WACS_SBSS +#define WACS_LTEE WACS_SSSB +#define WACS_BTEE WACS_SSBS +#define WACS_TTEE WACS_BSSS +#define WACS_HLINE WACS_BSBS +#define WACS_VLINE WACS_SBSB +#define WACS_PLUS WACS_SSSS + +#define WACS_S1 NCURSES_WACS('o') /* scan line 1 */ +#define WACS_S9 NCURSES_WACS('s') /* scan line 9 */ +#define WACS_DIAMOND NCURSES_WACS('`') /* diamond */ +#define WACS_CKBOARD NCURSES_WACS('a') /* checker board */ +#define WACS_DEGREE NCURSES_WACS('f') /* degree symbol */ +#define WACS_PLMINUS NCURSES_WACS('g') /* plus/minus */ +#define WACS_BULLET NCURSES_WACS('~') /* bullet */ + +/* Teletype 5410v1 symbols */ +#define WACS_LARROW NCURSES_WACS(',') /* arrow left */ +#define WACS_RARROW NCURSES_WACS('+') /* arrow right */ +#define WACS_DARROW NCURSES_WACS('.') /* arrow down */ +#define WACS_UARROW NCURSES_WACS('-') /* arrow up */ +#define WACS_BOARD NCURSES_WACS('h') /* board of squares */ +#define WACS_LANTERN NCURSES_WACS('i') /* lantern symbol */ +#define WACS_BLOCK NCURSES_WACS('0') /* solid square block */ + +/* ncurses extensions */ +#define WACS_S3 NCURSES_WACS('p') /* scan line 3 */ +#define WACS_S7 NCURSES_WACS('r') /* scan line 7 */ +#define WACS_LEQUAL NCURSES_WACS('y') /* less/equal */ +#define WACS_GEQUAL NCURSES_WACS('z') /* greater/equal */ +#define WACS_PI NCURSES_WACS('{') /* Pi */ +#define WACS_NEQUAL NCURSES_WACS('|') /* not equal */ +#define WACS_STERLING NCURSES_WACS('}') /* UK pound sign */ + +/* double lines */ +#define WACS_BDDB NCURSES_WACS('C') +#define WACS_DDBB NCURSES_WACS('D') +#define WACS_BBDD NCURSES_WACS('B') +#define WACS_DBBD NCURSES_WACS('A') +#define WACS_DBDD NCURSES_WACS('G') +#define WACS_DDDB NCURSES_WACS('F') +#define WACS_DDBD NCURSES_WACS('H') +#define WACS_BDDD NCURSES_WACS('I') +#define WACS_BDBD NCURSES_WACS('R') +#define WACS_DBDB NCURSES_WACS('Y') +#define WACS_DDDD NCURSES_WACS('E') + +#define WACS_D_ULCORNER WACS_BDDB +#define WACS_D_LLCORNER WACS_DDBB +#define WACS_D_URCORNER WACS_BBDD +#define WACS_D_LRCORNER WACS_DBBD +#define WACS_D_RTEE WACS_DBDD +#define WACS_D_LTEE WACS_DDDB +#define WACS_D_BTEE WACS_DDBD +#define WACS_D_TTEE WACS_BDDD +#define WACS_D_HLINE WACS_BDBD +#define WACS_D_VLINE WACS_DBDB +#define WACS_D_PLUS WACS_DDDD + +/* thick lines */ +#define WACS_BTTB NCURSES_WACS('L') +#define WACS_TTBB NCURSES_WACS('M') +#define WACS_BBTT NCURSES_WACS('K') +#define WACS_TBBT NCURSES_WACS('J') +#define WACS_TBTT NCURSES_WACS('U') +#define WACS_TTTB NCURSES_WACS('T') +#define WACS_TTBT NCURSES_WACS('V') +#define WACS_BTTT NCURSES_WACS('W') +#define WACS_BTBT NCURSES_WACS('Q') +#define WACS_TBTB NCURSES_WACS('X') +#define WACS_TTTT NCURSES_WACS('N') + +#define WACS_T_ULCORNER WACS_BTTB +#define WACS_T_LLCORNER WACS_TTBB +#define WACS_T_URCORNER WACS_BBTT +#define WACS_T_LRCORNER WACS_TBBT +#define WACS_T_RTEE WACS_TBTT +#define WACS_T_LTEE WACS_TTTB +#define WACS_T_BTEE WACS_TTBT +#define WACS_T_TTEE WACS_BTTT +#define WACS_T_HLINE WACS_BTBT +#define WACS_T_VLINE WACS_TBTB +#define WACS_T_PLUS WACS_TTTT + +/* + * Function prototypes for wide-character operations. + * + * "generated" comments should include ":WIDEC" to make the corresponding + * functions ifdef'd in lib_gen.c + * + * "implemented" comments do not need this marker. + */ + +extern NCURSES_EXPORT(int) add_wch(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + add_wchnstr(const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) add_wchstr(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) addnwstr(const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) addwstr(const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) bkgrnd(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(void) bkgrndset(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) border_set( + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + box_set(WINDOW*, const cchar_t*, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) echo_wchar(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) erasewchar(wchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) get_wch(wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) get_wstr(wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) getbkgrnd(cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) getcchar( + const cchar_t*, + wchar_t*, + attr_t*, + NCURSES_PAIRS_T*, + void*); /* implemented */ +extern NCURSES_EXPORT(int) getn_wstr(wint_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) hline_set(const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) in_wch(cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) in_wchnstr(cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) in_wchstr(cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) innwstr(wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) ins_nwstr(const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) ins_wch(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) ins_wstr(const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) inwstr(wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(NCURSES_CONST char*) key_name(wchar_t); /* implemented */ +extern NCURSES_EXPORT(int) killwchar(wchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + mvadd_wch(int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvadd_wchnstr(int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvadd_wchstr(int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvaddnwstr(int, int, const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvaddwstr(int, int, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvget_wch(int, int, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvget_wstr(int, int, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvgetn_wstr(int, int, wint_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvhline_set(int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvin_wch(int, int, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvin_wchnstr(int, int, cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvin_wchstr(int, int, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvinnwstr(int, int, wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvins_nwstr(int, int, const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvins_wch(int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvins_wstr(int, int, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvinwstr(int, int, wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvvline_set(int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwadd_wch(WINDOW*, int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwadd_wchnstr( + WINDOW*, + int, + int, + const cchar_t*, + int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwadd_wchstr(WINDOW*, int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwaddnwstr(WINDOW*, int, int, const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwaddwstr(WINDOW*, int, int, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwget_wch(WINDOW*, int, int, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwget_wstr(WINDOW*, int, int, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwgetn_wstr(WINDOW*, int, int, wint_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwhline_set(WINDOW*, int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwin_wch(WINDOW*, int, int, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwin_wchnstr(WINDOW*, int, int, cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwin_wchstr(WINDOW*, int, int, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwinnwstr(WINDOW*, int, int, wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwins_nwstr(WINDOW*, int, int, const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwins_wch(WINDOW*, int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwins_wstr(WINDOW*, int, int, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwinwstr(WINDOW*, int, int, wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwvline_set(WINDOW*, int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + pecho_wchar(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) setcchar( + cchar_t*, + const wchar_t*, + const attr_t, + NCURSES_PAIRS_T, + const void*); /* implemented */ +extern NCURSES_EXPORT(int) slk_wset(int, const wchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(attr_t) term_attrs(void); /* implemented */ +extern NCURSES_EXPORT(int) unget_wch(const wchar_t); /* implemented */ +extern NCURSES_EXPORT(int) + vid_attr(attr_t, NCURSES_PAIRS_T, void*); /* implemented */ +extern NCURSES_EXPORT(int) + vid_puts(attr_t, NCURSES_PAIRS_T, void*, NCURSES_OUTC); /* implemented */ +extern NCURSES_EXPORT(int) vline_set(const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wadd_wch(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + wadd_wchnstr(WINDOW*, const cchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) + wadd_wchstr(WINDOW*, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + waddnwstr(WINDOW*, const wchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) + waddwstr(WINDOW*, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wbkgrnd(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(void) + wbkgrndset(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) wborder_set( + WINDOW*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + wecho_wchar(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) wget_wch(WINDOW*, wint_t*); /* implemented */ +extern NCURSES_EXPORT(int) wget_wstr(WINDOW*, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wgetbkgrnd(WINDOW*, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wgetn_wstr(WINDOW*, wint_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) + whline_set(WINDOW*, const cchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) win_wch(WINDOW*, cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + win_wchnstr(WINDOW*, cchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) win_wchstr(WINDOW*, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) winnwstr(WINDOW*, wchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) + wins_nwstr(WINDOW*, const wchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) wins_wch(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + wins_wstr(WINDOW*, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) winwstr(WINDOW*, wchar_t*); /* implemented */ +extern NCURSES_EXPORT(wchar_t*) wunctrl(cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + wvline_set(WINDOW*, const cchar_t*, int); /* implemented */ + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(attr_t) + NCURSES_SP_NAME(term_attrs)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + unget_wch)(SCREEN*, const wchar_t); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(wchar_t*) + NCURSES_SP_NAME(wunctrl)(SCREEN*, cchar_t*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_attr)( + SCREEN*, + attr_t, + NCURSES_PAIRS_T, + void*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts)( + SCREEN*, + attr_t, + NCURSES_PAIRS_T, + void*, + NCURSES_SP_OUTC); /* implemented:SP_FUNC */ +#endif + +#ifndef NCURSES_NOMACROS + +/* + * XSI curses macros for XPG4 conformance. + */ +#define add_wch(c) wadd_wch(stdscr, (c)) +#define add_wchnstr(str, n) wadd_wchnstr(stdscr, (str), (n)) +#define add_wchstr(str) wadd_wchstr(stdscr, (str)) +#define addnwstr(wstr, n) waddnwstr(stdscr, (wstr), (n)) +#define addwstr(wstr) waddwstr(stdscr, (wstr)) +#define bkgrnd(c) wbkgrnd(stdscr, (c)) +#define bkgrndset(c) wbkgrndset(stdscr, (c)) +#define border_set(l, r, t, b, tl, tr, bl, br) \ + wborder_set(stdscr, (l), (r), (t), (b), tl, tr, bl, br) +#define box_set(w, v, h) wborder_set((w), (v), (v), (h), (h), 0, 0, 0, 0) +#define echo_wchar(c) wecho_wchar(stdscr, (c)) +#define get_wch(c) wget_wch(stdscr, (c)) +#define get_wstr(t) wget_wstr(stdscr, (t)) +#define getbkgrnd(wch) wgetbkgrnd(stdscr, (wch)) +#define getn_wstr(t, n) wgetn_wstr(stdscr, (t), (n)) +#define hline_set(c, n) whline_set(stdscr, (c), (n)) +#define in_wch(c) win_wch(stdscr, (c)) +#define in_wchnstr(c, n) win_wchnstr(stdscr, (c), (n)) +#define in_wchstr(c) win_wchstr(stdscr, (c)) +#define innwstr(c, n) winnwstr(stdscr, (c), (n)) +#define ins_nwstr(t, n) wins_nwstr(stdscr, (t), (n)) +#define ins_wch(c) wins_wch(stdscr, (c)) +#define ins_wstr(t) wins_wstr(stdscr, (t)) +#define inwstr(c) winwstr(stdscr, (c)) +#define vline_set(c, n) wvline_set(stdscr, (c), (n)) +#define wadd_wchstr(win, str) wadd_wchnstr((win), (str), -1) +#define waddwstr(win, wstr) waddnwstr((win), (wstr), -1) +#define wget_wstr(w, t) wgetn_wstr((w), (t), -1) +#define win_wchstr(w, c) win_wchnstr((w), (c), -1) +#define wins_wstr(w, t) wins_nwstr((w), (t), -1) + +#if !NCURSES_OPAQUE +#define wgetbkgrnd(win, wch) \ + (NCURSES_OK_ADDR(wch) ? ((win) ? (*(wch) = (win)->_bkgrnd) : *(wch), OK) \ + : ERR) +#endif + +#define mvadd_wch(y, x, c) mvwadd_wch(stdscr, (y), (x), (c)) +#define mvadd_wchnstr(y, x, s, n) mvwadd_wchnstr(stdscr, (y), (x), (s), (n)) +#define mvadd_wchstr(y, x, s) mvwadd_wchstr(stdscr, (y), (x), (s)) +#define mvaddnwstr(y, x, wstr, n) mvwaddnwstr(stdscr, (y), (x), (wstr), (n)) +#define mvaddwstr(y, x, wstr) mvwaddwstr(stdscr, (y), (x), (wstr)) +#define mvget_wch(y, x, c) mvwget_wch(stdscr, (y), (x), (c)) +#define mvget_wstr(y, x, t) mvwget_wstr(stdscr, (y), (x), (t)) +#define mvgetn_wstr(y, x, t, n) mvwgetn_wstr(stdscr, (y), (x), (t), (n)) +#define mvhline_set(y, x, c, n) mvwhline_set(stdscr, (y), (x), (c), (n)) +#define mvin_wch(y, x, c) mvwin_wch(stdscr, (y), (x), (c)) +#define mvin_wchnstr(y, x, c, n) mvwin_wchnstr(stdscr, (y), (x), (c), (n)) +#define mvin_wchstr(y, x, c) mvwin_wchstr(stdscr, (y), (x), (c)) +#define mvinnwstr(y, x, c, n) mvwinnwstr(stdscr, (y), (x), (c), (n)) +#define mvins_nwstr(y, x, t, n) mvwins_nwstr(stdscr, (y), (x), (t), (n)) +#define mvins_wch(y, x, c) mvwins_wch(stdscr, (y), (x), (c)) +#define mvins_wstr(y, x, t) mvwins_wstr(stdscr, (y), (x), (t)) +#define mvinwstr(y, x, c) mvwinwstr(stdscr, (y), (x), (c)) +#define mvvline_set(y, x, c, n) mvwvline_set(stdscr, (y), (x), (c), (n)) + +#define mvwadd_wch(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : wadd_wch((win), (c))) +#define mvwadd_wchnstr(win, y, x, s, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : wadd_wchnstr((win), (s), (n))) +#define mvwadd_wchstr(win, y, x, s) \ + (wmove(win, (y), (x)) == ERR ? ERR : wadd_wchstr((win), (s))) +#define mvwaddnwstr(win, y, x, wstr, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : waddnwstr((win), (wstr), (n))) +#define mvwaddwstr(win, y, x, wstr) \ + (wmove(win, (y), (x)) == ERR ? ERR : waddwstr((win), (wstr))) +#define mvwget_wch(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : wget_wch((win), (c))) +#define mvwget_wstr(win, y, x, t) \ + (wmove(win, (y), (x)) == ERR ? ERR : wget_wstr((win), (t))) +#define mvwgetn_wstr(win, y, x, t, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : wgetn_wstr((win), (t), (n))) +#define mvwhline_set(win, y, x, c, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : whline_set((win), (c), (n))) +#define mvwin_wch(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : win_wch((win), (c))) +#define mvwin_wchnstr(win, y, x, c, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : win_wchnstr((win), (c), (n))) +#define mvwin_wchstr(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : win_wchstr((win), (c))) +#define mvwinnwstr(win, y, x, c, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : winnwstr((win), (c), (n))) +#define mvwins_nwstr(win, y, x, t, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : wins_nwstr((win), (t), (n))) +#define mvwins_wch(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : wins_wch((win), (c))) +#define mvwins_wstr(win, y, x, t) \ + (wmove(win, (y), (x)) == ERR ? ERR : wins_wstr((win), (t))) +#define mvwinwstr(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : winwstr((win), (c))) +#define mvwvline_set(win, y, x, c, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : wvline_set((win), (c), (n))) + +#endif /* NCURSES_NOMACROS */ + +#if defined(TRACE) || defined(NCURSES_TEST) +extern NCURSES_EXPORT(const char*) _nc_viswbuf(const wchar_t*); +extern NCURSES_EXPORT(const char*) _nc_viswibuf(const wint_t*); +#endif + +#endif /* NCURSES_WIDECHAR */ +/* $Id: curses.tail,v 1.23 2016/02/13 16:37:45 tom Exp $ */ +/* + * vile:cmode: + * This file is part of ncurses, designed to be appended after curses.h.in + * (see that file for the relevant copyright). + */ + +/* mouse interface */ + +#if NCURSES_MOUSE_VERSION > 1 +#define NCURSES_MOUSE_MASK(b, m) ((m) << (((b)-1) * 5)) +#else +#define NCURSES_MOUSE_MASK(b, m) ((m) << (((b)-1) * 6)) +#endif + +#define NCURSES_BUTTON_RELEASED 001L +#define NCURSES_BUTTON_PRESSED 002L +#define NCURSES_BUTTON_CLICKED 004L +#define NCURSES_DOUBLE_CLICKED 010L +#define NCURSES_TRIPLE_CLICKED 020L +#define NCURSES_RESERVED_EVENT 040L + +/* event masks */ +#define BUTTON1_RELEASED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED) +#define BUTTON1_PRESSED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED) +#define BUTTON1_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED) +#define BUTTON1_DOUBLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED) +#define BUTTON1_TRIPLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED) + +#define BUTTON2_RELEASED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED) +#define BUTTON2_PRESSED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED) +#define BUTTON2_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED) +#define BUTTON2_DOUBLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED) +#define BUTTON2_TRIPLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED) + +#define BUTTON3_RELEASED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED) +#define BUTTON3_PRESSED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED) +#define BUTTON3_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED) +#define BUTTON3_DOUBLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED) +#define BUTTON3_TRIPLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED) + +#define BUTTON4_RELEASED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED) +#define BUTTON4_PRESSED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED) +#define BUTTON4_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED) +#define BUTTON4_DOUBLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED) +#define BUTTON4_TRIPLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED) + +/* + * In 32 bits the version-1 scheme does not provide enough space for a 5th + * button, unless we choose to change the ABI by omitting the reserved-events. + */ +#if NCURSES_MOUSE_VERSION > 1 + +#define BUTTON5_RELEASED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED) +#define BUTTON5_PRESSED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED) +#define BUTTON5_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED) +#define BUTTON5_DOUBLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED) +#define BUTTON5_TRIPLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED) + +#define BUTTON_CTRL NCURSES_MOUSE_MASK(6, 0001L) +#define BUTTON_SHIFT NCURSES_MOUSE_MASK(6, 0002L) +#define BUTTON_ALT NCURSES_MOUSE_MASK(6, 0004L) +#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(6, 0010L) + +#else + +#define BUTTON1_RESERVED_EVENT NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT) +#define BUTTON2_RESERVED_EVENT NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT) +#define BUTTON3_RESERVED_EVENT NCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT) +#define BUTTON4_RESERVED_EVENT NCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT) + +#define BUTTON_CTRL NCURSES_MOUSE_MASK(5, 0001L) +#define BUTTON_SHIFT NCURSES_MOUSE_MASK(5, 0002L) +#define BUTTON_ALT NCURSES_MOUSE_MASK(5, 0004L) +#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(5, 0010L) + +#endif + +#define ALL_MOUSE_EVENTS (REPORT_MOUSE_POSITION - 1) + +/* macros to extract single event-bits from masks */ +#define BUTTON_RELEASE(e, x) ((e)&NCURSES_MOUSE_MASK(x, 001)) +#define BUTTON_PRESS(e, x) ((e)&NCURSES_MOUSE_MASK(x, 002)) +#define BUTTON_CLICK(e, x) ((e)&NCURSES_MOUSE_MASK(x, 004)) +#define BUTTON_DOUBLE_CLICK(e, x) ((e)&NCURSES_MOUSE_MASK(x, 010)) +#define BUTTON_TRIPLE_CLICK(e, x) ((e)&NCURSES_MOUSE_MASK(x, 020)) +#define BUTTON_RESERVED_EVENT(e, x) ((e)&NCURSES_MOUSE_MASK(x, 040)) + +typedef struct { + short id; /* ID to distinguish multiple devices */ + int x, y, z; /* event coordinates (character-cell) */ + mmask_t bstate; /* button state bits */ +} MEVENT; + +extern NCURSES_EXPORT(bool) has_mouse(void); +extern NCURSES_EXPORT(int) getmouse(MEVENT*); +extern NCURSES_EXPORT(int) ungetmouse(MEVENT*); +extern NCURSES_EXPORT(mmask_t) mousemask(mmask_t, mmask_t*); +extern NCURSES_EXPORT(bool) wenclose(const WINDOW*, int, int); +extern NCURSES_EXPORT(int) mouseinterval(int); +extern NCURSES_EXPORT(bool) wmouse_trafo(const WINDOW*, int*, int*, bool); +extern NCURSES_EXPORT(bool) mouse_trafo(int*, int*, bool); /* generated */ + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_mouse)(SCREEN*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(getmouse)(SCREEN*, MEVENT*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetmouse)(SCREEN*, MEVENT*); +extern NCURSES_EXPORT(mmask_t) + NCURSES_SP_NAME(mousemask)(SCREEN*, mmask_t, mmask_t*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mouseinterval)(SCREEN*, int); +#endif + +#ifndef NCURSES_NOMACROS +#define mouse_trafo(y, x, to_screen) wmouse_trafo(stdscr, y, x, to_screen) +#endif + +/* other non-XSI functions */ + +extern NCURSES_EXPORT(int) mcprint(char*, int); /* direct data to printer */ +extern NCURSES_EXPORT(int) has_key(int); /* do we have given key? */ + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(has_key)(SCREEN*, int); /* do we have given key? */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(mcprint)(SCREEN*, char*, int); /* direct data to printer */ +#endif + +/* Debugging : use with libncurses_g.a */ + +extern NCURSES_EXPORT(void) _tracef(const char*, ...) GCC_PRINTFLIKE(1, 2); +extern NCURSES_EXPORT(char*) _traceattr(attr_t); +extern NCURSES_EXPORT(char*) _traceattr2(int, chtype); +extern NCURSES_EXPORT(char*) _tracechar(int); +extern NCURSES_EXPORT(char*) _tracechtype(chtype); +extern NCURSES_EXPORT(char*) _tracechtype2(int, chtype); +#if NCURSES_WIDECHAR +#define _tracech_t _tracecchar_t +extern NCURSES_EXPORT(char*) _tracecchar_t(const cchar_t*); +#define _tracech_t2 _tracecchar_t2 +extern NCURSES_EXPORT(char*) _tracecchar_t2(int, const cchar_t*); +#else +#define _tracech_t _tracechtype +#define _tracech_t2 _tracechtype2 +#endif +extern NCURSES_EXPORT(void) trace(const unsigned int); + +/* trace masks */ +#define TRACE_DISABLE 0x0000 /* turn off tracing */ +#define TRACE_TIMES 0x0001 /* trace user and system times of updates */ +#define TRACE_TPUTS 0x0002 /* trace tputs calls */ +#define TRACE_UPDATE 0x0004 /* trace update actions, old & new screens */ +#define TRACE_MOVE 0x0008 /* trace cursor moves and scrolls */ +#define TRACE_CHARPUT 0x0010 /* trace all character outputs */ +#define TRACE_ORDINARY 0x001F /* trace all update actions */ +#define TRACE_CALLS 0x0020 /* trace all curses calls */ +#define TRACE_VIRTPUT 0x0040 /* trace virtual character puts */ +#define TRACE_IEVENT 0x0080 /* trace low-level input processing */ +#define TRACE_BITS 0x0100 /* trace state of TTY control bits */ +#define TRACE_ICALLS 0x0200 /* trace internal/nested calls */ +#define TRACE_CCALLS 0x0400 /* trace per-character calls */ +#define TRACE_DATABASE 0x0800 /* trace read/write of terminfo/termcap data */ +#define TRACE_ATTRS 0x1000 /* trace attribute updates */ + +#define TRACE_SHIFT 13 /* number of bits in the trace masks */ +#define TRACE_MAXIMUM ((1 << TRACE_SHIFT) - 1) /* maximum trace level */ + +#if defined(TRACE) || defined(NCURSES_TEST) +extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable; /* enable optimizations */ +extern NCURSES_EXPORT(const char*) _nc_visbuf(const char*); +#define OPTIMIZE_MVCUR 0x01 /* cursor movement optimization */ +#define OPTIMIZE_HASHMAP 0x02 /* diff hashing to detect scrolls */ +#define OPTIMIZE_SCROLL 0x04 /* scroll optimization */ +#define OPTIMIZE_ALL 0xff /* enable all optimizations (dflt) */ +#endif + +#include + +#ifdef __cplusplus + +#ifndef NCURSES_NOMACROS + +/* these names conflict with STL */ +#undef box +#undef clear +#undef erase +#undef move +#undef refresh + +#endif /* NCURSES_NOMACROS */ +} +#endif + +#endif /* __NCURSES_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/curses.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/curses.h new file mode 100644 index 0000000..1512dc4 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/curses.h @@ -0,0 +1,2456 @@ +/**************************************************************************** + * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* $Id: curses.h.in,v 1.257 2017/11/21 00:11:37 tom Exp $ */ + +#ifndef __NCURSES_H +#define __NCURSES_H + +#define CURSES 1 +#define CURSES_H 1 + +/* These are defined only in curses.h, and are used for conditional compiles */ +#define NCURSES_VERSION_MAJOR 6 +#define NCURSES_VERSION_MINOR 1 +#define NCURSES_VERSION_PATCH 20180127 + +/* This is defined in more than one ncurses header, for identification */ +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.1" + +/* + * Identify the mouse encoding version. + */ +#define NCURSES_MOUSE_VERSION 2 + +/* + * Definitions to facilitate DLL's. + */ +#include + +#if 1 +#include +#endif + +/* + * User-definable tweak to disable the include of . + */ +#ifndef NCURSES_ENABLE_STDBOOL_H +#define NCURSES_ENABLE_STDBOOL_H 1 +#endif + +/* + * NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses + * configured using --disable-macros. + */ +#ifndef NCURSES_ATTR_T +#define NCURSES_ATTR_T int +#endif + +/* + * Expands to 'const' if ncurses is configured using --enable-const. Note that + * doing so makes it incompatible with other implementations of X/Open Curses. + */ +#undef NCURSES_CONST +#define NCURSES_CONST const + +#undef NCURSES_INLINE +#define NCURSES_INLINE inline + +/* + * The standard type used for color values, and for color-pairs. The latter + * allows the curses library to enumerate the combinations of foreground and + * background colors used by an application, and is normally the product of the + * total foreground and background colors. + * + * X/Open uses "short" for both of these types, ultimately because they are + * numbers from the SVr4 terminal database, which uses 16-bit signed values. + */ +#undef NCURSES_COLOR_T +#define NCURSES_COLOR_T short + +#undef NCURSES_PAIRS_T +#define NCURSES_PAIRS_T short + +/* + * Definitions used to make WINDOW and similar structs opaque. + */ +#ifndef NCURSES_INTERNALS +#define NCURSES_OPAQUE 0 +#define NCURSES_OPAQUE_FORM 0 +#define NCURSES_OPAQUE_MENU 0 +#define NCURSES_OPAQUE_PANEL 0 +#endif + +/* + * Definition used to optionally suppress wattr* macros to help with the + * transition from ncurses5 to ncurses6 by allowing the header files to + * be shared across development packages for ncursesw in both ABIs. + */ +#ifndef NCURSES_WATTR_MACROS +#define NCURSES_WATTR_MACROS 1 +#endif + +/* + * The reentrant code relies on the opaque setting, but adds features. + */ +#ifndef NCURSES_REENTRANT +#define NCURSES_REENTRANT 0 +#endif + +/* + * Control whether bindings for interop support are added. + */ +#undef NCURSES_INTEROP_FUNCS +#define NCURSES_INTEROP_FUNCS 1 + +/* + * The internal type used for window dimensions. + */ +#undef NCURSES_SIZE_T +#define NCURSES_SIZE_T short + +/* + * Control whether tparm() supports varargs or fixed-parameter list. + */ +#undef NCURSES_TPARM_VARARGS +#define NCURSES_TPARM_VARARGS 1 + +/* + * Control type used for tparm's arguments. While X/Open equates long and + * char* values, this is not always workable for 64-bit platforms. + */ +#undef NCURSES_TPARM_ARG +#define NCURSES_TPARM_ARG intptr_t + +/* + * Control whether ncurses uses wcwidth() for checking width of line-drawing + * characters. + */ +#undef NCURSES_WCWIDTH_GRAPHICS +#define NCURSES_WCWIDTH_GRAPHICS 1 + +/* + * NCURSES_CH_T is used in building the library, but not used otherwise in + * this header file, since that would make the normal/wide-character versions + * of the header incompatible. + */ +#undef NCURSES_CH_T +#define NCURSES_CH_T cchar_t + +#if 1 && defined(_LP64) +typedef unsigned chtype; +typedef unsigned mmask_t; +#else +typedef uint32_t chtype; +typedef uint32_t mmask_t; +#endif + +/* + * We need FILE, etc. Include this before checking any feature symbols. + */ +#include + +/* + * With XPG4, you must define _XOPEN_SOURCE_EXTENDED, it is redundant (or + * conflicting) when _XOPEN_SOURCE is 500 or greater. If NCURSES_WIDECHAR is + * not already defined, e.g., if the platform relies upon nonstandard feature + * test macros, define it at this point if the standard feature test macros + * indicate that it should be defined. + */ +#ifndef NCURSES_WIDECHAR +#if defined(_XOPEN_SOURCE_EXTENDED) || \ + (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 >= 500)) +#define NCURSES_WIDECHAR 1 +#else +#define NCURSES_WIDECHAR 0 +#endif +#endif /* NCURSES_WIDECHAR */ + +#include /* we need va_list */ +#if NCURSES_WIDECHAR +#include /* we want wchar_t */ +#endif + +/* X/Open and SVr4 specify that curses implements 'bool'. However, C++ may also + * implement it. If so, we must use the C++ compiler's type to avoid conflict + * with other interfaces. + * + * A further complication is that may declare 'bool' to be a + * different type, such as an enum which is not necessarily compatible with + * C++. If we have , make 'bool' a macro, so users may #undef it. + * Otherwise, let it remain a typedef to avoid conflicts with other #define's. + * In either case, make a typedef for NCURSES_BOOL which can be used if needed + * from either C or C++. + */ + +#undef TRUE +#define TRUE 1 + +#undef FALSE +#define FALSE 0 + +typedef unsigned char NCURSES_BOOL; + +#if defined(__cplusplus) /* __cplusplus, etc. */ + +/* use the C++ compiler's bool type */ +#define NCURSES_BOOL bool + +#else /* c89, c99, etc. */ + +#if NCURSES_ENABLE_STDBOOL_H +#include +/* use whatever the C compiler decides bool really is */ +#define NCURSES_BOOL bool +#else +/* there is no predefined bool - use our own */ +#undef bool +#define bool NCURSES_BOOL +#endif + +#endif /* !__cplusplus, etc. */ + +#ifdef __cplusplus +extern "C" { +#define NCURSES_CAST(type, value) static_cast(value) +#else +#define NCURSES_CAST(type, value) (type)(value) +#endif + +#define NCURSES_OK_ADDR(p) (0 != NCURSES_CAST(const void*, (p))) + +/* + * X/Open attributes. In the ncurses implementation, they are identical to the + * A_ attributes. + */ +#define WA_ATTRIBUTES A_ATTRIBUTES +#define WA_NORMAL A_NORMAL +#define WA_STANDOUT A_STANDOUT +#define WA_UNDERLINE A_UNDERLINE +#define WA_REVERSE A_REVERSE +#define WA_BLINK A_BLINK +#define WA_DIM A_DIM +#define WA_BOLD A_BOLD +#define WA_ALTCHARSET A_ALTCHARSET +#define WA_INVIS A_INVIS +#define WA_PROTECT A_PROTECT +#define WA_HORIZONTAL A_HORIZONTAL +#define WA_LEFT A_LEFT +#define WA_LOW A_LOW +#define WA_RIGHT A_RIGHT +#define WA_TOP A_TOP +#define WA_VERTICAL A_VERTICAL + +#if 1 +#define WA_ITALIC A_ITALIC /* ncurses extension */ +#endif + +/* colors */ +#define COLOR_BLACK 0 +#define COLOR_RED 1 +#define COLOR_GREEN 2 +#define COLOR_YELLOW 3 +#define COLOR_BLUE 4 +#define COLOR_MAGENTA 5 +#define COLOR_CYAN 6 +#define COLOR_WHITE 7 + +/* line graphics */ + +#if 0 || NCURSES_REENTRANT +NCURSES_WRAPPED_VAR(chtype*, acs_map); +#define acs_map NCURSES_PUBLIC_VAR(acs_map()) +#else +extern NCURSES_EXPORT_VAR(chtype) acs_map[]; +#endif + +#define NCURSES_ACS(c) (acs_map[NCURSES_CAST(unsigned char, (c))]) + +/* VT100 symbols begin here */ +#define ACS_ULCORNER NCURSES_ACS('l') /* upper left corner */ +#define ACS_LLCORNER NCURSES_ACS('m') /* lower left corner */ +#define ACS_URCORNER NCURSES_ACS('k') /* upper right corner */ +#define ACS_LRCORNER NCURSES_ACS('j') /* lower right corner */ +#define ACS_LTEE NCURSES_ACS('t') /* tee pointing right */ +#define ACS_RTEE NCURSES_ACS('u') /* tee pointing left */ +#define ACS_BTEE NCURSES_ACS('v') /* tee pointing up */ +#define ACS_TTEE NCURSES_ACS('w') /* tee pointing down */ +#define ACS_HLINE NCURSES_ACS('q') /* horizontal line */ +#define ACS_VLINE NCURSES_ACS('x') /* vertical line */ +#define ACS_PLUS NCURSES_ACS('n') /* large plus or crossover */ +#define ACS_S1 NCURSES_ACS('o') /* scan line 1 */ +#define ACS_S9 NCURSES_ACS('s') /* scan line 9 */ +#define ACS_DIAMOND NCURSES_ACS('`') /* diamond */ +#define ACS_CKBOARD NCURSES_ACS('a') /* checker board (stipple) */ +#define ACS_DEGREE NCURSES_ACS('f') /* degree symbol */ +#define ACS_PLMINUS NCURSES_ACS('g') /* plus/minus */ +#define ACS_BULLET NCURSES_ACS('~') /* bullet */ +/* Teletype 5410v1 symbols begin here */ +#define ACS_LARROW NCURSES_ACS(',') /* arrow pointing left */ +#define ACS_RARROW NCURSES_ACS('+') /* arrow pointing right */ +#define ACS_DARROW NCURSES_ACS('.') /* arrow pointing down */ +#define ACS_UARROW NCURSES_ACS('-') /* arrow pointing up */ +#define ACS_BOARD NCURSES_ACS('h') /* board of squares */ +#define ACS_LANTERN NCURSES_ACS('i') /* lantern symbol */ +#define ACS_BLOCK NCURSES_ACS('0') /* solid square block */ +/* + * These aren't documented, but a lot of System Vs have them anyway + * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings). + * The ACS_names may not match AT&T's, our source didn't know them. + */ +#define ACS_S3 NCURSES_ACS('p') /* scan line 3 */ +#define ACS_S7 NCURSES_ACS('r') /* scan line 7 */ +#define ACS_LEQUAL NCURSES_ACS('y') /* less/equal */ +#define ACS_GEQUAL NCURSES_ACS('z') /* greater/equal */ +#define ACS_PI NCURSES_ACS('{') /* Pi */ +#define ACS_NEQUAL NCURSES_ACS('|') /* not equal */ +#define ACS_STERLING NCURSES_ACS('}') /* UK pound sign */ + +/* + * Line drawing ACS names are of the form ACS_trbl, where t is the top, r + * is the right, b is the bottom, and l is the left. t, r, b, and l might + * be B (blank), S (single), D (double), or T (thick). The subset defined + * here only uses B and S. + */ +#define ACS_BSSB ACS_ULCORNER +#define ACS_SSBB ACS_LLCORNER +#define ACS_BBSS ACS_URCORNER +#define ACS_SBBS ACS_LRCORNER +#define ACS_SBSS ACS_RTEE +#define ACS_SSSB ACS_LTEE +#define ACS_SSBS ACS_BTEE +#define ACS_BSSS ACS_TTEE +#define ACS_BSBS ACS_HLINE +#define ACS_SBSB ACS_VLINE +#define ACS_SSSS ACS_PLUS + +#undef ERR +#define ERR (-1) + +#undef OK +#define OK (0) + +/* values for the _flags member */ +#define _SUBWIN 0x01 /* is this a sub-window? */ +#define _ENDLINE 0x02 /* is the window flush right? */ +#define _FULLWIN 0x04 /* is the window full-screen? */ +#define _SCROLLWIN 0x08 /* bottom edge is at screen bottom? */ +#define _ISPAD 0x10 /* is this window a pad? */ +#define _HASMOVED 0x20 /* has cursor moved since last refresh? */ +#define _WRAPPED 0x40 /* cursor was just wrappped */ + +/* + * this value is used in the firstchar and lastchar fields to mark + * unchanged lines + */ +#define _NOCHANGE -1 + +/* + * this value is used in the oldindex field to mark lines created by insertions + * and scrolls. + */ +#define _NEWINDEX -1 + +typedef struct screen SCREEN; +typedef struct _win_st WINDOW; + +typedef chtype attr_t; /* ...must be at least as wide as chtype */ + +#if NCURSES_WIDECHAR + +#if 0 +#ifdef mblen /* libutf8.h defines it w/o undefining first */ +#undef mblen +#endif +#include +#endif + +#if 1 +#include /* ...to get mbstate_t, etc. */ +#endif + +#if 0 +typedef unsigned short wchar_t1; +#endif + +#if 0 +typedef unsigned int wint_t1; +#endif + +/* + * cchar_t stores an array of CCHARW_MAX wide characters. The first is + * normally a spacing character. The others are non-spacing. If those + * (spacing and nonspacing) do not fill the array, a null L'\0' follows. + * Otherwise, a null is assumed to follow when extracting via getcchar(). + */ +#define CCHARW_MAX 5 +typedef struct { + attr_t attr; + wchar_t chars[CCHARW_MAX]; +#if 1 +#undef NCURSES_EXT_COLORS +#define NCURSES_EXT_COLORS 20180127 + int ext_color; /* color pair, must be more than 16-bits */ +#endif +} cchar_t; + +#endif /* NCURSES_WIDECHAR */ + +#if !NCURSES_OPAQUE +struct ldat; + +struct _win_st { + NCURSES_SIZE_T _cury, _curx; /* current cursor position */ + + /* window location and size */ + NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */ + NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */ + + short _flags; /* window state flags */ + + /* attribute tracking */ + attr_t _attrs; /* current attribute for non-space character */ + chtype _bkgd; /* current background char/attribute pair */ + + /* option values set by user */ + bool _notimeout; /* no time out on function-key entry? */ + bool _clear; /* consider all data in the window invalid? */ + bool _leaveok; /* OK to not reset cursor on exit? */ + bool _scroll; /* OK to scroll this window? */ + bool _idlok; /* OK to use insert/delete line? */ + bool _idcok; /* OK to use insert/delete char? */ + bool _immed; /* window in immed mode? (not yet used) */ + bool _sync; /* window in sync mode? */ + bool _use_keypad; /* process function keys into KEY_ symbols? */ + int _delay; /* 0 = nodelay, <0 = blocking, >0 = delay */ + + struct ldat* _line; /* the actual line data */ + + /* global screen state */ + NCURSES_SIZE_T _regtop; /* top line of scrolling region */ + NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */ + + /* these are used only if this is a sub-window */ + int _parx; /* x coordinate of this window in parent */ + int _pary; /* y coordinate of this window in parent */ + WINDOW* _parent; /* pointer to parent if a sub-window */ + + /* these are used only if this is a pad */ + struct pdat { + NCURSES_SIZE_T _pad_y, _pad_x; + NCURSES_SIZE_T _pad_top, _pad_left; + NCURSES_SIZE_T _pad_bottom, _pad_right; + } _pad; + + NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */ + +#if NCURSES_WIDECHAR + cchar_t _bkgrnd; /* current background char/attribute pair */ +#if 1 + int _color; /* current color-pair for non-space character */ +#endif +#endif +}; +#endif /* NCURSES_OPAQUE */ + +/* + * This is an extension to support events... + */ +#if 1 +#ifdef NCURSES_WGETCH_EVENTS +#if !defined(__BEOS__) || defined(__HAIKU__) +/* Fix _nc_timed_wait() on BEOS... */ +#define NCURSES_EVENT_VERSION 1 +#endif /* !defined(__BEOS__) */ + +/* + * Bits to set in _nc_event.data.flags + */ +#define _NC_EVENT_TIMEOUT_MSEC 1 +#define _NC_EVENT_FILE 2 +#define _NC_EVENT_FILE_READABLE 2 +#if 0 /* Not supported yet... */ +#define _NC_EVENT_FILE_WRITABLE 4 +#define _NC_EVENT_FILE_EXCEPTION 8 +#endif + +typedef struct { + int type; + union { + long timeout_msec; /* _NC_EVENT_TIMEOUT_MSEC */ + struct { + unsigned int flags; + int fd; + unsigned int result; + } fev; /* _NC_EVENT_FILE */ + } data; +} _nc_event; + +typedef struct { + int count; + int result_flags; /* _NC_EVENT_TIMEOUT_MSEC or _NC_EVENT_FILE_READABLE */ + _nc_event* events[1]; +} _nc_eventlist; + +extern NCURSES_EXPORT(int) + wgetch_events(WINDOW*, _nc_eventlist*); /* experimental */ +extern NCURSES_EXPORT(int) + wgetnstr_events(WINDOW*, char*, int, _nc_eventlist*); /* experimental */ + +#endif /* NCURSES_WGETCH_EVENTS */ +#endif /* NCURSES_EXT_FUNCS */ + +/* + * GCC (and some other compilers) define '__attribute__'; we're using this + * macro to alert the compiler to flag inconsistencies in printf/scanf-like + * function calls. Just in case '__attribute__' isn't defined, make a dummy. + * Old versions of G++ do not accept it anyway, at least not consistently with + * GCC. + */ +#if !(defined(__GNUC__) || defined(__GNUG__) || defined(__attribute__)) +#define __attribute__(p) /* nothing */ +#endif + +/* + * We cannot define these in ncurses_cfg.h, since they require parameters to be + * passed (that is non-portable). If you happen to be using gcc with warnings + * enabled, define + * GCC_PRINTF + * GCC_SCANF + * to improve checking of calls to printw(), etc. + */ +#ifndef GCC_PRINTFLIKE +#if defined(GCC_PRINTF) && !defined(printf) +#define GCC_PRINTFLIKE(fmt, var) __attribute__((format(printf, fmt, var))) +#else +#define GCC_PRINTFLIKE(fmt, var) /*nothing*/ +#endif +#endif + +#ifndef GCC_SCANFLIKE +#if defined(GCC_SCANF) && !defined(scanf) +#define GCC_SCANFLIKE(fmt, var) __attribute__((format(scanf, fmt, var))) +#else +#define GCC_SCANFLIKE(fmt, var) /*nothing*/ +#endif +#endif + +#ifndef GCC_NORETURN +#define GCC_NORETURN /* nothing */ +#endif + +#ifndef GCC_UNUSED +#define GCC_UNUSED /* nothing */ +#endif + +/* + * Curses uses a helper function. Define our type for this to simplify + * extending it for the sp-funcs feature. + */ +typedef int (*NCURSES_OUTC)(int); + +/* + * Function prototypes. This is the complete X/Open Curses list of required + * functions. Those marked `generated' will have sources generated from the + * macro definitions later in this file, in order to satisfy XPG4.2 + * requirements. + */ + +extern NCURSES_EXPORT(int) addch(const chtype); /* generated */ +extern NCURSES_EXPORT(int) addchnstr(const chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) addchstr(const chtype*); /* generated */ +extern NCURSES_EXPORT(int) addnstr(const char*, int); /* generated */ +extern NCURSES_EXPORT(int) addstr(const char*); /* generated */ +extern NCURSES_EXPORT(int) attroff(NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attron(NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attrset(NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) + attr_get(attr_t*, NCURSES_PAIRS_T*, void*); /* generated */ +extern NCURSES_EXPORT(int) attr_off(attr_t, void*); /* generated */ +extern NCURSES_EXPORT(int) attr_on(attr_t, void*); /* generated */ +extern NCURSES_EXPORT(int) + attr_set(attr_t, NCURSES_PAIRS_T, void*); /* generated */ +extern NCURSES_EXPORT(int) baudrate(void); /* implemented */ +extern NCURSES_EXPORT(int) beep(void); /* implemented */ +extern NCURSES_EXPORT(int) bkgd(chtype); /* generated */ +extern NCURSES_EXPORT(void) bkgdset(chtype); /* generated */ +extern NCURSES_EXPORT(int) border( + chtype, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype); /* generated */ +extern NCURSES_EXPORT(int) box(WINDOW*, chtype, chtype); /* generated */ +extern NCURSES_EXPORT(bool) can_change_color(void); /* implemented */ +extern NCURSES_EXPORT(int) cbreak(void); /* implemented */ +extern NCURSES_EXPORT(int) + chgat(int, attr_t, NCURSES_PAIRS_T, const void*); /* generated */ +extern NCURSES_EXPORT(int) clear(void); /* generated */ +extern NCURSES_EXPORT(int) clearok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) clrtobot(void); /* generated */ +extern NCURSES_EXPORT(int) clrtoeol(void); /* generated */ +extern NCURSES_EXPORT(int) color_content( + NCURSES_COLOR_T, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*); /* implemented */ +extern NCURSES_EXPORT(int) color_set(NCURSES_PAIRS_T, void*); /* generated */ +extern NCURSES_EXPORT(int) COLOR_PAIR(int); /* generated */ +extern NCURSES_EXPORT(int) copywin( + const WINDOW*, + WINDOW*, + int, + int, + int, + int, + int, + int, + int); /* implemented */ +extern NCURSES_EXPORT(int) curs_set(int); /* implemented */ +extern NCURSES_EXPORT(int) def_prog_mode(void); /* implemented */ +extern NCURSES_EXPORT(int) def_shell_mode(void); /* implemented */ +extern NCURSES_EXPORT(int) delay_output(int); /* implemented */ +extern NCURSES_EXPORT(int) delch(void); /* generated */ +extern NCURSES_EXPORT(void) delscreen(SCREEN*); /* implemented */ +extern NCURSES_EXPORT(int) delwin(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) deleteln(void); /* generated */ +extern NCURSES_EXPORT(WINDOW*) + derwin(WINDOW*, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) doupdate(void); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) dupwin(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) echo(void); /* implemented */ +extern NCURSES_EXPORT(int) echochar(const chtype); /* generated */ +extern NCURSES_EXPORT(int) erase(void); /* generated */ +extern NCURSES_EXPORT(int) endwin(void); /* implemented */ +extern NCURSES_EXPORT(char) erasechar(void); /* implemented */ +extern NCURSES_EXPORT(void) filter(void); /* implemented */ +extern NCURSES_EXPORT(int) flash(void); /* implemented */ +extern NCURSES_EXPORT(int) flushinp(void); /* implemented */ +extern NCURSES_EXPORT(chtype) getbkgd(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getch(void); /* generated */ +extern NCURSES_EXPORT(int) getnstr(char*, int); /* generated */ +extern NCURSES_EXPORT(int) getstr(char*); /* generated */ +extern NCURSES_EXPORT(WINDOW*) getwin(FILE*); /* implemented */ +extern NCURSES_EXPORT(int) halfdelay(int); /* implemented */ +extern NCURSES_EXPORT(bool) has_colors(void); /* implemented */ +extern NCURSES_EXPORT(bool) has_ic(void); /* implemented */ +extern NCURSES_EXPORT(bool) has_il(void); /* implemented */ +extern NCURSES_EXPORT(int) hline(chtype, int); /* generated */ +extern NCURSES_EXPORT(void) idcok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) idlok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(void) immedok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) inch(void); /* generated */ +extern NCURSES_EXPORT(int) inchnstr(chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) inchstr(chtype*); /* generated */ +extern NCURSES_EXPORT(WINDOW*) initscr(void); /* implemented */ +extern NCURSES_EXPORT(int) init_color( + NCURSES_COLOR_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T); /* implemented */ +extern NCURSES_EXPORT(int) init_pair( + NCURSES_PAIRS_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T); /* implemented */ +extern NCURSES_EXPORT(int) innstr(char*, int); /* generated */ +extern NCURSES_EXPORT(int) insch(chtype); /* generated */ +extern NCURSES_EXPORT(int) insdelln(int); /* generated */ +extern NCURSES_EXPORT(int) insertln(void); /* generated */ +extern NCURSES_EXPORT(int) insnstr(const char*, int); /* generated */ +extern NCURSES_EXPORT(int) insstr(const char*); /* generated */ +extern NCURSES_EXPORT(int) instr(char*); /* generated */ +extern NCURSES_EXPORT(int) intrflush(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(bool) isendwin(void); /* implemented */ +extern NCURSES_EXPORT(bool) is_linetouched(WINDOW*, int); /* implemented */ +extern NCURSES_EXPORT(bool) is_wintouched(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(NCURSES_CONST char*) keyname(int); /* implemented */ +extern NCURSES_EXPORT(int) keypad(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(char) killchar(void); /* implemented */ +extern NCURSES_EXPORT(int) leaveok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(char*) longname(void); /* implemented */ +extern NCURSES_EXPORT(int) meta(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) move(int, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddch(int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) + mvaddchnstr(int, int, const chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddchstr(int, int, const chtype*); /* generated */ +extern NCURSES_EXPORT(int) + mvaddnstr(int, int, const char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddstr(int, int, const char*); /* generated */ +extern NCURSES_EXPORT(int) + mvchgat(int, int, int, attr_t, NCURSES_PAIRS_T, const void*); /* generated + */ +extern NCURSES_EXPORT(int) mvcur(int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) mvdelch(int, int); /* generated */ +extern NCURSES_EXPORT(int) mvderwin(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(int) mvgetch(int, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetnstr(int, int, char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetstr(int, int, char*); /* generated */ +extern NCURSES_EXPORT(int) mvhline(int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(chtype) mvinch(int, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchnstr(int, int, chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchstr(int, int, chtype*); /* generated */ +extern NCURSES_EXPORT(int) mvinnstr(int, int, char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsch(int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) + mvinsnstr(int, int, const char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsstr(int, int, const char*); /* generated */ +extern NCURSES_EXPORT(int) mvinstr(int, int, char*); /* generated */ +extern NCURSES_EXPORT(int) + mvprintw(int, int, const char*, ...) /* implemented */ + GCC_PRINTFLIKE(3, 4); +extern NCURSES_EXPORT(int) + mvscanw(int, int, NCURSES_CONST char*, ...) /* implemented */ + GCC_SCANFLIKE(3, 4); +extern NCURSES_EXPORT(int) mvvline(int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddch(WINDOW*, int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddchnstr(WINDOW*, int, int, const chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddchstr(WINDOW*, int, int, const chtype*); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddnstr(WINDOW*, int, int, const char*, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddstr(WINDOW*, int, int, const char*); /* generated */ +extern NCURSES_EXPORT(int) mvwchgat( + WINDOW*, + int, + int, + int, + attr_t, + NCURSES_PAIRS_T, + const void*); /* generated */ +extern NCURSES_EXPORT(int) mvwdelch(WINDOW*, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetch(WINDOW*, int, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwgetnstr(WINDOW*, int, int, char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetstr(WINDOW*, int, int, char*); /* generated */ +extern NCURSES_EXPORT(int) + mvwhline(WINDOW*, int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvwin(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(chtype) mvwinch(WINDOW*, int, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwinchnstr(WINDOW*, int, int, chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwinchstr(WINDOW*, int, int, chtype*); /* generated */ +extern NCURSES_EXPORT(int) + mvwinnstr(WINDOW*, int, int, char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinsch(WINDOW*, int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) + mvwinsnstr(WINDOW*, int, int, const char*, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwinsstr(WINDOW*, int, int, const char*); /* generated */ +extern NCURSES_EXPORT(int) mvwinstr(WINDOW*, int, int, char*); /* generated */ +extern NCURSES_EXPORT(int) + mvwprintw(WINDOW*, int, int, const char*, ...) /* implemented */ + GCC_PRINTFLIKE(4, 5); +extern NCURSES_EXPORT(int) + mvwscanw(WINDOW*, int, int, NCURSES_CONST char*, ...) /* implemented */ + GCC_SCANFLIKE(4, 5); +extern NCURSES_EXPORT(int) + mvwvline(WINDOW*, int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) napms(int); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) newpad(int, int); /* implemented */ +extern NCURSES_EXPORT(SCREEN*) + newterm(NCURSES_CONST char*, FILE*, FILE*); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) newwin(int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) nl(void); /* implemented */ +extern NCURSES_EXPORT(int) nocbreak(void); /* implemented */ +extern NCURSES_EXPORT(int) nodelay(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) noecho(void); /* implemented */ +extern NCURSES_EXPORT(int) nonl(void); /* implemented */ +extern NCURSES_EXPORT(void) noqiflush(void); /* implemented */ +extern NCURSES_EXPORT(int) noraw(void); /* implemented */ +extern NCURSES_EXPORT(int) notimeout(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) overlay(const WINDOW*, WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) overwrite(const WINDOW*, WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) pair_content( + NCURSES_PAIRS_T, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*); /* implemented */ +extern NCURSES_EXPORT(int) PAIR_NUMBER(int); /* generated */ +extern NCURSES_EXPORT(int) pechochar(WINDOW*, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) + pnoutrefresh(WINDOW*, int, int, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) + prefresh(WINDOW*, int, int, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) printw(const char*, ...) /* implemented */ + GCC_PRINTFLIKE(1, 2); +extern NCURSES_EXPORT(int) putwin(WINDOW*, FILE*); /* implemented */ +extern NCURSES_EXPORT(void) qiflush(void); /* implemented */ +extern NCURSES_EXPORT(int) raw(void); /* implemented */ +extern NCURSES_EXPORT(int) redrawwin(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) refresh(void); /* generated */ +extern NCURSES_EXPORT(int) resetty(void); /* implemented */ +extern NCURSES_EXPORT(int) reset_prog_mode(void); /* implemented */ +extern NCURSES_EXPORT(int) reset_shell_mode(void); /* implemented */ +extern NCURSES_EXPORT(int) + ripoffline(int, int (*)(WINDOW*, int)); /* implemented */ +extern NCURSES_EXPORT(int) savetty(void); /* implemented */ +extern NCURSES_EXPORT(int) scanw(NCURSES_CONST char*, ...) /* implemented */ + GCC_SCANFLIKE(1, 2); +extern NCURSES_EXPORT(int) scr_dump(const char*); /* implemented */ +extern NCURSES_EXPORT(int) scr_init(const char*); /* implemented */ +extern NCURSES_EXPORT(int) scrl(int); /* generated */ +extern NCURSES_EXPORT(int) scroll(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) scrollok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) scr_restore(const char*); /* implemented */ +extern NCURSES_EXPORT(int) scr_set(const char*); /* implemented */ +extern NCURSES_EXPORT(int) setscrreg(int, int); /* generated */ +extern NCURSES_EXPORT(SCREEN*) set_term(SCREEN*); /* implemented */ +extern NCURSES_EXPORT(int) slk_attroff(const chtype); /* implemented */ +extern NCURSES_EXPORT(int) + slk_attr_off(const attr_t, void*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attron(const chtype); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_on(attr_t, void*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attrset(const chtype); /* implemented */ +extern NCURSES_EXPORT(attr_t) slk_attr(void); /* implemented */ +extern NCURSES_EXPORT(int) + slk_attr_set(const attr_t, NCURSES_PAIRS_T, void*); /* implemented */ +extern NCURSES_EXPORT(int) slk_clear(void); /* implemented */ +extern NCURSES_EXPORT(int) slk_color(NCURSES_PAIRS_T); /* implemented */ +extern NCURSES_EXPORT(int) slk_init(int); /* implemented */ +extern NCURSES_EXPORT(char*) slk_label(int); /* implemented */ +extern NCURSES_EXPORT(int) slk_noutrefresh(void); /* implemented */ +extern NCURSES_EXPORT(int) slk_refresh(void); /* implemented */ +extern NCURSES_EXPORT(int) slk_restore(void); /* implemented */ +extern NCURSES_EXPORT(int) slk_set(int, const char*, int); /* implemented */ +extern NCURSES_EXPORT(int) slk_touch(void); /* implemented */ +extern NCURSES_EXPORT(int) standout(void); /* generated */ +extern NCURSES_EXPORT(int) standend(void); /* generated */ +extern NCURSES_EXPORT(int) start_color(void); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) + subpad(WINDOW*, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) + subwin(WINDOW*, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) syncok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) termattrs(void); /* implemented */ +extern NCURSES_EXPORT(char*) termname(void); /* implemented */ +extern NCURSES_EXPORT(void) timeout(int); /* generated */ +extern NCURSES_EXPORT(int) touchline(WINDOW*, int, int); /* generated */ +extern NCURSES_EXPORT(int) touchwin(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) typeahead(int); /* implemented */ +extern NCURSES_EXPORT(int) ungetch(int); /* implemented */ +extern NCURSES_EXPORT(int) untouchwin(WINDOW*); /* generated */ +extern NCURSES_EXPORT(void) use_env(bool); /* implemented */ +extern NCURSES_EXPORT(void) use_tioctl(bool); /* implemented */ +extern NCURSES_EXPORT(int) vidattr(chtype); /* implemented */ +extern NCURSES_EXPORT(int) vidputs(chtype, NCURSES_OUTC); /* implemented */ +extern NCURSES_EXPORT(int) vline(chtype, int); /* generated */ +extern NCURSES_EXPORT(int) + vwprintw(WINDOW*, const char*, va_list); /* implemented */ +extern NCURSES_EXPORT(int) + vw_printw(WINDOW*, const char*, va_list); /* generated */ +extern NCURSES_EXPORT(int) + vwscanw(WINDOW*, NCURSES_CONST char*, va_list); /* implemented */ +extern NCURSES_EXPORT(int) + vw_scanw(WINDOW*, NCURSES_CONST char*, va_list); /* generated */ +extern NCURSES_EXPORT(int) waddch(WINDOW*, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) + waddchnstr(WINDOW*, const chtype*, int); /* implemented */ +extern NCURSES_EXPORT(int) waddchstr(WINDOW*, const chtype*); /* generated */ +extern NCURSES_EXPORT(int) + waddnstr(WINDOW*, const char*, int); /* implemented */ +extern NCURSES_EXPORT(int) waddstr(WINDOW*, const char*); /* generated */ +extern NCURSES_EXPORT(int) wattron(WINDOW*, int); /* generated */ +extern NCURSES_EXPORT(int) wattroff(WINDOW*, int); /* generated */ +extern NCURSES_EXPORT(int) wattrset(WINDOW*, int); /* generated */ +extern NCURSES_EXPORT(int) + wattr_get(WINDOW*, attr_t*, NCURSES_PAIRS_T*, void*); /* generated */ +extern NCURSES_EXPORT(int) wattr_on(WINDOW*, attr_t, void*); /* implemented */ +extern NCURSES_EXPORT(int) wattr_off(WINDOW*, attr_t, void*); /* implemented */ +extern NCURSES_EXPORT(int) + wattr_set(WINDOW*, attr_t, NCURSES_PAIRS_T, void*); /* generated */ +extern NCURSES_EXPORT(int) wbkgd(WINDOW*, chtype); /* implemented */ +extern NCURSES_EXPORT(void) wbkgdset(WINDOW*, chtype); /* implemented */ +extern NCURSES_EXPORT(int) wborder( + WINDOW*, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype); /* implemented */ +extern NCURSES_EXPORT(int) wchgat( + WINDOW*, + int, + attr_t, + NCURSES_PAIRS_T, + const void*); /* implemented */ +extern NCURSES_EXPORT(int) wclear(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wclrtobot(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wclrtoeol(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) + wcolor_set(WINDOW*, NCURSES_PAIRS_T, void*); /* implemented */ +extern NCURSES_EXPORT(void) wcursyncup(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wdelch(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wdeleteln(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) wechochar(WINDOW*, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) werase(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wgetch(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wgetnstr(WINDOW*, char*, int); /* implemented */ +extern NCURSES_EXPORT(int) wgetstr(WINDOW*, char*); /* generated */ +extern NCURSES_EXPORT(int) whline(WINDOW*, chtype, int); /* implemented */ +extern NCURSES_EXPORT(chtype) winch(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) winchnstr(WINDOW*, chtype*, int); /* implemented */ +extern NCURSES_EXPORT(int) winchstr(WINDOW*, chtype*); /* generated */ +extern NCURSES_EXPORT(int) winnstr(WINDOW*, char*, int); /* implemented */ +extern NCURSES_EXPORT(int) winsch(WINDOW*, chtype); /* implemented */ +extern NCURSES_EXPORT(int) winsdelln(WINDOW*, int); /* implemented */ +extern NCURSES_EXPORT(int) winsertln(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) + winsnstr(WINDOW*, const char*, int); /* implemented */ +extern NCURSES_EXPORT(int) winsstr(WINDOW*, const char*); /* generated */ +extern NCURSES_EXPORT(int) winstr(WINDOW*, char*); /* generated */ +extern NCURSES_EXPORT(int) wmove(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(int) wnoutrefresh(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wprintw(WINDOW*, const char*, ...) /* implemented */ + GCC_PRINTFLIKE(2, 3); +extern NCURSES_EXPORT(int) wredrawln(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(int) wrefresh(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) + wscanw(WINDOW*, NCURSES_CONST char*, ...) /* implemented */ + GCC_SCANFLIKE(2, 3); +extern NCURSES_EXPORT(int) wscrl(WINDOW*, int); /* implemented */ +extern NCURSES_EXPORT(int) wsetscrreg(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(int) wstandout(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) wstandend(WINDOW*); /* generated */ +extern NCURSES_EXPORT(void) wsyncdown(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(void) wsyncup(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(void) wtimeout(WINDOW*, int); /* implemented */ +extern NCURSES_EXPORT(int) wtouchln(WINDOW*, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) wvline(WINDOW*, chtype, int); /* implemented */ + +/* + * These are also declared in : + */ +extern NCURSES_EXPORT(int) tigetflag(NCURSES_CONST char*); /* implemented */ +extern NCURSES_EXPORT(int) tigetnum(NCURSES_CONST char*); /* implemented */ +extern NCURSES_EXPORT(char*) tigetstr(NCURSES_CONST char*); /* implemented */ +extern NCURSES_EXPORT(int) putp(const char*); /* implemented */ + +#if NCURSES_TPARM_VARARGS +extern NCURSES_EXPORT(char*) tparm(NCURSES_CONST char*, ...); /* special */ +#else +extern NCURSES_EXPORT(char*) tparm( + NCURSES_CONST char*, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG); /* special */ +extern NCURSES_EXPORT(char*) + tparm_varargs(NCURSES_CONST char*, ...); /* special */ +#endif + +extern NCURSES_EXPORT(char*) tiparm(const char*, ...); /* special */ + +/* + * X/Open says this returns a bool; SVr4 also checked for out-of-range line. + * The macro provides compatibility: + */ +#define is_linetouched(w, l) \ + ((!(w) || ((l) > getmaxy(w)) || ((l) < 0)) ? ERR : (is_linetouched)((w), (l))) + +/* + * These functions are not in X/Open, but we use them in macro definitions: + */ +extern NCURSES_EXPORT(int) getattrs(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getcurx(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getcury(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getbegx(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getbegy(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getmaxx(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getmaxy(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getparx(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getpary(const WINDOW*); /* generated */ + +/* + * vid_attr() was implemented originally based on a draft of X/Open curses. + */ +#if !NCURSES_WIDECHAR +#define vid_attr(a, pair, opts) vidattr(a) +#endif + +/* + * These functions are extensions - not in X/Open Curses. + */ +#if 1 +#undef NCURSES_EXT_FUNCS +#define NCURSES_EXT_FUNCS 20180127 +typedef int (*NCURSES_WINDOW_CB)(WINDOW*, void*); +typedef int (*NCURSES_SCREEN_CB)(SCREEN*, void*); +extern NCURSES_EXPORT(bool) is_term_resized(int, int); +extern NCURSES_EXPORT(char*) keybound(int, int); +extern NCURSES_EXPORT(const char*) curses_version(void); +extern NCURSES_EXPORT(int) alloc_pair(int, int); +extern NCURSES_EXPORT(int) assume_default_colors(int, int); +extern NCURSES_EXPORT(int) define_key(const char*, int); +extern NCURSES_EXPORT(int) extended_color_content(int, int*, int*, int*); +extern NCURSES_EXPORT(int) extended_pair_content(int, int*, int*); +extern NCURSES_EXPORT(int) extended_slk_color(int); +extern NCURSES_EXPORT(int) find_pair(int, int); +extern NCURSES_EXPORT(int) free_pair(int); +extern NCURSES_EXPORT(int) get_escdelay(void); +extern NCURSES_EXPORT(int) init_extended_color(int, int, int, int); +extern NCURSES_EXPORT(int) init_extended_pair(int, int, int); +extern NCURSES_EXPORT(int) key_defined(const char*); +extern NCURSES_EXPORT(int) keyok(int, bool); +extern NCURSES_EXPORT(void) reset_color_pairs(void); +extern NCURSES_EXPORT(int) resize_term(int, int); +extern NCURSES_EXPORT(int) resizeterm(int, int); +extern NCURSES_EXPORT(int) set_escdelay(int); +extern NCURSES_EXPORT(int) set_tabsize(int); +extern NCURSES_EXPORT(int) use_default_colors(void); +extern NCURSES_EXPORT(int) use_extended_names(bool); +extern NCURSES_EXPORT(int) use_legacy_coding(int); +extern NCURSES_EXPORT(int) use_screen(SCREEN*, NCURSES_SCREEN_CB, void*); +extern NCURSES_EXPORT(int) use_window(WINDOW*, NCURSES_WINDOW_CB, void*); +extern NCURSES_EXPORT(int) wresize(WINDOW*, int, int); +extern NCURSES_EXPORT(void) nofilter(void); + +/* + * These extensions provide access to information stored in the WINDOW even + * when NCURSES_OPAQUE is set: + */ +extern NCURSES_EXPORT(WINDOW*) wgetparent(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_cleared(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_idcok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_idlok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_immedok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_keypad(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_leaveok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_nodelay(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_notimeout(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_pad(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_scrollok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_subwin(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_syncok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) wgetdelay(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) + wgetscrreg(const WINDOW*, int*, int*); /* generated */ + +#else +#define curses_version() NCURSES_VERSION +#endif + +/* + * Extra extension-functions, which pass a SCREEN pointer rather than using + * a global variable SP. + */ +#if 1 +#undef NCURSES_SP_FUNCS +#define NCURSES_SP_FUNCS 20180127 +#define NCURSES_SP_NAME(name) name##_sp + +/* Define the sp-funcs helper function */ +#define NCURSES_SP_OUTC NCURSES_SP_NAME(NCURSES_OUTC) +typedef int (*NCURSES_SP_OUTC)(SCREEN*, int); + +extern NCURSES_EXPORT(SCREEN*) new_prescr(void); /* implemented:SP_FUNC */ + +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(baudrate)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(beep)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(can_change_color)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(cbreak)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(curs_set)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(color_content)( + SCREEN*, + NCURSES_PAIRS_T, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(def_prog_mode)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(def_shell_mode)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(delay_output)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(doupdate)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(echo)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(endwin)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char) + NCURSES_SP_NAME(erasechar)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(filter)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(flash)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(flushinp)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW*) + NCURSES_SP_NAME(getwin)(SCREEN*, FILE*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(halfdelay)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(has_colors)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(has_ic)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(has_il)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_color)( + SCREEN*, + NCURSES_COLOR_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_pair)( + SCREEN*, + NCURSES_PAIRS_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + intrflush)(SCREEN*, WINDOW*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(isendwin)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(NCURSES_CONST char*) + NCURSES_SP_NAME(keyname)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char) + NCURSES_SP_NAME(killchar)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(longname)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + mvcur)(SCREEN*, int, int, int, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(napms)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW*) + NCURSES_SP_NAME(newpad)(SCREEN*, int, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(SCREEN*) NCURSES_SP_NAME(newterm)( + SCREEN*, + NCURSES_CONST char*, + FILE*, + FILE*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW*) NCURSES_SP_NAME( + newwin)(SCREEN*, int, int, int, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(nl)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(nocbreak)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(noecho)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(nonl)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(noqiflush)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(noraw)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(pair_content)( + SCREEN*, + NCURSES_PAIRS_T, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(qiflush)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(raw)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(reset_prog_mode)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(reset_shell_mode)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(resetty)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + ripoffline)(SCREEN*, int, int (*)(WINDOW*, int)); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(savetty)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(scr_init)(SCREEN*, const char*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + scr_restore)(SCREEN*, const char*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(scr_set)(SCREEN*, const char*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_attroff)(SCREEN*, const chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_attron)(SCREEN*, const chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_attrset)(SCREEN*, const chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(attr_t) + NCURSES_SP_NAME(slk_attr)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attr_set)( + SCREEN*, + const attr_t, + NCURSES_PAIRS_T, + void*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_clear)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_color)(SCREEN*, NCURSES_PAIRS_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_init)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(slk_label)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_noutrefresh)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_refresh)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_restore)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_set)(SCREEN*, int, const char*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_touch)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(start_color)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(chtype) + NCURSES_SP_NAME(termattrs)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(termname)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(typeahead)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(ungetch)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(use_env)(SCREEN*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(use_tioctl)(SCREEN*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(vidattr)(SCREEN*, chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + vidputs)(SCREEN*, chtype, NCURSES_SP_OUTC); /* implemented:SP_FUNC */ +#if 1 +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(keybound)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + alloc_pair)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + assume_default_colors)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + define_key)(SCREEN*, const char*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_color_content)( + SCREEN*, + int, + int*, + int*, + int*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_pair_content)( + SCREEN*, + int, + int*, + int*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + extended_slk_color)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(get_escdelay)(SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(find_pair)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(free_pair)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_extended_color)( + SCREEN*, + int, + int, + int, + int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + init_extended_pair)(SCREEN*, int, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME( + is_term_resized)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + key_defined)(SCREEN*, const char*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(keyok)(SCREEN*, int, bool); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(nofilter)(SCREEN*); + /* implemented */ /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(reset_color_pairs)(SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + resize_term)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + resizeterm)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(set_escdelay)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(set_tabsize)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(use_default_colors)(SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + use_legacy_coding)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +#endif +#else +#undef NCURSES_SP_FUNCS +#define NCURSES_SP_FUNCS 0 +#define NCURSES_SP_NAME(name) name +#define NCURSES_SP_OUTC NCURSES_OUTC +#endif + +/* attributes */ + +#define NCURSES_ATTR_SHIFT 8 +#define NCURSES_BITS(mask, shift) \ + (NCURSES_CAST(chtype, (mask)) << ((shift) + NCURSES_ATTR_SHIFT)) + +#define A_NORMAL (1U - 1U) +#define A_ATTRIBUTES NCURSES_BITS(~(1U - 1U), 0) +#define A_CHARTEXT (NCURSES_BITS(1U, 0) - 1U) +#define A_COLOR NCURSES_BITS(((1U) << 8) - 1U, 0) +#define A_STANDOUT NCURSES_BITS(1U, 8) +#define A_UNDERLINE NCURSES_BITS(1U, 9) +#define A_REVERSE NCURSES_BITS(1U, 10) +#define A_BLINK NCURSES_BITS(1U, 11) +#define A_DIM NCURSES_BITS(1U, 12) +#define A_BOLD NCURSES_BITS(1U, 13) +#define A_ALTCHARSET NCURSES_BITS(1U, 14) +#define A_INVIS NCURSES_BITS(1U, 15) +#define A_PROTECT NCURSES_BITS(1U, 16) +#define A_HORIZONTAL NCURSES_BITS(1U, 17) +#define A_LEFT NCURSES_BITS(1U, 18) +#define A_LOW NCURSES_BITS(1U, 19) +#define A_RIGHT NCURSES_BITS(1U, 20) +#define A_TOP NCURSES_BITS(1U, 21) +#define A_VERTICAL NCURSES_BITS(1U, 22) + +#if 1 +#define A_ITALIC NCURSES_BITS(1U, 23) /* ncurses extension */ +#endif + +/* + * Most of the pseudo functions are macros that either provide compatibility + * with older versions of curses, or provide inline functionality to improve + * performance. + */ + +/* + * These pseudo functions are always implemented as macros: + */ + +#define getyx(win, y, x) (y = getcury(win), x = getcurx(win)) +#define getbegyx(win, y, x) (y = getbegy(win), x = getbegx(win)) +#define getmaxyx(win, y, x) (y = getmaxy(win), x = getmaxx(win)) +#define getparyx(win, y, x) (y = getpary(win), x = getparx(win)) + +#define getsyx(y, x) \ + do { \ + if (newscr) { \ + if (is_leaveok(newscr)) \ + (y) = (x) = -1; \ + else \ + getyx(newscr, (y), (x)); \ + } \ + } while (0) + +#define setsyx(y, x) \ + do { \ + if (newscr) { \ + if ((y) == -1 && (x) == -1) \ + leaveok(newscr, TRUE); \ + else { \ + leaveok(newscr, FALSE); \ + wmove(newscr, (y), (x)); \ + } \ + } \ + } while (0) + +#ifndef NCURSES_NOMACROS + +/* + * These miscellaneous pseudo functions are provided for compatibility: + */ + +#define wgetstr(w, s) wgetnstr(w, s, -1) +#define getnstr(s, n) wgetnstr(stdscr, s, (n)) + +#define setterm(term) setupterm(term, 1, (int*)0) + +#define fixterm() reset_prog_mode() +#define resetterm() reset_shell_mode() +#define saveterm() def_prog_mode() +#define crmode() cbreak() +#define nocrmode() nocbreak() +#define gettmode() + +/* It seems older SYSV curses versions define these */ +#if !NCURSES_OPAQUE +#define getattrs(win) \ + NCURSES_CAST(int, NCURSES_OK_ADDR(win) ? (win)->_attrs : A_NORMAL) +#define getcurx(win) (NCURSES_OK_ADDR(win) ? (win)->_curx : ERR) +#define getcury(win) (NCURSES_OK_ADDR(win) ? (win)->_cury : ERR) +#define getbegx(win) (NCURSES_OK_ADDR(win) ? (win)->_begx : ERR) +#define getbegy(win) (NCURSES_OK_ADDR(win) ? (win)->_begy : ERR) +#define getmaxx(win) (NCURSES_OK_ADDR(win) ? ((win)->_maxx + 1) : ERR) +#define getmaxy(win) (NCURSES_OK_ADDR(win) ? ((win)->_maxy + 1) : ERR) +#define getparx(win) (NCURSES_OK_ADDR(win) ? (win)->_parx : ERR) +#define getpary(win) (NCURSES_OK_ADDR(win) ? (win)->_pary : ERR) +#endif /* NCURSES_OPAQUE */ + +#define wstandout(win) (wattrset(win, A_STANDOUT)) +#define wstandend(win) (wattrset(win, A_NORMAL)) + +#define wattron(win, at) wattr_on(win, NCURSES_CAST(attr_t, at), NULL) +#define wattroff(win, at) wattr_off(win, NCURSES_CAST(attr_t, at), NULL) + +#if !NCURSES_OPAQUE +#if NCURSES_WATTR_MACROS +#if NCURSES_WIDECHAR && 1 +#define wattrset(win, at) \ + (NCURSES_OK_ADDR(win) ? ((win)->_color = NCURSES_CAST(int, PAIR_NUMBER(at)), \ + (win)->_attrs = NCURSES_CAST(attr_t, at), \ + OK) \ + : ERR) +#else +#define wattrset(win, at) \ + (NCURSES_OK_ADDR(win) ? ((win)->_attrs = NCURSES_CAST(attr_t, at), OK) : ERR) +#endif +#endif /* NCURSES_WATTR_MACROS */ +#endif /* NCURSES_OPAQUE */ + +#define scroll(win) wscrl(win, 1) + +#define touchwin(win) wtouchln((win), 0, getmaxy(win), 1) +#define touchline(win, s, c) wtouchln((win), s, c, 1) +#define untouchwin(win) wtouchln((win), 0, getmaxy(win), 0) + +#define box(win, v, h) wborder(win, v, v, h, h, 0, 0, 0, 0) +#define border(ls, rs, ts, bs, tl, tr, bl, br) \ + wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br) +#define hline(ch, n) whline(stdscr, ch, (n)) +#define vline(ch, n) wvline(stdscr, ch, (n)) + +#define winstr(w, s) winnstr(w, s, -1) +#define winchstr(w, s) winchnstr(w, s, -1) +#define winsstr(w, s) winsnstr(w, s, -1) + +#if !NCURSES_OPAQUE +#define redrawwin(win) \ + wredrawln(win, 0, (NCURSES_OK_ADDR(win) ? (win)->_maxy + 1 : -1)) +#endif /* NCURSES_OPAQUE */ + +#define waddstr(win, str) waddnstr(win, str, -1) +#define waddchstr(win, str) waddchnstr(win, str, -1) + +/* + * These apply to the first 256 color pairs. + */ +#define COLOR_PAIR(n) (NCURSES_BITS((n), 0) & A_COLOR) +#define PAIR_NUMBER(a) \ + (NCURSES_CAST( \ + int, \ + ((NCURSES_CAST(unsigned long, (a)) & A_COLOR) >> NCURSES_ATTR_SHIFT))) + +/* + * pseudo functions for standard screen + */ + +#define addch(ch) waddch(stdscr, (ch)) +#define addchnstr(str, n) waddchnstr(stdscr, (str), (n)) +#define addchstr(str) waddchstr(stdscr, (str)) +#define addnstr(str, n) waddnstr(stdscr, (str), (n)) +#define addstr(str) waddnstr(stdscr, (str), -1) +#define attr_get(ap, cp, o) wattr_get(stdscr, (ap), (cp), (o)) +#define attr_off(a, o) wattr_off(stdscr, (a), (o)) +#define attr_on(a, o) wattr_on(stdscr, (a), (o)) +#define attr_set(a, c, o) wattr_set(stdscr, (a), (c), (o)) +#define attroff(at) wattroff(stdscr, (at)) +#define attron(at) wattron(stdscr, (at)) +#define attrset(at) wattrset(stdscr, (at)) +#define bkgd(ch) wbkgd(stdscr, (ch)) +#define bkgdset(ch) wbkgdset(stdscr, (ch)) +#define chgat(n, a, c, o) wchgat(stdscr, (n), (a), (c), (o)) +#define clear() wclear(stdscr) +#define clrtobot() wclrtobot(stdscr) +#define clrtoeol() wclrtoeol(stdscr) +#define color_set(c, o) wcolor_set(stdscr, (c), (o)) +#define delch() wdelch(stdscr) +#define deleteln() winsdelln(stdscr, -1) +#define echochar(c) wechochar(stdscr, (c)) +#define erase() werase(stdscr) +#define getch() wgetch(stdscr) +#define getstr(str) wgetstr(stdscr, (str)) +#define inch() winch(stdscr) +#define inchnstr(s, n) winchnstr(stdscr, (s), (n)) +#define inchstr(s) winchstr(stdscr, (s)) +#define innstr(s, n) winnstr(stdscr, (s), (n)) +#define insch(c) winsch(stdscr, (c)) +#define insdelln(n) winsdelln(stdscr, (n)) +#define insertln() winsdelln(stdscr, 1) +#define insnstr(s, n) winsnstr(stdscr, (s), (n)) +#define insstr(s) winsstr(stdscr, (s)) +#define instr(s) winstr(stdscr, (s)) +#define move(y, x) wmove(stdscr, (y), (x)) +#define refresh() wrefresh(stdscr) +#define scrl(n) wscrl(stdscr, (n)) +#define setscrreg(t, b) wsetscrreg(stdscr, (t), (b)) +#define standend() wstandend(stdscr) +#define standout() wstandout(stdscr) +#define timeout(delay) wtimeout(stdscr, (delay)) +#define wdeleteln(win) winsdelln(win, -1) +#define winsertln(win) winsdelln(win, 1) + +/* + * mv functions + */ + +#define mvwaddch(win, y, x, ch) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddch((win), (ch))) +#define mvwaddchnstr(win, y, x, str, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddchnstr((win), (str), (n))) +#define mvwaddchstr(win, y, x, str) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddchnstr((win), (str), -1)) +#define mvwaddnstr(win, y, x, str, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddnstr((win), (str), (n))) +#define mvwaddstr(win, y, x, str) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddnstr((win), (str), -1)) +#define mvwchgat(win, y, x, n, a, c, o) \ + (wmove((win), (y), (x)) == ERR ? ERR : wchgat((win), (n), (a), (c), (o))) +#define mvwdelch(win, y, x) (wmove((win), (y), (x)) == ERR ? ERR : wdelch(win)) +#define mvwgetch(win, y, x) (wmove((win), (y), (x)) == ERR ? ERR : wgetch(win)) +#define mvwgetnstr(win, y, x, str, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : wgetnstr((win), (str), (n))) +#define mvwgetstr(win, y, x, str) \ + (wmove((win), (y), (x)) == ERR ? ERR : wgetstr((win), (str))) +#define mvwhline(win, y, x, c, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : whline((win), (c), (n))) +#define mvwinch(win, y, x) \ + (wmove((win), (y), (x)) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win)) +#define mvwinchnstr(win, y, x, s, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : winchnstr((win), (s), (n))) +#define mvwinchstr(win, y, x, s) \ + (wmove((win), (y), (x)) == ERR ? ERR : winchstr((win), (s))) +#define mvwinnstr(win, y, x, s, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : winnstr((win), (s), (n))) +#define mvwinsch(win, y, x, c) \ + (wmove((win), (y), (x)) == ERR ? ERR : winsch((win), (c))) +#define mvwinsnstr(win, y, x, s, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : winsnstr((win), (s), (n))) +#define mvwinsstr(win, y, x, s) \ + (wmove((win), (y), (x)) == ERR ? ERR : winsstr((win), (s))) +#define mvwinstr(win, y, x, s) \ + (wmove((win), (y), (x)) == ERR ? ERR : winstr((win), (s))) +#define mvwvline(win, y, x, c, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : wvline((win), (c), (n))) + +#define mvaddch(y, x, ch) mvwaddch(stdscr, (y), (x), (ch)) +#define mvaddchnstr(y, x, str, n) mvwaddchnstr(stdscr, (y), (x), (str), (n)) +#define mvaddchstr(y, x, str) mvwaddchstr(stdscr, (y), (x), (str)) +#define mvaddnstr(y, x, str, n) mvwaddnstr(stdscr, (y), (x), (str), (n)) +#define mvaddstr(y, x, str) mvwaddstr(stdscr, (y), (x), (str)) +#define mvchgat(y, x, n, a, c, o) mvwchgat(stdscr, (y), (x), (n), (a), (c), (o)) +#define mvdelch(y, x) mvwdelch(stdscr, (y), (x)) +#define mvgetch(y, x) mvwgetch(stdscr, (y), (x)) +#define mvgetnstr(y, x, str, n) mvwgetnstr(stdscr, (y), (x), (str), (n)) +#define mvgetstr(y, x, str) mvwgetstr(stdscr, (y), (x), (str)) +#define mvhline(y, x, c, n) mvwhline(stdscr, (y), (x), (c), (n)) +#define mvinch(y, x) mvwinch(stdscr, (y), (x)) +#define mvinchnstr(y, x, s, n) mvwinchnstr(stdscr, (y), (x), (s), (n)) +#define mvinchstr(y, x, s) mvwinchstr(stdscr, (y), (x), (s)) +#define mvinnstr(y, x, s, n) mvwinnstr(stdscr, (y), (x), (s), (n)) +#define mvinsch(y, x, c) mvwinsch(stdscr, (y), (x), (c)) +#define mvinsnstr(y, x, s, n) mvwinsnstr(stdscr, (y), (x), (s), (n)) +#define mvinsstr(y, x, s) mvwinsstr(stdscr, (y), (x), (s)) +#define mvinstr(y, x, s) mvwinstr(stdscr, (y), (x), (s)) +#define mvvline(y, x, c, n) mvwvline(stdscr, (y), (x), (c), (n)) + +/* + * Some wide-character functions can be implemented without the extensions. + */ +#if !NCURSES_OPAQUE +#define getbkgd(win) (NCURSES_OK_ADDR(win) ? ((win)->_bkgd) : 0) +#endif /* NCURSES_OPAQUE */ + +#define slk_attr_off(a, v) ((v) ? ERR : slk_attroff(a)) +#define slk_attr_on(a, v) ((v) ? ERR : slk_attron(a)) + +#if !NCURSES_OPAQUE +#if NCURSES_WATTR_MACROS +#if NCURSES_WIDECHAR && 1 +#define wattr_set(win, a, p, opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)((win)->_attrs = ((a) & ~A_COLOR), (win)->_color = (opts) ? *(int*)(opts) : (p)), \ + OK) \ + : ERR) +#define wattr_get(win, a, p, opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)(NCURSES_OK_ADDR(a) ? (*(a) = (win)->_attrs) : OK), \ + (void)(NCURSES_OK_ADDR(p) ? (*(p) = (NCURSES_PAIRS_T)(win)->_color) : OK), \ + (void)(NCURSES_OK_ADDR(opts) ? (*(int*)(opts) = (win)->_color) : OK), \ + OK) \ + : ERR) +#else /* !(NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */ +#define wattr_set(win, a, p, opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)((win)->_attrs = (((a) & ~A_COLOR) | (attr_t)COLOR_PAIR(p))), \ + OK) \ + : ERR) +#define wattr_get(win, a, p, opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)(NCURSES_OK_ADDR(a) ? (*(a) = (win)->_attrs) : OK), \ + (void)(NCURSES_OK_ADDR(p) ? (*(p) = (NCURSES_PAIRS_T)PAIR_NUMBER((win)->_attrs)) : OK), \ + OK) \ + : ERR) +#endif /* (NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */ +#endif /* NCURSES_WATTR_MACROS */ +#endif /* NCURSES_OPAQUE */ + +/* + * X/Open curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use + * varargs.h. It adds new calls vw_printw/vw_scanw, which are supposed to + * use POSIX stdarg.h. The ncurses versions of vwprintw/vwscanw already + * use stdarg.h, so... + */ +#define vw_printw vwprintw +#define vw_scanw vwscanw + +/* + * Export fallback function for use in C++ binding. + */ +#if !1 +#define vsscanf(a, b, c) _nc_vsscanf(a, b, c) +NCURSES_EXPORT(int) vsscanf(const char*, const char*, va_list); +#endif + +/* + * These macros are extensions - not in X/Open Curses. + */ +#if 1 +#if !NCURSES_OPAQUE +#define is_cleared(win) (NCURSES_OK_ADDR(win) ? (win)->_clear : FALSE) +#define is_idcok(win) (NCURSES_OK_ADDR(win) ? (win)->_idcok : FALSE) +#define is_idlok(win) (NCURSES_OK_ADDR(win) ? (win)->_idlok : FALSE) +#define is_immedok(win) (NCURSES_OK_ADDR(win) ? (win)->_immed : FALSE) +#define is_keypad(win) (NCURSES_OK_ADDR(win) ? (win)->_use_keypad : FALSE) +#define is_leaveok(win) (NCURSES_OK_ADDR(win) ? (win)->_leaveok : FALSE) +#define is_nodelay(win) (NCURSES_OK_ADDR(win) ? ((win)->_delay == 0) : FALSE) +#define is_notimeout(win) (NCURSES_OK_ADDR(win) ? (win)->_notimeout : FALSE) +#define is_pad(win) \ + (NCURSES_OK_ADDR(win) ? ((win)->_flags & _ISPAD) != 0 : FALSE) +#define is_scrollok(win) (NCURSES_OK_ADDR(win) ? (win)->_scroll : FALSE) +#define is_subwin(win) \ + (NCURSES_OK_ADDR(win) ? ((win)->_flags & _SUBWIN) != 0 : FALSE) +#define is_syncok(win) (NCURSES_OK_ADDR(win) ? (win)->_sync : FALSE) +#define wgetdelay(win) (NCURSES_OK_ADDR(win) ? (win)->_delay : 0) +#define wgetparent(win) (NCURSES_OK_ADDR(win) ? (win)->_parent : 0) +#define wgetscrreg(win, t, b) \ + (NCURSES_OK_ADDR(win) \ + ? (*(t) = (win)->_regtop, *(b) = (win)->_regbottom, OK) \ + : ERR) +#endif +#endif + +#endif /* NCURSES_NOMACROS */ + +/* + * Public variables. + * + * Notes: + * a. ESCDELAY was an undocumented feature under AIX curses. + * It gives the ESC expire time in milliseconds. + * b. ttytype is needed for backward compatibility + */ +#if NCURSES_REENTRANT + +NCURSES_WRAPPED_VAR(WINDOW*, curscr); +NCURSES_WRAPPED_VAR(WINDOW*, newscr); +NCURSES_WRAPPED_VAR(WINDOW*, stdscr); +NCURSES_WRAPPED_VAR(char*, ttytype); +NCURSES_WRAPPED_VAR(int, COLORS); +NCURSES_WRAPPED_VAR(int, COLOR_PAIRS); +NCURSES_WRAPPED_VAR(int, COLS); +NCURSES_WRAPPED_VAR(int, ESCDELAY); +NCURSES_WRAPPED_VAR(int, LINES); +NCURSES_WRAPPED_VAR(int, TABSIZE); + +#define curscr NCURSES_PUBLIC_VAR(curscr()) +#define newscr NCURSES_PUBLIC_VAR(newscr()) +#define stdscr NCURSES_PUBLIC_VAR(stdscr()) +#define ttytype NCURSES_PUBLIC_VAR(ttytype()) +#define COLORS NCURSES_PUBLIC_VAR(COLORS()) +#define COLOR_PAIRS NCURSES_PUBLIC_VAR(COLOR_PAIRS()) +#define COLS NCURSES_PUBLIC_VAR(COLS()) +#define ESCDELAY NCURSES_PUBLIC_VAR(ESCDELAY()) +#define LINES NCURSES_PUBLIC_VAR(LINES()) +#define TABSIZE NCURSES_PUBLIC_VAR(TABSIZE()) + +#else + +extern NCURSES_EXPORT_VAR(WINDOW*) curscr; +extern NCURSES_EXPORT_VAR(WINDOW*) newscr; +extern NCURSES_EXPORT_VAR(WINDOW*) stdscr; +extern NCURSES_EXPORT_VAR(char) ttytype[]; +extern NCURSES_EXPORT_VAR(int) COLORS; +extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS; +extern NCURSES_EXPORT_VAR(int) COLS; +extern NCURSES_EXPORT_VAR(int) ESCDELAY; +extern NCURSES_EXPORT_VAR(int) LINES; +extern NCURSES_EXPORT_VAR(int) TABSIZE; + +#endif + +/* + * Pseudo-character tokens outside ASCII range. The curses wgetch() function + * will return any given one of these only if the corresponding k- capability + * is defined in your terminal's terminfo entry. + * + * Some keys (KEY_A1, etc) are arranged like this: + * a1 up a3 + * left b2 right + * c1 down c3 + * + * A few key codes do not depend upon the terminfo entry. + */ +#define KEY_CODE_YES 0400 /* A wchar_t contains a key code */ +#define KEY_MIN 0401 /* Minimum curses key */ +#define KEY_BREAK 0401 /* Break key (unreliable) */ +#define KEY_SRESET 0530 /* Soft (partial) reset (unreliable) */ +#define KEY_RESET 0531 /* Reset or hard reset (unreliable) */ +/* + * These definitions were generated by ./MKkey_defs.sh ./Caps + */ +#define KEY_DOWN 0402 /* down-arrow key */ +#define KEY_UP 0403 /* up-arrow key */ +#define KEY_LEFT 0404 /* left-arrow key */ +#define KEY_RIGHT 0405 /* right-arrow key */ +#define KEY_HOME 0406 /* home key */ +#define KEY_BACKSPACE 0407 /* backspace key */ +#define KEY_F0 0410 /* Function keys. Space for 64 */ +#define KEY_F(n) (KEY_F0 + (n)) /* Value of function key n */ +#define KEY_DL 0510 /* delete-line key */ +#define KEY_IL 0511 /* insert-line key */ +#define KEY_DC 0512 /* delete-character key */ +#define KEY_IC 0513 /* insert-character key */ +#define KEY_EIC 0514 /* sent by rmir or smir in insert mode */ +#define KEY_CLEAR 0515 /* clear-screen or erase key */ +#define KEY_EOS 0516 /* clear-to-end-of-screen key */ +#define KEY_EOL 0517 /* clear-to-end-of-line key */ +#define KEY_SF 0520 /* scroll-forward key */ +#define KEY_SR 0521 /* scroll-backward key */ +#define KEY_NPAGE 0522 /* next-page key */ +#define KEY_PPAGE 0523 /* previous-page key */ +#define KEY_STAB 0524 /* set-tab key */ +#define KEY_CTAB 0525 /* clear-tab key */ +#define KEY_CATAB 0526 /* clear-all-tabs key */ +#define KEY_ENTER 0527 /* enter/send key */ +#define KEY_PRINT 0532 /* print key */ +#define KEY_LL 0533 /* lower-left key (home down) */ +#define KEY_A1 0534 /* upper left of keypad */ +#define KEY_A3 0535 /* upper right of keypad */ +#define KEY_B2 0536 /* center of keypad */ +#define KEY_C1 0537 /* lower left of keypad */ +#define KEY_C3 0540 /* lower right of keypad */ +#define KEY_BTAB 0541 /* back-tab key */ +#define KEY_BEG 0542 /* begin key */ +#define KEY_CANCEL 0543 /* cancel key */ +#define KEY_CLOSE 0544 /* close key */ +#define KEY_COMMAND 0545 /* command key */ +#define KEY_COPY 0546 /* copy key */ +#define KEY_CREATE 0547 /* create key */ +#define KEY_END 0550 /* end key */ +#define KEY_EXIT 0551 /* exit key */ +#define KEY_FIND 0552 /* find key */ +#define KEY_HELP 0553 /* help key */ +#define KEY_MARK 0554 /* mark key */ +#define KEY_MESSAGE 0555 /* message key */ +#define KEY_MOVE 0556 /* move key */ +#define KEY_NEXT 0557 /* next key */ +#define KEY_OPEN 0560 /* open key */ +#define KEY_OPTIONS 0561 /* options key */ +#define KEY_PREVIOUS 0562 /* previous key */ +#define KEY_REDO 0563 /* redo key */ +#define KEY_REFERENCE 0564 /* reference key */ +#define KEY_REFRESH 0565 /* refresh key */ +#define KEY_REPLACE 0566 /* replace key */ +#define KEY_RESTART 0567 /* restart key */ +#define KEY_RESUME 0570 /* resume key */ +#define KEY_SAVE 0571 /* save key */ +#define KEY_SBEG 0572 /* shifted begin key */ +#define KEY_SCANCEL 0573 /* shifted cancel key */ +#define KEY_SCOMMAND 0574 /* shifted command key */ +#define KEY_SCOPY 0575 /* shifted copy key */ +#define KEY_SCREATE 0576 /* shifted create key */ +#define KEY_SDC 0577 /* shifted delete-character key */ +#define KEY_SDL 0600 /* shifted delete-line key */ +#define KEY_SELECT 0601 /* select key */ +#define KEY_SEND 0602 /* shifted end key */ +#define KEY_SEOL 0603 /* shifted clear-to-end-of-line key */ +#define KEY_SEXIT 0604 /* shifted exit key */ +#define KEY_SFIND 0605 /* shifted find key */ +#define KEY_SHELP 0606 /* shifted help key */ +#define KEY_SHOME 0607 /* shifted home key */ +#define KEY_SIC 0610 /* shifted insert-character key */ +#define KEY_SLEFT 0611 /* shifted left-arrow key */ +#define KEY_SMESSAGE 0612 /* shifted message key */ +#define KEY_SMOVE 0613 /* shifted move key */ +#define KEY_SNEXT 0614 /* shifted next key */ +#define KEY_SOPTIONS 0615 /* shifted options key */ +#define KEY_SPREVIOUS 0616 /* shifted previous key */ +#define KEY_SPRINT 0617 /* shifted print key */ +#define KEY_SREDO 0620 /* shifted redo key */ +#define KEY_SREPLACE 0621 /* shifted replace key */ +#define KEY_SRIGHT 0622 /* shifted right-arrow key */ +#define KEY_SRSUME 0623 /* shifted resume key */ +#define KEY_SSAVE 0624 /* shifted save key */ +#define KEY_SSUSPEND 0625 /* shifted suspend key */ +#define KEY_SUNDO 0626 /* shifted undo key */ +#define KEY_SUSPEND 0627 /* suspend key */ +#define KEY_UNDO 0630 /* undo key */ +#define KEY_MOUSE 0631 /* Mouse event has occurred */ +#define KEY_RESIZE 0632 /* Terminal resize event */ +#define KEY_EVENT 0633 /* We were interrupted by an event */ + +#define KEY_MAX 0777 /* Maximum key value is 0633 */ +/* $Id: curses.wide,v 1.50 2017/03/26 16:05:21 tom Exp $ */ +/* + * vile:cmode: + * This file is part of ncurses, designed to be appended after curses.h.in + * (see that file for the relevant copyright). + */ +#define _XOPEN_CURSES 1 + +#if NCURSES_WIDECHAR + +extern NCURSES_EXPORT_VAR(cchar_t*) _nc_wacs; + +#define NCURSES_WACS(c) (&_nc_wacs[NCURSES_CAST(unsigned char, (c))]) + +#define WACS_BSSB NCURSES_WACS('l') +#define WACS_SSBB NCURSES_WACS('m') +#define WACS_BBSS NCURSES_WACS('k') +#define WACS_SBBS NCURSES_WACS('j') +#define WACS_SBSS NCURSES_WACS('u') +#define WACS_SSSB NCURSES_WACS('t') +#define WACS_SSBS NCURSES_WACS('v') +#define WACS_BSSS NCURSES_WACS('w') +#define WACS_BSBS NCURSES_WACS('q') +#define WACS_SBSB NCURSES_WACS('x') +#define WACS_SSSS NCURSES_WACS('n') + +#define WACS_ULCORNER WACS_BSSB +#define WACS_LLCORNER WACS_SSBB +#define WACS_URCORNER WACS_BBSS +#define WACS_LRCORNER WACS_SBBS +#define WACS_RTEE WACS_SBSS +#define WACS_LTEE WACS_SSSB +#define WACS_BTEE WACS_SSBS +#define WACS_TTEE WACS_BSSS +#define WACS_HLINE WACS_BSBS +#define WACS_VLINE WACS_SBSB +#define WACS_PLUS WACS_SSSS + +#define WACS_S1 NCURSES_WACS('o') /* scan line 1 */ +#define WACS_S9 NCURSES_WACS('s') /* scan line 9 */ +#define WACS_DIAMOND NCURSES_WACS('`') /* diamond */ +#define WACS_CKBOARD NCURSES_WACS('a') /* checker board */ +#define WACS_DEGREE NCURSES_WACS('f') /* degree symbol */ +#define WACS_PLMINUS NCURSES_WACS('g') /* plus/minus */ +#define WACS_BULLET NCURSES_WACS('~') /* bullet */ + +/* Teletype 5410v1 symbols */ +#define WACS_LARROW NCURSES_WACS(',') /* arrow left */ +#define WACS_RARROW NCURSES_WACS('+') /* arrow right */ +#define WACS_DARROW NCURSES_WACS('.') /* arrow down */ +#define WACS_UARROW NCURSES_WACS('-') /* arrow up */ +#define WACS_BOARD NCURSES_WACS('h') /* board of squares */ +#define WACS_LANTERN NCURSES_WACS('i') /* lantern symbol */ +#define WACS_BLOCK NCURSES_WACS('0') /* solid square block */ + +/* ncurses extensions */ +#define WACS_S3 NCURSES_WACS('p') /* scan line 3 */ +#define WACS_S7 NCURSES_WACS('r') /* scan line 7 */ +#define WACS_LEQUAL NCURSES_WACS('y') /* less/equal */ +#define WACS_GEQUAL NCURSES_WACS('z') /* greater/equal */ +#define WACS_PI NCURSES_WACS('{') /* Pi */ +#define WACS_NEQUAL NCURSES_WACS('|') /* not equal */ +#define WACS_STERLING NCURSES_WACS('}') /* UK pound sign */ + +/* double lines */ +#define WACS_BDDB NCURSES_WACS('C') +#define WACS_DDBB NCURSES_WACS('D') +#define WACS_BBDD NCURSES_WACS('B') +#define WACS_DBBD NCURSES_WACS('A') +#define WACS_DBDD NCURSES_WACS('G') +#define WACS_DDDB NCURSES_WACS('F') +#define WACS_DDBD NCURSES_WACS('H') +#define WACS_BDDD NCURSES_WACS('I') +#define WACS_BDBD NCURSES_WACS('R') +#define WACS_DBDB NCURSES_WACS('Y') +#define WACS_DDDD NCURSES_WACS('E') + +#define WACS_D_ULCORNER WACS_BDDB +#define WACS_D_LLCORNER WACS_DDBB +#define WACS_D_URCORNER WACS_BBDD +#define WACS_D_LRCORNER WACS_DBBD +#define WACS_D_RTEE WACS_DBDD +#define WACS_D_LTEE WACS_DDDB +#define WACS_D_BTEE WACS_DDBD +#define WACS_D_TTEE WACS_BDDD +#define WACS_D_HLINE WACS_BDBD +#define WACS_D_VLINE WACS_DBDB +#define WACS_D_PLUS WACS_DDDD + +/* thick lines */ +#define WACS_BTTB NCURSES_WACS('L') +#define WACS_TTBB NCURSES_WACS('M') +#define WACS_BBTT NCURSES_WACS('K') +#define WACS_TBBT NCURSES_WACS('J') +#define WACS_TBTT NCURSES_WACS('U') +#define WACS_TTTB NCURSES_WACS('T') +#define WACS_TTBT NCURSES_WACS('V') +#define WACS_BTTT NCURSES_WACS('W') +#define WACS_BTBT NCURSES_WACS('Q') +#define WACS_TBTB NCURSES_WACS('X') +#define WACS_TTTT NCURSES_WACS('N') + +#define WACS_T_ULCORNER WACS_BTTB +#define WACS_T_LLCORNER WACS_TTBB +#define WACS_T_URCORNER WACS_BBTT +#define WACS_T_LRCORNER WACS_TBBT +#define WACS_T_RTEE WACS_TBTT +#define WACS_T_LTEE WACS_TTTB +#define WACS_T_BTEE WACS_TTBT +#define WACS_T_TTEE WACS_BTTT +#define WACS_T_HLINE WACS_BTBT +#define WACS_T_VLINE WACS_TBTB +#define WACS_T_PLUS WACS_TTTT + +/* + * Function prototypes for wide-character operations. + * + * "generated" comments should include ":WIDEC" to make the corresponding + * functions ifdef'd in lib_gen.c + * + * "implemented" comments do not need this marker. + */ + +extern NCURSES_EXPORT(int) add_wch(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + add_wchnstr(const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) add_wchstr(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) addnwstr(const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) addwstr(const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) bkgrnd(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(void) bkgrndset(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) border_set( + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + box_set(WINDOW*, const cchar_t*, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) echo_wchar(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) erasewchar(wchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) get_wch(wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) get_wstr(wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) getbkgrnd(cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) getcchar( + const cchar_t*, + wchar_t*, + attr_t*, + NCURSES_PAIRS_T*, + void*); /* implemented */ +extern NCURSES_EXPORT(int) getn_wstr(wint_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) hline_set(const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) in_wch(cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) in_wchnstr(cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) in_wchstr(cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) innwstr(wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) ins_nwstr(const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) ins_wch(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) ins_wstr(const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) inwstr(wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(NCURSES_CONST char*) key_name(wchar_t); /* implemented */ +extern NCURSES_EXPORT(int) killwchar(wchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + mvadd_wch(int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvadd_wchnstr(int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvadd_wchstr(int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvaddnwstr(int, int, const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvaddwstr(int, int, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvget_wch(int, int, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvget_wstr(int, int, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvgetn_wstr(int, int, wint_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvhline_set(int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvin_wch(int, int, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvin_wchnstr(int, int, cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvin_wchstr(int, int, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvinnwstr(int, int, wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvins_nwstr(int, int, const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvins_wch(int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvins_wstr(int, int, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvinwstr(int, int, wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvvline_set(int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwadd_wch(WINDOW*, int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwadd_wchnstr( + WINDOW*, + int, + int, + const cchar_t*, + int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwadd_wchstr(WINDOW*, int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwaddnwstr(WINDOW*, int, int, const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwaddwstr(WINDOW*, int, int, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwget_wch(WINDOW*, int, int, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwget_wstr(WINDOW*, int, int, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwgetn_wstr(WINDOW*, int, int, wint_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwhline_set(WINDOW*, int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwin_wch(WINDOW*, int, int, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwin_wchnstr(WINDOW*, int, int, cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwin_wchstr(WINDOW*, int, int, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwinnwstr(WINDOW*, int, int, wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwins_nwstr(WINDOW*, int, int, const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwins_wch(WINDOW*, int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwins_wstr(WINDOW*, int, int, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwinwstr(WINDOW*, int, int, wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwvline_set(WINDOW*, int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + pecho_wchar(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) setcchar( + cchar_t*, + const wchar_t*, + const attr_t, + NCURSES_PAIRS_T, + const void*); /* implemented */ +extern NCURSES_EXPORT(int) slk_wset(int, const wchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(attr_t) term_attrs(void); /* implemented */ +extern NCURSES_EXPORT(int) unget_wch(const wchar_t); /* implemented */ +extern NCURSES_EXPORT(int) + vid_attr(attr_t, NCURSES_PAIRS_T, void*); /* implemented */ +extern NCURSES_EXPORT(int) + vid_puts(attr_t, NCURSES_PAIRS_T, void*, NCURSES_OUTC); /* implemented */ +extern NCURSES_EXPORT(int) vline_set(const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wadd_wch(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + wadd_wchnstr(WINDOW*, const cchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) + wadd_wchstr(WINDOW*, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + waddnwstr(WINDOW*, const wchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) + waddwstr(WINDOW*, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wbkgrnd(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(void) + wbkgrndset(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) wborder_set( + WINDOW*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + wecho_wchar(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) wget_wch(WINDOW*, wint_t*); /* implemented */ +extern NCURSES_EXPORT(int) wget_wstr(WINDOW*, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wgetbkgrnd(WINDOW*, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wgetn_wstr(WINDOW*, wint_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) + whline_set(WINDOW*, const cchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) win_wch(WINDOW*, cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + win_wchnstr(WINDOW*, cchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) win_wchstr(WINDOW*, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) winnwstr(WINDOW*, wchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) + wins_nwstr(WINDOW*, const wchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) wins_wch(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + wins_wstr(WINDOW*, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) winwstr(WINDOW*, wchar_t*); /* implemented */ +extern NCURSES_EXPORT(wchar_t*) wunctrl(cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + wvline_set(WINDOW*, const cchar_t*, int); /* implemented */ + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(attr_t) + NCURSES_SP_NAME(term_attrs)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + unget_wch)(SCREEN*, const wchar_t); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(wchar_t*) + NCURSES_SP_NAME(wunctrl)(SCREEN*, cchar_t*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_attr)( + SCREEN*, + attr_t, + NCURSES_PAIRS_T, + void*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts)( + SCREEN*, + attr_t, + NCURSES_PAIRS_T, + void*, + NCURSES_SP_OUTC); /* implemented:SP_FUNC */ +#endif + +#ifndef NCURSES_NOMACROS + +/* + * XSI curses macros for XPG4 conformance. + */ +#define add_wch(c) wadd_wch(stdscr, (c)) +#define add_wchnstr(str, n) wadd_wchnstr(stdscr, (str), (n)) +#define add_wchstr(str) wadd_wchstr(stdscr, (str)) +#define addnwstr(wstr, n) waddnwstr(stdscr, (wstr), (n)) +#define addwstr(wstr) waddwstr(stdscr, (wstr)) +#define bkgrnd(c) wbkgrnd(stdscr, (c)) +#define bkgrndset(c) wbkgrndset(stdscr, (c)) +#define border_set(l, r, t, b, tl, tr, bl, br) \ + wborder_set(stdscr, (l), (r), (t), (b), tl, tr, bl, br) +#define box_set(w, v, h) wborder_set((w), (v), (v), (h), (h), 0, 0, 0, 0) +#define echo_wchar(c) wecho_wchar(stdscr, (c)) +#define get_wch(c) wget_wch(stdscr, (c)) +#define get_wstr(t) wget_wstr(stdscr, (t)) +#define getbkgrnd(wch) wgetbkgrnd(stdscr, (wch)) +#define getn_wstr(t, n) wgetn_wstr(stdscr, (t), (n)) +#define hline_set(c, n) whline_set(stdscr, (c), (n)) +#define in_wch(c) win_wch(stdscr, (c)) +#define in_wchnstr(c, n) win_wchnstr(stdscr, (c), (n)) +#define in_wchstr(c) win_wchstr(stdscr, (c)) +#define innwstr(c, n) winnwstr(stdscr, (c), (n)) +#define ins_nwstr(t, n) wins_nwstr(stdscr, (t), (n)) +#define ins_wch(c) wins_wch(stdscr, (c)) +#define ins_wstr(t) wins_wstr(stdscr, (t)) +#define inwstr(c) winwstr(stdscr, (c)) +#define vline_set(c, n) wvline_set(stdscr, (c), (n)) +#define wadd_wchstr(win, str) wadd_wchnstr((win), (str), -1) +#define waddwstr(win, wstr) waddnwstr((win), (wstr), -1) +#define wget_wstr(w, t) wgetn_wstr((w), (t), -1) +#define win_wchstr(w, c) win_wchnstr((w), (c), -1) +#define wins_wstr(w, t) wins_nwstr((w), (t), -1) + +#if !NCURSES_OPAQUE +#define wgetbkgrnd(win, wch) \ + (NCURSES_OK_ADDR(wch) ? ((win) ? (*(wch) = (win)->_bkgrnd) : *(wch), OK) \ + : ERR) +#endif + +#define mvadd_wch(y, x, c) mvwadd_wch(stdscr, (y), (x), (c)) +#define mvadd_wchnstr(y, x, s, n) mvwadd_wchnstr(stdscr, (y), (x), (s), (n)) +#define mvadd_wchstr(y, x, s) mvwadd_wchstr(stdscr, (y), (x), (s)) +#define mvaddnwstr(y, x, wstr, n) mvwaddnwstr(stdscr, (y), (x), (wstr), (n)) +#define mvaddwstr(y, x, wstr) mvwaddwstr(stdscr, (y), (x), (wstr)) +#define mvget_wch(y, x, c) mvwget_wch(stdscr, (y), (x), (c)) +#define mvget_wstr(y, x, t) mvwget_wstr(stdscr, (y), (x), (t)) +#define mvgetn_wstr(y, x, t, n) mvwgetn_wstr(stdscr, (y), (x), (t), (n)) +#define mvhline_set(y, x, c, n) mvwhline_set(stdscr, (y), (x), (c), (n)) +#define mvin_wch(y, x, c) mvwin_wch(stdscr, (y), (x), (c)) +#define mvin_wchnstr(y, x, c, n) mvwin_wchnstr(stdscr, (y), (x), (c), (n)) +#define mvin_wchstr(y, x, c) mvwin_wchstr(stdscr, (y), (x), (c)) +#define mvinnwstr(y, x, c, n) mvwinnwstr(stdscr, (y), (x), (c), (n)) +#define mvins_nwstr(y, x, t, n) mvwins_nwstr(stdscr, (y), (x), (t), (n)) +#define mvins_wch(y, x, c) mvwins_wch(stdscr, (y), (x), (c)) +#define mvins_wstr(y, x, t) mvwins_wstr(stdscr, (y), (x), (t)) +#define mvinwstr(y, x, c) mvwinwstr(stdscr, (y), (x), (c)) +#define mvvline_set(y, x, c, n) mvwvline_set(stdscr, (y), (x), (c), (n)) + +#define mvwadd_wch(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : wadd_wch((win), (c))) +#define mvwadd_wchnstr(win, y, x, s, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : wadd_wchnstr((win), (s), (n))) +#define mvwadd_wchstr(win, y, x, s) \ + (wmove(win, (y), (x)) == ERR ? ERR : wadd_wchstr((win), (s))) +#define mvwaddnwstr(win, y, x, wstr, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : waddnwstr((win), (wstr), (n))) +#define mvwaddwstr(win, y, x, wstr) \ + (wmove(win, (y), (x)) == ERR ? ERR : waddwstr((win), (wstr))) +#define mvwget_wch(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : wget_wch((win), (c))) +#define mvwget_wstr(win, y, x, t) \ + (wmove(win, (y), (x)) == ERR ? ERR : wget_wstr((win), (t))) +#define mvwgetn_wstr(win, y, x, t, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : wgetn_wstr((win), (t), (n))) +#define mvwhline_set(win, y, x, c, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : whline_set((win), (c), (n))) +#define mvwin_wch(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : win_wch((win), (c))) +#define mvwin_wchnstr(win, y, x, c, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : win_wchnstr((win), (c), (n))) +#define mvwin_wchstr(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : win_wchstr((win), (c))) +#define mvwinnwstr(win, y, x, c, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : winnwstr((win), (c), (n))) +#define mvwins_nwstr(win, y, x, t, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : wins_nwstr((win), (t), (n))) +#define mvwins_wch(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : wins_wch((win), (c))) +#define mvwins_wstr(win, y, x, t) \ + (wmove(win, (y), (x)) == ERR ? ERR : wins_wstr((win), (t))) +#define mvwinwstr(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : winwstr((win), (c))) +#define mvwvline_set(win, y, x, c, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : wvline_set((win), (c), (n))) + +#endif /* NCURSES_NOMACROS */ + +#if defined(TRACE) || defined(NCURSES_TEST) +extern NCURSES_EXPORT(const char*) _nc_viswbuf(const wchar_t*); +extern NCURSES_EXPORT(const char*) _nc_viswibuf(const wint_t*); +#endif + +#endif /* NCURSES_WIDECHAR */ +/* $Id: curses.tail,v 1.23 2016/02/13 16:37:45 tom Exp $ */ +/* + * vile:cmode: + * This file is part of ncurses, designed to be appended after curses.h.in + * (see that file for the relevant copyright). + */ + +/* mouse interface */ + +#if NCURSES_MOUSE_VERSION > 1 +#define NCURSES_MOUSE_MASK(b, m) ((m) << (((b)-1) * 5)) +#else +#define NCURSES_MOUSE_MASK(b, m) ((m) << (((b)-1) * 6)) +#endif + +#define NCURSES_BUTTON_RELEASED 001L +#define NCURSES_BUTTON_PRESSED 002L +#define NCURSES_BUTTON_CLICKED 004L +#define NCURSES_DOUBLE_CLICKED 010L +#define NCURSES_TRIPLE_CLICKED 020L +#define NCURSES_RESERVED_EVENT 040L + +/* event masks */ +#define BUTTON1_RELEASED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED) +#define BUTTON1_PRESSED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED) +#define BUTTON1_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED) +#define BUTTON1_DOUBLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED) +#define BUTTON1_TRIPLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED) + +#define BUTTON2_RELEASED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED) +#define BUTTON2_PRESSED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED) +#define BUTTON2_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED) +#define BUTTON2_DOUBLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED) +#define BUTTON2_TRIPLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED) + +#define BUTTON3_RELEASED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED) +#define BUTTON3_PRESSED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED) +#define BUTTON3_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED) +#define BUTTON3_DOUBLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED) +#define BUTTON3_TRIPLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED) + +#define BUTTON4_RELEASED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED) +#define BUTTON4_PRESSED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED) +#define BUTTON4_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED) +#define BUTTON4_DOUBLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED) +#define BUTTON4_TRIPLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED) + +/* + * In 32 bits the version-1 scheme does not provide enough space for a 5th + * button, unless we choose to change the ABI by omitting the reserved-events. + */ +#if NCURSES_MOUSE_VERSION > 1 + +#define BUTTON5_RELEASED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED) +#define BUTTON5_PRESSED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED) +#define BUTTON5_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED) +#define BUTTON5_DOUBLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED) +#define BUTTON5_TRIPLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED) + +#define BUTTON_CTRL NCURSES_MOUSE_MASK(6, 0001L) +#define BUTTON_SHIFT NCURSES_MOUSE_MASK(6, 0002L) +#define BUTTON_ALT NCURSES_MOUSE_MASK(6, 0004L) +#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(6, 0010L) + +#else + +#define BUTTON1_RESERVED_EVENT NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT) +#define BUTTON2_RESERVED_EVENT NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT) +#define BUTTON3_RESERVED_EVENT NCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT) +#define BUTTON4_RESERVED_EVENT NCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT) + +#define BUTTON_CTRL NCURSES_MOUSE_MASK(5, 0001L) +#define BUTTON_SHIFT NCURSES_MOUSE_MASK(5, 0002L) +#define BUTTON_ALT NCURSES_MOUSE_MASK(5, 0004L) +#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(5, 0010L) + +#endif + +#define ALL_MOUSE_EVENTS (REPORT_MOUSE_POSITION - 1) + +/* macros to extract single event-bits from masks */ +#define BUTTON_RELEASE(e, x) ((e)&NCURSES_MOUSE_MASK(x, 001)) +#define BUTTON_PRESS(e, x) ((e)&NCURSES_MOUSE_MASK(x, 002)) +#define BUTTON_CLICK(e, x) ((e)&NCURSES_MOUSE_MASK(x, 004)) +#define BUTTON_DOUBLE_CLICK(e, x) ((e)&NCURSES_MOUSE_MASK(x, 010)) +#define BUTTON_TRIPLE_CLICK(e, x) ((e)&NCURSES_MOUSE_MASK(x, 020)) +#define BUTTON_RESERVED_EVENT(e, x) ((e)&NCURSES_MOUSE_MASK(x, 040)) + +typedef struct { + short id; /* ID to distinguish multiple devices */ + int x, y, z; /* event coordinates (character-cell) */ + mmask_t bstate; /* button state bits */ +} MEVENT; + +extern NCURSES_EXPORT(bool) has_mouse(void); +extern NCURSES_EXPORT(int) getmouse(MEVENT*); +extern NCURSES_EXPORT(int) ungetmouse(MEVENT*); +extern NCURSES_EXPORT(mmask_t) mousemask(mmask_t, mmask_t*); +extern NCURSES_EXPORT(bool) wenclose(const WINDOW*, int, int); +extern NCURSES_EXPORT(int) mouseinterval(int); +extern NCURSES_EXPORT(bool) wmouse_trafo(const WINDOW*, int*, int*, bool); +extern NCURSES_EXPORT(bool) mouse_trafo(int*, int*, bool); /* generated */ + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_mouse)(SCREEN*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(getmouse)(SCREEN*, MEVENT*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetmouse)(SCREEN*, MEVENT*); +extern NCURSES_EXPORT(mmask_t) + NCURSES_SP_NAME(mousemask)(SCREEN*, mmask_t, mmask_t*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mouseinterval)(SCREEN*, int); +#endif + +#ifndef NCURSES_NOMACROS +#define mouse_trafo(y, x, to_screen) wmouse_trafo(stdscr, y, x, to_screen) +#endif + +/* other non-XSI functions */ + +extern NCURSES_EXPORT(int) mcprint(char*, int); /* direct data to printer */ +extern NCURSES_EXPORT(int) has_key(int); /* do we have given key? */ + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(has_key)(SCREEN*, int); /* do we have given key? */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(mcprint)(SCREEN*, char*, int); /* direct data to printer */ +#endif + +/* Debugging : use with libncurses_g.a */ + +extern NCURSES_EXPORT(void) _tracef(const char*, ...) GCC_PRINTFLIKE(1, 2); +extern NCURSES_EXPORT(char*) _traceattr(attr_t); +extern NCURSES_EXPORT(char*) _traceattr2(int, chtype); +extern NCURSES_EXPORT(char*) _tracechar(int); +extern NCURSES_EXPORT(char*) _tracechtype(chtype); +extern NCURSES_EXPORT(char*) _tracechtype2(int, chtype); +#if NCURSES_WIDECHAR +#define _tracech_t _tracecchar_t +extern NCURSES_EXPORT(char*) _tracecchar_t(const cchar_t*); +#define _tracech_t2 _tracecchar_t2 +extern NCURSES_EXPORT(char*) _tracecchar_t2(int, const cchar_t*); +#else +#define _tracech_t _tracechtype +#define _tracech_t2 _tracechtype2 +#endif +extern NCURSES_EXPORT(void) trace(const unsigned int); + +/* trace masks */ +#define TRACE_DISABLE 0x0000 /* turn off tracing */ +#define TRACE_TIMES 0x0001 /* trace user and system times of updates */ +#define TRACE_TPUTS 0x0002 /* trace tputs calls */ +#define TRACE_UPDATE 0x0004 /* trace update actions, old & new screens */ +#define TRACE_MOVE 0x0008 /* trace cursor moves and scrolls */ +#define TRACE_CHARPUT 0x0010 /* trace all character outputs */ +#define TRACE_ORDINARY 0x001F /* trace all update actions */ +#define TRACE_CALLS 0x0020 /* trace all curses calls */ +#define TRACE_VIRTPUT 0x0040 /* trace virtual character puts */ +#define TRACE_IEVENT 0x0080 /* trace low-level input processing */ +#define TRACE_BITS 0x0100 /* trace state of TTY control bits */ +#define TRACE_ICALLS 0x0200 /* trace internal/nested calls */ +#define TRACE_CCALLS 0x0400 /* trace per-character calls */ +#define TRACE_DATABASE 0x0800 /* trace read/write of terminfo/termcap data */ +#define TRACE_ATTRS 0x1000 /* trace attribute updates */ + +#define TRACE_SHIFT 13 /* number of bits in the trace masks */ +#define TRACE_MAXIMUM ((1 << TRACE_SHIFT) - 1) /* maximum trace level */ + +#if defined(TRACE) || defined(NCURSES_TEST) +extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable; /* enable optimizations */ +extern NCURSES_EXPORT(const char*) _nc_visbuf(const char*); +#define OPTIMIZE_MVCUR 0x01 /* cursor movement optimization */ +#define OPTIMIZE_HASHMAP 0x02 /* diff hashing to detect scrolls */ +#define OPTIMIZE_SCROLL 0x04 /* scroll optimization */ +#define OPTIMIZE_ALL 0xff /* enable all optimizations (dflt) */ +#endif + +#include + +#ifdef __cplusplus + +#ifndef NCURSES_NOMACROS + +/* these names conflict with STL */ +#undef box +#undef clear +#undef erase +#undef move +#undef refresh + +#endif /* NCURSES_NOMACROS */ +} +#endif + +#endif /* __NCURSES_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/cursesapp.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/cursesapp.h new file mode 100644 index 0000000..b2f7bbd --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/cursesapp.h @@ -0,0 +1,174 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998-2005,2011 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1997 * + ****************************************************************************/ + +// $Id: cursesapp.h,v 1.12 2011/09/17 22:12:10 tom Exp $ + +#ifndef NCURSES_CURSESAPP_H_incl +#define NCURSES_CURSESAPP_H_incl + +#include + +class NCURSES_IMPEXP NCursesApplication { + public: + typedef struct _slk_link { // This structure is used to maintain + struct _slk_link* prev; // a stack of SLKs + Soft_Label_Key_Set* SLKs; + } SLK_Link; + + private: + static int rinit(NCursesWindow& w); // Internal Init function for title + static NCursesApplication* theApp; // Global ref. to the application + + static SLK_Link* slk_stack; + + protected: + static NCursesWindow* titleWindow; // The Title Window (if any) + + bool b_Colors; // Is this a color application? + NCursesWindow* Root_Window; // This is the stdscr equiv. + + // Initialization of attributes; + // Rewrite this in your derived class if you prefer other settings + virtual void init(bool bColors); + + // The number of lines for the title window. Default is no title window + // You may rewrite this in your derived class + virtual int titlesize() const { + return 0; + } + + // This method is called to put something into the title window initially + // You may rewrite this in your derived class + virtual void title() {} + + // The layout used for the Soft Label Keys. Default is to have no SLKs. + // You may rewrite this in your derived class + virtual Soft_Label_Key_Set::Label_Layout useSLKs() const { + return Soft_Label_Key_Set::None; + } + + // This method is called to initialize the SLKs. Default is nothing. + // You may rewrite this in your derived class + virtual void init_labels(Soft_Label_Key_Set& S) const { + (void)S; + } + + // Your derived class must implement this method. The return value must + // be the exit value of your application. + virtual int run() = 0; + + // The constructor is protected, so you may use it in your derived + // class constructor. The argument tells whether or not you want colors. + NCursesApplication(bool wantColors = FALSE); + + NCursesApplication& operator=(const NCursesApplication& rhs) { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesApplication(const NCursesApplication& rhs) + : b_Colors(rhs.b_Colors), Root_Window(rhs.Root_Window) {} + + public: + virtual ~NCursesApplication(); + + // Get a pointer to the current application object + static NCursesApplication* getApplication() { + return theApp; + } + + // This method runs the application and returns its exit value + int operator()(void); + + // Process the commandline arguments. The default implementation simply + // ignores them. Your derived class may rewrite this. + virtual void handleArgs(int argc, char* argv[]) { + (void)argc; + (void)argv; + } + + // Does this application use colors? + inline bool useColors() const { + return b_Colors; + } + + // Push the Key Set S onto the SLK Stack. S then becomes the current set + // of Soft Labelled Keys. + void push(Soft_Label_Key_Set& S); + + // Throw away the current set of SLKs and make the previous one the + // new current set. + bool pop(); + + // Retrieve the current set of Soft Labelled Keys. + Soft_Label_Key_Set* top() const; + + // Attributes to use for menu and forms foregrounds + virtual chtype foregrounds() const { + return b_Colors ? static_cast(COLOR_PAIR(1)) : A_BOLD; + } + + // Attributes to use for menu and forms backgrounds + virtual chtype backgrounds() const { + return b_Colors ? static_cast(COLOR_PAIR(2)) : A_NORMAL; + } + + // Attributes to use for inactive (menu) elements + virtual chtype inactives() const { + return b_Colors ? static_cast(COLOR_PAIR(3) | A_DIM) : A_DIM; + } + + // Attributes to use for (form) labels and SLKs + virtual chtype labels() const { + return b_Colors ? static_cast(COLOR_PAIR(4)) : A_NORMAL; + } + + // Attributes to use for form backgrounds + virtual chtype dialog_backgrounds() const { + return b_Colors ? static_cast(COLOR_PAIR(4)) : A_NORMAL; + } + + // Attributes to use as default for (form) window backgrounds + virtual chtype window_backgrounds() const { + return b_Colors ? static_cast(COLOR_PAIR(5)) : A_NORMAL; + } + + // Attributes to use for the title window + virtual chtype screen_titles() const { + return b_Colors ? static_cast(COLOR_PAIR(6)) : A_BOLD; + } +}; + +#endif /* NCURSES_CURSESAPP_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/cursesf.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/cursesf.h new file mode 100644 index 0000000..13ac431 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/cursesf.h @@ -0,0 +1,949 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998-2012,2014 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1997 * + ****************************************************************************/ + +// $Id: cursesf.h,v 1.32 2014/08/09 22:06:11 Adam.Jiang Exp $ + +#ifndef NCURSES_CURSESF_H_incl +#define NCURSES_CURSESF_H_incl 1 + +#include + +#ifndef __EXT_QNX +#include +#endif + +extern "C" { +#include +} +// +// ------------------------------------------------------------------------- +// The abstract base class for buitin and user defined Fieldtypes. +// ------------------------------------------------------------------------- +// +class NCURSES_IMPEXP NCursesFormField; // forward declaration + +// Class to represent builtin field types as well as C++ written new +// fieldtypes (see classes UserDefineFieldType... +class NCURSES_IMPEXP NCursesFieldType { + friend class NCursesFormField; + + protected: + FIELDTYPE* fieldtype; + + inline void OnError(int err) const + THROW2(NCursesException const, NCursesFormException) { + if (err != E_OK) + THROW(new NCursesFormException(err)); + } + + NCursesFieldType(FIELDTYPE* f) : fieldtype(f) {} + + virtual ~NCursesFieldType() {} + + // Set the fields f fieldtype to this one. + virtual void set(NCursesFormField& f) = 0; + + public: + NCursesFieldType() : fieldtype(STATIC_CAST(FIELDTYPE*)(0)) {} + + NCursesFieldType& operator=(const NCursesFieldType& rhs) { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesFieldType(const NCursesFieldType& rhs) : fieldtype(rhs.fieldtype) {} +}; + +// +// ------------------------------------------------------------------------- +// The class representing a forms field, wrapping the lowlevel FIELD struct +// ------------------------------------------------------------------------- +// +class NCURSES_IMPEXP NCursesFormField { + friend class NCursesForm; + + protected: + FIELD* field; // lowlevel structure + NCursesFieldType* ftype; // Associated field type + + // Error handler + inline void OnError(int err) const + THROW2(NCursesException const, NCursesFormException) { + if (err != E_OK) + THROW(new NCursesFormException(err)); + } + + public: + // Create a 'Null' field. Can be used to delimit a field list + NCursesFormField() + : field(STATIC_CAST(FIELD*)(0)), + ftype(STATIC_CAST(NCursesFieldType*)(0)) {} + + // Create a new field + NCursesFormField( + int rows, + int ncols, + int first_row = 0, + int first_col = 0, + int offscreen_rows = 0, + int additional_buffers = 0) + : field(0), ftype(STATIC_CAST(NCursesFieldType*)(0)) { + field = ::new_field( + rows, ncols, first_row, first_col, offscreen_rows, additional_buffers); + if (!field) + OnError(errno); + } + + NCursesFormField& operator=(const NCursesFormField& rhs) { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesFormField(const NCursesFormField& rhs) + : field(rhs.field), ftype(rhs.ftype) {} + + virtual ~NCursesFormField(); + + // Duplicate the field at a new position + inline NCursesFormField* dup(int first_row, int first_col) { + NCursesFormField* f = new NCursesFormField(); + if (!f) + OnError(E_SYSTEM_ERROR); + else { + f->ftype = ftype; + f->field = ::dup_field(field, first_row, first_col); + if (!f->field) + OnError(errno); + } + return f; + } + + // Link the field to a new location + inline NCursesFormField* link(int first_row, int first_col) { + NCursesFormField* f = new NCursesFormField(); + if (!f) + OnError(E_SYSTEM_ERROR); + else { + f->ftype = ftype; + f->field = ::link_field(field, first_row, first_col); + if (!f->field) + OnError(errno); + } + return f; + } + + // Get the lowlevel field representation + inline FIELD* get_field() const { + return field; + } + + // Retrieve info about the field + inline void info( + int& rows, + int& ncols, + int& first_row, + int& first_col, + int& offscreen_rows, + int& additional_buffers) const { + OnError( + ::field_info( + field, + &rows, + &ncols, + &first_row, + &first_col, + &offscreen_rows, + &additional_buffers)); + } + + // Retrieve info about the fields dynamic properties. + inline void + dynamic_info(int& dynamic_rows, int& dynamic_cols, int& max_growth) const { + OnError( + ::dynamic_field_info(field, &dynamic_rows, &dynamic_cols, &max_growth)); + } + + // For a dynamic field you may set the maximum growth limit. + // A zero means unlimited growth. + inline void set_maximum_growth(int growth = 0) { + OnError(::set_max_field(field, growth)); + } + + // Move the field to a new position + inline void move(int row, int col) { + OnError(::move_field(field, row, col)); + } + + // Mark the field to start a new page + inline void new_page(bool pageFlag = FALSE) { + OnError(::set_new_page(field, pageFlag)); + } + + // Retrieve whether or not the field starts a new page. + inline bool is_new_page() const { + return ::new_page(field); + } + + // Set the justification for the field + inline void set_justification(int just) { + OnError(::set_field_just(field, just)); + } + + // Retrieve the fields justification + inline int justification() const { + return ::field_just(field); + } + // Set the foreground attribute for the field + inline void set_foreground(chtype foreground) { + OnError(::set_field_fore(field, foreground)); + } + + // Retrieve the fields foreground attribute + inline chtype fore() const { + return ::field_fore(field); + } + + // Set the background attribute for the field + inline void set_background(chtype background) { + OnError(::set_field_back(field, background)); + } + + // Retrieve the fields background attribute + inline chtype back() const { + return ::field_back(field); + } + + // Set the padding character for the field + inline void set_pad_character(int padding) { + OnError(::set_field_pad(field, padding)); + } + + // Retrieve the fields padding character + inline int pad() const { + return ::field_pad(field); + } + + // Switch on the fields options + inline void options_on(Field_Options opts) { + OnError(::field_opts_on(field, opts)); + } + + // Switch off the fields options + inline void options_off(Field_Options opts) { + OnError(::field_opts_off(field, opts)); + } + + // Retrieve the fields options + inline Field_Options options() const { + return ::field_opts(field); + } + + // Set the fields options + inline void set_options(Field_Options opts) { + OnError(::set_field_opts(field, opts)); + } + + // Mark the field as changed + inline void set_changed(bool changeFlag = TRUE) { + OnError(::set_field_status(field, changeFlag)); + } + + // Test whether or not the field is marked as changed + inline bool changed() const { + return ::field_status(field); + } + + // Return the index of the field in the field array of a form + // or -1 if the field is not associated to a form + inline int(index)() const { + return ::field_index(field); + } + + // Store a value in a fields buffer. The default buffer is nr. 0 + inline void set_value(const char* val, int buffer = 0) { + OnError(::set_field_buffer(field, buffer, val)); + } + + // Retrieve the value of a fields buffer. The default buffer is nr. 0 + inline char* value(int buffer = 0) const { + return ::field_buffer(field, buffer); + } + + // Set the validation type of the field. + inline void set_fieldtype(NCursesFieldType& f) { + ftype = &f; + f.set(*this); // A good friend may do that... + } + + // Retrieve the validation type of the field. + inline NCursesFieldType* fieldtype() const { + return ftype; + } +}; + +// This are the built-in hook functions in this C++ binding. In C++ we use +// virtual member functions (see below On_..._Init and On_..._Termination) +// to provide this functionality in an object oriented manner. +extern "C" { +void _nc_xx_frm_init(FORM*); +void _nc_xx_frm_term(FORM*); +void _nc_xx_fld_init(FORM*); +void _nc_xx_fld_term(FORM*); +} + +// +// ------------------------------------------------------------------------- +// The class representing a form, wrapping the lowlevel FORM struct +// ------------------------------------------------------------------------- +// +class NCURSES_IMPEXP NCursesForm : public NCursesPanel { + protected: + FORM* form; // the lowlevel structure + + private: + NCursesWindow* sub; // the subwindow object + bool b_sub_owner; // is this our own subwindow? + bool b_framed; // has the form a border? + bool b_autoDelete; // Delete fields when deleting form? + + NCursesFormField** my_fields; // The array of fields for this form + + // This structure is used for the form's user data field to link the + // FORM* to the C++ object and to provide extra space for a user pointer. + typedef struct { + void* m_user; // the pointer for the user's data + const NCursesForm* m_back; // backward pointer to C++ object + const FORM* m_owner; + } UserHook; + + // Get the backward pointer to the C++ object from a FORM + static inline NCursesForm* getHook(const FORM* f) { + UserHook* hook = reinterpret_cast(::form_userptr(f)); + assert(hook != 0 && hook->m_owner == f); + return const_cast(hook->m_back); + } + + friend void _nc_xx_frm_init(FORM*); + friend void _nc_xx_frm_term(FORM*); + friend void _nc_xx_fld_init(FORM*); + friend void _nc_xx_fld_term(FORM*); + + // Calculate FIELD* array for the menu + FIELD** mapFields(NCursesFormField* nfields[]); + + protected: + // internal routines + inline void set_user(void* user) { + UserHook* uptr = reinterpret_cast(::form_userptr(form)); + assert(uptr != 0 && uptr->m_back == this && uptr->m_owner == form); + uptr->m_user = user; + } + + inline void* get_user() { + UserHook* uptr = reinterpret_cast(::form_userptr(form)); + assert(uptr != 0 && uptr->m_back == this && uptr->m_owner == form); + return uptr->m_user; + } + + void + InitForm(NCursesFormField* Fields[], bool with_frame, bool autoDeleteFields); + + inline void OnError(int err) const + THROW2(NCursesException const, NCursesFormException) { + if (err != E_OK) + THROW(new NCursesFormException(err)); + } + + // this wraps the form_driver call. + virtual int driver(int c); + + // 'Internal' constructor, builds an object without association to a + // field array. + NCursesForm(int nlines, int ncols, int begin_y = 0, int begin_x = 0) + : NCursesPanel(nlines, ncols, begin_y, begin_x), + form(STATIC_CAST(FORM*)(0)), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_fields(0) {} + + public: + // Create form for the default panel. + NCursesForm( + NCursesFormField* Fields[], + bool with_frame = FALSE, // reserve space for a frame? + bool autoDelete_Fields = FALSE) // do automatic cleanup? + : NCursesPanel(), + form(0), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_fields(0) { + InitForm(Fields, with_frame, autoDelete_Fields); + } + + // Create a form in a panel with the given position and size. + NCursesForm( + NCursesFormField* Fields[], + int nlines, + int ncols, + int begin_y, + int begin_x, + bool with_frame = FALSE, // reserve space for a frame? + bool autoDelete_Fields = FALSE) // do automatic cleanup? + : NCursesPanel(nlines, ncols, begin_y, begin_x), + form(0), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_fields(0) { + InitForm(Fields, with_frame, autoDelete_Fields); + } + + NCursesForm& operator=(const NCursesForm& rhs) { + if (this != &rhs) { + *this = rhs; + NCursesPanel::operator=(rhs); + } + return *this; + } + + NCursesForm(const NCursesForm& rhs) + : NCursesPanel(rhs), + form(rhs.form), + sub(rhs.sub), + b_sub_owner(rhs.b_sub_owner), + b_framed(rhs.b_framed), + b_autoDelete(rhs.b_autoDelete), + my_fields(rhs.my_fields) {} + + virtual ~NCursesForm(); + + // Set the default attributes for the form + virtual void setDefaultAttributes(); + + // Retrieve current field of the form. + inline NCursesFormField* current_field() const { + return my_fields[ ::field_index(::current_field(form))]; + } + + // Set the forms subwindow + void setSubWindow(NCursesWindow& sub); + + // Set these fields for the form + inline void setFields(NCursesFormField* Fields[]) { + OnError(::set_form_fields(form, mapFields(Fields))); + } + + // Remove the form from the screen + inline void unpost(void) { + OnError(::unpost_form(form)); + } + + // Post the form to the screen if flag is true, unpost it otherwise + inline void post(bool flag = TRUE) { + OnError(flag ? ::post_form(form) : ::unpost_form(form)); + } + + // Decorations + inline void frame(const char* title = NULL, const char* btitle = NULL) { + if (b_framed) + NCursesPanel::frame(title, btitle); + else + OnError(E_SYSTEM_ERROR); + } + + inline void boldframe(const char* title = NULL, const char* btitle = NULL) { + if (b_framed) + NCursesPanel::boldframe(title, btitle); + else + OnError(E_SYSTEM_ERROR); + } + + inline void label(const char* topLabel, const char* bottomLabel) { + if (b_framed) + NCursesPanel::label(topLabel, bottomLabel); + else + OnError(E_SYSTEM_ERROR); + } + + // ----- + // Hooks + // ----- + + // Called after the form gets repositioned in its window. + // This is especially true if the form is posted. + virtual void On_Form_Init(); + + // Called before the form gets repositioned in its window. + // This is especially true if the form is unposted. + virtual void On_Form_Termination(); + + // Called after the field became the current field + virtual void On_Field_Init(NCursesFormField& field); + + // Called before this field is left as current field. + virtual void On_Field_Termination(NCursesFormField& field); + + // Calculate required window size for the form. + void scale(int& rows, int& ncols) const { + OnError(::scale_form(form, &rows, &ncols)); + } + + // Retrieve number of fields in the form. + int count() const { + return ::field_count(form); + } + + // Make the page the current page of the form. + void set_page(int pageNum) { + OnError(::set_form_page(form, pageNum)); + } + + // Retrieve current page number + int page() const { + return ::form_page(form); + } + + // Switch on the forms options + inline void options_on(Form_Options opts) { + OnError(::form_opts_on(form, opts)); + } + + // Switch off the forms options + inline void options_off(Form_Options opts) { + OnError(::form_opts_off(form, opts)); + } + + // Retrieve the forms options + inline Form_Options options() const { + return ::form_opts(form); + } + + // Set the forms options + inline void set_options(Form_Options opts) { + OnError(::set_form_opts(form, opts)); + } + + // Are there more data in the current field after the data shown + inline bool data_ahead() const { + return ::data_ahead(form); + } + + // Are there more data in the current field before the data shown + inline bool data_behind() const { + return ::data_behind(form); + } + + // Position the cursor to the current field + inline void position_cursor() { + OnError(::pos_form_cursor(form)); + } + // Set the current field + inline void set_current(NCursesFormField& F) { + OnError(::set_current_field(form, F.field)); + } + + // Provide a default key virtualization. Translate the keyboard + // code c into a form request code. + // The default implementation provides a hopefully straightforward + // mapping for the most common keystrokes and form requests. + virtual int virtualize(int c); + + // Operators + inline NCursesFormField* operator[](int i) const { + if ((i < 0) || (i >= ::field_count(form))) + OnError(E_BAD_ARGUMENT); + return my_fields[i]; + } + + // Perform the menu's operation + // Return the field where you left the form. + virtual NCursesFormField* operator()(void); + + // Exception handlers. The default is a Beep. + virtual void On_Request_Denied(int c) const; + virtual void On_Invalid_Field(int c) const; + virtual void On_Unknown_Command(int c) const; +}; + +// +// ------------------------------------------------------------------------- +// This is the typical C++ typesafe way to allow to attach +// user data to a field of a form. Its assumed that the user +// data belongs to some class T. Use T as template argument +// to create a UserField. +// ------------------------------------------------------------------------- +template +class NCURSES_IMPEXP NCursesUserField : public NCursesFormField { + public: + NCursesUserField( + int rows, + int ncols, + int first_row = 0, + int first_col = 0, + const T* p_UserData = STATIC_CAST(T*)(0), + int offscreen_rows = 0, + int additional_buffers = 0) + : NCursesFormField( + rows, + ncols, + first_row, + first_col, + offscreen_rows, + additional_buffers) { + if (field) + OnError(::set_field_userptr(field, STATIC_CAST(void*)(p_UserData))); + } + + virtual ~NCursesUserField(){}; + + inline const T* UserData(void) const { + return reinterpret_cast(::field_userptr(field)); + } + + inline virtual void setUserData(const T* p_UserData) { + if (field) + OnError(::set_field_userptr(field, STATIC_CAST(void*)(p_UserData))); + } +}; +// +// ------------------------------------------------------------------------- +// The same mechanism is used to attach user data to a form +// ------------------------------------------------------------------------- +// +template +class NCURSES_IMPEXP NCursesUserForm : public NCursesForm { + protected: + // 'Internal' constructor, builds an object without association to a + // field array. + NCursesUserForm( + int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = STATIC_CAST(T*)(0)) + : NCursesForm(nlines, ncols, begin_y, begin_x) { + if (form) + set_user(const_cast(reinterpret_cast(p_UserData))); + } + + public: + NCursesUserForm( + NCursesFormField* Fields[], + const T* p_UserData = STATIC_CAST(T*)(0), + bool with_frame = FALSE, + bool autoDelete_Fields = FALSE) + : NCursesForm(Fields, with_frame, autoDelete_Fields) { + if (form) + set_user(const_cast(reinterpret_cast(p_UserData))); + }; + + NCursesUserForm( + NCursesFormField* Fields[], + int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = STATIC_CAST(T*)(0), + bool with_frame = FALSE, + bool autoDelete_Fields = FALSE) + : NCursesForm( + Fields, + nlines, + ncols, + begin_y, + begin_x, + with_frame, + autoDelete_Fields) { + if (form) + set_user(const_cast(reinterpret_cast(p_UserData))); + }; + + virtual ~NCursesUserForm(){}; + + inline T* UserData(void) { + return reinterpret_cast(get_user()); + }; + + inline virtual void setUserData(const T* p_UserData) { + if (form) + set_user(const_cast(reinterpret_cast(p_UserData))); + } +}; +// +// ------------------------------------------------------------------------- +// Builtin Fieldtypes +// ------------------------------------------------------------------------- +// +class NCURSES_IMPEXP Alpha_Field : public NCursesFieldType { + private: + int min_field_width; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(), fieldtype, min_field_width)); + } + + public: + Alpha_Field(int width) + : NCursesFieldType(TYPE_ALPHA), min_field_width(width) {} +}; + +class NCURSES_IMPEXP Alphanumeric_Field : public NCursesFieldType { + private: + int min_field_width; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(), fieldtype, min_field_width)); + } + + public: + Alphanumeric_Field(int width) + : NCursesFieldType(TYPE_ALNUM), min_field_width(width) {} +}; + +class NCURSES_IMPEXP Integer_Field : public NCursesFieldType { + private: + int precision; + long lower_limit, upper_limit; + + void set(NCursesFormField& f) { + OnError( + ::set_field_type( + f.get_field(), fieldtype, precision, lower_limit, upper_limit)); + } + + public: + Integer_Field(int prec, long low = 0L, long high = 0L) + : NCursesFieldType(TYPE_INTEGER), + precision(prec), + lower_limit(low), + upper_limit(high) {} +}; + +class NCURSES_IMPEXP Numeric_Field : public NCursesFieldType { + private: + int precision; + double lower_limit, upper_limit; + + void set(NCursesFormField& f) { + OnError( + ::set_field_type( + f.get_field(), fieldtype, precision, lower_limit, upper_limit)); + } + + public: + Numeric_Field(int prec, double low = 0.0, double high = 0.0) + : NCursesFieldType(TYPE_NUMERIC), + precision(prec), + lower_limit(low), + upper_limit(high) {} +}; + +class NCURSES_IMPEXP Regular_Expression_Field : public NCursesFieldType { + private: + char* regex; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(), fieldtype, regex)); + } + + void copy_regex(const char* source) { + regex = new char[1 + ::strlen(source)]; + (::strcpy)(regex, source); + } + + public: + Regular_Expression_Field(const char* expr) + : NCursesFieldType(TYPE_REGEXP), regex(NULL) { + copy_regex(expr); + } + + Regular_Expression_Field& operator=(const Regular_Expression_Field& rhs) { + if (this != &rhs) { + *this = rhs; + copy_regex(rhs.regex); + NCursesFieldType::operator=(rhs); + } + return *this; + } + + Regular_Expression_Field(const Regular_Expression_Field& rhs) + : NCursesFieldType(rhs), regex(NULL) { + copy_regex(rhs.regex); + } + + ~Regular_Expression_Field() { + delete[] regex; + } +}; + +class NCURSES_IMPEXP Enumeration_Field : public NCursesFieldType { + private: + const char** list; + int case_sensitive; + int non_unique_matches; + + void set(NCursesFormField& f) { + OnError( + ::set_field_type( + f.get_field(), + fieldtype, + list, + case_sensitive, + non_unique_matches)); + } + + public: + Enumeration_Field( + const char* enums[], + bool case_sens = FALSE, + bool non_unique = FALSE) + : NCursesFieldType(TYPE_ENUM), + list(enums), + case_sensitive(case_sens ? -1 : 0), + non_unique_matches(non_unique ? -1 : 0) {} + + Enumeration_Field& operator=(const Enumeration_Field& rhs) { + if (this != &rhs) { + *this = rhs; + NCursesFieldType::operator=(rhs); + } + return *this; + } + + Enumeration_Field(const Enumeration_Field& rhs) + : NCursesFieldType(rhs), + list(rhs.list), + case_sensitive(rhs.case_sensitive), + non_unique_matches(rhs.non_unique_matches) {} +}; + +class NCURSES_IMPEXP IPV4_Address_Field : public NCursesFieldType { + private: + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(), fieldtype)); + } + + public: + IPV4_Address_Field() : NCursesFieldType(TYPE_IPV4) {} +}; + +extern "C" { +bool _nc_xx_fld_fcheck(FIELD*, const void*); +bool _nc_xx_fld_ccheck(int c, const void*); +void* _nc_xx_fld_makearg(va_list*); +} + +// +// ------------------------------------------------------------------------- +// Abstract base class for User-Defined Fieldtypes +// ------------------------------------------------------------------------- +// +class NCURSES_IMPEXP UserDefinedFieldType : public NCursesFieldType { + friend class UDF_Init; // Internal helper to set up statics + private: + // For all C++ defined fieldtypes we need only one generic lowlevel + // FIELDTYPE* element. + static FIELDTYPE* generic_fieldtype; + + protected: + // This are the functions required by the low level libforms functions + // to construct a fieldtype. + friend bool _nc_xx_fld_fcheck(FIELD*, const void*); + friend bool _nc_xx_fld_ccheck(int c, const void*); + friend void* _nc_xx_fld_makearg(va_list*); + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(), fieldtype, &f)); + } + + protected: + // Redefine this function to do a field validation. The argument + // is a reference to the field you should validate. + virtual bool field_check(NCursesFormField& f) = 0; + + // Redefine this function to do a character validation. The argument + // is the character to be validated. + virtual bool char_check(int c) = 0; + + public: + UserDefinedFieldType() : NCursesFieldType(generic_fieldtype) {} +}; + +extern "C" { +bool _nc_xx_next_choice(FIELD*, const void*); +bool _nc_xx_prev_choice(FIELD*, const void*); +} + +// +// ------------------------------------------------------------------------- +// Abstract base class for User-Defined Fieldtypes with Choice functions +// ------------------------------------------------------------------------- +// +class NCURSES_IMPEXP UserDefinedFieldType_With_Choice + : public UserDefinedFieldType { + friend class UDF_Init; // Internal helper to set up statics + private: + // For all C++ defined fieldtypes with choice functions we need only one + // generic lowlevel FIELDTYPE* element. + static FIELDTYPE* generic_fieldtype_with_choice; + + // This are the functions required by the low level libforms functions + // to construct a fieldtype with choice functions. + friend bool _nc_xx_next_choice(FIELD*, const void*); + friend bool _nc_xx_prev_choice(FIELD*, const void*); + + protected: + // Redefine this function to do the retrieval of the next choice value. + // The argument is a reference to the field tobe examined. + virtual bool next(NCursesFormField& f) = 0; + + // Redefine this function to do the retrieval of the previous choice value. + // The argument is a reference to the field tobe examined. + virtual bool previous(NCursesFormField& f) = 0; + + public: + UserDefinedFieldType_With_Choice() { + fieldtype = generic_fieldtype_with_choice; + } +}; + +#endif /* NCURSES_CURSESF_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/cursesm.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/cursesm.h new file mode 100644 index 0000000..5e643ab --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/cursesm.h @@ -0,0 +1,650 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998-2012,2014 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1997 * + ****************************************************************************/ + +// $Id: cursesm.h,v 1.30 2014/08/09 22:06:18 Adam.Jiang Exp $ + +#ifndef NCURSES_CURSESM_H_incl +#define NCURSES_CURSESM_H_incl 1 + +#include + +extern "C" { +#include +} +// +// ------------------------------------------------------------------------- +// This wraps the ITEM type of +// ------------------------------------------------------------------------- +// +class NCURSES_IMPEXP NCursesMenuItem { + friend class NCursesMenu; + + protected: + ITEM* item; + + inline void OnError(int err) const + THROW2(NCursesException const, NCursesMenuException) { + if (err != E_OK) + THROW(new NCursesMenuException(err)); + } + + public: + NCursesMenuItem(const char* p_name = NULL, const char* p_descript = NULL) + : item(0) { + item = p_name ? ::new_item(p_name, p_descript) : STATIC_CAST(ITEM*)(0); + if (p_name && !item) + OnError(E_SYSTEM_ERROR); + } + // Create an item. If you pass both parameters as NULL, a delimiting + // item is constructed which can be used to terminate a list of + // NCursesMenu objects. + + NCursesMenuItem& operator=(const NCursesMenuItem& rhs) { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesMenuItem(const NCursesMenuItem& rhs) : item(0) { + (void)rhs; + } + + virtual ~NCursesMenuItem(); + // Release the items memory + + inline const char* name() const { + return ::item_name(item); + } + // Name of the item + + inline const char* description() const { + return ::item_description(item); + } + // Description of the item + + inline int(index)(void) const { + return ::item_index(item); + } + // Index of the item in an item array (or -1) + + inline void options_on(Item_Options opts) { + OnError(::item_opts_on(item, opts)); + } + // Switch on the items options + + inline void options_off(Item_Options opts) { + OnError(::item_opts_off(item, opts)); + } + // Switch off the item's option + + inline Item_Options options() const { + return ::item_opts(item); + } + // Retrieve the items options + + inline void set_options(Item_Options opts) { + OnError(::set_item_opts(item, opts)); + } + // Set the items options + + inline void set_value(bool f) { + OnError(::set_item_value(item, f)); + } + // Set/Reset the items selection state + + inline bool value() const { + return ::item_value(item); + } + // Retrieve the items selection state + + inline bool visible() const { + return ::item_visible(item); + } + // Retrieve visibility of the item + + virtual bool action(); + // Perform an action associated with this item; you may use this in an + // user supplied driver for a menu; you may derive from this class and + // overload action() to supply items with different actions. + // If an action returns true, the menu will be exited. The default action + // is to do nothing. +}; + +// Prototype for an items callback function. +typedef bool ITEMCALLBACK(NCursesMenuItem&); + +// If you don't like to create a child class for individual items to +// overload action(), you may use this class and provide a callback +// function pointer for items. +class NCURSES_IMPEXP NCursesMenuCallbackItem : public NCursesMenuItem { + private: + ITEMCALLBACK* p_fct; + + public: + NCursesMenuCallbackItem( + ITEMCALLBACK* fct = NULL, + const char* p_name = NULL, + const char* p_descript = NULL) + : NCursesMenuItem(p_name, p_descript), p_fct(fct) {} + + NCursesMenuCallbackItem& operator=(const NCursesMenuCallbackItem& rhs) { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesMenuCallbackItem(const NCursesMenuCallbackItem& rhs) + : NCursesMenuItem(rhs), p_fct(0) {} + + virtual ~NCursesMenuCallbackItem(); + + bool action(); +}; + +// This are the built-in hook functions in this C++ binding. In C++ we use +// virtual member functions (see below On_..._Init and On_..._Termination) +// to provide this functionality in an object oriented manner. +extern "C" { +void _nc_xx_mnu_init(MENU*); +void _nc_xx_mnu_term(MENU*); +void _nc_xx_itm_init(MENU*); +void _nc_xx_itm_term(MENU*); +} + +// +// ------------------------------------------------------------------------- +// This wraps the MENU type of +// ------------------------------------------------------------------------- +// +class NCURSES_IMPEXP NCursesMenu : public NCursesPanel { + protected: + MENU* menu; + + private: + NCursesWindow* sub; // the subwindow object + bool b_sub_owner; // is this our own subwindow? + bool b_framed; // has the menu a border? + bool b_autoDelete; // Delete items when deleting menu? + + NCursesMenuItem** my_items; // The array of items for this menu + + // This structure is used for the menu's user data field to link the + // MENU* to the C++ object and to provide extra space for a user pointer. + typedef struct { + void* m_user; // the pointer for the user's data + const NCursesMenu* m_back; // backward pointer to C++ object + const MENU* m_owner; + } UserHook; + + // Get the backward pointer to the C++ object from a MENU + static inline NCursesMenu* getHook(const MENU* m) { + UserHook* hook = STATIC_CAST(UserHook*)(::menu_userptr(m)); + assert(hook != 0 && hook->m_owner == m); + return const_cast(hook->m_back); + } + + friend void _nc_xx_mnu_init(MENU*); + friend void _nc_xx_mnu_term(MENU*); + friend void _nc_xx_itm_init(MENU*); + friend void _nc_xx_itm_term(MENU*); + + // Calculate ITEM* array for the menu + ITEM** mapItems(NCursesMenuItem* nitems[]); + + protected: + // internal routines + inline void set_user(void* user) { + UserHook* uptr = STATIC_CAST(UserHook*)(::menu_userptr(menu)); + assert(uptr != 0 && uptr->m_back == this && uptr->m_owner == menu); + uptr->m_user = user; + } + + inline void* get_user() { + UserHook* uptr = STATIC_CAST(UserHook*)(::menu_userptr(menu)); + assert(uptr != 0 && uptr->m_back == this && uptr->m_owner == menu); + return uptr->m_user; + } + + void InitMenu(NCursesMenuItem* menu[], bool with_frame, bool autoDeleteItems); + + inline void OnError(int err) const + THROW2(NCursesException const, NCursesMenuException) { + if (err != E_OK) + THROW(new NCursesMenuException(this, err)); + } + + // this wraps the menu_driver call. + virtual int driver(int c); + + // 'Internal' constructor to create a menu without association to + // an array of items. + NCursesMenu(int nlines, int ncols, int begin_y = 0, int begin_x = 0) + : NCursesPanel(nlines, ncols, begin_y, begin_x), + menu(STATIC_CAST(MENU*)(0)), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_items(0) {} + + public: + // Make a full window size menu + NCursesMenu( + NCursesMenuItem* Items[], + bool with_frame = FALSE, // Reserve space for a frame? + bool autoDelete_Items = FALSE) // Autocleanup of Items? + : NCursesPanel(), + menu(0), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_items(0) { + InitMenu(Items, with_frame, autoDelete_Items); + } + + // Make a menu with a window of this size. + NCursesMenu( + NCursesMenuItem* Items[], + int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + bool with_frame = FALSE, // Reserve space for a frame? + bool autoDelete_Items = FALSE) // Autocleanup of Items? + : NCursesPanel(nlines, ncols, begin_y, begin_x), + menu(0), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_items(0) { + InitMenu(Items, with_frame, autoDelete_Items); + } + + NCursesMenu& operator=(const NCursesMenu& rhs) { + if (this != &rhs) { + *this = rhs; + NCursesPanel::operator=(rhs); + } + return *this; + } + + NCursesMenu(const NCursesMenu& rhs) + : NCursesPanel(rhs), + menu(rhs.menu), + sub(rhs.sub), + b_sub_owner(rhs.b_sub_owner), + b_framed(rhs.b_framed), + b_autoDelete(rhs.b_autoDelete), + my_items(rhs.my_items) {} + + virtual ~NCursesMenu(); + + // Retrieve the menus subwindow + inline NCursesWindow& subWindow() const { + assert(sub != NULL); + return *sub; + } + + // Set the menus subwindow + void setSubWindow(NCursesWindow& sub); + + // Set these items for the menu + inline void setItems(NCursesMenuItem* Items[]) { + OnError(::set_menu_items(menu, mapItems(Items))); + } + + // Remove the menu from the screen + inline void unpost(void) { + OnError(::unpost_menu(menu)); + } + + // Post the menu to the screen if flag is true, unpost it otherwise + inline void post(bool flag = TRUE) { + flag ? OnError(::post_menu(menu)) : OnError(::unpost_menu(menu)); + } + + // Get the numer of rows and columns for this menu + inline void scale(int& mrows, int& mcols) const { + OnError(::scale_menu(menu, &mrows, &mcols)); + } + + // Set the format of this menu + inline void set_format(int mrows, int mcols) { + OnError(::set_menu_format(menu, mrows, mcols)); + } + + // Get the format of this menu + inline void menu_format(int& rows, int& ncols) { + ::menu_format(menu, &rows, &ncols); + } + + // Items of the menu + inline NCursesMenuItem* items() const { + return *my_items; + } + + // Get the number of items in this menu + inline int count() const { + return ::item_count(menu); + } + + // Get the current item (i.e. the one the cursor is located) + inline NCursesMenuItem* current_item() const { + return my_items[ ::item_index(::current_item(menu))]; + } + + // Get the marker string + inline const char* mark() const { + return ::menu_mark(menu); + } + + // Set the marker string + inline void set_mark(const char* marker) { + OnError(::set_menu_mark(menu, marker)); + } + + // Get the name of the request code c + inline static const char* request_name(int c) { + return ::menu_request_name(c); + } + + // Get the current pattern + inline char* pattern() const { + return ::menu_pattern(menu); + } + + // true if there is a pattern match, false otherwise. + bool set_pattern(const char* pat); + + // set the default attributes for the menu + // i.e. set fore, back and grey attribute + virtual void setDefaultAttributes(); + + // Get the menus background attributes + inline chtype back() const { + return ::menu_back(menu); + } + + // Get the menus foreground attributes + inline chtype fore() const { + return ::menu_fore(menu); + } + + // Get the menus grey attributes (used for unselectable items) + inline chtype grey() const { + return ::menu_grey(menu); + } + + // Set the menus background attributes + inline chtype set_background(chtype a) { + return ::set_menu_back(menu, a); + } + + // Set the menus foreground attributes + inline chtype set_foreground(chtype a) { + return ::set_menu_fore(menu, a); + } + + // Set the menus grey attributes (used for unselectable items) + inline chtype set_grey(chtype a) { + return ::set_menu_grey(menu, a); + } + + inline void options_on(Menu_Options opts) { + OnError(::menu_opts_on(menu, opts)); + } + + inline void options_off(Menu_Options opts) { + OnError(::menu_opts_off(menu, opts)); + } + + inline Menu_Options options() const { + return ::menu_opts(menu); + } + + inline void set_options(Menu_Options opts) { + OnError(::set_menu_opts(menu, opts)); + } + + inline int pad() const { + return ::menu_pad(menu); + } + + inline void set_pad(int padch) { + OnError(::set_menu_pad(menu, padch)); + } + + // Position the cursor to the current item + inline void position_cursor() const { + OnError(::pos_menu_cursor(menu)); + } + + // Set the current item + inline void set_current(NCursesMenuItem& I) { + OnError(::set_current_item(menu, I.item)); + } + + // Get the current top row of the menu + inline int top_row(void) const { + return ::top_row(menu); + } + + // Set the current top row of the menu + inline void set_top_row(int row) { + OnError(::set_top_row(menu, row)); + } + + // spacing control + // Set the spacing for the menu + inline void setSpacing(int spc_description, int spc_rows, int spc_columns) { + OnError(::set_menu_spacing(menu, spc_description, spc_rows, spc_columns)); + } + + // Get the spacing info for the menu + inline void Spacing(int& spc_description, int& spc_rows, int& spc_columns) + const { + OnError(::menu_spacing(menu, &spc_description, &spc_rows, &spc_columns)); + } + + // Decorations + inline void frame(const char* title = NULL, const char* btitle = NULL) { + if (b_framed) + NCursesPanel::frame(title, btitle); + else + OnError(E_SYSTEM_ERROR); + } + + inline void boldframe(const char* title = NULL, const char* btitle = NULL) { + if (b_framed) + NCursesPanel::boldframe(title, btitle); + else + OnError(E_SYSTEM_ERROR); + } + + inline void label(const char* topLabel, const char* bottomLabel) { + if (b_framed) + NCursesPanel::label(topLabel, bottomLabel); + else + OnError(E_SYSTEM_ERROR); + } + + // ----- + // Hooks + // ----- + + // Called after the menu gets repositioned in its window. + // This is especially true if the menu is posted. + virtual void On_Menu_Init(); + + // Called before the menu gets repositioned in its window. + // This is especially true if the menu is unposted. + virtual void On_Menu_Termination(); + + // Called after the item became the current item + virtual void On_Item_Init(NCursesMenuItem& item); + + // Called before this item is left as current item. + virtual void On_Item_Termination(NCursesMenuItem& item); + + // Provide a default key virtualization. Translate the keyboard + // code c into a menu request code. + // The default implementation provides a hopefully straightforward + // mapping for the most common keystrokes and menu requests. + virtual int virtualize(int c); + + // Operators + inline NCursesMenuItem* operator[](int i) const { + if ((i < 0) || (i >= ::item_count(menu))) + OnError(E_BAD_ARGUMENT); + return (my_items[i]); + } + + // Perform the menu's operation + // Return the item where you left the selection mark for a single + // selection menu, or NULL for a multivalued menu. + virtual NCursesMenuItem* operator()(void); + + // -------------------- + // Exception handlers + // Called by operator() + // -------------------- + + // Called if the request is denied + virtual void On_Request_Denied(int c) const; + + // Called if the item is not selectable + virtual void On_Not_Selectable(int c) const; + + // Called if pattern doesn't match + virtual void On_No_Match(int c) const; + + // Called if the command is unknown + virtual void On_Unknown_Command(int c) const; +}; +// +// ------------------------------------------------------------------------- +// This is the typical C++ typesafe way to allow to attach +// user data to an item of a menu. Its assumed that the user +// data belongs to some class T. Use T as template argument +// to create a UserItem. +// ------------------------------------------------------------------------- +// +template +class NCURSES_IMPEXP NCursesUserItem : public NCursesMenuItem { + public: + NCursesUserItem( + const char* p_name, + const char* p_descript = NULL, + const T* p_UserData = STATIC_CAST(T*)(0)) + : NCursesMenuItem(p_name, p_descript) { + if (item) + OnError( + ::set_item_userptr( + item, + const_cast(reinterpret_cast(p_UserData)))); + } + + virtual ~NCursesUserItem() {} + + inline const T* UserData(void) const { + return reinterpret_cast(::item_userptr(item)); + }; + + inline virtual void setUserData(const T* p_UserData) { + if (item) + OnError( + ::set_item_userptr( + item, + const_cast(reinterpret_cast(p_UserData)))); + } +}; +// +// ------------------------------------------------------------------------- +// The same mechanism is used to attach user data to a menu +// ------------------------------------------------------------------------- +// +template +class NCURSES_IMPEXP NCursesUserMenu : public NCursesMenu { + protected: + NCursesUserMenu( + int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = STATIC_CAST(T*)(0)) + : NCursesMenu(nlines, ncols, begin_y, begin_x) { + if (menu) + set_user(const_cast(reinterpret_cast(p_UserData))); + } + + public: + NCursesUserMenu( + NCursesMenuItem* Items[], + const T* p_UserData = STATIC_CAST(T*)(0), + bool with_frame = FALSE, + bool autoDelete_Items = FALSE) + : NCursesMenu(Items, with_frame, autoDelete_Items) { + if (menu) + set_user(const_cast(reinterpret_cast(p_UserData))); + }; + + NCursesUserMenu( + NCursesMenuItem* Items[], + int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = STATIC_CAST(T*)(0), + bool with_frame = FALSE) + : NCursesMenu(Items, nlines, ncols, begin_y, begin_x, with_frame) { + if (menu) + set_user(const_cast(reinterpret_cast(p_UserData))); + }; + + virtual ~NCursesUserMenu(){}; + + inline T* UserData(void) { + return reinterpret_cast(get_user()); + }; + + inline virtual void setUserData(const T* p_UserData) { + if (menu) + set_user(const_cast(reinterpret_cast(p_UserData))); + } +}; + +#endif /* NCURSES_CURSESM_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/cursesp.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/cursesp.h new file mode 100644 index 0000000..a2c9b16 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/cursesp.h @@ -0,0 +1,238 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998-2012,2014 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1997 * + ****************************************************************************/ + +#ifndef NCURSES_CURSESP_H_incl +#define NCURSES_CURSESP_H_incl 1 + +// $Id: cursesp.h,v 1.31 2014/08/09 22:06:26 Adam.Jiang Exp $ + +#include + +extern "C" { +#include +} + +class NCURSES_IMPEXP NCursesPanel : public NCursesWindow { + protected: + PANEL* p; + static NCursesPanel* dummy; + + private: + // This structure is used for the panel's user data field to link the + // PANEL* to the C++ object and to provide extra space for a user pointer. + typedef struct { + void* m_user; // the pointer for the user's data + const NCursesPanel* m_back; // backward pointer to C++ object + const PANEL* m_owner; // the panel itself + } UserHook; + + inline UserHook* UserPointer() { + UserHook* uptr = + reinterpret_cast(const_cast(::panel_userptr(p))); + return uptr; + } + + void init(); // Initialize the panel object + + protected: + void set_user(void* user) { + UserHook* uptr = UserPointer(); + if (uptr != 0 && uptr->m_back == this && uptr->m_owner == p) { + uptr->m_user = user; + } + } + // Set the user pointer of the panel. + + void* get_user() { + UserHook* uptr = UserPointer(); + void* result = 0; + if (uptr != 0 && uptr->m_back == this && uptr->m_owner == p) + result = uptr->m_user; + return result; + } + + void OnError(int err) const + THROW2(NCursesException const, NCursesPanelException) { + if (err == ERR) + THROW(new NCursesPanelException(this, err)); + } + // If err is equal to the curses error indicator ERR, an error handler + // is called. + + // Get a keystroke. Default implementation calls getch() + virtual int getKey(void); + + public: + NCursesPanel(int nlines, int ncols, int begin_y = 0, int begin_x = 0) + : NCursesWindow(nlines, ncols, begin_y, begin_x), p(0) { + init(); + } + // Create a panel with this size starting at the requested position. + + NCursesPanel() : NCursesWindow(::stdscr), p(0) { + init(); + } + // This constructor creates the default Panel associated with the + // ::stdscr window + + NCursesPanel& operator=(const NCursesPanel& rhs) { + if (this != &rhs) { + *this = rhs; + NCursesWindow::operator=(rhs); + } + return *this; + } + + NCursesPanel(const NCursesPanel& rhs) : NCursesWindow(rhs), p(rhs.p) {} + + virtual ~NCursesPanel(); + + // basic manipulation + inline void hide() { + OnError(::hide_panel(p)); + } + // Hide the panel. It stays in the stack but becomes invisible. + + inline void show() { + OnError(::show_panel(p)); + } + // Show the panel, i.e. make it visible. + + inline void top() { + OnError(::top_panel(p)); + } + // Make this panel the top panel in the stack. + + inline void bottom() { + OnError(::bottom_panel(p)); + } + // Make this panel the bottom panel in the stack. + // N.B.: The panel associated with ::stdscr is always on the bottom. So + // actually bottom() makes the panel the first above ::stdscr. + + virtual int mvwin(int y, int x) { + OnError(::move_panel(p, y, x)); + return OK; + } + + inline bool hidden() const { + return (::panel_hidden(p) ? TRUE : FALSE); + } + // Return TRUE if the panel is hidden, FALSE otherwise. + + /* The functions panel_above() and panel_below() are not reflected in + the NCursesPanel class. The reason for this is, that we cannot + assume that a panel retrieved by those operations is one wrapped + by a C++ class. Although this situation might be handled, we also + need a reverse mapping from PANEL to NCursesPanel which needs some + redesign of the low level stuff. At the moment, we define them in the + interface but they will always produce an error. */ + inline NCursesPanel& above() const { + OnError(ERR); + return *dummy; + } + + inline NCursesPanel& below() const { + OnError(ERR); + return *dummy; + } + + // Those two are rewrites of the corresponding virtual members of + // NCursesWindow + virtual int refresh(); + // Propagate all panel changes to the virtual screen and update the + // physical screen. + + virtual int noutrefresh(); + // Propagate all panel changes to the virtual screen. + + static void redraw(); + // Redraw all panels. + + // decorations + virtual void frame(const char* title = NULL, const char* btitle = NULL); + // Put a frame around the panel and put the title centered in the top line + // and btitle in the bottom line. + + virtual void boldframe(const char* title = NULL, const char* btitle = NULL); + // Same as frame(), but use highlighted attributes. + + virtual void label(const char* topLabel, const char* bottomLabel); + // Put the title centered in the top line and btitle in the bottom line. + + virtual void centertext(int row, const char* label); + // Put the label text centered in the specified row. +}; + +/* We use templates to provide a typesafe mechanism to associate + * user data with a panel. A NCursesUserPanel is a panel + * associated with some user data of type T. + */ +template +class NCursesUserPanel : public NCursesPanel { + public: + NCursesUserPanel( + int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = STATIC_CAST(T*)(0)) + : NCursesPanel(nlines, ncols, begin_y, begin_x) { + if (p) + set_user(const_cast(reinterpret_cast(p_UserData))); + }; + // This creates an user panel of the requested size with associated + // user data pointed to by p_UserData. + + NCursesUserPanel(const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesPanel() { + if (p) + set_user(const_cast(reinterpret_cast(p_UserData))); + }; + // This creates an user panel associated with the ::stdscr and user data + // pointed to by p_UserData. + + virtual ~NCursesUserPanel(){}; + + T* UserData(void) { + return reinterpret_cast(get_user()); + }; + // Retrieve the user data associated with the panel. + + virtual void setUserData(const T* p_UserData) { + if (p) + set_user(const_cast(reinterpret_cast(p_UserData))); + } + // Associate the user panel with the user data pointed to by p_UserData. +}; + +#endif /* NCURSES_CURSESP_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/cursesw.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/cursesw.h new file mode 100644 index 0000000..6a2ed25 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/cursesw.h @@ -0,0 +1,2005 @@ +// * This makes emacs happy -*-Mode: C++;-*- +// vile:cppmode +/**************************************************************************** + * Copyright (c) 1998-2014,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +#ifndef NCURSES_CURSESW_H_incl +#define NCURSES_CURSESW_H_incl 1 + +// $Id: cursesw.h,v 1.53 2017/11/21 00:37:23 tom Exp $ + +extern "C" { +#include +} + +#include + +/* SCO 3.2v4 curses.h includes term.h, which defines lines as a macro. + Undefine it here, because NCursesWindow uses lines as a method. */ +#undef lines + +/* "Convert" macros to inlines. We'll define it as another symbol to avoid + * conflict with library symbols. + */ +#undef UNDEF +#define UNDEF(name) CUR_##name + +#ifdef addch +inline int UNDEF(addch)(chtype ch) { + return addch(ch); +} +#undef addch +#define addch UNDEF(addch) +#endif + +#ifdef addchstr +inline int UNDEF(addchstr)(chtype* at) { + return addchstr(at); +} +#undef addchstr +#define addchstr UNDEF(addchstr) +#endif + +#ifdef addnstr +inline int UNDEF(addnstr)(const char* str, int n) { + return addnstr(str, n); +} +#undef addnstr +#define addnstr UNDEF(addnstr) +#endif + +#ifdef addstr +inline int UNDEF(addstr)(const char* str) { + return addstr(str); +} +#undef addstr +#define addstr UNDEF(addstr) +#endif + +#ifdef attroff +inline int UNDEF(attroff)(chtype at) { + return attroff(at); +} +#undef attroff +#define attroff UNDEF(attroff) +#endif + +#ifdef attron +inline int UNDEF(attron)(chtype at) { + return attron(at); +} +#undef attron +#define attron UNDEF(attron) +#endif + +#ifdef attrset +inline chtype UNDEF(attrset)(chtype at) { + return attrset(at); +} +#undef attrset +#define attrset UNDEF(attrset) +#endif + +#ifdef bkgd +inline int UNDEF(bkgd)(chtype ch) { + return bkgd(ch); +} +#undef bkgd +#define bkgd UNDEF(bkgd) +#endif + +#ifdef bkgdset +inline void UNDEF(bkgdset)(chtype ch) { + bkgdset(ch); +} +#undef bkgdset +#define bkgdset UNDEF(bkgdset) +#endif + +#ifdef border +inline int UNDEF(border)( + chtype ls, + chtype rs, + chtype ts, + chtype bs, + chtype tl, + chtype tr, + chtype bl, + chtype br) { + return border(ls, rs, ts, bs, tl, tr, bl, br); +} +#undef border +#define border UNDEF(border) +#endif + +#ifdef box +inline int UNDEF(box)(WINDOW* win, int v, int h) { + return box(win, v, h); +} +#undef box +#define box UNDEF(box) +#endif + +#ifdef chgat +inline int UNDEF( + chgat)(int n, attr_t attr, NCURSES_PAIRS_T color, const void* opts) { + return chgat(n, attr, color, opts); +} +#undef chgat +#define chgat UNDEF(chgat) +#endif + +#ifdef clear +inline int UNDEF(clear)() { + return clear(); +} +#undef clear +#define clear UNDEF(clear) +#endif + +#ifdef clearok +inline int UNDEF(clearok)(WINDOW* win, bool bf) { + return clearok(win, bf); +} +#undef clearok +#define clearok UNDEF(clearok) +#else +extern "C" NCURSES_IMPEXP int NCURSES_API clearok(WINDOW*, bool); +#endif + +#ifdef clrtobot +inline int UNDEF(clrtobot)() { + return clrtobot(); +} +#undef clrtobot +#define clrtobot UNDEF(clrtobot) +#endif + +#ifdef clrtoeol +inline int UNDEF(clrtoeol)() { + return clrtoeol(); +} +#undef clrtoeol +#define clrtoeol UNDEF(clrtoeol) +#endif + +#ifdef color_set +inline chtype UNDEF(color_set)(NCURSES_PAIRS_T p, void* opts) { + return color_set(p, opts); +} +#undef color_set +#define color_set UNDEF(color_set) +#endif + +#ifdef crmode +inline int UNDEF(crmode)(void) { + return crmode(); +} +#undef crmode +#define crmode UNDEF(crmode) +#endif + +#ifdef delch +inline int UNDEF(delch)() { + return delch(); +} +#undef delch +#define delch UNDEF(delch) +#endif + +#ifdef deleteln +inline int UNDEF(deleteln)() { + return deleteln(); +} +#undef deleteln +#define deleteln UNDEF(deleteln) +#endif + +#ifdef echochar +inline int UNDEF(echochar)(chtype ch) { + return echochar(ch); +} +#undef echochar +#define echochar UNDEF(echochar) +#endif + +#ifdef erase +inline int UNDEF(erase)() { + return erase(); +} +#undef erase +#define erase UNDEF(erase) +#endif + +#ifdef fixterm +inline int UNDEF(fixterm)(void) { + return fixterm(); +} +#undef fixterm +#define fixterm UNDEF(fixterm) +#endif + +#ifdef flushok +inline int UNDEF(flushok)(WINDOW* _win, bool _bf) { + return flushok(_win, _bf); +} +#undef flushok +#define flushok UNDEF(flushok) +#else +#define _no_flushok +#endif + +#ifdef getattrs +inline int UNDEF(getattrs)(WINDOW* win) { + return getattrs(win); +} +#undef getattrs +#define getattrs UNDEF(getattrs) +#endif + +#ifdef getbegyx +inline void UNDEF(getbegyx)(WINDOW* win, int& y, int& x) { + getbegyx(win, y, x); +} +#undef getbegyx +#define getbegyx UNDEF(getbegyx) +#endif + +#ifdef getbkgd +inline chtype UNDEF(getbkgd)(const WINDOW* win) { + return getbkgd(win); +} +#undef getbkgd +#define getbkgd UNDEF(getbkgd) +#endif + +#ifdef getch +inline int UNDEF(getch)() { + return getch(); +} +#undef getch +#define getch UNDEF(getch) +#endif + +#ifdef getmaxyx +inline void UNDEF(getmaxyx)(WINDOW* win, int& y, int& x) { + getmaxyx(win, y, x); +} +#undef getmaxyx +#define getmaxyx UNDEF(getmaxyx) +#endif + +#ifdef getnstr +inline int UNDEF(getnstr)(char* _str, int n) { + return getnstr(_str, n); +} +#undef getnstr +#define getnstr UNDEF(getnstr) +#endif + +#ifdef getparyx +inline void UNDEF(getparyx)(WINDOW* win, int& y, int& x) { + getparyx(win, y, x); +} +#undef getparyx +#define getparyx UNDEF(getparyx) +#endif + +#ifdef getstr +inline int UNDEF(getstr)(char* _str) { + return getstr(_str); +} +#undef getstr +#define getstr UNDEF(getstr) +#endif + +#ifdef getyx +inline void UNDEF(getyx)(const WINDOW* win, int& y, int& x) { + getyx(win, y, x); +} +#undef getyx +#define getyx UNDEF(getyx) +#endif + +#ifdef hline +inline int UNDEF(hline)(chtype ch, int n) { + return hline(ch, n); +} +#undef hline +#define hline UNDEF(hline) +#endif + +#ifdef inch +inline chtype UNDEF(inch)() { + return inch(); +} +#undef inch +#define inch UNDEF(inch) +#endif + +#ifdef inchstr +inline int UNDEF(inchstr)(chtype* str) { + return inchstr(str); +} +#undef inchstr +#define inchstr UNDEF(inchstr) +#endif + +#ifdef innstr +inline int UNDEF(innstr)(char* _str, int n) { + return innstr(_str, n); +} +#undef innstr +#define innstr UNDEF(innstr) +#endif + +#ifdef insch +inline int UNDEF(insch)(chtype c) { + return insch(c); +} +#undef insch +#define insch UNDEF(insch) +#endif + +#ifdef insdelln +inline int UNDEF(insdelln)(int n) { + return insdelln(n); +} +#undef insdelln +#define insdelln UNDEF(insdelln) +#endif + +#ifdef insertln +inline int UNDEF(insertln)() { + return insertln(); +} +#undef insertln +#define insertln UNDEF(insertln) +#endif + +#ifdef insnstr +inline int UNDEF(insnstr)(const char* _str, int n) { + return insnstr(_str, n); +} +#undef insnstr +#define insnstr UNDEF(insnstr) +#endif + +#ifdef insstr +inline int UNDEF(insstr)(const char* _str) { + return insstr(_str); +} +#undef insstr +#define insstr UNDEF(insstr) +#endif + +#ifdef instr +inline int UNDEF(instr)(char* _str) { + return instr(_str); +} +#undef instr +#define instr UNDEF(instr) +#endif + +#ifdef intrflush +inline void UNDEF(intrflush)(WINDOW* win, bool bf) { + intrflush(); +} +#undef intrflush +#define intrflush UNDEF(intrflush) +#endif + +#ifdef is_linetouched +inline int UNDEF(is_linetouched)(WINDOW* w, int l) { + return is_linetouched(w, l); +} +#undef is_linetouched +#define is_linetouched UNDEF(is_linetouched) +#endif + +#ifdef leaveok +inline int UNDEF(leaveok)(WINDOW* win, bool bf) { + return leaveok(win, bf); +} +#undef leaveok +#define leaveok UNDEF(leaveok) +#else +extern "C" NCURSES_IMPEXP int NCURSES_API leaveok(WINDOW* win, bool bf); +#endif + +#ifdef move +inline int UNDEF(move)(int x, int y) { + return move(x, y); +} +#undef move +#define move UNDEF(move) +#endif + +#ifdef mvaddch +inline int UNDEF(mvaddch)(int y, int x, chtype ch) { + return mvaddch(y, x, ch); +} +#undef mvaddch +#define mvaddch UNDEF(mvaddch) +#endif + +#ifdef mvaddnstr +inline int UNDEF(mvaddnstr)(int y, int x, const char* str, int n) { + return mvaddnstr(y, x, str, n); +} +#undef mvaddnstr +#define mvaddnstr UNDEF(mvaddnstr) +#endif + +#ifdef mvaddstr +inline int UNDEF(mvaddstr)(int y, int x, const char* str) { + return mvaddstr(y, x, str); +} +#undef mvaddstr +#define mvaddstr UNDEF(mvaddstr) +#endif + +#ifdef mvchgat +inline int UNDEF(mvchgat)( + int y, + int x, + int n, + attr_t attr, + NCURSES_PAIRS_T color, + const void* opts) { + return mvchgat(y, x, n, attr, color, opts); +} +#undef mvchgat +#define mvchgat UNDEF(mvchgat) +#endif + +#ifdef mvdelch +inline int UNDEF(mvdelch)(int y, int x) { + return mvdelch(y, x); +} +#undef mvdelch +#define mvdelch UNDEF(mvdelch) +#endif + +#ifdef mvgetch +inline int UNDEF(mvgetch)(int y, int x) { + return mvgetch(y, x); +} +#undef mvgetch +#define mvgetch UNDEF(mvgetch) +#endif + +#ifdef mvgetnstr +inline int UNDEF(mvgetnstr)(int y, int x, char* str, int n) { + return mvgetnstr(y, x, str, n); +} +#undef mvgetnstr +#define mvgetnstr UNDEF(mvgetnstr) +#endif + +#ifdef mvgetstr +inline int UNDEF(mvgetstr)(int y, int x, char* str) { + return mvgetstr(y, x, str); +} +#undef mvgetstr +#define mvgetstr UNDEF(mvgetstr) +#endif + +#ifdef mvinch +inline chtype UNDEF(mvinch)(int y, int x) { + return mvinch(y, x); +} +#undef mvinch +#define mvinch UNDEF(mvinch) +#endif + +#ifdef mvinnstr +inline int UNDEF(mvinnstr)(int y, int x, char* _str, int n) { + return mvinnstr(y, x, _str, n); +} +#undef mvinnstr +#define mvinnstr UNDEF(mvinnstr) +#endif + +#ifdef mvinsch +inline int UNDEF(mvinsch)(int y, int x, chtype c) { + return mvinsch(y, x, c); +} +#undef mvinsch +#define mvinsch UNDEF(mvinsch) +#endif + +#ifdef mvinsnstr +inline int UNDEF(mvinsnstr)(int y, int x, const char* _str, int n) { + return mvinsnstr(y, x, _str, n); +} +#undef mvinsnstr +#define mvinsnstr UNDEF(mvinsnstr) +#endif + +#ifdef mvinsstr +inline int UNDEF(mvinsstr)(int y, int x, const char* _str) { + return mvinsstr(y, x, _str); +} +#undef mvinsstr +#define mvinsstr UNDEF(mvinsstr) +#endif + +#ifdef mvwaddch +inline int UNDEF(mvwaddch)(WINDOW* win, int y, int x, const chtype ch) { + return mvwaddch(win, y, x, ch); +} +#undef mvwaddch +#define mvwaddch UNDEF(mvwaddch) +#endif + +#ifdef mvwaddchnstr +inline int UNDEF( + mvwaddchnstr)(WINDOW* win, int y, int x, const chtype* str, int n) { + return mvwaddchnstr(win, y, x, str, n); +} +#undef mvwaddchnstr +#define mvwaddchnstr UNDEF(mvwaddchnstr) +#endif + +#ifdef mvwaddchstr +inline int UNDEF(mvwaddchstr)(WINDOW* win, int y, int x, const chtype* str) { + return mvwaddchstr(win, y, x, str); +} +#undef mvwaddchstr +#define mvwaddchstr UNDEF(mvwaddchstr) +#endif + +#ifdef mvwaddnstr +inline int UNDEF( + mvwaddnstr)(WINDOW* win, int y, int x, const char* str, int n) { + return mvwaddnstr(win, y, x, str, n); +} +#undef mvwaddnstr +#define mvwaddnstr UNDEF(mvwaddnstr) +#endif + +#ifdef mvwaddstr +inline int UNDEF(mvwaddstr)(WINDOW* win, int y, int x, const char* str) { + return mvwaddstr(win, y, x, str); +} +#undef mvwaddstr +#define mvwaddstr UNDEF(mvwaddstr) +#endif + +#ifdef mvwchgat +inline int UNDEF(mvwchgat)( + WINDOW* win, + int y, + int x, + int n, + attr_t attr, + NCURSES_PAIRS_T color, + const void* opts) { + return mvwchgat(win, y, x, n, attr, color, opts); +} +#undef mvwchgat +#define mvwchgat UNDEF(mvwchgat) +#endif + +#ifdef mvwdelch +inline int UNDEF(mvwdelch)(WINDOW* win, int y, int x) { + return mvwdelch(win, y, x); +} +#undef mvwdelch +#define mvwdelch UNDEF(mvwdelch) +#endif + +#ifdef mvwgetch +inline int UNDEF(mvwgetch)(WINDOW* win, int y, int x) { + return mvwgetch(win, y, x); +} +#undef mvwgetch +#define mvwgetch UNDEF(mvwgetch) +#endif + +#ifdef mvwgetnstr +inline int UNDEF(mvwgetnstr)(WINDOW* win, int y, int x, char* str, int n) { + return mvwgetnstr(win, y, x, str, n); +} +#undef mvwgetnstr +#define mvwgetnstr UNDEF(mvwgetnstr) +#endif + +#ifdef mvwgetstr +inline int UNDEF(mvwgetstr)(WINDOW* win, int y, int x, char* str) { + return mvwgetstr(win, y, x, str); +} +#undef mvwgetstr +#define mvwgetstr UNDEF(mvwgetstr) +#endif + +#ifdef mvwhline +inline int UNDEF(mvwhline)(WINDOW* win, int y, int x, chtype c, int n) { + return mvwhline(win, y, x, c, n); +} +#undef mvwhline +#define mvwhline UNDEF(mvwhline) +#endif + +#ifdef mvwinch +inline chtype UNDEF(mvwinch)(WINDOW* win, int y, int x) { + return mvwinch(win, y, x); +} +#undef mvwinch +#define mvwinch UNDEF(mvwinch) +#endif + +#ifdef mvwinchnstr +inline int UNDEF(mvwinchnstr)(WINDOW* win, int y, int x, chtype* str, int n) { + return mvwinchnstr(win, y, x, str, n); +} +#undef mvwinchnstr +#define mvwinchnstr UNDEF(mvwinchnstr) +#endif + +#ifdef mvwinchstr +inline int UNDEF(mvwinchstr)(WINDOW* win, int y, int x, chtype* str) { + return mvwinchstr(win, y, x, str); +} +#undef mvwinchstr +#define mvwinchstr UNDEF(mvwinchstr) +#endif + +#ifdef mvwinnstr +inline int UNDEF(mvwinnstr)(WINDOW* win, int y, int x, char* _str, int n) { + return mvwinnstr(win, y, x, _str, n); +} +#undef mvwinnstr +#define mvwinnstr UNDEF(mvwinnstr) +#endif + +#ifdef mvwinsch +inline int UNDEF(mvwinsch)(WINDOW* win, int y, int x, chtype c) { + return mvwinsch(win, y, x, c); +} +#undef mvwinsch +#define mvwinsch UNDEF(mvwinsch) +#endif + +#ifdef mvwinsnstr +inline int UNDEF(mvwinsnstr)(WINDOW* w, int y, int x, const char* _str, int n) { + return mvwinsnstr(w, y, x, _str, n); +} +#undef mvwinsnstr +#define mvwinsnstr UNDEF(mvwinsnstr) +#endif + +#ifdef mvwinsstr +inline int UNDEF(mvwinsstr)(WINDOW* w, int y, int x, const char* _str) { + return mvwinsstr(w, y, x, _str); +} +#undef mvwinsstr +#define mvwinsstr UNDEF(mvwinsstr) +#endif + +#ifdef mvwvline +inline int UNDEF(mvwvline)(WINDOW* win, int y, int x, chtype c, int n) { + return mvwvline(win, y, x, c, n); +} +#undef mvwvline +#define mvwvline UNDEF(mvwvline) +#endif + +#ifdef napms +inline void UNDEF(napms)(unsigned long x) { + napms(x); +} +#undef napms +#define napms UNDEF(napms) +#endif + +#ifdef nocrmode +inline int UNDEF(nocrmode)(void) { + return nocrmode(); +} +#undef nocrmode +#define nocrmode UNDEF(nocrmode) +#endif + +#ifdef nodelay +inline void UNDEF(nodelay)() { + nodelay(); +} +#undef nodelay +#define nodelay UNDEF(nodelay) +#endif + +#ifdef redrawwin +inline int UNDEF(redrawwin)(WINDOW* win) { + return redrawwin(win); +} +#undef redrawwin +#define redrawwin UNDEF(redrawwin) +#endif + +#ifdef refresh +inline int UNDEF(refresh)() { + return refresh(); +} +#undef refresh +#define refresh UNDEF(refresh) +#endif + +#ifdef resetterm +inline int UNDEF(resetterm)(void) { + return resetterm(); +} +#undef resetterm +#define resetterm UNDEF(resetterm) +#endif + +#ifdef saveterm +inline int UNDEF(saveterm)(void) { + return saveterm(); +} +#undef saveterm +#define saveterm UNDEF(saveterm) +#endif + +#ifdef scrl +inline int UNDEF(scrl)(int l) { + return scrl(l); +} +#undef scrl +#define scrl UNDEF(scrl) +#endif + +#ifdef scroll +inline int UNDEF(scroll)(WINDOW* win) { + return scroll(win); +} +#undef scroll +#define scroll UNDEF(scroll) +#endif + +#ifdef scrollok +inline int UNDEF(scrollok)(WINDOW* win, bool bf) { + return scrollok(win, bf); +} +#undef scrollok +#define scrollok UNDEF(scrollok) +#else +#if defined(__NCURSES_H) +extern "C" NCURSES_IMPEXP int NCURSES_API scrollok(WINDOW*, bool); +#else +extern "C" NCURSES_IMPEXP int NCURSES_API scrollok(WINDOW*, char); +#endif +#endif + +#ifdef setscrreg +inline int UNDEF(setscrreg)(int t, int b) { + return setscrreg(t, b); +} +#undef setscrreg +#define setscrreg UNDEF(setscrreg) +#endif + +#ifdef standend +inline int UNDEF(standend)() { + return standend(); +} +#undef standend +#define standend UNDEF(standend) +#endif + +#ifdef standout +inline int UNDEF(standout)() { + return standout(); +} +#undef standout +#define standout UNDEF(standout) +#endif + +#ifdef subpad +inline WINDOW* UNDEF(subpad)(WINDOW* p, int l, int c, int y, int x) { + return derwin(p, l, c, y, x); +} +#undef subpad +#define subpad UNDEF(subpad) +#endif + +#ifdef timeout +inline void UNDEF(timeout)(int delay) { + timeout(delay); +} +#undef timeout +#define timeout UNDEF(timeout) +#endif + +#ifdef touchline +inline int UNDEF(touchline)(WINDOW* win, int s, int c) { + return touchline(win, s, c); +} +#undef touchline +#define touchline UNDEF(touchline) +#endif + +#ifdef touchwin +inline int UNDEF(touchwin)(WINDOW* win) { + return touchwin(win); +} +#undef touchwin +#define touchwin UNDEF(touchwin) +#endif + +#ifdef untouchwin +inline int UNDEF(untouchwin)(WINDOW* win) { + return untouchwin(win); +} +#undef untouchwin +#define untouchwin UNDEF(untouchwin) +#endif + +#ifdef vline +inline int UNDEF(vline)(chtype ch, int n) { + return vline(ch, n); +} +#undef vline +#define vline UNDEF(vline) +#endif + +#ifdef waddchstr +inline int UNDEF(waddchstr)(WINDOW* win, chtype* at) { + return waddchstr(win, at); +} +#undef waddchstr +#define waddchstr UNDEF(waddchstr) +#endif + +#ifdef waddstr +inline int UNDEF(waddstr)(WINDOW* win, char* str) { + return waddstr(win, str); +} +#undef waddstr +#define waddstr UNDEF(waddstr) +#endif + +#ifdef wattroff +inline int UNDEF(wattroff)(WINDOW* win, int att) { + return wattroff(win, att); +} +#undef wattroff +#define wattroff UNDEF(wattroff) +#endif + +#ifdef wattrset +inline int UNDEF(wattrset)(WINDOW* win, int att) { + return wattrset(win, att); +} +#undef wattrset +#define wattrset UNDEF(wattrset) +#endif + +#ifdef winch +inline chtype UNDEF(winch)(const WINDOW* win) { + return winch(win); +} +#undef winch +#define winch UNDEF(winch) +#endif + +#ifdef winchnstr +inline int UNDEF(winchnstr)(WINDOW* win, chtype* str, int n) { + return winchnstr(win, str, n); +} +#undef winchnstr +#define winchnstr UNDEF(winchnstr) +#endif + +#ifdef winchstr +inline int UNDEF(winchstr)(WINDOW* win, chtype* str) { + return winchstr(win, str); +} +#undef winchstr +#define winchstr UNDEF(winchstr) +#endif + +#ifdef winsstr +inline int UNDEF(winsstr)(WINDOW* w, const char* _str) { + return winsstr(w, _str); +} +#undef winsstr +#define winsstr UNDEF(winsstr) +#endif + +#ifdef wstandend +inline int UNDEF(wstandend)(WINDOW* win) { + return wstandend(win); +} +#undef wstandend +#define wstandend UNDEF(wstandend) +#endif + +#ifdef wstandout +inline int UNDEF(wstandout)(WINDOW* win) { + return wstandout(win); +} +#undef wstandout +#define wstandout UNDEF(wstandout) +#endif + +/* + * + * C++ class for windows. + * + */ + +extern "C" int _nc_ripoffline(int, int (*init)(WINDOW*, int)); +extern "C" int _nc_xx_ripoff_init(WINDOW*, int); +extern "C" int _nc_has_mouse(void); + +class NCURSES_IMPEXP NCursesWindow { + friend class NCursesMenu; + friend class NCursesForm; + + private: + static bool b_initialized; + static void initialize(); + void constructing(); + friend int _nc_xx_ripoff_init(WINDOW*, int); + + void set_keyboard(); + + NCURSES_COLOR_T getcolor(int getback) const; + NCURSES_PAIRS_T getPair() const; + + static int + setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back, NCURSES_PAIRS_T pair); + static int colorInitialized; + + // This private constructor is only used during the initialization + // of windows generated by ripoffline() calls. + NCursesWindow(WINDOW* win, int ncols); + + protected: + virtual void err_handler(const char*) const THROWS(NCursesException); + // Signal an error with the given message text. + + static long count; // count of all active windows: + // We rely on the c++ promise that + // all otherwise uninitialized + // static class vars are set to 0 + + WINDOW* w; // the curses WINDOW + + bool alloced; // TRUE if we own the WINDOW + + NCursesWindow* par; // parent, if subwindow + NCursesWindow* subwins; // head of subwindows list + NCursesWindow* sib; // next subwindow of parent + + void kill_subwindows(); // disable all subwindows + // Destroy all subwindows. + + /* Only for use by derived classes. They are then in charge to + fill the member variables correctly. */ + NCursesWindow(); + + public: + NCursesWindow(WINDOW* window); // useful only for stdscr + + NCursesWindow( + int nlines, // number of lines + int ncols, // number of columns + int begin_y, // line origin + int begin_x); // col origin + + NCursesWindow( + NCursesWindow& par, // parent window + int nlines, // number of lines + int ncols, // number of columns + int begin_y, // absolute or relative + int begin_x, // origins: + char absrel = 'a'); // if `a', begin_y & begin_x are + // absolute screen pos, else if `r', they are relative to par origin + + NCursesWindow( + NCursesWindow& par, // parent window + bool do_box = TRUE); + // this is the very common case that we want to create the subwindow that + // is two lines and two columns smaller and begins at (1,1). + // We may automatically request the box around it. + + NCursesWindow& operator=(const NCursesWindow& rhs) { + if (this != &rhs) + *this = rhs; + return *this; + } + + NCursesWindow(const NCursesWindow& rhs) + : w(rhs.w), + alloced(rhs.alloced), + par(rhs.par), + subwins(rhs.subwins), + sib(rhs.sib) {} + + virtual ~NCursesWindow(); + + NCursesWindow Clone(); + // Make an exact copy of the window. + + // Initialization. + static void useColors(void); + // Call this routine very early if you want to have colors. + + static int ripoffline(int ripoff_lines, int (*init)(NCursesWindow& win)); + // This function is used to generate a window of ripped-of lines. + // If the argument is positive, lines are removed from the top, if it + // is negative lines are removed from the bottom. This enhances the + // lowlevel ripoffline() function because it uses the internal + // implementation that allows to remove more than just a single line. + // This function must be called before any other ncurses function. The + // creation of the window is deferred until ncurses gets initialized. + // The initialization function is then called. + + // ------------------------------------------------------------------------- + // terminal status + // ------------------------------------------------------------------------- + int lines() const { + initialize(); + return LINES; + } + // Number of lines on terminal, *not* window + + int cols() const { + initialize(); + return COLS; + } + // Number of cols on terminal, *not* window + + int tabsize() const { + initialize(); + return TABSIZE; + } + // Size of a tab on terminal, *not* window + + static int NumberOfColors(); + // Number of available colors + + int colors() const { + return NumberOfColors(); + } + // Number of available colors + + // ------------------------------------------------------------------------- + // window status + // ------------------------------------------------------------------------- + int height() const { + return maxy() + 1; + } + // Number of lines in this window + + int width() const { + return maxx() + 1; + } + // Number of columns in this window + + int begx() const { + return getbegx(w); + } + // Column of top left corner relative to stdscr + + int begy() const { + return getbegy(w); + } + // Line of top left corner relative to stdscr + + int curx() const { + return getcurx(w); + } + // Column of top left corner relative to stdscr + + int cury() const { + return getcury(w); + } + // Line of top left corner relative to stdscr + + int maxx() const { + return getmaxx(w) == ERR ? ERR : getmaxx(w) - 1; + } + // Largest x coord in window + + int maxy() const { + return getmaxy(w) == ERR ? ERR : getmaxy(w) - 1; + } + // Largest y coord in window + + NCURSES_PAIRS_T getcolor() const; + // Actual color pair + + NCURSES_COLOR_T foreground() const { + return getcolor(0); + } + // Actual foreground color + + NCURSES_COLOR_T background() const { + return getcolor(1); + } + // Actual background color + + int setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back); + // Set color palette entry + + int setcolor(NCURSES_PAIRS_T pair); + // Set actually used palette entry + + // ------------------------------------------------------------------------- + // window positioning + // ------------------------------------------------------------------------- + virtual int mvwin(int begin_y, int begin_x) { + return ::mvwin(w, begin_y, begin_x); + } + // Move window to new position with the new position as top left corner. + // This is virtual because it is redefined in NCursesPanel. + + // ------------------------------------------------------------------------- + // coordinate positioning + // ------------------------------------------------------------------------- + int move(int y, int x) { + return ::wmove(w, y, x); + } + // Move cursor the this position + + void getyx(int& y, int& x) const { + ::getyx(w, y, x); + } + // Get current position of the cursor + + void getbegyx(int& y, int& x) const { + ::getbegyx(w, y, x); + } + // Get beginning of the window + + void getmaxyx(int& y, int& x) const { + ::getmaxyx(w, y, x); + } + // Get size of the window + + void getparyx(int& y, int& x) const { + ::getparyx(w, y, x); + } + // Get parent's beginning of the window + + int mvcur(int oldrow, int oldcol, int newrow, int newcol) const { + return ::mvcur(oldrow, oldcol, newrow, newcol); + } + // Perform lowlevel cursor motion that takes effect immediately. + + // ------------------------------------------------------------------------- + // input + // ------------------------------------------------------------------------- + int getch() { + return ::wgetch(w); + } + // Get a keystroke from the window. + + int getch(int y, int x) { + return ::mvwgetch(w, y, x); + } + // Move cursor to position and get a keystroke from the window + + int getstr(char* str, int n = -1) { + return ::wgetnstr(w, str, n); + } + // Read a series of characters into str until a newline or carriage return + // is received. Read at most n characters. If n is negative, the limit is + // ignored. + + int getstr(int y, int x, char* str, int n = -1) { + return ::mvwgetnstr(w, y, x, str, n); + } + // Move the cursor to the requested position and then perform the getstr() + // as described above. + + int instr(char* s, int n = -1) { + return ::winnstr(w, s, n); + } + // Get a string of characters from the window into the buffer s. Retrieve + // at most n characters, if n is negative retrieve all characters up to the + // end of the current line. Attributes are stripped from the characters. + + int instr(int y, int x, char* s, int n = -1) { + return ::mvwinnstr(w, y, x, s, n); + } + // Move the cursor to the requested position and then perform the instr() + // as described above. + + int scanw(const char* fmt, ...) +// Perform a scanw function from the window. +#if __GNUG__ >= 2 + __attribute__((format(scanf, 2, 3))); +#else + ; +#endif + + int scanw(const char*, va_list); + // Perform a scanw function from the window. + + int scanw(int y, int x, const char* fmt, ...) +// Move the cursor to the requested position and then perform a scanw +// from the window. +#if __GNUG__ >= 2 + __attribute__((format(scanf, 4, 5))); +#else + ; +#endif + + int scanw(int y, int x, const char* fmt, va_list); + // Move the cursor to the requested position and then perform a scanw + // from the window. + + // ------------------------------------------------------------------------- + // output + // ------------------------------------------------------------------------- + int addch(const chtype ch) { + return ::waddch(w, ch); + } + // Put attributed character to the window. + + int addch(int y, int x, const chtype ch) { + return ::mvwaddch(w, y, x, ch); + } + // Move cursor to the requested position and then put attributed character + // to the window. + + int echochar(const chtype ch) { + return ::wechochar(w, ch); + } + // Put attributed character to the window and refresh it immediately. + + int addstr(const char* str, int n = -1) { + return ::waddnstr(w, str, n); + } + // Write the string str to the window, stop writing if the terminating + // NUL or the limit n is reached. If n is negative, it is ignored. + + int addstr(int y, int x, const char* str, int n = -1) { + return ::mvwaddnstr(w, y, x, str, n); + } + // Move the cursor to the requested position and then perform the addchstr + // as described above. + + int addchstr(const chtype* str, int n = -1) { + return ::waddchnstr(w, str, n); + } + // Write the string str to the window, stop writing if the terminating + // NUL or the limit n is reached. If n is negative, it is ignored. + + int addchstr(int y, int x, const chtype* str, int n = -1) { + return ::mvwaddchnstr(w, y, x, str, n); + } + // Move the cursor to the requested position and then perform the addchstr + // as described above. + + int printw(const char* fmt, ...) +// Do a formatted print to the window. +#if (__GNUG__ >= 2) && !defined(printf) + __attribute__((format(printf, 2, 3))); +#else + ; +#endif + + int printw(int y, int x, const char* fmt, ...) +// Move the cursor and then do a formatted print to the window. +#if (__GNUG__ >= 2) && !defined(printf) + __attribute__((format(printf, 4, 5))); +#else + ; +#endif + + int printw(const char* fmt, va_list args); + // Do a formatted print to the window. + + int printw(int y, int x, const char* fmt, va_list args); + // Move the cursor and then do a formatted print to the window. + + chtype inch() const { + return ::winch(w); + } + // Retrieve attributed character under the current cursor position. + + chtype inch(int y, int x) { + return ::mvwinch(w, y, x); + } + // Move cursor to requested position and then retrieve attributed character + // at this position. + + int inchstr(chtype* str, int n = -1) { + return ::winchnstr(w, str, n); + } + // Read the string str from the window, stop reading if the terminating + // NUL or the limit n is reached. If n is negative, it is ignored. + + int inchstr(int y, int x, chtype* str, int n = -1) { + return ::mvwinchnstr(w, y, x, str, n); + } + // Move the cursor to the requested position and then perform the inchstr + // as described above. + + int insch(chtype ch) { + return ::winsch(w, ch); + } + // Insert attributed character into the window before current cursor + // position. + + int insch(int y, int x, chtype ch) { + return ::mvwinsch(w, y, x, ch); + } + // Move cursor to requested position and then insert the attributed + // character before that position. + + int insertln() { + return ::winsdelln(w, 1); + } + // Insert an empty line above the current line. + + int insdelln(int n = 1) { + return ::winsdelln(w, n); + } + // If n>0 insert that many lines above the current line. If n<0 delete + // that many lines beginning with the current line. + + int insstr(const char* s, int n = -1) { + return ::winsnstr(w, s, n); + } + // Insert the string into the window before the current cursor position. + // Insert stops at end of string or when the limit n is reached. If n is + // negative, it is ignored. + + int insstr(int y, int x, const char* s, int n = -1) { + return ::mvwinsnstr(w, y, x, s, n); + } + // Move the cursor to the requested position and then perform the insstr() + // as described above. + + int attron(chtype at) { + return ::wattron(w, at); + } + // Switch on the window attributes; + + int attroff(chtype at) { + return ::wattroff(w, static_cast(at)); + } + // Switch off the window attributes; + + int attrset(chtype at) { + return ::wattrset(w, static_cast(at)); + } + // Set the window attributes; + + chtype attrget() { + return ::getattrs(w); + } + // Get the window attributes; + + int color_set(NCURSES_PAIRS_T color_pair_number, void* opts = NULL) { + return ::wcolor_set(w, color_pair_number, opts); + } + // Set the window color attribute; + + int chgat( + int n, + attr_t attr, + NCURSES_PAIRS_T color, + const void* opts = NULL) { + return ::wchgat(w, n, attr, color, opts); + } + // Change the attributes of the next n characters in the current line. If + // n is negative or greater than the number of remaining characters in the + // line, the attributes will be changed up to the end of the line. + + int chgat( + int y, + int x, + int n, + attr_t attr, + NCURSES_PAIRS_T color, + const void* opts = NULL) { + return ::mvwchgat(w, y, x, n, attr, color, opts); + } + // Move the cursor to the requested position and then perform chgat() as + // described above. + + // ------------------------------------------------------------------------- + // background + // ------------------------------------------------------------------------- + chtype getbkgd() const { + return ::getbkgd(w); + } + // Get current background setting. + + int bkgd(const chtype ch) { + return ::wbkgd(w, ch); + } + // Set the background property and apply it to the window. + + void bkgdset(chtype ch) { + ::wbkgdset(w, ch); + } + // Set the background property. + + // ------------------------------------------------------------------------- + // borders + // ------------------------------------------------------------------------- + int box(chtype vert = 0, chtype hor = 0) { + return ::wborder(w, vert, vert, hor, hor, 0, 0, 0, 0); + } + // Draw a box around the window with the given vertical and horizontal + // drawing characters. If you specify a zero as character, curses will try + // to find a "nice" character. + + int border( + chtype left = 0, + chtype right = 0, + chtype top = 0, + chtype bottom = 0, + chtype top_left = 0, + chtype top_right = 0, + chtype bottom_left = 0, + chtype bottom_right = 0) { + return ::wborder( + w, + left, + right, + top, + bottom, + top_left, + top_right, + bottom_left, + bottom_right); + } + // Draw a border around the window with the given characters for the + // various parts of the border. If you pass zero for a character, curses + // will try to find "nice" characters. + + // ------------------------------------------------------------------------- + // lines and boxes + // ------------------------------------------------------------------------- + int hline(int len, chtype ch = 0) { + return ::whline(w, ch, len); + } + // Draw a horizontal line of len characters with the given character. If + // you pass zero for the character, curses will try to find a "nice" one. + + int hline(int y, int x, int len, chtype ch = 0) { + return ::mvwhline(w, y, x, ch, len); + } + // Move the cursor to the requested position and then draw a horizontal line. + + int vline(int len, chtype ch = 0) { + return ::wvline(w, ch, len); + } + // Draw a vertical line of len characters with the given character. If + // you pass zero for the character, curses will try to find a "nice" one. + + int vline(int y, int x, int len, chtype ch = 0) { + return ::mvwvline(w, y, x, ch, len); + } + // Move the cursor to the requested position and then draw a vertical line. + + // ------------------------------------------------------------------------- + // erasure + // ------------------------------------------------------------------------- + int erase() { + return ::werase(w); + } + // Erase the window. + + int clear() { + return ::wclear(w); + } + // Clear the window. + + int clearok(bool bf) { + return ::clearok(w, bf); + } + // Set/Reset the clear flag. If set, the next refresh() will clear the + // screen. + + int clrtobot() { + return ::wclrtobot(w); + } + // Clear to the end of the window. + + int clrtoeol() { + return ::wclrtoeol(w); + } + // Clear to the end of the line. + + int delch() { + return ::wdelch(w); + } + // Delete character under the cursor. + + int delch(int y, int x) { + return ::mvwdelch(w, y, x); + } + // Move cursor to requested position and delete the character under the + // cursor. + + int deleteln() { + return ::winsdelln(w, -1); + } + // Delete the current line. + + // ------------------------------------------------------------------------- + // screen control + // ------------------------------------------------------------------------- + int scroll(int amount = 1) { + return ::wscrl(w, amount); + } + // Scroll amount lines. If amount is positive, scroll up, otherwise + // scroll down. + + int scrollok(bool bf) { + return ::scrollok(w, bf); + } + // If bf is TRUE, window scrolls if cursor is moved off the bottom + // edge of the window or a scrolling region, otherwise the cursor is left + // at the bottom line. + + int setscrreg(int from, int to) { + return ::wsetscrreg(w, from, to); + } + // Define a soft scrolling region. + + int idlok(bool bf) { + return ::idlok(w, bf); + } + // If bf is TRUE, use insert/delete line hardware support if possible. + // Otherwise do it in software. + + void idcok(bool bf) { + ::idcok(w, bf); + } + // If bf is TRUE, use insert/delete character hardware support if possible. + // Otherwise do it in software. + + int touchline(int s, int c) { + return ::touchline(w, s, c); + } + // Mark the given lines as modified. + + int touchwin() { + return ::wtouchln(w, 0, height(), 1); + } + // Mark the whole window as modified. + + int untouchwin() { + return ::wtouchln(w, 0, height(), 0); + } + // Mark the whole window as unmodified. + + int touchln(int s, int cnt, bool changed = TRUE) { + return ::wtouchln(w, s, cnt, static_cast(changed ? 1 : 0)); + } + // Mark cnt lines beginning from line s as changed or unchanged, depending + // on the value of the changed flag. + + bool is_linetouched(int line) const { + return (::is_linetouched(w, line) == TRUE ? TRUE : FALSE); + } + // Return TRUE if line is marked as changed, FALSE otherwise + + bool is_wintouched() const { + return (::is_wintouched(w) ? TRUE : FALSE); + } + // Return TRUE if window is marked as changed, FALSE otherwise + + int leaveok(bool bf) { + return ::leaveok(w, bf); + } + // If bf is TRUE, curses will leave the cursor after an update whereever + // it is after the update. + + int redrawln(int from, int n) { + return ::wredrawln(w, from, n); + } + // Redraw n lines starting from the requested line + + int redrawwin() { + return ::wredrawln(w, 0, height()); + } + // Redraw the whole window + + int doupdate() { + return ::doupdate(); + } + // Do all outputs to make the physical screen looking like the virtual one + + void syncdown() { + ::wsyncdown(w); + } + // Propagate the changes down to all descendant windows + + void syncup() { + ::wsyncup(w); + } + // Propagate the changes up in the hierarchy + + void cursyncup() { + ::wcursyncup(w); + } + // Position the cursor in all ancestor windows corresponding to our setting + + int syncok(bool bf) { + return ::syncok(w, bf); + } +// If called with bf=TRUE, syncup() is called whenever the window is changed + +#ifndef _no_flushok + int flushok(bool bf) { + return ::flushok(w, bf); + } +#endif + + void immedok(bool bf) { + ::immedok(w, bf); + } + // If called with bf=TRUE, any change in the window will cause an + // automatic immediate refresh() + + int intrflush(bool bf) { + return ::intrflush(w, bf); + } + + int keypad(bool bf) { + return ::keypad(w, bf); + } + // If called with bf=TRUE, the application will interpret function keys. + + int nodelay(bool bf) { + return ::nodelay(w, bf); + } + + int meta(bool bf) { + return ::meta(w, bf); + } + // If called with bf=TRUE, keys may generate 8-Bit characters. Otherwise + // 7-Bit characters are generated. + + int standout() { + return ::wstandout(w); + } + // Enable "standout" attributes + + int standend() { + return ::wstandend(w); + } + // Disable "standout" attributes + + // ------------------------------------------------------------------------- + // The next two are virtual, because we redefine them in the + // NCursesPanel class. + // ------------------------------------------------------------------------- + virtual int refresh() { + return ::wrefresh(w); + } + // Propagate the changes in this window to the virtual screen and call + // doupdate(). This is redefined in NCursesPanel. + + virtual int noutrefresh() { + return ::wnoutrefresh(w); + } + // Propagate the changes in this window to the virtual screen. This is + // redefined in NCursesPanel. + + // ------------------------------------------------------------------------- + // multiple window control + // ------------------------------------------------------------------------- + int overlay(NCursesWindow& win) { + return ::overlay(w, win.w); + } + // Overlay this window over win. + + int overwrite(NCursesWindow& win) { + return ::overwrite(w, win.w); + } + // Overwrite win with this window. + + int copywin( + NCursesWindow& win, + int sminrow, + int smincol, + int dminrow, + int dmincol, + int dmaxrow, + int dmaxcol, + bool overlaywin = TRUE) { + return ::copywin( + w, + win.w, + sminrow, + smincol, + dminrow, + dmincol, + dmaxrow, + dmaxcol, + static_cast(overlaywin ? 1 : 0)); + } +// Overlay or overwrite the rectangle in win given by dminrow,dmincol, +// dmaxrow,dmaxcol with the rectangle in this window beginning at +// sminrow,smincol. + +// ------------------------------------------------------------------------- +// Extended functions +// ------------------------------------------------------------------------- +#if defined(NCURSES_EXT_FUNCS) && (NCURSES_EXT_FUNCS != 0) + int wresize(int newLines, int newColumns) { + return ::wresize(w, newLines, newColumns); + } +#endif + + // ------------------------------------------------------------------------- + // Mouse related + // ------------------------------------------------------------------------- + bool has_mouse() const; + // Return TRUE if terminal supports a mouse, FALSE otherwise + + // ------------------------------------------------------------------------- + // traversal support + // ------------------------------------------------------------------------- + NCursesWindow* child() { + return subwins; + } + // Get the first child window. + + NCursesWindow* sibling() { + return sib; + } + // Get the next child of my parent. + + NCursesWindow* parent() { + return par; + } + // Get my parent. + + bool isDescendant(NCursesWindow& win); + // Return TRUE if win is a descendant of this. +}; + +// ------------------------------------------------------------------------- +// We leave this here for compatibility reasons. +// ------------------------------------------------------------------------- +class NCURSES_IMPEXP NCursesColorWindow : public NCursesWindow { + public: + NCursesColorWindow(WINDOW*& window) // useful only for stdscr + : NCursesWindow(window) { + useColors(); + } + + NCursesColorWindow( + int nlines, // number of lines + int ncols, // number of columns + int begin_y, // line origin + int begin_x) // col origin + : NCursesWindow(nlines, ncols, begin_y, begin_x) { + useColors(); + } + + NCursesColorWindow( + NCursesWindow& parentWin, // parent window + int nlines, // number of lines + int ncols, // number of columns + int begin_y, // absolute or relative + int begin_x, // origins: + char absrel = 'a') // if `a', by & bx are + : NCursesWindow( + parentWin, + nlines, + ncols, // absolute screen pos, + begin_y, + begin_x, // else if `r', they are + absrel) { // relative to par origin + useColors(); + } +}; + +// These enum definitions really belong inside the NCursesPad class, but only +// recent compilers support that feature. + +typedef enum { + REQ_PAD_REFRESH = KEY_MAX + 1, + REQ_PAD_UP, + REQ_PAD_DOWN, + REQ_PAD_LEFT, + REQ_PAD_RIGHT, + REQ_PAD_EXIT +} Pad_Request; + +const Pad_Request PAD_LOW = REQ_PAD_REFRESH; // lowest op-code +const Pad_Request PAD_HIGH = REQ_PAD_EXIT; // highest op-code + +// ------------------------------------------------------------------------- +// Pad Support. We allow an association of a pad with a "real" window +// through which the pad may be viewed. +// ------------------------------------------------------------------------- +class NCURSES_IMPEXP NCursesPad : public NCursesWindow { + private: + NCursesWindow* viewWin; // the "viewport" window + NCursesWindow* viewSub; // the "viewport" subwindow + + int h_gridsize, v_gridsize; + + protected: + int min_row, min_col; // top left row/col of the pads display area + + NCursesWindow* Win(void) const { + // Get the window into which the pad should be copied (if any) + return (viewSub ? viewSub : (viewWin ? viewWin : 0)); + } + + NCursesWindow* getWindow(void) const { + return viewWin; + } + + NCursesWindow* getSubWindow(void) const { + return viewSub; + } + + virtual int driver(int key); // Virtualize keystroke key + // The driver translates the keystroke c into an Pad_Request + + virtual void OnUnknownOperation(int pad_req) { + (void)pad_req; + ::beep(); + } + // This is called if the driver returns an unknown op-code + + virtual void OnNavigationError(int pad_req) { + (void)pad_req; + ::beep(); + } + // This is called if a navigation request couldn't be satisfied + + virtual void OnOperation(int pad_req) { + (void)pad_req; + }; + // OnOperation is called if a Pad_Operation was executed and just before + // the refresh() operation is done. + + public: + NCursesPad(int nlines, int ncols); + // create a pad with the given size + + NCursesPad& operator=(const NCursesPad& rhs) { + if (this != &rhs) { + *this = rhs; + NCursesWindow::operator=(rhs); + } + return *this; + } + + NCursesPad(const NCursesPad& rhs) + : NCursesWindow(rhs), + viewWin(rhs.viewWin), + viewSub(rhs.viewSub), + h_gridsize(rhs.h_gridsize), + v_gridsize(rhs.v_gridsize), + min_row(rhs.min_row), + min_col(rhs.min_col) {} + + virtual ~NCursesPad() {} + + int echochar(const chtype ch) { + return ::pechochar(w, ch); + } + // Put the attributed character onto the pad and immediately do a + // prefresh(). + + int refresh(); + // If a viewport is defined the pad is displayed in this window, otherwise + // this is a noop. + + int refresh( + int pminrow, + int pmincol, + int sminrow, + int smincol, + int smaxrow, + int smaxcol) { + return ::prefresh(w, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol); + } + // The coordinates sminrow,smincol,smaxrow,smaxcol describe a rectangle + // on the screen. refresh copies a rectangle of this size beginning + // with top left corner pminrow,pmincol onto the screen and calls doupdate(). + + int noutrefresh(); + // If a viewport is defined the pad is displayed in this window, otherwise + // this is a noop. + + int noutrefresh( + int pminrow, + int pmincol, + int sminrow, + int smincol, + int smaxrow, + int smaxcol) { + return ::pnoutrefresh( + w, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol); + } + // Does the same as refresh() but without calling doupdate(). + + virtual void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1); + // Add the window "view" as viewing window to the pad. + + virtual void setSubWindow(NCursesWindow& sub); + // Use the subwindow "sub" of the viewport window for the actual viewing. + // The full viewport window is usually used to provide some decorations + // like frames, titles etc. + + virtual void operator()(void); + // Perform Pad's operation +}; + +// A FramedPad is constructed always with a viewport window. This viewport +// will be framed (by a box() command) and the interior of the box is the +// viewport subwindow. On the frame we display scrollbar sliders. +class NCURSES_IMPEXP NCursesFramedPad : public NCursesPad { + protected: + virtual void OnOperation(int pad_req); + + public: + NCursesFramedPad( + NCursesWindow& win, + int nlines, + int ncols, + int v_grid = 1, + int h_grid = 1) + : NCursesPad(nlines, ncols) { + NCursesPad::setWindow(win, v_grid, h_grid); + NCursesPad::setSubWindow(*(new NCursesWindow(win))); + } + // Construct the FramedPad with the given Window win as viewport. + + virtual ~NCursesFramedPad() { + delete getSubWindow(); + } + + void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1) { + (void)view; + (void)v_grid; + (void)h_grid; + err_handler("Operation not allowed"); + } + // Disable this call; the viewport is already defined + + void setSubWindow(NCursesWindow& sub) { + (void)sub; + err_handler("Operation not allowed"); + } + // Disable this call; the viewport subwindow is already defined +}; + +#endif /* NCURSES_CURSESW_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/cursslk.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/cursslk.h new file mode 100644 index 0000000..204c7c6 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/cursslk.h @@ -0,0 +1,232 @@ +// * this is for making emacs happy: -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1997 * + ****************************************************************************/ + +// $Id: cursslk.h,v 1.13 2005/05/28 21:58:18 tom Exp $ + +#ifndef NCURSES_CURSSLK_H_incl +#define NCURSES_CURSSLK_H_incl + +#include + +class NCURSES_IMPEXP Soft_Label_Key_Set { + public: + // This inner class represents the attributes of a Soft Label Key (SLK) + class NCURSES_IMPEXP Soft_Label_Key { + friend class Soft_Label_Key_Set; + + public: + typedef enum { Left = 0, Center = 1, Right = 2 } Justification; + + private: + char* label; // The Text of the Label + Justification format; // The Justification + int num; // The number of the Label + + Soft_Label_Key() : label(NULL), format(Left), num(-1) {} + + virtual ~Soft_Label_Key() { + delete[] label; + }; + + public: + // Set the text of the Label + Soft_Label_Key& operator=(char* text); + + // Set the Justification of the Label + Soft_Label_Key& operator=(Justification just) { + format = just; + return *this; + } + + // Retrieve the text of the label + inline char* operator()(void) const { + return label; + } + + Soft_Label_Key& operator=(const Soft_Label_Key& rhs) { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + Soft_Label_Key(const Soft_Label_Key& rhs) + : label(NULL), format(rhs.format), num(rhs.num) { + *this = rhs.label; + } + }; + + public: + typedef enum { + None = -1, + Three_Two_Three = 0, + Four_Four = 1, + PC_Style = 2, + PC_Style_With_Index = 3 + } Label_Layout; + + private: + static long NCURSES_IMPEXP count; // Number of Key Sets + static Label_Layout NCURSES_IMPEXP format; // Layout of the Key Sets + static int NCURSES_IMPEXP num_labels; // Number Of Labels in Key Sets + bool NCURSES_IMPEXP b_attrInit; // Are attributes initialized + + Soft_Label_Key* slk_array; // The array of SLK's + + // Init the Key Set + void init(); + + // Activate or Deactivate Label# i, Label counting starts with 1! + void activate_label(int i, bool bf = TRUE); + + // Activate of Deactivate all Labels + void activate_labels(bool bf); + + protected: + inline void Error(const char* msg) const THROWS(NCursesException) { + THROW(new NCursesException(msg)); + } + + // Remove SLK's from screen + void clear() { + if (ERR == ::slk_clear()) + Error("slk_clear"); + } + + // Restore them + void restore() { + if (ERR == ::slk_restore()) + Error("slk_restore"); + } + + public: + // Construct a Key Set, use the most comfortable layout as default. + // You must create a Soft_Label_Key_Set before you create any object of + // the NCursesWindow, NCursesPanel or derived classes. (Actually before + // ::initscr() is called). + Soft_Label_Key_Set(Label_Layout fmt); + + // This constructor assumes, that you already constructed a Key Set + // with a layout by the constructor above. This layout will be reused. + NCURSES_IMPEXP Soft_Label_Key_Set(); + + Soft_Label_Key_Set& operator=(const Soft_Label_Key_Set& rhs) { + if (this != &rhs) { + *this = rhs; + init(); // allocate a new slk_array[] + } + return *this; + } + + Soft_Label_Key_Set(const Soft_Label_Key_Set& rhs) + : b_attrInit(rhs.b_attrInit), slk_array(NULL) { + init(); // allocate a new slk_array[] + } + + virtual ~Soft_Label_Key_Set(); + + // Get Label# i. Label counting starts with 1! + NCURSES_IMPEXP Soft_Label_Key& operator[](int i); + + // Retrieve number of Labels + inline int labels() const { + return num_labels; + } + + // Refresh the SLK portion of the screen + inline void refresh() { + if (ERR == ::slk_refresh()) + Error("slk_refresh"); + } + + // Mark the SLK portion of the screen for refresh, defer actual refresh + // until next update call. + inline void noutrefresh() { + if (ERR == ::slk_noutrefresh()) + Error("slk_noutrefresh"); + } + + // Mark the whole SLK portion of the screen as modified + inline void touch() { + if (ERR == ::slk_touch()) + Error("slk_touch"); + } + + // Activate Label# i + inline void show(int i) { + activate_label(i, FALSE); + activate_label(i, TRUE); + } + + // Hide Label# i + inline void hide(int i) { + activate_label(i, FALSE); + } + + // Show all Labels + inline void show() { + activate_labels(FALSE); + activate_labels(TRUE); + } + + // Hide all Labels + inline void hide() { + activate_labels(FALSE); + } + + inline void attron(attr_t attrs) { + if (ERR == ::slk_attron(attrs)) + Error("slk_attron"); + } + + inline void attroff(attr_t attrs) { + if (ERR == ::slk_attroff(attrs)) + Error("slk_attroff"); + } + + inline void attrset(attr_t attrs) { + if (ERR == ::slk_attrset(attrs)) + Error("slk_attrset"); + } + + inline void color(short color_pair_number) { + if (ERR == ::slk_color(color_pair_number)) + Error("slk_color"); + } + + inline attr_t attr() const { + return ::slk_attr(); + } +}; + +#endif /* NCURSES_CURSSLK_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/eti.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/eti.h new file mode 100644 index 0000000..3e44a9f --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/eti.h @@ -0,0 +1,54 @@ +/**************************************************************************** + * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1995,1997 * + ****************************************************************************/ + +/* $Id: eti.h,v 1.8 2003/10/25 15:24:29 tom Exp $ */ + +#ifndef NCURSES_ETI_H_incl +#define NCURSES_ETI_H_incl 1 + +#define E_OK (0) +#define E_SYSTEM_ERROR (-1) +#define E_BAD_ARGUMENT (-2) +#define E_POSTED (-3) +#define E_CONNECTED (-4) +#define E_BAD_STATE (-5) +#define E_NO_ROOM (-6) +#define E_NOT_POSTED (-7) +#define E_UNKNOWN_COMMAND (-8) +#define E_NO_MATCH (-9) +#define E_NOT_SELECTABLE (-10) +#define E_NOT_CONNECTED (-11) +#define E_REQUEST_DENIED (-12) +#define E_INVALID_FIELD (-13) +#define E_CURRENT (-14) + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/etip.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/etip.h new file mode 100644 index 0000000..fdb98a0 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/etip.h @@ -0,0 +1,333 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998-2012,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1997 * + ****************************************************************************/ + +// $Id: etip.h.in,v 1.41 2017/06/24 21:57:16 tom Exp $ + +#ifndef NCURSES_ETIP_H_incl +#define NCURSES_ETIP_H_incl 1 + +// These are substituted at configure/build time +#ifndef HAVE_BUILTIN_H +#define HAVE_BUILTIN_H 0 +#endif + +#ifndef HAVE_GXX_BUILTIN_H +#define HAVE_GXX_BUILTIN_H 0 +#endif + +#ifndef HAVE_GPP_BUILTIN_H +#define HAVE_GPP_BUILTIN_H 0 +#endif + +#ifndef HAVE_IOSTREAM +#define HAVE_IOSTREAM 1 +#endif + +#ifndef HAVE_TYPEINFO +#define HAVE_TYPEINFO 1 +#endif + +#ifndef HAVE_VALUES_H +#define HAVE_VALUES_H 0 +#endif + +#ifndef ETIP_NEEDS_MATH_H +#define ETIP_NEEDS_MATH_H 0 +#endif + +#ifndef ETIP_NEEDS_MATH_EXCEPTION +#define ETIP_NEEDS_MATH_EXCEPTION 0 +#endif + +#ifndef CPP_HAS_PARAM_INIT +#define CPP_HAS_PARAM_INIT 0 +#endif + +#ifndef CPP_HAS_STATIC_CAST +#define CPP_HAS_STATIC_CAST 1 +#endif + +#ifndef IOSTREAM_NAMESPACE +#define IOSTREAM_NAMESPACE 1 +#endif + +#ifdef __GNUG__ +#if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8)) +#if HAVE_TYPEINFO +#include +#endif +#endif +#endif + +#if defined(__GNUG__) +#if HAVE_BUILTIN_H || HAVE_GXX_BUILTIN_H || HAVE_GPP_BUILTIN_H +#if ETIP_NEEDS_MATH_H +#if ETIP_NEEDS_MATH_EXCEPTION +#undef exception +#define exception math_exception +#endif +#include +#endif +#undef exception +#define exception builtin_exception +#if HAVE_GPP_BUILTIN_H +#include +#elif HAVE_GXX_BUILTIN_H +#include +#else +#include +#endif +#undef exception +#endif +#elif defined(__SUNPRO_CC) +#include +#endif + +#include + +extern "C" { +#if HAVE_VALUES_H +#include +#endif + +#include +#include +#include +} + +// Language features +#if CPP_HAS_PARAM_INIT +#define NCURSES_PARAM_INIT(value) = value +#else +#define NCURSES_PARAM_INIT(value) /*nothing*/ +#endif + +#if CPP_HAS_STATIC_CAST +#define STATIC_CAST(s) static_cast +#else +#define STATIC_CAST(s) (s) +#endif + +// Forward Declarations +class NCURSES_IMPEXP NCursesPanel; +class NCURSES_IMPEXP NCursesMenu; +class NCURSES_IMPEXP NCursesForm; + +class NCURSES_IMPEXP NCursesException { + public: + const char* message; + int errorno; + + NCursesException(const char* msg, int err) : message(msg), errorno(err){}; + + NCursesException(const char* msg) : message(msg), errorno(E_SYSTEM_ERROR){}; + + NCursesException& operator=(const NCursesException& rhs) { + errorno = rhs.errorno; + return *this; + } + + NCursesException(const NCursesException& rhs) + : message(rhs.message), errorno(rhs.errorno) {} + + virtual const char* classname() const { + return "NCursesWindow"; + } + + virtual ~NCursesException() {} +}; + +class NCURSES_IMPEXP NCursesPanelException : public NCursesException { + public: + const NCursesPanel* p; + + NCursesPanelException(const char* msg, int err) + : NCursesException(msg, err), p(0){}; + + NCursesPanelException(const NCursesPanel* panel, const char* msg, int err) + : NCursesException(msg, err), p(panel){}; + + NCursesPanelException(int err) + : NCursesException("panel library error", err), p(0){}; + + NCursesPanelException(const NCursesPanel* panel, int err) + : NCursesException("panel library error", err), p(panel){}; + + NCursesPanelException& operator=(const NCursesPanelException& rhs) { + if (this != &rhs) { + NCursesException::operator=(rhs); + p = rhs.p; + } + return *this; + } + + NCursesPanelException(const NCursesPanelException& rhs) + : NCursesException(rhs), p(rhs.p) {} + + virtual const char* classname() const { + return "NCursesPanel"; + } + + virtual ~NCursesPanelException() {} +}; + +class NCURSES_IMPEXP NCursesMenuException : public NCursesException { + public: + const NCursesMenu* m; + + NCursesMenuException(const char* msg, int err) + : NCursesException(msg, err), m(0){}; + + NCursesMenuException(const NCursesMenu* menu, const char* msg, int err) + : NCursesException(msg, err), m(menu){}; + + NCursesMenuException(int err) + : NCursesException("menu library error", err), m(0){}; + + NCursesMenuException(const NCursesMenu* menu, int err) + : NCursesException("menu library error", err), m(menu){}; + + NCursesMenuException& operator=(const NCursesMenuException& rhs) { + if (this != &rhs) { + NCursesException::operator=(rhs); + m = rhs.m; + } + return *this; + } + + NCursesMenuException(const NCursesMenuException& rhs) + : NCursesException(rhs), m(rhs.m) {} + + virtual const char* classname() const { + return "NCursesMenu"; + } + + virtual ~NCursesMenuException() {} +}; + +class NCURSES_IMPEXP NCursesFormException : public NCursesException { + public: + const NCursesForm* f; + + NCursesFormException(const char* msg, int err) + : NCursesException(msg, err), f(0){}; + + NCursesFormException(const NCursesForm* form, const char* msg, int err) + : NCursesException(msg, err), f(form){}; + + NCursesFormException(int err) + : NCursesException("form library error", err), f(0){}; + + NCursesFormException(const NCursesForm* form, int err) + : NCursesException("form library error", err), f(form){}; + + NCursesFormException& operator=(const NCursesFormException& rhs) { + if (this != &rhs) { + NCursesException::operator=(rhs); + f = rhs.f; + } + return *this; + } + + NCursesFormException(const NCursesFormException& rhs) + : NCursesException(rhs), f(rhs.f) {} + + virtual const char* classname() const { + return "NCursesForm"; + } + + virtual ~NCursesFormException() {} +}; + +#if !( \ + (defined(__GNUG__) && defined(__EXCEPTIONS) && (__GNUG__ < 7)) || \ + defined(__SUNPRO_CC)) +#if HAVE_IOSTREAM +#include +#if IOSTREAM_NAMESPACE +using std::cerr; +using std::endl; +#endif +#else +#include +#endif +extern "C" void exit(int); +#endif + +inline void THROW(const NCursesException* e) { +#if defined(__GNUG__) && defined(__EXCEPTIONS) +#if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8)) + (*lib_error_handler)(e ? e->classname() : "", e ? e->message : ""); +#elif (__GNUG__ >= 7) + // g++ 7.0 warns about deprecation, but lacks the predefined symbols + ::endwin(); + std::cerr << "Found a problem - goodbye" << std::endl; + exit(EXIT_FAILURE); +#else +#define CPP_HAS_TRY_CATCH 1 +#endif +#elif defined(__SUNPRO_CC) +#if !defined(__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT < 5) + genericerror(1, ((e != 0) ? (char*)(e->message) : "")); +#else +#define CPP_HAS_TRY_CATCH 1 +#endif +#else + if (e) + cerr << e->message << endl; + exit(0); +#endif + +#ifndef CPP_HAS_TRY_CATCH +#define CPP_HAS_TRY_CATCH 0 +#define NCURSES_CPP_TRY /* nothing */ +#define NCURSES_CPP_CATCH(e) if (false) +#define THROWS(s) /* nothing */ +#define THROW2(s, t) /* nothing */ +#elif CPP_HAS_TRY_CATCH + throw * e; +#define NCURSES_CPP_TRY try +#define NCURSES_CPP_CATCH(e) catch (e) +#if defined(__cpp_noexcept_function_type) && \ + (__cpp_noexcept_function_type >= 201510) +// C++17 deprecates the usage of throw(). +#define THROWS(s) /* nothing */ +#define THROW2(s, t) /* nothing */ +#else +#define THROWS(s) throw(s) +#define THROW2(s, t) throw(s, t) +#endif +#endif +} + +#endif /* NCURSES_ETIP_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/form.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/form.h new file mode 100644 index 0000000..4beba75 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/form.h @@ -0,0 +1,450 @@ +/**************************************************************************** + * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1995,1997 * + ****************************************************************************/ + +/* $Id: form.h,v 0.27 2017/02/11 16:35:42 tom Exp $ */ + +#ifndef FORM_H +#define FORM_H +/* *INDENT-OFF*/ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef FORM_PRIV_H +typedef void* FIELD_CELL; +#endif + +#ifndef NCURSES_FIELD_INTERNALS +#define NCURSES_FIELD_INTERNALS /* nothing */ +#endif + +typedef int Form_Options; +typedef int Field_Options; + +/********** +* _PAGE * +**********/ + +typedef struct pagenode +#if !NCURSES_OPAQUE_FORM +{ + short pmin; /* index of first field on page */ + short pmax; /* index of last field on page */ + short smin; /* index of top leftmost field on page */ + short smax; /* index of bottom rightmost field on page */ +} +#endif /* !NCURSES_OPAQUE_FORM */ +_PAGE; + +/********** +* FIELD * +**********/ + +typedef struct fieldnode +#if 1 /* not yet: !NCURSES_OPAQUE_FORM */ +{ + unsigned short status; /* flags */ + short rows; /* size in rows */ + short cols; /* size in cols */ + short frow; /* first row */ + short fcol; /* first col */ + int drows; /* dynamic rows */ + int dcols; /* dynamic cols */ + int maxgrow; /* maximum field growth */ + int nrow; /* off-screen rows */ + short nbuf; /* additional buffers */ + short just; /* justification */ + short page; /* page on form */ + short index; /* into form -> field */ + int pad; /* pad character */ + chtype fore; /* foreground attribute */ + chtype back; /* background attribute */ + Field_Options opts; /* options */ + struct fieldnode* snext; /* sorted order pointer */ + struct fieldnode* sprev; /* sorted order pointer */ + struct fieldnode* link; /* linked field chain */ + struct formnode* form; /* containing form */ + struct typenode* type; /* field type */ + void* arg; /* argument for type */ + FIELD_CELL* buf; /* field buffers */ + void* usrptr; /* user pointer */ + /* + * The wide-character configuration requires extra information. Because + * there are existing applications that manipulate the members of FIELD + * directly, we cannot make the struct opaque, except by changing the ABI. + * Offsets of members up to this point are the same in the narrow- and + * wide-character configuration. But note that the type of buf depends on + * the configuration, and is made opaque for that reason. + */ + NCURSES_FIELD_INTERNALS +} +#endif /* NCURSES_OPAQUE_FORM */ +FIELD; + +/********* +* FORM * +*********/ + +typedef struct formnode +#if 1 /* not yet: !NCURSES_OPAQUE_FORM */ +{ + unsigned short status; /* flags */ + short rows; /* size in rows */ + short cols; /* size in cols */ + int currow; /* current row in field window */ + int curcol; /* current col in field window */ + int toprow; /* in scrollable field window */ + int begincol; /* in horiz. scrollable field */ + short maxfield; /* number of fields */ + short maxpage; /* number of pages */ + short curpage; /* index into page */ + Form_Options opts; /* options */ + WINDOW* win; /* window */ + WINDOW* sub; /* subwindow */ + WINDOW* w; /* window for current field */ + FIELD** field; /* field [maxfield] */ + FIELD* current; /* current field */ + _PAGE* page; /* page [maxpage] */ + void* usrptr; /* user pointer */ + + void (*forminit)(struct formnode*); + void (*formterm)(struct formnode*); + void (*fieldinit)(struct formnode*); + void (*fieldterm)(struct formnode*); + +} +#endif /* !NCURSES_OPAQUE_FORM */ +FORM; + +/************** +* FIELDTYPE * +**************/ + +typedef struct typenode +#if !NCURSES_OPAQUE_FORM +{ + unsigned short status; /* flags */ + long ref; /* reference count */ + struct typenode* left; /* ptr to operand for | */ + struct typenode* right; /* ptr to operand for | */ + + void* (*makearg)(va_list*); /* make fieldtype arg */ + void* (*copyarg)(const void*); /* copy fieldtype arg */ + void (*freearg)(void*); /* free fieldtype arg */ + +#if NCURSES_INTEROP_FUNCS + union { + bool (*ofcheck)(FIELD*, const void*); /* field validation */ + bool (*gfcheck)(FORM*, FIELD*, const void*); /* generic field validation */ + } fieldcheck; + union { + bool (*occheck)(int, const void*); /* character validation */ + bool (*gccheck)( + int, + FORM*, + FIELD*, + const void*); /* generic char validation */ + } charcheck; + union { + bool (*onext)(FIELD*, const void*); /* enumerate next value */ + bool (*gnext)(FORM*, FIELD*, const void*); /* generic enumerate next */ + } enum_next; + union { + bool (*oprev)(FIELD*, const void*); /* enumerate prev value */ + bool (*gprev)(FORM*, FIELD*, const void*); /* generic enumerate prev */ + } enum_prev; + void* (*genericarg)(void*); /* Alternate Arg method */ +#else + bool (*fcheck)(FIELD*, const void*); /* field validation */ + bool (*ccheck)(int, const void*); /* character validation */ + + bool (*next)(FIELD*, const void*); /* enumerate next value */ + bool (*prev)(FIELD*, const void*); /* enumerate prev value */ +#endif +} +#endif /* !NCURSES_OPAQUE_FORM */ +FIELDTYPE; + +typedef void (*Form_Hook)(FORM*); + +/*************************** +* miscellaneous #defines * +***************************/ + +/* field justification */ +#define NO_JUSTIFICATION (0) +#define JUSTIFY_LEFT (1) +#define JUSTIFY_CENTER (2) +#define JUSTIFY_RIGHT (3) + +/* field options */ +#define O_VISIBLE (0x0001U) +#define O_ACTIVE (0x0002U) +#define O_PUBLIC (0x0004U) +#define O_EDIT (0x0008U) +#define O_WRAP (0x0010U) +#define O_BLANK (0x0020U) +#define O_AUTOSKIP (0x0040U) +#define O_NULLOK (0x0080U) +#define O_PASSOK (0x0100U) +#define O_STATIC (0x0200U) +#define O_DYNAMIC_JUSTIFY (0x0400U) /* ncurses extension */ +#define O_NO_LEFT_STRIP (0x0800U) /* ncurses extension */ + +/* form options */ +#define O_NL_OVERLOAD (0x0001U) +#define O_BS_OVERLOAD (0x0002U) + +/* form driver commands */ +#define REQ_NEXT_PAGE (KEY_MAX + 1) /* move to next page */ +#define REQ_PREV_PAGE (KEY_MAX + 2) /* move to previous page */ +#define REQ_FIRST_PAGE (KEY_MAX + 3) /* move to first page */ +#define REQ_LAST_PAGE (KEY_MAX + 4) /* move to last page */ + +#define REQ_NEXT_FIELD (KEY_MAX + 5) /* move to next field */ +#define REQ_PREV_FIELD (KEY_MAX + 6) /* move to previous field */ +#define REQ_FIRST_FIELD (KEY_MAX + 7) /* move to first field */ +#define REQ_LAST_FIELD (KEY_MAX + 8) /* move to last field */ +#define REQ_SNEXT_FIELD (KEY_MAX + 9) /* move to sorted next field */ +#define REQ_SPREV_FIELD (KEY_MAX + 10) /* move to sorted prev field */ +#define REQ_SFIRST_FIELD (KEY_MAX + 11) /* move to sorted first field */ +#define REQ_SLAST_FIELD (KEY_MAX + 12) /* move to sorted last field */ +#define REQ_LEFT_FIELD (KEY_MAX + 13) /* move to left to field */ +#define REQ_RIGHT_FIELD (KEY_MAX + 14) /* move to right to field */ +#define REQ_UP_FIELD (KEY_MAX + 15) /* move to up to field */ +#define REQ_DOWN_FIELD (KEY_MAX + 16) /* move to down to field */ + +#define REQ_NEXT_CHAR (KEY_MAX + 17) /* move to next char in field */ +#define REQ_PREV_CHAR (KEY_MAX + 18) /* move to prev char in field */ +#define REQ_NEXT_LINE (KEY_MAX + 19) /* move to next line in field */ +#define REQ_PREV_LINE (KEY_MAX + 20) /* move to prev line in field */ +#define REQ_NEXT_WORD (KEY_MAX + 21) /* move to next word in field */ +#define REQ_PREV_WORD (KEY_MAX + 22) /* move to prev word in field */ +#define REQ_BEG_FIELD (KEY_MAX + 23) /* move to first char in field */ +#define REQ_END_FIELD (KEY_MAX + 24) /* move after last char in fld */ +#define REQ_BEG_LINE (KEY_MAX + 25) /* move to beginning of line */ +#define REQ_END_LINE (KEY_MAX + 26) /* move after last char in line */ +#define REQ_LEFT_CHAR (KEY_MAX + 27) /* move left in field */ +#define REQ_RIGHT_CHAR (KEY_MAX + 28) /* move right in field */ +#define REQ_UP_CHAR (KEY_MAX + 29) /* move up in field */ +#define REQ_DOWN_CHAR (KEY_MAX + 30) /* move down in field */ + +#define REQ_NEW_LINE (KEY_MAX + 31) /* insert/overlay new line */ +#define REQ_INS_CHAR (KEY_MAX + 32) /* insert blank char at cursor */ +#define REQ_INS_LINE (KEY_MAX + 33) /* insert blank line at cursor */ +#define REQ_DEL_CHAR (KEY_MAX + 34) /* delete char at cursor */ +#define REQ_DEL_PREV (KEY_MAX + 35) /* delete char before cursor */ +#define REQ_DEL_LINE (KEY_MAX + 36) /* delete line at cursor */ +#define REQ_DEL_WORD (KEY_MAX + 37) /* delete word at cursor */ +#define REQ_CLR_EOL (KEY_MAX + 38) /* clear to end of line */ +#define REQ_CLR_EOF (KEY_MAX + 39) /* clear to end of field */ +#define REQ_CLR_FIELD (KEY_MAX + 40) /* clear entire field */ +#define REQ_OVL_MODE (KEY_MAX + 41) /* begin overlay mode */ +#define REQ_INS_MODE (KEY_MAX + 42) /* begin insert mode */ +#define REQ_SCR_FLINE (KEY_MAX + 43) /* scroll field forward a line */ +#define REQ_SCR_BLINE (KEY_MAX + 44) /* scroll field backward a line */ +#define REQ_SCR_FPAGE (KEY_MAX + 45) /* scroll field forward a page */ +#define REQ_SCR_BPAGE (KEY_MAX + 46) /* scroll field backward a page */ +#define REQ_SCR_FHPAGE (KEY_MAX + 47) /* scroll field forward half page */ +#define REQ_SCR_BHPAGE (KEY_MAX + 48) /* scroll field backward half page */ +#define REQ_SCR_FCHAR (KEY_MAX + 49) /* horizontal scroll char */ +#define REQ_SCR_BCHAR (KEY_MAX + 50) /* horizontal scroll char */ +#define REQ_SCR_HFLINE (KEY_MAX + 51) /* horizontal scroll line */ +#define REQ_SCR_HBLINE (KEY_MAX + 52) /* horizontal scroll line */ +#define REQ_SCR_HFHALF (KEY_MAX + 53) /* horizontal scroll half line */ +#define REQ_SCR_HBHALF (KEY_MAX + 54) /* horizontal scroll half line */ + +#define REQ_VALIDATION (KEY_MAX + 55) /* validate field */ +#define REQ_NEXT_CHOICE (KEY_MAX + 56) /* display next field choice */ +#define REQ_PREV_CHOICE (KEY_MAX + 57) /* display prev field choice */ + +#define MIN_FORM_COMMAND (KEY_MAX + 1) /* used by form_driver */ +#define MAX_FORM_COMMAND (KEY_MAX + 57) /* used by form_driver */ + +#if defined(MAX_COMMAND) +#if (MAX_FORM_COMMAND > MAX_COMMAND) +#error Something is wrong -- MAX_FORM_COMMAND is greater than MAX_COMMAND +#elif (MAX_COMMAND != (KEY_MAX + 128)) +#error Something is wrong -- MAX_COMMAND is already inconsistently defined. +#endif +#else +#define MAX_COMMAND (KEY_MAX + 128) +#endif + +/************************* +* standard field types * +*************************/ +extern NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ALPHA; +extern NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ALNUM; +extern NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ENUM; +extern NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_INTEGER; +extern NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_NUMERIC; +extern NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_REGEXP; + +/************************************ +* built-in additional field types * +* They are not defined in SVr4 * +************************************/ +extern NCURSES_EXPORT_VAR( + FIELDTYPE*) TYPE_IPV4; /* Internet IP Version 4 address */ + +/*********************** +* FIELDTYPE routines * +***********************/ +extern NCURSES_EXPORT(FIELDTYPE*) new_fieldtype( + bool (*const field_check)(FIELD*, const void*), + bool (*const char_check)(int, const void*)); +extern NCURSES_EXPORT(FIELDTYPE*) link_fieldtype(FIELDTYPE*, FIELDTYPE*); + +extern NCURSES_EXPORT(int) free_fieldtype(FIELDTYPE*); +extern NCURSES_EXPORT(int) set_fieldtype_arg( + FIELDTYPE*, + void* (*const make_arg)(va_list*), + void* (*const copy_arg)(const void*), + void (*const free_arg)(void*)); +extern NCURSES_EXPORT(int) set_fieldtype_choice( + FIELDTYPE*, + bool (*const next_choice)(FIELD*, const void*), + bool (*const prev_choice)(FIELD*, const void*)); + +/******************* +* FIELD routines * +*******************/ +extern NCURSES_EXPORT(FIELD*) new_field(int, int, int, int, int, int); +extern NCURSES_EXPORT(FIELD*) dup_field(FIELD*, int, int); +extern NCURSES_EXPORT(FIELD*) link_field(FIELD*, int, int); + +extern NCURSES_EXPORT(int) free_field(FIELD*); +extern NCURSES_EXPORT(int) + field_info(const FIELD*, int*, int*, int*, int*, int*, int*); +extern NCURSES_EXPORT(int) dynamic_field_info(const FIELD*, int*, int*, int*); +extern NCURSES_EXPORT(int) set_max_field(FIELD*, int); +extern NCURSES_EXPORT(int) move_field(FIELD*, int, int); +extern NCURSES_EXPORT(int) set_field_type(FIELD*, FIELDTYPE*, ...); +extern NCURSES_EXPORT(int) set_new_page(FIELD*, bool); +extern NCURSES_EXPORT(int) set_field_just(FIELD*, int); +extern NCURSES_EXPORT(int) field_just(const FIELD*); +extern NCURSES_EXPORT(int) set_field_fore(FIELD*, chtype); +extern NCURSES_EXPORT(int) set_field_back(FIELD*, chtype); +extern NCURSES_EXPORT(int) set_field_pad(FIELD*, int); +extern NCURSES_EXPORT(int) field_pad(const FIELD*); +extern NCURSES_EXPORT(int) set_field_buffer(FIELD*, int, const char*); +extern NCURSES_EXPORT(int) set_field_status(FIELD*, bool); +extern NCURSES_EXPORT(int) set_field_userptr(FIELD*, void*); +extern NCURSES_EXPORT(int) set_field_opts(FIELD*, Field_Options); +extern NCURSES_EXPORT(int) field_opts_on(FIELD*, Field_Options); +extern NCURSES_EXPORT(int) field_opts_off(FIELD*, Field_Options); + +extern NCURSES_EXPORT(chtype) field_fore(const FIELD*); +extern NCURSES_EXPORT(chtype) field_back(const FIELD*); + +extern NCURSES_EXPORT(bool) new_page(const FIELD*); +extern NCURSES_EXPORT(bool) field_status(const FIELD*); + +extern NCURSES_EXPORT(void*) field_arg(const FIELD*); + +extern NCURSES_EXPORT(void*) field_userptr(const FIELD*); + +extern NCURSES_EXPORT(FIELDTYPE*) field_type(const FIELD*); + +extern NCURSES_EXPORT(char*) field_buffer(const FIELD*, int); + +extern NCURSES_EXPORT(Field_Options) field_opts(const FIELD*); + +/****************** +* FORM routines * +******************/ + +extern NCURSES_EXPORT(FORM*) new_form(FIELD**); + +extern NCURSES_EXPORT(FIELD**) form_fields(const FORM*); +extern NCURSES_EXPORT(FIELD*) current_field(const FORM*); + +extern NCURSES_EXPORT(WINDOW*) form_win(const FORM*); +extern NCURSES_EXPORT(WINDOW*) form_sub(const FORM*); + +extern NCURSES_EXPORT(Form_Hook) form_init(const FORM*); +extern NCURSES_EXPORT(Form_Hook) form_term(const FORM*); +extern NCURSES_EXPORT(Form_Hook) field_init(const FORM*); +extern NCURSES_EXPORT(Form_Hook) field_term(const FORM*); + +extern NCURSES_EXPORT(int) free_form(FORM*); +extern NCURSES_EXPORT(int) set_form_fields(FORM*, FIELD**); +extern NCURSES_EXPORT(int) field_count(const FORM*); +extern NCURSES_EXPORT(int) set_form_win(FORM*, WINDOW*); +extern NCURSES_EXPORT(int) set_form_sub(FORM*, WINDOW*); +extern NCURSES_EXPORT(int) set_current_field(FORM*, FIELD*); +extern NCURSES_EXPORT(int) unfocus_current_field(FORM*); +extern NCURSES_EXPORT(int) field_index(const FIELD*); +extern NCURSES_EXPORT(int) set_form_page(FORM*, int); +extern NCURSES_EXPORT(int) form_page(const FORM*); +extern NCURSES_EXPORT(int) scale_form(const FORM*, int*, int*); +extern NCURSES_EXPORT(int) set_form_init(FORM*, Form_Hook); +extern NCURSES_EXPORT(int) set_form_term(FORM*, Form_Hook); +extern NCURSES_EXPORT(int) set_field_init(FORM*, Form_Hook); +extern NCURSES_EXPORT(int) set_field_term(FORM*, Form_Hook); +extern NCURSES_EXPORT(int) post_form(FORM*); +extern NCURSES_EXPORT(int) unpost_form(FORM*); +extern NCURSES_EXPORT(int) pos_form_cursor(FORM*); +extern NCURSES_EXPORT(int) form_driver(FORM*, int); +#if NCURSES_WIDECHAR +extern NCURSES_EXPORT(int) form_driver_w(FORM*, int, wchar_t); +#endif +extern NCURSES_EXPORT(int) set_form_userptr(FORM*, void*); +extern NCURSES_EXPORT(int) set_form_opts(FORM*, Form_Options); +extern NCURSES_EXPORT(int) form_opts_on(FORM*, Form_Options); +extern NCURSES_EXPORT(int) form_opts_off(FORM*, Form_Options); +extern NCURSES_EXPORT(int) form_request_by_name(const char*); + +extern NCURSES_EXPORT(const char*) form_request_name(int); + +extern NCURSES_EXPORT(void*) form_userptr(const FORM*); + +extern NCURSES_EXPORT(Form_Options) form_opts(const FORM*); + +extern NCURSES_EXPORT(bool) data_ahead(const FORM*); +extern NCURSES_EXPORT(bool) data_behind(const FORM*); + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(FORM*) NCURSES_SP_NAME(new_form)(SCREEN*, FIELD**); +#endif + +#ifdef __cplusplus +} +#endif +/* *INDENT-ON*/ + +#endif /* FORM_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/menu.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/menu.h new file mode 100644 index 0000000..6f81485 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/menu.h @@ -0,0 +1,266 @@ +/**************************************************************************** + * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1995,1997 * + ****************************************************************************/ + +/* $Id: menu.h,v 1.23 2017/02/11 16:54:04 tom Exp $ */ + +#ifndef ETI_MENU +#define ETI_MENU + +#ifdef AMIGA +#define TEXT TEXT_ncurses +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef int Menu_Options; +typedef int Item_Options; + +/* Menu options: */ +#define O_ONEVALUE (0x01) +#define O_SHOWDESC (0x02) +#define O_ROWMAJOR (0x04) +#define O_IGNORECASE (0x08) +#define O_SHOWMATCH (0x10) +#define O_NONCYCLIC (0x20) +#define O_MOUSE_MENU (0x40) + +/* Item options: */ +#define O_SELECTABLE (0x01) + +#if !NCURSES_OPAQUE_MENU +typedef struct { + const char* str; + unsigned short length; +} TEXT; +#endif /* !NCURSES_OPAQUE_MENU */ + +struct tagMENU; + +typedef struct tagITEM +#if !NCURSES_OPAQUE_MENU +{ + TEXT name; /* name of menu item */ + TEXT description; /* description of item, optional in display */ + struct tagMENU* imenu; /* Pointer to parent menu */ + void* userptr; /* Pointer to user defined per item data */ + Item_Options opt; /* Item options */ + short index; /* Item number if connected to a menu */ + short y; /* y and x location of item in menu */ + short x; + bool value; /* Selection value */ + + struct tagITEM* left; /* neighbor items */ + struct tagITEM* right; + struct tagITEM* up; + struct tagITEM* down; + +} +#endif /* !NCURSES_OPAQUE_MENU */ +ITEM; + +typedef void (*Menu_Hook)(struct tagMENU*); + +typedef struct tagMENU +#if 1 /* not yet: !NCURSES_OPAQUE_MENU */ +{ + short height; /* Nr. of chars high */ + short width; /* Nr. of chars wide */ + short rows; /* Nr. of items high */ + short cols; /* Nr. of items wide */ + short frows; /* Nr. of formatted items high */ + short fcols; /* Nr. of formatted items wide */ + short arows; /* Nr. of items high (actual) */ + short namelen; /* Max. name length */ + short desclen; /* Max. description length */ + short marklen; /* Length of mark, if any */ + short itemlen; /* Length of one item */ + short spc_desc; /* Spacing for descriptor */ + short spc_cols; /* Spacing for columns */ + short spc_rows; /* Spacing for rows */ + char* pattern; /* Buffer to store match chars */ + short pindex; /* Index into pattern buffer */ + WINDOW* win; /* Window containing menu */ + WINDOW* sub; /* Subwindow for menu display */ + WINDOW* userwin; /* User's window */ + WINDOW* usersub; /* User's subwindow */ + ITEM** items; /* array of items */ + short nitems; /* Nr. of items in menu */ + ITEM* curitem; /* Current item */ + short toprow; /* Top row of menu */ + chtype fore; /* Selection attribute */ + chtype back; /* Nonselection attribute */ + chtype grey; /* Inactive attribute */ + unsigned char pad; /* Pad character */ + + Menu_Hook menuinit; /* User hooks */ + Menu_Hook menuterm; + Menu_Hook iteminit; + Menu_Hook itemterm; + + void* userptr; /* Pointer to menus user data */ + char* mark; /* Pointer to marker string */ + + Menu_Options opt; /* Menu options */ + unsigned short status; /* Internal state of menu */ +} +#endif /* !NCURSES_OPAQUE_MENU */ +MENU; + +/* Define keys */ + +#define REQ_LEFT_ITEM (KEY_MAX + 1) +#define REQ_RIGHT_ITEM (KEY_MAX + 2) +#define REQ_UP_ITEM (KEY_MAX + 3) +#define REQ_DOWN_ITEM (KEY_MAX + 4) +#define REQ_SCR_ULINE (KEY_MAX + 5) +#define REQ_SCR_DLINE (KEY_MAX + 6) +#define REQ_SCR_DPAGE (KEY_MAX + 7) +#define REQ_SCR_UPAGE (KEY_MAX + 8) +#define REQ_FIRST_ITEM (KEY_MAX + 9) +#define REQ_LAST_ITEM (KEY_MAX + 10) +#define REQ_NEXT_ITEM (KEY_MAX + 11) +#define REQ_PREV_ITEM (KEY_MAX + 12) +#define REQ_TOGGLE_ITEM (KEY_MAX + 13) +#define REQ_CLEAR_PATTERN (KEY_MAX + 14) +#define REQ_BACK_PATTERN (KEY_MAX + 15) +#define REQ_NEXT_MATCH (KEY_MAX + 16) +#define REQ_PREV_MATCH (KEY_MAX + 17) + +#define MIN_MENU_COMMAND (KEY_MAX + 1) +#define MAX_MENU_COMMAND (KEY_MAX + 17) + +/* + * Some AT&T code expects MAX_COMMAND to be out-of-band not + * just for menu commands but for forms ones as well. + */ +#if defined(MAX_COMMAND) +#if (MAX_MENU_COMMAND > MAX_COMMAND) +#error Something is wrong -- MAX_MENU_COMMAND is greater than MAX_COMMAND +#elif (MAX_COMMAND != (KEY_MAX + 128)) +#error Something is wrong -- MAX_COMMAND is already inconsistently defined. +#endif +#else +#define MAX_COMMAND (KEY_MAX + 128) +#endif + +/* --------- prototypes for libmenu functions ----------------------------- */ + +extern NCURSES_EXPORT(ITEM**) menu_items(const MENU*); +extern NCURSES_EXPORT(ITEM*) current_item(const MENU*); +extern NCURSES_EXPORT(ITEM*) new_item(const char*, const char*); + +extern NCURSES_EXPORT(MENU*) new_menu(ITEM**); + +extern NCURSES_EXPORT(Item_Options) item_opts(const ITEM*); +extern NCURSES_EXPORT(Menu_Options) menu_opts(const MENU*); + +extern NCURSES_EXPORT(Menu_Hook) item_init(const MENU*); +extern NCURSES_EXPORT(Menu_Hook) item_term(const MENU*); +extern NCURSES_EXPORT(Menu_Hook) menu_init(const MENU*); +extern NCURSES_EXPORT(Menu_Hook) menu_term(const MENU*); + +extern NCURSES_EXPORT(WINDOW*) menu_sub(const MENU*); +extern NCURSES_EXPORT(WINDOW*) menu_win(const MENU*); + +extern NCURSES_EXPORT(const char*) item_description(const ITEM*); +extern NCURSES_EXPORT(const char*) item_name(const ITEM*); +extern NCURSES_EXPORT(const char*) menu_mark(const MENU*); +extern NCURSES_EXPORT(const char*) menu_request_name(int); + +extern NCURSES_EXPORT(char*) menu_pattern(const MENU*); + +extern NCURSES_EXPORT(void*) menu_userptr(const MENU*); +extern NCURSES_EXPORT(void*) item_userptr(const ITEM*); + +extern NCURSES_EXPORT(chtype) menu_back(const MENU*); +extern NCURSES_EXPORT(chtype) menu_fore(const MENU*); +extern NCURSES_EXPORT(chtype) menu_grey(const MENU*); + +extern NCURSES_EXPORT(int) free_item(ITEM*); +extern NCURSES_EXPORT(int) free_menu(MENU*); +extern NCURSES_EXPORT(int) item_count(const MENU*); +extern NCURSES_EXPORT(int) item_index(const ITEM*); +extern NCURSES_EXPORT(int) item_opts_off(ITEM*, Item_Options); +extern NCURSES_EXPORT(int) item_opts_on(ITEM*, Item_Options); +extern NCURSES_EXPORT(int) menu_driver(MENU*, int); +extern NCURSES_EXPORT(int) menu_opts_off(MENU*, Menu_Options); +extern NCURSES_EXPORT(int) menu_opts_on(MENU*, Menu_Options); +extern NCURSES_EXPORT(int) menu_pad(const MENU*); +extern NCURSES_EXPORT(int) pos_menu_cursor(const MENU*); +extern NCURSES_EXPORT(int) post_menu(MENU*); +extern NCURSES_EXPORT(int) scale_menu(const MENU*, int*, int*); +extern NCURSES_EXPORT(int) set_current_item(MENU* menu, ITEM* item); +extern NCURSES_EXPORT(int) set_item_init(MENU*, Menu_Hook); +extern NCURSES_EXPORT(int) set_item_opts(ITEM*, Item_Options); +extern NCURSES_EXPORT(int) set_item_term(MENU*, Menu_Hook); +extern NCURSES_EXPORT(int) set_item_userptr(ITEM*, void*); +extern NCURSES_EXPORT(int) set_item_value(ITEM*, bool); +extern NCURSES_EXPORT(int) set_menu_back(MENU*, chtype); +extern NCURSES_EXPORT(int) set_menu_fore(MENU*, chtype); +extern NCURSES_EXPORT(int) set_menu_format(MENU*, int, int); +extern NCURSES_EXPORT(int) set_menu_grey(MENU*, chtype); +extern NCURSES_EXPORT(int) set_menu_init(MENU*, Menu_Hook); +extern NCURSES_EXPORT(int) set_menu_items(MENU*, ITEM**); +extern NCURSES_EXPORT(int) set_menu_mark(MENU*, const char*); +extern NCURSES_EXPORT(int) set_menu_opts(MENU*, Menu_Options); +extern NCURSES_EXPORT(int) set_menu_pad(MENU*, int); +extern NCURSES_EXPORT(int) set_menu_pattern(MENU*, const char*); +extern NCURSES_EXPORT(int) set_menu_sub(MENU*, WINDOW*); +extern NCURSES_EXPORT(int) set_menu_term(MENU*, Menu_Hook); +extern NCURSES_EXPORT(int) set_menu_userptr(MENU*, void*); +extern NCURSES_EXPORT(int) set_menu_win(MENU*, WINDOW*); +extern NCURSES_EXPORT(int) set_top_row(MENU*, int); +extern NCURSES_EXPORT(int) top_row(const MENU*); +extern NCURSES_EXPORT(int) unpost_menu(MENU*); +extern NCURSES_EXPORT(int) menu_request_by_name(const char*); +extern NCURSES_EXPORT(int) set_menu_spacing(MENU*, int, int, int); +extern NCURSES_EXPORT(int) menu_spacing(const MENU*, int*, int*, int*); + +extern NCURSES_EXPORT(bool) item_value(const ITEM*); +extern NCURSES_EXPORT(bool) item_visible(const ITEM*); + +extern NCURSES_EXPORT(void) menu_format(const MENU*, int*, int*); + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(MENU*) NCURSES_SP_NAME(new_menu)(SCREEN*, ITEM**); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* ETI_MENU */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/nc_tparm.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/nc_tparm.h new file mode 100644 index 0000000..c3f414b --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/nc_tparm.h @@ -0,0 +1,120 @@ +/**************************************************************************** + * Copyright (c) 2006-2012,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Thomas E. Dickey 2006 * + ****************************************************************************/ + +/* $Id: nc_tparm.h,v 1.8 2017/07/22 17:09:46 tom Exp $ */ + +#ifndef NC_TPARM_included +#define NC_TPARM_included 1 + +#include +#include + +/* + * Cast parameters past the formatting-string for tparm() to match the + * assumption of the varargs code. + */ +#ifndef TPARM_ARG +#ifdef NCURSES_TPARM_ARG +#define TPARM_ARG NCURSES_TPARM_ARG +#else +#define TPARM_ARG long +#endif +#endif /* TPARAM_ARG */ + +#define TPARM_N(n) (TPARM_ARG)(n) + +#define TPARM_9(a, b, c, d, e, f, g, h, i, j) \ + tparm( \ + a, \ + TPARM_N(b), \ + TPARM_N(c), \ + TPARM_N(d), \ + TPARM_N(e), \ + TPARM_N(f), \ + TPARM_N(g), \ + TPARM_N(h), \ + TPARM_N(i), \ + TPARM_N(j)) + +#if NCURSES_TPARM_VARARGS +#define TPARM_8(a, b, c, d, e, f, g, h, i) \ + tparm( \ + a, \ + TPARM_N(b), \ + TPARM_N(c), \ + TPARM_N(d), \ + TPARM_N(e), \ + TPARM_N(f), \ + TPARM_N(g), \ + TPARM_N(h), \ + TPARM_N(i)) +#define TPARM_7(a, b, c, d, e, f, g, h) \ + tparm( \ + a, \ + TPARM_N(b), \ + TPARM_N(c), \ + TPARM_N(d), \ + TPARM_N(e), \ + TPARM_N(f), \ + TPARM_N(g), \ + TPARM_N(h)) +#define TPARM_6(a, b, c, d, e, f, g) \ + tparm( \ + a, \ + TPARM_N(b), \ + TPARM_N(c), \ + TPARM_N(d), \ + TPARM_N(e), \ + TPARM_N(f), \ + TPARM_N(g)) +#define TPARM_5(a, b, c, d, e, f) \ + tparm(a, TPARM_N(b), TPARM_N(c), TPARM_N(d), TPARM_N(e), TPARM_N(f)) +#define TPARM_4(a, b, c, d, e) \ + tparm(a, TPARM_N(b), TPARM_N(c), TPARM_N(d), TPARM_N(e)) +#define TPARM_3(a, b, c, d) tparm(a, TPARM_N(b), TPARM_N(c), TPARM_N(d)) +#define TPARM_2(a, b, c) tparm(a, TPARM_N(b), TPARM_N(c)) +#define TPARM_1(a, b) tparm(a, TPARM_N(b)) +#define TPARM_0(a) tparm(a) +#else +#define TPARM_8(a, b, c, d, e, f, g, h, i) TPARM_9(a, b, c, d, e, f, g, h, i, 0) +#define TPARM_7(a, b, c, d, e, f, g, h) TPARM_8(a, b, c, d, e, f, g, h, 0) +#define TPARM_6(a, b, c, d, e, f, g) TPARM_7(a, b, c, d, e, f, g, 0) +#define TPARM_5(a, b, c, d, e, f) TPARM_6(a, b, c, d, e, f, 0) +#define TPARM_4(a, b, c, d, e) TPARM_5(a, b, c, d, e, 0) +#define TPARM_3(a, b, c, d) TPARM_4(a, b, c, d, 0) +#define TPARM_2(a, b, c) TPARM_3(a, b, c, 0) +#define TPARM_1(a, b) TPARM_2(a, b, 0) +#define TPARM_1(a, b) TPARM_2(a, b, 0) +#define TPARM_0(a) TPARM_1(a, 0) +#endif + +#endif /* NC_TPARM_included */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/ncurses.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/ncurses.h new file mode 100644 index 0000000..1512dc4 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/ncurses.h @@ -0,0 +1,2456 @@ +/**************************************************************************** + * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* $Id: curses.h.in,v 1.257 2017/11/21 00:11:37 tom Exp $ */ + +#ifndef __NCURSES_H +#define __NCURSES_H + +#define CURSES 1 +#define CURSES_H 1 + +/* These are defined only in curses.h, and are used for conditional compiles */ +#define NCURSES_VERSION_MAJOR 6 +#define NCURSES_VERSION_MINOR 1 +#define NCURSES_VERSION_PATCH 20180127 + +/* This is defined in more than one ncurses header, for identification */ +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.1" + +/* + * Identify the mouse encoding version. + */ +#define NCURSES_MOUSE_VERSION 2 + +/* + * Definitions to facilitate DLL's. + */ +#include + +#if 1 +#include +#endif + +/* + * User-definable tweak to disable the include of . + */ +#ifndef NCURSES_ENABLE_STDBOOL_H +#define NCURSES_ENABLE_STDBOOL_H 1 +#endif + +/* + * NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses + * configured using --disable-macros. + */ +#ifndef NCURSES_ATTR_T +#define NCURSES_ATTR_T int +#endif + +/* + * Expands to 'const' if ncurses is configured using --enable-const. Note that + * doing so makes it incompatible with other implementations of X/Open Curses. + */ +#undef NCURSES_CONST +#define NCURSES_CONST const + +#undef NCURSES_INLINE +#define NCURSES_INLINE inline + +/* + * The standard type used for color values, and for color-pairs. The latter + * allows the curses library to enumerate the combinations of foreground and + * background colors used by an application, and is normally the product of the + * total foreground and background colors. + * + * X/Open uses "short" for both of these types, ultimately because they are + * numbers from the SVr4 terminal database, which uses 16-bit signed values. + */ +#undef NCURSES_COLOR_T +#define NCURSES_COLOR_T short + +#undef NCURSES_PAIRS_T +#define NCURSES_PAIRS_T short + +/* + * Definitions used to make WINDOW and similar structs opaque. + */ +#ifndef NCURSES_INTERNALS +#define NCURSES_OPAQUE 0 +#define NCURSES_OPAQUE_FORM 0 +#define NCURSES_OPAQUE_MENU 0 +#define NCURSES_OPAQUE_PANEL 0 +#endif + +/* + * Definition used to optionally suppress wattr* macros to help with the + * transition from ncurses5 to ncurses6 by allowing the header files to + * be shared across development packages for ncursesw in both ABIs. + */ +#ifndef NCURSES_WATTR_MACROS +#define NCURSES_WATTR_MACROS 1 +#endif + +/* + * The reentrant code relies on the opaque setting, but adds features. + */ +#ifndef NCURSES_REENTRANT +#define NCURSES_REENTRANT 0 +#endif + +/* + * Control whether bindings for interop support are added. + */ +#undef NCURSES_INTEROP_FUNCS +#define NCURSES_INTEROP_FUNCS 1 + +/* + * The internal type used for window dimensions. + */ +#undef NCURSES_SIZE_T +#define NCURSES_SIZE_T short + +/* + * Control whether tparm() supports varargs or fixed-parameter list. + */ +#undef NCURSES_TPARM_VARARGS +#define NCURSES_TPARM_VARARGS 1 + +/* + * Control type used for tparm's arguments. While X/Open equates long and + * char* values, this is not always workable for 64-bit platforms. + */ +#undef NCURSES_TPARM_ARG +#define NCURSES_TPARM_ARG intptr_t + +/* + * Control whether ncurses uses wcwidth() for checking width of line-drawing + * characters. + */ +#undef NCURSES_WCWIDTH_GRAPHICS +#define NCURSES_WCWIDTH_GRAPHICS 1 + +/* + * NCURSES_CH_T is used in building the library, but not used otherwise in + * this header file, since that would make the normal/wide-character versions + * of the header incompatible. + */ +#undef NCURSES_CH_T +#define NCURSES_CH_T cchar_t + +#if 1 && defined(_LP64) +typedef unsigned chtype; +typedef unsigned mmask_t; +#else +typedef uint32_t chtype; +typedef uint32_t mmask_t; +#endif + +/* + * We need FILE, etc. Include this before checking any feature symbols. + */ +#include + +/* + * With XPG4, you must define _XOPEN_SOURCE_EXTENDED, it is redundant (or + * conflicting) when _XOPEN_SOURCE is 500 or greater. If NCURSES_WIDECHAR is + * not already defined, e.g., if the platform relies upon nonstandard feature + * test macros, define it at this point if the standard feature test macros + * indicate that it should be defined. + */ +#ifndef NCURSES_WIDECHAR +#if defined(_XOPEN_SOURCE_EXTENDED) || \ + (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 >= 500)) +#define NCURSES_WIDECHAR 1 +#else +#define NCURSES_WIDECHAR 0 +#endif +#endif /* NCURSES_WIDECHAR */ + +#include /* we need va_list */ +#if NCURSES_WIDECHAR +#include /* we want wchar_t */ +#endif + +/* X/Open and SVr4 specify that curses implements 'bool'. However, C++ may also + * implement it. If so, we must use the C++ compiler's type to avoid conflict + * with other interfaces. + * + * A further complication is that may declare 'bool' to be a + * different type, such as an enum which is not necessarily compatible with + * C++. If we have , make 'bool' a macro, so users may #undef it. + * Otherwise, let it remain a typedef to avoid conflicts with other #define's. + * In either case, make a typedef for NCURSES_BOOL which can be used if needed + * from either C or C++. + */ + +#undef TRUE +#define TRUE 1 + +#undef FALSE +#define FALSE 0 + +typedef unsigned char NCURSES_BOOL; + +#if defined(__cplusplus) /* __cplusplus, etc. */ + +/* use the C++ compiler's bool type */ +#define NCURSES_BOOL bool + +#else /* c89, c99, etc. */ + +#if NCURSES_ENABLE_STDBOOL_H +#include +/* use whatever the C compiler decides bool really is */ +#define NCURSES_BOOL bool +#else +/* there is no predefined bool - use our own */ +#undef bool +#define bool NCURSES_BOOL +#endif + +#endif /* !__cplusplus, etc. */ + +#ifdef __cplusplus +extern "C" { +#define NCURSES_CAST(type, value) static_cast(value) +#else +#define NCURSES_CAST(type, value) (type)(value) +#endif + +#define NCURSES_OK_ADDR(p) (0 != NCURSES_CAST(const void*, (p))) + +/* + * X/Open attributes. In the ncurses implementation, they are identical to the + * A_ attributes. + */ +#define WA_ATTRIBUTES A_ATTRIBUTES +#define WA_NORMAL A_NORMAL +#define WA_STANDOUT A_STANDOUT +#define WA_UNDERLINE A_UNDERLINE +#define WA_REVERSE A_REVERSE +#define WA_BLINK A_BLINK +#define WA_DIM A_DIM +#define WA_BOLD A_BOLD +#define WA_ALTCHARSET A_ALTCHARSET +#define WA_INVIS A_INVIS +#define WA_PROTECT A_PROTECT +#define WA_HORIZONTAL A_HORIZONTAL +#define WA_LEFT A_LEFT +#define WA_LOW A_LOW +#define WA_RIGHT A_RIGHT +#define WA_TOP A_TOP +#define WA_VERTICAL A_VERTICAL + +#if 1 +#define WA_ITALIC A_ITALIC /* ncurses extension */ +#endif + +/* colors */ +#define COLOR_BLACK 0 +#define COLOR_RED 1 +#define COLOR_GREEN 2 +#define COLOR_YELLOW 3 +#define COLOR_BLUE 4 +#define COLOR_MAGENTA 5 +#define COLOR_CYAN 6 +#define COLOR_WHITE 7 + +/* line graphics */ + +#if 0 || NCURSES_REENTRANT +NCURSES_WRAPPED_VAR(chtype*, acs_map); +#define acs_map NCURSES_PUBLIC_VAR(acs_map()) +#else +extern NCURSES_EXPORT_VAR(chtype) acs_map[]; +#endif + +#define NCURSES_ACS(c) (acs_map[NCURSES_CAST(unsigned char, (c))]) + +/* VT100 symbols begin here */ +#define ACS_ULCORNER NCURSES_ACS('l') /* upper left corner */ +#define ACS_LLCORNER NCURSES_ACS('m') /* lower left corner */ +#define ACS_URCORNER NCURSES_ACS('k') /* upper right corner */ +#define ACS_LRCORNER NCURSES_ACS('j') /* lower right corner */ +#define ACS_LTEE NCURSES_ACS('t') /* tee pointing right */ +#define ACS_RTEE NCURSES_ACS('u') /* tee pointing left */ +#define ACS_BTEE NCURSES_ACS('v') /* tee pointing up */ +#define ACS_TTEE NCURSES_ACS('w') /* tee pointing down */ +#define ACS_HLINE NCURSES_ACS('q') /* horizontal line */ +#define ACS_VLINE NCURSES_ACS('x') /* vertical line */ +#define ACS_PLUS NCURSES_ACS('n') /* large plus or crossover */ +#define ACS_S1 NCURSES_ACS('o') /* scan line 1 */ +#define ACS_S9 NCURSES_ACS('s') /* scan line 9 */ +#define ACS_DIAMOND NCURSES_ACS('`') /* diamond */ +#define ACS_CKBOARD NCURSES_ACS('a') /* checker board (stipple) */ +#define ACS_DEGREE NCURSES_ACS('f') /* degree symbol */ +#define ACS_PLMINUS NCURSES_ACS('g') /* plus/minus */ +#define ACS_BULLET NCURSES_ACS('~') /* bullet */ +/* Teletype 5410v1 symbols begin here */ +#define ACS_LARROW NCURSES_ACS(',') /* arrow pointing left */ +#define ACS_RARROW NCURSES_ACS('+') /* arrow pointing right */ +#define ACS_DARROW NCURSES_ACS('.') /* arrow pointing down */ +#define ACS_UARROW NCURSES_ACS('-') /* arrow pointing up */ +#define ACS_BOARD NCURSES_ACS('h') /* board of squares */ +#define ACS_LANTERN NCURSES_ACS('i') /* lantern symbol */ +#define ACS_BLOCK NCURSES_ACS('0') /* solid square block */ +/* + * These aren't documented, but a lot of System Vs have them anyway + * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings). + * The ACS_names may not match AT&T's, our source didn't know them. + */ +#define ACS_S3 NCURSES_ACS('p') /* scan line 3 */ +#define ACS_S7 NCURSES_ACS('r') /* scan line 7 */ +#define ACS_LEQUAL NCURSES_ACS('y') /* less/equal */ +#define ACS_GEQUAL NCURSES_ACS('z') /* greater/equal */ +#define ACS_PI NCURSES_ACS('{') /* Pi */ +#define ACS_NEQUAL NCURSES_ACS('|') /* not equal */ +#define ACS_STERLING NCURSES_ACS('}') /* UK pound sign */ + +/* + * Line drawing ACS names are of the form ACS_trbl, where t is the top, r + * is the right, b is the bottom, and l is the left. t, r, b, and l might + * be B (blank), S (single), D (double), or T (thick). The subset defined + * here only uses B and S. + */ +#define ACS_BSSB ACS_ULCORNER +#define ACS_SSBB ACS_LLCORNER +#define ACS_BBSS ACS_URCORNER +#define ACS_SBBS ACS_LRCORNER +#define ACS_SBSS ACS_RTEE +#define ACS_SSSB ACS_LTEE +#define ACS_SSBS ACS_BTEE +#define ACS_BSSS ACS_TTEE +#define ACS_BSBS ACS_HLINE +#define ACS_SBSB ACS_VLINE +#define ACS_SSSS ACS_PLUS + +#undef ERR +#define ERR (-1) + +#undef OK +#define OK (0) + +/* values for the _flags member */ +#define _SUBWIN 0x01 /* is this a sub-window? */ +#define _ENDLINE 0x02 /* is the window flush right? */ +#define _FULLWIN 0x04 /* is the window full-screen? */ +#define _SCROLLWIN 0x08 /* bottom edge is at screen bottom? */ +#define _ISPAD 0x10 /* is this window a pad? */ +#define _HASMOVED 0x20 /* has cursor moved since last refresh? */ +#define _WRAPPED 0x40 /* cursor was just wrappped */ + +/* + * this value is used in the firstchar and lastchar fields to mark + * unchanged lines + */ +#define _NOCHANGE -1 + +/* + * this value is used in the oldindex field to mark lines created by insertions + * and scrolls. + */ +#define _NEWINDEX -1 + +typedef struct screen SCREEN; +typedef struct _win_st WINDOW; + +typedef chtype attr_t; /* ...must be at least as wide as chtype */ + +#if NCURSES_WIDECHAR + +#if 0 +#ifdef mblen /* libutf8.h defines it w/o undefining first */ +#undef mblen +#endif +#include +#endif + +#if 1 +#include /* ...to get mbstate_t, etc. */ +#endif + +#if 0 +typedef unsigned short wchar_t1; +#endif + +#if 0 +typedef unsigned int wint_t1; +#endif + +/* + * cchar_t stores an array of CCHARW_MAX wide characters. The first is + * normally a spacing character. The others are non-spacing. If those + * (spacing and nonspacing) do not fill the array, a null L'\0' follows. + * Otherwise, a null is assumed to follow when extracting via getcchar(). + */ +#define CCHARW_MAX 5 +typedef struct { + attr_t attr; + wchar_t chars[CCHARW_MAX]; +#if 1 +#undef NCURSES_EXT_COLORS +#define NCURSES_EXT_COLORS 20180127 + int ext_color; /* color pair, must be more than 16-bits */ +#endif +} cchar_t; + +#endif /* NCURSES_WIDECHAR */ + +#if !NCURSES_OPAQUE +struct ldat; + +struct _win_st { + NCURSES_SIZE_T _cury, _curx; /* current cursor position */ + + /* window location and size */ + NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */ + NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */ + + short _flags; /* window state flags */ + + /* attribute tracking */ + attr_t _attrs; /* current attribute for non-space character */ + chtype _bkgd; /* current background char/attribute pair */ + + /* option values set by user */ + bool _notimeout; /* no time out on function-key entry? */ + bool _clear; /* consider all data in the window invalid? */ + bool _leaveok; /* OK to not reset cursor on exit? */ + bool _scroll; /* OK to scroll this window? */ + bool _idlok; /* OK to use insert/delete line? */ + bool _idcok; /* OK to use insert/delete char? */ + bool _immed; /* window in immed mode? (not yet used) */ + bool _sync; /* window in sync mode? */ + bool _use_keypad; /* process function keys into KEY_ symbols? */ + int _delay; /* 0 = nodelay, <0 = blocking, >0 = delay */ + + struct ldat* _line; /* the actual line data */ + + /* global screen state */ + NCURSES_SIZE_T _regtop; /* top line of scrolling region */ + NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */ + + /* these are used only if this is a sub-window */ + int _parx; /* x coordinate of this window in parent */ + int _pary; /* y coordinate of this window in parent */ + WINDOW* _parent; /* pointer to parent if a sub-window */ + + /* these are used only if this is a pad */ + struct pdat { + NCURSES_SIZE_T _pad_y, _pad_x; + NCURSES_SIZE_T _pad_top, _pad_left; + NCURSES_SIZE_T _pad_bottom, _pad_right; + } _pad; + + NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */ + +#if NCURSES_WIDECHAR + cchar_t _bkgrnd; /* current background char/attribute pair */ +#if 1 + int _color; /* current color-pair for non-space character */ +#endif +#endif +}; +#endif /* NCURSES_OPAQUE */ + +/* + * This is an extension to support events... + */ +#if 1 +#ifdef NCURSES_WGETCH_EVENTS +#if !defined(__BEOS__) || defined(__HAIKU__) +/* Fix _nc_timed_wait() on BEOS... */ +#define NCURSES_EVENT_VERSION 1 +#endif /* !defined(__BEOS__) */ + +/* + * Bits to set in _nc_event.data.flags + */ +#define _NC_EVENT_TIMEOUT_MSEC 1 +#define _NC_EVENT_FILE 2 +#define _NC_EVENT_FILE_READABLE 2 +#if 0 /* Not supported yet... */ +#define _NC_EVENT_FILE_WRITABLE 4 +#define _NC_EVENT_FILE_EXCEPTION 8 +#endif + +typedef struct { + int type; + union { + long timeout_msec; /* _NC_EVENT_TIMEOUT_MSEC */ + struct { + unsigned int flags; + int fd; + unsigned int result; + } fev; /* _NC_EVENT_FILE */ + } data; +} _nc_event; + +typedef struct { + int count; + int result_flags; /* _NC_EVENT_TIMEOUT_MSEC or _NC_EVENT_FILE_READABLE */ + _nc_event* events[1]; +} _nc_eventlist; + +extern NCURSES_EXPORT(int) + wgetch_events(WINDOW*, _nc_eventlist*); /* experimental */ +extern NCURSES_EXPORT(int) + wgetnstr_events(WINDOW*, char*, int, _nc_eventlist*); /* experimental */ + +#endif /* NCURSES_WGETCH_EVENTS */ +#endif /* NCURSES_EXT_FUNCS */ + +/* + * GCC (and some other compilers) define '__attribute__'; we're using this + * macro to alert the compiler to flag inconsistencies in printf/scanf-like + * function calls. Just in case '__attribute__' isn't defined, make a dummy. + * Old versions of G++ do not accept it anyway, at least not consistently with + * GCC. + */ +#if !(defined(__GNUC__) || defined(__GNUG__) || defined(__attribute__)) +#define __attribute__(p) /* nothing */ +#endif + +/* + * We cannot define these in ncurses_cfg.h, since they require parameters to be + * passed (that is non-portable). If you happen to be using gcc with warnings + * enabled, define + * GCC_PRINTF + * GCC_SCANF + * to improve checking of calls to printw(), etc. + */ +#ifndef GCC_PRINTFLIKE +#if defined(GCC_PRINTF) && !defined(printf) +#define GCC_PRINTFLIKE(fmt, var) __attribute__((format(printf, fmt, var))) +#else +#define GCC_PRINTFLIKE(fmt, var) /*nothing*/ +#endif +#endif + +#ifndef GCC_SCANFLIKE +#if defined(GCC_SCANF) && !defined(scanf) +#define GCC_SCANFLIKE(fmt, var) __attribute__((format(scanf, fmt, var))) +#else +#define GCC_SCANFLIKE(fmt, var) /*nothing*/ +#endif +#endif + +#ifndef GCC_NORETURN +#define GCC_NORETURN /* nothing */ +#endif + +#ifndef GCC_UNUSED +#define GCC_UNUSED /* nothing */ +#endif + +/* + * Curses uses a helper function. Define our type for this to simplify + * extending it for the sp-funcs feature. + */ +typedef int (*NCURSES_OUTC)(int); + +/* + * Function prototypes. This is the complete X/Open Curses list of required + * functions. Those marked `generated' will have sources generated from the + * macro definitions later in this file, in order to satisfy XPG4.2 + * requirements. + */ + +extern NCURSES_EXPORT(int) addch(const chtype); /* generated */ +extern NCURSES_EXPORT(int) addchnstr(const chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) addchstr(const chtype*); /* generated */ +extern NCURSES_EXPORT(int) addnstr(const char*, int); /* generated */ +extern NCURSES_EXPORT(int) addstr(const char*); /* generated */ +extern NCURSES_EXPORT(int) attroff(NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attron(NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attrset(NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) + attr_get(attr_t*, NCURSES_PAIRS_T*, void*); /* generated */ +extern NCURSES_EXPORT(int) attr_off(attr_t, void*); /* generated */ +extern NCURSES_EXPORT(int) attr_on(attr_t, void*); /* generated */ +extern NCURSES_EXPORT(int) + attr_set(attr_t, NCURSES_PAIRS_T, void*); /* generated */ +extern NCURSES_EXPORT(int) baudrate(void); /* implemented */ +extern NCURSES_EXPORT(int) beep(void); /* implemented */ +extern NCURSES_EXPORT(int) bkgd(chtype); /* generated */ +extern NCURSES_EXPORT(void) bkgdset(chtype); /* generated */ +extern NCURSES_EXPORT(int) border( + chtype, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype); /* generated */ +extern NCURSES_EXPORT(int) box(WINDOW*, chtype, chtype); /* generated */ +extern NCURSES_EXPORT(bool) can_change_color(void); /* implemented */ +extern NCURSES_EXPORT(int) cbreak(void); /* implemented */ +extern NCURSES_EXPORT(int) + chgat(int, attr_t, NCURSES_PAIRS_T, const void*); /* generated */ +extern NCURSES_EXPORT(int) clear(void); /* generated */ +extern NCURSES_EXPORT(int) clearok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) clrtobot(void); /* generated */ +extern NCURSES_EXPORT(int) clrtoeol(void); /* generated */ +extern NCURSES_EXPORT(int) color_content( + NCURSES_COLOR_T, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*); /* implemented */ +extern NCURSES_EXPORT(int) color_set(NCURSES_PAIRS_T, void*); /* generated */ +extern NCURSES_EXPORT(int) COLOR_PAIR(int); /* generated */ +extern NCURSES_EXPORT(int) copywin( + const WINDOW*, + WINDOW*, + int, + int, + int, + int, + int, + int, + int); /* implemented */ +extern NCURSES_EXPORT(int) curs_set(int); /* implemented */ +extern NCURSES_EXPORT(int) def_prog_mode(void); /* implemented */ +extern NCURSES_EXPORT(int) def_shell_mode(void); /* implemented */ +extern NCURSES_EXPORT(int) delay_output(int); /* implemented */ +extern NCURSES_EXPORT(int) delch(void); /* generated */ +extern NCURSES_EXPORT(void) delscreen(SCREEN*); /* implemented */ +extern NCURSES_EXPORT(int) delwin(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) deleteln(void); /* generated */ +extern NCURSES_EXPORT(WINDOW*) + derwin(WINDOW*, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) doupdate(void); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) dupwin(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) echo(void); /* implemented */ +extern NCURSES_EXPORT(int) echochar(const chtype); /* generated */ +extern NCURSES_EXPORT(int) erase(void); /* generated */ +extern NCURSES_EXPORT(int) endwin(void); /* implemented */ +extern NCURSES_EXPORT(char) erasechar(void); /* implemented */ +extern NCURSES_EXPORT(void) filter(void); /* implemented */ +extern NCURSES_EXPORT(int) flash(void); /* implemented */ +extern NCURSES_EXPORT(int) flushinp(void); /* implemented */ +extern NCURSES_EXPORT(chtype) getbkgd(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getch(void); /* generated */ +extern NCURSES_EXPORT(int) getnstr(char*, int); /* generated */ +extern NCURSES_EXPORT(int) getstr(char*); /* generated */ +extern NCURSES_EXPORT(WINDOW*) getwin(FILE*); /* implemented */ +extern NCURSES_EXPORT(int) halfdelay(int); /* implemented */ +extern NCURSES_EXPORT(bool) has_colors(void); /* implemented */ +extern NCURSES_EXPORT(bool) has_ic(void); /* implemented */ +extern NCURSES_EXPORT(bool) has_il(void); /* implemented */ +extern NCURSES_EXPORT(int) hline(chtype, int); /* generated */ +extern NCURSES_EXPORT(void) idcok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) idlok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(void) immedok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) inch(void); /* generated */ +extern NCURSES_EXPORT(int) inchnstr(chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) inchstr(chtype*); /* generated */ +extern NCURSES_EXPORT(WINDOW*) initscr(void); /* implemented */ +extern NCURSES_EXPORT(int) init_color( + NCURSES_COLOR_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T); /* implemented */ +extern NCURSES_EXPORT(int) init_pair( + NCURSES_PAIRS_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T); /* implemented */ +extern NCURSES_EXPORT(int) innstr(char*, int); /* generated */ +extern NCURSES_EXPORT(int) insch(chtype); /* generated */ +extern NCURSES_EXPORT(int) insdelln(int); /* generated */ +extern NCURSES_EXPORT(int) insertln(void); /* generated */ +extern NCURSES_EXPORT(int) insnstr(const char*, int); /* generated */ +extern NCURSES_EXPORT(int) insstr(const char*); /* generated */ +extern NCURSES_EXPORT(int) instr(char*); /* generated */ +extern NCURSES_EXPORT(int) intrflush(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(bool) isendwin(void); /* implemented */ +extern NCURSES_EXPORT(bool) is_linetouched(WINDOW*, int); /* implemented */ +extern NCURSES_EXPORT(bool) is_wintouched(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(NCURSES_CONST char*) keyname(int); /* implemented */ +extern NCURSES_EXPORT(int) keypad(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(char) killchar(void); /* implemented */ +extern NCURSES_EXPORT(int) leaveok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(char*) longname(void); /* implemented */ +extern NCURSES_EXPORT(int) meta(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) move(int, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddch(int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) + mvaddchnstr(int, int, const chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddchstr(int, int, const chtype*); /* generated */ +extern NCURSES_EXPORT(int) + mvaddnstr(int, int, const char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddstr(int, int, const char*); /* generated */ +extern NCURSES_EXPORT(int) + mvchgat(int, int, int, attr_t, NCURSES_PAIRS_T, const void*); /* generated + */ +extern NCURSES_EXPORT(int) mvcur(int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) mvdelch(int, int); /* generated */ +extern NCURSES_EXPORT(int) mvderwin(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(int) mvgetch(int, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetnstr(int, int, char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetstr(int, int, char*); /* generated */ +extern NCURSES_EXPORT(int) mvhline(int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(chtype) mvinch(int, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchnstr(int, int, chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchstr(int, int, chtype*); /* generated */ +extern NCURSES_EXPORT(int) mvinnstr(int, int, char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsch(int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) + mvinsnstr(int, int, const char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsstr(int, int, const char*); /* generated */ +extern NCURSES_EXPORT(int) mvinstr(int, int, char*); /* generated */ +extern NCURSES_EXPORT(int) + mvprintw(int, int, const char*, ...) /* implemented */ + GCC_PRINTFLIKE(3, 4); +extern NCURSES_EXPORT(int) + mvscanw(int, int, NCURSES_CONST char*, ...) /* implemented */ + GCC_SCANFLIKE(3, 4); +extern NCURSES_EXPORT(int) mvvline(int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddch(WINDOW*, int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddchnstr(WINDOW*, int, int, const chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddchstr(WINDOW*, int, int, const chtype*); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddnstr(WINDOW*, int, int, const char*, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddstr(WINDOW*, int, int, const char*); /* generated */ +extern NCURSES_EXPORT(int) mvwchgat( + WINDOW*, + int, + int, + int, + attr_t, + NCURSES_PAIRS_T, + const void*); /* generated */ +extern NCURSES_EXPORT(int) mvwdelch(WINDOW*, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetch(WINDOW*, int, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwgetnstr(WINDOW*, int, int, char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetstr(WINDOW*, int, int, char*); /* generated */ +extern NCURSES_EXPORT(int) + mvwhline(WINDOW*, int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvwin(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(chtype) mvwinch(WINDOW*, int, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwinchnstr(WINDOW*, int, int, chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwinchstr(WINDOW*, int, int, chtype*); /* generated */ +extern NCURSES_EXPORT(int) + mvwinnstr(WINDOW*, int, int, char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinsch(WINDOW*, int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) + mvwinsnstr(WINDOW*, int, int, const char*, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwinsstr(WINDOW*, int, int, const char*); /* generated */ +extern NCURSES_EXPORT(int) mvwinstr(WINDOW*, int, int, char*); /* generated */ +extern NCURSES_EXPORT(int) + mvwprintw(WINDOW*, int, int, const char*, ...) /* implemented */ + GCC_PRINTFLIKE(4, 5); +extern NCURSES_EXPORT(int) + mvwscanw(WINDOW*, int, int, NCURSES_CONST char*, ...) /* implemented */ + GCC_SCANFLIKE(4, 5); +extern NCURSES_EXPORT(int) + mvwvline(WINDOW*, int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) napms(int); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) newpad(int, int); /* implemented */ +extern NCURSES_EXPORT(SCREEN*) + newterm(NCURSES_CONST char*, FILE*, FILE*); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) newwin(int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) nl(void); /* implemented */ +extern NCURSES_EXPORT(int) nocbreak(void); /* implemented */ +extern NCURSES_EXPORT(int) nodelay(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) noecho(void); /* implemented */ +extern NCURSES_EXPORT(int) nonl(void); /* implemented */ +extern NCURSES_EXPORT(void) noqiflush(void); /* implemented */ +extern NCURSES_EXPORT(int) noraw(void); /* implemented */ +extern NCURSES_EXPORT(int) notimeout(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) overlay(const WINDOW*, WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) overwrite(const WINDOW*, WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) pair_content( + NCURSES_PAIRS_T, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*); /* implemented */ +extern NCURSES_EXPORT(int) PAIR_NUMBER(int); /* generated */ +extern NCURSES_EXPORT(int) pechochar(WINDOW*, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) + pnoutrefresh(WINDOW*, int, int, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) + prefresh(WINDOW*, int, int, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) printw(const char*, ...) /* implemented */ + GCC_PRINTFLIKE(1, 2); +extern NCURSES_EXPORT(int) putwin(WINDOW*, FILE*); /* implemented */ +extern NCURSES_EXPORT(void) qiflush(void); /* implemented */ +extern NCURSES_EXPORT(int) raw(void); /* implemented */ +extern NCURSES_EXPORT(int) redrawwin(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) refresh(void); /* generated */ +extern NCURSES_EXPORT(int) resetty(void); /* implemented */ +extern NCURSES_EXPORT(int) reset_prog_mode(void); /* implemented */ +extern NCURSES_EXPORT(int) reset_shell_mode(void); /* implemented */ +extern NCURSES_EXPORT(int) + ripoffline(int, int (*)(WINDOW*, int)); /* implemented */ +extern NCURSES_EXPORT(int) savetty(void); /* implemented */ +extern NCURSES_EXPORT(int) scanw(NCURSES_CONST char*, ...) /* implemented */ + GCC_SCANFLIKE(1, 2); +extern NCURSES_EXPORT(int) scr_dump(const char*); /* implemented */ +extern NCURSES_EXPORT(int) scr_init(const char*); /* implemented */ +extern NCURSES_EXPORT(int) scrl(int); /* generated */ +extern NCURSES_EXPORT(int) scroll(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) scrollok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) scr_restore(const char*); /* implemented */ +extern NCURSES_EXPORT(int) scr_set(const char*); /* implemented */ +extern NCURSES_EXPORT(int) setscrreg(int, int); /* generated */ +extern NCURSES_EXPORT(SCREEN*) set_term(SCREEN*); /* implemented */ +extern NCURSES_EXPORT(int) slk_attroff(const chtype); /* implemented */ +extern NCURSES_EXPORT(int) + slk_attr_off(const attr_t, void*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attron(const chtype); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_on(attr_t, void*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attrset(const chtype); /* implemented */ +extern NCURSES_EXPORT(attr_t) slk_attr(void); /* implemented */ +extern NCURSES_EXPORT(int) + slk_attr_set(const attr_t, NCURSES_PAIRS_T, void*); /* implemented */ +extern NCURSES_EXPORT(int) slk_clear(void); /* implemented */ +extern NCURSES_EXPORT(int) slk_color(NCURSES_PAIRS_T); /* implemented */ +extern NCURSES_EXPORT(int) slk_init(int); /* implemented */ +extern NCURSES_EXPORT(char*) slk_label(int); /* implemented */ +extern NCURSES_EXPORT(int) slk_noutrefresh(void); /* implemented */ +extern NCURSES_EXPORT(int) slk_refresh(void); /* implemented */ +extern NCURSES_EXPORT(int) slk_restore(void); /* implemented */ +extern NCURSES_EXPORT(int) slk_set(int, const char*, int); /* implemented */ +extern NCURSES_EXPORT(int) slk_touch(void); /* implemented */ +extern NCURSES_EXPORT(int) standout(void); /* generated */ +extern NCURSES_EXPORT(int) standend(void); /* generated */ +extern NCURSES_EXPORT(int) start_color(void); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) + subpad(WINDOW*, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) + subwin(WINDOW*, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) syncok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) termattrs(void); /* implemented */ +extern NCURSES_EXPORT(char*) termname(void); /* implemented */ +extern NCURSES_EXPORT(void) timeout(int); /* generated */ +extern NCURSES_EXPORT(int) touchline(WINDOW*, int, int); /* generated */ +extern NCURSES_EXPORT(int) touchwin(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) typeahead(int); /* implemented */ +extern NCURSES_EXPORT(int) ungetch(int); /* implemented */ +extern NCURSES_EXPORT(int) untouchwin(WINDOW*); /* generated */ +extern NCURSES_EXPORT(void) use_env(bool); /* implemented */ +extern NCURSES_EXPORT(void) use_tioctl(bool); /* implemented */ +extern NCURSES_EXPORT(int) vidattr(chtype); /* implemented */ +extern NCURSES_EXPORT(int) vidputs(chtype, NCURSES_OUTC); /* implemented */ +extern NCURSES_EXPORT(int) vline(chtype, int); /* generated */ +extern NCURSES_EXPORT(int) + vwprintw(WINDOW*, const char*, va_list); /* implemented */ +extern NCURSES_EXPORT(int) + vw_printw(WINDOW*, const char*, va_list); /* generated */ +extern NCURSES_EXPORT(int) + vwscanw(WINDOW*, NCURSES_CONST char*, va_list); /* implemented */ +extern NCURSES_EXPORT(int) + vw_scanw(WINDOW*, NCURSES_CONST char*, va_list); /* generated */ +extern NCURSES_EXPORT(int) waddch(WINDOW*, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) + waddchnstr(WINDOW*, const chtype*, int); /* implemented */ +extern NCURSES_EXPORT(int) waddchstr(WINDOW*, const chtype*); /* generated */ +extern NCURSES_EXPORT(int) + waddnstr(WINDOW*, const char*, int); /* implemented */ +extern NCURSES_EXPORT(int) waddstr(WINDOW*, const char*); /* generated */ +extern NCURSES_EXPORT(int) wattron(WINDOW*, int); /* generated */ +extern NCURSES_EXPORT(int) wattroff(WINDOW*, int); /* generated */ +extern NCURSES_EXPORT(int) wattrset(WINDOW*, int); /* generated */ +extern NCURSES_EXPORT(int) + wattr_get(WINDOW*, attr_t*, NCURSES_PAIRS_T*, void*); /* generated */ +extern NCURSES_EXPORT(int) wattr_on(WINDOW*, attr_t, void*); /* implemented */ +extern NCURSES_EXPORT(int) wattr_off(WINDOW*, attr_t, void*); /* implemented */ +extern NCURSES_EXPORT(int) + wattr_set(WINDOW*, attr_t, NCURSES_PAIRS_T, void*); /* generated */ +extern NCURSES_EXPORT(int) wbkgd(WINDOW*, chtype); /* implemented */ +extern NCURSES_EXPORT(void) wbkgdset(WINDOW*, chtype); /* implemented */ +extern NCURSES_EXPORT(int) wborder( + WINDOW*, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype); /* implemented */ +extern NCURSES_EXPORT(int) wchgat( + WINDOW*, + int, + attr_t, + NCURSES_PAIRS_T, + const void*); /* implemented */ +extern NCURSES_EXPORT(int) wclear(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wclrtobot(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wclrtoeol(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) + wcolor_set(WINDOW*, NCURSES_PAIRS_T, void*); /* implemented */ +extern NCURSES_EXPORT(void) wcursyncup(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wdelch(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wdeleteln(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) wechochar(WINDOW*, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) werase(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wgetch(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wgetnstr(WINDOW*, char*, int); /* implemented */ +extern NCURSES_EXPORT(int) wgetstr(WINDOW*, char*); /* generated */ +extern NCURSES_EXPORT(int) whline(WINDOW*, chtype, int); /* implemented */ +extern NCURSES_EXPORT(chtype) winch(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) winchnstr(WINDOW*, chtype*, int); /* implemented */ +extern NCURSES_EXPORT(int) winchstr(WINDOW*, chtype*); /* generated */ +extern NCURSES_EXPORT(int) winnstr(WINDOW*, char*, int); /* implemented */ +extern NCURSES_EXPORT(int) winsch(WINDOW*, chtype); /* implemented */ +extern NCURSES_EXPORT(int) winsdelln(WINDOW*, int); /* implemented */ +extern NCURSES_EXPORT(int) winsertln(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) + winsnstr(WINDOW*, const char*, int); /* implemented */ +extern NCURSES_EXPORT(int) winsstr(WINDOW*, const char*); /* generated */ +extern NCURSES_EXPORT(int) winstr(WINDOW*, char*); /* generated */ +extern NCURSES_EXPORT(int) wmove(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(int) wnoutrefresh(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wprintw(WINDOW*, const char*, ...) /* implemented */ + GCC_PRINTFLIKE(2, 3); +extern NCURSES_EXPORT(int) wredrawln(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(int) wrefresh(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) + wscanw(WINDOW*, NCURSES_CONST char*, ...) /* implemented */ + GCC_SCANFLIKE(2, 3); +extern NCURSES_EXPORT(int) wscrl(WINDOW*, int); /* implemented */ +extern NCURSES_EXPORT(int) wsetscrreg(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(int) wstandout(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) wstandend(WINDOW*); /* generated */ +extern NCURSES_EXPORT(void) wsyncdown(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(void) wsyncup(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(void) wtimeout(WINDOW*, int); /* implemented */ +extern NCURSES_EXPORT(int) wtouchln(WINDOW*, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) wvline(WINDOW*, chtype, int); /* implemented */ + +/* + * These are also declared in : + */ +extern NCURSES_EXPORT(int) tigetflag(NCURSES_CONST char*); /* implemented */ +extern NCURSES_EXPORT(int) tigetnum(NCURSES_CONST char*); /* implemented */ +extern NCURSES_EXPORT(char*) tigetstr(NCURSES_CONST char*); /* implemented */ +extern NCURSES_EXPORT(int) putp(const char*); /* implemented */ + +#if NCURSES_TPARM_VARARGS +extern NCURSES_EXPORT(char*) tparm(NCURSES_CONST char*, ...); /* special */ +#else +extern NCURSES_EXPORT(char*) tparm( + NCURSES_CONST char*, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG); /* special */ +extern NCURSES_EXPORT(char*) + tparm_varargs(NCURSES_CONST char*, ...); /* special */ +#endif + +extern NCURSES_EXPORT(char*) tiparm(const char*, ...); /* special */ + +/* + * X/Open says this returns a bool; SVr4 also checked for out-of-range line. + * The macro provides compatibility: + */ +#define is_linetouched(w, l) \ + ((!(w) || ((l) > getmaxy(w)) || ((l) < 0)) ? ERR : (is_linetouched)((w), (l))) + +/* + * These functions are not in X/Open, but we use them in macro definitions: + */ +extern NCURSES_EXPORT(int) getattrs(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getcurx(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getcury(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getbegx(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getbegy(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getmaxx(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getmaxy(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getparx(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getpary(const WINDOW*); /* generated */ + +/* + * vid_attr() was implemented originally based on a draft of X/Open curses. + */ +#if !NCURSES_WIDECHAR +#define vid_attr(a, pair, opts) vidattr(a) +#endif + +/* + * These functions are extensions - not in X/Open Curses. + */ +#if 1 +#undef NCURSES_EXT_FUNCS +#define NCURSES_EXT_FUNCS 20180127 +typedef int (*NCURSES_WINDOW_CB)(WINDOW*, void*); +typedef int (*NCURSES_SCREEN_CB)(SCREEN*, void*); +extern NCURSES_EXPORT(bool) is_term_resized(int, int); +extern NCURSES_EXPORT(char*) keybound(int, int); +extern NCURSES_EXPORT(const char*) curses_version(void); +extern NCURSES_EXPORT(int) alloc_pair(int, int); +extern NCURSES_EXPORT(int) assume_default_colors(int, int); +extern NCURSES_EXPORT(int) define_key(const char*, int); +extern NCURSES_EXPORT(int) extended_color_content(int, int*, int*, int*); +extern NCURSES_EXPORT(int) extended_pair_content(int, int*, int*); +extern NCURSES_EXPORT(int) extended_slk_color(int); +extern NCURSES_EXPORT(int) find_pair(int, int); +extern NCURSES_EXPORT(int) free_pair(int); +extern NCURSES_EXPORT(int) get_escdelay(void); +extern NCURSES_EXPORT(int) init_extended_color(int, int, int, int); +extern NCURSES_EXPORT(int) init_extended_pair(int, int, int); +extern NCURSES_EXPORT(int) key_defined(const char*); +extern NCURSES_EXPORT(int) keyok(int, bool); +extern NCURSES_EXPORT(void) reset_color_pairs(void); +extern NCURSES_EXPORT(int) resize_term(int, int); +extern NCURSES_EXPORT(int) resizeterm(int, int); +extern NCURSES_EXPORT(int) set_escdelay(int); +extern NCURSES_EXPORT(int) set_tabsize(int); +extern NCURSES_EXPORT(int) use_default_colors(void); +extern NCURSES_EXPORT(int) use_extended_names(bool); +extern NCURSES_EXPORT(int) use_legacy_coding(int); +extern NCURSES_EXPORT(int) use_screen(SCREEN*, NCURSES_SCREEN_CB, void*); +extern NCURSES_EXPORT(int) use_window(WINDOW*, NCURSES_WINDOW_CB, void*); +extern NCURSES_EXPORT(int) wresize(WINDOW*, int, int); +extern NCURSES_EXPORT(void) nofilter(void); + +/* + * These extensions provide access to information stored in the WINDOW even + * when NCURSES_OPAQUE is set: + */ +extern NCURSES_EXPORT(WINDOW*) wgetparent(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_cleared(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_idcok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_idlok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_immedok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_keypad(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_leaveok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_nodelay(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_notimeout(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_pad(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_scrollok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_subwin(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_syncok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) wgetdelay(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) + wgetscrreg(const WINDOW*, int*, int*); /* generated */ + +#else +#define curses_version() NCURSES_VERSION +#endif + +/* + * Extra extension-functions, which pass a SCREEN pointer rather than using + * a global variable SP. + */ +#if 1 +#undef NCURSES_SP_FUNCS +#define NCURSES_SP_FUNCS 20180127 +#define NCURSES_SP_NAME(name) name##_sp + +/* Define the sp-funcs helper function */ +#define NCURSES_SP_OUTC NCURSES_SP_NAME(NCURSES_OUTC) +typedef int (*NCURSES_SP_OUTC)(SCREEN*, int); + +extern NCURSES_EXPORT(SCREEN*) new_prescr(void); /* implemented:SP_FUNC */ + +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(baudrate)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(beep)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(can_change_color)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(cbreak)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(curs_set)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(color_content)( + SCREEN*, + NCURSES_PAIRS_T, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(def_prog_mode)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(def_shell_mode)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(delay_output)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(doupdate)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(echo)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(endwin)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char) + NCURSES_SP_NAME(erasechar)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(filter)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(flash)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(flushinp)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW*) + NCURSES_SP_NAME(getwin)(SCREEN*, FILE*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(halfdelay)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(has_colors)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(has_ic)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(has_il)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_color)( + SCREEN*, + NCURSES_COLOR_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_pair)( + SCREEN*, + NCURSES_PAIRS_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + intrflush)(SCREEN*, WINDOW*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(isendwin)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(NCURSES_CONST char*) + NCURSES_SP_NAME(keyname)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char) + NCURSES_SP_NAME(killchar)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(longname)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + mvcur)(SCREEN*, int, int, int, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(napms)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW*) + NCURSES_SP_NAME(newpad)(SCREEN*, int, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(SCREEN*) NCURSES_SP_NAME(newterm)( + SCREEN*, + NCURSES_CONST char*, + FILE*, + FILE*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW*) NCURSES_SP_NAME( + newwin)(SCREEN*, int, int, int, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(nl)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(nocbreak)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(noecho)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(nonl)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(noqiflush)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(noraw)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(pair_content)( + SCREEN*, + NCURSES_PAIRS_T, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(qiflush)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(raw)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(reset_prog_mode)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(reset_shell_mode)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(resetty)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + ripoffline)(SCREEN*, int, int (*)(WINDOW*, int)); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(savetty)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(scr_init)(SCREEN*, const char*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + scr_restore)(SCREEN*, const char*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(scr_set)(SCREEN*, const char*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_attroff)(SCREEN*, const chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_attron)(SCREEN*, const chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_attrset)(SCREEN*, const chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(attr_t) + NCURSES_SP_NAME(slk_attr)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attr_set)( + SCREEN*, + const attr_t, + NCURSES_PAIRS_T, + void*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_clear)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_color)(SCREEN*, NCURSES_PAIRS_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_init)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(slk_label)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_noutrefresh)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_refresh)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_restore)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_set)(SCREEN*, int, const char*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_touch)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(start_color)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(chtype) + NCURSES_SP_NAME(termattrs)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(termname)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(typeahead)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(ungetch)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(use_env)(SCREEN*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(use_tioctl)(SCREEN*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(vidattr)(SCREEN*, chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + vidputs)(SCREEN*, chtype, NCURSES_SP_OUTC); /* implemented:SP_FUNC */ +#if 1 +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(keybound)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + alloc_pair)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + assume_default_colors)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + define_key)(SCREEN*, const char*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_color_content)( + SCREEN*, + int, + int*, + int*, + int*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_pair_content)( + SCREEN*, + int, + int*, + int*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + extended_slk_color)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(get_escdelay)(SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(find_pair)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(free_pair)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_extended_color)( + SCREEN*, + int, + int, + int, + int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + init_extended_pair)(SCREEN*, int, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME( + is_term_resized)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + key_defined)(SCREEN*, const char*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(keyok)(SCREEN*, int, bool); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(nofilter)(SCREEN*); + /* implemented */ /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(reset_color_pairs)(SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + resize_term)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + resizeterm)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(set_escdelay)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(set_tabsize)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(use_default_colors)(SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + use_legacy_coding)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +#endif +#else +#undef NCURSES_SP_FUNCS +#define NCURSES_SP_FUNCS 0 +#define NCURSES_SP_NAME(name) name +#define NCURSES_SP_OUTC NCURSES_OUTC +#endif + +/* attributes */ + +#define NCURSES_ATTR_SHIFT 8 +#define NCURSES_BITS(mask, shift) \ + (NCURSES_CAST(chtype, (mask)) << ((shift) + NCURSES_ATTR_SHIFT)) + +#define A_NORMAL (1U - 1U) +#define A_ATTRIBUTES NCURSES_BITS(~(1U - 1U), 0) +#define A_CHARTEXT (NCURSES_BITS(1U, 0) - 1U) +#define A_COLOR NCURSES_BITS(((1U) << 8) - 1U, 0) +#define A_STANDOUT NCURSES_BITS(1U, 8) +#define A_UNDERLINE NCURSES_BITS(1U, 9) +#define A_REVERSE NCURSES_BITS(1U, 10) +#define A_BLINK NCURSES_BITS(1U, 11) +#define A_DIM NCURSES_BITS(1U, 12) +#define A_BOLD NCURSES_BITS(1U, 13) +#define A_ALTCHARSET NCURSES_BITS(1U, 14) +#define A_INVIS NCURSES_BITS(1U, 15) +#define A_PROTECT NCURSES_BITS(1U, 16) +#define A_HORIZONTAL NCURSES_BITS(1U, 17) +#define A_LEFT NCURSES_BITS(1U, 18) +#define A_LOW NCURSES_BITS(1U, 19) +#define A_RIGHT NCURSES_BITS(1U, 20) +#define A_TOP NCURSES_BITS(1U, 21) +#define A_VERTICAL NCURSES_BITS(1U, 22) + +#if 1 +#define A_ITALIC NCURSES_BITS(1U, 23) /* ncurses extension */ +#endif + +/* + * Most of the pseudo functions are macros that either provide compatibility + * with older versions of curses, or provide inline functionality to improve + * performance. + */ + +/* + * These pseudo functions are always implemented as macros: + */ + +#define getyx(win, y, x) (y = getcury(win), x = getcurx(win)) +#define getbegyx(win, y, x) (y = getbegy(win), x = getbegx(win)) +#define getmaxyx(win, y, x) (y = getmaxy(win), x = getmaxx(win)) +#define getparyx(win, y, x) (y = getpary(win), x = getparx(win)) + +#define getsyx(y, x) \ + do { \ + if (newscr) { \ + if (is_leaveok(newscr)) \ + (y) = (x) = -1; \ + else \ + getyx(newscr, (y), (x)); \ + } \ + } while (0) + +#define setsyx(y, x) \ + do { \ + if (newscr) { \ + if ((y) == -1 && (x) == -1) \ + leaveok(newscr, TRUE); \ + else { \ + leaveok(newscr, FALSE); \ + wmove(newscr, (y), (x)); \ + } \ + } \ + } while (0) + +#ifndef NCURSES_NOMACROS + +/* + * These miscellaneous pseudo functions are provided for compatibility: + */ + +#define wgetstr(w, s) wgetnstr(w, s, -1) +#define getnstr(s, n) wgetnstr(stdscr, s, (n)) + +#define setterm(term) setupterm(term, 1, (int*)0) + +#define fixterm() reset_prog_mode() +#define resetterm() reset_shell_mode() +#define saveterm() def_prog_mode() +#define crmode() cbreak() +#define nocrmode() nocbreak() +#define gettmode() + +/* It seems older SYSV curses versions define these */ +#if !NCURSES_OPAQUE +#define getattrs(win) \ + NCURSES_CAST(int, NCURSES_OK_ADDR(win) ? (win)->_attrs : A_NORMAL) +#define getcurx(win) (NCURSES_OK_ADDR(win) ? (win)->_curx : ERR) +#define getcury(win) (NCURSES_OK_ADDR(win) ? (win)->_cury : ERR) +#define getbegx(win) (NCURSES_OK_ADDR(win) ? (win)->_begx : ERR) +#define getbegy(win) (NCURSES_OK_ADDR(win) ? (win)->_begy : ERR) +#define getmaxx(win) (NCURSES_OK_ADDR(win) ? ((win)->_maxx + 1) : ERR) +#define getmaxy(win) (NCURSES_OK_ADDR(win) ? ((win)->_maxy + 1) : ERR) +#define getparx(win) (NCURSES_OK_ADDR(win) ? (win)->_parx : ERR) +#define getpary(win) (NCURSES_OK_ADDR(win) ? (win)->_pary : ERR) +#endif /* NCURSES_OPAQUE */ + +#define wstandout(win) (wattrset(win, A_STANDOUT)) +#define wstandend(win) (wattrset(win, A_NORMAL)) + +#define wattron(win, at) wattr_on(win, NCURSES_CAST(attr_t, at), NULL) +#define wattroff(win, at) wattr_off(win, NCURSES_CAST(attr_t, at), NULL) + +#if !NCURSES_OPAQUE +#if NCURSES_WATTR_MACROS +#if NCURSES_WIDECHAR && 1 +#define wattrset(win, at) \ + (NCURSES_OK_ADDR(win) ? ((win)->_color = NCURSES_CAST(int, PAIR_NUMBER(at)), \ + (win)->_attrs = NCURSES_CAST(attr_t, at), \ + OK) \ + : ERR) +#else +#define wattrset(win, at) \ + (NCURSES_OK_ADDR(win) ? ((win)->_attrs = NCURSES_CAST(attr_t, at), OK) : ERR) +#endif +#endif /* NCURSES_WATTR_MACROS */ +#endif /* NCURSES_OPAQUE */ + +#define scroll(win) wscrl(win, 1) + +#define touchwin(win) wtouchln((win), 0, getmaxy(win), 1) +#define touchline(win, s, c) wtouchln((win), s, c, 1) +#define untouchwin(win) wtouchln((win), 0, getmaxy(win), 0) + +#define box(win, v, h) wborder(win, v, v, h, h, 0, 0, 0, 0) +#define border(ls, rs, ts, bs, tl, tr, bl, br) \ + wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br) +#define hline(ch, n) whline(stdscr, ch, (n)) +#define vline(ch, n) wvline(stdscr, ch, (n)) + +#define winstr(w, s) winnstr(w, s, -1) +#define winchstr(w, s) winchnstr(w, s, -1) +#define winsstr(w, s) winsnstr(w, s, -1) + +#if !NCURSES_OPAQUE +#define redrawwin(win) \ + wredrawln(win, 0, (NCURSES_OK_ADDR(win) ? (win)->_maxy + 1 : -1)) +#endif /* NCURSES_OPAQUE */ + +#define waddstr(win, str) waddnstr(win, str, -1) +#define waddchstr(win, str) waddchnstr(win, str, -1) + +/* + * These apply to the first 256 color pairs. + */ +#define COLOR_PAIR(n) (NCURSES_BITS((n), 0) & A_COLOR) +#define PAIR_NUMBER(a) \ + (NCURSES_CAST( \ + int, \ + ((NCURSES_CAST(unsigned long, (a)) & A_COLOR) >> NCURSES_ATTR_SHIFT))) + +/* + * pseudo functions for standard screen + */ + +#define addch(ch) waddch(stdscr, (ch)) +#define addchnstr(str, n) waddchnstr(stdscr, (str), (n)) +#define addchstr(str) waddchstr(stdscr, (str)) +#define addnstr(str, n) waddnstr(stdscr, (str), (n)) +#define addstr(str) waddnstr(stdscr, (str), -1) +#define attr_get(ap, cp, o) wattr_get(stdscr, (ap), (cp), (o)) +#define attr_off(a, o) wattr_off(stdscr, (a), (o)) +#define attr_on(a, o) wattr_on(stdscr, (a), (o)) +#define attr_set(a, c, o) wattr_set(stdscr, (a), (c), (o)) +#define attroff(at) wattroff(stdscr, (at)) +#define attron(at) wattron(stdscr, (at)) +#define attrset(at) wattrset(stdscr, (at)) +#define bkgd(ch) wbkgd(stdscr, (ch)) +#define bkgdset(ch) wbkgdset(stdscr, (ch)) +#define chgat(n, a, c, o) wchgat(stdscr, (n), (a), (c), (o)) +#define clear() wclear(stdscr) +#define clrtobot() wclrtobot(stdscr) +#define clrtoeol() wclrtoeol(stdscr) +#define color_set(c, o) wcolor_set(stdscr, (c), (o)) +#define delch() wdelch(stdscr) +#define deleteln() winsdelln(stdscr, -1) +#define echochar(c) wechochar(stdscr, (c)) +#define erase() werase(stdscr) +#define getch() wgetch(stdscr) +#define getstr(str) wgetstr(stdscr, (str)) +#define inch() winch(stdscr) +#define inchnstr(s, n) winchnstr(stdscr, (s), (n)) +#define inchstr(s) winchstr(stdscr, (s)) +#define innstr(s, n) winnstr(stdscr, (s), (n)) +#define insch(c) winsch(stdscr, (c)) +#define insdelln(n) winsdelln(stdscr, (n)) +#define insertln() winsdelln(stdscr, 1) +#define insnstr(s, n) winsnstr(stdscr, (s), (n)) +#define insstr(s) winsstr(stdscr, (s)) +#define instr(s) winstr(stdscr, (s)) +#define move(y, x) wmove(stdscr, (y), (x)) +#define refresh() wrefresh(stdscr) +#define scrl(n) wscrl(stdscr, (n)) +#define setscrreg(t, b) wsetscrreg(stdscr, (t), (b)) +#define standend() wstandend(stdscr) +#define standout() wstandout(stdscr) +#define timeout(delay) wtimeout(stdscr, (delay)) +#define wdeleteln(win) winsdelln(win, -1) +#define winsertln(win) winsdelln(win, 1) + +/* + * mv functions + */ + +#define mvwaddch(win, y, x, ch) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddch((win), (ch))) +#define mvwaddchnstr(win, y, x, str, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddchnstr((win), (str), (n))) +#define mvwaddchstr(win, y, x, str) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddchnstr((win), (str), -1)) +#define mvwaddnstr(win, y, x, str, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddnstr((win), (str), (n))) +#define mvwaddstr(win, y, x, str) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddnstr((win), (str), -1)) +#define mvwchgat(win, y, x, n, a, c, o) \ + (wmove((win), (y), (x)) == ERR ? ERR : wchgat((win), (n), (a), (c), (o))) +#define mvwdelch(win, y, x) (wmove((win), (y), (x)) == ERR ? ERR : wdelch(win)) +#define mvwgetch(win, y, x) (wmove((win), (y), (x)) == ERR ? ERR : wgetch(win)) +#define mvwgetnstr(win, y, x, str, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : wgetnstr((win), (str), (n))) +#define mvwgetstr(win, y, x, str) \ + (wmove((win), (y), (x)) == ERR ? ERR : wgetstr((win), (str))) +#define mvwhline(win, y, x, c, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : whline((win), (c), (n))) +#define mvwinch(win, y, x) \ + (wmove((win), (y), (x)) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win)) +#define mvwinchnstr(win, y, x, s, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : winchnstr((win), (s), (n))) +#define mvwinchstr(win, y, x, s) \ + (wmove((win), (y), (x)) == ERR ? ERR : winchstr((win), (s))) +#define mvwinnstr(win, y, x, s, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : winnstr((win), (s), (n))) +#define mvwinsch(win, y, x, c) \ + (wmove((win), (y), (x)) == ERR ? ERR : winsch((win), (c))) +#define mvwinsnstr(win, y, x, s, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : winsnstr((win), (s), (n))) +#define mvwinsstr(win, y, x, s) \ + (wmove((win), (y), (x)) == ERR ? ERR : winsstr((win), (s))) +#define mvwinstr(win, y, x, s) \ + (wmove((win), (y), (x)) == ERR ? ERR : winstr((win), (s))) +#define mvwvline(win, y, x, c, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : wvline((win), (c), (n))) + +#define mvaddch(y, x, ch) mvwaddch(stdscr, (y), (x), (ch)) +#define mvaddchnstr(y, x, str, n) mvwaddchnstr(stdscr, (y), (x), (str), (n)) +#define mvaddchstr(y, x, str) mvwaddchstr(stdscr, (y), (x), (str)) +#define mvaddnstr(y, x, str, n) mvwaddnstr(stdscr, (y), (x), (str), (n)) +#define mvaddstr(y, x, str) mvwaddstr(stdscr, (y), (x), (str)) +#define mvchgat(y, x, n, a, c, o) mvwchgat(stdscr, (y), (x), (n), (a), (c), (o)) +#define mvdelch(y, x) mvwdelch(stdscr, (y), (x)) +#define mvgetch(y, x) mvwgetch(stdscr, (y), (x)) +#define mvgetnstr(y, x, str, n) mvwgetnstr(stdscr, (y), (x), (str), (n)) +#define mvgetstr(y, x, str) mvwgetstr(stdscr, (y), (x), (str)) +#define mvhline(y, x, c, n) mvwhline(stdscr, (y), (x), (c), (n)) +#define mvinch(y, x) mvwinch(stdscr, (y), (x)) +#define mvinchnstr(y, x, s, n) mvwinchnstr(stdscr, (y), (x), (s), (n)) +#define mvinchstr(y, x, s) mvwinchstr(stdscr, (y), (x), (s)) +#define mvinnstr(y, x, s, n) mvwinnstr(stdscr, (y), (x), (s), (n)) +#define mvinsch(y, x, c) mvwinsch(stdscr, (y), (x), (c)) +#define mvinsnstr(y, x, s, n) mvwinsnstr(stdscr, (y), (x), (s), (n)) +#define mvinsstr(y, x, s) mvwinsstr(stdscr, (y), (x), (s)) +#define mvinstr(y, x, s) mvwinstr(stdscr, (y), (x), (s)) +#define mvvline(y, x, c, n) mvwvline(stdscr, (y), (x), (c), (n)) + +/* + * Some wide-character functions can be implemented without the extensions. + */ +#if !NCURSES_OPAQUE +#define getbkgd(win) (NCURSES_OK_ADDR(win) ? ((win)->_bkgd) : 0) +#endif /* NCURSES_OPAQUE */ + +#define slk_attr_off(a, v) ((v) ? ERR : slk_attroff(a)) +#define slk_attr_on(a, v) ((v) ? ERR : slk_attron(a)) + +#if !NCURSES_OPAQUE +#if NCURSES_WATTR_MACROS +#if NCURSES_WIDECHAR && 1 +#define wattr_set(win, a, p, opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)((win)->_attrs = ((a) & ~A_COLOR), (win)->_color = (opts) ? *(int*)(opts) : (p)), \ + OK) \ + : ERR) +#define wattr_get(win, a, p, opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)(NCURSES_OK_ADDR(a) ? (*(a) = (win)->_attrs) : OK), \ + (void)(NCURSES_OK_ADDR(p) ? (*(p) = (NCURSES_PAIRS_T)(win)->_color) : OK), \ + (void)(NCURSES_OK_ADDR(opts) ? (*(int*)(opts) = (win)->_color) : OK), \ + OK) \ + : ERR) +#else /* !(NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */ +#define wattr_set(win, a, p, opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)((win)->_attrs = (((a) & ~A_COLOR) | (attr_t)COLOR_PAIR(p))), \ + OK) \ + : ERR) +#define wattr_get(win, a, p, opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)(NCURSES_OK_ADDR(a) ? (*(a) = (win)->_attrs) : OK), \ + (void)(NCURSES_OK_ADDR(p) ? (*(p) = (NCURSES_PAIRS_T)PAIR_NUMBER((win)->_attrs)) : OK), \ + OK) \ + : ERR) +#endif /* (NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */ +#endif /* NCURSES_WATTR_MACROS */ +#endif /* NCURSES_OPAQUE */ + +/* + * X/Open curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use + * varargs.h. It adds new calls vw_printw/vw_scanw, which are supposed to + * use POSIX stdarg.h. The ncurses versions of vwprintw/vwscanw already + * use stdarg.h, so... + */ +#define vw_printw vwprintw +#define vw_scanw vwscanw + +/* + * Export fallback function for use in C++ binding. + */ +#if !1 +#define vsscanf(a, b, c) _nc_vsscanf(a, b, c) +NCURSES_EXPORT(int) vsscanf(const char*, const char*, va_list); +#endif + +/* + * These macros are extensions - not in X/Open Curses. + */ +#if 1 +#if !NCURSES_OPAQUE +#define is_cleared(win) (NCURSES_OK_ADDR(win) ? (win)->_clear : FALSE) +#define is_idcok(win) (NCURSES_OK_ADDR(win) ? (win)->_idcok : FALSE) +#define is_idlok(win) (NCURSES_OK_ADDR(win) ? (win)->_idlok : FALSE) +#define is_immedok(win) (NCURSES_OK_ADDR(win) ? (win)->_immed : FALSE) +#define is_keypad(win) (NCURSES_OK_ADDR(win) ? (win)->_use_keypad : FALSE) +#define is_leaveok(win) (NCURSES_OK_ADDR(win) ? (win)->_leaveok : FALSE) +#define is_nodelay(win) (NCURSES_OK_ADDR(win) ? ((win)->_delay == 0) : FALSE) +#define is_notimeout(win) (NCURSES_OK_ADDR(win) ? (win)->_notimeout : FALSE) +#define is_pad(win) \ + (NCURSES_OK_ADDR(win) ? ((win)->_flags & _ISPAD) != 0 : FALSE) +#define is_scrollok(win) (NCURSES_OK_ADDR(win) ? (win)->_scroll : FALSE) +#define is_subwin(win) \ + (NCURSES_OK_ADDR(win) ? ((win)->_flags & _SUBWIN) != 0 : FALSE) +#define is_syncok(win) (NCURSES_OK_ADDR(win) ? (win)->_sync : FALSE) +#define wgetdelay(win) (NCURSES_OK_ADDR(win) ? (win)->_delay : 0) +#define wgetparent(win) (NCURSES_OK_ADDR(win) ? (win)->_parent : 0) +#define wgetscrreg(win, t, b) \ + (NCURSES_OK_ADDR(win) \ + ? (*(t) = (win)->_regtop, *(b) = (win)->_regbottom, OK) \ + : ERR) +#endif +#endif + +#endif /* NCURSES_NOMACROS */ + +/* + * Public variables. + * + * Notes: + * a. ESCDELAY was an undocumented feature under AIX curses. + * It gives the ESC expire time in milliseconds. + * b. ttytype is needed for backward compatibility + */ +#if NCURSES_REENTRANT + +NCURSES_WRAPPED_VAR(WINDOW*, curscr); +NCURSES_WRAPPED_VAR(WINDOW*, newscr); +NCURSES_WRAPPED_VAR(WINDOW*, stdscr); +NCURSES_WRAPPED_VAR(char*, ttytype); +NCURSES_WRAPPED_VAR(int, COLORS); +NCURSES_WRAPPED_VAR(int, COLOR_PAIRS); +NCURSES_WRAPPED_VAR(int, COLS); +NCURSES_WRAPPED_VAR(int, ESCDELAY); +NCURSES_WRAPPED_VAR(int, LINES); +NCURSES_WRAPPED_VAR(int, TABSIZE); + +#define curscr NCURSES_PUBLIC_VAR(curscr()) +#define newscr NCURSES_PUBLIC_VAR(newscr()) +#define stdscr NCURSES_PUBLIC_VAR(stdscr()) +#define ttytype NCURSES_PUBLIC_VAR(ttytype()) +#define COLORS NCURSES_PUBLIC_VAR(COLORS()) +#define COLOR_PAIRS NCURSES_PUBLIC_VAR(COLOR_PAIRS()) +#define COLS NCURSES_PUBLIC_VAR(COLS()) +#define ESCDELAY NCURSES_PUBLIC_VAR(ESCDELAY()) +#define LINES NCURSES_PUBLIC_VAR(LINES()) +#define TABSIZE NCURSES_PUBLIC_VAR(TABSIZE()) + +#else + +extern NCURSES_EXPORT_VAR(WINDOW*) curscr; +extern NCURSES_EXPORT_VAR(WINDOW*) newscr; +extern NCURSES_EXPORT_VAR(WINDOW*) stdscr; +extern NCURSES_EXPORT_VAR(char) ttytype[]; +extern NCURSES_EXPORT_VAR(int) COLORS; +extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS; +extern NCURSES_EXPORT_VAR(int) COLS; +extern NCURSES_EXPORT_VAR(int) ESCDELAY; +extern NCURSES_EXPORT_VAR(int) LINES; +extern NCURSES_EXPORT_VAR(int) TABSIZE; + +#endif + +/* + * Pseudo-character tokens outside ASCII range. The curses wgetch() function + * will return any given one of these only if the corresponding k- capability + * is defined in your terminal's terminfo entry. + * + * Some keys (KEY_A1, etc) are arranged like this: + * a1 up a3 + * left b2 right + * c1 down c3 + * + * A few key codes do not depend upon the terminfo entry. + */ +#define KEY_CODE_YES 0400 /* A wchar_t contains a key code */ +#define KEY_MIN 0401 /* Minimum curses key */ +#define KEY_BREAK 0401 /* Break key (unreliable) */ +#define KEY_SRESET 0530 /* Soft (partial) reset (unreliable) */ +#define KEY_RESET 0531 /* Reset or hard reset (unreliable) */ +/* + * These definitions were generated by ./MKkey_defs.sh ./Caps + */ +#define KEY_DOWN 0402 /* down-arrow key */ +#define KEY_UP 0403 /* up-arrow key */ +#define KEY_LEFT 0404 /* left-arrow key */ +#define KEY_RIGHT 0405 /* right-arrow key */ +#define KEY_HOME 0406 /* home key */ +#define KEY_BACKSPACE 0407 /* backspace key */ +#define KEY_F0 0410 /* Function keys. Space for 64 */ +#define KEY_F(n) (KEY_F0 + (n)) /* Value of function key n */ +#define KEY_DL 0510 /* delete-line key */ +#define KEY_IL 0511 /* insert-line key */ +#define KEY_DC 0512 /* delete-character key */ +#define KEY_IC 0513 /* insert-character key */ +#define KEY_EIC 0514 /* sent by rmir or smir in insert mode */ +#define KEY_CLEAR 0515 /* clear-screen or erase key */ +#define KEY_EOS 0516 /* clear-to-end-of-screen key */ +#define KEY_EOL 0517 /* clear-to-end-of-line key */ +#define KEY_SF 0520 /* scroll-forward key */ +#define KEY_SR 0521 /* scroll-backward key */ +#define KEY_NPAGE 0522 /* next-page key */ +#define KEY_PPAGE 0523 /* previous-page key */ +#define KEY_STAB 0524 /* set-tab key */ +#define KEY_CTAB 0525 /* clear-tab key */ +#define KEY_CATAB 0526 /* clear-all-tabs key */ +#define KEY_ENTER 0527 /* enter/send key */ +#define KEY_PRINT 0532 /* print key */ +#define KEY_LL 0533 /* lower-left key (home down) */ +#define KEY_A1 0534 /* upper left of keypad */ +#define KEY_A3 0535 /* upper right of keypad */ +#define KEY_B2 0536 /* center of keypad */ +#define KEY_C1 0537 /* lower left of keypad */ +#define KEY_C3 0540 /* lower right of keypad */ +#define KEY_BTAB 0541 /* back-tab key */ +#define KEY_BEG 0542 /* begin key */ +#define KEY_CANCEL 0543 /* cancel key */ +#define KEY_CLOSE 0544 /* close key */ +#define KEY_COMMAND 0545 /* command key */ +#define KEY_COPY 0546 /* copy key */ +#define KEY_CREATE 0547 /* create key */ +#define KEY_END 0550 /* end key */ +#define KEY_EXIT 0551 /* exit key */ +#define KEY_FIND 0552 /* find key */ +#define KEY_HELP 0553 /* help key */ +#define KEY_MARK 0554 /* mark key */ +#define KEY_MESSAGE 0555 /* message key */ +#define KEY_MOVE 0556 /* move key */ +#define KEY_NEXT 0557 /* next key */ +#define KEY_OPEN 0560 /* open key */ +#define KEY_OPTIONS 0561 /* options key */ +#define KEY_PREVIOUS 0562 /* previous key */ +#define KEY_REDO 0563 /* redo key */ +#define KEY_REFERENCE 0564 /* reference key */ +#define KEY_REFRESH 0565 /* refresh key */ +#define KEY_REPLACE 0566 /* replace key */ +#define KEY_RESTART 0567 /* restart key */ +#define KEY_RESUME 0570 /* resume key */ +#define KEY_SAVE 0571 /* save key */ +#define KEY_SBEG 0572 /* shifted begin key */ +#define KEY_SCANCEL 0573 /* shifted cancel key */ +#define KEY_SCOMMAND 0574 /* shifted command key */ +#define KEY_SCOPY 0575 /* shifted copy key */ +#define KEY_SCREATE 0576 /* shifted create key */ +#define KEY_SDC 0577 /* shifted delete-character key */ +#define KEY_SDL 0600 /* shifted delete-line key */ +#define KEY_SELECT 0601 /* select key */ +#define KEY_SEND 0602 /* shifted end key */ +#define KEY_SEOL 0603 /* shifted clear-to-end-of-line key */ +#define KEY_SEXIT 0604 /* shifted exit key */ +#define KEY_SFIND 0605 /* shifted find key */ +#define KEY_SHELP 0606 /* shifted help key */ +#define KEY_SHOME 0607 /* shifted home key */ +#define KEY_SIC 0610 /* shifted insert-character key */ +#define KEY_SLEFT 0611 /* shifted left-arrow key */ +#define KEY_SMESSAGE 0612 /* shifted message key */ +#define KEY_SMOVE 0613 /* shifted move key */ +#define KEY_SNEXT 0614 /* shifted next key */ +#define KEY_SOPTIONS 0615 /* shifted options key */ +#define KEY_SPREVIOUS 0616 /* shifted previous key */ +#define KEY_SPRINT 0617 /* shifted print key */ +#define KEY_SREDO 0620 /* shifted redo key */ +#define KEY_SREPLACE 0621 /* shifted replace key */ +#define KEY_SRIGHT 0622 /* shifted right-arrow key */ +#define KEY_SRSUME 0623 /* shifted resume key */ +#define KEY_SSAVE 0624 /* shifted save key */ +#define KEY_SSUSPEND 0625 /* shifted suspend key */ +#define KEY_SUNDO 0626 /* shifted undo key */ +#define KEY_SUSPEND 0627 /* suspend key */ +#define KEY_UNDO 0630 /* undo key */ +#define KEY_MOUSE 0631 /* Mouse event has occurred */ +#define KEY_RESIZE 0632 /* Terminal resize event */ +#define KEY_EVENT 0633 /* We were interrupted by an event */ + +#define KEY_MAX 0777 /* Maximum key value is 0633 */ +/* $Id: curses.wide,v 1.50 2017/03/26 16:05:21 tom Exp $ */ +/* + * vile:cmode: + * This file is part of ncurses, designed to be appended after curses.h.in + * (see that file for the relevant copyright). + */ +#define _XOPEN_CURSES 1 + +#if NCURSES_WIDECHAR + +extern NCURSES_EXPORT_VAR(cchar_t*) _nc_wacs; + +#define NCURSES_WACS(c) (&_nc_wacs[NCURSES_CAST(unsigned char, (c))]) + +#define WACS_BSSB NCURSES_WACS('l') +#define WACS_SSBB NCURSES_WACS('m') +#define WACS_BBSS NCURSES_WACS('k') +#define WACS_SBBS NCURSES_WACS('j') +#define WACS_SBSS NCURSES_WACS('u') +#define WACS_SSSB NCURSES_WACS('t') +#define WACS_SSBS NCURSES_WACS('v') +#define WACS_BSSS NCURSES_WACS('w') +#define WACS_BSBS NCURSES_WACS('q') +#define WACS_SBSB NCURSES_WACS('x') +#define WACS_SSSS NCURSES_WACS('n') + +#define WACS_ULCORNER WACS_BSSB +#define WACS_LLCORNER WACS_SSBB +#define WACS_URCORNER WACS_BBSS +#define WACS_LRCORNER WACS_SBBS +#define WACS_RTEE WACS_SBSS +#define WACS_LTEE WACS_SSSB +#define WACS_BTEE WACS_SSBS +#define WACS_TTEE WACS_BSSS +#define WACS_HLINE WACS_BSBS +#define WACS_VLINE WACS_SBSB +#define WACS_PLUS WACS_SSSS + +#define WACS_S1 NCURSES_WACS('o') /* scan line 1 */ +#define WACS_S9 NCURSES_WACS('s') /* scan line 9 */ +#define WACS_DIAMOND NCURSES_WACS('`') /* diamond */ +#define WACS_CKBOARD NCURSES_WACS('a') /* checker board */ +#define WACS_DEGREE NCURSES_WACS('f') /* degree symbol */ +#define WACS_PLMINUS NCURSES_WACS('g') /* plus/minus */ +#define WACS_BULLET NCURSES_WACS('~') /* bullet */ + +/* Teletype 5410v1 symbols */ +#define WACS_LARROW NCURSES_WACS(',') /* arrow left */ +#define WACS_RARROW NCURSES_WACS('+') /* arrow right */ +#define WACS_DARROW NCURSES_WACS('.') /* arrow down */ +#define WACS_UARROW NCURSES_WACS('-') /* arrow up */ +#define WACS_BOARD NCURSES_WACS('h') /* board of squares */ +#define WACS_LANTERN NCURSES_WACS('i') /* lantern symbol */ +#define WACS_BLOCK NCURSES_WACS('0') /* solid square block */ + +/* ncurses extensions */ +#define WACS_S3 NCURSES_WACS('p') /* scan line 3 */ +#define WACS_S7 NCURSES_WACS('r') /* scan line 7 */ +#define WACS_LEQUAL NCURSES_WACS('y') /* less/equal */ +#define WACS_GEQUAL NCURSES_WACS('z') /* greater/equal */ +#define WACS_PI NCURSES_WACS('{') /* Pi */ +#define WACS_NEQUAL NCURSES_WACS('|') /* not equal */ +#define WACS_STERLING NCURSES_WACS('}') /* UK pound sign */ + +/* double lines */ +#define WACS_BDDB NCURSES_WACS('C') +#define WACS_DDBB NCURSES_WACS('D') +#define WACS_BBDD NCURSES_WACS('B') +#define WACS_DBBD NCURSES_WACS('A') +#define WACS_DBDD NCURSES_WACS('G') +#define WACS_DDDB NCURSES_WACS('F') +#define WACS_DDBD NCURSES_WACS('H') +#define WACS_BDDD NCURSES_WACS('I') +#define WACS_BDBD NCURSES_WACS('R') +#define WACS_DBDB NCURSES_WACS('Y') +#define WACS_DDDD NCURSES_WACS('E') + +#define WACS_D_ULCORNER WACS_BDDB +#define WACS_D_LLCORNER WACS_DDBB +#define WACS_D_URCORNER WACS_BBDD +#define WACS_D_LRCORNER WACS_DBBD +#define WACS_D_RTEE WACS_DBDD +#define WACS_D_LTEE WACS_DDDB +#define WACS_D_BTEE WACS_DDBD +#define WACS_D_TTEE WACS_BDDD +#define WACS_D_HLINE WACS_BDBD +#define WACS_D_VLINE WACS_DBDB +#define WACS_D_PLUS WACS_DDDD + +/* thick lines */ +#define WACS_BTTB NCURSES_WACS('L') +#define WACS_TTBB NCURSES_WACS('M') +#define WACS_BBTT NCURSES_WACS('K') +#define WACS_TBBT NCURSES_WACS('J') +#define WACS_TBTT NCURSES_WACS('U') +#define WACS_TTTB NCURSES_WACS('T') +#define WACS_TTBT NCURSES_WACS('V') +#define WACS_BTTT NCURSES_WACS('W') +#define WACS_BTBT NCURSES_WACS('Q') +#define WACS_TBTB NCURSES_WACS('X') +#define WACS_TTTT NCURSES_WACS('N') + +#define WACS_T_ULCORNER WACS_BTTB +#define WACS_T_LLCORNER WACS_TTBB +#define WACS_T_URCORNER WACS_BBTT +#define WACS_T_LRCORNER WACS_TBBT +#define WACS_T_RTEE WACS_TBTT +#define WACS_T_LTEE WACS_TTTB +#define WACS_T_BTEE WACS_TTBT +#define WACS_T_TTEE WACS_BTTT +#define WACS_T_HLINE WACS_BTBT +#define WACS_T_VLINE WACS_TBTB +#define WACS_T_PLUS WACS_TTTT + +/* + * Function prototypes for wide-character operations. + * + * "generated" comments should include ":WIDEC" to make the corresponding + * functions ifdef'd in lib_gen.c + * + * "implemented" comments do not need this marker. + */ + +extern NCURSES_EXPORT(int) add_wch(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + add_wchnstr(const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) add_wchstr(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) addnwstr(const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) addwstr(const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) bkgrnd(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(void) bkgrndset(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) border_set( + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + box_set(WINDOW*, const cchar_t*, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) echo_wchar(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) erasewchar(wchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) get_wch(wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) get_wstr(wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) getbkgrnd(cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) getcchar( + const cchar_t*, + wchar_t*, + attr_t*, + NCURSES_PAIRS_T*, + void*); /* implemented */ +extern NCURSES_EXPORT(int) getn_wstr(wint_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) hline_set(const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) in_wch(cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) in_wchnstr(cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) in_wchstr(cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) innwstr(wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) ins_nwstr(const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) ins_wch(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) ins_wstr(const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) inwstr(wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(NCURSES_CONST char*) key_name(wchar_t); /* implemented */ +extern NCURSES_EXPORT(int) killwchar(wchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + mvadd_wch(int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvadd_wchnstr(int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvadd_wchstr(int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvaddnwstr(int, int, const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvaddwstr(int, int, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvget_wch(int, int, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvget_wstr(int, int, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvgetn_wstr(int, int, wint_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvhline_set(int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvin_wch(int, int, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvin_wchnstr(int, int, cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvin_wchstr(int, int, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvinnwstr(int, int, wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvins_nwstr(int, int, const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvins_wch(int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvins_wstr(int, int, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvinwstr(int, int, wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvvline_set(int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwadd_wch(WINDOW*, int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwadd_wchnstr( + WINDOW*, + int, + int, + const cchar_t*, + int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwadd_wchstr(WINDOW*, int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwaddnwstr(WINDOW*, int, int, const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwaddwstr(WINDOW*, int, int, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwget_wch(WINDOW*, int, int, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwget_wstr(WINDOW*, int, int, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwgetn_wstr(WINDOW*, int, int, wint_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwhline_set(WINDOW*, int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwin_wch(WINDOW*, int, int, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwin_wchnstr(WINDOW*, int, int, cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwin_wchstr(WINDOW*, int, int, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwinnwstr(WINDOW*, int, int, wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwins_nwstr(WINDOW*, int, int, const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwins_wch(WINDOW*, int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwins_wstr(WINDOW*, int, int, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwinwstr(WINDOW*, int, int, wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwvline_set(WINDOW*, int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + pecho_wchar(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) setcchar( + cchar_t*, + const wchar_t*, + const attr_t, + NCURSES_PAIRS_T, + const void*); /* implemented */ +extern NCURSES_EXPORT(int) slk_wset(int, const wchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(attr_t) term_attrs(void); /* implemented */ +extern NCURSES_EXPORT(int) unget_wch(const wchar_t); /* implemented */ +extern NCURSES_EXPORT(int) + vid_attr(attr_t, NCURSES_PAIRS_T, void*); /* implemented */ +extern NCURSES_EXPORT(int) + vid_puts(attr_t, NCURSES_PAIRS_T, void*, NCURSES_OUTC); /* implemented */ +extern NCURSES_EXPORT(int) vline_set(const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wadd_wch(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + wadd_wchnstr(WINDOW*, const cchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) + wadd_wchstr(WINDOW*, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + waddnwstr(WINDOW*, const wchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) + waddwstr(WINDOW*, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wbkgrnd(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(void) + wbkgrndset(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) wborder_set( + WINDOW*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + wecho_wchar(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) wget_wch(WINDOW*, wint_t*); /* implemented */ +extern NCURSES_EXPORT(int) wget_wstr(WINDOW*, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wgetbkgrnd(WINDOW*, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wgetn_wstr(WINDOW*, wint_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) + whline_set(WINDOW*, const cchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) win_wch(WINDOW*, cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + win_wchnstr(WINDOW*, cchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) win_wchstr(WINDOW*, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) winnwstr(WINDOW*, wchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) + wins_nwstr(WINDOW*, const wchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) wins_wch(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + wins_wstr(WINDOW*, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) winwstr(WINDOW*, wchar_t*); /* implemented */ +extern NCURSES_EXPORT(wchar_t*) wunctrl(cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + wvline_set(WINDOW*, const cchar_t*, int); /* implemented */ + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(attr_t) + NCURSES_SP_NAME(term_attrs)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + unget_wch)(SCREEN*, const wchar_t); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(wchar_t*) + NCURSES_SP_NAME(wunctrl)(SCREEN*, cchar_t*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_attr)( + SCREEN*, + attr_t, + NCURSES_PAIRS_T, + void*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts)( + SCREEN*, + attr_t, + NCURSES_PAIRS_T, + void*, + NCURSES_SP_OUTC); /* implemented:SP_FUNC */ +#endif + +#ifndef NCURSES_NOMACROS + +/* + * XSI curses macros for XPG4 conformance. + */ +#define add_wch(c) wadd_wch(stdscr, (c)) +#define add_wchnstr(str, n) wadd_wchnstr(stdscr, (str), (n)) +#define add_wchstr(str) wadd_wchstr(stdscr, (str)) +#define addnwstr(wstr, n) waddnwstr(stdscr, (wstr), (n)) +#define addwstr(wstr) waddwstr(stdscr, (wstr)) +#define bkgrnd(c) wbkgrnd(stdscr, (c)) +#define bkgrndset(c) wbkgrndset(stdscr, (c)) +#define border_set(l, r, t, b, tl, tr, bl, br) \ + wborder_set(stdscr, (l), (r), (t), (b), tl, tr, bl, br) +#define box_set(w, v, h) wborder_set((w), (v), (v), (h), (h), 0, 0, 0, 0) +#define echo_wchar(c) wecho_wchar(stdscr, (c)) +#define get_wch(c) wget_wch(stdscr, (c)) +#define get_wstr(t) wget_wstr(stdscr, (t)) +#define getbkgrnd(wch) wgetbkgrnd(stdscr, (wch)) +#define getn_wstr(t, n) wgetn_wstr(stdscr, (t), (n)) +#define hline_set(c, n) whline_set(stdscr, (c), (n)) +#define in_wch(c) win_wch(stdscr, (c)) +#define in_wchnstr(c, n) win_wchnstr(stdscr, (c), (n)) +#define in_wchstr(c) win_wchstr(stdscr, (c)) +#define innwstr(c, n) winnwstr(stdscr, (c), (n)) +#define ins_nwstr(t, n) wins_nwstr(stdscr, (t), (n)) +#define ins_wch(c) wins_wch(stdscr, (c)) +#define ins_wstr(t) wins_wstr(stdscr, (t)) +#define inwstr(c) winwstr(stdscr, (c)) +#define vline_set(c, n) wvline_set(stdscr, (c), (n)) +#define wadd_wchstr(win, str) wadd_wchnstr((win), (str), -1) +#define waddwstr(win, wstr) waddnwstr((win), (wstr), -1) +#define wget_wstr(w, t) wgetn_wstr((w), (t), -1) +#define win_wchstr(w, c) win_wchnstr((w), (c), -1) +#define wins_wstr(w, t) wins_nwstr((w), (t), -1) + +#if !NCURSES_OPAQUE +#define wgetbkgrnd(win, wch) \ + (NCURSES_OK_ADDR(wch) ? ((win) ? (*(wch) = (win)->_bkgrnd) : *(wch), OK) \ + : ERR) +#endif + +#define mvadd_wch(y, x, c) mvwadd_wch(stdscr, (y), (x), (c)) +#define mvadd_wchnstr(y, x, s, n) mvwadd_wchnstr(stdscr, (y), (x), (s), (n)) +#define mvadd_wchstr(y, x, s) mvwadd_wchstr(stdscr, (y), (x), (s)) +#define mvaddnwstr(y, x, wstr, n) mvwaddnwstr(stdscr, (y), (x), (wstr), (n)) +#define mvaddwstr(y, x, wstr) mvwaddwstr(stdscr, (y), (x), (wstr)) +#define mvget_wch(y, x, c) mvwget_wch(stdscr, (y), (x), (c)) +#define mvget_wstr(y, x, t) mvwget_wstr(stdscr, (y), (x), (t)) +#define mvgetn_wstr(y, x, t, n) mvwgetn_wstr(stdscr, (y), (x), (t), (n)) +#define mvhline_set(y, x, c, n) mvwhline_set(stdscr, (y), (x), (c), (n)) +#define mvin_wch(y, x, c) mvwin_wch(stdscr, (y), (x), (c)) +#define mvin_wchnstr(y, x, c, n) mvwin_wchnstr(stdscr, (y), (x), (c), (n)) +#define mvin_wchstr(y, x, c) mvwin_wchstr(stdscr, (y), (x), (c)) +#define mvinnwstr(y, x, c, n) mvwinnwstr(stdscr, (y), (x), (c), (n)) +#define mvins_nwstr(y, x, t, n) mvwins_nwstr(stdscr, (y), (x), (t), (n)) +#define mvins_wch(y, x, c) mvwins_wch(stdscr, (y), (x), (c)) +#define mvins_wstr(y, x, t) mvwins_wstr(stdscr, (y), (x), (t)) +#define mvinwstr(y, x, c) mvwinwstr(stdscr, (y), (x), (c)) +#define mvvline_set(y, x, c, n) mvwvline_set(stdscr, (y), (x), (c), (n)) + +#define mvwadd_wch(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : wadd_wch((win), (c))) +#define mvwadd_wchnstr(win, y, x, s, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : wadd_wchnstr((win), (s), (n))) +#define mvwadd_wchstr(win, y, x, s) \ + (wmove(win, (y), (x)) == ERR ? ERR : wadd_wchstr((win), (s))) +#define mvwaddnwstr(win, y, x, wstr, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : waddnwstr((win), (wstr), (n))) +#define mvwaddwstr(win, y, x, wstr) \ + (wmove(win, (y), (x)) == ERR ? ERR : waddwstr((win), (wstr))) +#define mvwget_wch(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : wget_wch((win), (c))) +#define mvwget_wstr(win, y, x, t) \ + (wmove(win, (y), (x)) == ERR ? ERR : wget_wstr((win), (t))) +#define mvwgetn_wstr(win, y, x, t, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : wgetn_wstr((win), (t), (n))) +#define mvwhline_set(win, y, x, c, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : whline_set((win), (c), (n))) +#define mvwin_wch(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : win_wch((win), (c))) +#define mvwin_wchnstr(win, y, x, c, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : win_wchnstr((win), (c), (n))) +#define mvwin_wchstr(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : win_wchstr((win), (c))) +#define mvwinnwstr(win, y, x, c, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : winnwstr((win), (c), (n))) +#define mvwins_nwstr(win, y, x, t, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : wins_nwstr((win), (t), (n))) +#define mvwins_wch(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : wins_wch((win), (c))) +#define mvwins_wstr(win, y, x, t) \ + (wmove(win, (y), (x)) == ERR ? ERR : wins_wstr((win), (t))) +#define mvwinwstr(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : winwstr((win), (c))) +#define mvwvline_set(win, y, x, c, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : wvline_set((win), (c), (n))) + +#endif /* NCURSES_NOMACROS */ + +#if defined(TRACE) || defined(NCURSES_TEST) +extern NCURSES_EXPORT(const char*) _nc_viswbuf(const wchar_t*); +extern NCURSES_EXPORT(const char*) _nc_viswibuf(const wint_t*); +#endif + +#endif /* NCURSES_WIDECHAR */ +/* $Id: curses.tail,v 1.23 2016/02/13 16:37:45 tom Exp $ */ +/* + * vile:cmode: + * This file is part of ncurses, designed to be appended after curses.h.in + * (see that file for the relevant copyright). + */ + +/* mouse interface */ + +#if NCURSES_MOUSE_VERSION > 1 +#define NCURSES_MOUSE_MASK(b, m) ((m) << (((b)-1) * 5)) +#else +#define NCURSES_MOUSE_MASK(b, m) ((m) << (((b)-1) * 6)) +#endif + +#define NCURSES_BUTTON_RELEASED 001L +#define NCURSES_BUTTON_PRESSED 002L +#define NCURSES_BUTTON_CLICKED 004L +#define NCURSES_DOUBLE_CLICKED 010L +#define NCURSES_TRIPLE_CLICKED 020L +#define NCURSES_RESERVED_EVENT 040L + +/* event masks */ +#define BUTTON1_RELEASED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED) +#define BUTTON1_PRESSED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED) +#define BUTTON1_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED) +#define BUTTON1_DOUBLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED) +#define BUTTON1_TRIPLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED) + +#define BUTTON2_RELEASED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED) +#define BUTTON2_PRESSED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED) +#define BUTTON2_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED) +#define BUTTON2_DOUBLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED) +#define BUTTON2_TRIPLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED) + +#define BUTTON3_RELEASED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED) +#define BUTTON3_PRESSED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED) +#define BUTTON3_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED) +#define BUTTON3_DOUBLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED) +#define BUTTON3_TRIPLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED) + +#define BUTTON4_RELEASED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED) +#define BUTTON4_PRESSED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED) +#define BUTTON4_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED) +#define BUTTON4_DOUBLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED) +#define BUTTON4_TRIPLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED) + +/* + * In 32 bits the version-1 scheme does not provide enough space for a 5th + * button, unless we choose to change the ABI by omitting the reserved-events. + */ +#if NCURSES_MOUSE_VERSION > 1 + +#define BUTTON5_RELEASED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED) +#define BUTTON5_PRESSED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED) +#define BUTTON5_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED) +#define BUTTON5_DOUBLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED) +#define BUTTON5_TRIPLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED) + +#define BUTTON_CTRL NCURSES_MOUSE_MASK(6, 0001L) +#define BUTTON_SHIFT NCURSES_MOUSE_MASK(6, 0002L) +#define BUTTON_ALT NCURSES_MOUSE_MASK(6, 0004L) +#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(6, 0010L) + +#else + +#define BUTTON1_RESERVED_EVENT NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT) +#define BUTTON2_RESERVED_EVENT NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT) +#define BUTTON3_RESERVED_EVENT NCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT) +#define BUTTON4_RESERVED_EVENT NCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT) + +#define BUTTON_CTRL NCURSES_MOUSE_MASK(5, 0001L) +#define BUTTON_SHIFT NCURSES_MOUSE_MASK(5, 0002L) +#define BUTTON_ALT NCURSES_MOUSE_MASK(5, 0004L) +#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(5, 0010L) + +#endif + +#define ALL_MOUSE_EVENTS (REPORT_MOUSE_POSITION - 1) + +/* macros to extract single event-bits from masks */ +#define BUTTON_RELEASE(e, x) ((e)&NCURSES_MOUSE_MASK(x, 001)) +#define BUTTON_PRESS(e, x) ((e)&NCURSES_MOUSE_MASK(x, 002)) +#define BUTTON_CLICK(e, x) ((e)&NCURSES_MOUSE_MASK(x, 004)) +#define BUTTON_DOUBLE_CLICK(e, x) ((e)&NCURSES_MOUSE_MASK(x, 010)) +#define BUTTON_TRIPLE_CLICK(e, x) ((e)&NCURSES_MOUSE_MASK(x, 020)) +#define BUTTON_RESERVED_EVENT(e, x) ((e)&NCURSES_MOUSE_MASK(x, 040)) + +typedef struct { + short id; /* ID to distinguish multiple devices */ + int x, y, z; /* event coordinates (character-cell) */ + mmask_t bstate; /* button state bits */ +} MEVENT; + +extern NCURSES_EXPORT(bool) has_mouse(void); +extern NCURSES_EXPORT(int) getmouse(MEVENT*); +extern NCURSES_EXPORT(int) ungetmouse(MEVENT*); +extern NCURSES_EXPORT(mmask_t) mousemask(mmask_t, mmask_t*); +extern NCURSES_EXPORT(bool) wenclose(const WINDOW*, int, int); +extern NCURSES_EXPORT(int) mouseinterval(int); +extern NCURSES_EXPORT(bool) wmouse_trafo(const WINDOW*, int*, int*, bool); +extern NCURSES_EXPORT(bool) mouse_trafo(int*, int*, bool); /* generated */ + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_mouse)(SCREEN*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(getmouse)(SCREEN*, MEVENT*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetmouse)(SCREEN*, MEVENT*); +extern NCURSES_EXPORT(mmask_t) + NCURSES_SP_NAME(mousemask)(SCREEN*, mmask_t, mmask_t*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mouseinterval)(SCREEN*, int); +#endif + +#ifndef NCURSES_NOMACROS +#define mouse_trafo(y, x, to_screen) wmouse_trafo(stdscr, y, x, to_screen) +#endif + +/* other non-XSI functions */ + +extern NCURSES_EXPORT(int) mcprint(char*, int); /* direct data to printer */ +extern NCURSES_EXPORT(int) has_key(int); /* do we have given key? */ + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(has_key)(SCREEN*, int); /* do we have given key? */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(mcprint)(SCREEN*, char*, int); /* direct data to printer */ +#endif + +/* Debugging : use with libncurses_g.a */ + +extern NCURSES_EXPORT(void) _tracef(const char*, ...) GCC_PRINTFLIKE(1, 2); +extern NCURSES_EXPORT(char*) _traceattr(attr_t); +extern NCURSES_EXPORT(char*) _traceattr2(int, chtype); +extern NCURSES_EXPORT(char*) _tracechar(int); +extern NCURSES_EXPORT(char*) _tracechtype(chtype); +extern NCURSES_EXPORT(char*) _tracechtype2(int, chtype); +#if NCURSES_WIDECHAR +#define _tracech_t _tracecchar_t +extern NCURSES_EXPORT(char*) _tracecchar_t(const cchar_t*); +#define _tracech_t2 _tracecchar_t2 +extern NCURSES_EXPORT(char*) _tracecchar_t2(int, const cchar_t*); +#else +#define _tracech_t _tracechtype +#define _tracech_t2 _tracechtype2 +#endif +extern NCURSES_EXPORT(void) trace(const unsigned int); + +/* trace masks */ +#define TRACE_DISABLE 0x0000 /* turn off tracing */ +#define TRACE_TIMES 0x0001 /* trace user and system times of updates */ +#define TRACE_TPUTS 0x0002 /* trace tputs calls */ +#define TRACE_UPDATE 0x0004 /* trace update actions, old & new screens */ +#define TRACE_MOVE 0x0008 /* trace cursor moves and scrolls */ +#define TRACE_CHARPUT 0x0010 /* trace all character outputs */ +#define TRACE_ORDINARY 0x001F /* trace all update actions */ +#define TRACE_CALLS 0x0020 /* trace all curses calls */ +#define TRACE_VIRTPUT 0x0040 /* trace virtual character puts */ +#define TRACE_IEVENT 0x0080 /* trace low-level input processing */ +#define TRACE_BITS 0x0100 /* trace state of TTY control bits */ +#define TRACE_ICALLS 0x0200 /* trace internal/nested calls */ +#define TRACE_CCALLS 0x0400 /* trace per-character calls */ +#define TRACE_DATABASE 0x0800 /* trace read/write of terminfo/termcap data */ +#define TRACE_ATTRS 0x1000 /* trace attribute updates */ + +#define TRACE_SHIFT 13 /* number of bits in the trace masks */ +#define TRACE_MAXIMUM ((1 << TRACE_SHIFT) - 1) /* maximum trace level */ + +#if defined(TRACE) || defined(NCURSES_TEST) +extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable; /* enable optimizations */ +extern NCURSES_EXPORT(const char*) _nc_visbuf(const char*); +#define OPTIMIZE_MVCUR 0x01 /* cursor movement optimization */ +#define OPTIMIZE_HASHMAP 0x02 /* diff hashing to detect scrolls */ +#define OPTIMIZE_SCROLL 0x04 /* scroll optimization */ +#define OPTIMIZE_ALL 0xff /* enable all optimizations (dflt) */ +#endif + +#include + +#ifdef __cplusplus + +#ifndef NCURSES_NOMACROS + +/* these names conflict with STL */ +#undef box +#undef clear +#undef erase +#undef move +#undef refresh + +#endif /* NCURSES_NOMACROS */ +} +#endif + +#endif /* __NCURSES_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/ncurses_dll.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/ncurses_dll.h new file mode 100644 index 0000000..240f606 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/ncurses_dll.h @@ -0,0 +1,103 @@ +/**************************************************************************** + * Copyright (c) 1998-2009,2014 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ +/* $Id: ncurses_dll.h.in,v 1.9 2014/08/02 21:30:20 tom Exp $ */ + +#ifndef NCURSES_DLL_H_incl +#define NCURSES_DLL_H_incl 1 + +/* 2014-08-02 workaround for broken MinGW compiler. + * Oddly, only TRACE is mapped to trace - the other -D's are okay. + * suggest TDM as an alternative. + */ +#if defined(__MINGW64__) +#elif defined(__MINGW32__) +#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) + +#ifdef trace +#undef trace +#define TRACE +#endif + +#endif /* broken compiler */ +#endif /* MingW */ + +/* + * For reentrant code, we map the various global variables into SCREEN by + * using functions to access them. + */ +#define NCURSES_PUBLIC_VAR(name) _nc_##name +#define NCURSES_WRAPPED_VAR(type, name) \ + extern type NCURSES_PUBLIC_VAR(name)(void) + +/* no longer needed on cygwin or mingw, thanks to auto-import */ +/* but this structure may be useful at some point for an MSVC build */ +/* so, for now unconditionally define the important flags */ +/* "the right way" for proper static and dll+auto-import behavior */ +#undef NCURSES_DLL +#define NCURSES_STATIC + +#if defined(__CYGWIN__) || defined(__MINGW32__) +#if defined(NCURSES_DLL) +#if defined(NCURSES_STATIC) +#undef NCURSES_STATIC +#endif +#endif +#undef NCURSES_IMPEXP +#undef NCURSES_API +#undef NCURSES_EXPORT +#undef NCURSES_EXPORT_VAR +#if defined(NCURSES_DLL) +/* building a DLL */ +#define NCURSES_IMPEXP __declspec(dllexport) +#elif defined(NCURSES_STATIC) +/* building or linking to a static library */ +#define NCURSES_IMPEXP /* nothing */ +#else +/* linking to the DLL */ +#define NCURSES_IMPEXP __declspec(dllimport) +#endif +#define NCURSES_API __cdecl +#define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API +#define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type +#endif + +/* Take care of non-cygwin platforms */ +#if !defined(NCURSES_IMPEXP) +#define NCURSES_IMPEXP /* nothing */ +#endif +#if !defined(NCURSES_API) +#define NCURSES_API /* nothing */ +#endif +#if !defined(NCURSES_EXPORT) +#define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API +#endif +#if !defined(NCURSES_EXPORT_VAR) +#define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type +#endif + +#endif /* NCURSES_DLL_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/panel.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/panel.h new file mode 100644 index 0000000..104d587 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/panel.h @@ -0,0 +1,88 @@ +/**************************************************************************** + * Copyright (c) 1998-2009,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1995 * + * and: Eric S. Raymond * + * and: Juergen Pfeifer 1996-1999,2008 * + ****************************************************************************/ + +/* $Id: panel.h,v 1.12 2017/02/11 16:50:28 tom Exp $ */ + +/* panel.h -- interface file for panels library */ + +#ifndef NCURSES_PANEL_H_incl +#define NCURSES_PANEL_H_incl 1 + +#include + +typedef struct panel +#if !NCURSES_OPAQUE_PANEL +{ + WINDOW* win; + struct panel* below; + struct panel* above; + NCURSES_CONST void* user; +} +#endif /* !NCURSES_OPAQUE_PANEL */ +PANEL; + +#if defined(__cplusplus) +extern "C" { +#endif + +extern NCURSES_EXPORT(WINDOW*) panel_window(const PANEL*); +extern NCURSES_EXPORT(void) update_panels(void); +extern NCURSES_EXPORT(int) hide_panel(PANEL*); +extern NCURSES_EXPORT(int) show_panel(PANEL*); +extern NCURSES_EXPORT(int) del_panel(PANEL*); +extern NCURSES_EXPORT(int) top_panel(PANEL*); +extern NCURSES_EXPORT(int) bottom_panel(PANEL*); +extern NCURSES_EXPORT(PANEL*) new_panel(WINDOW*); +extern NCURSES_EXPORT(PANEL*) panel_above(const PANEL*); +extern NCURSES_EXPORT(PANEL*) panel_below(const PANEL*); +extern NCURSES_EXPORT(int) set_panel_userptr(PANEL*, NCURSES_CONST void*); +extern NCURSES_EXPORT(NCURSES_CONST void*) panel_userptr(const PANEL*); +extern NCURSES_EXPORT(int) move_panel(PANEL*, int, int); +extern NCURSES_EXPORT(int) replace_panel(PANEL*, WINDOW*); +extern NCURSES_EXPORT(int) panel_hidden(const PANEL*); + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(PANEL*) ground_panel(SCREEN*); +extern NCURSES_EXPORT(PANEL*) ceiling_panel(SCREEN*); + +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(update_panels)(SCREEN*); +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /* NCURSES_PANEL_H_incl */ + +/* end of panel.h */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/term.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/term.h new file mode 100644 index 0000000..79b83db --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/term.h @@ -0,0 +1,886 @@ +/**************************************************************************** + * Copyright (c) 1998-2013,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/****************************************************************************/ +/* Author: Zeyd M. Ben-Halim 1992,1995 */ +/* and: Eric S. Raymond */ +/* and: Thomas E. Dickey 1995-on */ +/****************************************************************************/ + +/* $Id: MKterm.h.awk.in,v 1.67 2017/04/06 00:19:26 tom Exp $ */ + +/* +** term.h -- Definition of struct term +*/ + +#ifndef NCURSES_TERM_H_incl +#define NCURSES_TERM_H_incl 1 + +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.1" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H + * definition (based on the system for which this was configured). + */ + +#undef NCURSES_CONST +#define NCURSES_CONST const + +#undef NCURSES_SBOOL +#define NCURSES_SBOOL char + +#undef NCURSES_USE_DATABASE +#define NCURSES_USE_DATABASE 1 + +#undef NCURSES_USE_TERMCAP +#define NCURSES_USE_TERMCAP 1 + +#undef NCURSES_XNAMES +#define NCURSES_XNAMES 1 + +/* We will use these symbols to hide differences between + * termios/termio/sgttyb interfaces. + */ +#undef TTY +#undef SET_TTY +#undef GET_TTY + +/* Assume POSIX termio if we have the header and function */ +/* #if HAVE_TERMIOS_H && HAVE_TCGETATTR */ +#if 1 && 1 + +#undef TERMIOS +#define TERMIOS 1 + +#include +#define TTY struct termios + +#else /* !HAVE_TERMIOS_H */ + +/* #if HAVE_TERMIO_H */ +#if 1 + +#undef TERMIOS +#define TERMIOS 1 + +#include +#define TTY struct termio + +#else /* !HAVE_TERMIO_H */ + +#if __MINGW32__ +#include +#define TTY struct termios +#else +#undef TERMIOS +#include +#include +#define TTY struct sgttyb +#endif /* MINGW32 */ +#endif /* HAVE_TERMIO_H */ + +#endif /* HAVE_TERMIOS_H */ + +#ifdef TERMIOS +#define GET_TTY(fd, buf) tcgetattr(fd, buf) +#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf) +#else +#define GET_TTY(fd, buf) gtty(fd, buf) +#define SET_TTY(fd, buf) stty(fd, buf) +#endif + +#define NAMESIZE 256 + +/* The cast works because TERMTYPE is the first data in TERMINAL */ +#define CUR ((TERMTYPE*)(cur_term))-> + +#define auto_left_margin CUR Booleans[0] +#define auto_right_margin CUR Booleans[1] +#define no_esc_ctlc CUR Booleans[2] +#define ceol_standout_glitch CUR Booleans[3] +#define eat_newline_glitch CUR Booleans[4] +#define erase_overstrike CUR Booleans[5] +#define generic_type CUR Booleans[6] +#define hard_copy CUR Booleans[7] +#define has_meta_key CUR Booleans[8] +#define has_status_line CUR Booleans[9] +#define insert_null_glitch CUR Booleans[10] +#define memory_above CUR Booleans[11] +#define memory_below CUR Booleans[12] +#define move_insert_mode CUR Booleans[13] +#define move_standout_mode CUR Booleans[14] +#define over_strike CUR Booleans[15] +#define status_line_esc_ok CUR Booleans[16] +#define dest_tabs_magic_smso CUR Booleans[17] +#define tilde_glitch CUR Booleans[18] +#define transparent_underline CUR Booleans[19] +#define xon_xoff CUR Booleans[20] +#define needs_xon_xoff CUR Booleans[21] +#define prtr_silent CUR Booleans[22] +#define hard_cursor CUR Booleans[23] +#define non_rev_rmcup CUR Booleans[24] +#define no_pad_char CUR Booleans[25] +#define non_dest_scroll_region CUR Booleans[26] +#define can_change CUR Booleans[27] +#define back_color_erase CUR Booleans[28] +#define hue_lightness_saturation CUR Booleans[29] +#define col_addr_glitch CUR Booleans[30] +#define cr_cancels_micro_mode CUR Booleans[31] +#define has_print_wheel CUR Booleans[32] +#define row_addr_glitch CUR Booleans[33] +#define semi_auto_right_margin CUR Booleans[34] +#define cpi_changes_res CUR Booleans[35] +#define lpi_changes_res CUR Booleans[36] +#define columns CUR Numbers[0] +#define init_tabs CUR Numbers[1] +#define lines CUR Numbers[2] +#define lines_of_memory CUR Numbers[3] +#define magic_cookie_glitch CUR Numbers[4] +#define padding_baud_rate CUR Numbers[5] +#define virtual_terminal CUR Numbers[6] +#define width_status_line CUR Numbers[7] +#define num_labels CUR Numbers[8] +#define label_height CUR Numbers[9] +#define label_width CUR Numbers[10] +#define max_attributes CUR Numbers[11] +#define maximum_windows CUR Numbers[12] +#define max_colors CUR Numbers[13] +#define max_pairs CUR Numbers[14] +#define no_color_video CUR Numbers[15] +#define buffer_capacity CUR Numbers[16] +#define dot_vert_spacing CUR Numbers[17] +#define dot_horz_spacing CUR Numbers[18] +#define max_micro_address CUR Numbers[19] +#define max_micro_jump CUR Numbers[20] +#define micro_col_size CUR Numbers[21] +#define micro_line_size CUR Numbers[22] +#define number_of_pins CUR Numbers[23] +#define output_res_char CUR Numbers[24] +#define output_res_line CUR Numbers[25] +#define output_res_horz_inch CUR Numbers[26] +#define output_res_vert_inch CUR Numbers[27] +#define print_rate CUR Numbers[28] +#define wide_char_size CUR Numbers[29] +#define buttons CUR Numbers[30] +#define bit_image_entwining CUR Numbers[31] +#define bit_image_type CUR Numbers[32] +#define back_tab CUR Strings[0] +#define bell CUR Strings[1] +#define carriage_return CUR Strings[2] +#define change_scroll_region CUR Strings[3] +#define clear_all_tabs CUR Strings[4] +#define clear_screen CUR Strings[5] +#define clr_eol CUR Strings[6] +#define clr_eos CUR Strings[7] +#define column_address CUR Strings[8] +#define command_character CUR Strings[9] +#define cursor_address CUR Strings[10] +#define cursor_down CUR Strings[11] +#define cursor_home CUR Strings[12] +#define cursor_invisible CUR Strings[13] +#define cursor_left CUR Strings[14] +#define cursor_mem_address CUR Strings[15] +#define cursor_normal CUR Strings[16] +#define cursor_right CUR Strings[17] +#define cursor_to_ll CUR Strings[18] +#define cursor_up CUR Strings[19] +#define cursor_visible CUR Strings[20] +#define delete_character CUR Strings[21] +#define delete_line CUR Strings[22] +#define dis_status_line CUR Strings[23] +#define down_half_line CUR Strings[24] +#define enter_alt_charset_mode CUR Strings[25] +#define enter_blink_mode CUR Strings[26] +#define enter_bold_mode CUR Strings[27] +#define enter_ca_mode CUR Strings[28] +#define enter_delete_mode CUR Strings[29] +#define enter_dim_mode CUR Strings[30] +#define enter_insert_mode CUR Strings[31] +#define enter_secure_mode CUR Strings[32] +#define enter_protected_mode CUR Strings[33] +#define enter_reverse_mode CUR Strings[34] +#define enter_standout_mode CUR Strings[35] +#define enter_underline_mode CUR Strings[36] +#define erase_chars CUR Strings[37] +#define exit_alt_charset_mode CUR Strings[38] +#define exit_attribute_mode CUR Strings[39] +#define exit_ca_mode CUR Strings[40] +#define exit_delete_mode CUR Strings[41] +#define exit_insert_mode CUR Strings[42] +#define exit_standout_mode CUR Strings[43] +#define exit_underline_mode CUR Strings[44] +#define flash_screen CUR Strings[45] +#define form_feed CUR Strings[46] +#define from_status_line CUR Strings[47] +#define init_1string CUR Strings[48] +#define init_2string CUR Strings[49] +#define init_3string CUR Strings[50] +#define init_file CUR Strings[51] +#define insert_character CUR Strings[52] +#define insert_line CUR Strings[53] +#define insert_padding CUR Strings[54] +#define key_backspace CUR Strings[55] +#define key_catab CUR Strings[56] +#define key_clear CUR Strings[57] +#define key_ctab CUR Strings[58] +#define key_dc CUR Strings[59] +#define key_dl CUR Strings[60] +#define key_down CUR Strings[61] +#define key_eic CUR Strings[62] +#define key_eol CUR Strings[63] +#define key_eos CUR Strings[64] +#define key_f0 CUR Strings[65] +#define key_f1 CUR Strings[66] +#define key_f10 CUR Strings[67] +#define key_f2 CUR Strings[68] +#define key_f3 CUR Strings[69] +#define key_f4 CUR Strings[70] +#define key_f5 CUR Strings[71] +#define key_f6 CUR Strings[72] +#define key_f7 CUR Strings[73] +#define key_f8 CUR Strings[74] +#define key_f9 CUR Strings[75] +#define key_home CUR Strings[76] +#define key_ic CUR Strings[77] +#define key_il CUR Strings[78] +#define key_left CUR Strings[79] +#define key_ll CUR Strings[80] +#define key_npage CUR Strings[81] +#define key_ppage CUR Strings[82] +#define key_right CUR Strings[83] +#define key_sf CUR Strings[84] +#define key_sr CUR Strings[85] +#define key_stab CUR Strings[86] +#define key_up CUR Strings[87] +#define keypad_local CUR Strings[88] +#define keypad_xmit CUR Strings[89] +#define lab_f0 CUR Strings[90] +#define lab_f1 CUR Strings[91] +#define lab_f10 CUR Strings[92] +#define lab_f2 CUR Strings[93] +#define lab_f3 CUR Strings[94] +#define lab_f4 CUR Strings[95] +#define lab_f5 CUR Strings[96] +#define lab_f6 CUR Strings[97] +#define lab_f7 CUR Strings[98] +#define lab_f8 CUR Strings[99] +#define lab_f9 CUR Strings[100] +#define meta_off CUR Strings[101] +#define meta_on CUR Strings[102] +#define newline CUR Strings[103] +#define pad_char CUR Strings[104] +#define parm_dch CUR Strings[105] +#define parm_delete_line CUR Strings[106] +#define parm_down_cursor CUR Strings[107] +#define parm_ich CUR Strings[108] +#define parm_index CUR Strings[109] +#define parm_insert_line CUR Strings[110] +#define parm_left_cursor CUR Strings[111] +#define parm_right_cursor CUR Strings[112] +#define parm_rindex CUR Strings[113] +#define parm_up_cursor CUR Strings[114] +#define pkey_key CUR Strings[115] +#define pkey_local CUR Strings[116] +#define pkey_xmit CUR Strings[117] +#define print_screen CUR Strings[118] +#define prtr_off CUR Strings[119] +#define prtr_on CUR Strings[120] +#define repeat_char CUR Strings[121] +#define reset_1string CUR Strings[122] +#define reset_2string CUR Strings[123] +#define reset_3string CUR Strings[124] +#define reset_file CUR Strings[125] +#define restore_cursor CUR Strings[126] +#define row_address CUR Strings[127] +#define save_cursor CUR Strings[128] +#define scroll_forward CUR Strings[129] +#define scroll_reverse CUR Strings[130] +#define set_attributes CUR Strings[131] +#define set_tab CUR Strings[132] +#define set_window CUR Strings[133] +#define tab CUR Strings[134] +#define to_status_line CUR Strings[135] +#define underline_char CUR Strings[136] +#define up_half_line CUR Strings[137] +#define init_prog CUR Strings[138] +#define key_a1 CUR Strings[139] +#define key_a3 CUR Strings[140] +#define key_b2 CUR Strings[141] +#define key_c1 CUR Strings[142] +#define key_c3 CUR Strings[143] +#define prtr_non CUR Strings[144] +#define char_padding CUR Strings[145] +#define acs_chars CUR Strings[146] +#define plab_norm CUR Strings[147] +#define key_btab CUR Strings[148] +#define enter_xon_mode CUR Strings[149] +#define exit_xon_mode CUR Strings[150] +#define enter_am_mode CUR Strings[151] +#define exit_am_mode CUR Strings[152] +#define xon_character CUR Strings[153] +#define xoff_character CUR Strings[154] +#define ena_acs CUR Strings[155] +#define label_on CUR Strings[156] +#define label_off CUR Strings[157] +#define key_beg CUR Strings[158] +#define key_cancel CUR Strings[159] +#define key_close CUR Strings[160] +#define key_command CUR Strings[161] +#define key_copy CUR Strings[162] +#define key_create CUR Strings[163] +#define key_end CUR Strings[164] +#define key_enter CUR Strings[165] +#define key_exit CUR Strings[166] +#define key_find CUR Strings[167] +#define key_help CUR Strings[168] +#define key_mark CUR Strings[169] +#define key_message CUR Strings[170] +#define key_move CUR Strings[171] +#define key_next CUR Strings[172] +#define key_open CUR Strings[173] +#define key_options CUR Strings[174] +#define key_previous CUR Strings[175] +#define key_print CUR Strings[176] +#define key_redo CUR Strings[177] +#define key_reference CUR Strings[178] +#define key_refresh CUR Strings[179] +#define key_replace CUR Strings[180] +#define key_restart CUR Strings[181] +#define key_resume CUR Strings[182] +#define key_save CUR Strings[183] +#define key_suspend CUR Strings[184] +#define key_undo CUR Strings[185] +#define key_sbeg CUR Strings[186] +#define key_scancel CUR Strings[187] +#define key_scommand CUR Strings[188] +#define key_scopy CUR Strings[189] +#define key_screate CUR Strings[190] +#define key_sdc CUR Strings[191] +#define key_sdl CUR Strings[192] +#define key_select CUR Strings[193] +#define key_send CUR Strings[194] +#define key_seol CUR Strings[195] +#define key_sexit CUR Strings[196] +#define key_sfind CUR Strings[197] +#define key_shelp CUR Strings[198] +#define key_shome CUR Strings[199] +#define key_sic CUR Strings[200] +#define key_sleft CUR Strings[201] +#define key_smessage CUR Strings[202] +#define key_smove CUR Strings[203] +#define key_snext CUR Strings[204] +#define key_soptions CUR Strings[205] +#define key_sprevious CUR Strings[206] +#define key_sprint CUR Strings[207] +#define key_sredo CUR Strings[208] +#define key_sreplace CUR Strings[209] +#define key_sright CUR Strings[210] +#define key_srsume CUR Strings[211] +#define key_ssave CUR Strings[212] +#define key_ssuspend CUR Strings[213] +#define key_sundo CUR Strings[214] +#define req_for_input CUR Strings[215] +#define key_f11 CUR Strings[216] +#define key_f12 CUR Strings[217] +#define key_f13 CUR Strings[218] +#define key_f14 CUR Strings[219] +#define key_f15 CUR Strings[220] +#define key_f16 CUR Strings[221] +#define key_f17 CUR Strings[222] +#define key_f18 CUR Strings[223] +#define key_f19 CUR Strings[224] +#define key_f20 CUR Strings[225] +#define key_f21 CUR Strings[226] +#define key_f22 CUR Strings[227] +#define key_f23 CUR Strings[228] +#define key_f24 CUR Strings[229] +#define key_f25 CUR Strings[230] +#define key_f26 CUR Strings[231] +#define key_f27 CUR Strings[232] +#define key_f28 CUR Strings[233] +#define key_f29 CUR Strings[234] +#define key_f30 CUR Strings[235] +#define key_f31 CUR Strings[236] +#define key_f32 CUR Strings[237] +#define key_f33 CUR Strings[238] +#define key_f34 CUR Strings[239] +#define key_f35 CUR Strings[240] +#define key_f36 CUR Strings[241] +#define key_f37 CUR Strings[242] +#define key_f38 CUR Strings[243] +#define key_f39 CUR Strings[244] +#define key_f40 CUR Strings[245] +#define key_f41 CUR Strings[246] +#define key_f42 CUR Strings[247] +#define key_f43 CUR Strings[248] +#define key_f44 CUR Strings[249] +#define key_f45 CUR Strings[250] +#define key_f46 CUR Strings[251] +#define key_f47 CUR Strings[252] +#define key_f48 CUR Strings[253] +#define key_f49 CUR Strings[254] +#define key_f50 CUR Strings[255] +#define key_f51 CUR Strings[256] +#define key_f52 CUR Strings[257] +#define key_f53 CUR Strings[258] +#define key_f54 CUR Strings[259] +#define key_f55 CUR Strings[260] +#define key_f56 CUR Strings[261] +#define key_f57 CUR Strings[262] +#define key_f58 CUR Strings[263] +#define key_f59 CUR Strings[264] +#define key_f60 CUR Strings[265] +#define key_f61 CUR Strings[266] +#define key_f62 CUR Strings[267] +#define key_f63 CUR Strings[268] +#define clr_bol CUR Strings[269] +#define clear_margins CUR Strings[270] +#define set_left_margin CUR Strings[271] +#define set_right_margin CUR Strings[272] +#define label_format CUR Strings[273] +#define set_clock CUR Strings[274] +#define display_clock CUR Strings[275] +#define remove_clock CUR Strings[276] +#define create_window CUR Strings[277] +#define goto_window CUR Strings[278] +#define hangup CUR Strings[279] +#define dial_phone CUR Strings[280] +#define quick_dial CUR Strings[281] +#define tone CUR Strings[282] +#define pulse CUR Strings[283] +#define flash_hook CUR Strings[284] +#define fixed_pause CUR Strings[285] +#define wait_tone CUR Strings[286] +#define user0 CUR Strings[287] +#define user1 CUR Strings[288] +#define user2 CUR Strings[289] +#define user3 CUR Strings[290] +#define user4 CUR Strings[291] +#define user5 CUR Strings[292] +#define user6 CUR Strings[293] +#define user7 CUR Strings[294] +#define user8 CUR Strings[295] +#define user9 CUR Strings[296] +#define orig_pair CUR Strings[297] +#define orig_colors CUR Strings[298] +#define initialize_color CUR Strings[299] +#define initialize_pair CUR Strings[300] +#define set_color_pair CUR Strings[301] +#define set_foreground CUR Strings[302] +#define set_background CUR Strings[303] +#define change_char_pitch CUR Strings[304] +#define change_line_pitch CUR Strings[305] +#define change_res_horz CUR Strings[306] +#define change_res_vert CUR Strings[307] +#define define_char CUR Strings[308] +#define enter_doublewide_mode CUR Strings[309] +#define enter_draft_quality CUR Strings[310] +#define enter_italics_mode CUR Strings[311] +#define enter_leftward_mode CUR Strings[312] +#define enter_micro_mode CUR Strings[313] +#define enter_near_letter_quality CUR Strings[314] +#define enter_normal_quality CUR Strings[315] +#define enter_shadow_mode CUR Strings[316] +#define enter_subscript_mode CUR Strings[317] +#define enter_superscript_mode CUR Strings[318] +#define enter_upward_mode CUR Strings[319] +#define exit_doublewide_mode CUR Strings[320] +#define exit_italics_mode CUR Strings[321] +#define exit_leftward_mode CUR Strings[322] +#define exit_micro_mode CUR Strings[323] +#define exit_shadow_mode CUR Strings[324] +#define exit_subscript_mode CUR Strings[325] +#define exit_superscript_mode CUR Strings[326] +#define exit_upward_mode CUR Strings[327] +#define micro_column_address CUR Strings[328] +#define micro_down CUR Strings[329] +#define micro_left CUR Strings[330] +#define micro_right CUR Strings[331] +#define micro_row_address CUR Strings[332] +#define micro_up CUR Strings[333] +#define order_of_pins CUR Strings[334] +#define parm_down_micro CUR Strings[335] +#define parm_left_micro CUR Strings[336] +#define parm_right_micro CUR Strings[337] +#define parm_up_micro CUR Strings[338] +#define select_char_set CUR Strings[339] +#define set_bottom_margin CUR Strings[340] +#define set_bottom_margin_parm CUR Strings[341] +#define set_left_margin_parm CUR Strings[342] +#define set_right_margin_parm CUR Strings[343] +#define set_top_margin CUR Strings[344] +#define set_top_margin_parm CUR Strings[345] +#define start_bit_image CUR Strings[346] +#define start_char_set_def CUR Strings[347] +#define stop_bit_image CUR Strings[348] +#define stop_char_set_def CUR Strings[349] +#define subscript_characters CUR Strings[350] +#define superscript_characters CUR Strings[351] +#define these_cause_cr CUR Strings[352] +#define zero_motion CUR Strings[353] +#define char_set_names CUR Strings[354] +#define key_mouse CUR Strings[355] +#define mouse_info CUR Strings[356] +#define req_mouse_pos CUR Strings[357] +#define get_mouse CUR Strings[358] +#define set_a_foreground CUR Strings[359] +#define set_a_background CUR Strings[360] +#define pkey_plab CUR Strings[361] +#define device_type CUR Strings[362] +#define code_set_init CUR Strings[363] +#define set0_des_seq CUR Strings[364] +#define set1_des_seq CUR Strings[365] +#define set2_des_seq CUR Strings[366] +#define set3_des_seq CUR Strings[367] +#define set_lr_margin CUR Strings[368] +#define set_tb_margin CUR Strings[369] +#define bit_image_repeat CUR Strings[370] +#define bit_image_newline CUR Strings[371] +#define bit_image_carriage_return CUR Strings[372] +#define color_names CUR Strings[373] +#define define_bit_image_region CUR Strings[374] +#define end_bit_image_region CUR Strings[375] +#define set_color_band CUR Strings[376] +#define set_page_length CUR Strings[377] +#define display_pc_char CUR Strings[378] +#define enter_pc_charset_mode CUR Strings[379] +#define exit_pc_charset_mode CUR Strings[380] +#define enter_scancode_mode CUR Strings[381] +#define exit_scancode_mode CUR Strings[382] +#define pc_term_options CUR Strings[383] +#define scancode_escape CUR Strings[384] +#define alt_scancode_esc CUR Strings[385] +#define enter_horizontal_hl_mode CUR Strings[386] +#define enter_left_hl_mode CUR Strings[387] +#define enter_low_hl_mode CUR Strings[388] +#define enter_right_hl_mode CUR Strings[389] +#define enter_top_hl_mode CUR Strings[390] +#define enter_vertical_hl_mode CUR Strings[391] +#define set_a_attributes CUR Strings[392] +#define set_pglen_inch CUR Strings[393] + +#define BOOLWRITE 37 +#define NUMWRITE 33 +#define STRWRITE 394 + +/* older synonyms for some capabilities */ +#define beehive_glitch no_esc_ctlc +#define teleray_glitch dest_tabs_magic_smso +#define micro_char_size micro_col_size + +#ifdef __INTERNAL_CAPS_VISIBLE +#define termcap_init2 CUR Strings[394] +#define termcap_reset CUR Strings[395] +#define magic_cookie_glitch_ul CUR Numbers[33] +#define backspaces_with_bs CUR Booleans[37] +#define crt_no_scrolling CUR Booleans[38] +#define no_correctly_working_cr CUR Booleans[39] +#define carriage_return_delay CUR Numbers[34] +#define new_line_delay CUR Numbers[35] +#define linefeed_if_not_lf CUR Strings[396] +#define backspace_if_not_bs CUR Strings[397] +#define gnu_has_meta_key CUR Booleans[40] +#define linefeed_is_newline CUR Booleans[41] +#define backspace_delay CUR Numbers[36] +#define horizontal_tab_delay CUR Numbers[37] +#define number_of_function_keys CUR Numbers[38] +#define other_non_function_keys CUR Strings[398] +#define arrow_key_map CUR Strings[399] +#define has_hardware_tabs CUR Booleans[42] +#define return_does_clr_eol CUR Booleans[43] +#define acs_ulcorner CUR Strings[400] +#define acs_llcorner CUR Strings[401] +#define acs_urcorner CUR Strings[402] +#define acs_lrcorner CUR Strings[403] +#define acs_ltee CUR Strings[404] +#define acs_rtee CUR Strings[405] +#define acs_btee CUR Strings[406] +#define acs_ttee CUR Strings[407] +#define acs_hline CUR Strings[408] +#define acs_vline CUR Strings[409] +#define acs_plus CUR Strings[410] +#define memory_lock CUR Strings[411] +#define memory_unlock CUR Strings[412] +#define box_chars_1 CUR Strings[413] +#endif /* __INTERNAL_CAPS_VISIBLE */ + +/* + * Predefined terminfo array sizes + */ +#define BOOLCOUNT 44 +#define NUMCOUNT 39 +#define STRCOUNT 414 + +/* used by code for comparing entries */ +#define acs_chars_index 146 + +typedef struct termtype { /* in-core form of terminfo data */ + char* term_names; /* str_table offset of term names */ + char* str_table; /* pointer to string table */ + NCURSES_SBOOL* Booleans; /* array of boolean values */ + short* Numbers; /* array of integer values */ + char** Strings; /* array of string offsets */ + +#if NCURSES_XNAMES + char* ext_str_table; /* pointer to extended string table */ + char** ext_Names; /* corresponding names */ + + unsigned short num_Booleans; /* count total Booleans */ + unsigned short num_Numbers; /* count total Numbers */ + unsigned short num_Strings; /* count total Strings */ + + unsigned short ext_Booleans; /* count extensions to Booleans */ + unsigned short ext_Numbers; /* count extensions to Numbers */ + unsigned short ext_Strings; /* count extensions to Strings */ +#endif /* NCURSES_XNAMES */ + +} TERMTYPE; + +/* + * The only reason these structures are visible is for read-only use. + * Programs which modify the data are not, never were, portable across + * curses implementations. + */ +#ifdef NCURSES_INTERNALS + +typedef struct termtype2 { /* in-core form of terminfo data */ + char* term_names; /* str_table offset of term names */ + char* str_table; /* pointer to string table */ + NCURSES_SBOOL* Booleans; /* array of boolean values */ + int* Numbers; /* array of integer values */ + char** Strings; /* array of string offsets */ + +#if NCURSES_XNAMES + char* ext_str_table; /* pointer to extended string table */ + char** ext_Names; /* corresponding names */ + + unsigned short num_Booleans; /* count total Booleans */ + unsigned short num_Numbers; /* count total Numbers */ + unsigned short num_Strings; /* count total Strings */ + + unsigned short ext_Booleans; /* count extensions to Booleans */ + unsigned short ext_Numbers; /* count extensions to Numbers */ + unsigned short ext_Strings; /* count extensions to Strings */ +#endif /* NCURSES_XNAMES */ + +} TERMTYPE2; + +typedef struct term { /* describe an actual terminal */ + TERMTYPE type; /* terminal type description */ + short Filedes; /* file description being written to */ + TTY Ottyb; /* original state of the terminal */ + TTY Nttyb; /* current state of the terminal */ + int _baudrate; /* used to compute padding */ + char* _termname; /* used for termname() */ + TERMTYPE2 type2; /* extended terminal type description */ +} TERMINAL; +#else +typedef struct term TERMINAL; +#endif /* NCURSES_INTERNALS */ + +#if 0 && !0 +extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term; +#elif 0 +NCURSES_WRAPPED_VAR(TERMINAL*, cur_term); +#define cur_term NCURSES_PUBLIC_VAR(cur_term()) +#else +extern NCURSES_EXPORT_VAR(TERMINAL*) cur_term; +#endif + +#if 0 || 0 +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolcodes); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolfnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numcodes); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numfnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strcodes); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strfnames); + +#define boolnames NCURSES_PUBLIC_VAR(boolnames()) +#define boolcodes NCURSES_PUBLIC_VAR(boolcodes()) +#define boolfnames NCURSES_PUBLIC_VAR(boolfnames()) +#define numnames NCURSES_PUBLIC_VAR(numnames()) +#define numcodes NCURSES_PUBLIC_VAR(numcodes()) +#define numfnames NCURSES_PUBLIC_VAR(numfnames()) +#define strnames NCURSES_PUBLIC_VAR(strnames()) +#define strcodes NCURSES_PUBLIC_VAR(strcodes()) +#define strfnames NCURSES_PUBLIC_VAR(strfnames()) + +#else + +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) boolnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) boolcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) boolfnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) numnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) numcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) numfnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) strnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) strcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) strfnames[]; + +#endif + +/* + * These entrypoints are used only by the ncurses utilities such as tic. + */ +#ifdef NCURSES_INTERNALS + +extern NCURSES_EXPORT(int) _nc_set_tty_mode(TTY* buf); +extern NCURSES_EXPORT(int) + _nc_read_entry2(const char* const, char* const, TERMTYPE2* const); +extern NCURSES_EXPORT(int) _nc_read_file_entry(const char* const, TERMTYPE2*); +extern NCURSES_EXPORT(int) _nc_read_termtype(TERMTYPE2*, char*, int); +extern NCURSES_EXPORT(char*) _nc_first_name(const char* const); +extern NCURSES_EXPORT(int) + _nc_name_match(const char* const, const char* const, const char* const); + +#endif /* NCURSES_INTERNALS */ + +/* + * These entrypoints are used by tack. + */ +extern NCURSES_EXPORT(const TERMTYPE*) _nc_fallback(const char*); +extern NCURSES_EXPORT(int) + _nc_read_entry(const char* const, char* const, TERMTYPE* const); + +/* Normal entry points */ +extern NCURSES_EXPORT(TERMINAL*) set_curterm(TERMINAL*); +extern NCURSES_EXPORT(int) del_curterm(TERMINAL*); + +/* miscellaneous entry points */ +extern NCURSES_EXPORT(int) restartterm(NCURSES_CONST char*, int, int*); +extern NCURSES_EXPORT(int) setupterm(NCURSES_CONST char*, int, int*); + +/* terminfo entry points, also declared in curses.h */ +#if !defined(__NCURSES_H) +extern NCURSES_EXPORT(char*) tigetstr(NCURSES_CONST char*); +extern NCURSES_EXPORT_VAR(char) ttytype[]; +extern NCURSES_EXPORT(int) putp(const char*); +extern NCURSES_EXPORT(int) tigetflag(NCURSES_CONST char*); +extern NCURSES_EXPORT(int) tigetnum(NCURSES_CONST char*); + +#if 1 /* NCURSES_TPARM_VARARGS */ +extern NCURSES_EXPORT(char*) tparm(NCURSES_CONST char*, ...); /* special */ +#else +extern NCURSES_EXPORT(char*) tparm( + NCURSES_CONST char*, + long, + long, + long, + long, + long, + long, + long, + long, + long); /* special */ +extern NCURSES_EXPORT(char*) + tparm_varargs(NCURSES_CONST char*, ...); /* special */ +#endif + +extern NCURSES_EXPORT(char*) tiparm(const char*, ...); /* special */ + +#endif /* __NCURSES_H */ + +/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */ +#if !defined(NCURSES_TERMCAP_H_incl) +extern NCURSES_EXPORT(char*) tgetstr(NCURSES_CONST char*, char**); +extern NCURSES_EXPORT(char*) tgoto(const char*, int, int); +extern NCURSES_EXPORT(int) tgetent(char*, const char*); +extern NCURSES_EXPORT(int) tgetflag(NCURSES_CONST char*); +extern NCURSES_EXPORT(int) tgetnum(NCURSES_CONST char*); +extern NCURSES_EXPORT(int) tputs(const char*, int, int (*)(int)); +#endif /* NCURSES_TERMCAP_H_incl */ + +/* + * Include curses.h before term.h to enable these extensions. + */ +#if defined(NCURSES_SP_FUNCS) && (NCURSES_SP_FUNCS != 0) + +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(tigetstr)(SCREEN*, NCURSES_CONST char*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(putp)(SCREEN*, const char*); +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(tigetflag)(SCREEN*, NCURSES_CONST char*); +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(tigetnum)(SCREEN*, NCURSES_CONST char*); + +#if 1 /* NCURSES_TPARM_VARARGS */ +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(tparm)(SCREEN*, NCURSES_CONST char*, ...); /* special */ +#else +extern NCURSES_EXPORT(char*) NCURSES_SP_NAME(tparm)( + SCREEN*, + NCURSES_CONST char*, + long, + long, + long, + long, + long, + long, + long, + long, + long); /* special */ +extern NCURSES_EXPORT(char*) NCURSES_SP_NAME( + tparm_varargs)(SCREEN*, NCURSES_CONST char*, ...); /* special */ +#endif + +/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */ +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(tgetstr)(SCREEN*, NCURSES_CONST char*, char**); +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(tgoto)(SCREEN*, const char*, int, int); +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(tgetent)(SCREEN*, char*, const char*); +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(tgetflag)(SCREEN*, NCURSES_CONST char*); +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(tgetnum)(SCREEN*, NCURSES_CONST char*); +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(tputs)(SCREEN*, const char*, int, NCURSES_SP_OUTC); + +extern NCURSES_EXPORT(TERMINAL*) + NCURSES_SP_NAME(set_curterm)(SCREEN*, TERMINAL*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(del_curterm)(SCREEN*, TERMINAL*); + +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(restartterm)(SCREEN*, NCURSES_CONST char*, int, int*); +#endif /* NCURSES_SP_FUNCS */ + +#ifdef __cplusplus +} +#endif + +#endif /* NCURSES_TERM_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/term_entry.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/term_entry.h new file mode 100644 index 0000000..f62326b --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/term_entry.h @@ -0,0 +1,252 @@ +/**************************************************************************** + * Copyright (c) 1998-2015,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1998-on * + ****************************************************************************/ + +/* $Id: term_entry.h,v 1.55 2017/04/06 22:45:34 tom Exp $ */ + +/* + * term_entry.h -- interface to entry-manipulation code + */ + +#ifndef NCURSES_TERM_ENTRY_H_incl +#define NCURSES_TERM_ENTRY_H_incl 1 +/* *INDENT-OFF* */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * These macros may be used by programs that know about TERMTYPE: + */ +#if NCURSES_XNAMES +#define NUM_BOOLEANS(tp) (tp)->num_Booleans +#define NUM_NUMBERS(tp) (tp)->num_Numbers +#define NUM_STRINGS(tp) (tp)->num_Strings +#define EXT_NAMES(tp, i, limit, index, table) \ + (i >= limit) ? tp->ext_Names[index] : table[i] +#else +#define NUM_BOOLEANS(tp) BOOLCOUNT +#define NUM_NUMBERS(tp) NUMCOUNT +#define NUM_STRINGS(tp) STRCOUNT +#define EXT_NAMES(tp, i, limit, index, table) table[i] +#endif + +#define NUM_EXT_NAMES(tp) \ + (unsigned)((tp)->ext_Booleans + (tp)->ext_Numbers + (tp)->ext_Strings) + +#define for_each_boolean(n, tp) for (n = 0; n < NUM_BOOLEANS(tp); n++) +#define for_each_number(n, tp) for (n = 0; n < NUM_NUMBERS(tp); n++) +#define for_each_string(n, tp) for (n = 0; n < NUM_STRINGS(tp); n++) + +#if NCURSES_XNAMES +#define for_each_ext_boolean(n, tp) \ + for (n = BOOLCOUNT; (int)n < (int)NUM_BOOLEANS(tp); n++) +#define for_each_ext_number(n, tp) \ + for (n = NUMCOUNT; (int)n < (int)NUM_NUMBERS(tp); n++) +#define for_each_ext_string(n, tp) \ + for (n = STRCOUNT; (int)n < (int)NUM_STRINGS(tp); n++) +#endif + +#define ExtBoolname(tp, i, names) \ + EXT_NAMES( \ + tp, i, BOOLCOUNT, (i - (tp->num_Booleans - tp->ext_Booleans)), names) +#define ExtNumname(tp, i, names) \ + EXT_NAMES( \ + tp, \ + i, \ + NUMCOUNT, \ + (i - (tp->num_Numbers - tp->ext_Numbers)) + tp->ext_Booleans, \ + names) +#define ExtStrname(tp, i, names) \ + EXT_NAMES( \ + tp, \ + i, \ + STRCOUNT, \ + (i - (tp->num_Strings - tp->ext_Strings)) + \ + (tp->ext_Numbers + tp->ext_Booleans), \ + names) + +/* + * The remaining type-definitions and macros are used only internally by the + * ncurses utilities. + */ +#ifdef NCURSES_INTERNALS + +/* + * see db_iterator.c - this enumeration lists the places searched for a + * terminal description and defines the order in which they are searched. + */ +typedef enum { + dbdTIC = 0, /* special, used by tic when writing entry */ +#if NCURSES_USE_DATABASE + dbdEnvOnce, /* the $TERMINFO environment variable */ + dbdHome, /* $HOME/.terminfo */ + dbdEnvList, /* the $TERMINFO_DIRS environment variable */ + dbdCfgList, /* the compiled-in TERMINFO_DIRS value */ + dbdCfgOnce, /* the compiled-in TERMINFO value */ +#endif +#if NCURSES_USE_TERMCAP + dbdEnvOnce2, /* the $TERMCAP environment variable */ + dbdEnvList2, /* the $TERMPATH environment variable */ + dbdCfgList2, /* the compiled-in TERMPATH */ +#endif + dbdLAST +} DBDIRS; + +#define MAX_USES 32 +#define MAX_CROSSLINKS 16 + +typedef struct entry ENTRY; + +typedef struct { + char* name; + ENTRY* link; + long line; +} ENTRY_USES; + +struct entry { + TERMTYPE2 tterm; + unsigned nuses; + ENTRY_USES uses[MAX_USES]; + int ncrosslinks; + ENTRY* crosslinks[MAX_CROSSLINKS]; + long cstart; + long cend; + long startline; + ENTRY* next; + ENTRY* last; +}; + +extern NCURSES_EXPORT_VAR(ENTRY*) _nc_head; +extern NCURSES_EXPORT_VAR(ENTRY*) _nc_tail; +#define for_entry_list(qp) for (qp = _nc_head; qp; qp = qp->next) + +#define MAX_LINE 132 + +#define NULLHOOK (bool (*)(ENTRY*))0 + +/* + * Note that WANTED and PRESENT are not simple inverses! If a capability + * has been explicitly cancelled, it's not considered WANTED. + */ +#define WANTED(s) ((s) == ABSENT_STRING) +#define PRESENT(s) (((s) != ABSENT_STRING) && ((s) != CANCELLED_STRING)) + +#define ANDMISSING(p, q) \ + { \ + if (PRESENT(p) && !PRESENT(q)) \ + _nc_warning(#p " but no " #q); \ + } + +#define PAIRED(p, q) \ + { \ + if (PRESENT(q) && !PRESENT(p)) \ + _nc_warning(#q " but no " #p); \ + if (PRESENT(p) && !PRESENT(q)) \ + _nc_warning(#p " but no " #q); \ + } + +/* + * These entrypoints are used only by the ncurses utilities such as tic. + */ + +/* alloc_entry.c: elementary allocation code */ +extern NCURSES_EXPORT(ENTRY*) _nc_copy_entry(ENTRY* oldp); +extern NCURSES_EXPORT(char*) _nc_save_str(const char* const); +extern NCURSES_EXPORT(void) _nc_init_entry(ENTRY* const); +extern NCURSES_EXPORT(void) _nc_merge_entry(ENTRY* const, ENTRY* const); +extern NCURSES_EXPORT(void) _nc_wrap_entry(ENTRY* const, bool); + +/* alloc_ttype.c: elementary allocation code */ +extern NCURSES_EXPORT(void) _nc_align_termtype(TERMTYPE2*, TERMTYPE2*); + +/* free_ttype.c: elementary allocation code */ +extern NCURSES_EXPORT(void) _nc_free_termtype2(TERMTYPE2*); + +/* lib_termcap.c: trim sgr0 string for termcap users */ +extern NCURSES_EXPORT(char*) _nc_trim_sgr0(TERMTYPE2*); + +/* parse_entry.c: entry-parsing code */ +#if NCURSES_XNAMES +extern NCURSES_EXPORT_VAR(bool) _nc_user_definable; +extern NCURSES_EXPORT_VAR(bool) _nc_disable_period; +#endif +extern NCURSES_EXPORT(int) _nc_parse_entry(ENTRY*, int, bool); +extern NCURSES_EXPORT(int) _nc_capcmp(const char*, const char*); + +/* write_entry.c: writing an entry to the file system */ +extern NCURSES_EXPORT(void) _nc_set_writedir(const char*); +extern NCURSES_EXPORT(void) _nc_write_entry(TERMTYPE2* const); +extern NCURSES_EXPORT(int) + _nc_write_object(TERMTYPE2*, char*, unsigned*, unsigned); + +/* comp_parse.c: entry list handling */ +extern NCURSES_EXPORT(void) + _nc_read_entry_source(FILE*, char*, int, bool, bool (*)(ENTRY*)); +extern NCURSES_EXPORT(bool) _nc_entry_match(char*, char*); +extern NCURSES_EXPORT(int) _nc_resolve_uses(bool); /* obs 20040705 */ +extern NCURSES_EXPORT(int) _nc_resolve_uses2(bool, bool); +extern NCURSES_EXPORT(void) _nc_free_entries(ENTRY*); +extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype)( + TERMTYPE*); /* obs 20040705 */ +extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype2)(TERMTYPE2*, bool); + +/* trace_xnames.c */ +extern NCURSES_EXPORT(void) _nc_trace_xnames(TERMTYPE*); + +#endif /* NCURSES_INTERNALS */ + +/* + * These entrypoints are used by tack. + */ + +/* alloc_ttype.c: elementary allocation code */ +extern NCURSES_EXPORT(void) _nc_copy_termtype(TERMTYPE*, const TERMTYPE*); + +/* lib_acs.c */ +extern NCURSES_EXPORT(void) + _nc_init_acs(void); /* corresponds to traditional 'init_acs()' */ + +/* free_ttype.c: elementary allocation code */ +extern NCURSES_EXPORT(void) _nc_free_termtype(TERMTYPE*); + +#ifdef __cplusplus +} +#endif + +/* *INDENT-ON* */ + +#endif /* NCURSES_TERM_ENTRY_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/termcap.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/termcap.h new file mode 100644 index 0000000..8bad007 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/termcap.h @@ -0,0 +1,74 @@ +/**************************************************************************** + * Copyright (c) 1998-2000,2001 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* $Id: termcap.h.in,v 1.17 2001/03/24 21:53:27 tom Exp $ */ + +#ifndef NCURSES_TERMCAP_H_incl +#define NCURSES_TERMCAP_H_incl 1 + +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.1" + +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include + +#undef NCURSES_CONST +#define NCURSES_CONST const + +#undef NCURSES_OSPEED +#define NCURSES_OSPEED short + +extern NCURSES_EXPORT_VAR(char) PC; +extern NCURSES_EXPORT_VAR(char*) UP; +extern NCURSES_EXPORT_VAR(char*) BC; +extern NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed; + +#if !defined(NCURSES_TERM_H_incl) +extern NCURSES_EXPORT(char*) tgetstr(NCURSES_CONST char*, char**); +extern NCURSES_EXPORT(char*) tgoto(const char*, int, int); +extern NCURSES_EXPORT(int) tgetent(char*, const char*); +extern NCURSES_EXPORT(int) tgetflag(NCURSES_CONST char*); +extern NCURSES_EXPORT(int) tgetnum(NCURSES_CONST char*); +extern NCURSES_EXPORT(int) tputs(const char*, int, int (*)(int)); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* NCURSES_TERMCAP_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/tic.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/tic.h new file mode 100644 index 0000000..fd2c5e6 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/tic.h @@ -0,0 +1,369 @@ +/**************************************************************************** + * Copyright (c) 1998-2012,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996 on * + ****************************************************************************/ + +/* + * $Id: tic.h,v 1.75 2017/07/29 23:21:06 tom Exp $ + * tic.h - Global variables and structures for the terminfo compiler. + */ + +#ifndef __TIC_H +#define __TIC_H +/* *INDENT-OFF* */ +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include /* for the _tracef() prototype, ERR/OK, bool defs */ + +/* +** The format of SVr2 compiled terminfo files is as follows: +** +** Header (12 bytes), containing information given below +** Names Section, containing the names of the terminal +** Boolean Section, containing the values of all of the +** boolean capabilities +** A null byte may be inserted here to make +** sure that the Number Section begins on an +** even word boundary. +** Number Section, containing the values of all of the numeric +** capabilities, each as a short integer +** String Section, containing short integer offsets into the +** String Table, one per string capability +** String Table, containing the actual characters of the string +** capabilities. +** +** In the SVr2 format, "short" means signed 16-bit numbers, which is sometimes +** inconvenient. The numbers are signed, to provide for absent and canceled +** values. ncurses6.1 introduced an extension to this compiled format, by +** making the Number Section a list of signed 32-bit integers. +** +** NOTE that all short integers in the file are stored using VAX/PDP-style +** byte-order, i.e., least-significant byte first. +** +** There is no structure definition here because it would only confuse +** matters. Terminfo format is a raw byte layout, not a structure +** dump. If you happen to be on a little-endian machine with 16-bit +** shorts that requires no padding between short members in a struct, +** then there is a natural C structure that captures the header, but +** not very helpfully. +*/ + +#define MAGIC 0432 /* first two bytes of a compiled entry */ +#define MAGIC2 01036 /* first two bytes of a compiled 32-bit entry */ + +#undef BYTE +#define BYTE(p, n) (unsigned char)((p)[n]) + +#define IS_NEG1(p) ((BYTE(p, 0) == 0377) && (BYTE(p, 1) == 0377)) +#define IS_NEG2(p) ((BYTE(p, 0) == 0376) && (BYTE(p, 1) == 0377)) +#define LOW_MSB(p) (BYTE(p, 0) + 256 * BYTE(p, 1)) + +#define IS_TIC_MAGIC(p) (LOW_MSB(p) == MAGIC || LOW_MSB(p) == MAGIC2) + +#define quick_prefix(s) (!strncmp((s), "b64:", 4) || !strncmp((s), "hex:", 4)) + +/* + * The "maximum" here is misleading; XSI guarantees minimum values, which a + * given implementation may exceed. + */ +#define MAX_NAME_SIZE 512 /* maximum legal name field size (XSI:127) */ +#define MAX_ENTRY_SIZE1 4096 /* maximum legal entry size (SVr2) */ +#define MAX_ENTRY_SIZE2 32768 /* maximum legal entry size (ncurses6.1) */ + +#if NCURSES_EXT_COLORS && HAVE_INIT_EXTENDED_COLOR +#define MAX_ENTRY_SIZE MAX_ENTRY_SIZE2 +#else +#define MAX_ENTRY_SIZE MAX_ENTRY_SIZE1 +#endif + +/* + * The maximum size of individual name or alias is guaranteed in XSI to be at + * least 14, since that corresponds to the older filename lengths. Newer + * systems allow longer aliases, though not many terminal descriptions are + * written to use them. The MAX_ALIAS symbol is used for warnings. + */ +#if HAVE_LONG_FILE_NAMES +#define MAX_ALIAS 32 /* smaller than POSIX minimum for PATH_MAX */ +#else +#define MAX_ALIAS 14 /* SVr3 filename length */ +#endif + +/* location of user's personal info directory */ +#define PRIVATE_INFO "%s/.terminfo" /* plug getenv("HOME") into %s */ + +/* + * Some traces are designed to be used via tic's verbose option (and similar in + * infocmp and toe) rather than the 'trace()' function. So we use the bits + * above the normal trace() parameter as a debug-level. + */ + +#define MAX_DEBUG_LEVEL 15 +#define DEBUG_LEVEL(n) ((n) << TRACE_SHIFT) + +#define set_trace_level(n) \ + _nc_tracing &= \ + DEBUG_LEVEL(MAX_DEBUG_LEVEL) + DEBUG_LEVEL(MAX_DEBUG_LEVEL) - 1, \ + _nc_tracing |= DEBUG_LEVEL(n) + +#ifdef TRACE +#define DEBUG(n, a) \ + if (_nc_tracing >= DEBUG_LEVEL(n)) \ + _tracef a +#else +#define DEBUG(n, a) /*nothing*/ +#endif + +/* + * These are the types of tokens returned by the scanner. The first + * three are also used in the hash table of capability names. The scanner + * returns one of these values after loading the specifics into the global + * structure curr_token. + */ + +#define BOOLEAN 0 /* Boolean capability */ +#define NUMBER 1 /* Numeric capability */ +#define STRING 2 /* String-valued capability */ +#define CANCEL 3 /* Capability to be cancelled in following tc's */ +#define NAMES 4 /* The names for a terminal type */ +#define UNDEF 5 /* Undefined */ + +#define NO_PUSHBACK -1 /* used in pushtype to indicate no pushback */ + +/* + * The global structure in which the specific parts of a + * scanned token are returned. + */ + +struct token { + char* tk_name; /* name of capability */ + int tk_valnumber; /* value of capability (if a number) */ + char* tk_valstring; /* value of capability (if a string) */ +}; + +/* + * Offsets to string capabilities, with the corresponding functionkey codes. + */ +struct tinfo_fkeys { + unsigned offset; + chtype code; +}; + +typedef short HashValue; + +/* + * The file comp_captab.c contains an array of these structures, one per + * possible capability. These are indexed by a hash table array of pointers to + * the same structures for use by the parser. + */ +struct name_table_entry { + const char* nte_name; /* name to hash on */ + int nte_type; /* BOOLEAN, NUMBER or STRING */ + HashValue nte_index; /* index of associated variable in its array */ + HashValue nte_link; /* index in table of next hash, or -1 */ +}; + +/* + * Use this structure to hide differences between terminfo and termcap tables. + */ +typedef struct { + unsigned table_size; + const HashValue* table_data; + HashValue (*hash_of)(const char*); + int (*compare_names)(const char*, const char*); +} HashData; + +struct alias { + const char* from; + const char* to; + const char* source; +}; + +#define NOTFOUND ((struct name_table_entry*)0) + +/* + * The casts are required for correct sign-propagation with systems such as + * AIX, IRIX64, Solaris which default to unsigned characters. The C standard + * leaves this detail unspecified. + */ + +/* out-of-band values for representing absent capabilities */ +#define ABSENT_BOOLEAN ((signed char)-1) /* 255 */ +#define ABSENT_NUMERIC (-1) +#define ABSENT_STRING (char*)0 + +/* out-of-band values for representing cancels */ +#define CANCELLED_BOOLEAN ((signed char)-2) /* 254 */ +#define CANCELLED_NUMERIC (-2) +#define CANCELLED_STRING (char*)(-1) + +#define VALID_BOOLEAN(s) ((unsigned char)(s) <= 1) /* reject "-1" */ +#define VALID_NUMERIC(s) ((s) >= 0) +#define VALID_STRING(s) ((s) != CANCELLED_STRING && (s) != ABSENT_STRING) + +/* termcap entries longer than this may break old binaries */ +#define MAX_TERMCAP_LENGTH 1023 + +/* this is a documented limitation of terminfo */ +#define MAX_TERMINFO_LENGTH 4096 + +#ifndef TERMINFO +#define TERMINFO "/usr/share/terminfo" +#endif + +#ifdef NCURSES_TERM_ENTRY_H_incl + +/* + * These entrypoints are used only by the ncurses utilities such as tic. + */ +#ifdef NCURSES_INTERNALS +/* access.c */ +extern NCURSES_EXPORT(unsigned) _nc_pathlast(const char*); +extern NCURSES_EXPORT(bool) _nc_is_abs_path(const char*); +extern NCURSES_EXPORT(bool) _nc_is_dir_path(const char*); +extern NCURSES_EXPORT(bool) _nc_is_file_path(const char*); +extern NCURSES_EXPORT(char*) _nc_basename(char*); +extern NCURSES_EXPORT(char*) _nc_rootname(char*); + +/* comp_captab.c */ +extern NCURSES_EXPORT(const struct name_table_entry*) _nc_get_table(bool); +extern NCURSES_EXPORT(const HashData*) _nc_get_hash_info(bool); +extern NCURSES_EXPORT(const struct alias*) _nc_get_alias_table(bool); + +/* comp_hash.c: name lookup */ +extern NCURSES_EXPORT(struct name_table_entry const*) + _nc_find_type_entry(const char*, int, bool); + +/* comp_scan.c: lexical analysis */ +extern NCURSES_EXPORT(int) _nc_get_token(bool); +extern NCURSES_EXPORT(void) _nc_panic_mode(char); +extern NCURSES_EXPORT(void) _nc_push_token(int); +extern NCURSES_EXPORT_VAR(int) _nc_curr_col; +extern NCURSES_EXPORT_VAR(int) _nc_curr_line; +extern NCURSES_EXPORT_VAR(int) _nc_syntax; +extern NCURSES_EXPORT_VAR(int) _nc_strict_bsd; +extern NCURSES_EXPORT_VAR(long) _nc_comment_end; +extern NCURSES_EXPORT_VAR(long) _nc_comment_start; +extern NCURSES_EXPORT_VAR(long) _nc_curr_file_pos; +extern NCURSES_EXPORT_VAR(long) _nc_start_line; +#define SYN_TERMINFO 0 +#define SYN_TERMCAP 1 + +/* comp_error.c: warning & abort messages */ +extern NCURSES_EXPORT(const char*) _nc_get_source(void); +extern NCURSES_EXPORT(void) _nc_err_abort(const char* const, ...) + GCC_PRINTFLIKE(1, 2) GCC_NORETURN; +extern NCURSES_EXPORT(void) _nc_get_type(char* name); +extern NCURSES_EXPORT(void) _nc_set_source(const char* const); +extern NCURSES_EXPORT(void) _nc_set_type(const char* const); +extern NCURSES_EXPORT(void) _nc_syserr_abort(const char* const, ...) + GCC_PRINTFLIKE(1, 2) GCC_NORETURN; +extern NCURSES_EXPORT(void) _nc_warning(const char* const, ...) + GCC_PRINTFLIKE(1, 2); +extern NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings; + +/* comp_scan.c */ +extern NCURSES_EXPORT_VAR(struct token) _nc_curr_token; + +/* captoinfo.c: capability conversion */ +extern NCURSES_EXPORT(char*) _nc_captoinfo(const char*, const char*, int const); +extern NCURSES_EXPORT(char*) _nc_infotocap(const char*, const char*, int const); + +/* home_terminfo.c */ +extern NCURSES_EXPORT(char*) _nc_home_terminfo(void); + +/* init_keytry.c */ +#if BROKEN_LINKER +#define _nc_tinfo_fkeys _nc_tinfo_fkeysf() +extern NCURSES_EXPORT(const struct tinfo_fkeys*) _nc_tinfo_fkeysf(void); +#else +extern NCURSES_EXPORT_VAR(const struct tinfo_fkeys) _nc_tinfo_fkeys[]; +#endif + +/* lib_tparm.c */ +#define NUM_PARM 9 + +extern NCURSES_EXPORT_VAR(int) _nc_tparm_err; + +extern NCURSES_EXPORT(int) _nc_tparm_analyze(const char*, char**, int*); + +/* lib_trace.c */ +extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing; +extern NCURSES_EXPORT(const char*) _nc_visbuf(const char*); +extern NCURSES_EXPORT(const char*) _nc_visbuf2(int, const char*); + +/* lib_tputs.c */ +extern NCURSES_EXPORT_VAR(int) _nc_nulls_sent; /* Add one for every null sent */ + +/* comp_main.c: compiler main */ +extern const char* _nc_progname; + +/* db_iterator.c */ +extern NCURSES_EXPORT(const char*) _nc_next_db(DBDIRS*, int*); +extern NCURSES_EXPORT(const char*) _nc_tic_dir(const char*); +extern NCURSES_EXPORT(void) _nc_first_db(DBDIRS*, int*); +extern NCURSES_EXPORT(void) _nc_last_db(void); + +/* write_entry.c */ +extern NCURSES_EXPORT(int) _nc_tic_written(void); + +#endif /* NCURSES_INTERNALS */ + +/* + * These entrypoints are used by tack. + */ + +/* comp_hash.c: name lookup */ +extern NCURSES_EXPORT(struct name_table_entry const*) + _nc_find_entry(const char*, const HashValue*); +extern NCURSES_EXPORT(const HashValue*) _nc_get_hash_table(bool); + +/* comp_scan.c: lexical analysis */ +extern NCURSES_EXPORT(void) _nc_reset_input(FILE*, char*); + +/* comp_expand.c: expand string into readable form */ +extern NCURSES_EXPORT(char*) _nc_tic_expand(const char*, bool, int); + +/* comp_scan.c: decode string from readable form */ +extern NCURSES_EXPORT(int) _nc_trans_string(char*, char*); + +#endif /* NCURSES_TERM_ENTRY_H_incl */ + +#ifdef __cplusplus +} +#endif + +/* *INDENT-ON* */ +#endif /* __TIC_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/unctrl.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/unctrl.h new file mode 100644 index 0000000..581f6a5 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses/unctrl.h @@ -0,0 +1,67 @@ +/**************************************************************************** + * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* + * unctrl.h + * + * Display a printable version of a control character. + * Control characters are displayed in caret notation (^x), DELETE is displayed + * as ^?. Printable characters are displayed as is. + */ + +/* $Id: unctrl.h.in,v 1.11 2009/04/18 21:00:52 tom Exp $ */ + +#ifndef NCURSES_UNCTRL_H_incl +#define NCURSES_UNCTRL_H_incl 1 + +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.1" + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#undef unctrl +NCURSES_EXPORT(NCURSES_CONST char*) unctrl(chtype); + +#if 1 +NCURSES_EXPORT(NCURSES_CONST char*) NCURSES_SP_NAME(unctrl)(SCREEN*, chtype); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* NCURSES_UNCTRL_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses_dll.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses_dll.h new file mode 100644 index 0000000..240f606 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncurses_dll.h @@ -0,0 +1,103 @@ +/**************************************************************************** + * Copyright (c) 1998-2009,2014 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ +/* $Id: ncurses_dll.h.in,v 1.9 2014/08/02 21:30:20 tom Exp $ */ + +#ifndef NCURSES_DLL_H_incl +#define NCURSES_DLL_H_incl 1 + +/* 2014-08-02 workaround for broken MinGW compiler. + * Oddly, only TRACE is mapped to trace - the other -D's are okay. + * suggest TDM as an alternative. + */ +#if defined(__MINGW64__) +#elif defined(__MINGW32__) +#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) + +#ifdef trace +#undef trace +#define TRACE +#endif + +#endif /* broken compiler */ +#endif /* MingW */ + +/* + * For reentrant code, we map the various global variables into SCREEN by + * using functions to access them. + */ +#define NCURSES_PUBLIC_VAR(name) _nc_##name +#define NCURSES_WRAPPED_VAR(type, name) \ + extern type NCURSES_PUBLIC_VAR(name)(void) + +/* no longer needed on cygwin or mingw, thanks to auto-import */ +/* but this structure may be useful at some point for an MSVC build */ +/* so, for now unconditionally define the important flags */ +/* "the right way" for proper static and dll+auto-import behavior */ +#undef NCURSES_DLL +#define NCURSES_STATIC + +#if defined(__CYGWIN__) || defined(__MINGW32__) +#if defined(NCURSES_DLL) +#if defined(NCURSES_STATIC) +#undef NCURSES_STATIC +#endif +#endif +#undef NCURSES_IMPEXP +#undef NCURSES_API +#undef NCURSES_EXPORT +#undef NCURSES_EXPORT_VAR +#if defined(NCURSES_DLL) +/* building a DLL */ +#define NCURSES_IMPEXP __declspec(dllexport) +#elif defined(NCURSES_STATIC) +/* building or linking to a static library */ +#define NCURSES_IMPEXP /* nothing */ +#else +/* linking to the DLL */ +#define NCURSES_IMPEXP __declspec(dllimport) +#endif +#define NCURSES_API __cdecl +#define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API +#define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type +#endif + +/* Take care of non-cygwin platforms */ +#if !defined(NCURSES_IMPEXP) +#define NCURSES_IMPEXP /* nothing */ +#endif +#if !defined(NCURSES_API) +#define NCURSES_API /* nothing */ +#endif +#if !defined(NCURSES_EXPORT) +#define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API +#endif +#if !defined(NCURSES_EXPORT_VAR) +#define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type +#endif + +#endif /* NCURSES_DLL_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/curses.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/curses.h new file mode 100644 index 0000000..1512dc4 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/curses.h @@ -0,0 +1,2456 @@ +/**************************************************************************** + * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* $Id: curses.h.in,v 1.257 2017/11/21 00:11:37 tom Exp $ */ + +#ifndef __NCURSES_H +#define __NCURSES_H + +#define CURSES 1 +#define CURSES_H 1 + +/* These are defined only in curses.h, and are used for conditional compiles */ +#define NCURSES_VERSION_MAJOR 6 +#define NCURSES_VERSION_MINOR 1 +#define NCURSES_VERSION_PATCH 20180127 + +/* This is defined in more than one ncurses header, for identification */ +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.1" + +/* + * Identify the mouse encoding version. + */ +#define NCURSES_MOUSE_VERSION 2 + +/* + * Definitions to facilitate DLL's. + */ +#include + +#if 1 +#include +#endif + +/* + * User-definable tweak to disable the include of . + */ +#ifndef NCURSES_ENABLE_STDBOOL_H +#define NCURSES_ENABLE_STDBOOL_H 1 +#endif + +/* + * NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses + * configured using --disable-macros. + */ +#ifndef NCURSES_ATTR_T +#define NCURSES_ATTR_T int +#endif + +/* + * Expands to 'const' if ncurses is configured using --enable-const. Note that + * doing so makes it incompatible with other implementations of X/Open Curses. + */ +#undef NCURSES_CONST +#define NCURSES_CONST const + +#undef NCURSES_INLINE +#define NCURSES_INLINE inline + +/* + * The standard type used for color values, and for color-pairs. The latter + * allows the curses library to enumerate the combinations of foreground and + * background colors used by an application, and is normally the product of the + * total foreground and background colors. + * + * X/Open uses "short" for both of these types, ultimately because they are + * numbers from the SVr4 terminal database, which uses 16-bit signed values. + */ +#undef NCURSES_COLOR_T +#define NCURSES_COLOR_T short + +#undef NCURSES_PAIRS_T +#define NCURSES_PAIRS_T short + +/* + * Definitions used to make WINDOW and similar structs opaque. + */ +#ifndef NCURSES_INTERNALS +#define NCURSES_OPAQUE 0 +#define NCURSES_OPAQUE_FORM 0 +#define NCURSES_OPAQUE_MENU 0 +#define NCURSES_OPAQUE_PANEL 0 +#endif + +/* + * Definition used to optionally suppress wattr* macros to help with the + * transition from ncurses5 to ncurses6 by allowing the header files to + * be shared across development packages for ncursesw in both ABIs. + */ +#ifndef NCURSES_WATTR_MACROS +#define NCURSES_WATTR_MACROS 1 +#endif + +/* + * The reentrant code relies on the opaque setting, but adds features. + */ +#ifndef NCURSES_REENTRANT +#define NCURSES_REENTRANT 0 +#endif + +/* + * Control whether bindings for interop support are added. + */ +#undef NCURSES_INTEROP_FUNCS +#define NCURSES_INTEROP_FUNCS 1 + +/* + * The internal type used for window dimensions. + */ +#undef NCURSES_SIZE_T +#define NCURSES_SIZE_T short + +/* + * Control whether tparm() supports varargs or fixed-parameter list. + */ +#undef NCURSES_TPARM_VARARGS +#define NCURSES_TPARM_VARARGS 1 + +/* + * Control type used for tparm's arguments. While X/Open equates long and + * char* values, this is not always workable for 64-bit platforms. + */ +#undef NCURSES_TPARM_ARG +#define NCURSES_TPARM_ARG intptr_t + +/* + * Control whether ncurses uses wcwidth() for checking width of line-drawing + * characters. + */ +#undef NCURSES_WCWIDTH_GRAPHICS +#define NCURSES_WCWIDTH_GRAPHICS 1 + +/* + * NCURSES_CH_T is used in building the library, but not used otherwise in + * this header file, since that would make the normal/wide-character versions + * of the header incompatible. + */ +#undef NCURSES_CH_T +#define NCURSES_CH_T cchar_t + +#if 1 && defined(_LP64) +typedef unsigned chtype; +typedef unsigned mmask_t; +#else +typedef uint32_t chtype; +typedef uint32_t mmask_t; +#endif + +/* + * We need FILE, etc. Include this before checking any feature symbols. + */ +#include + +/* + * With XPG4, you must define _XOPEN_SOURCE_EXTENDED, it is redundant (or + * conflicting) when _XOPEN_SOURCE is 500 or greater. If NCURSES_WIDECHAR is + * not already defined, e.g., if the platform relies upon nonstandard feature + * test macros, define it at this point if the standard feature test macros + * indicate that it should be defined. + */ +#ifndef NCURSES_WIDECHAR +#if defined(_XOPEN_SOURCE_EXTENDED) || \ + (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 >= 500)) +#define NCURSES_WIDECHAR 1 +#else +#define NCURSES_WIDECHAR 0 +#endif +#endif /* NCURSES_WIDECHAR */ + +#include /* we need va_list */ +#if NCURSES_WIDECHAR +#include /* we want wchar_t */ +#endif + +/* X/Open and SVr4 specify that curses implements 'bool'. However, C++ may also + * implement it. If so, we must use the C++ compiler's type to avoid conflict + * with other interfaces. + * + * A further complication is that may declare 'bool' to be a + * different type, such as an enum which is not necessarily compatible with + * C++. If we have , make 'bool' a macro, so users may #undef it. + * Otherwise, let it remain a typedef to avoid conflicts with other #define's. + * In either case, make a typedef for NCURSES_BOOL which can be used if needed + * from either C or C++. + */ + +#undef TRUE +#define TRUE 1 + +#undef FALSE +#define FALSE 0 + +typedef unsigned char NCURSES_BOOL; + +#if defined(__cplusplus) /* __cplusplus, etc. */ + +/* use the C++ compiler's bool type */ +#define NCURSES_BOOL bool + +#else /* c89, c99, etc. */ + +#if NCURSES_ENABLE_STDBOOL_H +#include +/* use whatever the C compiler decides bool really is */ +#define NCURSES_BOOL bool +#else +/* there is no predefined bool - use our own */ +#undef bool +#define bool NCURSES_BOOL +#endif + +#endif /* !__cplusplus, etc. */ + +#ifdef __cplusplus +extern "C" { +#define NCURSES_CAST(type, value) static_cast(value) +#else +#define NCURSES_CAST(type, value) (type)(value) +#endif + +#define NCURSES_OK_ADDR(p) (0 != NCURSES_CAST(const void*, (p))) + +/* + * X/Open attributes. In the ncurses implementation, they are identical to the + * A_ attributes. + */ +#define WA_ATTRIBUTES A_ATTRIBUTES +#define WA_NORMAL A_NORMAL +#define WA_STANDOUT A_STANDOUT +#define WA_UNDERLINE A_UNDERLINE +#define WA_REVERSE A_REVERSE +#define WA_BLINK A_BLINK +#define WA_DIM A_DIM +#define WA_BOLD A_BOLD +#define WA_ALTCHARSET A_ALTCHARSET +#define WA_INVIS A_INVIS +#define WA_PROTECT A_PROTECT +#define WA_HORIZONTAL A_HORIZONTAL +#define WA_LEFT A_LEFT +#define WA_LOW A_LOW +#define WA_RIGHT A_RIGHT +#define WA_TOP A_TOP +#define WA_VERTICAL A_VERTICAL + +#if 1 +#define WA_ITALIC A_ITALIC /* ncurses extension */ +#endif + +/* colors */ +#define COLOR_BLACK 0 +#define COLOR_RED 1 +#define COLOR_GREEN 2 +#define COLOR_YELLOW 3 +#define COLOR_BLUE 4 +#define COLOR_MAGENTA 5 +#define COLOR_CYAN 6 +#define COLOR_WHITE 7 + +/* line graphics */ + +#if 0 || NCURSES_REENTRANT +NCURSES_WRAPPED_VAR(chtype*, acs_map); +#define acs_map NCURSES_PUBLIC_VAR(acs_map()) +#else +extern NCURSES_EXPORT_VAR(chtype) acs_map[]; +#endif + +#define NCURSES_ACS(c) (acs_map[NCURSES_CAST(unsigned char, (c))]) + +/* VT100 symbols begin here */ +#define ACS_ULCORNER NCURSES_ACS('l') /* upper left corner */ +#define ACS_LLCORNER NCURSES_ACS('m') /* lower left corner */ +#define ACS_URCORNER NCURSES_ACS('k') /* upper right corner */ +#define ACS_LRCORNER NCURSES_ACS('j') /* lower right corner */ +#define ACS_LTEE NCURSES_ACS('t') /* tee pointing right */ +#define ACS_RTEE NCURSES_ACS('u') /* tee pointing left */ +#define ACS_BTEE NCURSES_ACS('v') /* tee pointing up */ +#define ACS_TTEE NCURSES_ACS('w') /* tee pointing down */ +#define ACS_HLINE NCURSES_ACS('q') /* horizontal line */ +#define ACS_VLINE NCURSES_ACS('x') /* vertical line */ +#define ACS_PLUS NCURSES_ACS('n') /* large plus or crossover */ +#define ACS_S1 NCURSES_ACS('o') /* scan line 1 */ +#define ACS_S9 NCURSES_ACS('s') /* scan line 9 */ +#define ACS_DIAMOND NCURSES_ACS('`') /* diamond */ +#define ACS_CKBOARD NCURSES_ACS('a') /* checker board (stipple) */ +#define ACS_DEGREE NCURSES_ACS('f') /* degree symbol */ +#define ACS_PLMINUS NCURSES_ACS('g') /* plus/minus */ +#define ACS_BULLET NCURSES_ACS('~') /* bullet */ +/* Teletype 5410v1 symbols begin here */ +#define ACS_LARROW NCURSES_ACS(',') /* arrow pointing left */ +#define ACS_RARROW NCURSES_ACS('+') /* arrow pointing right */ +#define ACS_DARROW NCURSES_ACS('.') /* arrow pointing down */ +#define ACS_UARROW NCURSES_ACS('-') /* arrow pointing up */ +#define ACS_BOARD NCURSES_ACS('h') /* board of squares */ +#define ACS_LANTERN NCURSES_ACS('i') /* lantern symbol */ +#define ACS_BLOCK NCURSES_ACS('0') /* solid square block */ +/* + * These aren't documented, but a lot of System Vs have them anyway + * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings). + * The ACS_names may not match AT&T's, our source didn't know them. + */ +#define ACS_S3 NCURSES_ACS('p') /* scan line 3 */ +#define ACS_S7 NCURSES_ACS('r') /* scan line 7 */ +#define ACS_LEQUAL NCURSES_ACS('y') /* less/equal */ +#define ACS_GEQUAL NCURSES_ACS('z') /* greater/equal */ +#define ACS_PI NCURSES_ACS('{') /* Pi */ +#define ACS_NEQUAL NCURSES_ACS('|') /* not equal */ +#define ACS_STERLING NCURSES_ACS('}') /* UK pound sign */ + +/* + * Line drawing ACS names are of the form ACS_trbl, where t is the top, r + * is the right, b is the bottom, and l is the left. t, r, b, and l might + * be B (blank), S (single), D (double), or T (thick). The subset defined + * here only uses B and S. + */ +#define ACS_BSSB ACS_ULCORNER +#define ACS_SSBB ACS_LLCORNER +#define ACS_BBSS ACS_URCORNER +#define ACS_SBBS ACS_LRCORNER +#define ACS_SBSS ACS_RTEE +#define ACS_SSSB ACS_LTEE +#define ACS_SSBS ACS_BTEE +#define ACS_BSSS ACS_TTEE +#define ACS_BSBS ACS_HLINE +#define ACS_SBSB ACS_VLINE +#define ACS_SSSS ACS_PLUS + +#undef ERR +#define ERR (-1) + +#undef OK +#define OK (0) + +/* values for the _flags member */ +#define _SUBWIN 0x01 /* is this a sub-window? */ +#define _ENDLINE 0x02 /* is the window flush right? */ +#define _FULLWIN 0x04 /* is the window full-screen? */ +#define _SCROLLWIN 0x08 /* bottom edge is at screen bottom? */ +#define _ISPAD 0x10 /* is this window a pad? */ +#define _HASMOVED 0x20 /* has cursor moved since last refresh? */ +#define _WRAPPED 0x40 /* cursor was just wrappped */ + +/* + * this value is used in the firstchar and lastchar fields to mark + * unchanged lines + */ +#define _NOCHANGE -1 + +/* + * this value is used in the oldindex field to mark lines created by insertions + * and scrolls. + */ +#define _NEWINDEX -1 + +typedef struct screen SCREEN; +typedef struct _win_st WINDOW; + +typedef chtype attr_t; /* ...must be at least as wide as chtype */ + +#if NCURSES_WIDECHAR + +#if 0 +#ifdef mblen /* libutf8.h defines it w/o undefining first */ +#undef mblen +#endif +#include +#endif + +#if 1 +#include /* ...to get mbstate_t, etc. */ +#endif + +#if 0 +typedef unsigned short wchar_t1; +#endif + +#if 0 +typedef unsigned int wint_t1; +#endif + +/* + * cchar_t stores an array of CCHARW_MAX wide characters. The first is + * normally a spacing character. The others are non-spacing. If those + * (spacing and nonspacing) do not fill the array, a null L'\0' follows. + * Otherwise, a null is assumed to follow when extracting via getcchar(). + */ +#define CCHARW_MAX 5 +typedef struct { + attr_t attr; + wchar_t chars[CCHARW_MAX]; +#if 1 +#undef NCURSES_EXT_COLORS +#define NCURSES_EXT_COLORS 20180127 + int ext_color; /* color pair, must be more than 16-bits */ +#endif +} cchar_t; + +#endif /* NCURSES_WIDECHAR */ + +#if !NCURSES_OPAQUE +struct ldat; + +struct _win_st { + NCURSES_SIZE_T _cury, _curx; /* current cursor position */ + + /* window location and size */ + NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */ + NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */ + + short _flags; /* window state flags */ + + /* attribute tracking */ + attr_t _attrs; /* current attribute for non-space character */ + chtype _bkgd; /* current background char/attribute pair */ + + /* option values set by user */ + bool _notimeout; /* no time out on function-key entry? */ + bool _clear; /* consider all data in the window invalid? */ + bool _leaveok; /* OK to not reset cursor on exit? */ + bool _scroll; /* OK to scroll this window? */ + bool _idlok; /* OK to use insert/delete line? */ + bool _idcok; /* OK to use insert/delete char? */ + bool _immed; /* window in immed mode? (not yet used) */ + bool _sync; /* window in sync mode? */ + bool _use_keypad; /* process function keys into KEY_ symbols? */ + int _delay; /* 0 = nodelay, <0 = blocking, >0 = delay */ + + struct ldat* _line; /* the actual line data */ + + /* global screen state */ + NCURSES_SIZE_T _regtop; /* top line of scrolling region */ + NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */ + + /* these are used only if this is a sub-window */ + int _parx; /* x coordinate of this window in parent */ + int _pary; /* y coordinate of this window in parent */ + WINDOW* _parent; /* pointer to parent if a sub-window */ + + /* these are used only if this is a pad */ + struct pdat { + NCURSES_SIZE_T _pad_y, _pad_x; + NCURSES_SIZE_T _pad_top, _pad_left; + NCURSES_SIZE_T _pad_bottom, _pad_right; + } _pad; + + NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */ + +#if NCURSES_WIDECHAR + cchar_t _bkgrnd; /* current background char/attribute pair */ +#if 1 + int _color; /* current color-pair for non-space character */ +#endif +#endif +}; +#endif /* NCURSES_OPAQUE */ + +/* + * This is an extension to support events... + */ +#if 1 +#ifdef NCURSES_WGETCH_EVENTS +#if !defined(__BEOS__) || defined(__HAIKU__) +/* Fix _nc_timed_wait() on BEOS... */ +#define NCURSES_EVENT_VERSION 1 +#endif /* !defined(__BEOS__) */ + +/* + * Bits to set in _nc_event.data.flags + */ +#define _NC_EVENT_TIMEOUT_MSEC 1 +#define _NC_EVENT_FILE 2 +#define _NC_EVENT_FILE_READABLE 2 +#if 0 /* Not supported yet... */ +#define _NC_EVENT_FILE_WRITABLE 4 +#define _NC_EVENT_FILE_EXCEPTION 8 +#endif + +typedef struct { + int type; + union { + long timeout_msec; /* _NC_EVENT_TIMEOUT_MSEC */ + struct { + unsigned int flags; + int fd; + unsigned int result; + } fev; /* _NC_EVENT_FILE */ + } data; +} _nc_event; + +typedef struct { + int count; + int result_flags; /* _NC_EVENT_TIMEOUT_MSEC or _NC_EVENT_FILE_READABLE */ + _nc_event* events[1]; +} _nc_eventlist; + +extern NCURSES_EXPORT(int) + wgetch_events(WINDOW*, _nc_eventlist*); /* experimental */ +extern NCURSES_EXPORT(int) + wgetnstr_events(WINDOW*, char*, int, _nc_eventlist*); /* experimental */ + +#endif /* NCURSES_WGETCH_EVENTS */ +#endif /* NCURSES_EXT_FUNCS */ + +/* + * GCC (and some other compilers) define '__attribute__'; we're using this + * macro to alert the compiler to flag inconsistencies in printf/scanf-like + * function calls. Just in case '__attribute__' isn't defined, make a dummy. + * Old versions of G++ do not accept it anyway, at least not consistently with + * GCC. + */ +#if !(defined(__GNUC__) || defined(__GNUG__) || defined(__attribute__)) +#define __attribute__(p) /* nothing */ +#endif + +/* + * We cannot define these in ncurses_cfg.h, since they require parameters to be + * passed (that is non-portable). If you happen to be using gcc with warnings + * enabled, define + * GCC_PRINTF + * GCC_SCANF + * to improve checking of calls to printw(), etc. + */ +#ifndef GCC_PRINTFLIKE +#if defined(GCC_PRINTF) && !defined(printf) +#define GCC_PRINTFLIKE(fmt, var) __attribute__((format(printf, fmt, var))) +#else +#define GCC_PRINTFLIKE(fmt, var) /*nothing*/ +#endif +#endif + +#ifndef GCC_SCANFLIKE +#if defined(GCC_SCANF) && !defined(scanf) +#define GCC_SCANFLIKE(fmt, var) __attribute__((format(scanf, fmt, var))) +#else +#define GCC_SCANFLIKE(fmt, var) /*nothing*/ +#endif +#endif + +#ifndef GCC_NORETURN +#define GCC_NORETURN /* nothing */ +#endif + +#ifndef GCC_UNUSED +#define GCC_UNUSED /* nothing */ +#endif + +/* + * Curses uses a helper function. Define our type for this to simplify + * extending it for the sp-funcs feature. + */ +typedef int (*NCURSES_OUTC)(int); + +/* + * Function prototypes. This is the complete X/Open Curses list of required + * functions. Those marked `generated' will have sources generated from the + * macro definitions later in this file, in order to satisfy XPG4.2 + * requirements. + */ + +extern NCURSES_EXPORT(int) addch(const chtype); /* generated */ +extern NCURSES_EXPORT(int) addchnstr(const chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) addchstr(const chtype*); /* generated */ +extern NCURSES_EXPORT(int) addnstr(const char*, int); /* generated */ +extern NCURSES_EXPORT(int) addstr(const char*); /* generated */ +extern NCURSES_EXPORT(int) attroff(NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attron(NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attrset(NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) + attr_get(attr_t*, NCURSES_PAIRS_T*, void*); /* generated */ +extern NCURSES_EXPORT(int) attr_off(attr_t, void*); /* generated */ +extern NCURSES_EXPORT(int) attr_on(attr_t, void*); /* generated */ +extern NCURSES_EXPORT(int) + attr_set(attr_t, NCURSES_PAIRS_T, void*); /* generated */ +extern NCURSES_EXPORT(int) baudrate(void); /* implemented */ +extern NCURSES_EXPORT(int) beep(void); /* implemented */ +extern NCURSES_EXPORT(int) bkgd(chtype); /* generated */ +extern NCURSES_EXPORT(void) bkgdset(chtype); /* generated */ +extern NCURSES_EXPORT(int) border( + chtype, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype); /* generated */ +extern NCURSES_EXPORT(int) box(WINDOW*, chtype, chtype); /* generated */ +extern NCURSES_EXPORT(bool) can_change_color(void); /* implemented */ +extern NCURSES_EXPORT(int) cbreak(void); /* implemented */ +extern NCURSES_EXPORT(int) + chgat(int, attr_t, NCURSES_PAIRS_T, const void*); /* generated */ +extern NCURSES_EXPORT(int) clear(void); /* generated */ +extern NCURSES_EXPORT(int) clearok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) clrtobot(void); /* generated */ +extern NCURSES_EXPORT(int) clrtoeol(void); /* generated */ +extern NCURSES_EXPORT(int) color_content( + NCURSES_COLOR_T, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*); /* implemented */ +extern NCURSES_EXPORT(int) color_set(NCURSES_PAIRS_T, void*); /* generated */ +extern NCURSES_EXPORT(int) COLOR_PAIR(int); /* generated */ +extern NCURSES_EXPORT(int) copywin( + const WINDOW*, + WINDOW*, + int, + int, + int, + int, + int, + int, + int); /* implemented */ +extern NCURSES_EXPORT(int) curs_set(int); /* implemented */ +extern NCURSES_EXPORT(int) def_prog_mode(void); /* implemented */ +extern NCURSES_EXPORT(int) def_shell_mode(void); /* implemented */ +extern NCURSES_EXPORT(int) delay_output(int); /* implemented */ +extern NCURSES_EXPORT(int) delch(void); /* generated */ +extern NCURSES_EXPORT(void) delscreen(SCREEN*); /* implemented */ +extern NCURSES_EXPORT(int) delwin(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) deleteln(void); /* generated */ +extern NCURSES_EXPORT(WINDOW*) + derwin(WINDOW*, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) doupdate(void); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) dupwin(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) echo(void); /* implemented */ +extern NCURSES_EXPORT(int) echochar(const chtype); /* generated */ +extern NCURSES_EXPORT(int) erase(void); /* generated */ +extern NCURSES_EXPORT(int) endwin(void); /* implemented */ +extern NCURSES_EXPORT(char) erasechar(void); /* implemented */ +extern NCURSES_EXPORT(void) filter(void); /* implemented */ +extern NCURSES_EXPORT(int) flash(void); /* implemented */ +extern NCURSES_EXPORT(int) flushinp(void); /* implemented */ +extern NCURSES_EXPORT(chtype) getbkgd(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getch(void); /* generated */ +extern NCURSES_EXPORT(int) getnstr(char*, int); /* generated */ +extern NCURSES_EXPORT(int) getstr(char*); /* generated */ +extern NCURSES_EXPORT(WINDOW*) getwin(FILE*); /* implemented */ +extern NCURSES_EXPORT(int) halfdelay(int); /* implemented */ +extern NCURSES_EXPORT(bool) has_colors(void); /* implemented */ +extern NCURSES_EXPORT(bool) has_ic(void); /* implemented */ +extern NCURSES_EXPORT(bool) has_il(void); /* implemented */ +extern NCURSES_EXPORT(int) hline(chtype, int); /* generated */ +extern NCURSES_EXPORT(void) idcok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) idlok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(void) immedok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) inch(void); /* generated */ +extern NCURSES_EXPORT(int) inchnstr(chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) inchstr(chtype*); /* generated */ +extern NCURSES_EXPORT(WINDOW*) initscr(void); /* implemented */ +extern NCURSES_EXPORT(int) init_color( + NCURSES_COLOR_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T); /* implemented */ +extern NCURSES_EXPORT(int) init_pair( + NCURSES_PAIRS_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T); /* implemented */ +extern NCURSES_EXPORT(int) innstr(char*, int); /* generated */ +extern NCURSES_EXPORT(int) insch(chtype); /* generated */ +extern NCURSES_EXPORT(int) insdelln(int); /* generated */ +extern NCURSES_EXPORT(int) insertln(void); /* generated */ +extern NCURSES_EXPORT(int) insnstr(const char*, int); /* generated */ +extern NCURSES_EXPORT(int) insstr(const char*); /* generated */ +extern NCURSES_EXPORT(int) instr(char*); /* generated */ +extern NCURSES_EXPORT(int) intrflush(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(bool) isendwin(void); /* implemented */ +extern NCURSES_EXPORT(bool) is_linetouched(WINDOW*, int); /* implemented */ +extern NCURSES_EXPORT(bool) is_wintouched(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(NCURSES_CONST char*) keyname(int); /* implemented */ +extern NCURSES_EXPORT(int) keypad(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(char) killchar(void); /* implemented */ +extern NCURSES_EXPORT(int) leaveok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(char*) longname(void); /* implemented */ +extern NCURSES_EXPORT(int) meta(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) move(int, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddch(int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) + mvaddchnstr(int, int, const chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddchstr(int, int, const chtype*); /* generated */ +extern NCURSES_EXPORT(int) + mvaddnstr(int, int, const char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddstr(int, int, const char*); /* generated */ +extern NCURSES_EXPORT(int) + mvchgat(int, int, int, attr_t, NCURSES_PAIRS_T, const void*); /* generated + */ +extern NCURSES_EXPORT(int) mvcur(int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) mvdelch(int, int); /* generated */ +extern NCURSES_EXPORT(int) mvderwin(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(int) mvgetch(int, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetnstr(int, int, char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetstr(int, int, char*); /* generated */ +extern NCURSES_EXPORT(int) mvhline(int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(chtype) mvinch(int, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchnstr(int, int, chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchstr(int, int, chtype*); /* generated */ +extern NCURSES_EXPORT(int) mvinnstr(int, int, char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsch(int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) + mvinsnstr(int, int, const char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsstr(int, int, const char*); /* generated */ +extern NCURSES_EXPORT(int) mvinstr(int, int, char*); /* generated */ +extern NCURSES_EXPORT(int) + mvprintw(int, int, const char*, ...) /* implemented */ + GCC_PRINTFLIKE(3, 4); +extern NCURSES_EXPORT(int) + mvscanw(int, int, NCURSES_CONST char*, ...) /* implemented */ + GCC_SCANFLIKE(3, 4); +extern NCURSES_EXPORT(int) mvvline(int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddch(WINDOW*, int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddchnstr(WINDOW*, int, int, const chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddchstr(WINDOW*, int, int, const chtype*); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddnstr(WINDOW*, int, int, const char*, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddstr(WINDOW*, int, int, const char*); /* generated */ +extern NCURSES_EXPORT(int) mvwchgat( + WINDOW*, + int, + int, + int, + attr_t, + NCURSES_PAIRS_T, + const void*); /* generated */ +extern NCURSES_EXPORT(int) mvwdelch(WINDOW*, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetch(WINDOW*, int, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwgetnstr(WINDOW*, int, int, char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetstr(WINDOW*, int, int, char*); /* generated */ +extern NCURSES_EXPORT(int) + mvwhline(WINDOW*, int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvwin(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(chtype) mvwinch(WINDOW*, int, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwinchnstr(WINDOW*, int, int, chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwinchstr(WINDOW*, int, int, chtype*); /* generated */ +extern NCURSES_EXPORT(int) + mvwinnstr(WINDOW*, int, int, char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinsch(WINDOW*, int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) + mvwinsnstr(WINDOW*, int, int, const char*, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwinsstr(WINDOW*, int, int, const char*); /* generated */ +extern NCURSES_EXPORT(int) mvwinstr(WINDOW*, int, int, char*); /* generated */ +extern NCURSES_EXPORT(int) + mvwprintw(WINDOW*, int, int, const char*, ...) /* implemented */ + GCC_PRINTFLIKE(4, 5); +extern NCURSES_EXPORT(int) + mvwscanw(WINDOW*, int, int, NCURSES_CONST char*, ...) /* implemented */ + GCC_SCANFLIKE(4, 5); +extern NCURSES_EXPORT(int) + mvwvline(WINDOW*, int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) napms(int); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) newpad(int, int); /* implemented */ +extern NCURSES_EXPORT(SCREEN*) + newterm(NCURSES_CONST char*, FILE*, FILE*); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) newwin(int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) nl(void); /* implemented */ +extern NCURSES_EXPORT(int) nocbreak(void); /* implemented */ +extern NCURSES_EXPORT(int) nodelay(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) noecho(void); /* implemented */ +extern NCURSES_EXPORT(int) nonl(void); /* implemented */ +extern NCURSES_EXPORT(void) noqiflush(void); /* implemented */ +extern NCURSES_EXPORT(int) noraw(void); /* implemented */ +extern NCURSES_EXPORT(int) notimeout(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) overlay(const WINDOW*, WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) overwrite(const WINDOW*, WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) pair_content( + NCURSES_PAIRS_T, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*); /* implemented */ +extern NCURSES_EXPORT(int) PAIR_NUMBER(int); /* generated */ +extern NCURSES_EXPORT(int) pechochar(WINDOW*, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) + pnoutrefresh(WINDOW*, int, int, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) + prefresh(WINDOW*, int, int, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) printw(const char*, ...) /* implemented */ + GCC_PRINTFLIKE(1, 2); +extern NCURSES_EXPORT(int) putwin(WINDOW*, FILE*); /* implemented */ +extern NCURSES_EXPORT(void) qiflush(void); /* implemented */ +extern NCURSES_EXPORT(int) raw(void); /* implemented */ +extern NCURSES_EXPORT(int) redrawwin(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) refresh(void); /* generated */ +extern NCURSES_EXPORT(int) resetty(void); /* implemented */ +extern NCURSES_EXPORT(int) reset_prog_mode(void); /* implemented */ +extern NCURSES_EXPORT(int) reset_shell_mode(void); /* implemented */ +extern NCURSES_EXPORT(int) + ripoffline(int, int (*)(WINDOW*, int)); /* implemented */ +extern NCURSES_EXPORT(int) savetty(void); /* implemented */ +extern NCURSES_EXPORT(int) scanw(NCURSES_CONST char*, ...) /* implemented */ + GCC_SCANFLIKE(1, 2); +extern NCURSES_EXPORT(int) scr_dump(const char*); /* implemented */ +extern NCURSES_EXPORT(int) scr_init(const char*); /* implemented */ +extern NCURSES_EXPORT(int) scrl(int); /* generated */ +extern NCURSES_EXPORT(int) scroll(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) scrollok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) scr_restore(const char*); /* implemented */ +extern NCURSES_EXPORT(int) scr_set(const char*); /* implemented */ +extern NCURSES_EXPORT(int) setscrreg(int, int); /* generated */ +extern NCURSES_EXPORT(SCREEN*) set_term(SCREEN*); /* implemented */ +extern NCURSES_EXPORT(int) slk_attroff(const chtype); /* implemented */ +extern NCURSES_EXPORT(int) + slk_attr_off(const attr_t, void*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attron(const chtype); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_on(attr_t, void*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attrset(const chtype); /* implemented */ +extern NCURSES_EXPORT(attr_t) slk_attr(void); /* implemented */ +extern NCURSES_EXPORT(int) + slk_attr_set(const attr_t, NCURSES_PAIRS_T, void*); /* implemented */ +extern NCURSES_EXPORT(int) slk_clear(void); /* implemented */ +extern NCURSES_EXPORT(int) slk_color(NCURSES_PAIRS_T); /* implemented */ +extern NCURSES_EXPORT(int) slk_init(int); /* implemented */ +extern NCURSES_EXPORT(char*) slk_label(int); /* implemented */ +extern NCURSES_EXPORT(int) slk_noutrefresh(void); /* implemented */ +extern NCURSES_EXPORT(int) slk_refresh(void); /* implemented */ +extern NCURSES_EXPORT(int) slk_restore(void); /* implemented */ +extern NCURSES_EXPORT(int) slk_set(int, const char*, int); /* implemented */ +extern NCURSES_EXPORT(int) slk_touch(void); /* implemented */ +extern NCURSES_EXPORT(int) standout(void); /* generated */ +extern NCURSES_EXPORT(int) standend(void); /* generated */ +extern NCURSES_EXPORT(int) start_color(void); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) + subpad(WINDOW*, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) + subwin(WINDOW*, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) syncok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) termattrs(void); /* implemented */ +extern NCURSES_EXPORT(char*) termname(void); /* implemented */ +extern NCURSES_EXPORT(void) timeout(int); /* generated */ +extern NCURSES_EXPORT(int) touchline(WINDOW*, int, int); /* generated */ +extern NCURSES_EXPORT(int) touchwin(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) typeahead(int); /* implemented */ +extern NCURSES_EXPORT(int) ungetch(int); /* implemented */ +extern NCURSES_EXPORT(int) untouchwin(WINDOW*); /* generated */ +extern NCURSES_EXPORT(void) use_env(bool); /* implemented */ +extern NCURSES_EXPORT(void) use_tioctl(bool); /* implemented */ +extern NCURSES_EXPORT(int) vidattr(chtype); /* implemented */ +extern NCURSES_EXPORT(int) vidputs(chtype, NCURSES_OUTC); /* implemented */ +extern NCURSES_EXPORT(int) vline(chtype, int); /* generated */ +extern NCURSES_EXPORT(int) + vwprintw(WINDOW*, const char*, va_list); /* implemented */ +extern NCURSES_EXPORT(int) + vw_printw(WINDOW*, const char*, va_list); /* generated */ +extern NCURSES_EXPORT(int) + vwscanw(WINDOW*, NCURSES_CONST char*, va_list); /* implemented */ +extern NCURSES_EXPORT(int) + vw_scanw(WINDOW*, NCURSES_CONST char*, va_list); /* generated */ +extern NCURSES_EXPORT(int) waddch(WINDOW*, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) + waddchnstr(WINDOW*, const chtype*, int); /* implemented */ +extern NCURSES_EXPORT(int) waddchstr(WINDOW*, const chtype*); /* generated */ +extern NCURSES_EXPORT(int) + waddnstr(WINDOW*, const char*, int); /* implemented */ +extern NCURSES_EXPORT(int) waddstr(WINDOW*, const char*); /* generated */ +extern NCURSES_EXPORT(int) wattron(WINDOW*, int); /* generated */ +extern NCURSES_EXPORT(int) wattroff(WINDOW*, int); /* generated */ +extern NCURSES_EXPORT(int) wattrset(WINDOW*, int); /* generated */ +extern NCURSES_EXPORT(int) + wattr_get(WINDOW*, attr_t*, NCURSES_PAIRS_T*, void*); /* generated */ +extern NCURSES_EXPORT(int) wattr_on(WINDOW*, attr_t, void*); /* implemented */ +extern NCURSES_EXPORT(int) wattr_off(WINDOW*, attr_t, void*); /* implemented */ +extern NCURSES_EXPORT(int) + wattr_set(WINDOW*, attr_t, NCURSES_PAIRS_T, void*); /* generated */ +extern NCURSES_EXPORT(int) wbkgd(WINDOW*, chtype); /* implemented */ +extern NCURSES_EXPORT(void) wbkgdset(WINDOW*, chtype); /* implemented */ +extern NCURSES_EXPORT(int) wborder( + WINDOW*, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype); /* implemented */ +extern NCURSES_EXPORT(int) wchgat( + WINDOW*, + int, + attr_t, + NCURSES_PAIRS_T, + const void*); /* implemented */ +extern NCURSES_EXPORT(int) wclear(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wclrtobot(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wclrtoeol(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) + wcolor_set(WINDOW*, NCURSES_PAIRS_T, void*); /* implemented */ +extern NCURSES_EXPORT(void) wcursyncup(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wdelch(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wdeleteln(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) wechochar(WINDOW*, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) werase(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wgetch(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wgetnstr(WINDOW*, char*, int); /* implemented */ +extern NCURSES_EXPORT(int) wgetstr(WINDOW*, char*); /* generated */ +extern NCURSES_EXPORT(int) whline(WINDOW*, chtype, int); /* implemented */ +extern NCURSES_EXPORT(chtype) winch(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) winchnstr(WINDOW*, chtype*, int); /* implemented */ +extern NCURSES_EXPORT(int) winchstr(WINDOW*, chtype*); /* generated */ +extern NCURSES_EXPORT(int) winnstr(WINDOW*, char*, int); /* implemented */ +extern NCURSES_EXPORT(int) winsch(WINDOW*, chtype); /* implemented */ +extern NCURSES_EXPORT(int) winsdelln(WINDOW*, int); /* implemented */ +extern NCURSES_EXPORT(int) winsertln(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) + winsnstr(WINDOW*, const char*, int); /* implemented */ +extern NCURSES_EXPORT(int) winsstr(WINDOW*, const char*); /* generated */ +extern NCURSES_EXPORT(int) winstr(WINDOW*, char*); /* generated */ +extern NCURSES_EXPORT(int) wmove(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(int) wnoutrefresh(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wprintw(WINDOW*, const char*, ...) /* implemented */ + GCC_PRINTFLIKE(2, 3); +extern NCURSES_EXPORT(int) wredrawln(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(int) wrefresh(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) + wscanw(WINDOW*, NCURSES_CONST char*, ...) /* implemented */ + GCC_SCANFLIKE(2, 3); +extern NCURSES_EXPORT(int) wscrl(WINDOW*, int); /* implemented */ +extern NCURSES_EXPORT(int) wsetscrreg(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(int) wstandout(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) wstandend(WINDOW*); /* generated */ +extern NCURSES_EXPORT(void) wsyncdown(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(void) wsyncup(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(void) wtimeout(WINDOW*, int); /* implemented */ +extern NCURSES_EXPORT(int) wtouchln(WINDOW*, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) wvline(WINDOW*, chtype, int); /* implemented */ + +/* + * These are also declared in : + */ +extern NCURSES_EXPORT(int) tigetflag(NCURSES_CONST char*); /* implemented */ +extern NCURSES_EXPORT(int) tigetnum(NCURSES_CONST char*); /* implemented */ +extern NCURSES_EXPORT(char*) tigetstr(NCURSES_CONST char*); /* implemented */ +extern NCURSES_EXPORT(int) putp(const char*); /* implemented */ + +#if NCURSES_TPARM_VARARGS +extern NCURSES_EXPORT(char*) tparm(NCURSES_CONST char*, ...); /* special */ +#else +extern NCURSES_EXPORT(char*) tparm( + NCURSES_CONST char*, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG); /* special */ +extern NCURSES_EXPORT(char*) + tparm_varargs(NCURSES_CONST char*, ...); /* special */ +#endif + +extern NCURSES_EXPORT(char*) tiparm(const char*, ...); /* special */ + +/* + * X/Open says this returns a bool; SVr4 also checked for out-of-range line. + * The macro provides compatibility: + */ +#define is_linetouched(w, l) \ + ((!(w) || ((l) > getmaxy(w)) || ((l) < 0)) ? ERR : (is_linetouched)((w), (l))) + +/* + * These functions are not in X/Open, but we use them in macro definitions: + */ +extern NCURSES_EXPORT(int) getattrs(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getcurx(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getcury(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getbegx(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getbegy(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getmaxx(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getmaxy(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getparx(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getpary(const WINDOW*); /* generated */ + +/* + * vid_attr() was implemented originally based on a draft of X/Open curses. + */ +#if !NCURSES_WIDECHAR +#define vid_attr(a, pair, opts) vidattr(a) +#endif + +/* + * These functions are extensions - not in X/Open Curses. + */ +#if 1 +#undef NCURSES_EXT_FUNCS +#define NCURSES_EXT_FUNCS 20180127 +typedef int (*NCURSES_WINDOW_CB)(WINDOW*, void*); +typedef int (*NCURSES_SCREEN_CB)(SCREEN*, void*); +extern NCURSES_EXPORT(bool) is_term_resized(int, int); +extern NCURSES_EXPORT(char*) keybound(int, int); +extern NCURSES_EXPORT(const char*) curses_version(void); +extern NCURSES_EXPORT(int) alloc_pair(int, int); +extern NCURSES_EXPORT(int) assume_default_colors(int, int); +extern NCURSES_EXPORT(int) define_key(const char*, int); +extern NCURSES_EXPORT(int) extended_color_content(int, int*, int*, int*); +extern NCURSES_EXPORT(int) extended_pair_content(int, int*, int*); +extern NCURSES_EXPORT(int) extended_slk_color(int); +extern NCURSES_EXPORT(int) find_pair(int, int); +extern NCURSES_EXPORT(int) free_pair(int); +extern NCURSES_EXPORT(int) get_escdelay(void); +extern NCURSES_EXPORT(int) init_extended_color(int, int, int, int); +extern NCURSES_EXPORT(int) init_extended_pair(int, int, int); +extern NCURSES_EXPORT(int) key_defined(const char*); +extern NCURSES_EXPORT(int) keyok(int, bool); +extern NCURSES_EXPORT(void) reset_color_pairs(void); +extern NCURSES_EXPORT(int) resize_term(int, int); +extern NCURSES_EXPORT(int) resizeterm(int, int); +extern NCURSES_EXPORT(int) set_escdelay(int); +extern NCURSES_EXPORT(int) set_tabsize(int); +extern NCURSES_EXPORT(int) use_default_colors(void); +extern NCURSES_EXPORT(int) use_extended_names(bool); +extern NCURSES_EXPORT(int) use_legacy_coding(int); +extern NCURSES_EXPORT(int) use_screen(SCREEN*, NCURSES_SCREEN_CB, void*); +extern NCURSES_EXPORT(int) use_window(WINDOW*, NCURSES_WINDOW_CB, void*); +extern NCURSES_EXPORT(int) wresize(WINDOW*, int, int); +extern NCURSES_EXPORT(void) nofilter(void); + +/* + * These extensions provide access to information stored in the WINDOW even + * when NCURSES_OPAQUE is set: + */ +extern NCURSES_EXPORT(WINDOW*) wgetparent(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_cleared(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_idcok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_idlok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_immedok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_keypad(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_leaveok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_nodelay(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_notimeout(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_pad(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_scrollok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_subwin(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_syncok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) wgetdelay(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) + wgetscrreg(const WINDOW*, int*, int*); /* generated */ + +#else +#define curses_version() NCURSES_VERSION +#endif + +/* + * Extra extension-functions, which pass a SCREEN pointer rather than using + * a global variable SP. + */ +#if 1 +#undef NCURSES_SP_FUNCS +#define NCURSES_SP_FUNCS 20180127 +#define NCURSES_SP_NAME(name) name##_sp + +/* Define the sp-funcs helper function */ +#define NCURSES_SP_OUTC NCURSES_SP_NAME(NCURSES_OUTC) +typedef int (*NCURSES_SP_OUTC)(SCREEN*, int); + +extern NCURSES_EXPORT(SCREEN*) new_prescr(void); /* implemented:SP_FUNC */ + +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(baudrate)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(beep)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(can_change_color)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(cbreak)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(curs_set)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(color_content)( + SCREEN*, + NCURSES_PAIRS_T, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(def_prog_mode)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(def_shell_mode)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(delay_output)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(doupdate)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(echo)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(endwin)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char) + NCURSES_SP_NAME(erasechar)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(filter)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(flash)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(flushinp)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW*) + NCURSES_SP_NAME(getwin)(SCREEN*, FILE*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(halfdelay)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(has_colors)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(has_ic)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(has_il)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_color)( + SCREEN*, + NCURSES_COLOR_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_pair)( + SCREEN*, + NCURSES_PAIRS_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + intrflush)(SCREEN*, WINDOW*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(isendwin)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(NCURSES_CONST char*) + NCURSES_SP_NAME(keyname)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char) + NCURSES_SP_NAME(killchar)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(longname)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + mvcur)(SCREEN*, int, int, int, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(napms)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW*) + NCURSES_SP_NAME(newpad)(SCREEN*, int, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(SCREEN*) NCURSES_SP_NAME(newterm)( + SCREEN*, + NCURSES_CONST char*, + FILE*, + FILE*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW*) NCURSES_SP_NAME( + newwin)(SCREEN*, int, int, int, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(nl)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(nocbreak)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(noecho)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(nonl)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(noqiflush)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(noraw)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(pair_content)( + SCREEN*, + NCURSES_PAIRS_T, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(qiflush)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(raw)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(reset_prog_mode)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(reset_shell_mode)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(resetty)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + ripoffline)(SCREEN*, int, int (*)(WINDOW*, int)); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(savetty)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(scr_init)(SCREEN*, const char*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + scr_restore)(SCREEN*, const char*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(scr_set)(SCREEN*, const char*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_attroff)(SCREEN*, const chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_attron)(SCREEN*, const chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_attrset)(SCREEN*, const chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(attr_t) + NCURSES_SP_NAME(slk_attr)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attr_set)( + SCREEN*, + const attr_t, + NCURSES_PAIRS_T, + void*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_clear)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_color)(SCREEN*, NCURSES_PAIRS_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_init)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(slk_label)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_noutrefresh)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_refresh)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_restore)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_set)(SCREEN*, int, const char*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_touch)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(start_color)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(chtype) + NCURSES_SP_NAME(termattrs)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(termname)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(typeahead)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(ungetch)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(use_env)(SCREEN*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(use_tioctl)(SCREEN*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(vidattr)(SCREEN*, chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + vidputs)(SCREEN*, chtype, NCURSES_SP_OUTC); /* implemented:SP_FUNC */ +#if 1 +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(keybound)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + alloc_pair)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + assume_default_colors)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + define_key)(SCREEN*, const char*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_color_content)( + SCREEN*, + int, + int*, + int*, + int*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_pair_content)( + SCREEN*, + int, + int*, + int*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + extended_slk_color)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(get_escdelay)(SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(find_pair)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(free_pair)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_extended_color)( + SCREEN*, + int, + int, + int, + int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + init_extended_pair)(SCREEN*, int, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME( + is_term_resized)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + key_defined)(SCREEN*, const char*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(keyok)(SCREEN*, int, bool); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(nofilter)(SCREEN*); + /* implemented */ /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(reset_color_pairs)(SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + resize_term)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + resizeterm)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(set_escdelay)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(set_tabsize)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(use_default_colors)(SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + use_legacy_coding)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +#endif +#else +#undef NCURSES_SP_FUNCS +#define NCURSES_SP_FUNCS 0 +#define NCURSES_SP_NAME(name) name +#define NCURSES_SP_OUTC NCURSES_OUTC +#endif + +/* attributes */ + +#define NCURSES_ATTR_SHIFT 8 +#define NCURSES_BITS(mask, shift) \ + (NCURSES_CAST(chtype, (mask)) << ((shift) + NCURSES_ATTR_SHIFT)) + +#define A_NORMAL (1U - 1U) +#define A_ATTRIBUTES NCURSES_BITS(~(1U - 1U), 0) +#define A_CHARTEXT (NCURSES_BITS(1U, 0) - 1U) +#define A_COLOR NCURSES_BITS(((1U) << 8) - 1U, 0) +#define A_STANDOUT NCURSES_BITS(1U, 8) +#define A_UNDERLINE NCURSES_BITS(1U, 9) +#define A_REVERSE NCURSES_BITS(1U, 10) +#define A_BLINK NCURSES_BITS(1U, 11) +#define A_DIM NCURSES_BITS(1U, 12) +#define A_BOLD NCURSES_BITS(1U, 13) +#define A_ALTCHARSET NCURSES_BITS(1U, 14) +#define A_INVIS NCURSES_BITS(1U, 15) +#define A_PROTECT NCURSES_BITS(1U, 16) +#define A_HORIZONTAL NCURSES_BITS(1U, 17) +#define A_LEFT NCURSES_BITS(1U, 18) +#define A_LOW NCURSES_BITS(1U, 19) +#define A_RIGHT NCURSES_BITS(1U, 20) +#define A_TOP NCURSES_BITS(1U, 21) +#define A_VERTICAL NCURSES_BITS(1U, 22) + +#if 1 +#define A_ITALIC NCURSES_BITS(1U, 23) /* ncurses extension */ +#endif + +/* + * Most of the pseudo functions are macros that either provide compatibility + * with older versions of curses, or provide inline functionality to improve + * performance. + */ + +/* + * These pseudo functions are always implemented as macros: + */ + +#define getyx(win, y, x) (y = getcury(win), x = getcurx(win)) +#define getbegyx(win, y, x) (y = getbegy(win), x = getbegx(win)) +#define getmaxyx(win, y, x) (y = getmaxy(win), x = getmaxx(win)) +#define getparyx(win, y, x) (y = getpary(win), x = getparx(win)) + +#define getsyx(y, x) \ + do { \ + if (newscr) { \ + if (is_leaveok(newscr)) \ + (y) = (x) = -1; \ + else \ + getyx(newscr, (y), (x)); \ + } \ + } while (0) + +#define setsyx(y, x) \ + do { \ + if (newscr) { \ + if ((y) == -1 && (x) == -1) \ + leaveok(newscr, TRUE); \ + else { \ + leaveok(newscr, FALSE); \ + wmove(newscr, (y), (x)); \ + } \ + } \ + } while (0) + +#ifndef NCURSES_NOMACROS + +/* + * These miscellaneous pseudo functions are provided for compatibility: + */ + +#define wgetstr(w, s) wgetnstr(w, s, -1) +#define getnstr(s, n) wgetnstr(stdscr, s, (n)) + +#define setterm(term) setupterm(term, 1, (int*)0) + +#define fixterm() reset_prog_mode() +#define resetterm() reset_shell_mode() +#define saveterm() def_prog_mode() +#define crmode() cbreak() +#define nocrmode() nocbreak() +#define gettmode() + +/* It seems older SYSV curses versions define these */ +#if !NCURSES_OPAQUE +#define getattrs(win) \ + NCURSES_CAST(int, NCURSES_OK_ADDR(win) ? (win)->_attrs : A_NORMAL) +#define getcurx(win) (NCURSES_OK_ADDR(win) ? (win)->_curx : ERR) +#define getcury(win) (NCURSES_OK_ADDR(win) ? (win)->_cury : ERR) +#define getbegx(win) (NCURSES_OK_ADDR(win) ? (win)->_begx : ERR) +#define getbegy(win) (NCURSES_OK_ADDR(win) ? (win)->_begy : ERR) +#define getmaxx(win) (NCURSES_OK_ADDR(win) ? ((win)->_maxx + 1) : ERR) +#define getmaxy(win) (NCURSES_OK_ADDR(win) ? ((win)->_maxy + 1) : ERR) +#define getparx(win) (NCURSES_OK_ADDR(win) ? (win)->_parx : ERR) +#define getpary(win) (NCURSES_OK_ADDR(win) ? (win)->_pary : ERR) +#endif /* NCURSES_OPAQUE */ + +#define wstandout(win) (wattrset(win, A_STANDOUT)) +#define wstandend(win) (wattrset(win, A_NORMAL)) + +#define wattron(win, at) wattr_on(win, NCURSES_CAST(attr_t, at), NULL) +#define wattroff(win, at) wattr_off(win, NCURSES_CAST(attr_t, at), NULL) + +#if !NCURSES_OPAQUE +#if NCURSES_WATTR_MACROS +#if NCURSES_WIDECHAR && 1 +#define wattrset(win, at) \ + (NCURSES_OK_ADDR(win) ? ((win)->_color = NCURSES_CAST(int, PAIR_NUMBER(at)), \ + (win)->_attrs = NCURSES_CAST(attr_t, at), \ + OK) \ + : ERR) +#else +#define wattrset(win, at) \ + (NCURSES_OK_ADDR(win) ? ((win)->_attrs = NCURSES_CAST(attr_t, at), OK) : ERR) +#endif +#endif /* NCURSES_WATTR_MACROS */ +#endif /* NCURSES_OPAQUE */ + +#define scroll(win) wscrl(win, 1) + +#define touchwin(win) wtouchln((win), 0, getmaxy(win), 1) +#define touchline(win, s, c) wtouchln((win), s, c, 1) +#define untouchwin(win) wtouchln((win), 0, getmaxy(win), 0) + +#define box(win, v, h) wborder(win, v, v, h, h, 0, 0, 0, 0) +#define border(ls, rs, ts, bs, tl, tr, bl, br) \ + wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br) +#define hline(ch, n) whline(stdscr, ch, (n)) +#define vline(ch, n) wvline(stdscr, ch, (n)) + +#define winstr(w, s) winnstr(w, s, -1) +#define winchstr(w, s) winchnstr(w, s, -1) +#define winsstr(w, s) winsnstr(w, s, -1) + +#if !NCURSES_OPAQUE +#define redrawwin(win) \ + wredrawln(win, 0, (NCURSES_OK_ADDR(win) ? (win)->_maxy + 1 : -1)) +#endif /* NCURSES_OPAQUE */ + +#define waddstr(win, str) waddnstr(win, str, -1) +#define waddchstr(win, str) waddchnstr(win, str, -1) + +/* + * These apply to the first 256 color pairs. + */ +#define COLOR_PAIR(n) (NCURSES_BITS((n), 0) & A_COLOR) +#define PAIR_NUMBER(a) \ + (NCURSES_CAST( \ + int, \ + ((NCURSES_CAST(unsigned long, (a)) & A_COLOR) >> NCURSES_ATTR_SHIFT))) + +/* + * pseudo functions for standard screen + */ + +#define addch(ch) waddch(stdscr, (ch)) +#define addchnstr(str, n) waddchnstr(stdscr, (str), (n)) +#define addchstr(str) waddchstr(stdscr, (str)) +#define addnstr(str, n) waddnstr(stdscr, (str), (n)) +#define addstr(str) waddnstr(stdscr, (str), -1) +#define attr_get(ap, cp, o) wattr_get(stdscr, (ap), (cp), (o)) +#define attr_off(a, o) wattr_off(stdscr, (a), (o)) +#define attr_on(a, o) wattr_on(stdscr, (a), (o)) +#define attr_set(a, c, o) wattr_set(stdscr, (a), (c), (o)) +#define attroff(at) wattroff(stdscr, (at)) +#define attron(at) wattron(stdscr, (at)) +#define attrset(at) wattrset(stdscr, (at)) +#define bkgd(ch) wbkgd(stdscr, (ch)) +#define bkgdset(ch) wbkgdset(stdscr, (ch)) +#define chgat(n, a, c, o) wchgat(stdscr, (n), (a), (c), (o)) +#define clear() wclear(stdscr) +#define clrtobot() wclrtobot(stdscr) +#define clrtoeol() wclrtoeol(stdscr) +#define color_set(c, o) wcolor_set(stdscr, (c), (o)) +#define delch() wdelch(stdscr) +#define deleteln() winsdelln(stdscr, -1) +#define echochar(c) wechochar(stdscr, (c)) +#define erase() werase(stdscr) +#define getch() wgetch(stdscr) +#define getstr(str) wgetstr(stdscr, (str)) +#define inch() winch(stdscr) +#define inchnstr(s, n) winchnstr(stdscr, (s), (n)) +#define inchstr(s) winchstr(stdscr, (s)) +#define innstr(s, n) winnstr(stdscr, (s), (n)) +#define insch(c) winsch(stdscr, (c)) +#define insdelln(n) winsdelln(stdscr, (n)) +#define insertln() winsdelln(stdscr, 1) +#define insnstr(s, n) winsnstr(stdscr, (s), (n)) +#define insstr(s) winsstr(stdscr, (s)) +#define instr(s) winstr(stdscr, (s)) +#define move(y, x) wmove(stdscr, (y), (x)) +#define refresh() wrefresh(stdscr) +#define scrl(n) wscrl(stdscr, (n)) +#define setscrreg(t, b) wsetscrreg(stdscr, (t), (b)) +#define standend() wstandend(stdscr) +#define standout() wstandout(stdscr) +#define timeout(delay) wtimeout(stdscr, (delay)) +#define wdeleteln(win) winsdelln(win, -1) +#define winsertln(win) winsdelln(win, 1) + +/* + * mv functions + */ + +#define mvwaddch(win, y, x, ch) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddch((win), (ch))) +#define mvwaddchnstr(win, y, x, str, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddchnstr((win), (str), (n))) +#define mvwaddchstr(win, y, x, str) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddchnstr((win), (str), -1)) +#define mvwaddnstr(win, y, x, str, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddnstr((win), (str), (n))) +#define mvwaddstr(win, y, x, str) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddnstr((win), (str), -1)) +#define mvwchgat(win, y, x, n, a, c, o) \ + (wmove((win), (y), (x)) == ERR ? ERR : wchgat((win), (n), (a), (c), (o))) +#define mvwdelch(win, y, x) (wmove((win), (y), (x)) == ERR ? ERR : wdelch(win)) +#define mvwgetch(win, y, x) (wmove((win), (y), (x)) == ERR ? ERR : wgetch(win)) +#define mvwgetnstr(win, y, x, str, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : wgetnstr((win), (str), (n))) +#define mvwgetstr(win, y, x, str) \ + (wmove((win), (y), (x)) == ERR ? ERR : wgetstr((win), (str))) +#define mvwhline(win, y, x, c, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : whline((win), (c), (n))) +#define mvwinch(win, y, x) \ + (wmove((win), (y), (x)) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win)) +#define mvwinchnstr(win, y, x, s, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : winchnstr((win), (s), (n))) +#define mvwinchstr(win, y, x, s) \ + (wmove((win), (y), (x)) == ERR ? ERR : winchstr((win), (s))) +#define mvwinnstr(win, y, x, s, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : winnstr((win), (s), (n))) +#define mvwinsch(win, y, x, c) \ + (wmove((win), (y), (x)) == ERR ? ERR : winsch((win), (c))) +#define mvwinsnstr(win, y, x, s, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : winsnstr((win), (s), (n))) +#define mvwinsstr(win, y, x, s) \ + (wmove((win), (y), (x)) == ERR ? ERR : winsstr((win), (s))) +#define mvwinstr(win, y, x, s) \ + (wmove((win), (y), (x)) == ERR ? ERR : winstr((win), (s))) +#define mvwvline(win, y, x, c, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : wvline((win), (c), (n))) + +#define mvaddch(y, x, ch) mvwaddch(stdscr, (y), (x), (ch)) +#define mvaddchnstr(y, x, str, n) mvwaddchnstr(stdscr, (y), (x), (str), (n)) +#define mvaddchstr(y, x, str) mvwaddchstr(stdscr, (y), (x), (str)) +#define mvaddnstr(y, x, str, n) mvwaddnstr(stdscr, (y), (x), (str), (n)) +#define mvaddstr(y, x, str) mvwaddstr(stdscr, (y), (x), (str)) +#define mvchgat(y, x, n, a, c, o) mvwchgat(stdscr, (y), (x), (n), (a), (c), (o)) +#define mvdelch(y, x) mvwdelch(stdscr, (y), (x)) +#define mvgetch(y, x) mvwgetch(stdscr, (y), (x)) +#define mvgetnstr(y, x, str, n) mvwgetnstr(stdscr, (y), (x), (str), (n)) +#define mvgetstr(y, x, str) mvwgetstr(stdscr, (y), (x), (str)) +#define mvhline(y, x, c, n) mvwhline(stdscr, (y), (x), (c), (n)) +#define mvinch(y, x) mvwinch(stdscr, (y), (x)) +#define mvinchnstr(y, x, s, n) mvwinchnstr(stdscr, (y), (x), (s), (n)) +#define mvinchstr(y, x, s) mvwinchstr(stdscr, (y), (x), (s)) +#define mvinnstr(y, x, s, n) mvwinnstr(stdscr, (y), (x), (s), (n)) +#define mvinsch(y, x, c) mvwinsch(stdscr, (y), (x), (c)) +#define mvinsnstr(y, x, s, n) mvwinsnstr(stdscr, (y), (x), (s), (n)) +#define mvinsstr(y, x, s) mvwinsstr(stdscr, (y), (x), (s)) +#define mvinstr(y, x, s) mvwinstr(stdscr, (y), (x), (s)) +#define mvvline(y, x, c, n) mvwvline(stdscr, (y), (x), (c), (n)) + +/* + * Some wide-character functions can be implemented without the extensions. + */ +#if !NCURSES_OPAQUE +#define getbkgd(win) (NCURSES_OK_ADDR(win) ? ((win)->_bkgd) : 0) +#endif /* NCURSES_OPAQUE */ + +#define slk_attr_off(a, v) ((v) ? ERR : slk_attroff(a)) +#define slk_attr_on(a, v) ((v) ? ERR : slk_attron(a)) + +#if !NCURSES_OPAQUE +#if NCURSES_WATTR_MACROS +#if NCURSES_WIDECHAR && 1 +#define wattr_set(win, a, p, opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)((win)->_attrs = ((a) & ~A_COLOR), (win)->_color = (opts) ? *(int*)(opts) : (p)), \ + OK) \ + : ERR) +#define wattr_get(win, a, p, opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)(NCURSES_OK_ADDR(a) ? (*(a) = (win)->_attrs) : OK), \ + (void)(NCURSES_OK_ADDR(p) ? (*(p) = (NCURSES_PAIRS_T)(win)->_color) : OK), \ + (void)(NCURSES_OK_ADDR(opts) ? (*(int*)(opts) = (win)->_color) : OK), \ + OK) \ + : ERR) +#else /* !(NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */ +#define wattr_set(win, a, p, opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)((win)->_attrs = (((a) & ~A_COLOR) | (attr_t)COLOR_PAIR(p))), \ + OK) \ + : ERR) +#define wattr_get(win, a, p, opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)(NCURSES_OK_ADDR(a) ? (*(a) = (win)->_attrs) : OK), \ + (void)(NCURSES_OK_ADDR(p) ? (*(p) = (NCURSES_PAIRS_T)PAIR_NUMBER((win)->_attrs)) : OK), \ + OK) \ + : ERR) +#endif /* (NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */ +#endif /* NCURSES_WATTR_MACROS */ +#endif /* NCURSES_OPAQUE */ + +/* + * X/Open curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use + * varargs.h. It adds new calls vw_printw/vw_scanw, which are supposed to + * use POSIX stdarg.h. The ncurses versions of vwprintw/vwscanw already + * use stdarg.h, so... + */ +#define vw_printw vwprintw +#define vw_scanw vwscanw + +/* + * Export fallback function for use in C++ binding. + */ +#if !1 +#define vsscanf(a, b, c) _nc_vsscanf(a, b, c) +NCURSES_EXPORT(int) vsscanf(const char*, const char*, va_list); +#endif + +/* + * These macros are extensions - not in X/Open Curses. + */ +#if 1 +#if !NCURSES_OPAQUE +#define is_cleared(win) (NCURSES_OK_ADDR(win) ? (win)->_clear : FALSE) +#define is_idcok(win) (NCURSES_OK_ADDR(win) ? (win)->_idcok : FALSE) +#define is_idlok(win) (NCURSES_OK_ADDR(win) ? (win)->_idlok : FALSE) +#define is_immedok(win) (NCURSES_OK_ADDR(win) ? (win)->_immed : FALSE) +#define is_keypad(win) (NCURSES_OK_ADDR(win) ? (win)->_use_keypad : FALSE) +#define is_leaveok(win) (NCURSES_OK_ADDR(win) ? (win)->_leaveok : FALSE) +#define is_nodelay(win) (NCURSES_OK_ADDR(win) ? ((win)->_delay == 0) : FALSE) +#define is_notimeout(win) (NCURSES_OK_ADDR(win) ? (win)->_notimeout : FALSE) +#define is_pad(win) \ + (NCURSES_OK_ADDR(win) ? ((win)->_flags & _ISPAD) != 0 : FALSE) +#define is_scrollok(win) (NCURSES_OK_ADDR(win) ? (win)->_scroll : FALSE) +#define is_subwin(win) \ + (NCURSES_OK_ADDR(win) ? ((win)->_flags & _SUBWIN) != 0 : FALSE) +#define is_syncok(win) (NCURSES_OK_ADDR(win) ? (win)->_sync : FALSE) +#define wgetdelay(win) (NCURSES_OK_ADDR(win) ? (win)->_delay : 0) +#define wgetparent(win) (NCURSES_OK_ADDR(win) ? (win)->_parent : 0) +#define wgetscrreg(win, t, b) \ + (NCURSES_OK_ADDR(win) \ + ? (*(t) = (win)->_regtop, *(b) = (win)->_regbottom, OK) \ + : ERR) +#endif +#endif + +#endif /* NCURSES_NOMACROS */ + +/* + * Public variables. + * + * Notes: + * a. ESCDELAY was an undocumented feature under AIX curses. + * It gives the ESC expire time in milliseconds. + * b. ttytype is needed for backward compatibility + */ +#if NCURSES_REENTRANT + +NCURSES_WRAPPED_VAR(WINDOW*, curscr); +NCURSES_WRAPPED_VAR(WINDOW*, newscr); +NCURSES_WRAPPED_VAR(WINDOW*, stdscr); +NCURSES_WRAPPED_VAR(char*, ttytype); +NCURSES_WRAPPED_VAR(int, COLORS); +NCURSES_WRAPPED_VAR(int, COLOR_PAIRS); +NCURSES_WRAPPED_VAR(int, COLS); +NCURSES_WRAPPED_VAR(int, ESCDELAY); +NCURSES_WRAPPED_VAR(int, LINES); +NCURSES_WRAPPED_VAR(int, TABSIZE); + +#define curscr NCURSES_PUBLIC_VAR(curscr()) +#define newscr NCURSES_PUBLIC_VAR(newscr()) +#define stdscr NCURSES_PUBLIC_VAR(stdscr()) +#define ttytype NCURSES_PUBLIC_VAR(ttytype()) +#define COLORS NCURSES_PUBLIC_VAR(COLORS()) +#define COLOR_PAIRS NCURSES_PUBLIC_VAR(COLOR_PAIRS()) +#define COLS NCURSES_PUBLIC_VAR(COLS()) +#define ESCDELAY NCURSES_PUBLIC_VAR(ESCDELAY()) +#define LINES NCURSES_PUBLIC_VAR(LINES()) +#define TABSIZE NCURSES_PUBLIC_VAR(TABSIZE()) + +#else + +extern NCURSES_EXPORT_VAR(WINDOW*) curscr; +extern NCURSES_EXPORT_VAR(WINDOW*) newscr; +extern NCURSES_EXPORT_VAR(WINDOW*) stdscr; +extern NCURSES_EXPORT_VAR(char) ttytype[]; +extern NCURSES_EXPORT_VAR(int) COLORS; +extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS; +extern NCURSES_EXPORT_VAR(int) COLS; +extern NCURSES_EXPORT_VAR(int) ESCDELAY; +extern NCURSES_EXPORT_VAR(int) LINES; +extern NCURSES_EXPORT_VAR(int) TABSIZE; + +#endif + +/* + * Pseudo-character tokens outside ASCII range. The curses wgetch() function + * will return any given one of these only if the corresponding k- capability + * is defined in your terminal's terminfo entry. + * + * Some keys (KEY_A1, etc) are arranged like this: + * a1 up a3 + * left b2 right + * c1 down c3 + * + * A few key codes do not depend upon the terminfo entry. + */ +#define KEY_CODE_YES 0400 /* A wchar_t contains a key code */ +#define KEY_MIN 0401 /* Minimum curses key */ +#define KEY_BREAK 0401 /* Break key (unreliable) */ +#define KEY_SRESET 0530 /* Soft (partial) reset (unreliable) */ +#define KEY_RESET 0531 /* Reset or hard reset (unreliable) */ +/* + * These definitions were generated by ./MKkey_defs.sh ./Caps + */ +#define KEY_DOWN 0402 /* down-arrow key */ +#define KEY_UP 0403 /* up-arrow key */ +#define KEY_LEFT 0404 /* left-arrow key */ +#define KEY_RIGHT 0405 /* right-arrow key */ +#define KEY_HOME 0406 /* home key */ +#define KEY_BACKSPACE 0407 /* backspace key */ +#define KEY_F0 0410 /* Function keys. Space for 64 */ +#define KEY_F(n) (KEY_F0 + (n)) /* Value of function key n */ +#define KEY_DL 0510 /* delete-line key */ +#define KEY_IL 0511 /* insert-line key */ +#define KEY_DC 0512 /* delete-character key */ +#define KEY_IC 0513 /* insert-character key */ +#define KEY_EIC 0514 /* sent by rmir or smir in insert mode */ +#define KEY_CLEAR 0515 /* clear-screen or erase key */ +#define KEY_EOS 0516 /* clear-to-end-of-screen key */ +#define KEY_EOL 0517 /* clear-to-end-of-line key */ +#define KEY_SF 0520 /* scroll-forward key */ +#define KEY_SR 0521 /* scroll-backward key */ +#define KEY_NPAGE 0522 /* next-page key */ +#define KEY_PPAGE 0523 /* previous-page key */ +#define KEY_STAB 0524 /* set-tab key */ +#define KEY_CTAB 0525 /* clear-tab key */ +#define KEY_CATAB 0526 /* clear-all-tabs key */ +#define KEY_ENTER 0527 /* enter/send key */ +#define KEY_PRINT 0532 /* print key */ +#define KEY_LL 0533 /* lower-left key (home down) */ +#define KEY_A1 0534 /* upper left of keypad */ +#define KEY_A3 0535 /* upper right of keypad */ +#define KEY_B2 0536 /* center of keypad */ +#define KEY_C1 0537 /* lower left of keypad */ +#define KEY_C3 0540 /* lower right of keypad */ +#define KEY_BTAB 0541 /* back-tab key */ +#define KEY_BEG 0542 /* begin key */ +#define KEY_CANCEL 0543 /* cancel key */ +#define KEY_CLOSE 0544 /* close key */ +#define KEY_COMMAND 0545 /* command key */ +#define KEY_COPY 0546 /* copy key */ +#define KEY_CREATE 0547 /* create key */ +#define KEY_END 0550 /* end key */ +#define KEY_EXIT 0551 /* exit key */ +#define KEY_FIND 0552 /* find key */ +#define KEY_HELP 0553 /* help key */ +#define KEY_MARK 0554 /* mark key */ +#define KEY_MESSAGE 0555 /* message key */ +#define KEY_MOVE 0556 /* move key */ +#define KEY_NEXT 0557 /* next key */ +#define KEY_OPEN 0560 /* open key */ +#define KEY_OPTIONS 0561 /* options key */ +#define KEY_PREVIOUS 0562 /* previous key */ +#define KEY_REDO 0563 /* redo key */ +#define KEY_REFERENCE 0564 /* reference key */ +#define KEY_REFRESH 0565 /* refresh key */ +#define KEY_REPLACE 0566 /* replace key */ +#define KEY_RESTART 0567 /* restart key */ +#define KEY_RESUME 0570 /* resume key */ +#define KEY_SAVE 0571 /* save key */ +#define KEY_SBEG 0572 /* shifted begin key */ +#define KEY_SCANCEL 0573 /* shifted cancel key */ +#define KEY_SCOMMAND 0574 /* shifted command key */ +#define KEY_SCOPY 0575 /* shifted copy key */ +#define KEY_SCREATE 0576 /* shifted create key */ +#define KEY_SDC 0577 /* shifted delete-character key */ +#define KEY_SDL 0600 /* shifted delete-line key */ +#define KEY_SELECT 0601 /* select key */ +#define KEY_SEND 0602 /* shifted end key */ +#define KEY_SEOL 0603 /* shifted clear-to-end-of-line key */ +#define KEY_SEXIT 0604 /* shifted exit key */ +#define KEY_SFIND 0605 /* shifted find key */ +#define KEY_SHELP 0606 /* shifted help key */ +#define KEY_SHOME 0607 /* shifted home key */ +#define KEY_SIC 0610 /* shifted insert-character key */ +#define KEY_SLEFT 0611 /* shifted left-arrow key */ +#define KEY_SMESSAGE 0612 /* shifted message key */ +#define KEY_SMOVE 0613 /* shifted move key */ +#define KEY_SNEXT 0614 /* shifted next key */ +#define KEY_SOPTIONS 0615 /* shifted options key */ +#define KEY_SPREVIOUS 0616 /* shifted previous key */ +#define KEY_SPRINT 0617 /* shifted print key */ +#define KEY_SREDO 0620 /* shifted redo key */ +#define KEY_SREPLACE 0621 /* shifted replace key */ +#define KEY_SRIGHT 0622 /* shifted right-arrow key */ +#define KEY_SRSUME 0623 /* shifted resume key */ +#define KEY_SSAVE 0624 /* shifted save key */ +#define KEY_SSUSPEND 0625 /* shifted suspend key */ +#define KEY_SUNDO 0626 /* shifted undo key */ +#define KEY_SUSPEND 0627 /* suspend key */ +#define KEY_UNDO 0630 /* undo key */ +#define KEY_MOUSE 0631 /* Mouse event has occurred */ +#define KEY_RESIZE 0632 /* Terminal resize event */ +#define KEY_EVENT 0633 /* We were interrupted by an event */ + +#define KEY_MAX 0777 /* Maximum key value is 0633 */ +/* $Id: curses.wide,v 1.50 2017/03/26 16:05:21 tom Exp $ */ +/* + * vile:cmode: + * This file is part of ncurses, designed to be appended after curses.h.in + * (see that file for the relevant copyright). + */ +#define _XOPEN_CURSES 1 + +#if NCURSES_WIDECHAR + +extern NCURSES_EXPORT_VAR(cchar_t*) _nc_wacs; + +#define NCURSES_WACS(c) (&_nc_wacs[NCURSES_CAST(unsigned char, (c))]) + +#define WACS_BSSB NCURSES_WACS('l') +#define WACS_SSBB NCURSES_WACS('m') +#define WACS_BBSS NCURSES_WACS('k') +#define WACS_SBBS NCURSES_WACS('j') +#define WACS_SBSS NCURSES_WACS('u') +#define WACS_SSSB NCURSES_WACS('t') +#define WACS_SSBS NCURSES_WACS('v') +#define WACS_BSSS NCURSES_WACS('w') +#define WACS_BSBS NCURSES_WACS('q') +#define WACS_SBSB NCURSES_WACS('x') +#define WACS_SSSS NCURSES_WACS('n') + +#define WACS_ULCORNER WACS_BSSB +#define WACS_LLCORNER WACS_SSBB +#define WACS_URCORNER WACS_BBSS +#define WACS_LRCORNER WACS_SBBS +#define WACS_RTEE WACS_SBSS +#define WACS_LTEE WACS_SSSB +#define WACS_BTEE WACS_SSBS +#define WACS_TTEE WACS_BSSS +#define WACS_HLINE WACS_BSBS +#define WACS_VLINE WACS_SBSB +#define WACS_PLUS WACS_SSSS + +#define WACS_S1 NCURSES_WACS('o') /* scan line 1 */ +#define WACS_S9 NCURSES_WACS('s') /* scan line 9 */ +#define WACS_DIAMOND NCURSES_WACS('`') /* diamond */ +#define WACS_CKBOARD NCURSES_WACS('a') /* checker board */ +#define WACS_DEGREE NCURSES_WACS('f') /* degree symbol */ +#define WACS_PLMINUS NCURSES_WACS('g') /* plus/minus */ +#define WACS_BULLET NCURSES_WACS('~') /* bullet */ + +/* Teletype 5410v1 symbols */ +#define WACS_LARROW NCURSES_WACS(',') /* arrow left */ +#define WACS_RARROW NCURSES_WACS('+') /* arrow right */ +#define WACS_DARROW NCURSES_WACS('.') /* arrow down */ +#define WACS_UARROW NCURSES_WACS('-') /* arrow up */ +#define WACS_BOARD NCURSES_WACS('h') /* board of squares */ +#define WACS_LANTERN NCURSES_WACS('i') /* lantern symbol */ +#define WACS_BLOCK NCURSES_WACS('0') /* solid square block */ + +/* ncurses extensions */ +#define WACS_S3 NCURSES_WACS('p') /* scan line 3 */ +#define WACS_S7 NCURSES_WACS('r') /* scan line 7 */ +#define WACS_LEQUAL NCURSES_WACS('y') /* less/equal */ +#define WACS_GEQUAL NCURSES_WACS('z') /* greater/equal */ +#define WACS_PI NCURSES_WACS('{') /* Pi */ +#define WACS_NEQUAL NCURSES_WACS('|') /* not equal */ +#define WACS_STERLING NCURSES_WACS('}') /* UK pound sign */ + +/* double lines */ +#define WACS_BDDB NCURSES_WACS('C') +#define WACS_DDBB NCURSES_WACS('D') +#define WACS_BBDD NCURSES_WACS('B') +#define WACS_DBBD NCURSES_WACS('A') +#define WACS_DBDD NCURSES_WACS('G') +#define WACS_DDDB NCURSES_WACS('F') +#define WACS_DDBD NCURSES_WACS('H') +#define WACS_BDDD NCURSES_WACS('I') +#define WACS_BDBD NCURSES_WACS('R') +#define WACS_DBDB NCURSES_WACS('Y') +#define WACS_DDDD NCURSES_WACS('E') + +#define WACS_D_ULCORNER WACS_BDDB +#define WACS_D_LLCORNER WACS_DDBB +#define WACS_D_URCORNER WACS_BBDD +#define WACS_D_LRCORNER WACS_DBBD +#define WACS_D_RTEE WACS_DBDD +#define WACS_D_LTEE WACS_DDDB +#define WACS_D_BTEE WACS_DDBD +#define WACS_D_TTEE WACS_BDDD +#define WACS_D_HLINE WACS_BDBD +#define WACS_D_VLINE WACS_DBDB +#define WACS_D_PLUS WACS_DDDD + +/* thick lines */ +#define WACS_BTTB NCURSES_WACS('L') +#define WACS_TTBB NCURSES_WACS('M') +#define WACS_BBTT NCURSES_WACS('K') +#define WACS_TBBT NCURSES_WACS('J') +#define WACS_TBTT NCURSES_WACS('U') +#define WACS_TTTB NCURSES_WACS('T') +#define WACS_TTBT NCURSES_WACS('V') +#define WACS_BTTT NCURSES_WACS('W') +#define WACS_BTBT NCURSES_WACS('Q') +#define WACS_TBTB NCURSES_WACS('X') +#define WACS_TTTT NCURSES_WACS('N') + +#define WACS_T_ULCORNER WACS_BTTB +#define WACS_T_LLCORNER WACS_TTBB +#define WACS_T_URCORNER WACS_BBTT +#define WACS_T_LRCORNER WACS_TBBT +#define WACS_T_RTEE WACS_TBTT +#define WACS_T_LTEE WACS_TTTB +#define WACS_T_BTEE WACS_TTBT +#define WACS_T_TTEE WACS_BTTT +#define WACS_T_HLINE WACS_BTBT +#define WACS_T_VLINE WACS_TBTB +#define WACS_T_PLUS WACS_TTTT + +/* + * Function prototypes for wide-character operations. + * + * "generated" comments should include ":WIDEC" to make the corresponding + * functions ifdef'd in lib_gen.c + * + * "implemented" comments do not need this marker. + */ + +extern NCURSES_EXPORT(int) add_wch(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + add_wchnstr(const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) add_wchstr(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) addnwstr(const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) addwstr(const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) bkgrnd(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(void) bkgrndset(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) border_set( + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + box_set(WINDOW*, const cchar_t*, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) echo_wchar(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) erasewchar(wchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) get_wch(wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) get_wstr(wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) getbkgrnd(cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) getcchar( + const cchar_t*, + wchar_t*, + attr_t*, + NCURSES_PAIRS_T*, + void*); /* implemented */ +extern NCURSES_EXPORT(int) getn_wstr(wint_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) hline_set(const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) in_wch(cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) in_wchnstr(cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) in_wchstr(cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) innwstr(wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) ins_nwstr(const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) ins_wch(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) ins_wstr(const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) inwstr(wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(NCURSES_CONST char*) key_name(wchar_t); /* implemented */ +extern NCURSES_EXPORT(int) killwchar(wchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + mvadd_wch(int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvadd_wchnstr(int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvadd_wchstr(int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvaddnwstr(int, int, const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvaddwstr(int, int, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvget_wch(int, int, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvget_wstr(int, int, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvgetn_wstr(int, int, wint_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvhline_set(int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvin_wch(int, int, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvin_wchnstr(int, int, cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvin_wchstr(int, int, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvinnwstr(int, int, wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvins_nwstr(int, int, const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvins_wch(int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvins_wstr(int, int, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvinwstr(int, int, wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvvline_set(int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwadd_wch(WINDOW*, int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwadd_wchnstr( + WINDOW*, + int, + int, + const cchar_t*, + int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwadd_wchstr(WINDOW*, int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwaddnwstr(WINDOW*, int, int, const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwaddwstr(WINDOW*, int, int, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwget_wch(WINDOW*, int, int, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwget_wstr(WINDOW*, int, int, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwgetn_wstr(WINDOW*, int, int, wint_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwhline_set(WINDOW*, int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwin_wch(WINDOW*, int, int, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwin_wchnstr(WINDOW*, int, int, cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwin_wchstr(WINDOW*, int, int, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwinnwstr(WINDOW*, int, int, wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwins_nwstr(WINDOW*, int, int, const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwins_wch(WINDOW*, int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwins_wstr(WINDOW*, int, int, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwinwstr(WINDOW*, int, int, wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwvline_set(WINDOW*, int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + pecho_wchar(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) setcchar( + cchar_t*, + const wchar_t*, + const attr_t, + NCURSES_PAIRS_T, + const void*); /* implemented */ +extern NCURSES_EXPORT(int) slk_wset(int, const wchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(attr_t) term_attrs(void); /* implemented */ +extern NCURSES_EXPORT(int) unget_wch(const wchar_t); /* implemented */ +extern NCURSES_EXPORT(int) + vid_attr(attr_t, NCURSES_PAIRS_T, void*); /* implemented */ +extern NCURSES_EXPORT(int) + vid_puts(attr_t, NCURSES_PAIRS_T, void*, NCURSES_OUTC); /* implemented */ +extern NCURSES_EXPORT(int) vline_set(const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wadd_wch(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + wadd_wchnstr(WINDOW*, const cchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) + wadd_wchstr(WINDOW*, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + waddnwstr(WINDOW*, const wchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) + waddwstr(WINDOW*, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wbkgrnd(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(void) + wbkgrndset(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) wborder_set( + WINDOW*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + wecho_wchar(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) wget_wch(WINDOW*, wint_t*); /* implemented */ +extern NCURSES_EXPORT(int) wget_wstr(WINDOW*, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wgetbkgrnd(WINDOW*, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wgetn_wstr(WINDOW*, wint_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) + whline_set(WINDOW*, const cchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) win_wch(WINDOW*, cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + win_wchnstr(WINDOW*, cchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) win_wchstr(WINDOW*, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) winnwstr(WINDOW*, wchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) + wins_nwstr(WINDOW*, const wchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) wins_wch(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + wins_wstr(WINDOW*, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) winwstr(WINDOW*, wchar_t*); /* implemented */ +extern NCURSES_EXPORT(wchar_t*) wunctrl(cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + wvline_set(WINDOW*, const cchar_t*, int); /* implemented */ + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(attr_t) + NCURSES_SP_NAME(term_attrs)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + unget_wch)(SCREEN*, const wchar_t); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(wchar_t*) + NCURSES_SP_NAME(wunctrl)(SCREEN*, cchar_t*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_attr)( + SCREEN*, + attr_t, + NCURSES_PAIRS_T, + void*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts)( + SCREEN*, + attr_t, + NCURSES_PAIRS_T, + void*, + NCURSES_SP_OUTC); /* implemented:SP_FUNC */ +#endif + +#ifndef NCURSES_NOMACROS + +/* + * XSI curses macros for XPG4 conformance. + */ +#define add_wch(c) wadd_wch(stdscr, (c)) +#define add_wchnstr(str, n) wadd_wchnstr(stdscr, (str), (n)) +#define add_wchstr(str) wadd_wchstr(stdscr, (str)) +#define addnwstr(wstr, n) waddnwstr(stdscr, (wstr), (n)) +#define addwstr(wstr) waddwstr(stdscr, (wstr)) +#define bkgrnd(c) wbkgrnd(stdscr, (c)) +#define bkgrndset(c) wbkgrndset(stdscr, (c)) +#define border_set(l, r, t, b, tl, tr, bl, br) \ + wborder_set(stdscr, (l), (r), (t), (b), tl, tr, bl, br) +#define box_set(w, v, h) wborder_set((w), (v), (v), (h), (h), 0, 0, 0, 0) +#define echo_wchar(c) wecho_wchar(stdscr, (c)) +#define get_wch(c) wget_wch(stdscr, (c)) +#define get_wstr(t) wget_wstr(stdscr, (t)) +#define getbkgrnd(wch) wgetbkgrnd(stdscr, (wch)) +#define getn_wstr(t, n) wgetn_wstr(stdscr, (t), (n)) +#define hline_set(c, n) whline_set(stdscr, (c), (n)) +#define in_wch(c) win_wch(stdscr, (c)) +#define in_wchnstr(c, n) win_wchnstr(stdscr, (c), (n)) +#define in_wchstr(c) win_wchstr(stdscr, (c)) +#define innwstr(c, n) winnwstr(stdscr, (c), (n)) +#define ins_nwstr(t, n) wins_nwstr(stdscr, (t), (n)) +#define ins_wch(c) wins_wch(stdscr, (c)) +#define ins_wstr(t) wins_wstr(stdscr, (t)) +#define inwstr(c) winwstr(stdscr, (c)) +#define vline_set(c, n) wvline_set(stdscr, (c), (n)) +#define wadd_wchstr(win, str) wadd_wchnstr((win), (str), -1) +#define waddwstr(win, wstr) waddnwstr((win), (wstr), -1) +#define wget_wstr(w, t) wgetn_wstr((w), (t), -1) +#define win_wchstr(w, c) win_wchnstr((w), (c), -1) +#define wins_wstr(w, t) wins_nwstr((w), (t), -1) + +#if !NCURSES_OPAQUE +#define wgetbkgrnd(win, wch) \ + (NCURSES_OK_ADDR(wch) ? ((win) ? (*(wch) = (win)->_bkgrnd) : *(wch), OK) \ + : ERR) +#endif + +#define mvadd_wch(y, x, c) mvwadd_wch(stdscr, (y), (x), (c)) +#define mvadd_wchnstr(y, x, s, n) mvwadd_wchnstr(stdscr, (y), (x), (s), (n)) +#define mvadd_wchstr(y, x, s) mvwadd_wchstr(stdscr, (y), (x), (s)) +#define mvaddnwstr(y, x, wstr, n) mvwaddnwstr(stdscr, (y), (x), (wstr), (n)) +#define mvaddwstr(y, x, wstr) mvwaddwstr(stdscr, (y), (x), (wstr)) +#define mvget_wch(y, x, c) mvwget_wch(stdscr, (y), (x), (c)) +#define mvget_wstr(y, x, t) mvwget_wstr(stdscr, (y), (x), (t)) +#define mvgetn_wstr(y, x, t, n) mvwgetn_wstr(stdscr, (y), (x), (t), (n)) +#define mvhline_set(y, x, c, n) mvwhline_set(stdscr, (y), (x), (c), (n)) +#define mvin_wch(y, x, c) mvwin_wch(stdscr, (y), (x), (c)) +#define mvin_wchnstr(y, x, c, n) mvwin_wchnstr(stdscr, (y), (x), (c), (n)) +#define mvin_wchstr(y, x, c) mvwin_wchstr(stdscr, (y), (x), (c)) +#define mvinnwstr(y, x, c, n) mvwinnwstr(stdscr, (y), (x), (c), (n)) +#define mvins_nwstr(y, x, t, n) mvwins_nwstr(stdscr, (y), (x), (t), (n)) +#define mvins_wch(y, x, c) mvwins_wch(stdscr, (y), (x), (c)) +#define mvins_wstr(y, x, t) mvwins_wstr(stdscr, (y), (x), (t)) +#define mvinwstr(y, x, c) mvwinwstr(stdscr, (y), (x), (c)) +#define mvvline_set(y, x, c, n) mvwvline_set(stdscr, (y), (x), (c), (n)) + +#define mvwadd_wch(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : wadd_wch((win), (c))) +#define mvwadd_wchnstr(win, y, x, s, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : wadd_wchnstr((win), (s), (n))) +#define mvwadd_wchstr(win, y, x, s) \ + (wmove(win, (y), (x)) == ERR ? ERR : wadd_wchstr((win), (s))) +#define mvwaddnwstr(win, y, x, wstr, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : waddnwstr((win), (wstr), (n))) +#define mvwaddwstr(win, y, x, wstr) \ + (wmove(win, (y), (x)) == ERR ? ERR : waddwstr((win), (wstr))) +#define mvwget_wch(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : wget_wch((win), (c))) +#define mvwget_wstr(win, y, x, t) \ + (wmove(win, (y), (x)) == ERR ? ERR : wget_wstr((win), (t))) +#define mvwgetn_wstr(win, y, x, t, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : wgetn_wstr((win), (t), (n))) +#define mvwhline_set(win, y, x, c, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : whline_set((win), (c), (n))) +#define mvwin_wch(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : win_wch((win), (c))) +#define mvwin_wchnstr(win, y, x, c, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : win_wchnstr((win), (c), (n))) +#define mvwin_wchstr(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : win_wchstr((win), (c))) +#define mvwinnwstr(win, y, x, c, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : winnwstr((win), (c), (n))) +#define mvwins_nwstr(win, y, x, t, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : wins_nwstr((win), (t), (n))) +#define mvwins_wch(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : wins_wch((win), (c))) +#define mvwins_wstr(win, y, x, t) \ + (wmove(win, (y), (x)) == ERR ? ERR : wins_wstr((win), (t))) +#define mvwinwstr(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : winwstr((win), (c))) +#define mvwvline_set(win, y, x, c, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : wvline_set((win), (c), (n))) + +#endif /* NCURSES_NOMACROS */ + +#if defined(TRACE) || defined(NCURSES_TEST) +extern NCURSES_EXPORT(const char*) _nc_viswbuf(const wchar_t*); +extern NCURSES_EXPORT(const char*) _nc_viswibuf(const wint_t*); +#endif + +#endif /* NCURSES_WIDECHAR */ +/* $Id: curses.tail,v 1.23 2016/02/13 16:37:45 tom Exp $ */ +/* + * vile:cmode: + * This file is part of ncurses, designed to be appended after curses.h.in + * (see that file for the relevant copyright). + */ + +/* mouse interface */ + +#if NCURSES_MOUSE_VERSION > 1 +#define NCURSES_MOUSE_MASK(b, m) ((m) << (((b)-1) * 5)) +#else +#define NCURSES_MOUSE_MASK(b, m) ((m) << (((b)-1) * 6)) +#endif + +#define NCURSES_BUTTON_RELEASED 001L +#define NCURSES_BUTTON_PRESSED 002L +#define NCURSES_BUTTON_CLICKED 004L +#define NCURSES_DOUBLE_CLICKED 010L +#define NCURSES_TRIPLE_CLICKED 020L +#define NCURSES_RESERVED_EVENT 040L + +/* event masks */ +#define BUTTON1_RELEASED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED) +#define BUTTON1_PRESSED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED) +#define BUTTON1_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED) +#define BUTTON1_DOUBLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED) +#define BUTTON1_TRIPLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED) + +#define BUTTON2_RELEASED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED) +#define BUTTON2_PRESSED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED) +#define BUTTON2_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED) +#define BUTTON2_DOUBLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED) +#define BUTTON2_TRIPLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED) + +#define BUTTON3_RELEASED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED) +#define BUTTON3_PRESSED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED) +#define BUTTON3_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED) +#define BUTTON3_DOUBLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED) +#define BUTTON3_TRIPLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED) + +#define BUTTON4_RELEASED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED) +#define BUTTON4_PRESSED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED) +#define BUTTON4_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED) +#define BUTTON4_DOUBLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED) +#define BUTTON4_TRIPLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED) + +/* + * In 32 bits the version-1 scheme does not provide enough space for a 5th + * button, unless we choose to change the ABI by omitting the reserved-events. + */ +#if NCURSES_MOUSE_VERSION > 1 + +#define BUTTON5_RELEASED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED) +#define BUTTON5_PRESSED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED) +#define BUTTON5_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED) +#define BUTTON5_DOUBLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED) +#define BUTTON5_TRIPLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED) + +#define BUTTON_CTRL NCURSES_MOUSE_MASK(6, 0001L) +#define BUTTON_SHIFT NCURSES_MOUSE_MASK(6, 0002L) +#define BUTTON_ALT NCURSES_MOUSE_MASK(6, 0004L) +#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(6, 0010L) + +#else + +#define BUTTON1_RESERVED_EVENT NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT) +#define BUTTON2_RESERVED_EVENT NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT) +#define BUTTON3_RESERVED_EVENT NCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT) +#define BUTTON4_RESERVED_EVENT NCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT) + +#define BUTTON_CTRL NCURSES_MOUSE_MASK(5, 0001L) +#define BUTTON_SHIFT NCURSES_MOUSE_MASK(5, 0002L) +#define BUTTON_ALT NCURSES_MOUSE_MASK(5, 0004L) +#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(5, 0010L) + +#endif + +#define ALL_MOUSE_EVENTS (REPORT_MOUSE_POSITION - 1) + +/* macros to extract single event-bits from masks */ +#define BUTTON_RELEASE(e, x) ((e)&NCURSES_MOUSE_MASK(x, 001)) +#define BUTTON_PRESS(e, x) ((e)&NCURSES_MOUSE_MASK(x, 002)) +#define BUTTON_CLICK(e, x) ((e)&NCURSES_MOUSE_MASK(x, 004)) +#define BUTTON_DOUBLE_CLICK(e, x) ((e)&NCURSES_MOUSE_MASK(x, 010)) +#define BUTTON_TRIPLE_CLICK(e, x) ((e)&NCURSES_MOUSE_MASK(x, 020)) +#define BUTTON_RESERVED_EVENT(e, x) ((e)&NCURSES_MOUSE_MASK(x, 040)) + +typedef struct { + short id; /* ID to distinguish multiple devices */ + int x, y, z; /* event coordinates (character-cell) */ + mmask_t bstate; /* button state bits */ +} MEVENT; + +extern NCURSES_EXPORT(bool) has_mouse(void); +extern NCURSES_EXPORT(int) getmouse(MEVENT*); +extern NCURSES_EXPORT(int) ungetmouse(MEVENT*); +extern NCURSES_EXPORT(mmask_t) mousemask(mmask_t, mmask_t*); +extern NCURSES_EXPORT(bool) wenclose(const WINDOW*, int, int); +extern NCURSES_EXPORT(int) mouseinterval(int); +extern NCURSES_EXPORT(bool) wmouse_trafo(const WINDOW*, int*, int*, bool); +extern NCURSES_EXPORT(bool) mouse_trafo(int*, int*, bool); /* generated */ + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_mouse)(SCREEN*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(getmouse)(SCREEN*, MEVENT*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetmouse)(SCREEN*, MEVENT*); +extern NCURSES_EXPORT(mmask_t) + NCURSES_SP_NAME(mousemask)(SCREEN*, mmask_t, mmask_t*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mouseinterval)(SCREEN*, int); +#endif + +#ifndef NCURSES_NOMACROS +#define mouse_trafo(y, x, to_screen) wmouse_trafo(stdscr, y, x, to_screen) +#endif + +/* other non-XSI functions */ + +extern NCURSES_EXPORT(int) mcprint(char*, int); /* direct data to printer */ +extern NCURSES_EXPORT(int) has_key(int); /* do we have given key? */ + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(has_key)(SCREEN*, int); /* do we have given key? */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(mcprint)(SCREEN*, char*, int); /* direct data to printer */ +#endif + +/* Debugging : use with libncurses_g.a */ + +extern NCURSES_EXPORT(void) _tracef(const char*, ...) GCC_PRINTFLIKE(1, 2); +extern NCURSES_EXPORT(char*) _traceattr(attr_t); +extern NCURSES_EXPORT(char*) _traceattr2(int, chtype); +extern NCURSES_EXPORT(char*) _tracechar(int); +extern NCURSES_EXPORT(char*) _tracechtype(chtype); +extern NCURSES_EXPORT(char*) _tracechtype2(int, chtype); +#if NCURSES_WIDECHAR +#define _tracech_t _tracecchar_t +extern NCURSES_EXPORT(char*) _tracecchar_t(const cchar_t*); +#define _tracech_t2 _tracecchar_t2 +extern NCURSES_EXPORT(char*) _tracecchar_t2(int, const cchar_t*); +#else +#define _tracech_t _tracechtype +#define _tracech_t2 _tracechtype2 +#endif +extern NCURSES_EXPORT(void) trace(const unsigned int); + +/* trace masks */ +#define TRACE_DISABLE 0x0000 /* turn off tracing */ +#define TRACE_TIMES 0x0001 /* trace user and system times of updates */ +#define TRACE_TPUTS 0x0002 /* trace tputs calls */ +#define TRACE_UPDATE 0x0004 /* trace update actions, old & new screens */ +#define TRACE_MOVE 0x0008 /* trace cursor moves and scrolls */ +#define TRACE_CHARPUT 0x0010 /* trace all character outputs */ +#define TRACE_ORDINARY 0x001F /* trace all update actions */ +#define TRACE_CALLS 0x0020 /* trace all curses calls */ +#define TRACE_VIRTPUT 0x0040 /* trace virtual character puts */ +#define TRACE_IEVENT 0x0080 /* trace low-level input processing */ +#define TRACE_BITS 0x0100 /* trace state of TTY control bits */ +#define TRACE_ICALLS 0x0200 /* trace internal/nested calls */ +#define TRACE_CCALLS 0x0400 /* trace per-character calls */ +#define TRACE_DATABASE 0x0800 /* trace read/write of terminfo/termcap data */ +#define TRACE_ATTRS 0x1000 /* trace attribute updates */ + +#define TRACE_SHIFT 13 /* number of bits in the trace masks */ +#define TRACE_MAXIMUM ((1 << TRACE_SHIFT) - 1) /* maximum trace level */ + +#if defined(TRACE) || defined(NCURSES_TEST) +extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable; /* enable optimizations */ +extern NCURSES_EXPORT(const char*) _nc_visbuf(const char*); +#define OPTIMIZE_MVCUR 0x01 /* cursor movement optimization */ +#define OPTIMIZE_HASHMAP 0x02 /* diff hashing to detect scrolls */ +#define OPTIMIZE_SCROLL 0x04 /* scroll optimization */ +#define OPTIMIZE_ALL 0xff /* enable all optimizations (dflt) */ +#endif + +#include + +#ifdef __cplusplus + +#ifndef NCURSES_NOMACROS + +/* these names conflict with STL */ +#undef box +#undef clear +#undef erase +#undef move +#undef refresh + +#endif /* NCURSES_NOMACROS */ +} +#endif + +#endif /* __NCURSES_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/cursesapp.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/cursesapp.h new file mode 100644 index 0000000..b2f7bbd --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/cursesapp.h @@ -0,0 +1,174 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998-2005,2011 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1997 * + ****************************************************************************/ + +// $Id: cursesapp.h,v 1.12 2011/09/17 22:12:10 tom Exp $ + +#ifndef NCURSES_CURSESAPP_H_incl +#define NCURSES_CURSESAPP_H_incl + +#include + +class NCURSES_IMPEXP NCursesApplication { + public: + typedef struct _slk_link { // This structure is used to maintain + struct _slk_link* prev; // a stack of SLKs + Soft_Label_Key_Set* SLKs; + } SLK_Link; + + private: + static int rinit(NCursesWindow& w); // Internal Init function for title + static NCursesApplication* theApp; // Global ref. to the application + + static SLK_Link* slk_stack; + + protected: + static NCursesWindow* titleWindow; // The Title Window (if any) + + bool b_Colors; // Is this a color application? + NCursesWindow* Root_Window; // This is the stdscr equiv. + + // Initialization of attributes; + // Rewrite this in your derived class if you prefer other settings + virtual void init(bool bColors); + + // The number of lines for the title window. Default is no title window + // You may rewrite this in your derived class + virtual int titlesize() const { + return 0; + } + + // This method is called to put something into the title window initially + // You may rewrite this in your derived class + virtual void title() {} + + // The layout used for the Soft Label Keys. Default is to have no SLKs. + // You may rewrite this in your derived class + virtual Soft_Label_Key_Set::Label_Layout useSLKs() const { + return Soft_Label_Key_Set::None; + } + + // This method is called to initialize the SLKs. Default is nothing. + // You may rewrite this in your derived class + virtual void init_labels(Soft_Label_Key_Set& S) const { + (void)S; + } + + // Your derived class must implement this method. The return value must + // be the exit value of your application. + virtual int run() = 0; + + // The constructor is protected, so you may use it in your derived + // class constructor. The argument tells whether or not you want colors. + NCursesApplication(bool wantColors = FALSE); + + NCursesApplication& operator=(const NCursesApplication& rhs) { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesApplication(const NCursesApplication& rhs) + : b_Colors(rhs.b_Colors), Root_Window(rhs.Root_Window) {} + + public: + virtual ~NCursesApplication(); + + // Get a pointer to the current application object + static NCursesApplication* getApplication() { + return theApp; + } + + // This method runs the application and returns its exit value + int operator()(void); + + // Process the commandline arguments. The default implementation simply + // ignores them. Your derived class may rewrite this. + virtual void handleArgs(int argc, char* argv[]) { + (void)argc; + (void)argv; + } + + // Does this application use colors? + inline bool useColors() const { + return b_Colors; + } + + // Push the Key Set S onto the SLK Stack. S then becomes the current set + // of Soft Labelled Keys. + void push(Soft_Label_Key_Set& S); + + // Throw away the current set of SLKs and make the previous one the + // new current set. + bool pop(); + + // Retrieve the current set of Soft Labelled Keys. + Soft_Label_Key_Set* top() const; + + // Attributes to use for menu and forms foregrounds + virtual chtype foregrounds() const { + return b_Colors ? static_cast(COLOR_PAIR(1)) : A_BOLD; + } + + // Attributes to use for menu and forms backgrounds + virtual chtype backgrounds() const { + return b_Colors ? static_cast(COLOR_PAIR(2)) : A_NORMAL; + } + + // Attributes to use for inactive (menu) elements + virtual chtype inactives() const { + return b_Colors ? static_cast(COLOR_PAIR(3) | A_DIM) : A_DIM; + } + + // Attributes to use for (form) labels and SLKs + virtual chtype labels() const { + return b_Colors ? static_cast(COLOR_PAIR(4)) : A_NORMAL; + } + + // Attributes to use for form backgrounds + virtual chtype dialog_backgrounds() const { + return b_Colors ? static_cast(COLOR_PAIR(4)) : A_NORMAL; + } + + // Attributes to use as default for (form) window backgrounds + virtual chtype window_backgrounds() const { + return b_Colors ? static_cast(COLOR_PAIR(5)) : A_NORMAL; + } + + // Attributes to use for the title window + virtual chtype screen_titles() const { + return b_Colors ? static_cast(COLOR_PAIR(6)) : A_BOLD; + } +}; + +#endif /* NCURSES_CURSESAPP_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/cursesf.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/cursesf.h new file mode 100644 index 0000000..13ac431 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/cursesf.h @@ -0,0 +1,949 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998-2012,2014 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1997 * + ****************************************************************************/ + +// $Id: cursesf.h,v 1.32 2014/08/09 22:06:11 Adam.Jiang Exp $ + +#ifndef NCURSES_CURSESF_H_incl +#define NCURSES_CURSESF_H_incl 1 + +#include + +#ifndef __EXT_QNX +#include +#endif + +extern "C" { +#include +} +// +// ------------------------------------------------------------------------- +// The abstract base class for buitin and user defined Fieldtypes. +// ------------------------------------------------------------------------- +// +class NCURSES_IMPEXP NCursesFormField; // forward declaration + +// Class to represent builtin field types as well as C++ written new +// fieldtypes (see classes UserDefineFieldType... +class NCURSES_IMPEXP NCursesFieldType { + friend class NCursesFormField; + + protected: + FIELDTYPE* fieldtype; + + inline void OnError(int err) const + THROW2(NCursesException const, NCursesFormException) { + if (err != E_OK) + THROW(new NCursesFormException(err)); + } + + NCursesFieldType(FIELDTYPE* f) : fieldtype(f) {} + + virtual ~NCursesFieldType() {} + + // Set the fields f fieldtype to this one. + virtual void set(NCursesFormField& f) = 0; + + public: + NCursesFieldType() : fieldtype(STATIC_CAST(FIELDTYPE*)(0)) {} + + NCursesFieldType& operator=(const NCursesFieldType& rhs) { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesFieldType(const NCursesFieldType& rhs) : fieldtype(rhs.fieldtype) {} +}; + +// +// ------------------------------------------------------------------------- +// The class representing a forms field, wrapping the lowlevel FIELD struct +// ------------------------------------------------------------------------- +// +class NCURSES_IMPEXP NCursesFormField { + friend class NCursesForm; + + protected: + FIELD* field; // lowlevel structure + NCursesFieldType* ftype; // Associated field type + + // Error handler + inline void OnError(int err) const + THROW2(NCursesException const, NCursesFormException) { + if (err != E_OK) + THROW(new NCursesFormException(err)); + } + + public: + // Create a 'Null' field. Can be used to delimit a field list + NCursesFormField() + : field(STATIC_CAST(FIELD*)(0)), + ftype(STATIC_CAST(NCursesFieldType*)(0)) {} + + // Create a new field + NCursesFormField( + int rows, + int ncols, + int first_row = 0, + int first_col = 0, + int offscreen_rows = 0, + int additional_buffers = 0) + : field(0), ftype(STATIC_CAST(NCursesFieldType*)(0)) { + field = ::new_field( + rows, ncols, first_row, first_col, offscreen_rows, additional_buffers); + if (!field) + OnError(errno); + } + + NCursesFormField& operator=(const NCursesFormField& rhs) { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesFormField(const NCursesFormField& rhs) + : field(rhs.field), ftype(rhs.ftype) {} + + virtual ~NCursesFormField(); + + // Duplicate the field at a new position + inline NCursesFormField* dup(int first_row, int first_col) { + NCursesFormField* f = new NCursesFormField(); + if (!f) + OnError(E_SYSTEM_ERROR); + else { + f->ftype = ftype; + f->field = ::dup_field(field, first_row, first_col); + if (!f->field) + OnError(errno); + } + return f; + } + + // Link the field to a new location + inline NCursesFormField* link(int first_row, int first_col) { + NCursesFormField* f = new NCursesFormField(); + if (!f) + OnError(E_SYSTEM_ERROR); + else { + f->ftype = ftype; + f->field = ::link_field(field, first_row, first_col); + if (!f->field) + OnError(errno); + } + return f; + } + + // Get the lowlevel field representation + inline FIELD* get_field() const { + return field; + } + + // Retrieve info about the field + inline void info( + int& rows, + int& ncols, + int& first_row, + int& first_col, + int& offscreen_rows, + int& additional_buffers) const { + OnError( + ::field_info( + field, + &rows, + &ncols, + &first_row, + &first_col, + &offscreen_rows, + &additional_buffers)); + } + + // Retrieve info about the fields dynamic properties. + inline void + dynamic_info(int& dynamic_rows, int& dynamic_cols, int& max_growth) const { + OnError( + ::dynamic_field_info(field, &dynamic_rows, &dynamic_cols, &max_growth)); + } + + // For a dynamic field you may set the maximum growth limit. + // A zero means unlimited growth. + inline void set_maximum_growth(int growth = 0) { + OnError(::set_max_field(field, growth)); + } + + // Move the field to a new position + inline void move(int row, int col) { + OnError(::move_field(field, row, col)); + } + + // Mark the field to start a new page + inline void new_page(bool pageFlag = FALSE) { + OnError(::set_new_page(field, pageFlag)); + } + + // Retrieve whether or not the field starts a new page. + inline bool is_new_page() const { + return ::new_page(field); + } + + // Set the justification for the field + inline void set_justification(int just) { + OnError(::set_field_just(field, just)); + } + + // Retrieve the fields justification + inline int justification() const { + return ::field_just(field); + } + // Set the foreground attribute for the field + inline void set_foreground(chtype foreground) { + OnError(::set_field_fore(field, foreground)); + } + + // Retrieve the fields foreground attribute + inline chtype fore() const { + return ::field_fore(field); + } + + // Set the background attribute for the field + inline void set_background(chtype background) { + OnError(::set_field_back(field, background)); + } + + // Retrieve the fields background attribute + inline chtype back() const { + return ::field_back(field); + } + + // Set the padding character for the field + inline void set_pad_character(int padding) { + OnError(::set_field_pad(field, padding)); + } + + // Retrieve the fields padding character + inline int pad() const { + return ::field_pad(field); + } + + // Switch on the fields options + inline void options_on(Field_Options opts) { + OnError(::field_opts_on(field, opts)); + } + + // Switch off the fields options + inline void options_off(Field_Options opts) { + OnError(::field_opts_off(field, opts)); + } + + // Retrieve the fields options + inline Field_Options options() const { + return ::field_opts(field); + } + + // Set the fields options + inline void set_options(Field_Options opts) { + OnError(::set_field_opts(field, opts)); + } + + // Mark the field as changed + inline void set_changed(bool changeFlag = TRUE) { + OnError(::set_field_status(field, changeFlag)); + } + + // Test whether or not the field is marked as changed + inline bool changed() const { + return ::field_status(field); + } + + // Return the index of the field in the field array of a form + // or -1 if the field is not associated to a form + inline int(index)() const { + return ::field_index(field); + } + + // Store a value in a fields buffer. The default buffer is nr. 0 + inline void set_value(const char* val, int buffer = 0) { + OnError(::set_field_buffer(field, buffer, val)); + } + + // Retrieve the value of a fields buffer. The default buffer is nr. 0 + inline char* value(int buffer = 0) const { + return ::field_buffer(field, buffer); + } + + // Set the validation type of the field. + inline void set_fieldtype(NCursesFieldType& f) { + ftype = &f; + f.set(*this); // A good friend may do that... + } + + // Retrieve the validation type of the field. + inline NCursesFieldType* fieldtype() const { + return ftype; + } +}; + +// This are the built-in hook functions in this C++ binding. In C++ we use +// virtual member functions (see below On_..._Init and On_..._Termination) +// to provide this functionality in an object oriented manner. +extern "C" { +void _nc_xx_frm_init(FORM*); +void _nc_xx_frm_term(FORM*); +void _nc_xx_fld_init(FORM*); +void _nc_xx_fld_term(FORM*); +} + +// +// ------------------------------------------------------------------------- +// The class representing a form, wrapping the lowlevel FORM struct +// ------------------------------------------------------------------------- +// +class NCURSES_IMPEXP NCursesForm : public NCursesPanel { + protected: + FORM* form; // the lowlevel structure + + private: + NCursesWindow* sub; // the subwindow object + bool b_sub_owner; // is this our own subwindow? + bool b_framed; // has the form a border? + bool b_autoDelete; // Delete fields when deleting form? + + NCursesFormField** my_fields; // The array of fields for this form + + // This structure is used for the form's user data field to link the + // FORM* to the C++ object and to provide extra space for a user pointer. + typedef struct { + void* m_user; // the pointer for the user's data + const NCursesForm* m_back; // backward pointer to C++ object + const FORM* m_owner; + } UserHook; + + // Get the backward pointer to the C++ object from a FORM + static inline NCursesForm* getHook(const FORM* f) { + UserHook* hook = reinterpret_cast(::form_userptr(f)); + assert(hook != 0 && hook->m_owner == f); + return const_cast(hook->m_back); + } + + friend void _nc_xx_frm_init(FORM*); + friend void _nc_xx_frm_term(FORM*); + friend void _nc_xx_fld_init(FORM*); + friend void _nc_xx_fld_term(FORM*); + + // Calculate FIELD* array for the menu + FIELD** mapFields(NCursesFormField* nfields[]); + + protected: + // internal routines + inline void set_user(void* user) { + UserHook* uptr = reinterpret_cast(::form_userptr(form)); + assert(uptr != 0 && uptr->m_back == this && uptr->m_owner == form); + uptr->m_user = user; + } + + inline void* get_user() { + UserHook* uptr = reinterpret_cast(::form_userptr(form)); + assert(uptr != 0 && uptr->m_back == this && uptr->m_owner == form); + return uptr->m_user; + } + + void + InitForm(NCursesFormField* Fields[], bool with_frame, bool autoDeleteFields); + + inline void OnError(int err) const + THROW2(NCursesException const, NCursesFormException) { + if (err != E_OK) + THROW(new NCursesFormException(err)); + } + + // this wraps the form_driver call. + virtual int driver(int c); + + // 'Internal' constructor, builds an object without association to a + // field array. + NCursesForm(int nlines, int ncols, int begin_y = 0, int begin_x = 0) + : NCursesPanel(nlines, ncols, begin_y, begin_x), + form(STATIC_CAST(FORM*)(0)), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_fields(0) {} + + public: + // Create form for the default panel. + NCursesForm( + NCursesFormField* Fields[], + bool with_frame = FALSE, // reserve space for a frame? + bool autoDelete_Fields = FALSE) // do automatic cleanup? + : NCursesPanel(), + form(0), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_fields(0) { + InitForm(Fields, with_frame, autoDelete_Fields); + } + + // Create a form in a panel with the given position and size. + NCursesForm( + NCursesFormField* Fields[], + int nlines, + int ncols, + int begin_y, + int begin_x, + bool with_frame = FALSE, // reserve space for a frame? + bool autoDelete_Fields = FALSE) // do automatic cleanup? + : NCursesPanel(nlines, ncols, begin_y, begin_x), + form(0), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_fields(0) { + InitForm(Fields, with_frame, autoDelete_Fields); + } + + NCursesForm& operator=(const NCursesForm& rhs) { + if (this != &rhs) { + *this = rhs; + NCursesPanel::operator=(rhs); + } + return *this; + } + + NCursesForm(const NCursesForm& rhs) + : NCursesPanel(rhs), + form(rhs.form), + sub(rhs.sub), + b_sub_owner(rhs.b_sub_owner), + b_framed(rhs.b_framed), + b_autoDelete(rhs.b_autoDelete), + my_fields(rhs.my_fields) {} + + virtual ~NCursesForm(); + + // Set the default attributes for the form + virtual void setDefaultAttributes(); + + // Retrieve current field of the form. + inline NCursesFormField* current_field() const { + return my_fields[ ::field_index(::current_field(form))]; + } + + // Set the forms subwindow + void setSubWindow(NCursesWindow& sub); + + // Set these fields for the form + inline void setFields(NCursesFormField* Fields[]) { + OnError(::set_form_fields(form, mapFields(Fields))); + } + + // Remove the form from the screen + inline void unpost(void) { + OnError(::unpost_form(form)); + } + + // Post the form to the screen if flag is true, unpost it otherwise + inline void post(bool flag = TRUE) { + OnError(flag ? ::post_form(form) : ::unpost_form(form)); + } + + // Decorations + inline void frame(const char* title = NULL, const char* btitle = NULL) { + if (b_framed) + NCursesPanel::frame(title, btitle); + else + OnError(E_SYSTEM_ERROR); + } + + inline void boldframe(const char* title = NULL, const char* btitle = NULL) { + if (b_framed) + NCursesPanel::boldframe(title, btitle); + else + OnError(E_SYSTEM_ERROR); + } + + inline void label(const char* topLabel, const char* bottomLabel) { + if (b_framed) + NCursesPanel::label(topLabel, bottomLabel); + else + OnError(E_SYSTEM_ERROR); + } + + // ----- + // Hooks + // ----- + + // Called after the form gets repositioned in its window. + // This is especially true if the form is posted. + virtual void On_Form_Init(); + + // Called before the form gets repositioned in its window. + // This is especially true if the form is unposted. + virtual void On_Form_Termination(); + + // Called after the field became the current field + virtual void On_Field_Init(NCursesFormField& field); + + // Called before this field is left as current field. + virtual void On_Field_Termination(NCursesFormField& field); + + // Calculate required window size for the form. + void scale(int& rows, int& ncols) const { + OnError(::scale_form(form, &rows, &ncols)); + } + + // Retrieve number of fields in the form. + int count() const { + return ::field_count(form); + } + + // Make the page the current page of the form. + void set_page(int pageNum) { + OnError(::set_form_page(form, pageNum)); + } + + // Retrieve current page number + int page() const { + return ::form_page(form); + } + + // Switch on the forms options + inline void options_on(Form_Options opts) { + OnError(::form_opts_on(form, opts)); + } + + // Switch off the forms options + inline void options_off(Form_Options opts) { + OnError(::form_opts_off(form, opts)); + } + + // Retrieve the forms options + inline Form_Options options() const { + return ::form_opts(form); + } + + // Set the forms options + inline void set_options(Form_Options opts) { + OnError(::set_form_opts(form, opts)); + } + + // Are there more data in the current field after the data shown + inline bool data_ahead() const { + return ::data_ahead(form); + } + + // Are there more data in the current field before the data shown + inline bool data_behind() const { + return ::data_behind(form); + } + + // Position the cursor to the current field + inline void position_cursor() { + OnError(::pos_form_cursor(form)); + } + // Set the current field + inline void set_current(NCursesFormField& F) { + OnError(::set_current_field(form, F.field)); + } + + // Provide a default key virtualization. Translate the keyboard + // code c into a form request code. + // The default implementation provides a hopefully straightforward + // mapping for the most common keystrokes and form requests. + virtual int virtualize(int c); + + // Operators + inline NCursesFormField* operator[](int i) const { + if ((i < 0) || (i >= ::field_count(form))) + OnError(E_BAD_ARGUMENT); + return my_fields[i]; + } + + // Perform the menu's operation + // Return the field where you left the form. + virtual NCursesFormField* operator()(void); + + // Exception handlers. The default is a Beep. + virtual void On_Request_Denied(int c) const; + virtual void On_Invalid_Field(int c) const; + virtual void On_Unknown_Command(int c) const; +}; + +// +// ------------------------------------------------------------------------- +// This is the typical C++ typesafe way to allow to attach +// user data to a field of a form. Its assumed that the user +// data belongs to some class T. Use T as template argument +// to create a UserField. +// ------------------------------------------------------------------------- +template +class NCURSES_IMPEXP NCursesUserField : public NCursesFormField { + public: + NCursesUserField( + int rows, + int ncols, + int first_row = 0, + int first_col = 0, + const T* p_UserData = STATIC_CAST(T*)(0), + int offscreen_rows = 0, + int additional_buffers = 0) + : NCursesFormField( + rows, + ncols, + first_row, + first_col, + offscreen_rows, + additional_buffers) { + if (field) + OnError(::set_field_userptr(field, STATIC_CAST(void*)(p_UserData))); + } + + virtual ~NCursesUserField(){}; + + inline const T* UserData(void) const { + return reinterpret_cast(::field_userptr(field)); + } + + inline virtual void setUserData(const T* p_UserData) { + if (field) + OnError(::set_field_userptr(field, STATIC_CAST(void*)(p_UserData))); + } +}; +// +// ------------------------------------------------------------------------- +// The same mechanism is used to attach user data to a form +// ------------------------------------------------------------------------- +// +template +class NCURSES_IMPEXP NCursesUserForm : public NCursesForm { + protected: + // 'Internal' constructor, builds an object without association to a + // field array. + NCursesUserForm( + int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = STATIC_CAST(T*)(0)) + : NCursesForm(nlines, ncols, begin_y, begin_x) { + if (form) + set_user(const_cast(reinterpret_cast(p_UserData))); + } + + public: + NCursesUserForm( + NCursesFormField* Fields[], + const T* p_UserData = STATIC_CAST(T*)(0), + bool with_frame = FALSE, + bool autoDelete_Fields = FALSE) + : NCursesForm(Fields, with_frame, autoDelete_Fields) { + if (form) + set_user(const_cast(reinterpret_cast(p_UserData))); + }; + + NCursesUserForm( + NCursesFormField* Fields[], + int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = STATIC_CAST(T*)(0), + bool with_frame = FALSE, + bool autoDelete_Fields = FALSE) + : NCursesForm( + Fields, + nlines, + ncols, + begin_y, + begin_x, + with_frame, + autoDelete_Fields) { + if (form) + set_user(const_cast(reinterpret_cast(p_UserData))); + }; + + virtual ~NCursesUserForm(){}; + + inline T* UserData(void) { + return reinterpret_cast(get_user()); + }; + + inline virtual void setUserData(const T* p_UserData) { + if (form) + set_user(const_cast(reinterpret_cast(p_UserData))); + } +}; +// +// ------------------------------------------------------------------------- +// Builtin Fieldtypes +// ------------------------------------------------------------------------- +// +class NCURSES_IMPEXP Alpha_Field : public NCursesFieldType { + private: + int min_field_width; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(), fieldtype, min_field_width)); + } + + public: + Alpha_Field(int width) + : NCursesFieldType(TYPE_ALPHA), min_field_width(width) {} +}; + +class NCURSES_IMPEXP Alphanumeric_Field : public NCursesFieldType { + private: + int min_field_width; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(), fieldtype, min_field_width)); + } + + public: + Alphanumeric_Field(int width) + : NCursesFieldType(TYPE_ALNUM), min_field_width(width) {} +}; + +class NCURSES_IMPEXP Integer_Field : public NCursesFieldType { + private: + int precision; + long lower_limit, upper_limit; + + void set(NCursesFormField& f) { + OnError( + ::set_field_type( + f.get_field(), fieldtype, precision, lower_limit, upper_limit)); + } + + public: + Integer_Field(int prec, long low = 0L, long high = 0L) + : NCursesFieldType(TYPE_INTEGER), + precision(prec), + lower_limit(low), + upper_limit(high) {} +}; + +class NCURSES_IMPEXP Numeric_Field : public NCursesFieldType { + private: + int precision; + double lower_limit, upper_limit; + + void set(NCursesFormField& f) { + OnError( + ::set_field_type( + f.get_field(), fieldtype, precision, lower_limit, upper_limit)); + } + + public: + Numeric_Field(int prec, double low = 0.0, double high = 0.0) + : NCursesFieldType(TYPE_NUMERIC), + precision(prec), + lower_limit(low), + upper_limit(high) {} +}; + +class NCURSES_IMPEXP Regular_Expression_Field : public NCursesFieldType { + private: + char* regex; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(), fieldtype, regex)); + } + + void copy_regex(const char* source) { + regex = new char[1 + ::strlen(source)]; + (::strcpy)(regex, source); + } + + public: + Regular_Expression_Field(const char* expr) + : NCursesFieldType(TYPE_REGEXP), regex(NULL) { + copy_regex(expr); + } + + Regular_Expression_Field& operator=(const Regular_Expression_Field& rhs) { + if (this != &rhs) { + *this = rhs; + copy_regex(rhs.regex); + NCursesFieldType::operator=(rhs); + } + return *this; + } + + Regular_Expression_Field(const Regular_Expression_Field& rhs) + : NCursesFieldType(rhs), regex(NULL) { + copy_regex(rhs.regex); + } + + ~Regular_Expression_Field() { + delete[] regex; + } +}; + +class NCURSES_IMPEXP Enumeration_Field : public NCursesFieldType { + private: + const char** list; + int case_sensitive; + int non_unique_matches; + + void set(NCursesFormField& f) { + OnError( + ::set_field_type( + f.get_field(), + fieldtype, + list, + case_sensitive, + non_unique_matches)); + } + + public: + Enumeration_Field( + const char* enums[], + bool case_sens = FALSE, + bool non_unique = FALSE) + : NCursesFieldType(TYPE_ENUM), + list(enums), + case_sensitive(case_sens ? -1 : 0), + non_unique_matches(non_unique ? -1 : 0) {} + + Enumeration_Field& operator=(const Enumeration_Field& rhs) { + if (this != &rhs) { + *this = rhs; + NCursesFieldType::operator=(rhs); + } + return *this; + } + + Enumeration_Field(const Enumeration_Field& rhs) + : NCursesFieldType(rhs), + list(rhs.list), + case_sensitive(rhs.case_sensitive), + non_unique_matches(rhs.non_unique_matches) {} +}; + +class NCURSES_IMPEXP IPV4_Address_Field : public NCursesFieldType { + private: + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(), fieldtype)); + } + + public: + IPV4_Address_Field() : NCursesFieldType(TYPE_IPV4) {} +}; + +extern "C" { +bool _nc_xx_fld_fcheck(FIELD*, const void*); +bool _nc_xx_fld_ccheck(int c, const void*); +void* _nc_xx_fld_makearg(va_list*); +} + +// +// ------------------------------------------------------------------------- +// Abstract base class for User-Defined Fieldtypes +// ------------------------------------------------------------------------- +// +class NCURSES_IMPEXP UserDefinedFieldType : public NCursesFieldType { + friend class UDF_Init; // Internal helper to set up statics + private: + // For all C++ defined fieldtypes we need only one generic lowlevel + // FIELDTYPE* element. + static FIELDTYPE* generic_fieldtype; + + protected: + // This are the functions required by the low level libforms functions + // to construct a fieldtype. + friend bool _nc_xx_fld_fcheck(FIELD*, const void*); + friend bool _nc_xx_fld_ccheck(int c, const void*); + friend void* _nc_xx_fld_makearg(va_list*); + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(), fieldtype, &f)); + } + + protected: + // Redefine this function to do a field validation. The argument + // is a reference to the field you should validate. + virtual bool field_check(NCursesFormField& f) = 0; + + // Redefine this function to do a character validation. The argument + // is the character to be validated. + virtual bool char_check(int c) = 0; + + public: + UserDefinedFieldType() : NCursesFieldType(generic_fieldtype) {} +}; + +extern "C" { +bool _nc_xx_next_choice(FIELD*, const void*); +bool _nc_xx_prev_choice(FIELD*, const void*); +} + +// +// ------------------------------------------------------------------------- +// Abstract base class for User-Defined Fieldtypes with Choice functions +// ------------------------------------------------------------------------- +// +class NCURSES_IMPEXP UserDefinedFieldType_With_Choice + : public UserDefinedFieldType { + friend class UDF_Init; // Internal helper to set up statics + private: + // For all C++ defined fieldtypes with choice functions we need only one + // generic lowlevel FIELDTYPE* element. + static FIELDTYPE* generic_fieldtype_with_choice; + + // This are the functions required by the low level libforms functions + // to construct a fieldtype with choice functions. + friend bool _nc_xx_next_choice(FIELD*, const void*); + friend bool _nc_xx_prev_choice(FIELD*, const void*); + + protected: + // Redefine this function to do the retrieval of the next choice value. + // The argument is a reference to the field tobe examined. + virtual bool next(NCursesFormField& f) = 0; + + // Redefine this function to do the retrieval of the previous choice value. + // The argument is a reference to the field tobe examined. + virtual bool previous(NCursesFormField& f) = 0; + + public: + UserDefinedFieldType_With_Choice() { + fieldtype = generic_fieldtype_with_choice; + } +}; + +#endif /* NCURSES_CURSESF_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/cursesm.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/cursesm.h new file mode 100644 index 0000000..5e643ab --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/cursesm.h @@ -0,0 +1,650 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998-2012,2014 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1997 * + ****************************************************************************/ + +// $Id: cursesm.h,v 1.30 2014/08/09 22:06:18 Adam.Jiang Exp $ + +#ifndef NCURSES_CURSESM_H_incl +#define NCURSES_CURSESM_H_incl 1 + +#include + +extern "C" { +#include +} +// +// ------------------------------------------------------------------------- +// This wraps the ITEM type of +// ------------------------------------------------------------------------- +// +class NCURSES_IMPEXP NCursesMenuItem { + friend class NCursesMenu; + + protected: + ITEM* item; + + inline void OnError(int err) const + THROW2(NCursesException const, NCursesMenuException) { + if (err != E_OK) + THROW(new NCursesMenuException(err)); + } + + public: + NCursesMenuItem(const char* p_name = NULL, const char* p_descript = NULL) + : item(0) { + item = p_name ? ::new_item(p_name, p_descript) : STATIC_CAST(ITEM*)(0); + if (p_name && !item) + OnError(E_SYSTEM_ERROR); + } + // Create an item. If you pass both parameters as NULL, a delimiting + // item is constructed which can be used to terminate a list of + // NCursesMenu objects. + + NCursesMenuItem& operator=(const NCursesMenuItem& rhs) { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesMenuItem(const NCursesMenuItem& rhs) : item(0) { + (void)rhs; + } + + virtual ~NCursesMenuItem(); + // Release the items memory + + inline const char* name() const { + return ::item_name(item); + } + // Name of the item + + inline const char* description() const { + return ::item_description(item); + } + // Description of the item + + inline int(index)(void) const { + return ::item_index(item); + } + // Index of the item in an item array (or -1) + + inline void options_on(Item_Options opts) { + OnError(::item_opts_on(item, opts)); + } + // Switch on the items options + + inline void options_off(Item_Options opts) { + OnError(::item_opts_off(item, opts)); + } + // Switch off the item's option + + inline Item_Options options() const { + return ::item_opts(item); + } + // Retrieve the items options + + inline void set_options(Item_Options opts) { + OnError(::set_item_opts(item, opts)); + } + // Set the items options + + inline void set_value(bool f) { + OnError(::set_item_value(item, f)); + } + // Set/Reset the items selection state + + inline bool value() const { + return ::item_value(item); + } + // Retrieve the items selection state + + inline bool visible() const { + return ::item_visible(item); + } + // Retrieve visibility of the item + + virtual bool action(); + // Perform an action associated with this item; you may use this in an + // user supplied driver for a menu; you may derive from this class and + // overload action() to supply items with different actions. + // If an action returns true, the menu will be exited. The default action + // is to do nothing. +}; + +// Prototype for an items callback function. +typedef bool ITEMCALLBACK(NCursesMenuItem&); + +// If you don't like to create a child class for individual items to +// overload action(), you may use this class and provide a callback +// function pointer for items. +class NCURSES_IMPEXP NCursesMenuCallbackItem : public NCursesMenuItem { + private: + ITEMCALLBACK* p_fct; + + public: + NCursesMenuCallbackItem( + ITEMCALLBACK* fct = NULL, + const char* p_name = NULL, + const char* p_descript = NULL) + : NCursesMenuItem(p_name, p_descript), p_fct(fct) {} + + NCursesMenuCallbackItem& operator=(const NCursesMenuCallbackItem& rhs) { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesMenuCallbackItem(const NCursesMenuCallbackItem& rhs) + : NCursesMenuItem(rhs), p_fct(0) {} + + virtual ~NCursesMenuCallbackItem(); + + bool action(); +}; + +// This are the built-in hook functions in this C++ binding. In C++ we use +// virtual member functions (see below On_..._Init and On_..._Termination) +// to provide this functionality in an object oriented manner. +extern "C" { +void _nc_xx_mnu_init(MENU*); +void _nc_xx_mnu_term(MENU*); +void _nc_xx_itm_init(MENU*); +void _nc_xx_itm_term(MENU*); +} + +// +// ------------------------------------------------------------------------- +// This wraps the MENU type of +// ------------------------------------------------------------------------- +// +class NCURSES_IMPEXP NCursesMenu : public NCursesPanel { + protected: + MENU* menu; + + private: + NCursesWindow* sub; // the subwindow object + bool b_sub_owner; // is this our own subwindow? + bool b_framed; // has the menu a border? + bool b_autoDelete; // Delete items when deleting menu? + + NCursesMenuItem** my_items; // The array of items for this menu + + // This structure is used for the menu's user data field to link the + // MENU* to the C++ object and to provide extra space for a user pointer. + typedef struct { + void* m_user; // the pointer for the user's data + const NCursesMenu* m_back; // backward pointer to C++ object + const MENU* m_owner; + } UserHook; + + // Get the backward pointer to the C++ object from a MENU + static inline NCursesMenu* getHook(const MENU* m) { + UserHook* hook = STATIC_CAST(UserHook*)(::menu_userptr(m)); + assert(hook != 0 && hook->m_owner == m); + return const_cast(hook->m_back); + } + + friend void _nc_xx_mnu_init(MENU*); + friend void _nc_xx_mnu_term(MENU*); + friend void _nc_xx_itm_init(MENU*); + friend void _nc_xx_itm_term(MENU*); + + // Calculate ITEM* array for the menu + ITEM** mapItems(NCursesMenuItem* nitems[]); + + protected: + // internal routines + inline void set_user(void* user) { + UserHook* uptr = STATIC_CAST(UserHook*)(::menu_userptr(menu)); + assert(uptr != 0 && uptr->m_back == this && uptr->m_owner == menu); + uptr->m_user = user; + } + + inline void* get_user() { + UserHook* uptr = STATIC_CAST(UserHook*)(::menu_userptr(menu)); + assert(uptr != 0 && uptr->m_back == this && uptr->m_owner == menu); + return uptr->m_user; + } + + void InitMenu(NCursesMenuItem* menu[], bool with_frame, bool autoDeleteItems); + + inline void OnError(int err) const + THROW2(NCursesException const, NCursesMenuException) { + if (err != E_OK) + THROW(new NCursesMenuException(this, err)); + } + + // this wraps the menu_driver call. + virtual int driver(int c); + + // 'Internal' constructor to create a menu without association to + // an array of items. + NCursesMenu(int nlines, int ncols, int begin_y = 0, int begin_x = 0) + : NCursesPanel(nlines, ncols, begin_y, begin_x), + menu(STATIC_CAST(MENU*)(0)), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_items(0) {} + + public: + // Make a full window size menu + NCursesMenu( + NCursesMenuItem* Items[], + bool with_frame = FALSE, // Reserve space for a frame? + bool autoDelete_Items = FALSE) // Autocleanup of Items? + : NCursesPanel(), + menu(0), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_items(0) { + InitMenu(Items, with_frame, autoDelete_Items); + } + + // Make a menu with a window of this size. + NCursesMenu( + NCursesMenuItem* Items[], + int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + bool with_frame = FALSE, // Reserve space for a frame? + bool autoDelete_Items = FALSE) // Autocleanup of Items? + : NCursesPanel(nlines, ncols, begin_y, begin_x), + menu(0), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_items(0) { + InitMenu(Items, with_frame, autoDelete_Items); + } + + NCursesMenu& operator=(const NCursesMenu& rhs) { + if (this != &rhs) { + *this = rhs; + NCursesPanel::operator=(rhs); + } + return *this; + } + + NCursesMenu(const NCursesMenu& rhs) + : NCursesPanel(rhs), + menu(rhs.menu), + sub(rhs.sub), + b_sub_owner(rhs.b_sub_owner), + b_framed(rhs.b_framed), + b_autoDelete(rhs.b_autoDelete), + my_items(rhs.my_items) {} + + virtual ~NCursesMenu(); + + // Retrieve the menus subwindow + inline NCursesWindow& subWindow() const { + assert(sub != NULL); + return *sub; + } + + // Set the menus subwindow + void setSubWindow(NCursesWindow& sub); + + // Set these items for the menu + inline void setItems(NCursesMenuItem* Items[]) { + OnError(::set_menu_items(menu, mapItems(Items))); + } + + // Remove the menu from the screen + inline void unpost(void) { + OnError(::unpost_menu(menu)); + } + + // Post the menu to the screen if flag is true, unpost it otherwise + inline void post(bool flag = TRUE) { + flag ? OnError(::post_menu(menu)) : OnError(::unpost_menu(menu)); + } + + // Get the numer of rows and columns for this menu + inline void scale(int& mrows, int& mcols) const { + OnError(::scale_menu(menu, &mrows, &mcols)); + } + + // Set the format of this menu + inline void set_format(int mrows, int mcols) { + OnError(::set_menu_format(menu, mrows, mcols)); + } + + // Get the format of this menu + inline void menu_format(int& rows, int& ncols) { + ::menu_format(menu, &rows, &ncols); + } + + // Items of the menu + inline NCursesMenuItem* items() const { + return *my_items; + } + + // Get the number of items in this menu + inline int count() const { + return ::item_count(menu); + } + + // Get the current item (i.e. the one the cursor is located) + inline NCursesMenuItem* current_item() const { + return my_items[ ::item_index(::current_item(menu))]; + } + + // Get the marker string + inline const char* mark() const { + return ::menu_mark(menu); + } + + // Set the marker string + inline void set_mark(const char* marker) { + OnError(::set_menu_mark(menu, marker)); + } + + // Get the name of the request code c + inline static const char* request_name(int c) { + return ::menu_request_name(c); + } + + // Get the current pattern + inline char* pattern() const { + return ::menu_pattern(menu); + } + + // true if there is a pattern match, false otherwise. + bool set_pattern(const char* pat); + + // set the default attributes for the menu + // i.e. set fore, back and grey attribute + virtual void setDefaultAttributes(); + + // Get the menus background attributes + inline chtype back() const { + return ::menu_back(menu); + } + + // Get the menus foreground attributes + inline chtype fore() const { + return ::menu_fore(menu); + } + + // Get the menus grey attributes (used for unselectable items) + inline chtype grey() const { + return ::menu_grey(menu); + } + + // Set the menus background attributes + inline chtype set_background(chtype a) { + return ::set_menu_back(menu, a); + } + + // Set the menus foreground attributes + inline chtype set_foreground(chtype a) { + return ::set_menu_fore(menu, a); + } + + // Set the menus grey attributes (used for unselectable items) + inline chtype set_grey(chtype a) { + return ::set_menu_grey(menu, a); + } + + inline void options_on(Menu_Options opts) { + OnError(::menu_opts_on(menu, opts)); + } + + inline void options_off(Menu_Options opts) { + OnError(::menu_opts_off(menu, opts)); + } + + inline Menu_Options options() const { + return ::menu_opts(menu); + } + + inline void set_options(Menu_Options opts) { + OnError(::set_menu_opts(menu, opts)); + } + + inline int pad() const { + return ::menu_pad(menu); + } + + inline void set_pad(int padch) { + OnError(::set_menu_pad(menu, padch)); + } + + // Position the cursor to the current item + inline void position_cursor() const { + OnError(::pos_menu_cursor(menu)); + } + + // Set the current item + inline void set_current(NCursesMenuItem& I) { + OnError(::set_current_item(menu, I.item)); + } + + // Get the current top row of the menu + inline int top_row(void) const { + return ::top_row(menu); + } + + // Set the current top row of the menu + inline void set_top_row(int row) { + OnError(::set_top_row(menu, row)); + } + + // spacing control + // Set the spacing for the menu + inline void setSpacing(int spc_description, int spc_rows, int spc_columns) { + OnError(::set_menu_spacing(menu, spc_description, spc_rows, spc_columns)); + } + + // Get the spacing info for the menu + inline void Spacing(int& spc_description, int& spc_rows, int& spc_columns) + const { + OnError(::menu_spacing(menu, &spc_description, &spc_rows, &spc_columns)); + } + + // Decorations + inline void frame(const char* title = NULL, const char* btitle = NULL) { + if (b_framed) + NCursesPanel::frame(title, btitle); + else + OnError(E_SYSTEM_ERROR); + } + + inline void boldframe(const char* title = NULL, const char* btitle = NULL) { + if (b_framed) + NCursesPanel::boldframe(title, btitle); + else + OnError(E_SYSTEM_ERROR); + } + + inline void label(const char* topLabel, const char* bottomLabel) { + if (b_framed) + NCursesPanel::label(topLabel, bottomLabel); + else + OnError(E_SYSTEM_ERROR); + } + + // ----- + // Hooks + // ----- + + // Called after the menu gets repositioned in its window. + // This is especially true if the menu is posted. + virtual void On_Menu_Init(); + + // Called before the menu gets repositioned in its window. + // This is especially true if the menu is unposted. + virtual void On_Menu_Termination(); + + // Called after the item became the current item + virtual void On_Item_Init(NCursesMenuItem& item); + + // Called before this item is left as current item. + virtual void On_Item_Termination(NCursesMenuItem& item); + + // Provide a default key virtualization. Translate the keyboard + // code c into a menu request code. + // The default implementation provides a hopefully straightforward + // mapping for the most common keystrokes and menu requests. + virtual int virtualize(int c); + + // Operators + inline NCursesMenuItem* operator[](int i) const { + if ((i < 0) || (i >= ::item_count(menu))) + OnError(E_BAD_ARGUMENT); + return (my_items[i]); + } + + // Perform the menu's operation + // Return the item where you left the selection mark for a single + // selection menu, or NULL for a multivalued menu. + virtual NCursesMenuItem* operator()(void); + + // -------------------- + // Exception handlers + // Called by operator() + // -------------------- + + // Called if the request is denied + virtual void On_Request_Denied(int c) const; + + // Called if the item is not selectable + virtual void On_Not_Selectable(int c) const; + + // Called if pattern doesn't match + virtual void On_No_Match(int c) const; + + // Called if the command is unknown + virtual void On_Unknown_Command(int c) const; +}; +// +// ------------------------------------------------------------------------- +// This is the typical C++ typesafe way to allow to attach +// user data to an item of a menu. Its assumed that the user +// data belongs to some class T. Use T as template argument +// to create a UserItem. +// ------------------------------------------------------------------------- +// +template +class NCURSES_IMPEXP NCursesUserItem : public NCursesMenuItem { + public: + NCursesUserItem( + const char* p_name, + const char* p_descript = NULL, + const T* p_UserData = STATIC_CAST(T*)(0)) + : NCursesMenuItem(p_name, p_descript) { + if (item) + OnError( + ::set_item_userptr( + item, + const_cast(reinterpret_cast(p_UserData)))); + } + + virtual ~NCursesUserItem() {} + + inline const T* UserData(void) const { + return reinterpret_cast(::item_userptr(item)); + }; + + inline virtual void setUserData(const T* p_UserData) { + if (item) + OnError( + ::set_item_userptr( + item, + const_cast(reinterpret_cast(p_UserData)))); + } +}; +// +// ------------------------------------------------------------------------- +// The same mechanism is used to attach user data to a menu +// ------------------------------------------------------------------------- +// +template +class NCURSES_IMPEXP NCursesUserMenu : public NCursesMenu { + protected: + NCursesUserMenu( + int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = STATIC_CAST(T*)(0)) + : NCursesMenu(nlines, ncols, begin_y, begin_x) { + if (menu) + set_user(const_cast(reinterpret_cast(p_UserData))); + } + + public: + NCursesUserMenu( + NCursesMenuItem* Items[], + const T* p_UserData = STATIC_CAST(T*)(0), + bool with_frame = FALSE, + bool autoDelete_Items = FALSE) + : NCursesMenu(Items, with_frame, autoDelete_Items) { + if (menu) + set_user(const_cast(reinterpret_cast(p_UserData))); + }; + + NCursesUserMenu( + NCursesMenuItem* Items[], + int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = STATIC_CAST(T*)(0), + bool with_frame = FALSE) + : NCursesMenu(Items, nlines, ncols, begin_y, begin_x, with_frame) { + if (menu) + set_user(const_cast(reinterpret_cast(p_UserData))); + }; + + virtual ~NCursesUserMenu(){}; + + inline T* UserData(void) { + return reinterpret_cast(get_user()); + }; + + inline virtual void setUserData(const T* p_UserData) { + if (menu) + set_user(const_cast(reinterpret_cast(p_UserData))); + } +}; + +#endif /* NCURSES_CURSESM_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/cursesp.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/cursesp.h new file mode 100644 index 0000000..a2c9b16 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/cursesp.h @@ -0,0 +1,238 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998-2012,2014 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1997 * + ****************************************************************************/ + +#ifndef NCURSES_CURSESP_H_incl +#define NCURSES_CURSESP_H_incl 1 + +// $Id: cursesp.h,v 1.31 2014/08/09 22:06:26 Adam.Jiang Exp $ + +#include + +extern "C" { +#include +} + +class NCURSES_IMPEXP NCursesPanel : public NCursesWindow { + protected: + PANEL* p; + static NCursesPanel* dummy; + + private: + // This structure is used for the panel's user data field to link the + // PANEL* to the C++ object and to provide extra space for a user pointer. + typedef struct { + void* m_user; // the pointer for the user's data + const NCursesPanel* m_back; // backward pointer to C++ object + const PANEL* m_owner; // the panel itself + } UserHook; + + inline UserHook* UserPointer() { + UserHook* uptr = + reinterpret_cast(const_cast(::panel_userptr(p))); + return uptr; + } + + void init(); // Initialize the panel object + + protected: + void set_user(void* user) { + UserHook* uptr = UserPointer(); + if (uptr != 0 && uptr->m_back == this && uptr->m_owner == p) { + uptr->m_user = user; + } + } + // Set the user pointer of the panel. + + void* get_user() { + UserHook* uptr = UserPointer(); + void* result = 0; + if (uptr != 0 && uptr->m_back == this && uptr->m_owner == p) + result = uptr->m_user; + return result; + } + + void OnError(int err) const + THROW2(NCursesException const, NCursesPanelException) { + if (err == ERR) + THROW(new NCursesPanelException(this, err)); + } + // If err is equal to the curses error indicator ERR, an error handler + // is called. + + // Get a keystroke. Default implementation calls getch() + virtual int getKey(void); + + public: + NCursesPanel(int nlines, int ncols, int begin_y = 0, int begin_x = 0) + : NCursesWindow(nlines, ncols, begin_y, begin_x), p(0) { + init(); + } + // Create a panel with this size starting at the requested position. + + NCursesPanel() : NCursesWindow(::stdscr), p(0) { + init(); + } + // This constructor creates the default Panel associated with the + // ::stdscr window + + NCursesPanel& operator=(const NCursesPanel& rhs) { + if (this != &rhs) { + *this = rhs; + NCursesWindow::operator=(rhs); + } + return *this; + } + + NCursesPanel(const NCursesPanel& rhs) : NCursesWindow(rhs), p(rhs.p) {} + + virtual ~NCursesPanel(); + + // basic manipulation + inline void hide() { + OnError(::hide_panel(p)); + } + // Hide the panel. It stays in the stack but becomes invisible. + + inline void show() { + OnError(::show_panel(p)); + } + // Show the panel, i.e. make it visible. + + inline void top() { + OnError(::top_panel(p)); + } + // Make this panel the top panel in the stack. + + inline void bottom() { + OnError(::bottom_panel(p)); + } + // Make this panel the bottom panel in the stack. + // N.B.: The panel associated with ::stdscr is always on the bottom. So + // actually bottom() makes the panel the first above ::stdscr. + + virtual int mvwin(int y, int x) { + OnError(::move_panel(p, y, x)); + return OK; + } + + inline bool hidden() const { + return (::panel_hidden(p) ? TRUE : FALSE); + } + // Return TRUE if the panel is hidden, FALSE otherwise. + + /* The functions panel_above() and panel_below() are not reflected in + the NCursesPanel class. The reason for this is, that we cannot + assume that a panel retrieved by those operations is one wrapped + by a C++ class. Although this situation might be handled, we also + need a reverse mapping from PANEL to NCursesPanel which needs some + redesign of the low level stuff. At the moment, we define them in the + interface but they will always produce an error. */ + inline NCursesPanel& above() const { + OnError(ERR); + return *dummy; + } + + inline NCursesPanel& below() const { + OnError(ERR); + return *dummy; + } + + // Those two are rewrites of the corresponding virtual members of + // NCursesWindow + virtual int refresh(); + // Propagate all panel changes to the virtual screen and update the + // physical screen. + + virtual int noutrefresh(); + // Propagate all panel changes to the virtual screen. + + static void redraw(); + // Redraw all panels. + + // decorations + virtual void frame(const char* title = NULL, const char* btitle = NULL); + // Put a frame around the panel and put the title centered in the top line + // and btitle in the bottom line. + + virtual void boldframe(const char* title = NULL, const char* btitle = NULL); + // Same as frame(), but use highlighted attributes. + + virtual void label(const char* topLabel, const char* bottomLabel); + // Put the title centered in the top line and btitle in the bottom line. + + virtual void centertext(int row, const char* label); + // Put the label text centered in the specified row. +}; + +/* We use templates to provide a typesafe mechanism to associate + * user data with a panel. A NCursesUserPanel is a panel + * associated with some user data of type T. + */ +template +class NCursesUserPanel : public NCursesPanel { + public: + NCursesUserPanel( + int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = STATIC_CAST(T*)(0)) + : NCursesPanel(nlines, ncols, begin_y, begin_x) { + if (p) + set_user(const_cast(reinterpret_cast(p_UserData))); + }; + // This creates an user panel of the requested size with associated + // user data pointed to by p_UserData. + + NCursesUserPanel(const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesPanel() { + if (p) + set_user(const_cast(reinterpret_cast(p_UserData))); + }; + // This creates an user panel associated with the ::stdscr and user data + // pointed to by p_UserData. + + virtual ~NCursesUserPanel(){}; + + T* UserData(void) { + return reinterpret_cast(get_user()); + }; + // Retrieve the user data associated with the panel. + + virtual void setUserData(const T* p_UserData) { + if (p) + set_user(const_cast(reinterpret_cast(p_UserData))); + } + // Associate the user panel with the user data pointed to by p_UserData. +}; + +#endif /* NCURSES_CURSESP_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/cursesw.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/cursesw.h new file mode 100644 index 0000000..6a2ed25 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/cursesw.h @@ -0,0 +1,2005 @@ +// * This makes emacs happy -*-Mode: C++;-*- +// vile:cppmode +/**************************************************************************** + * Copyright (c) 1998-2014,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +#ifndef NCURSES_CURSESW_H_incl +#define NCURSES_CURSESW_H_incl 1 + +// $Id: cursesw.h,v 1.53 2017/11/21 00:37:23 tom Exp $ + +extern "C" { +#include +} + +#include + +/* SCO 3.2v4 curses.h includes term.h, which defines lines as a macro. + Undefine it here, because NCursesWindow uses lines as a method. */ +#undef lines + +/* "Convert" macros to inlines. We'll define it as another symbol to avoid + * conflict with library symbols. + */ +#undef UNDEF +#define UNDEF(name) CUR_##name + +#ifdef addch +inline int UNDEF(addch)(chtype ch) { + return addch(ch); +} +#undef addch +#define addch UNDEF(addch) +#endif + +#ifdef addchstr +inline int UNDEF(addchstr)(chtype* at) { + return addchstr(at); +} +#undef addchstr +#define addchstr UNDEF(addchstr) +#endif + +#ifdef addnstr +inline int UNDEF(addnstr)(const char* str, int n) { + return addnstr(str, n); +} +#undef addnstr +#define addnstr UNDEF(addnstr) +#endif + +#ifdef addstr +inline int UNDEF(addstr)(const char* str) { + return addstr(str); +} +#undef addstr +#define addstr UNDEF(addstr) +#endif + +#ifdef attroff +inline int UNDEF(attroff)(chtype at) { + return attroff(at); +} +#undef attroff +#define attroff UNDEF(attroff) +#endif + +#ifdef attron +inline int UNDEF(attron)(chtype at) { + return attron(at); +} +#undef attron +#define attron UNDEF(attron) +#endif + +#ifdef attrset +inline chtype UNDEF(attrset)(chtype at) { + return attrset(at); +} +#undef attrset +#define attrset UNDEF(attrset) +#endif + +#ifdef bkgd +inline int UNDEF(bkgd)(chtype ch) { + return bkgd(ch); +} +#undef bkgd +#define bkgd UNDEF(bkgd) +#endif + +#ifdef bkgdset +inline void UNDEF(bkgdset)(chtype ch) { + bkgdset(ch); +} +#undef bkgdset +#define bkgdset UNDEF(bkgdset) +#endif + +#ifdef border +inline int UNDEF(border)( + chtype ls, + chtype rs, + chtype ts, + chtype bs, + chtype tl, + chtype tr, + chtype bl, + chtype br) { + return border(ls, rs, ts, bs, tl, tr, bl, br); +} +#undef border +#define border UNDEF(border) +#endif + +#ifdef box +inline int UNDEF(box)(WINDOW* win, int v, int h) { + return box(win, v, h); +} +#undef box +#define box UNDEF(box) +#endif + +#ifdef chgat +inline int UNDEF( + chgat)(int n, attr_t attr, NCURSES_PAIRS_T color, const void* opts) { + return chgat(n, attr, color, opts); +} +#undef chgat +#define chgat UNDEF(chgat) +#endif + +#ifdef clear +inline int UNDEF(clear)() { + return clear(); +} +#undef clear +#define clear UNDEF(clear) +#endif + +#ifdef clearok +inline int UNDEF(clearok)(WINDOW* win, bool bf) { + return clearok(win, bf); +} +#undef clearok +#define clearok UNDEF(clearok) +#else +extern "C" NCURSES_IMPEXP int NCURSES_API clearok(WINDOW*, bool); +#endif + +#ifdef clrtobot +inline int UNDEF(clrtobot)() { + return clrtobot(); +} +#undef clrtobot +#define clrtobot UNDEF(clrtobot) +#endif + +#ifdef clrtoeol +inline int UNDEF(clrtoeol)() { + return clrtoeol(); +} +#undef clrtoeol +#define clrtoeol UNDEF(clrtoeol) +#endif + +#ifdef color_set +inline chtype UNDEF(color_set)(NCURSES_PAIRS_T p, void* opts) { + return color_set(p, opts); +} +#undef color_set +#define color_set UNDEF(color_set) +#endif + +#ifdef crmode +inline int UNDEF(crmode)(void) { + return crmode(); +} +#undef crmode +#define crmode UNDEF(crmode) +#endif + +#ifdef delch +inline int UNDEF(delch)() { + return delch(); +} +#undef delch +#define delch UNDEF(delch) +#endif + +#ifdef deleteln +inline int UNDEF(deleteln)() { + return deleteln(); +} +#undef deleteln +#define deleteln UNDEF(deleteln) +#endif + +#ifdef echochar +inline int UNDEF(echochar)(chtype ch) { + return echochar(ch); +} +#undef echochar +#define echochar UNDEF(echochar) +#endif + +#ifdef erase +inline int UNDEF(erase)() { + return erase(); +} +#undef erase +#define erase UNDEF(erase) +#endif + +#ifdef fixterm +inline int UNDEF(fixterm)(void) { + return fixterm(); +} +#undef fixterm +#define fixterm UNDEF(fixterm) +#endif + +#ifdef flushok +inline int UNDEF(flushok)(WINDOW* _win, bool _bf) { + return flushok(_win, _bf); +} +#undef flushok +#define flushok UNDEF(flushok) +#else +#define _no_flushok +#endif + +#ifdef getattrs +inline int UNDEF(getattrs)(WINDOW* win) { + return getattrs(win); +} +#undef getattrs +#define getattrs UNDEF(getattrs) +#endif + +#ifdef getbegyx +inline void UNDEF(getbegyx)(WINDOW* win, int& y, int& x) { + getbegyx(win, y, x); +} +#undef getbegyx +#define getbegyx UNDEF(getbegyx) +#endif + +#ifdef getbkgd +inline chtype UNDEF(getbkgd)(const WINDOW* win) { + return getbkgd(win); +} +#undef getbkgd +#define getbkgd UNDEF(getbkgd) +#endif + +#ifdef getch +inline int UNDEF(getch)() { + return getch(); +} +#undef getch +#define getch UNDEF(getch) +#endif + +#ifdef getmaxyx +inline void UNDEF(getmaxyx)(WINDOW* win, int& y, int& x) { + getmaxyx(win, y, x); +} +#undef getmaxyx +#define getmaxyx UNDEF(getmaxyx) +#endif + +#ifdef getnstr +inline int UNDEF(getnstr)(char* _str, int n) { + return getnstr(_str, n); +} +#undef getnstr +#define getnstr UNDEF(getnstr) +#endif + +#ifdef getparyx +inline void UNDEF(getparyx)(WINDOW* win, int& y, int& x) { + getparyx(win, y, x); +} +#undef getparyx +#define getparyx UNDEF(getparyx) +#endif + +#ifdef getstr +inline int UNDEF(getstr)(char* _str) { + return getstr(_str); +} +#undef getstr +#define getstr UNDEF(getstr) +#endif + +#ifdef getyx +inline void UNDEF(getyx)(const WINDOW* win, int& y, int& x) { + getyx(win, y, x); +} +#undef getyx +#define getyx UNDEF(getyx) +#endif + +#ifdef hline +inline int UNDEF(hline)(chtype ch, int n) { + return hline(ch, n); +} +#undef hline +#define hline UNDEF(hline) +#endif + +#ifdef inch +inline chtype UNDEF(inch)() { + return inch(); +} +#undef inch +#define inch UNDEF(inch) +#endif + +#ifdef inchstr +inline int UNDEF(inchstr)(chtype* str) { + return inchstr(str); +} +#undef inchstr +#define inchstr UNDEF(inchstr) +#endif + +#ifdef innstr +inline int UNDEF(innstr)(char* _str, int n) { + return innstr(_str, n); +} +#undef innstr +#define innstr UNDEF(innstr) +#endif + +#ifdef insch +inline int UNDEF(insch)(chtype c) { + return insch(c); +} +#undef insch +#define insch UNDEF(insch) +#endif + +#ifdef insdelln +inline int UNDEF(insdelln)(int n) { + return insdelln(n); +} +#undef insdelln +#define insdelln UNDEF(insdelln) +#endif + +#ifdef insertln +inline int UNDEF(insertln)() { + return insertln(); +} +#undef insertln +#define insertln UNDEF(insertln) +#endif + +#ifdef insnstr +inline int UNDEF(insnstr)(const char* _str, int n) { + return insnstr(_str, n); +} +#undef insnstr +#define insnstr UNDEF(insnstr) +#endif + +#ifdef insstr +inline int UNDEF(insstr)(const char* _str) { + return insstr(_str); +} +#undef insstr +#define insstr UNDEF(insstr) +#endif + +#ifdef instr +inline int UNDEF(instr)(char* _str) { + return instr(_str); +} +#undef instr +#define instr UNDEF(instr) +#endif + +#ifdef intrflush +inline void UNDEF(intrflush)(WINDOW* win, bool bf) { + intrflush(); +} +#undef intrflush +#define intrflush UNDEF(intrflush) +#endif + +#ifdef is_linetouched +inline int UNDEF(is_linetouched)(WINDOW* w, int l) { + return is_linetouched(w, l); +} +#undef is_linetouched +#define is_linetouched UNDEF(is_linetouched) +#endif + +#ifdef leaveok +inline int UNDEF(leaveok)(WINDOW* win, bool bf) { + return leaveok(win, bf); +} +#undef leaveok +#define leaveok UNDEF(leaveok) +#else +extern "C" NCURSES_IMPEXP int NCURSES_API leaveok(WINDOW* win, bool bf); +#endif + +#ifdef move +inline int UNDEF(move)(int x, int y) { + return move(x, y); +} +#undef move +#define move UNDEF(move) +#endif + +#ifdef mvaddch +inline int UNDEF(mvaddch)(int y, int x, chtype ch) { + return mvaddch(y, x, ch); +} +#undef mvaddch +#define mvaddch UNDEF(mvaddch) +#endif + +#ifdef mvaddnstr +inline int UNDEF(mvaddnstr)(int y, int x, const char* str, int n) { + return mvaddnstr(y, x, str, n); +} +#undef mvaddnstr +#define mvaddnstr UNDEF(mvaddnstr) +#endif + +#ifdef mvaddstr +inline int UNDEF(mvaddstr)(int y, int x, const char* str) { + return mvaddstr(y, x, str); +} +#undef mvaddstr +#define mvaddstr UNDEF(mvaddstr) +#endif + +#ifdef mvchgat +inline int UNDEF(mvchgat)( + int y, + int x, + int n, + attr_t attr, + NCURSES_PAIRS_T color, + const void* opts) { + return mvchgat(y, x, n, attr, color, opts); +} +#undef mvchgat +#define mvchgat UNDEF(mvchgat) +#endif + +#ifdef mvdelch +inline int UNDEF(mvdelch)(int y, int x) { + return mvdelch(y, x); +} +#undef mvdelch +#define mvdelch UNDEF(mvdelch) +#endif + +#ifdef mvgetch +inline int UNDEF(mvgetch)(int y, int x) { + return mvgetch(y, x); +} +#undef mvgetch +#define mvgetch UNDEF(mvgetch) +#endif + +#ifdef mvgetnstr +inline int UNDEF(mvgetnstr)(int y, int x, char* str, int n) { + return mvgetnstr(y, x, str, n); +} +#undef mvgetnstr +#define mvgetnstr UNDEF(mvgetnstr) +#endif + +#ifdef mvgetstr +inline int UNDEF(mvgetstr)(int y, int x, char* str) { + return mvgetstr(y, x, str); +} +#undef mvgetstr +#define mvgetstr UNDEF(mvgetstr) +#endif + +#ifdef mvinch +inline chtype UNDEF(mvinch)(int y, int x) { + return mvinch(y, x); +} +#undef mvinch +#define mvinch UNDEF(mvinch) +#endif + +#ifdef mvinnstr +inline int UNDEF(mvinnstr)(int y, int x, char* _str, int n) { + return mvinnstr(y, x, _str, n); +} +#undef mvinnstr +#define mvinnstr UNDEF(mvinnstr) +#endif + +#ifdef mvinsch +inline int UNDEF(mvinsch)(int y, int x, chtype c) { + return mvinsch(y, x, c); +} +#undef mvinsch +#define mvinsch UNDEF(mvinsch) +#endif + +#ifdef mvinsnstr +inline int UNDEF(mvinsnstr)(int y, int x, const char* _str, int n) { + return mvinsnstr(y, x, _str, n); +} +#undef mvinsnstr +#define mvinsnstr UNDEF(mvinsnstr) +#endif + +#ifdef mvinsstr +inline int UNDEF(mvinsstr)(int y, int x, const char* _str) { + return mvinsstr(y, x, _str); +} +#undef mvinsstr +#define mvinsstr UNDEF(mvinsstr) +#endif + +#ifdef mvwaddch +inline int UNDEF(mvwaddch)(WINDOW* win, int y, int x, const chtype ch) { + return mvwaddch(win, y, x, ch); +} +#undef mvwaddch +#define mvwaddch UNDEF(mvwaddch) +#endif + +#ifdef mvwaddchnstr +inline int UNDEF( + mvwaddchnstr)(WINDOW* win, int y, int x, const chtype* str, int n) { + return mvwaddchnstr(win, y, x, str, n); +} +#undef mvwaddchnstr +#define mvwaddchnstr UNDEF(mvwaddchnstr) +#endif + +#ifdef mvwaddchstr +inline int UNDEF(mvwaddchstr)(WINDOW* win, int y, int x, const chtype* str) { + return mvwaddchstr(win, y, x, str); +} +#undef mvwaddchstr +#define mvwaddchstr UNDEF(mvwaddchstr) +#endif + +#ifdef mvwaddnstr +inline int UNDEF( + mvwaddnstr)(WINDOW* win, int y, int x, const char* str, int n) { + return mvwaddnstr(win, y, x, str, n); +} +#undef mvwaddnstr +#define mvwaddnstr UNDEF(mvwaddnstr) +#endif + +#ifdef mvwaddstr +inline int UNDEF(mvwaddstr)(WINDOW* win, int y, int x, const char* str) { + return mvwaddstr(win, y, x, str); +} +#undef mvwaddstr +#define mvwaddstr UNDEF(mvwaddstr) +#endif + +#ifdef mvwchgat +inline int UNDEF(mvwchgat)( + WINDOW* win, + int y, + int x, + int n, + attr_t attr, + NCURSES_PAIRS_T color, + const void* opts) { + return mvwchgat(win, y, x, n, attr, color, opts); +} +#undef mvwchgat +#define mvwchgat UNDEF(mvwchgat) +#endif + +#ifdef mvwdelch +inline int UNDEF(mvwdelch)(WINDOW* win, int y, int x) { + return mvwdelch(win, y, x); +} +#undef mvwdelch +#define mvwdelch UNDEF(mvwdelch) +#endif + +#ifdef mvwgetch +inline int UNDEF(mvwgetch)(WINDOW* win, int y, int x) { + return mvwgetch(win, y, x); +} +#undef mvwgetch +#define mvwgetch UNDEF(mvwgetch) +#endif + +#ifdef mvwgetnstr +inline int UNDEF(mvwgetnstr)(WINDOW* win, int y, int x, char* str, int n) { + return mvwgetnstr(win, y, x, str, n); +} +#undef mvwgetnstr +#define mvwgetnstr UNDEF(mvwgetnstr) +#endif + +#ifdef mvwgetstr +inline int UNDEF(mvwgetstr)(WINDOW* win, int y, int x, char* str) { + return mvwgetstr(win, y, x, str); +} +#undef mvwgetstr +#define mvwgetstr UNDEF(mvwgetstr) +#endif + +#ifdef mvwhline +inline int UNDEF(mvwhline)(WINDOW* win, int y, int x, chtype c, int n) { + return mvwhline(win, y, x, c, n); +} +#undef mvwhline +#define mvwhline UNDEF(mvwhline) +#endif + +#ifdef mvwinch +inline chtype UNDEF(mvwinch)(WINDOW* win, int y, int x) { + return mvwinch(win, y, x); +} +#undef mvwinch +#define mvwinch UNDEF(mvwinch) +#endif + +#ifdef mvwinchnstr +inline int UNDEF(mvwinchnstr)(WINDOW* win, int y, int x, chtype* str, int n) { + return mvwinchnstr(win, y, x, str, n); +} +#undef mvwinchnstr +#define mvwinchnstr UNDEF(mvwinchnstr) +#endif + +#ifdef mvwinchstr +inline int UNDEF(mvwinchstr)(WINDOW* win, int y, int x, chtype* str) { + return mvwinchstr(win, y, x, str); +} +#undef mvwinchstr +#define mvwinchstr UNDEF(mvwinchstr) +#endif + +#ifdef mvwinnstr +inline int UNDEF(mvwinnstr)(WINDOW* win, int y, int x, char* _str, int n) { + return mvwinnstr(win, y, x, _str, n); +} +#undef mvwinnstr +#define mvwinnstr UNDEF(mvwinnstr) +#endif + +#ifdef mvwinsch +inline int UNDEF(mvwinsch)(WINDOW* win, int y, int x, chtype c) { + return mvwinsch(win, y, x, c); +} +#undef mvwinsch +#define mvwinsch UNDEF(mvwinsch) +#endif + +#ifdef mvwinsnstr +inline int UNDEF(mvwinsnstr)(WINDOW* w, int y, int x, const char* _str, int n) { + return mvwinsnstr(w, y, x, _str, n); +} +#undef mvwinsnstr +#define mvwinsnstr UNDEF(mvwinsnstr) +#endif + +#ifdef mvwinsstr +inline int UNDEF(mvwinsstr)(WINDOW* w, int y, int x, const char* _str) { + return mvwinsstr(w, y, x, _str); +} +#undef mvwinsstr +#define mvwinsstr UNDEF(mvwinsstr) +#endif + +#ifdef mvwvline +inline int UNDEF(mvwvline)(WINDOW* win, int y, int x, chtype c, int n) { + return mvwvline(win, y, x, c, n); +} +#undef mvwvline +#define mvwvline UNDEF(mvwvline) +#endif + +#ifdef napms +inline void UNDEF(napms)(unsigned long x) { + napms(x); +} +#undef napms +#define napms UNDEF(napms) +#endif + +#ifdef nocrmode +inline int UNDEF(nocrmode)(void) { + return nocrmode(); +} +#undef nocrmode +#define nocrmode UNDEF(nocrmode) +#endif + +#ifdef nodelay +inline void UNDEF(nodelay)() { + nodelay(); +} +#undef nodelay +#define nodelay UNDEF(nodelay) +#endif + +#ifdef redrawwin +inline int UNDEF(redrawwin)(WINDOW* win) { + return redrawwin(win); +} +#undef redrawwin +#define redrawwin UNDEF(redrawwin) +#endif + +#ifdef refresh +inline int UNDEF(refresh)() { + return refresh(); +} +#undef refresh +#define refresh UNDEF(refresh) +#endif + +#ifdef resetterm +inline int UNDEF(resetterm)(void) { + return resetterm(); +} +#undef resetterm +#define resetterm UNDEF(resetterm) +#endif + +#ifdef saveterm +inline int UNDEF(saveterm)(void) { + return saveterm(); +} +#undef saveterm +#define saveterm UNDEF(saveterm) +#endif + +#ifdef scrl +inline int UNDEF(scrl)(int l) { + return scrl(l); +} +#undef scrl +#define scrl UNDEF(scrl) +#endif + +#ifdef scroll +inline int UNDEF(scroll)(WINDOW* win) { + return scroll(win); +} +#undef scroll +#define scroll UNDEF(scroll) +#endif + +#ifdef scrollok +inline int UNDEF(scrollok)(WINDOW* win, bool bf) { + return scrollok(win, bf); +} +#undef scrollok +#define scrollok UNDEF(scrollok) +#else +#if defined(__NCURSES_H) +extern "C" NCURSES_IMPEXP int NCURSES_API scrollok(WINDOW*, bool); +#else +extern "C" NCURSES_IMPEXP int NCURSES_API scrollok(WINDOW*, char); +#endif +#endif + +#ifdef setscrreg +inline int UNDEF(setscrreg)(int t, int b) { + return setscrreg(t, b); +} +#undef setscrreg +#define setscrreg UNDEF(setscrreg) +#endif + +#ifdef standend +inline int UNDEF(standend)() { + return standend(); +} +#undef standend +#define standend UNDEF(standend) +#endif + +#ifdef standout +inline int UNDEF(standout)() { + return standout(); +} +#undef standout +#define standout UNDEF(standout) +#endif + +#ifdef subpad +inline WINDOW* UNDEF(subpad)(WINDOW* p, int l, int c, int y, int x) { + return derwin(p, l, c, y, x); +} +#undef subpad +#define subpad UNDEF(subpad) +#endif + +#ifdef timeout +inline void UNDEF(timeout)(int delay) { + timeout(delay); +} +#undef timeout +#define timeout UNDEF(timeout) +#endif + +#ifdef touchline +inline int UNDEF(touchline)(WINDOW* win, int s, int c) { + return touchline(win, s, c); +} +#undef touchline +#define touchline UNDEF(touchline) +#endif + +#ifdef touchwin +inline int UNDEF(touchwin)(WINDOW* win) { + return touchwin(win); +} +#undef touchwin +#define touchwin UNDEF(touchwin) +#endif + +#ifdef untouchwin +inline int UNDEF(untouchwin)(WINDOW* win) { + return untouchwin(win); +} +#undef untouchwin +#define untouchwin UNDEF(untouchwin) +#endif + +#ifdef vline +inline int UNDEF(vline)(chtype ch, int n) { + return vline(ch, n); +} +#undef vline +#define vline UNDEF(vline) +#endif + +#ifdef waddchstr +inline int UNDEF(waddchstr)(WINDOW* win, chtype* at) { + return waddchstr(win, at); +} +#undef waddchstr +#define waddchstr UNDEF(waddchstr) +#endif + +#ifdef waddstr +inline int UNDEF(waddstr)(WINDOW* win, char* str) { + return waddstr(win, str); +} +#undef waddstr +#define waddstr UNDEF(waddstr) +#endif + +#ifdef wattroff +inline int UNDEF(wattroff)(WINDOW* win, int att) { + return wattroff(win, att); +} +#undef wattroff +#define wattroff UNDEF(wattroff) +#endif + +#ifdef wattrset +inline int UNDEF(wattrset)(WINDOW* win, int att) { + return wattrset(win, att); +} +#undef wattrset +#define wattrset UNDEF(wattrset) +#endif + +#ifdef winch +inline chtype UNDEF(winch)(const WINDOW* win) { + return winch(win); +} +#undef winch +#define winch UNDEF(winch) +#endif + +#ifdef winchnstr +inline int UNDEF(winchnstr)(WINDOW* win, chtype* str, int n) { + return winchnstr(win, str, n); +} +#undef winchnstr +#define winchnstr UNDEF(winchnstr) +#endif + +#ifdef winchstr +inline int UNDEF(winchstr)(WINDOW* win, chtype* str) { + return winchstr(win, str); +} +#undef winchstr +#define winchstr UNDEF(winchstr) +#endif + +#ifdef winsstr +inline int UNDEF(winsstr)(WINDOW* w, const char* _str) { + return winsstr(w, _str); +} +#undef winsstr +#define winsstr UNDEF(winsstr) +#endif + +#ifdef wstandend +inline int UNDEF(wstandend)(WINDOW* win) { + return wstandend(win); +} +#undef wstandend +#define wstandend UNDEF(wstandend) +#endif + +#ifdef wstandout +inline int UNDEF(wstandout)(WINDOW* win) { + return wstandout(win); +} +#undef wstandout +#define wstandout UNDEF(wstandout) +#endif + +/* + * + * C++ class for windows. + * + */ + +extern "C" int _nc_ripoffline(int, int (*init)(WINDOW*, int)); +extern "C" int _nc_xx_ripoff_init(WINDOW*, int); +extern "C" int _nc_has_mouse(void); + +class NCURSES_IMPEXP NCursesWindow { + friend class NCursesMenu; + friend class NCursesForm; + + private: + static bool b_initialized; + static void initialize(); + void constructing(); + friend int _nc_xx_ripoff_init(WINDOW*, int); + + void set_keyboard(); + + NCURSES_COLOR_T getcolor(int getback) const; + NCURSES_PAIRS_T getPair() const; + + static int + setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back, NCURSES_PAIRS_T pair); + static int colorInitialized; + + // This private constructor is only used during the initialization + // of windows generated by ripoffline() calls. + NCursesWindow(WINDOW* win, int ncols); + + protected: + virtual void err_handler(const char*) const THROWS(NCursesException); + // Signal an error with the given message text. + + static long count; // count of all active windows: + // We rely on the c++ promise that + // all otherwise uninitialized + // static class vars are set to 0 + + WINDOW* w; // the curses WINDOW + + bool alloced; // TRUE if we own the WINDOW + + NCursesWindow* par; // parent, if subwindow + NCursesWindow* subwins; // head of subwindows list + NCursesWindow* sib; // next subwindow of parent + + void kill_subwindows(); // disable all subwindows + // Destroy all subwindows. + + /* Only for use by derived classes. They are then in charge to + fill the member variables correctly. */ + NCursesWindow(); + + public: + NCursesWindow(WINDOW* window); // useful only for stdscr + + NCursesWindow( + int nlines, // number of lines + int ncols, // number of columns + int begin_y, // line origin + int begin_x); // col origin + + NCursesWindow( + NCursesWindow& par, // parent window + int nlines, // number of lines + int ncols, // number of columns + int begin_y, // absolute or relative + int begin_x, // origins: + char absrel = 'a'); // if `a', begin_y & begin_x are + // absolute screen pos, else if `r', they are relative to par origin + + NCursesWindow( + NCursesWindow& par, // parent window + bool do_box = TRUE); + // this is the very common case that we want to create the subwindow that + // is two lines and two columns smaller and begins at (1,1). + // We may automatically request the box around it. + + NCursesWindow& operator=(const NCursesWindow& rhs) { + if (this != &rhs) + *this = rhs; + return *this; + } + + NCursesWindow(const NCursesWindow& rhs) + : w(rhs.w), + alloced(rhs.alloced), + par(rhs.par), + subwins(rhs.subwins), + sib(rhs.sib) {} + + virtual ~NCursesWindow(); + + NCursesWindow Clone(); + // Make an exact copy of the window. + + // Initialization. + static void useColors(void); + // Call this routine very early if you want to have colors. + + static int ripoffline(int ripoff_lines, int (*init)(NCursesWindow& win)); + // This function is used to generate a window of ripped-of lines. + // If the argument is positive, lines are removed from the top, if it + // is negative lines are removed from the bottom. This enhances the + // lowlevel ripoffline() function because it uses the internal + // implementation that allows to remove more than just a single line. + // This function must be called before any other ncurses function. The + // creation of the window is deferred until ncurses gets initialized. + // The initialization function is then called. + + // ------------------------------------------------------------------------- + // terminal status + // ------------------------------------------------------------------------- + int lines() const { + initialize(); + return LINES; + } + // Number of lines on terminal, *not* window + + int cols() const { + initialize(); + return COLS; + } + // Number of cols on terminal, *not* window + + int tabsize() const { + initialize(); + return TABSIZE; + } + // Size of a tab on terminal, *not* window + + static int NumberOfColors(); + // Number of available colors + + int colors() const { + return NumberOfColors(); + } + // Number of available colors + + // ------------------------------------------------------------------------- + // window status + // ------------------------------------------------------------------------- + int height() const { + return maxy() + 1; + } + // Number of lines in this window + + int width() const { + return maxx() + 1; + } + // Number of columns in this window + + int begx() const { + return getbegx(w); + } + // Column of top left corner relative to stdscr + + int begy() const { + return getbegy(w); + } + // Line of top left corner relative to stdscr + + int curx() const { + return getcurx(w); + } + // Column of top left corner relative to stdscr + + int cury() const { + return getcury(w); + } + // Line of top left corner relative to stdscr + + int maxx() const { + return getmaxx(w) == ERR ? ERR : getmaxx(w) - 1; + } + // Largest x coord in window + + int maxy() const { + return getmaxy(w) == ERR ? ERR : getmaxy(w) - 1; + } + // Largest y coord in window + + NCURSES_PAIRS_T getcolor() const; + // Actual color pair + + NCURSES_COLOR_T foreground() const { + return getcolor(0); + } + // Actual foreground color + + NCURSES_COLOR_T background() const { + return getcolor(1); + } + // Actual background color + + int setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back); + // Set color palette entry + + int setcolor(NCURSES_PAIRS_T pair); + // Set actually used palette entry + + // ------------------------------------------------------------------------- + // window positioning + // ------------------------------------------------------------------------- + virtual int mvwin(int begin_y, int begin_x) { + return ::mvwin(w, begin_y, begin_x); + } + // Move window to new position with the new position as top left corner. + // This is virtual because it is redefined in NCursesPanel. + + // ------------------------------------------------------------------------- + // coordinate positioning + // ------------------------------------------------------------------------- + int move(int y, int x) { + return ::wmove(w, y, x); + } + // Move cursor the this position + + void getyx(int& y, int& x) const { + ::getyx(w, y, x); + } + // Get current position of the cursor + + void getbegyx(int& y, int& x) const { + ::getbegyx(w, y, x); + } + // Get beginning of the window + + void getmaxyx(int& y, int& x) const { + ::getmaxyx(w, y, x); + } + // Get size of the window + + void getparyx(int& y, int& x) const { + ::getparyx(w, y, x); + } + // Get parent's beginning of the window + + int mvcur(int oldrow, int oldcol, int newrow, int newcol) const { + return ::mvcur(oldrow, oldcol, newrow, newcol); + } + // Perform lowlevel cursor motion that takes effect immediately. + + // ------------------------------------------------------------------------- + // input + // ------------------------------------------------------------------------- + int getch() { + return ::wgetch(w); + } + // Get a keystroke from the window. + + int getch(int y, int x) { + return ::mvwgetch(w, y, x); + } + // Move cursor to position and get a keystroke from the window + + int getstr(char* str, int n = -1) { + return ::wgetnstr(w, str, n); + } + // Read a series of characters into str until a newline or carriage return + // is received. Read at most n characters. If n is negative, the limit is + // ignored. + + int getstr(int y, int x, char* str, int n = -1) { + return ::mvwgetnstr(w, y, x, str, n); + } + // Move the cursor to the requested position and then perform the getstr() + // as described above. + + int instr(char* s, int n = -1) { + return ::winnstr(w, s, n); + } + // Get a string of characters from the window into the buffer s. Retrieve + // at most n characters, if n is negative retrieve all characters up to the + // end of the current line. Attributes are stripped from the characters. + + int instr(int y, int x, char* s, int n = -1) { + return ::mvwinnstr(w, y, x, s, n); + } + // Move the cursor to the requested position and then perform the instr() + // as described above. + + int scanw(const char* fmt, ...) +// Perform a scanw function from the window. +#if __GNUG__ >= 2 + __attribute__((format(scanf, 2, 3))); +#else + ; +#endif + + int scanw(const char*, va_list); + // Perform a scanw function from the window. + + int scanw(int y, int x, const char* fmt, ...) +// Move the cursor to the requested position and then perform a scanw +// from the window. +#if __GNUG__ >= 2 + __attribute__((format(scanf, 4, 5))); +#else + ; +#endif + + int scanw(int y, int x, const char* fmt, va_list); + // Move the cursor to the requested position and then perform a scanw + // from the window. + + // ------------------------------------------------------------------------- + // output + // ------------------------------------------------------------------------- + int addch(const chtype ch) { + return ::waddch(w, ch); + } + // Put attributed character to the window. + + int addch(int y, int x, const chtype ch) { + return ::mvwaddch(w, y, x, ch); + } + // Move cursor to the requested position and then put attributed character + // to the window. + + int echochar(const chtype ch) { + return ::wechochar(w, ch); + } + // Put attributed character to the window and refresh it immediately. + + int addstr(const char* str, int n = -1) { + return ::waddnstr(w, str, n); + } + // Write the string str to the window, stop writing if the terminating + // NUL or the limit n is reached. If n is negative, it is ignored. + + int addstr(int y, int x, const char* str, int n = -1) { + return ::mvwaddnstr(w, y, x, str, n); + } + // Move the cursor to the requested position and then perform the addchstr + // as described above. + + int addchstr(const chtype* str, int n = -1) { + return ::waddchnstr(w, str, n); + } + // Write the string str to the window, stop writing if the terminating + // NUL or the limit n is reached. If n is negative, it is ignored. + + int addchstr(int y, int x, const chtype* str, int n = -1) { + return ::mvwaddchnstr(w, y, x, str, n); + } + // Move the cursor to the requested position and then perform the addchstr + // as described above. + + int printw(const char* fmt, ...) +// Do a formatted print to the window. +#if (__GNUG__ >= 2) && !defined(printf) + __attribute__((format(printf, 2, 3))); +#else + ; +#endif + + int printw(int y, int x, const char* fmt, ...) +// Move the cursor and then do a formatted print to the window. +#if (__GNUG__ >= 2) && !defined(printf) + __attribute__((format(printf, 4, 5))); +#else + ; +#endif + + int printw(const char* fmt, va_list args); + // Do a formatted print to the window. + + int printw(int y, int x, const char* fmt, va_list args); + // Move the cursor and then do a formatted print to the window. + + chtype inch() const { + return ::winch(w); + } + // Retrieve attributed character under the current cursor position. + + chtype inch(int y, int x) { + return ::mvwinch(w, y, x); + } + // Move cursor to requested position and then retrieve attributed character + // at this position. + + int inchstr(chtype* str, int n = -1) { + return ::winchnstr(w, str, n); + } + // Read the string str from the window, stop reading if the terminating + // NUL or the limit n is reached. If n is negative, it is ignored. + + int inchstr(int y, int x, chtype* str, int n = -1) { + return ::mvwinchnstr(w, y, x, str, n); + } + // Move the cursor to the requested position and then perform the inchstr + // as described above. + + int insch(chtype ch) { + return ::winsch(w, ch); + } + // Insert attributed character into the window before current cursor + // position. + + int insch(int y, int x, chtype ch) { + return ::mvwinsch(w, y, x, ch); + } + // Move cursor to requested position and then insert the attributed + // character before that position. + + int insertln() { + return ::winsdelln(w, 1); + } + // Insert an empty line above the current line. + + int insdelln(int n = 1) { + return ::winsdelln(w, n); + } + // If n>0 insert that many lines above the current line. If n<0 delete + // that many lines beginning with the current line. + + int insstr(const char* s, int n = -1) { + return ::winsnstr(w, s, n); + } + // Insert the string into the window before the current cursor position. + // Insert stops at end of string or when the limit n is reached. If n is + // negative, it is ignored. + + int insstr(int y, int x, const char* s, int n = -1) { + return ::mvwinsnstr(w, y, x, s, n); + } + // Move the cursor to the requested position and then perform the insstr() + // as described above. + + int attron(chtype at) { + return ::wattron(w, at); + } + // Switch on the window attributes; + + int attroff(chtype at) { + return ::wattroff(w, static_cast(at)); + } + // Switch off the window attributes; + + int attrset(chtype at) { + return ::wattrset(w, static_cast(at)); + } + // Set the window attributes; + + chtype attrget() { + return ::getattrs(w); + } + // Get the window attributes; + + int color_set(NCURSES_PAIRS_T color_pair_number, void* opts = NULL) { + return ::wcolor_set(w, color_pair_number, opts); + } + // Set the window color attribute; + + int chgat( + int n, + attr_t attr, + NCURSES_PAIRS_T color, + const void* opts = NULL) { + return ::wchgat(w, n, attr, color, opts); + } + // Change the attributes of the next n characters in the current line. If + // n is negative or greater than the number of remaining characters in the + // line, the attributes will be changed up to the end of the line. + + int chgat( + int y, + int x, + int n, + attr_t attr, + NCURSES_PAIRS_T color, + const void* opts = NULL) { + return ::mvwchgat(w, y, x, n, attr, color, opts); + } + // Move the cursor to the requested position and then perform chgat() as + // described above. + + // ------------------------------------------------------------------------- + // background + // ------------------------------------------------------------------------- + chtype getbkgd() const { + return ::getbkgd(w); + } + // Get current background setting. + + int bkgd(const chtype ch) { + return ::wbkgd(w, ch); + } + // Set the background property and apply it to the window. + + void bkgdset(chtype ch) { + ::wbkgdset(w, ch); + } + // Set the background property. + + // ------------------------------------------------------------------------- + // borders + // ------------------------------------------------------------------------- + int box(chtype vert = 0, chtype hor = 0) { + return ::wborder(w, vert, vert, hor, hor, 0, 0, 0, 0); + } + // Draw a box around the window with the given vertical and horizontal + // drawing characters. If you specify a zero as character, curses will try + // to find a "nice" character. + + int border( + chtype left = 0, + chtype right = 0, + chtype top = 0, + chtype bottom = 0, + chtype top_left = 0, + chtype top_right = 0, + chtype bottom_left = 0, + chtype bottom_right = 0) { + return ::wborder( + w, + left, + right, + top, + bottom, + top_left, + top_right, + bottom_left, + bottom_right); + } + // Draw a border around the window with the given characters for the + // various parts of the border. If you pass zero for a character, curses + // will try to find "nice" characters. + + // ------------------------------------------------------------------------- + // lines and boxes + // ------------------------------------------------------------------------- + int hline(int len, chtype ch = 0) { + return ::whline(w, ch, len); + } + // Draw a horizontal line of len characters with the given character. If + // you pass zero for the character, curses will try to find a "nice" one. + + int hline(int y, int x, int len, chtype ch = 0) { + return ::mvwhline(w, y, x, ch, len); + } + // Move the cursor to the requested position and then draw a horizontal line. + + int vline(int len, chtype ch = 0) { + return ::wvline(w, ch, len); + } + // Draw a vertical line of len characters with the given character. If + // you pass zero for the character, curses will try to find a "nice" one. + + int vline(int y, int x, int len, chtype ch = 0) { + return ::mvwvline(w, y, x, ch, len); + } + // Move the cursor to the requested position and then draw a vertical line. + + // ------------------------------------------------------------------------- + // erasure + // ------------------------------------------------------------------------- + int erase() { + return ::werase(w); + } + // Erase the window. + + int clear() { + return ::wclear(w); + } + // Clear the window. + + int clearok(bool bf) { + return ::clearok(w, bf); + } + // Set/Reset the clear flag. If set, the next refresh() will clear the + // screen. + + int clrtobot() { + return ::wclrtobot(w); + } + // Clear to the end of the window. + + int clrtoeol() { + return ::wclrtoeol(w); + } + // Clear to the end of the line. + + int delch() { + return ::wdelch(w); + } + // Delete character under the cursor. + + int delch(int y, int x) { + return ::mvwdelch(w, y, x); + } + // Move cursor to requested position and delete the character under the + // cursor. + + int deleteln() { + return ::winsdelln(w, -1); + } + // Delete the current line. + + // ------------------------------------------------------------------------- + // screen control + // ------------------------------------------------------------------------- + int scroll(int amount = 1) { + return ::wscrl(w, amount); + } + // Scroll amount lines. If amount is positive, scroll up, otherwise + // scroll down. + + int scrollok(bool bf) { + return ::scrollok(w, bf); + } + // If bf is TRUE, window scrolls if cursor is moved off the bottom + // edge of the window or a scrolling region, otherwise the cursor is left + // at the bottom line. + + int setscrreg(int from, int to) { + return ::wsetscrreg(w, from, to); + } + // Define a soft scrolling region. + + int idlok(bool bf) { + return ::idlok(w, bf); + } + // If bf is TRUE, use insert/delete line hardware support if possible. + // Otherwise do it in software. + + void idcok(bool bf) { + ::idcok(w, bf); + } + // If bf is TRUE, use insert/delete character hardware support if possible. + // Otherwise do it in software. + + int touchline(int s, int c) { + return ::touchline(w, s, c); + } + // Mark the given lines as modified. + + int touchwin() { + return ::wtouchln(w, 0, height(), 1); + } + // Mark the whole window as modified. + + int untouchwin() { + return ::wtouchln(w, 0, height(), 0); + } + // Mark the whole window as unmodified. + + int touchln(int s, int cnt, bool changed = TRUE) { + return ::wtouchln(w, s, cnt, static_cast(changed ? 1 : 0)); + } + // Mark cnt lines beginning from line s as changed or unchanged, depending + // on the value of the changed flag. + + bool is_linetouched(int line) const { + return (::is_linetouched(w, line) == TRUE ? TRUE : FALSE); + } + // Return TRUE if line is marked as changed, FALSE otherwise + + bool is_wintouched() const { + return (::is_wintouched(w) ? TRUE : FALSE); + } + // Return TRUE if window is marked as changed, FALSE otherwise + + int leaveok(bool bf) { + return ::leaveok(w, bf); + } + // If bf is TRUE, curses will leave the cursor after an update whereever + // it is after the update. + + int redrawln(int from, int n) { + return ::wredrawln(w, from, n); + } + // Redraw n lines starting from the requested line + + int redrawwin() { + return ::wredrawln(w, 0, height()); + } + // Redraw the whole window + + int doupdate() { + return ::doupdate(); + } + // Do all outputs to make the physical screen looking like the virtual one + + void syncdown() { + ::wsyncdown(w); + } + // Propagate the changes down to all descendant windows + + void syncup() { + ::wsyncup(w); + } + // Propagate the changes up in the hierarchy + + void cursyncup() { + ::wcursyncup(w); + } + // Position the cursor in all ancestor windows corresponding to our setting + + int syncok(bool bf) { + return ::syncok(w, bf); + } +// If called with bf=TRUE, syncup() is called whenever the window is changed + +#ifndef _no_flushok + int flushok(bool bf) { + return ::flushok(w, bf); + } +#endif + + void immedok(bool bf) { + ::immedok(w, bf); + } + // If called with bf=TRUE, any change in the window will cause an + // automatic immediate refresh() + + int intrflush(bool bf) { + return ::intrflush(w, bf); + } + + int keypad(bool bf) { + return ::keypad(w, bf); + } + // If called with bf=TRUE, the application will interpret function keys. + + int nodelay(bool bf) { + return ::nodelay(w, bf); + } + + int meta(bool bf) { + return ::meta(w, bf); + } + // If called with bf=TRUE, keys may generate 8-Bit characters. Otherwise + // 7-Bit characters are generated. + + int standout() { + return ::wstandout(w); + } + // Enable "standout" attributes + + int standend() { + return ::wstandend(w); + } + // Disable "standout" attributes + + // ------------------------------------------------------------------------- + // The next two are virtual, because we redefine them in the + // NCursesPanel class. + // ------------------------------------------------------------------------- + virtual int refresh() { + return ::wrefresh(w); + } + // Propagate the changes in this window to the virtual screen and call + // doupdate(). This is redefined in NCursesPanel. + + virtual int noutrefresh() { + return ::wnoutrefresh(w); + } + // Propagate the changes in this window to the virtual screen. This is + // redefined in NCursesPanel. + + // ------------------------------------------------------------------------- + // multiple window control + // ------------------------------------------------------------------------- + int overlay(NCursesWindow& win) { + return ::overlay(w, win.w); + } + // Overlay this window over win. + + int overwrite(NCursesWindow& win) { + return ::overwrite(w, win.w); + } + // Overwrite win with this window. + + int copywin( + NCursesWindow& win, + int sminrow, + int smincol, + int dminrow, + int dmincol, + int dmaxrow, + int dmaxcol, + bool overlaywin = TRUE) { + return ::copywin( + w, + win.w, + sminrow, + smincol, + dminrow, + dmincol, + dmaxrow, + dmaxcol, + static_cast(overlaywin ? 1 : 0)); + } +// Overlay or overwrite the rectangle in win given by dminrow,dmincol, +// dmaxrow,dmaxcol with the rectangle in this window beginning at +// sminrow,smincol. + +// ------------------------------------------------------------------------- +// Extended functions +// ------------------------------------------------------------------------- +#if defined(NCURSES_EXT_FUNCS) && (NCURSES_EXT_FUNCS != 0) + int wresize(int newLines, int newColumns) { + return ::wresize(w, newLines, newColumns); + } +#endif + + // ------------------------------------------------------------------------- + // Mouse related + // ------------------------------------------------------------------------- + bool has_mouse() const; + // Return TRUE if terminal supports a mouse, FALSE otherwise + + // ------------------------------------------------------------------------- + // traversal support + // ------------------------------------------------------------------------- + NCursesWindow* child() { + return subwins; + } + // Get the first child window. + + NCursesWindow* sibling() { + return sib; + } + // Get the next child of my parent. + + NCursesWindow* parent() { + return par; + } + // Get my parent. + + bool isDescendant(NCursesWindow& win); + // Return TRUE if win is a descendant of this. +}; + +// ------------------------------------------------------------------------- +// We leave this here for compatibility reasons. +// ------------------------------------------------------------------------- +class NCURSES_IMPEXP NCursesColorWindow : public NCursesWindow { + public: + NCursesColorWindow(WINDOW*& window) // useful only for stdscr + : NCursesWindow(window) { + useColors(); + } + + NCursesColorWindow( + int nlines, // number of lines + int ncols, // number of columns + int begin_y, // line origin + int begin_x) // col origin + : NCursesWindow(nlines, ncols, begin_y, begin_x) { + useColors(); + } + + NCursesColorWindow( + NCursesWindow& parentWin, // parent window + int nlines, // number of lines + int ncols, // number of columns + int begin_y, // absolute or relative + int begin_x, // origins: + char absrel = 'a') // if `a', by & bx are + : NCursesWindow( + parentWin, + nlines, + ncols, // absolute screen pos, + begin_y, + begin_x, // else if `r', they are + absrel) { // relative to par origin + useColors(); + } +}; + +// These enum definitions really belong inside the NCursesPad class, but only +// recent compilers support that feature. + +typedef enum { + REQ_PAD_REFRESH = KEY_MAX + 1, + REQ_PAD_UP, + REQ_PAD_DOWN, + REQ_PAD_LEFT, + REQ_PAD_RIGHT, + REQ_PAD_EXIT +} Pad_Request; + +const Pad_Request PAD_LOW = REQ_PAD_REFRESH; // lowest op-code +const Pad_Request PAD_HIGH = REQ_PAD_EXIT; // highest op-code + +// ------------------------------------------------------------------------- +// Pad Support. We allow an association of a pad with a "real" window +// through which the pad may be viewed. +// ------------------------------------------------------------------------- +class NCURSES_IMPEXP NCursesPad : public NCursesWindow { + private: + NCursesWindow* viewWin; // the "viewport" window + NCursesWindow* viewSub; // the "viewport" subwindow + + int h_gridsize, v_gridsize; + + protected: + int min_row, min_col; // top left row/col of the pads display area + + NCursesWindow* Win(void) const { + // Get the window into which the pad should be copied (if any) + return (viewSub ? viewSub : (viewWin ? viewWin : 0)); + } + + NCursesWindow* getWindow(void) const { + return viewWin; + } + + NCursesWindow* getSubWindow(void) const { + return viewSub; + } + + virtual int driver(int key); // Virtualize keystroke key + // The driver translates the keystroke c into an Pad_Request + + virtual void OnUnknownOperation(int pad_req) { + (void)pad_req; + ::beep(); + } + // This is called if the driver returns an unknown op-code + + virtual void OnNavigationError(int pad_req) { + (void)pad_req; + ::beep(); + } + // This is called if a navigation request couldn't be satisfied + + virtual void OnOperation(int pad_req) { + (void)pad_req; + }; + // OnOperation is called if a Pad_Operation was executed and just before + // the refresh() operation is done. + + public: + NCursesPad(int nlines, int ncols); + // create a pad with the given size + + NCursesPad& operator=(const NCursesPad& rhs) { + if (this != &rhs) { + *this = rhs; + NCursesWindow::operator=(rhs); + } + return *this; + } + + NCursesPad(const NCursesPad& rhs) + : NCursesWindow(rhs), + viewWin(rhs.viewWin), + viewSub(rhs.viewSub), + h_gridsize(rhs.h_gridsize), + v_gridsize(rhs.v_gridsize), + min_row(rhs.min_row), + min_col(rhs.min_col) {} + + virtual ~NCursesPad() {} + + int echochar(const chtype ch) { + return ::pechochar(w, ch); + } + // Put the attributed character onto the pad and immediately do a + // prefresh(). + + int refresh(); + // If a viewport is defined the pad is displayed in this window, otherwise + // this is a noop. + + int refresh( + int pminrow, + int pmincol, + int sminrow, + int smincol, + int smaxrow, + int smaxcol) { + return ::prefresh(w, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol); + } + // The coordinates sminrow,smincol,smaxrow,smaxcol describe a rectangle + // on the screen. refresh copies a rectangle of this size beginning + // with top left corner pminrow,pmincol onto the screen and calls doupdate(). + + int noutrefresh(); + // If a viewport is defined the pad is displayed in this window, otherwise + // this is a noop. + + int noutrefresh( + int pminrow, + int pmincol, + int sminrow, + int smincol, + int smaxrow, + int smaxcol) { + return ::pnoutrefresh( + w, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol); + } + // Does the same as refresh() but without calling doupdate(). + + virtual void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1); + // Add the window "view" as viewing window to the pad. + + virtual void setSubWindow(NCursesWindow& sub); + // Use the subwindow "sub" of the viewport window for the actual viewing. + // The full viewport window is usually used to provide some decorations + // like frames, titles etc. + + virtual void operator()(void); + // Perform Pad's operation +}; + +// A FramedPad is constructed always with a viewport window. This viewport +// will be framed (by a box() command) and the interior of the box is the +// viewport subwindow. On the frame we display scrollbar sliders. +class NCURSES_IMPEXP NCursesFramedPad : public NCursesPad { + protected: + virtual void OnOperation(int pad_req); + + public: + NCursesFramedPad( + NCursesWindow& win, + int nlines, + int ncols, + int v_grid = 1, + int h_grid = 1) + : NCursesPad(nlines, ncols) { + NCursesPad::setWindow(win, v_grid, h_grid); + NCursesPad::setSubWindow(*(new NCursesWindow(win))); + } + // Construct the FramedPad with the given Window win as viewport. + + virtual ~NCursesFramedPad() { + delete getSubWindow(); + } + + void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1) { + (void)view; + (void)v_grid; + (void)h_grid; + err_handler("Operation not allowed"); + } + // Disable this call; the viewport is already defined + + void setSubWindow(NCursesWindow& sub) { + (void)sub; + err_handler("Operation not allowed"); + } + // Disable this call; the viewport subwindow is already defined +}; + +#endif /* NCURSES_CURSESW_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/cursslk.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/cursslk.h new file mode 100644 index 0000000..204c7c6 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/cursslk.h @@ -0,0 +1,232 @@ +// * this is for making emacs happy: -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1997 * + ****************************************************************************/ + +// $Id: cursslk.h,v 1.13 2005/05/28 21:58:18 tom Exp $ + +#ifndef NCURSES_CURSSLK_H_incl +#define NCURSES_CURSSLK_H_incl + +#include + +class NCURSES_IMPEXP Soft_Label_Key_Set { + public: + // This inner class represents the attributes of a Soft Label Key (SLK) + class NCURSES_IMPEXP Soft_Label_Key { + friend class Soft_Label_Key_Set; + + public: + typedef enum { Left = 0, Center = 1, Right = 2 } Justification; + + private: + char* label; // The Text of the Label + Justification format; // The Justification + int num; // The number of the Label + + Soft_Label_Key() : label(NULL), format(Left), num(-1) {} + + virtual ~Soft_Label_Key() { + delete[] label; + }; + + public: + // Set the text of the Label + Soft_Label_Key& operator=(char* text); + + // Set the Justification of the Label + Soft_Label_Key& operator=(Justification just) { + format = just; + return *this; + } + + // Retrieve the text of the label + inline char* operator()(void) const { + return label; + } + + Soft_Label_Key& operator=(const Soft_Label_Key& rhs) { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + Soft_Label_Key(const Soft_Label_Key& rhs) + : label(NULL), format(rhs.format), num(rhs.num) { + *this = rhs.label; + } + }; + + public: + typedef enum { + None = -1, + Three_Two_Three = 0, + Four_Four = 1, + PC_Style = 2, + PC_Style_With_Index = 3 + } Label_Layout; + + private: + static long NCURSES_IMPEXP count; // Number of Key Sets + static Label_Layout NCURSES_IMPEXP format; // Layout of the Key Sets + static int NCURSES_IMPEXP num_labels; // Number Of Labels in Key Sets + bool NCURSES_IMPEXP b_attrInit; // Are attributes initialized + + Soft_Label_Key* slk_array; // The array of SLK's + + // Init the Key Set + void init(); + + // Activate or Deactivate Label# i, Label counting starts with 1! + void activate_label(int i, bool bf = TRUE); + + // Activate of Deactivate all Labels + void activate_labels(bool bf); + + protected: + inline void Error(const char* msg) const THROWS(NCursesException) { + THROW(new NCursesException(msg)); + } + + // Remove SLK's from screen + void clear() { + if (ERR == ::slk_clear()) + Error("slk_clear"); + } + + // Restore them + void restore() { + if (ERR == ::slk_restore()) + Error("slk_restore"); + } + + public: + // Construct a Key Set, use the most comfortable layout as default. + // You must create a Soft_Label_Key_Set before you create any object of + // the NCursesWindow, NCursesPanel or derived classes. (Actually before + // ::initscr() is called). + Soft_Label_Key_Set(Label_Layout fmt); + + // This constructor assumes, that you already constructed a Key Set + // with a layout by the constructor above. This layout will be reused. + NCURSES_IMPEXP Soft_Label_Key_Set(); + + Soft_Label_Key_Set& operator=(const Soft_Label_Key_Set& rhs) { + if (this != &rhs) { + *this = rhs; + init(); // allocate a new slk_array[] + } + return *this; + } + + Soft_Label_Key_Set(const Soft_Label_Key_Set& rhs) + : b_attrInit(rhs.b_attrInit), slk_array(NULL) { + init(); // allocate a new slk_array[] + } + + virtual ~Soft_Label_Key_Set(); + + // Get Label# i. Label counting starts with 1! + NCURSES_IMPEXP Soft_Label_Key& operator[](int i); + + // Retrieve number of Labels + inline int labels() const { + return num_labels; + } + + // Refresh the SLK portion of the screen + inline void refresh() { + if (ERR == ::slk_refresh()) + Error("slk_refresh"); + } + + // Mark the SLK portion of the screen for refresh, defer actual refresh + // until next update call. + inline void noutrefresh() { + if (ERR == ::slk_noutrefresh()) + Error("slk_noutrefresh"); + } + + // Mark the whole SLK portion of the screen as modified + inline void touch() { + if (ERR == ::slk_touch()) + Error("slk_touch"); + } + + // Activate Label# i + inline void show(int i) { + activate_label(i, FALSE); + activate_label(i, TRUE); + } + + // Hide Label# i + inline void hide(int i) { + activate_label(i, FALSE); + } + + // Show all Labels + inline void show() { + activate_labels(FALSE); + activate_labels(TRUE); + } + + // Hide all Labels + inline void hide() { + activate_labels(FALSE); + } + + inline void attron(attr_t attrs) { + if (ERR == ::slk_attron(attrs)) + Error("slk_attron"); + } + + inline void attroff(attr_t attrs) { + if (ERR == ::slk_attroff(attrs)) + Error("slk_attroff"); + } + + inline void attrset(attr_t attrs) { + if (ERR == ::slk_attrset(attrs)) + Error("slk_attrset"); + } + + inline void color(short color_pair_number) { + if (ERR == ::slk_color(color_pair_number)) + Error("slk_color"); + } + + inline attr_t attr() const { + return ::slk_attr(); + } +}; + +#endif /* NCURSES_CURSSLK_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/eti.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/eti.h new file mode 100644 index 0000000..3e44a9f --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/eti.h @@ -0,0 +1,54 @@ +/**************************************************************************** + * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1995,1997 * + ****************************************************************************/ + +/* $Id: eti.h,v 1.8 2003/10/25 15:24:29 tom Exp $ */ + +#ifndef NCURSES_ETI_H_incl +#define NCURSES_ETI_H_incl 1 + +#define E_OK (0) +#define E_SYSTEM_ERROR (-1) +#define E_BAD_ARGUMENT (-2) +#define E_POSTED (-3) +#define E_CONNECTED (-4) +#define E_BAD_STATE (-5) +#define E_NO_ROOM (-6) +#define E_NOT_POSTED (-7) +#define E_UNKNOWN_COMMAND (-8) +#define E_NO_MATCH (-9) +#define E_NOT_SELECTABLE (-10) +#define E_NOT_CONNECTED (-11) +#define E_REQUEST_DENIED (-12) +#define E_INVALID_FIELD (-13) +#define E_CURRENT (-14) + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/etip.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/etip.h new file mode 100644 index 0000000..fdb98a0 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/etip.h @@ -0,0 +1,333 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998-2012,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1997 * + ****************************************************************************/ + +// $Id: etip.h.in,v 1.41 2017/06/24 21:57:16 tom Exp $ + +#ifndef NCURSES_ETIP_H_incl +#define NCURSES_ETIP_H_incl 1 + +// These are substituted at configure/build time +#ifndef HAVE_BUILTIN_H +#define HAVE_BUILTIN_H 0 +#endif + +#ifndef HAVE_GXX_BUILTIN_H +#define HAVE_GXX_BUILTIN_H 0 +#endif + +#ifndef HAVE_GPP_BUILTIN_H +#define HAVE_GPP_BUILTIN_H 0 +#endif + +#ifndef HAVE_IOSTREAM +#define HAVE_IOSTREAM 1 +#endif + +#ifndef HAVE_TYPEINFO +#define HAVE_TYPEINFO 1 +#endif + +#ifndef HAVE_VALUES_H +#define HAVE_VALUES_H 0 +#endif + +#ifndef ETIP_NEEDS_MATH_H +#define ETIP_NEEDS_MATH_H 0 +#endif + +#ifndef ETIP_NEEDS_MATH_EXCEPTION +#define ETIP_NEEDS_MATH_EXCEPTION 0 +#endif + +#ifndef CPP_HAS_PARAM_INIT +#define CPP_HAS_PARAM_INIT 0 +#endif + +#ifndef CPP_HAS_STATIC_CAST +#define CPP_HAS_STATIC_CAST 1 +#endif + +#ifndef IOSTREAM_NAMESPACE +#define IOSTREAM_NAMESPACE 1 +#endif + +#ifdef __GNUG__ +#if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8)) +#if HAVE_TYPEINFO +#include +#endif +#endif +#endif + +#if defined(__GNUG__) +#if HAVE_BUILTIN_H || HAVE_GXX_BUILTIN_H || HAVE_GPP_BUILTIN_H +#if ETIP_NEEDS_MATH_H +#if ETIP_NEEDS_MATH_EXCEPTION +#undef exception +#define exception math_exception +#endif +#include +#endif +#undef exception +#define exception builtin_exception +#if HAVE_GPP_BUILTIN_H +#include +#elif HAVE_GXX_BUILTIN_H +#include +#else +#include +#endif +#undef exception +#endif +#elif defined(__SUNPRO_CC) +#include +#endif + +#include + +extern "C" { +#if HAVE_VALUES_H +#include +#endif + +#include +#include +#include +} + +// Language features +#if CPP_HAS_PARAM_INIT +#define NCURSES_PARAM_INIT(value) = value +#else +#define NCURSES_PARAM_INIT(value) /*nothing*/ +#endif + +#if CPP_HAS_STATIC_CAST +#define STATIC_CAST(s) static_cast +#else +#define STATIC_CAST(s) (s) +#endif + +// Forward Declarations +class NCURSES_IMPEXP NCursesPanel; +class NCURSES_IMPEXP NCursesMenu; +class NCURSES_IMPEXP NCursesForm; + +class NCURSES_IMPEXP NCursesException { + public: + const char* message; + int errorno; + + NCursesException(const char* msg, int err) : message(msg), errorno(err){}; + + NCursesException(const char* msg) : message(msg), errorno(E_SYSTEM_ERROR){}; + + NCursesException& operator=(const NCursesException& rhs) { + errorno = rhs.errorno; + return *this; + } + + NCursesException(const NCursesException& rhs) + : message(rhs.message), errorno(rhs.errorno) {} + + virtual const char* classname() const { + return "NCursesWindow"; + } + + virtual ~NCursesException() {} +}; + +class NCURSES_IMPEXP NCursesPanelException : public NCursesException { + public: + const NCursesPanel* p; + + NCursesPanelException(const char* msg, int err) + : NCursesException(msg, err), p(0){}; + + NCursesPanelException(const NCursesPanel* panel, const char* msg, int err) + : NCursesException(msg, err), p(panel){}; + + NCursesPanelException(int err) + : NCursesException("panel library error", err), p(0){}; + + NCursesPanelException(const NCursesPanel* panel, int err) + : NCursesException("panel library error", err), p(panel){}; + + NCursesPanelException& operator=(const NCursesPanelException& rhs) { + if (this != &rhs) { + NCursesException::operator=(rhs); + p = rhs.p; + } + return *this; + } + + NCursesPanelException(const NCursesPanelException& rhs) + : NCursesException(rhs), p(rhs.p) {} + + virtual const char* classname() const { + return "NCursesPanel"; + } + + virtual ~NCursesPanelException() {} +}; + +class NCURSES_IMPEXP NCursesMenuException : public NCursesException { + public: + const NCursesMenu* m; + + NCursesMenuException(const char* msg, int err) + : NCursesException(msg, err), m(0){}; + + NCursesMenuException(const NCursesMenu* menu, const char* msg, int err) + : NCursesException(msg, err), m(menu){}; + + NCursesMenuException(int err) + : NCursesException("menu library error", err), m(0){}; + + NCursesMenuException(const NCursesMenu* menu, int err) + : NCursesException("menu library error", err), m(menu){}; + + NCursesMenuException& operator=(const NCursesMenuException& rhs) { + if (this != &rhs) { + NCursesException::operator=(rhs); + m = rhs.m; + } + return *this; + } + + NCursesMenuException(const NCursesMenuException& rhs) + : NCursesException(rhs), m(rhs.m) {} + + virtual const char* classname() const { + return "NCursesMenu"; + } + + virtual ~NCursesMenuException() {} +}; + +class NCURSES_IMPEXP NCursesFormException : public NCursesException { + public: + const NCursesForm* f; + + NCursesFormException(const char* msg, int err) + : NCursesException(msg, err), f(0){}; + + NCursesFormException(const NCursesForm* form, const char* msg, int err) + : NCursesException(msg, err), f(form){}; + + NCursesFormException(int err) + : NCursesException("form library error", err), f(0){}; + + NCursesFormException(const NCursesForm* form, int err) + : NCursesException("form library error", err), f(form){}; + + NCursesFormException& operator=(const NCursesFormException& rhs) { + if (this != &rhs) { + NCursesException::operator=(rhs); + f = rhs.f; + } + return *this; + } + + NCursesFormException(const NCursesFormException& rhs) + : NCursesException(rhs), f(rhs.f) {} + + virtual const char* classname() const { + return "NCursesForm"; + } + + virtual ~NCursesFormException() {} +}; + +#if !( \ + (defined(__GNUG__) && defined(__EXCEPTIONS) && (__GNUG__ < 7)) || \ + defined(__SUNPRO_CC)) +#if HAVE_IOSTREAM +#include +#if IOSTREAM_NAMESPACE +using std::cerr; +using std::endl; +#endif +#else +#include +#endif +extern "C" void exit(int); +#endif + +inline void THROW(const NCursesException* e) { +#if defined(__GNUG__) && defined(__EXCEPTIONS) +#if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8)) + (*lib_error_handler)(e ? e->classname() : "", e ? e->message : ""); +#elif (__GNUG__ >= 7) + // g++ 7.0 warns about deprecation, but lacks the predefined symbols + ::endwin(); + std::cerr << "Found a problem - goodbye" << std::endl; + exit(EXIT_FAILURE); +#else +#define CPP_HAS_TRY_CATCH 1 +#endif +#elif defined(__SUNPRO_CC) +#if !defined(__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT < 5) + genericerror(1, ((e != 0) ? (char*)(e->message) : "")); +#else +#define CPP_HAS_TRY_CATCH 1 +#endif +#else + if (e) + cerr << e->message << endl; + exit(0); +#endif + +#ifndef CPP_HAS_TRY_CATCH +#define CPP_HAS_TRY_CATCH 0 +#define NCURSES_CPP_TRY /* nothing */ +#define NCURSES_CPP_CATCH(e) if (false) +#define THROWS(s) /* nothing */ +#define THROW2(s, t) /* nothing */ +#elif CPP_HAS_TRY_CATCH + throw * e; +#define NCURSES_CPP_TRY try +#define NCURSES_CPP_CATCH(e) catch (e) +#if defined(__cpp_noexcept_function_type) && \ + (__cpp_noexcept_function_type >= 201510) +// C++17 deprecates the usage of throw(). +#define THROWS(s) /* nothing */ +#define THROW2(s, t) /* nothing */ +#else +#define THROWS(s) throw(s) +#define THROW2(s, t) throw(s, t) +#endif +#endif +} + +#endif /* NCURSES_ETIP_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/form.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/form.h new file mode 100644 index 0000000..4beba75 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/form.h @@ -0,0 +1,450 @@ +/**************************************************************************** + * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1995,1997 * + ****************************************************************************/ + +/* $Id: form.h,v 0.27 2017/02/11 16:35:42 tom Exp $ */ + +#ifndef FORM_H +#define FORM_H +/* *INDENT-OFF*/ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef FORM_PRIV_H +typedef void* FIELD_CELL; +#endif + +#ifndef NCURSES_FIELD_INTERNALS +#define NCURSES_FIELD_INTERNALS /* nothing */ +#endif + +typedef int Form_Options; +typedef int Field_Options; + +/********** +* _PAGE * +**********/ + +typedef struct pagenode +#if !NCURSES_OPAQUE_FORM +{ + short pmin; /* index of first field on page */ + short pmax; /* index of last field on page */ + short smin; /* index of top leftmost field on page */ + short smax; /* index of bottom rightmost field on page */ +} +#endif /* !NCURSES_OPAQUE_FORM */ +_PAGE; + +/********** +* FIELD * +**********/ + +typedef struct fieldnode +#if 1 /* not yet: !NCURSES_OPAQUE_FORM */ +{ + unsigned short status; /* flags */ + short rows; /* size in rows */ + short cols; /* size in cols */ + short frow; /* first row */ + short fcol; /* first col */ + int drows; /* dynamic rows */ + int dcols; /* dynamic cols */ + int maxgrow; /* maximum field growth */ + int nrow; /* off-screen rows */ + short nbuf; /* additional buffers */ + short just; /* justification */ + short page; /* page on form */ + short index; /* into form -> field */ + int pad; /* pad character */ + chtype fore; /* foreground attribute */ + chtype back; /* background attribute */ + Field_Options opts; /* options */ + struct fieldnode* snext; /* sorted order pointer */ + struct fieldnode* sprev; /* sorted order pointer */ + struct fieldnode* link; /* linked field chain */ + struct formnode* form; /* containing form */ + struct typenode* type; /* field type */ + void* arg; /* argument for type */ + FIELD_CELL* buf; /* field buffers */ + void* usrptr; /* user pointer */ + /* + * The wide-character configuration requires extra information. Because + * there are existing applications that manipulate the members of FIELD + * directly, we cannot make the struct opaque, except by changing the ABI. + * Offsets of members up to this point are the same in the narrow- and + * wide-character configuration. But note that the type of buf depends on + * the configuration, and is made opaque for that reason. + */ + NCURSES_FIELD_INTERNALS +} +#endif /* NCURSES_OPAQUE_FORM */ +FIELD; + +/********* +* FORM * +*********/ + +typedef struct formnode +#if 1 /* not yet: !NCURSES_OPAQUE_FORM */ +{ + unsigned short status; /* flags */ + short rows; /* size in rows */ + short cols; /* size in cols */ + int currow; /* current row in field window */ + int curcol; /* current col in field window */ + int toprow; /* in scrollable field window */ + int begincol; /* in horiz. scrollable field */ + short maxfield; /* number of fields */ + short maxpage; /* number of pages */ + short curpage; /* index into page */ + Form_Options opts; /* options */ + WINDOW* win; /* window */ + WINDOW* sub; /* subwindow */ + WINDOW* w; /* window for current field */ + FIELD** field; /* field [maxfield] */ + FIELD* current; /* current field */ + _PAGE* page; /* page [maxpage] */ + void* usrptr; /* user pointer */ + + void (*forminit)(struct formnode*); + void (*formterm)(struct formnode*); + void (*fieldinit)(struct formnode*); + void (*fieldterm)(struct formnode*); + +} +#endif /* !NCURSES_OPAQUE_FORM */ +FORM; + +/************** +* FIELDTYPE * +**************/ + +typedef struct typenode +#if !NCURSES_OPAQUE_FORM +{ + unsigned short status; /* flags */ + long ref; /* reference count */ + struct typenode* left; /* ptr to operand for | */ + struct typenode* right; /* ptr to operand for | */ + + void* (*makearg)(va_list*); /* make fieldtype arg */ + void* (*copyarg)(const void*); /* copy fieldtype arg */ + void (*freearg)(void*); /* free fieldtype arg */ + +#if NCURSES_INTEROP_FUNCS + union { + bool (*ofcheck)(FIELD*, const void*); /* field validation */ + bool (*gfcheck)(FORM*, FIELD*, const void*); /* generic field validation */ + } fieldcheck; + union { + bool (*occheck)(int, const void*); /* character validation */ + bool (*gccheck)( + int, + FORM*, + FIELD*, + const void*); /* generic char validation */ + } charcheck; + union { + bool (*onext)(FIELD*, const void*); /* enumerate next value */ + bool (*gnext)(FORM*, FIELD*, const void*); /* generic enumerate next */ + } enum_next; + union { + bool (*oprev)(FIELD*, const void*); /* enumerate prev value */ + bool (*gprev)(FORM*, FIELD*, const void*); /* generic enumerate prev */ + } enum_prev; + void* (*genericarg)(void*); /* Alternate Arg method */ +#else + bool (*fcheck)(FIELD*, const void*); /* field validation */ + bool (*ccheck)(int, const void*); /* character validation */ + + bool (*next)(FIELD*, const void*); /* enumerate next value */ + bool (*prev)(FIELD*, const void*); /* enumerate prev value */ +#endif +} +#endif /* !NCURSES_OPAQUE_FORM */ +FIELDTYPE; + +typedef void (*Form_Hook)(FORM*); + +/*************************** +* miscellaneous #defines * +***************************/ + +/* field justification */ +#define NO_JUSTIFICATION (0) +#define JUSTIFY_LEFT (1) +#define JUSTIFY_CENTER (2) +#define JUSTIFY_RIGHT (3) + +/* field options */ +#define O_VISIBLE (0x0001U) +#define O_ACTIVE (0x0002U) +#define O_PUBLIC (0x0004U) +#define O_EDIT (0x0008U) +#define O_WRAP (0x0010U) +#define O_BLANK (0x0020U) +#define O_AUTOSKIP (0x0040U) +#define O_NULLOK (0x0080U) +#define O_PASSOK (0x0100U) +#define O_STATIC (0x0200U) +#define O_DYNAMIC_JUSTIFY (0x0400U) /* ncurses extension */ +#define O_NO_LEFT_STRIP (0x0800U) /* ncurses extension */ + +/* form options */ +#define O_NL_OVERLOAD (0x0001U) +#define O_BS_OVERLOAD (0x0002U) + +/* form driver commands */ +#define REQ_NEXT_PAGE (KEY_MAX + 1) /* move to next page */ +#define REQ_PREV_PAGE (KEY_MAX + 2) /* move to previous page */ +#define REQ_FIRST_PAGE (KEY_MAX + 3) /* move to first page */ +#define REQ_LAST_PAGE (KEY_MAX + 4) /* move to last page */ + +#define REQ_NEXT_FIELD (KEY_MAX + 5) /* move to next field */ +#define REQ_PREV_FIELD (KEY_MAX + 6) /* move to previous field */ +#define REQ_FIRST_FIELD (KEY_MAX + 7) /* move to first field */ +#define REQ_LAST_FIELD (KEY_MAX + 8) /* move to last field */ +#define REQ_SNEXT_FIELD (KEY_MAX + 9) /* move to sorted next field */ +#define REQ_SPREV_FIELD (KEY_MAX + 10) /* move to sorted prev field */ +#define REQ_SFIRST_FIELD (KEY_MAX + 11) /* move to sorted first field */ +#define REQ_SLAST_FIELD (KEY_MAX + 12) /* move to sorted last field */ +#define REQ_LEFT_FIELD (KEY_MAX + 13) /* move to left to field */ +#define REQ_RIGHT_FIELD (KEY_MAX + 14) /* move to right to field */ +#define REQ_UP_FIELD (KEY_MAX + 15) /* move to up to field */ +#define REQ_DOWN_FIELD (KEY_MAX + 16) /* move to down to field */ + +#define REQ_NEXT_CHAR (KEY_MAX + 17) /* move to next char in field */ +#define REQ_PREV_CHAR (KEY_MAX + 18) /* move to prev char in field */ +#define REQ_NEXT_LINE (KEY_MAX + 19) /* move to next line in field */ +#define REQ_PREV_LINE (KEY_MAX + 20) /* move to prev line in field */ +#define REQ_NEXT_WORD (KEY_MAX + 21) /* move to next word in field */ +#define REQ_PREV_WORD (KEY_MAX + 22) /* move to prev word in field */ +#define REQ_BEG_FIELD (KEY_MAX + 23) /* move to first char in field */ +#define REQ_END_FIELD (KEY_MAX + 24) /* move after last char in fld */ +#define REQ_BEG_LINE (KEY_MAX + 25) /* move to beginning of line */ +#define REQ_END_LINE (KEY_MAX + 26) /* move after last char in line */ +#define REQ_LEFT_CHAR (KEY_MAX + 27) /* move left in field */ +#define REQ_RIGHT_CHAR (KEY_MAX + 28) /* move right in field */ +#define REQ_UP_CHAR (KEY_MAX + 29) /* move up in field */ +#define REQ_DOWN_CHAR (KEY_MAX + 30) /* move down in field */ + +#define REQ_NEW_LINE (KEY_MAX + 31) /* insert/overlay new line */ +#define REQ_INS_CHAR (KEY_MAX + 32) /* insert blank char at cursor */ +#define REQ_INS_LINE (KEY_MAX + 33) /* insert blank line at cursor */ +#define REQ_DEL_CHAR (KEY_MAX + 34) /* delete char at cursor */ +#define REQ_DEL_PREV (KEY_MAX + 35) /* delete char before cursor */ +#define REQ_DEL_LINE (KEY_MAX + 36) /* delete line at cursor */ +#define REQ_DEL_WORD (KEY_MAX + 37) /* delete word at cursor */ +#define REQ_CLR_EOL (KEY_MAX + 38) /* clear to end of line */ +#define REQ_CLR_EOF (KEY_MAX + 39) /* clear to end of field */ +#define REQ_CLR_FIELD (KEY_MAX + 40) /* clear entire field */ +#define REQ_OVL_MODE (KEY_MAX + 41) /* begin overlay mode */ +#define REQ_INS_MODE (KEY_MAX + 42) /* begin insert mode */ +#define REQ_SCR_FLINE (KEY_MAX + 43) /* scroll field forward a line */ +#define REQ_SCR_BLINE (KEY_MAX + 44) /* scroll field backward a line */ +#define REQ_SCR_FPAGE (KEY_MAX + 45) /* scroll field forward a page */ +#define REQ_SCR_BPAGE (KEY_MAX + 46) /* scroll field backward a page */ +#define REQ_SCR_FHPAGE (KEY_MAX + 47) /* scroll field forward half page */ +#define REQ_SCR_BHPAGE (KEY_MAX + 48) /* scroll field backward half page */ +#define REQ_SCR_FCHAR (KEY_MAX + 49) /* horizontal scroll char */ +#define REQ_SCR_BCHAR (KEY_MAX + 50) /* horizontal scroll char */ +#define REQ_SCR_HFLINE (KEY_MAX + 51) /* horizontal scroll line */ +#define REQ_SCR_HBLINE (KEY_MAX + 52) /* horizontal scroll line */ +#define REQ_SCR_HFHALF (KEY_MAX + 53) /* horizontal scroll half line */ +#define REQ_SCR_HBHALF (KEY_MAX + 54) /* horizontal scroll half line */ + +#define REQ_VALIDATION (KEY_MAX + 55) /* validate field */ +#define REQ_NEXT_CHOICE (KEY_MAX + 56) /* display next field choice */ +#define REQ_PREV_CHOICE (KEY_MAX + 57) /* display prev field choice */ + +#define MIN_FORM_COMMAND (KEY_MAX + 1) /* used by form_driver */ +#define MAX_FORM_COMMAND (KEY_MAX + 57) /* used by form_driver */ + +#if defined(MAX_COMMAND) +#if (MAX_FORM_COMMAND > MAX_COMMAND) +#error Something is wrong -- MAX_FORM_COMMAND is greater than MAX_COMMAND +#elif (MAX_COMMAND != (KEY_MAX + 128)) +#error Something is wrong -- MAX_COMMAND is already inconsistently defined. +#endif +#else +#define MAX_COMMAND (KEY_MAX + 128) +#endif + +/************************* +* standard field types * +*************************/ +extern NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ALPHA; +extern NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ALNUM; +extern NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ENUM; +extern NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_INTEGER; +extern NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_NUMERIC; +extern NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_REGEXP; + +/************************************ +* built-in additional field types * +* They are not defined in SVr4 * +************************************/ +extern NCURSES_EXPORT_VAR( + FIELDTYPE*) TYPE_IPV4; /* Internet IP Version 4 address */ + +/*********************** +* FIELDTYPE routines * +***********************/ +extern NCURSES_EXPORT(FIELDTYPE*) new_fieldtype( + bool (*const field_check)(FIELD*, const void*), + bool (*const char_check)(int, const void*)); +extern NCURSES_EXPORT(FIELDTYPE*) link_fieldtype(FIELDTYPE*, FIELDTYPE*); + +extern NCURSES_EXPORT(int) free_fieldtype(FIELDTYPE*); +extern NCURSES_EXPORT(int) set_fieldtype_arg( + FIELDTYPE*, + void* (*const make_arg)(va_list*), + void* (*const copy_arg)(const void*), + void (*const free_arg)(void*)); +extern NCURSES_EXPORT(int) set_fieldtype_choice( + FIELDTYPE*, + bool (*const next_choice)(FIELD*, const void*), + bool (*const prev_choice)(FIELD*, const void*)); + +/******************* +* FIELD routines * +*******************/ +extern NCURSES_EXPORT(FIELD*) new_field(int, int, int, int, int, int); +extern NCURSES_EXPORT(FIELD*) dup_field(FIELD*, int, int); +extern NCURSES_EXPORT(FIELD*) link_field(FIELD*, int, int); + +extern NCURSES_EXPORT(int) free_field(FIELD*); +extern NCURSES_EXPORT(int) + field_info(const FIELD*, int*, int*, int*, int*, int*, int*); +extern NCURSES_EXPORT(int) dynamic_field_info(const FIELD*, int*, int*, int*); +extern NCURSES_EXPORT(int) set_max_field(FIELD*, int); +extern NCURSES_EXPORT(int) move_field(FIELD*, int, int); +extern NCURSES_EXPORT(int) set_field_type(FIELD*, FIELDTYPE*, ...); +extern NCURSES_EXPORT(int) set_new_page(FIELD*, bool); +extern NCURSES_EXPORT(int) set_field_just(FIELD*, int); +extern NCURSES_EXPORT(int) field_just(const FIELD*); +extern NCURSES_EXPORT(int) set_field_fore(FIELD*, chtype); +extern NCURSES_EXPORT(int) set_field_back(FIELD*, chtype); +extern NCURSES_EXPORT(int) set_field_pad(FIELD*, int); +extern NCURSES_EXPORT(int) field_pad(const FIELD*); +extern NCURSES_EXPORT(int) set_field_buffer(FIELD*, int, const char*); +extern NCURSES_EXPORT(int) set_field_status(FIELD*, bool); +extern NCURSES_EXPORT(int) set_field_userptr(FIELD*, void*); +extern NCURSES_EXPORT(int) set_field_opts(FIELD*, Field_Options); +extern NCURSES_EXPORT(int) field_opts_on(FIELD*, Field_Options); +extern NCURSES_EXPORT(int) field_opts_off(FIELD*, Field_Options); + +extern NCURSES_EXPORT(chtype) field_fore(const FIELD*); +extern NCURSES_EXPORT(chtype) field_back(const FIELD*); + +extern NCURSES_EXPORT(bool) new_page(const FIELD*); +extern NCURSES_EXPORT(bool) field_status(const FIELD*); + +extern NCURSES_EXPORT(void*) field_arg(const FIELD*); + +extern NCURSES_EXPORT(void*) field_userptr(const FIELD*); + +extern NCURSES_EXPORT(FIELDTYPE*) field_type(const FIELD*); + +extern NCURSES_EXPORT(char*) field_buffer(const FIELD*, int); + +extern NCURSES_EXPORT(Field_Options) field_opts(const FIELD*); + +/****************** +* FORM routines * +******************/ + +extern NCURSES_EXPORT(FORM*) new_form(FIELD**); + +extern NCURSES_EXPORT(FIELD**) form_fields(const FORM*); +extern NCURSES_EXPORT(FIELD*) current_field(const FORM*); + +extern NCURSES_EXPORT(WINDOW*) form_win(const FORM*); +extern NCURSES_EXPORT(WINDOW*) form_sub(const FORM*); + +extern NCURSES_EXPORT(Form_Hook) form_init(const FORM*); +extern NCURSES_EXPORT(Form_Hook) form_term(const FORM*); +extern NCURSES_EXPORT(Form_Hook) field_init(const FORM*); +extern NCURSES_EXPORT(Form_Hook) field_term(const FORM*); + +extern NCURSES_EXPORT(int) free_form(FORM*); +extern NCURSES_EXPORT(int) set_form_fields(FORM*, FIELD**); +extern NCURSES_EXPORT(int) field_count(const FORM*); +extern NCURSES_EXPORT(int) set_form_win(FORM*, WINDOW*); +extern NCURSES_EXPORT(int) set_form_sub(FORM*, WINDOW*); +extern NCURSES_EXPORT(int) set_current_field(FORM*, FIELD*); +extern NCURSES_EXPORT(int) unfocus_current_field(FORM*); +extern NCURSES_EXPORT(int) field_index(const FIELD*); +extern NCURSES_EXPORT(int) set_form_page(FORM*, int); +extern NCURSES_EXPORT(int) form_page(const FORM*); +extern NCURSES_EXPORT(int) scale_form(const FORM*, int*, int*); +extern NCURSES_EXPORT(int) set_form_init(FORM*, Form_Hook); +extern NCURSES_EXPORT(int) set_form_term(FORM*, Form_Hook); +extern NCURSES_EXPORT(int) set_field_init(FORM*, Form_Hook); +extern NCURSES_EXPORT(int) set_field_term(FORM*, Form_Hook); +extern NCURSES_EXPORT(int) post_form(FORM*); +extern NCURSES_EXPORT(int) unpost_form(FORM*); +extern NCURSES_EXPORT(int) pos_form_cursor(FORM*); +extern NCURSES_EXPORT(int) form_driver(FORM*, int); +#if NCURSES_WIDECHAR +extern NCURSES_EXPORT(int) form_driver_w(FORM*, int, wchar_t); +#endif +extern NCURSES_EXPORT(int) set_form_userptr(FORM*, void*); +extern NCURSES_EXPORT(int) set_form_opts(FORM*, Form_Options); +extern NCURSES_EXPORT(int) form_opts_on(FORM*, Form_Options); +extern NCURSES_EXPORT(int) form_opts_off(FORM*, Form_Options); +extern NCURSES_EXPORT(int) form_request_by_name(const char*); + +extern NCURSES_EXPORT(const char*) form_request_name(int); + +extern NCURSES_EXPORT(void*) form_userptr(const FORM*); + +extern NCURSES_EXPORT(Form_Options) form_opts(const FORM*); + +extern NCURSES_EXPORT(bool) data_ahead(const FORM*); +extern NCURSES_EXPORT(bool) data_behind(const FORM*); + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(FORM*) NCURSES_SP_NAME(new_form)(SCREEN*, FIELD**); +#endif + +#ifdef __cplusplus +} +#endif +/* *INDENT-ON*/ + +#endif /* FORM_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/menu.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/menu.h new file mode 100644 index 0000000..6f81485 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/menu.h @@ -0,0 +1,266 @@ +/**************************************************************************** + * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1995,1997 * + ****************************************************************************/ + +/* $Id: menu.h,v 1.23 2017/02/11 16:54:04 tom Exp $ */ + +#ifndef ETI_MENU +#define ETI_MENU + +#ifdef AMIGA +#define TEXT TEXT_ncurses +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef int Menu_Options; +typedef int Item_Options; + +/* Menu options: */ +#define O_ONEVALUE (0x01) +#define O_SHOWDESC (0x02) +#define O_ROWMAJOR (0x04) +#define O_IGNORECASE (0x08) +#define O_SHOWMATCH (0x10) +#define O_NONCYCLIC (0x20) +#define O_MOUSE_MENU (0x40) + +/* Item options: */ +#define O_SELECTABLE (0x01) + +#if !NCURSES_OPAQUE_MENU +typedef struct { + const char* str; + unsigned short length; +} TEXT; +#endif /* !NCURSES_OPAQUE_MENU */ + +struct tagMENU; + +typedef struct tagITEM +#if !NCURSES_OPAQUE_MENU +{ + TEXT name; /* name of menu item */ + TEXT description; /* description of item, optional in display */ + struct tagMENU* imenu; /* Pointer to parent menu */ + void* userptr; /* Pointer to user defined per item data */ + Item_Options opt; /* Item options */ + short index; /* Item number if connected to a menu */ + short y; /* y and x location of item in menu */ + short x; + bool value; /* Selection value */ + + struct tagITEM* left; /* neighbor items */ + struct tagITEM* right; + struct tagITEM* up; + struct tagITEM* down; + +} +#endif /* !NCURSES_OPAQUE_MENU */ +ITEM; + +typedef void (*Menu_Hook)(struct tagMENU*); + +typedef struct tagMENU +#if 1 /* not yet: !NCURSES_OPAQUE_MENU */ +{ + short height; /* Nr. of chars high */ + short width; /* Nr. of chars wide */ + short rows; /* Nr. of items high */ + short cols; /* Nr. of items wide */ + short frows; /* Nr. of formatted items high */ + short fcols; /* Nr. of formatted items wide */ + short arows; /* Nr. of items high (actual) */ + short namelen; /* Max. name length */ + short desclen; /* Max. description length */ + short marklen; /* Length of mark, if any */ + short itemlen; /* Length of one item */ + short spc_desc; /* Spacing for descriptor */ + short spc_cols; /* Spacing for columns */ + short spc_rows; /* Spacing for rows */ + char* pattern; /* Buffer to store match chars */ + short pindex; /* Index into pattern buffer */ + WINDOW* win; /* Window containing menu */ + WINDOW* sub; /* Subwindow for menu display */ + WINDOW* userwin; /* User's window */ + WINDOW* usersub; /* User's subwindow */ + ITEM** items; /* array of items */ + short nitems; /* Nr. of items in menu */ + ITEM* curitem; /* Current item */ + short toprow; /* Top row of menu */ + chtype fore; /* Selection attribute */ + chtype back; /* Nonselection attribute */ + chtype grey; /* Inactive attribute */ + unsigned char pad; /* Pad character */ + + Menu_Hook menuinit; /* User hooks */ + Menu_Hook menuterm; + Menu_Hook iteminit; + Menu_Hook itemterm; + + void* userptr; /* Pointer to menus user data */ + char* mark; /* Pointer to marker string */ + + Menu_Options opt; /* Menu options */ + unsigned short status; /* Internal state of menu */ +} +#endif /* !NCURSES_OPAQUE_MENU */ +MENU; + +/* Define keys */ + +#define REQ_LEFT_ITEM (KEY_MAX + 1) +#define REQ_RIGHT_ITEM (KEY_MAX + 2) +#define REQ_UP_ITEM (KEY_MAX + 3) +#define REQ_DOWN_ITEM (KEY_MAX + 4) +#define REQ_SCR_ULINE (KEY_MAX + 5) +#define REQ_SCR_DLINE (KEY_MAX + 6) +#define REQ_SCR_DPAGE (KEY_MAX + 7) +#define REQ_SCR_UPAGE (KEY_MAX + 8) +#define REQ_FIRST_ITEM (KEY_MAX + 9) +#define REQ_LAST_ITEM (KEY_MAX + 10) +#define REQ_NEXT_ITEM (KEY_MAX + 11) +#define REQ_PREV_ITEM (KEY_MAX + 12) +#define REQ_TOGGLE_ITEM (KEY_MAX + 13) +#define REQ_CLEAR_PATTERN (KEY_MAX + 14) +#define REQ_BACK_PATTERN (KEY_MAX + 15) +#define REQ_NEXT_MATCH (KEY_MAX + 16) +#define REQ_PREV_MATCH (KEY_MAX + 17) + +#define MIN_MENU_COMMAND (KEY_MAX + 1) +#define MAX_MENU_COMMAND (KEY_MAX + 17) + +/* + * Some AT&T code expects MAX_COMMAND to be out-of-band not + * just for menu commands but for forms ones as well. + */ +#if defined(MAX_COMMAND) +#if (MAX_MENU_COMMAND > MAX_COMMAND) +#error Something is wrong -- MAX_MENU_COMMAND is greater than MAX_COMMAND +#elif (MAX_COMMAND != (KEY_MAX + 128)) +#error Something is wrong -- MAX_COMMAND is already inconsistently defined. +#endif +#else +#define MAX_COMMAND (KEY_MAX + 128) +#endif + +/* --------- prototypes for libmenu functions ----------------------------- */ + +extern NCURSES_EXPORT(ITEM**) menu_items(const MENU*); +extern NCURSES_EXPORT(ITEM*) current_item(const MENU*); +extern NCURSES_EXPORT(ITEM*) new_item(const char*, const char*); + +extern NCURSES_EXPORT(MENU*) new_menu(ITEM**); + +extern NCURSES_EXPORT(Item_Options) item_opts(const ITEM*); +extern NCURSES_EXPORT(Menu_Options) menu_opts(const MENU*); + +extern NCURSES_EXPORT(Menu_Hook) item_init(const MENU*); +extern NCURSES_EXPORT(Menu_Hook) item_term(const MENU*); +extern NCURSES_EXPORT(Menu_Hook) menu_init(const MENU*); +extern NCURSES_EXPORT(Menu_Hook) menu_term(const MENU*); + +extern NCURSES_EXPORT(WINDOW*) menu_sub(const MENU*); +extern NCURSES_EXPORT(WINDOW*) menu_win(const MENU*); + +extern NCURSES_EXPORT(const char*) item_description(const ITEM*); +extern NCURSES_EXPORT(const char*) item_name(const ITEM*); +extern NCURSES_EXPORT(const char*) menu_mark(const MENU*); +extern NCURSES_EXPORT(const char*) menu_request_name(int); + +extern NCURSES_EXPORT(char*) menu_pattern(const MENU*); + +extern NCURSES_EXPORT(void*) menu_userptr(const MENU*); +extern NCURSES_EXPORT(void*) item_userptr(const ITEM*); + +extern NCURSES_EXPORT(chtype) menu_back(const MENU*); +extern NCURSES_EXPORT(chtype) menu_fore(const MENU*); +extern NCURSES_EXPORT(chtype) menu_grey(const MENU*); + +extern NCURSES_EXPORT(int) free_item(ITEM*); +extern NCURSES_EXPORT(int) free_menu(MENU*); +extern NCURSES_EXPORT(int) item_count(const MENU*); +extern NCURSES_EXPORT(int) item_index(const ITEM*); +extern NCURSES_EXPORT(int) item_opts_off(ITEM*, Item_Options); +extern NCURSES_EXPORT(int) item_opts_on(ITEM*, Item_Options); +extern NCURSES_EXPORT(int) menu_driver(MENU*, int); +extern NCURSES_EXPORT(int) menu_opts_off(MENU*, Menu_Options); +extern NCURSES_EXPORT(int) menu_opts_on(MENU*, Menu_Options); +extern NCURSES_EXPORT(int) menu_pad(const MENU*); +extern NCURSES_EXPORT(int) pos_menu_cursor(const MENU*); +extern NCURSES_EXPORT(int) post_menu(MENU*); +extern NCURSES_EXPORT(int) scale_menu(const MENU*, int*, int*); +extern NCURSES_EXPORT(int) set_current_item(MENU* menu, ITEM* item); +extern NCURSES_EXPORT(int) set_item_init(MENU*, Menu_Hook); +extern NCURSES_EXPORT(int) set_item_opts(ITEM*, Item_Options); +extern NCURSES_EXPORT(int) set_item_term(MENU*, Menu_Hook); +extern NCURSES_EXPORT(int) set_item_userptr(ITEM*, void*); +extern NCURSES_EXPORT(int) set_item_value(ITEM*, bool); +extern NCURSES_EXPORT(int) set_menu_back(MENU*, chtype); +extern NCURSES_EXPORT(int) set_menu_fore(MENU*, chtype); +extern NCURSES_EXPORT(int) set_menu_format(MENU*, int, int); +extern NCURSES_EXPORT(int) set_menu_grey(MENU*, chtype); +extern NCURSES_EXPORT(int) set_menu_init(MENU*, Menu_Hook); +extern NCURSES_EXPORT(int) set_menu_items(MENU*, ITEM**); +extern NCURSES_EXPORT(int) set_menu_mark(MENU*, const char*); +extern NCURSES_EXPORT(int) set_menu_opts(MENU*, Menu_Options); +extern NCURSES_EXPORT(int) set_menu_pad(MENU*, int); +extern NCURSES_EXPORT(int) set_menu_pattern(MENU*, const char*); +extern NCURSES_EXPORT(int) set_menu_sub(MENU*, WINDOW*); +extern NCURSES_EXPORT(int) set_menu_term(MENU*, Menu_Hook); +extern NCURSES_EXPORT(int) set_menu_userptr(MENU*, void*); +extern NCURSES_EXPORT(int) set_menu_win(MENU*, WINDOW*); +extern NCURSES_EXPORT(int) set_top_row(MENU*, int); +extern NCURSES_EXPORT(int) top_row(const MENU*); +extern NCURSES_EXPORT(int) unpost_menu(MENU*); +extern NCURSES_EXPORT(int) menu_request_by_name(const char*); +extern NCURSES_EXPORT(int) set_menu_spacing(MENU*, int, int, int); +extern NCURSES_EXPORT(int) menu_spacing(const MENU*, int*, int*, int*); + +extern NCURSES_EXPORT(bool) item_value(const ITEM*); +extern NCURSES_EXPORT(bool) item_visible(const ITEM*); + +extern NCURSES_EXPORT(void) menu_format(const MENU*, int*, int*); + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(MENU*) NCURSES_SP_NAME(new_menu)(SCREEN*, ITEM**); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* ETI_MENU */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/nc_tparm.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/nc_tparm.h new file mode 100644 index 0000000..c3f414b --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/nc_tparm.h @@ -0,0 +1,120 @@ +/**************************************************************************** + * Copyright (c) 2006-2012,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Thomas E. Dickey 2006 * + ****************************************************************************/ + +/* $Id: nc_tparm.h,v 1.8 2017/07/22 17:09:46 tom Exp $ */ + +#ifndef NC_TPARM_included +#define NC_TPARM_included 1 + +#include +#include + +/* + * Cast parameters past the formatting-string for tparm() to match the + * assumption of the varargs code. + */ +#ifndef TPARM_ARG +#ifdef NCURSES_TPARM_ARG +#define TPARM_ARG NCURSES_TPARM_ARG +#else +#define TPARM_ARG long +#endif +#endif /* TPARAM_ARG */ + +#define TPARM_N(n) (TPARM_ARG)(n) + +#define TPARM_9(a, b, c, d, e, f, g, h, i, j) \ + tparm( \ + a, \ + TPARM_N(b), \ + TPARM_N(c), \ + TPARM_N(d), \ + TPARM_N(e), \ + TPARM_N(f), \ + TPARM_N(g), \ + TPARM_N(h), \ + TPARM_N(i), \ + TPARM_N(j)) + +#if NCURSES_TPARM_VARARGS +#define TPARM_8(a, b, c, d, e, f, g, h, i) \ + tparm( \ + a, \ + TPARM_N(b), \ + TPARM_N(c), \ + TPARM_N(d), \ + TPARM_N(e), \ + TPARM_N(f), \ + TPARM_N(g), \ + TPARM_N(h), \ + TPARM_N(i)) +#define TPARM_7(a, b, c, d, e, f, g, h) \ + tparm( \ + a, \ + TPARM_N(b), \ + TPARM_N(c), \ + TPARM_N(d), \ + TPARM_N(e), \ + TPARM_N(f), \ + TPARM_N(g), \ + TPARM_N(h)) +#define TPARM_6(a, b, c, d, e, f, g) \ + tparm( \ + a, \ + TPARM_N(b), \ + TPARM_N(c), \ + TPARM_N(d), \ + TPARM_N(e), \ + TPARM_N(f), \ + TPARM_N(g)) +#define TPARM_5(a, b, c, d, e, f) \ + tparm(a, TPARM_N(b), TPARM_N(c), TPARM_N(d), TPARM_N(e), TPARM_N(f)) +#define TPARM_4(a, b, c, d, e) \ + tparm(a, TPARM_N(b), TPARM_N(c), TPARM_N(d), TPARM_N(e)) +#define TPARM_3(a, b, c, d) tparm(a, TPARM_N(b), TPARM_N(c), TPARM_N(d)) +#define TPARM_2(a, b, c) tparm(a, TPARM_N(b), TPARM_N(c)) +#define TPARM_1(a, b) tparm(a, TPARM_N(b)) +#define TPARM_0(a) tparm(a) +#else +#define TPARM_8(a, b, c, d, e, f, g, h, i) TPARM_9(a, b, c, d, e, f, g, h, i, 0) +#define TPARM_7(a, b, c, d, e, f, g, h) TPARM_8(a, b, c, d, e, f, g, h, 0) +#define TPARM_6(a, b, c, d, e, f, g) TPARM_7(a, b, c, d, e, f, g, 0) +#define TPARM_5(a, b, c, d, e, f) TPARM_6(a, b, c, d, e, f, 0) +#define TPARM_4(a, b, c, d, e) TPARM_5(a, b, c, d, e, 0) +#define TPARM_3(a, b, c, d) TPARM_4(a, b, c, d, 0) +#define TPARM_2(a, b, c) TPARM_3(a, b, c, 0) +#define TPARM_1(a, b) TPARM_2(a, b, 0) +#define TPARM_1(a, b) TPARM_2(a, b, 0) +#define TPARM_0(a) TPARM_1(a, 0) +#endif + +#endif /* NC_TPARM_included */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/ncurses.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/ncurses.h new file mode 100644 index 0000000..1512dc4 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/ncurses.h @@ -0,0 +1,2456 @@ +/**************************************************************************** + * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* $Id: curses.h.in,v 1.257 2017/11/21 00:11:37 tom Exp $ */ + +#ifndef __NCURSES_H +#define __NCURSES_H + +#define CURSES 1 +#define CURSES_H 1 + +/* These are defined only in curses.h, and are used for conditional compiles */ +#define NCURSES_VERSION_MAJOR 6 +#define NCURSES_VERSION_MINOR 1 +#define NCURSES_VERSION_PATCH 20180127 + +/* This is defined in more than one ncurses header, for identification */ +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.1" + +/* + * Identify the mouse encoding version. + */ +#define NCURSES_MOUSE_VERSION 2 + +/* + * Definitions to facilitate DLL's. + */ +#include + +#if 1 +#include +#endif + +/* + * User-definable tweak to disable the include of . + */ +#ifndef NCURSES_ENABLE_STDBOOL_H +#define NCURSES_ENABLE_STDBOOL_H 1 +#endif + +/* + * NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses + * configured using --disable-macros. + */ +#ifndef NCURSES_ATTR_T +#define NCURSES_ATTR_T int +#endif + +/* + * Expands to 'const' if ncurses is configured using --enable-const. Note that + * doing so makes it incompatible with other implementations of X/Open Curses. + */ +#undef NCURSES_CONST +#define NCURSES_CONST const + +#undef NCURSES_INLINE +#define NCURSES_INLINE inline + +/* + * The standard type used for color values, and for color-pairs. The latter + * allows the curses library to enumerate the combinations of foreground and + * background colors used by an application, and is normally the product of the + * total foreground and background colors. + * + * X/Open uses "short" for both of these types, ultimately because they are + * numbers from the SVr4 terminal database, which uses 16-bit signed values. + */ +#undef NCURSES_COLOR_T +#define NCURSES_COLOR_T short + +#undef NCURSES_PAIRS_T +#define NCURSES_PAIRS_T short + +/* + * Definitions used to make WINDOW and similar structs opaque. + */ +#ifndef NCURSES_INTERNALS +#define NCURSES_OPAQUE 0 +#define NCURSES_OPAQUE_FORM 0 +#define NCURSES_OPAQUE_MENU 0 +#define NCURSES_OPAQUE_PANEL 0 +#endif + +/* + * Definition used to optionally suppress wattr* macros to help with the + * transition from ncurses5 to ncurses6 by allowing the header files to + * be shared across development packages for ncursesw in both ABIs. + */ +#ifndef NCURSES_WATTR_MACROS +#define NCURSES_WATTR_MACROS 1 +#endif + +/* + * The reentrant code relies on the opaque setting, but adds features. + */ +#ifndef NCURSES_REENTRANT +#define NCURSES_REENTRANT 0 +#endif + +/* + * Control whether bindings for interop support are added. + */ +#undef NCURSES_INTEROP_FUNCS +#define NCURSES_INTEROP_FUNCS 1 + +/* + * The internal type used for window dimensions. + */ +#undef NCURSES_SIZE_T +#define NCURSES_SIZE_T short + +/* + * Control whether tparm() supports varargs or fixed-parameter list. + */ +#undef NCURSES_TPARM_VARARGS +#define NCURSES_TPARM_VARARGS 1 + +/* + * Control type used for tparm's arguments. While X/Open equates long and + * char* values, this is not always workable for 64-bit platforms. + */ +#undef NCURSES_TPARM_ARG +#define NCURSES_TPARM_ARG intptr_t + +/* + * Control whether ncurses uses wcwidth() for checking width of line-drawing + * characters. + */ +#undef NCURSES_WCWIDTH_GRAPHICS +#define NCURSES_WCWIDTH_GRAPHICS 1 + +/* + * NCURSES_CH_T is used in building the library, but not used otherwise in + * this header file, since that would make the normal/wide-character versions + * of the header incompatible. + */ +#undef NCURSES_CH_T +#define NCURSES_CH_T cchar_t + +#if 1 && defined(_LP64) +typedef unsigned chtype; +typedef unsigned mmask_t; +#else +typedef uint32_t chtype; +typedef uint32_t mmask_t; +#endif + +/* + * We need FILE, etc. Include this before checking any feature symbols. + */ +#include + +/* + * With XPG4, you must define _XOPEN_SOURCE_EXTENDED, it is redundant (or + * conflicting) when _XOPEN_SOURCE is 500 or greater. If NCURSES_WIDECHAR is + * not already defined, e.g., if the platform relies upon nonstandard feature + * test macros, define it at this point if the standard feature test macros + * indicate that it should be defined. + */ +#ifndef NCURSES_WIDECHAR +#if defined(_XOPEN_SOURCE_EXTENDED) || \ + (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 >= 500)) +#define NCURSES_WIDECHAR 1 +#else +#define NCURSES_WIDECHAR 0 +#endif +#endif /* NCURSES_WIDECHAR */ + +#include /* we need va_list */ +#if NCURSES_WIDECHAR +#include /* we want wchar_t */ +#endif + +/* X/Open and SVr4 specify that curses implements 'bool'. However, C++ may also + * implement it. If so, we must use the C++ compiler's type to avoid conflict + * with other interfaces. + * + * A further complication is that may declare 'bool' to be a + * different type, such as an enum which is not necessarily compatible with + * C++. If we have , make 'bool' a macro, so users may #undef it. + * Otherwise, let it remain a typedef to avoid conflicts with other #define's. + * In either case, make a typedef for NCURSES_BOOL which can be used if needed + * from either C or C++. + */ + +#undef TRUE +#define TRUE 1 + +#undef FALSE +#define FALSE 0 + +typedef unsigned char NCURSES_BOOL; + +#if defined(__cplusplus) /* __cplusplus, etc. */ + +/* use the C++ compiler's bool type */ +#define NCURSES_BOOL bool + +#else /* c89, c99, etc. */ + +#if NCURSES_ENABLE_STDBOOL_H +#include +/* use whatever the C compiler decides bool really is */ +#define NCURSES_BOOL bool +#else +/* there is no predefined bool - use our own */ +#undef bool +#define bool NCURSES_BOOL +#endif + +#endif /* !__cplusplus, etc. */ + +#ifdef __cplusplus +extern "C" { +#define NCURSES_CAST(type, value) static_cast(value) +#else +#define NCURSES_CAST(type, value) (type)(value) +#endif + +#define NCURSES_OK_ADDR(p) (0 != NCURSES_CAST(const void*, (p))) + +/* + * X/Open attributes. In the ncurses implementation, they are identical to the + * A_ attributes. + */ +#define WA_ATTRIBUTES A_ATTRIBUTES +#define WA_NORMAL A_NORMAL +#define WA_STANDOUT A_STANDOUT +#define WA_UNDERLINE A_UNDERLINE +#define WA_REVERSE A_REVERSE +#define WA_BLINK A_BLINK +#define WA_DIM A_DIM +#define WA_BOLD A_BOLD +#define WA_ALTCHARSET A_ALTCHARSET +#define WA_INVIS A_INVIS +#define WA_PROTECT A_PROTECT +#define WA_HORIZONTAL A_HORIZONTAL +#define WA_LEFT A_LEFT +#define WA_LOW A_LOW +#define WA_RIGHT A_RIGHT +#define WA_TOP A_TOP +#define WA_VERTICAL A_VERTICAL + +#if 1 +#define WA_ITALIC A_ITALIC /* ncurses extension */ +#endif + +/* colors */ +#define COLOR_BLACK 0 +#define COLOR_RED 1 +#define COLOR_GREEN 2 +#define COLOR_YELLOW 3 +#define COLOR_BLUE 4 +#define COLOR_MAGENTA 5 +#define COLOR_CYAN 6 +#define COLOR_WHITE 7 + +/* line graphics */ + +#if 0 || NCURSES_REENTRANT +NCURSES_WRAPPED_VAR(chtype*, acs_map); +#define acs_map NCURSES_PUBLIC_VAR(acs_map()) +#else +extern NCURSES_EXPORT_VAR(chtype) acs_map[]; +#endif + +#define NCURSES_ACS(c) (acs_map[NCURSES_CAST(unsigned char, (c))]) + +/* VT100 symbols begin here */ +#define ACS_ULCORNER NCURSES_ACS('l') /* upper left corner */ +#define ACS_LLCORNER NCURSES_ACS('m') /* lower left corner */ +#define ACS_URCORNER NCURSES_ACS('k') /* upper right corner */ +#define ACS_LRCORNER NCURSES_ACS('j') /* lower right corner */ +#define ACS_LTEE NCURSES_ACS('t') /* tee pointing right */ +#define ACS_RTEE NCURSES_ACS('u') /* tee pointing left */ +#define ACS_BTEE NCURSES_ACS('v') /* tee pointing up */ +#define ACS_TTEE NCURSES_ACS('w') /* tee pointing down */ +#define ACS_HLINE NCURSES_ACS('q') /* horizontal line */ +#define ACS_VLINE NCURSES_ACS('x') /* vertical line */ +#define ACS_PLUS NCURSES_ACS('n') /* large plus or crossover */ +#define ACS_S1 NCURSES_ACS('o') /* scan line 1 */ +#define ACS_S9 NCURSES_ACS('s') /* scan line 9 */ +#define ACS_DIAMOND NCURSES_ACS('`') /* diamond */ +#define ACS_CKBOARD NCURSES_ACS('a') /* checker board (stipple) */ +#define ACS_DEGREE NCURSES_ACS('f') /* degree symbol */ +#define ACS_PLMINUS NCURSES_ACS('g') /* plus/minus */ +#define ACS_BULLET NCURSES_ACS('~') /* bullet */ +/* Teletype 5410v1 symbols begin here */ +#define ACS_LARROW NCURSES_ACS(',') /* arrow pointing left */ +#define ACS_RARROW NCURSES_ACS('+') /* arrow pointing right */ +#define ACS_DARROW NCURSES_ACS('.') /* arrow pointing down */ +#define ACS_UARROW NCURSES_ACS('-') /* arrow pointing up */ +#define ACS_BOARD NCURSES_ACS('h') /* board of squares */ +#define ACS_LANTERN NCURSES_ACS('i') /* lantern symbol */ +#define ACS_BLOCK NCURSES_ACS('0') /* solid square block */ +/* + * These aren't documented, but a lot of System Vs have them anyway + * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings). + * The ACS_names may not match AT&T's, our source didn't know them. + */ +#define ACS_S3 NCURSES_ACS('p') /* scan line 3 */ +#define ACS_S7 NCURSES_ACS('r') /* scan line 7 */ +#define ACS_LEQUAL NCURSES_ACS('y') /* less/equal */ +#define ACS_GEQUAL NCURSES_ACS('z') /* greater/equal */ +#define ACS_PI NCURSES_ACS('{') /* Pi */ +#define ACS_NEQUAL NCURSES_ACS('|') /* not equal */ +#define ACS_STERLING NCURSES_ACS('}') /* UK pound sign */ + +/* + * Line drawing ACS names are of the form ACS_trbl, where t is the top, r + * is the right, b is the bottom, and l is the left. t, r, b, and l might + * be B (blank), S (single), D (double), or T (thick). The subset defined + * here only uses B and S. + */ +#define ACS_BSSB ACS_ULCORNER +#define ACS_SSBB ACS_LLCORNER +#define ACS_BBSS ACS_URCORNER +#define ACS_SBBS ACS_LRCORNER +#define ACS_SBSS ACS_RTEE +#define ACS_SSSB ACS_LTEE +#define ACS_SSBS ACS_BTEE +#define ACS_BSSS ACS_TTEE +#define ACS_BSBS ACS_HLINE +#define ACS_SBSB ACS_VLINE +#define ACS_SSSS ACS_PLUS + +#undef ERR +#define ERR (-1) + +#undef OK +#define OK (0) + +/* values for the _flags member */ +#define _SUBWIN 0x01 /* is this a sub-window? */ +#define _ENDLINE 0x02 /* is the window flush right? */ +#define _FULLWIN 0x04 /* is the window full-screen? */ +#define _SCROLLWIN 0x08 /* bottom edge is at screen bottom? */ +#define _ISPAD 0x10 /* is this window a pad? */ +#define _HASMOVED 0x20 /* has cursor moved since last refresh? */ +#define _WRAPPED 0x40 /* cursor was just wrappped */ + +/* + * this value is used in the firstchar and lastchar fields to mark + * unchanged lines + */ +#define _NOCHANGE -1 + +/* + * this value is used in the oldindex field to mark lines created by insertions + * and scrolls. + */ +#define _NEWINDEX -1 + +typedef struct screen SCREEN; +typedef struct _win_st WINDOW; + +typedef chtype attr_t; /* ...must be at least as wide as chtype */ + +#if NCURSES_WIDECHAR + +#if 0 +#ifdef mblen /* libutf8.h defines it w/o undefining first */ +#undef mblen +#endif +#include +#endif + +#if 1 +#include /* ...to get mbstate_t, etc. */ +#endif + +#if 0 +typedef unsigned short wchar_t1; +#endif + +#if 0 +typedef unsigned int wint_t1; +#endif + +/* + * cchar_t stores an array of CCHARW_MAX wide characters. The first is + * normally a spacing character. The others are non-spacing. If those + * (spacing and nonspacing) do not fill the array, a null L'\0' follows. + * Otherwise, a null is assumed to follow when extracting via getcchar(). + */ +#define CCHARW_MAX 5 +typedef struct { + attr_t attr; + wchar_t chars[CCHARW_MAX]; +#if 1 +#undef NCURSES_EXT_COLORS +#define NCURSES_EXT_COLORS 20180127 + int ext_color; /* color pair, must be more than 16-bits */ +#endif +} cchar_t; + +#endif /* NCURSES_WIDECHAR */ + +#if !NCURSES_OPAQUE +struct ldat; + +struct _win_st { + NCURSES_SIZE_T _cury, _curx; /* current cursor position */ + + /* window location and size */ + NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */ + NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */ + + short _flags; /* window state flags */ + + /* attribute tracking */ + attr_t _attrs; /* current attribute for non-space character */ + chtype _bkgd; /* current background char/attribute pair */ + + /* option values set by user */ + bool _notimeout; /* no time out on function-key entry? */ + bool _clear; /* consider all data in the window invalid? */ + bool _leaveok; /* OK to not reset cursor on exit? */ + bool _scroll; /* OK to scroll this window? */ + bool _idlok; /* OK to use insert/delete line? */ + bool _idcok; /* OK to use insert/delete char? */ + bool _immed; /* window in immed mode? (not yet used) */ + bool _sync; /* window in sync mode? */ + bool _use_keypad; /* process function keys into KEY_ symbols? */ + int _delay; /* 0 = nodelay, <0 = blocking, >0 = delay */ + + struct ldat* _line; /* the actual line data */ + + /* global screen state */ + NCURSES_SIZE_T _regtop; /* top line of scrolling region */ + NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */ + + /* these are used only if this is a sub-window */ + int _parx; /* x coordinate of this window in parent */ + int _pary; /* y coordinate of this window in parent */ + WINDOW* _parent; /* pointer to parent if a sub-window */ + + /* these are used only if this is a pad */ + struct pdat { + NCURSES_SIZE_T _pad_y, _pad_x; + NCURSES_SIZE_T _pad_top, _pad_left; + NCURSES_SIZE_T _pad_bottom, _pad_right; + } _pad; + + NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */ + +#if NCURSES_WIDECHAR + cchar_t _bkgrnd; /* current background char/attribute pair */ +#if 1 + int _color; /* current color-pair for non-space character */ +#endif +#endif +}; +#endif /* NCURSES_OPAQUE */ + +/* + * This is an extension to support events... + */ +#if 1 +#ifdef NCURSES_WGETCH_EVENTS +#if !defined(__BEOS__) || defined(__HAIKU__) +/* Fix _nc_timed_wait() on BEOS... */ +#define NCURSES_EVENT_VERSION 1 +#endif /* !defined(__BEOS__) */ + +/* + * Bits to set in _nc_event.data.flags + */ +#define _NC_EVENT_TIMEOUT_MSEC 1 +#define _NC_EVENT_FILE 2 +#define _NC_EVENT_FILE_READABLE 2 +#if 0 /* Not supported yet... */ +#define _NC_EVENT_FILE_WRITABLE 4 +#define _NC_EVENT_FILE_EXCEPTION 8 +#endif + +typedef struct { + int type; + union { + long timeout_msec; /* _NC_EVENT_TIMEOUT_MSEC */ + struct { + unsigned int flags; + int fd; + unsigned int result; + } fev; /* _NC_EVENT_FILE */ + } data; +} _nc_event; + +typedef struct { + int count; + int result_flags; /* _NC_EVENT_TIMEOUT_MSEC or _NC_EVENT_FILE_READABLE */ + _nc_event* events[1]; +} _nc_eventlist; + +extern NCURSES_EXPORT(int) + wgetch_events(WINDOW*, _nc_eventlist*); /* experimental */ +extern NCURSES_EXPORT(int) + wgetnstr_events(WINDOW*, char*, int, _nc_eventlist*); /* experimental */ + +#endif /* NCURSES_WGETCH_EVENTS */ +#endif /* NCURSES_EXT_FUNCS */ + +/* + * GCC (and some other compilers) define '__attribute__'; we're using this + * macro to alert the compiler to flag inconsistencies in printf/scanf-like + * function calls. Just in case '__attribute__' isn't defined, make a dummy. + * Old versions of G++ do not accept it anyway, at least not consistently with + * GCC. + */ +#if !(defined(__GNUC__) || defined(__GNUG__) || defined(__attribute__)) +#define __attribute__(p) /* nothing */ +#endif + +/* + * We cannot define these in ncurses_cfg.h, since they require parameters to be + * passed (that is non-portable). If you happen to be using gcc with warnings + * enabled, define + * GCC_PRINTF + * GCC_SCANF + * to improve checking of calls to printw(), etc. + */ +#ifndef GCC_PRINTFLIKE +#if defined(GCC_PRINTF) && !defined(printf) +#define GCC_PRINTFLIKE(fmt, var) __attribute__((format(printf, fmt, var))) +#else +#define GCC_PRINTFLIKE(fmt, var) /*nothing*/ +#endif +#endif + +#ifndef GCC_SCANFLIKE +#if defined(GCC_SCANF) && !defined(scanf) +#define GCC_SCANFLIKE(fmt, var) __attribute__((format(scanf, fmt, var))) +#else +#define GCC_SCANFLIKE(fmt, var) /*nothing*/ +#endif +#endif + +#ifndef GCC_NORETURN +#define GCC_NORETURN /* nothing */ +#endif + +#ifndef GCC_UNUSED +#define GCC_UNUSED /* nothing */ +#endif + +/* + * Curses uses a helper function. Define our type for this to simplify + * extending it for the sp-funcs feature. + */ +typedef int (*NCURSES_OUTC)(int); + +/* + * Function prototypes. This is the complete X/Open Curses list of required + * functions. Those marked `generated' will have sources generated from the + * macro definitions later in this file, in order to satisfy XPG4.2 + * requirements. + */ + +extern NCURSES_EXPORT(int) addch(const chtype); /* generated */ +extern NCURSES_EXPORT(int) addchnstr(const chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) addchstr(const chtype*); /* generated */ +extern NCURSES_EXPORT(int) addnstr(const char*, int); /* generated */ +extern NCURSES_EXPORT(int) addstr(const char*); /* generated */ +extern NCURSES_EXPORT(int) attroff(NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attron(NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attrset(NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) + attr_get(attr_t*, NCURSES_PAIRS_T*, void*); /* generated */ +extern NCURSES_EXPORT(int) attr_off(attr_t, void*); /* generated */ +extern NCURSES_EXPORT(int) attr_on(attr_t, void*); /* generated */ +extern NCURSES_EXPORT(int) + attr_set(attr_t, NCURSES_PAIRS_T, void*); /* generated */ +extern NCURSES_EXPORT(int) baudrate(void); /* implemented */ +extern NCURSES_EXPORT(int) beep(void); /* implemented */ +extern NCURSES_EXPORT(int) bkgd(chtype); /* generated */ +extern NCURSES_EXPORT(void) bkgdset(chtype); /* generated */ +extern NCURSES_EXPORT(int) border( + chtype, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype); /* generated */ +extern NCURSES_EXPORT(int) box(WINDOW*, chtype, chtype); /* generated */ +extern NCURSES_EXPORT(bool) can_change_color(void); /* implemented */ +extern NCURSES_EXPORT(int) cbreak(void); /* implemented */ +extern NCURSES_EXPORT(int) + chgat(int, attr_t, NCURSES_PAIRS_T, const void*); /* generated */ +extern NCURSES_EXPORT(int) clear(void); /* generated */ +extern NCURSES_EXPORT(int) clearok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) clrtobot(void); /* generated */ +extern NCURSES_EXPORT(int) clrtoeol(void); /* generated */ +extern NCURSES_EXPORT(int) color_content( + NCURSES_COLOR_T, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*); /* implemented */ +extern NCURSES_EXPORT(int) color_set(NCURSES_PAIRS_T, void*); /* generated */ +extern NCURSES_EXPORT(int) COLOR_PAIR(int); /* generated */ +extern NCURSES_EXPORT(int) copywin( + const WINDOW*, + WINDOW*, + int, + int, + int, + int, + int, + int, + int); /* implemented */ +extern NCURSES_EXPORT(int) curs_set(int); /* implemented */ +extern NCURSES_EXPORT(int) def_prog_mode(void); /* implemented */ +extern NCURSES_EXPORT(int) def_shell_mode(void); /* implemented */ +extern NCURSES_EXPORT(int) delay_output(int); /* implemented */ +extern NCURSES_EXPORT(int) delch(void); /* generated */ +extern NCURSES_EXPORT(void) delscreen(SCREEN*); /* implemented */ +extern NCURSES_EXPORT(int) delwin(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) deleteln(void); /* generated */ +extern NCURSES_EXPORT(WINDOW*) + derwin(WINDOW*, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) doupdate(void); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) dupwin(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) echo(void); /* implemented */ +extern NCURSES_EXPORT(int) echochar(const chtype); /* generated */ +extern NCURSES_EXPORT(int) erase(void); /* generated */ +extern NCURSES_EXPORT(int) endwin(void); /* implemented */ +extern NCURSES_EXPORT(char) erasechar(void); /* implemented */ +extern NCURSES_EXPORT(void) filter(void); /* implemented */ +extern NCURSES_EXPORT(int) flash(void); /* implemented */ +extern NCURSES_EXPORT(int) flushinp(void); /* implemented */ +extern NCURSES_EXPORT(chtype) getbkgd(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getch(void); /* generated */ +extern NCURSES_EXPORT(int) getnstr(char*, int); /* generated */ +extern NCURSES_EXPORT(int) getstr(char*); /* generated */ +extern NCURSES_EXPORT(WINDOW*) getwin(FILE*); /* implemented */ +extern NCURSES_EXPORT(int) halfdelay(int); /* implemented */ +extern NCURSES_EXPORT(bool) has_colors(void); /* implemented */ +extern NCURSES_EXPORT(bool) has_ic(void); /* implemented */ +extern NCURSES_EXPORT(bool) has_il(void); /* implemented */ +extern NCURSES_EXPORT(int) hline(chtype, int); /* generated */ +extern NCURSES_EXPORT(void) idcok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) idlok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(void) immedok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) inch(void); /* generated */ +extern NCURSES_EXPORT(int) inchnstr(chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) inchstr(chtype*); /* generated */ +extern NCURSES_EXPORT(WINDOW*) initscr(void); /* implemented */ +extern NCURSES_EXPORT(int) init_color( + NCURSES_COLOR_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T); /* implemented */ +extern NCURSES_EXPORT(int) init_pair( + NCURSES_PAIRS_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T); /* implemented */ +extern NCURSES_EXPORT(int) innstr(char*, int); /* generated */ +extern NCURSES_EXPORT(int) insch(chtype); /* generated */ +extern NCURSES_EXPORT(int) insdelln(int); /* generated */ +extern NCURSES_EXPORT(int) insertln(void); /* generated */ +extern NCURSES_EXPORT(int) insnstr(const char*, int); /* generated */ +extern NCURSES_EXPORT(int) insstr(const char*); /* generated */ +extern NCURSES_EXPORT(int) instr(char*); /* generated */ +extern NCURSES_EXPORT(int) intrflush(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(bool) isendwin(void); /* implemented */ +extern NCURSES_EXPORT(bool) is_linetouched(WINDOW*, int); /* implemented */ +extern NCURSES_EXPORT(bool) is_wintouched(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(NCURSES_CONST char*) keyname(int); /* implemented */ +extern NCURSES_EXPORT(int) keypad(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(char) killchar(void); /* implemented */ +extern NCURSES_EXPORT(int) leaveok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(char*) longname(void); /* implemented */ +extern NCURSES_EXPORT(int) meta(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) move(int, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddch(int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) + mvaddchnstr(int, int, const chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddchstr(int, int, const chtype*); /* generated */ +extern NCURSES_EXPORT(int) + mvaddnstr(int, int, const char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddstr(int, int, const char*); /* generated */ +extern NCURSES_EXPORT(int) + mvchgat(int, int, int, attr_t, NCURSES_PAIRS_T, const void*); /* generated + */ +extern NCURSES_EXPORT(int) mvcur(int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) mvdelch(int, int); /* generated */ +extern NCURSES_EXPORT(int) mvderwin(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(int) mvgetch(int, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetnstr(int, int, char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetstr(int, int, char*); /* generated */ +extern NCURSES_EXPORT(int) mvhline(int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(chtype) mvinch(int, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchnstr(int, int, chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchstr(int, int, chtype*); /* generated */ +extern NCURSES_EXPORT(int) mvinnstr(int, int, char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsch(int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) + mvinsnstr(int, int, const char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsstr(int, int, const char*); /* generated */ +extern NCURSES_EXPORT(int) mvinstr(int, int, char*); /* generated */ +extern NCURSES_EXPORT(int) + mvprintw(int, int, const char*, ...) /* implemented */ + GCC_PRINTFLIKE(3, 4); +extern NCURSES_EXPORT(int) + mvscanw(int, int, NCURSES_CONST char*, ...) /* implemented */ + GCC_SCANFLIKE(3, 4); +extern NCURSES_EXPORT(int) mvvline(int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddch(WINDOW*, int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddchnstr(WINDOW*, int, int, const chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddchstr(WINDOW*, int, int, const chtype*); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddnstr(WINDOW*, int, int, const char*, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwaddstr(WINDOW*, int, int, const char*); /* generated */ +extern NCURSES_EXPORT(int) mvwchgat( + WINDOW*, + int, + int, + int, + attr_t, + NCURSES_PAIRS_T, + const void*); /* generated */ +extern NCURSES_EXPORT(int) mvwdelch(WINDOW*, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetch(WINDOW*, int, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwgetnstr(WINDOW*, int, int, char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetstr(WINDOW*, int, int, char*); /* generated */ +extern NCURSES_EXPORT(int) + mvwhline(WINDOW*, int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvwin(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(chtype) mvwinch(WINDOW*, int, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwinchnstr(WINDOW*, int, int, chtype*, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwinchstr(WINDOW*, int, int, chtype*); /* generated */ +extern NCURSES_EXPORT(int) + mvwinnstr(WINDOW*, int, int, char*, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinsch(WINDOW*, int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) + mvwinsnstr(WINDOW*, int, int, const char*, int); /* generated */ +extern NCURSES_EXPORT(int) + mvwinsstr(WINDOW*, int, int, const char*); /* generated */ +extern NCURSES_EXPORT(int) mvwinstr(WINDOW*, int, int, char*); /* generated */ +extern NCURSES_EXPORT(int) + mvwprintw(WINDOW*, int, int, const char*, ...) /* implemented */ + GCC_PRINTFLIKE(4, 5); +extern NCURSES_EXPORT(int) + mvwscanw(WINDOW*, int, int, NCURSES_CONST char*, ...) /* implemented */ + GCC_SCANFLIKE(4, 5); +extern NCURSES_EXPORT(int) + mvwvline(WINDOW*, int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) napms(int); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) newpad(int, int); /* implemented */ +extern NCURSES_EXPORT(SCREEN*) + newterm(NCURSES_CONST char*, FILE*, FILE*); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) newwin(int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) nl(void); /* implemented */ +extern NCURSES_EXPORT(int) nocbreak(void); /* implemented */ +extern NCURSES_EXPORT(int) nodelay(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) noecho(void); /* implemented */ +extern NCURSES_EXPORT(int) nonl(void); /* implemented */ +extern NCURSES_EXPORT(void) noqiflush(void); /* implemented */ +extern NCURSES_EXPORT(int) noraw(void); /* implemented */ +extern NCURSES_EXPORT(int) notimeout(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) overlay(const WINDOW*, WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) overwrite(const WINDOW*, WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) pair_content( + NCURSES_PAIRS_T, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*); /* implemented */ +extern NCURSES_EXPORT(int) PAIR_NUMBER(int); /* generated */ +extern NCURSES_EXPORT(int) pechochar(WINDOW*, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) + pnoutrefresh(WINDOW*, int, int, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) + prefresh(WINDOW*, int, int, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) printw(const char*, ...) /* implemented */ + GCC_PRINTFLIKE(1, 2); +extern NCURSES_EXPORT(int) putwin(WINDOW*, FILE*); /* implemented */ +extern NCURSES_EXPORT(void) qiflush(void); /* implemented */ +extern NCURSES_EXPORT(int) raw(void); /* implemented */ +extern NCURSES_EXPORT(int) redrawwin(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) refresh(void); /* generated */ +extern NCURSES_EXPORT(int) resetty(void); /* implemented */ +extern NCURSES_EXPORT(int) reset_prog_mode(void); /* implemented */ +extern NCURSES_EXPORT(int) reset_shell_mode(void); /* implemented */ +extern NCURSES_EXPORT(int) + ripoffline(int, int (*)(WINDOW*, int)); /* implemented */ +extern NCURSES_EXPORT(int) savetty(void); /* implemented */ +extern NCURSES_EXPORT(int) scanw(NCURSES_CONST char*, ...) /* implemented */ + GCC_SCANFLIKE(1, 2); +extern NCURSES_EXPORT(int) scr_dump(const char*); /* implemented */ +extern NCURSES_EXPORT(int) scr_init(const char*); /* implemented */ +extern NCURSES_EXPORT(int) scrl(int); /* generated */ +extern NCURSES_EXPORT(int) scroll(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) scrollok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(int) scr_restore(const char*); /* implemented */ +extern NCURSES_EXPORT(int) scr_set(const char*); /* implemented */ +extern NCURSES_EXPORT(int) setscrreg(int, int); /* generated */ +extern NCURSES_EXPORT(SCREEN*) set_term(SCREEN*); /* implemented */ +extern NCURSES_EXPORT(int) slk_attroff(const chtype); /* implemented */ +extern NCURSES_EXPORT(int) + slk_attr_off(const attr_t, void*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attron(const chtype); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_on(attr_t, void*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attrset(const chtype); /* implemented */ +extern NCURSES_EXPORT(attr_t) slk_attr(void); /* implemented */ +extern NCURSES_EXPORT(int) + slk_attr_set(const attr_t, NCURSES_PAIRS_T, void*); /* implemented */ +extern NCURSES_EXPORT(int) slk_clear(void); /* implemented */ +extern NCURSES_EXPORT(int) slk_color(NCURSES_PAIRS_T); /* implemented */ +extern NCURSES_EXPORT(int) slk_init(int); /* implemented */ +extern NCURSES_EXPORT(char*) slk_label(int); /* implemented */ +extern NCURSES_EXPORT(int) slk_noutrefresh(void); /* implemented */ +extern NCURSES_EXPORT(int) slk_refresh(void); /* implemented */ +extern NCURSES_EXPORT(int) slk_restore(void); /* implemented */ +extern NCURSES_EXPORT(int) slk_set(int, const char*, int); /* implemented */ +extern NCURSES_EXPORT(int) slk_touch(void); /* implemented */ +extern NCURSES_EXPORT(int) standout(void); /* generated */ +extern NCURSES_EXPORT(int) standend(void); /* generated */ +extern NCURSES_EXPORT(int) start_color(void); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) + subpad(WINDOW*, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(WINDOW*) + subwin(WINDOW*, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) syncok(WINDOW*, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) termattrs(void); /* implemented */ +extern NCURSES_EXPORT(char*) termname(void); /* implemented */ +extern NCURSES_EXPORT(void) timeout(int); /* generated */ +extern NCURSES_EXPORT(int) touchline(WINDOW*, int, int); /* generated */ +extern NCURSES_EXPORT(int) touchwin(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) typeahead(int); /* implemented */ +extern NCURSES_EXPORT(int) ungetch(int); /* implemented */ +extern NCURSES_EXPORT(int) untouchwin(WINDOW*); /* generated */ +extern NCURSES_EXPORT(void) use_env(bool); /* implemented */ +extern NCURSES_EXPORT(void) use_tioctl(bool); /* implemented */ +extern NCURSES_EXPORT(int) vidattr(chtype); /* implemented */ +extern NCURSES_EXPORT(int) vidputs(chtype, NCURSES_OUTC); /* implemented */ +extern NCURSES_EXPORT(int) vline(chtype, int); /* generated */ +extern NCURSES_EXPORT(int) + vwprintw(WINDOW*, const char*, va_list); /* implemented */ +extern NCURSES_EXPORT(int) + vw_printw(WINDOW*, const char*, va_list); /* generated */ +extern NCURSES_EXPORT(int) + vwscanw(WINDOW*, NCURSES_CONST char*, va_list); /* implemented */ +extern NCURSES_EXPORT(int) + vw_scanw(WINDOW*, NCURSES_CONST char*, va_list); /* generated */ +extern NCURSES_EXPORT(int) waddch(WINDOW*, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) + waddchnstr(WINDOW*, const chtype*, int); /* implemented */ +extern NCURSES_EXPORT(int) waddchstr(WINDOW*, const chtype*); /* generated */ +extern NCURSES_EXPORT(int) + waddnstr(WINDOW*, const char*, int); /* implemented */ +extern NCURSES_EXPORT(int) waddstr(WINDOW*, const char*); /* generated */ +extern NCURSES_EXPORT(int) wattron(WINDOW*, int); /* generated */ +extern NCURSES_EXPORT(int) wattroff(WINDOW*, int); /* generated */ +extern NCURSES_EXPORT(int) wattrset(WINDOW*, int); /* generated */ +extern NCURSES_EXPORT(int) + wattr_get(WINDOW*, attr_t*, NCURSES_PAIRS_T*, void*); /* generated */ +extern NCURSES_EXPORT(int) wattr_on(WINDOW*, attr_t, void*); /* implemented */ +extern NCURSES_EXPORT(int) wattr_off(WINDOW*, attr_t, void*); /* implemented */ +extern NCURSES_EXPORT(int) + wattr_set(WINDOW*, attr_t, NCURSES_PAIRS_T, void*); /* generated */ +extern NCURSES_EXPORT(int) wbkgd(WINDOW*, chtype); /* implemented */ +extern NCURSES_EXPORT(void) wbkgdset(WINDOW*, chtype); /* implemented */ +extern NCURSES_EXPORT(int) wborder( + WINDOW*, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype, + chtype); /* implemented */ +extern NCURSES_EXPORT(int) wchgat( + WINDOW*, + int, + attr_t, + NCURSES_PAIRS_T, + const void*); /* implemented */ +extern NCURSES_EXPORT(int) wclear(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wclrtobot(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wclrtoeol(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) + wcolor_set(WINDOW*, NCURSES_PAIRS_T, void*); /* implemented */ +extern NCURSES_EXPORT(void) wcursyncup(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wdelch(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wdeleteln(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) wechochar(WINDOW*, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) werase(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wgetch(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wgetnstr(WINDOW*, char*, int); /* implemented */ +extern NCURSES_EXPORT(int) wgetstr(WINDOW*, char*); /* generated */ +extern NCURSES_EXPORT(int) whline(WINDOW*, chtype, int); /* implemented */ +extern NCURSES_EXPORT(chtype) winch(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) winchnstr(WINDOW*, chtype*, int); /* implemented */ +extern NCURSES_EXPORT(int) winchstr(WINDOW*, chtype*); /* generated */ +extern NCURSES_EXPORT(int) winnstr(WINDOW*, char*, int); /* implemented */ +extern NCURSES_EXPORT(int) winsch(WINDOW*, chtype); /* implemented */ +extern NCURSES_EXPORT(int) winsdelln(WINDOW*, int); /* implemented */ +extern NCURSES_EXPORT(int) winsertln(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) + winsnstr(WINDOW*, const char*, int); /* implemented */ +extern NCURSES_EXPORT(int) winsstr(WINDOW*, const char*); /* generated */ +extern NCURSES_EXPORT(int) winstr(WINDOW*, char*); /* generated */ +extern NCURSES_EXPORT(int) wmove(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(int) wnoutrefresh(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) wprintw(WINDOW*, const char*, ...) /* implemented */ + GCC_PRINTFLIKE(2, 3); +extern NCURSES_EXPORT(int) wredrawln(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(int) wrefresh(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(int) + wscanw(WINDOW*, NCURSES_CONST char*, ...) /* implemented */ + GCC_SCANFLIKE(2, 3); +extern NCURSES_EXPORT(int) wscrl(WINDOW*, int); /* implemented */ +extern NCURSES_EXPORT(int) wsetscrreg(WINDOW*, int, int); /* implemented */ +extern NCURSES_EXPORT(int) wstandout(WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) wstandend(WINDOW*); /* generated */ +extern NCURSES_EXPORT(void) wsyncdown(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(void) wsyncup(WINDOW*); /* implemented */ +extern NCURSES_EXPORT(void) wtimeout(WINDOW*, int); /* implemented */ +extern NCURSES_EXPORT(int) wtouchln(WINDOW*, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) wvline(WINDOW*, chtype, int); /* implemented */ + +/* + * These are also declared in : + */ +extern NCURSES_EXPORT(int) tigetflag(NCURSES_CONST char*); /* implemented */ +extern NCURSES_EXPORT(int) tigetnum(NCURSES_CONST char*); /* implemented */ +extern NCURSES_EXPORT(char*) tigetstr(NCURSES_CONST char*); /* implemented */ +extern NCURSES_EXPORT(int) putp(const char*); /* implemented */ + +#if NCURSES_TPARM_VARARGS +extern NCURSES_EXPORT(char*) tparm(NCURSES_CONST char*, ...); /* special */ +#else +extern NCURSES_EXPORT(char*) tparm( + NCURSES_CONST char*, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG, + NCURSES_TPARM_ARG); /* special */ +extern NCURSES_EXPORT(char*) + tparm_varargs(NCURSES_CONST char*, ...); /* special */ +#endif + +extern NCURSES_EXPORT(char*) tiparm(const char*, ...); /* special */ + +/* + * X/Open says this returns a bool; SVr4 also checked for out-of-range line. + * The macro provides compatibility: + */ +#define is_linetouched(w, l) \ + ((!(w) || ((l) > getmaxy(w)) || ((l) < 0)) ? ERR : (is_linetouched)((w), (l))) + +/* + * These functions are not in X/Open, but we use them in macro definitions: + */ +extern NCURSES_EXPORT(int) getattrs(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getcurx(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getcury(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getbegx(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getbegy(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getmaxx(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getmaxy(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getparx(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) getpary(const WINDOW*); /* generated */ + +/* + * vid_attr() was implemented originally based on a draft of X/Open curses. + */ +#if !NCURSES_WIDECHAR +#define vid_attr(a, pair, opts) vidattr(a) +#endif + +/* + * These functions are extensions - not in X/Open Curses. + */ +#if 1 +#undef NCURSES_EXT_FUNCS +#define NCURSES_EXT_FUNCS 20180127 +typedef int (*NCURSES_WINDOW_CB)(WINDOW*, void*); +typedef int (*NCURSES_SCREEN_CB)(SCREEN*, void*); +extern NCURSES_EXPORT(bool) is_term_resized(int, int); +extern NCURSES_EXPORT(char*) keybound(int, int); +extern NCURSES_EXPORT(const char*) curses_version(void); +extern NCURSES_EXPORT(int) alloc_pair(int, int); +extern NCURSES_EXPORT(int) assume_default_colors(int, int); +extern NCURSES_EXPORT(int) define_key(const char*, int); +extern NCURSES_EXPORT(int) extended_color_content(int, int*, int*, int*); +extern NCURSES_EXPORT(int) extended_pair_content(int, int*, int*); +extern NCURSES_EXPORT(int) extended_slk_color(int); +extern NCURSES_EXPORT(int) find_pair(int, int); +extern NCURSES_EXPORT(int) free_pair(int); +extern NCURSES_EXPORT(int) get_escdelay(void); +extern NCURSES_EXPORT(int) init_extended_color(int, int, int, int); +extern NCURSES_EXPORT(int) init_extended_pair(int, int, int); +extern NCURSES_EXPORT(int) key_defined(const char*); +extern NCURSES_EXPORT(int) keyok(int, bool); +extern NCURSES_EXPORT(void) reset_color_pairs(void); +extern NCURSES_EXPORT(int) resize_term(int, int); +extern NCURSES_EXPORT(int) resizeterm(int, int); +extern NCURSES_EXPORT(int) set_escdelay(int); +extern NCURSES_EXPORT(int) set_tabsize(int); +extern NCURSES_EXPORT(int) use_default_colors(void); +extern NCURSES_EXPORT(int) use_extended_names(bool); +extern NCURSES_EXPORT(int) use_legacy_coding(int); +extern NCURSES_EXPORT(int) use_screen(SCREEN*, NCURSES_SCREEN_CB, void*); +extern NCURSES_EXPORT(int) use_window(WINDOW*, NCURSES_WINDOW_CB, void*); +extern NCURSES_EXPORT(int) wresize(WINDOW*, int, int); +extern NCURSES_EXPORT(void) nofilter(void); + +/* + * These extensions provide access to information stored in the WINDOW even + * when NCURSES_OPAQUE is set: + */ +extern NCURSES_EXPORT(WINDOW*) wgetparent(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_cleared(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_idcok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_idlok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_immedok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_keypad(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_leaveok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_nodelay(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_notimeout(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_pad(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_scrollok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_subwin(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(bool) is_syncok(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) wgetdelay(const WINDOW*); /* generated */ +extern NCURSES_EXPORT(int) + wgetscrreg(const WINDOW*, int*, int*); /* generated */ + +#else +#define curses_version() NCURSES_VERSION +#endif + +/* + * Extra extension-functions, which pass a SCREEN pointer rather than using + * a global variable SP. + */ +#if 1 +#undef NCURSES_SP_FUNCS +#define NCURSES_SP_FUNCS 20180127 +#define NCURSES_SP_NAME(name) name##_sp + +/* Define the sp-funcs helper function */ +#define NCURSES_SP_OUTC NCURSES_SP_NAME(NCURSES_OUTC) +typedef int (*NCURSES_SP_OUTC)(SCREEN*, int); + +extern NCURSES_EXPORT(SCREEN*) new_prescr(void); /* implemented:SP_FUNC */ + +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(baudrate)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(beep)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(can_change_color)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(cbreak)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(curs_set)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(color_content)( + SCREEN*, + NCURSES_PAIRS_T, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(def_prog_mode)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(def_shell_mode)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(delay_output)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(doupdate)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(echo)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(endwin)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char) + NCURSES_SP_NAME(erasechar)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(filter)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(flash)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(flushinp)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW*) + NCURSES_SP_NAME(getwin)(SCREEN*, FILE*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(halfdelay)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(has_colors)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(has_ic)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(has_il)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_color)( + SCREEN*, + NCURSES_COLOR_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_pair)( + SCREEN*, + NCURSES_PAIRS_T, + NCURSES_COLOR_T, + NCURSES_COLOR_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + intrflush)(SCREEN*, WINDOW*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) + NCURSES_SP_NAME(isendwin)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(NCURSES_CONST char*) + NCURSES_SP_NAME(keyname)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char) + NCURSES_SP_NAME(killchar)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(longname)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + mvcur)(SCREEN*, int, int, int, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(napms)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW*) + NCURSES_SP_NAME(newpad)(SCREEN*, int, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(SCREEN*) NCURSES_SP_NAME(newterm)( + SCREEN*, + NCURSES_CONST char*, + FILE*, + FILE*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW*) NCURSES_SP_NAME( + newwin)(SCREEN*, int, int, int, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(nl)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(nocbreak)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(noecho)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(nonl)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(noqiflush)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(noraw)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(pair_content)( + SCREEN*, + NCURSES_PAIRS_T, + NCURSES_COLOR_T*, + NCURSES_COLOR_T*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(qiflush)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(raw)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(reset_prog_mode)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(reset_shell_mode)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(resetty)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + ripoffline)(SCREEN*, int, int (*)(WINDOW*, int)); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(savetty)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(scr_init)(SCREEN*, const char*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + scr_restore)(SCREEN*, const char*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(scr_set)(SCREEN*, const char*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_attroff)(SCREEN*, const chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_attron)(SCREEN*, const chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_attrset)(SCREEN*, const chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(attr_t) + NCURSES_SP_NAME(slk_attr)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attr_set)( + SCREEN*, + const attr_t, + NCURSES_PAIRS_T, + void*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_clear)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_color)(SCREEN*, NCURSES_PAIRS_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_init)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(slk_label)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_noutrefresh)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_refresh)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_restore)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + slk_set)(SCREEN*, int, const char*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(slk_touch)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(start_color)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(chtype) + NCURSES_SP_NAME(termattrs)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(termname)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(typeahead)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(ungetch)(SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(use_env)(SCREEN*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(use_tioctl)(SCREEN*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(vidattr)(SCREEN*, chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + vidputs)(SCREEN*, chtype, NCURSES_SP_OUTC); /* implemented:SP_FUNC */ +#if 1 +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(keybound)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + alloc_pair)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + assume_default_colors)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + define_key)(SCREEN*, const char*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_color_content)( + SCREEN*, + int, + int*, + int*, + int*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_pair_content)( + SCREEN*, + int, + int*, + int*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + extended_slk_color)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(get_escdelay)(SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(find_pair)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(free_pair)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_extended_color)( + SCREEN*, + int, + int, + int, + int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + init_extended_pair)(SCREEN*, int, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME( + is_term_resized)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + key_defined)(SCREEN*, const char*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(keyok)(SCREEN*, int, bool); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(nofilter)(SCREEN*); + /* implemented */ /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(void) + NCURSES_SP_NAME(reset_color_pairs)(SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + resize_term)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + resizeterm)(SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(set_escdelay)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(set_tabsize)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(use_default_colors)(SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + use_legacy_coding)(SCREEN*, int); /* implemented:EXT_SP_FUNC */ +#endif +#else +#undef NCURSES_SP_FUNCS +#define NCURSES_SP_FUNCS 0 +#define NCURSES_SP_NAME(name) name +#define NCURSES_SP_OUTC NCURSES_OUTC +#endif + +/* attributes */ + +#define NCURSES_ATTR_SHIFT 8 +#define NCURSES_BITS(mask, shift) \ + (NCURSES_CAST(chtype, (mask)) << ((shift) + NCURSES_ATTR_SHIFT)) + +#define A_NORMAL (1U - 1U) +#define A_ATTRIBUTES NCURSES_BITS(~(1U - 1U), 0) +#define A_CHARTEXT (NCURSES_BITS(1U, 0) - 1U) +#define A_COLOR NCURSES_BITS(((1U) << 8) - 1U, 0) +#define A_STANDOUT NCURSES_BITS(1U, 8) +#define A_UNDERLINE NCURSES_BITS(1U, 9) +#define A_REVERSE NCURSES_BITS(1U, 10) +#define A_BLINK NCURSES_BITS(1U, 11) +#define A_DIM NCURSES_BITS(1U, 12) +#define A_BOLD NCURSES_BITS(1U, 13) +#define A_ALTCHARSET NCURSES_BITS(1U, 14) +#define A_INVIS NCURSES_BITS(1U, 15) +#define A_PROTECT NCURSES_BITS(1U, 16) +#define A_HORIZONTAL NCURSES_BITS(1U, 17) +#define A_LEFT NCURSES_BITS(1U, 18) +#define A_LOW NCURSES_BITS(1U, 19) +#define A_RIGHT NCURSES_BITS(1U, 20) +#define A_TOP NCURSES_BITS(1U, 21) +#define A_VERTICAL NCURSES_BITS(1U, 22) + +#if 1 +#define A_ITALIC NCURSES_BITS(1U, 23) /* ncurses extension */ +#endif + +/* + * Most of the pseudo functions are macros that either provide compatibility + * with older versions of curses, or provide inline functionality to improve + * performance. + */ + +/* + * These pseudo functions are always implemented as macros: + */ + +#define getyx(win, y, x) (y = getcury(win), x = getcurx(win)) +#define getbegyx(win, y, x) (y = getbegy(win), x = getbegx(win)) +#define getmaxyx(win, y, x) (y = getmaxy(win), x = getmaxx(win)) +#define getparyx(win, y, x) (y = getpary(win), x = getparx(win)) + +#define getsyx(y, x) \ + do { \ + if (newscr) { \ + if (is_leaveok(newscr)) \ + (y) = (x) = -1; \ + else \ + getyx(newscr, (y), (x)); \ + } \ + } while (0) + +#define setsyx(y, x) \ + do { \ + if (newscr) { \ + if ((y) == -1 && (x) == -1) \ + leaveok(newscr, TRUE); \ + else { \ + leaveok(newscr, FALSE); \ + wmove(newscr, (y), (x)); \ + } \ + } \ + } while (0) + +#ifndef NCURSES_NOMACROS + +/* + * These miscellaneous pseudo functions are provided for compatibility: + */ + +#define wgetstr(w, s) wgetnstr(w, s, -1) +#define getnstr(s, n) wgetnstr(stdscr, s, (n)) + +#define setterm(term) setupterm(term, 1, (int*)0) + +#define fixterm() reset_prog_mode() +#define resetterm() reset_shell_mode() +#define saveterm() def_prog_mode() +#define crmode() cbreak() +#define nocrmode() nocbreak() +#define gettmode() + +/* It seems older SYSV curses versions define these */ +#if !NCURSES_OPAQUE +#define getattrs(win) \ + NCURSES_CAST(int, NCURSES_OK_ADDR(win) ? (win)->_attrs : A_NORMAL) +#define getcurx(win) (NCURSES_OK_ADDR(win) ? (win)->_curx : ERR) +#define getcury(win) (NCURSES_OK_ADDR(win) ? (win)->_cury : ERR) +#define getbegx(win) (NCURSES_OK_ADDR(win) ? (win)->_begx : ERR) +#define getbegy(win) (NCURSES_OK_ADDR(win) ? (win)->_begy : ERR) +#define getmaxx(win) (NCURSES_OK_ADDR(win) ? ((win)->_maxx + 1) : ERR) +#define getmaxy(win) (NCURSES_OK_ADDR(win) ? ((win)->_maxy + 1) : ERR) +#define getparx(win) (NCURSES_OK_ADDR(win) ? (win)->_parx : ERR) +#define getpary(win) (NCURSES_OK_ADDR(win) ? (win)->_pary : ERR) +#endif /* NCURSES_OPAQUE */ + +#define wstandout(win) (wattrset(win, A_STANDOUT)) +#define wstandend(win) (wattrset(win, A_NORMAL)) + +#define wattron(win, at) wattr_on(win, NCURSES_CAST(attr_t, at), NULL) +#define wattroff(win, at) wattr_off(win, NCURSES_CAST(attr_t, at), NULL) + +#if !NCURSES_OPAQUE +#if NCURSES_WATTR_MACROS +#if NCURSES_WIDECHAR && 1 +#define wattrset(win, at) \ + (NCURSES_OK_ADDR(win) ? ((win)->_color = NCURSES_CAST(int, PAIR_NUMBER(at)), \ + (win)->_attrs = NCURSES_CAST(attr_t, at), \ + OK) \ + : ERR) +#else +#define wattrset(win, at) \ + (NCURSES_OK_ADDR(win) ? ((win)->_attrs = NCURSES_CAST(attr_t, at), OK) : ERR) +#endif +#endif /* NCURSES_WATTR_MACROS */ +#endif /* NCURSES_OPAQUE */ + +#define scroll(win) wscrl(win, 1) + +#define touchwin(win) wtouchln((win), 0, getmaxy(win), 1) +#define touchline(win, s, c) wtouchln((win), s, c, 1) +#define untouchwin(win) wtouchln((win), 0, getmaxy(win), 0) + +#define box(win, v, h) wborder(win, v, v, h, h, 0, 0, 0, 0) +#define border(ls, rs, ts, bs, tl, tr, bl, br) \ + wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br) +#define hline(ch, n) whline(stdscr, ch, (n)) +#define vline(ch, n) wvline(stdscr, ch, (n)) + +#define winstr(w, s) winnstr(w, s, -1) +#define winchstr(w, s) winchnstr(w, s, -1) +#define winsstr(w, s) winsnstr(w, s, -1) + +#if !NCURSES_OPAQUE +#define redrawwin(win) \ + wredrawln(win, 0, (NCURSES_OK_ADDR(win) ? (win)->_maxy + 1 : -1)) +#endif /* NCURSES_OPAQUE */ + +#define waddstr(win, str) waddnstr(win, str, -1) +#define waddchstr(win, str) waddchnstr(win, str, -1) + +/* + * These apply to the first 256 color pairs. + */ +#define COLOR_PAIR(n) (NCURSES_BITS((n), 0) & A_COLOR) +#define PAIR_NUMBER(a) \ + (NCURSES_CAST( \ + int, \ + ((NCURSES_CAST(unsigned long, (a)) & A_COLOR) >> NCURSES_ATTR_SHIFT))) + +/* + * pseudo functions for standard screen + */ + +#define addch(ch) waddch(stdscr, (ch)) +#define addchnstr(str, n) waddchnstr(stdscr, (str), (n)) +#define addchstr(str) waddchstr(stdscr, (str)) +#define addnstr(str, n) waddnstr(stdscr, (str), (n)) +#define addstr(str) waddnstr(stdscr, (str), -1) +#define attr_get(ap, cp, o) wattr_get(stdscr, (ap), (cp), (o)) +#define attr_off(a, o) wattr_off(stdscr, (a), (o)) +#define attr_on(a, o) wattr_on(stdscr, (a), (o)) +#define attr_set(a, c, o) wattr_set(stdscr, (a), (c), (o)) +#define attroff(at) wattroff(stdscr, (at)) +#define attron(at) wattron(stdscr, (at)) +#define attrset(at) wattrset(stdscr, (at)) +#define bkgd(ch) wbkgd(stdscr, (ch)) +#define bkgdset(ch) wbkgdset(stdscr, (ch)) +#define chgat(n, a, c, o) wchgat(stdscr, (n), (a), (c), (o)) +#define clear() wclear(stdscr) +#define clrtobot() wclrtobot(stdscr) +#define clrtoeol() wclrtoeol(stdscr) +#define color_set(c, o) wcolor_set(stdscr, (c), (o)) +#define delch() wdelch(stdscr) +#define deleteln() winsdelln(stdscr, -1) +#define echochar(c) wechochar(stdscr, (c)) +#define erase() werase(stdscr) +#define getch() wgetch(stdscr) +#define getstr(str) wgetstr(stdscr, (str)) +#define inch() winch(stdscr) +#define inchnstr(s, n) winchnstr(stdscr, (s), (n)) +#define inchstr(s) winchstr(stdscr, (s)) +#define innstr(s, n) winnstr(stdscr, (s), (n)) +#define insch(c) winsch(stdscr, (c)) +#define insdelln(n) winsdelln(stdscr, (n)) +#define insertln() winsdelln(stdscr, 1) +#define insnstr(s, n) winsnstr(stdscr, (s), (n)) +#define insstr(s) winsstr(stdscr, (s)) +#define instr(s) winstr(stdscr, (s)) +#define move(y, x) wmove(stdscr, (y), (x)) +#define refresh() wrefresh(stdscr) +#define scrl(n) wscrl(stdscr, (n)) +#define setscrreg(t, b) wsetscrreg(stdscr, (t), (b)) +#define standend() wstandend(stdscr) +#define standout() wstandout(stdscr) +#define timeout(delay) wtimeout(stdscr, (delay)) +#define wdeleteln(win) winsdelln(win, -1) +#define winsertln(win) winsdelln(win, 1) + +/* + * mv functions + */ + +#define mvwaddch(win, y, x, ch) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddch((win), (ch))) +#define mvwaddchnstr(win, y, x, str, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddchnstr((win), (str), (n))) +#define mvwaddchstr(win, y, x, str) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddchnstr((win), (str), -1)) +#define mvwaddnstr(win, y, x, str, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddnstr((win), (str), (n))) +#define mvwaddstr(win, y, x, str) \ + (wmove((win), (y), (x)) == ERR ? ERR : waddnstr((win), (str), -1)) +#define mvwchgat(win, y, x, n, a, c, o) \ + (wmove((win), (y), (x)) == ERR ? ERR : wchgat((win), (n), (a), (c), (o))) +#define mvwdelch(win, y, x) (wmove((win), (y), (x)) == ERR ? ERR : wdelch(win)) +#define mvwgetch(win, y, x) (wmove((win), (y), (x)) == ERR ? ERR : wgetch(win)) +#define mvwgetnstr(win, y, x, str, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : wgetnstr((win), (str), (n))) +#define mvwgetstr(win, y, x, str) \ + (wmove((win), (y), (x)) == ERR ? ERR : wgetstr((win), (str))) +#define mvwhline(win, y, x, c, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : whline((win), (c), (n))) +#define mvwinch(win, y, x) \ + (wmove((win), (y), (x)) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win)) +#define mvwinchnstr(win, y, x, s, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : winchnstr((win), (s), (n))) +#define mvwinchstr(win, y, x, s) \ + (wmove((win), (y), (x)) == ERR ? ERR : winchstr((win), (s))) +#define mvwinnstr(win, y, x, s, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : winnstr((win), (s), (n))) +#define mvwinsch(win, y, x, c) \ + (wmove((win), (y), (x)) == ERR ? ERR : winsch((win), (c))) +#define mvwinsnstr(win, y, x, s, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : winsnstr((win), (s), (n))) +#define mvwinsstr(win, y, x, s) \ + (wmove((win), (y), (x)) == ERR ? ERR : winsstr((win), (s))) +#define mvwinstr(win, y, x, s) \ + (wmove((win), (y), (x)) == ERR ? ERR : winstr((win), (s))) +#define mvwvline(win, y, x, c, n) \ + (wmove((win), (y), (x)) == ERR ? ERR : wvline((win), (c), (n))) + +#define mvaddch(y, x, ch) mvwaddch(stdscr, (y), (x), (ch)) +#define mvaddchnstr(y, x, str, n) mvwaddchnstr(stdscr, (y), (x), (str), (n)) +#define mvaddchstr(y, x, str) mvwaddchstr(stdscr, (y), (x), (str)) +#define mvaddnstr(y, x, str, n) mvwaddnstr(stdscr, (y), (x), (str), (n)) +#define mvaddstr(y, x, str) mvwaddstr(stdscr, (y), (x), (str)) +#define mvchgat(y, x, n, a, c, o) mvwchgat(stdscr, (y), (x), (n), (a), (c), (o)) +#define mvdelch(y, x) mvwdelch(stdscr, (y), (x)) +#define mvgetch(y, x) mvwgetch(stdscr, (y), (x)) +#define mvgetnstr(y, x, str, n) mvwgetnstr(stdscr, (y), (x), (str), (n)) +#define mvgetstr(y, x, str) mvwgetstr(stdscr, (y), (x), (str)) +#define mvhline(y, x, c, n) mvwhline(stdscr, (y), (x), (c), (n)) +#define mvinch(y, x) mvwinch(stdscr, (y), (x)) +#define mvinchnstr(y, x, s, n) mvwinchnstr(stdscr, (y), (x), (s), (n)) +#define mvinchstr(y, x, s) mvwinchstr(stdscr, (y), (x), (s)) +#define mvinnstr(y, x, s, n) mvwinnstr(stdscr, (y), (x), (s), (n)) +#define mvinsch(y, x, c) mvwinsch(stdscr, (y), (x), (c)) +#define mvinsnstr(y, x, s, n) mvwinsnstr(stdscr, (y), (x), (s), (n)) +#define mvinsstr(y, x, s) mvwinsstr(stdscr, (y), (x), (s)) +#define mvinstr(y, x, s) mvwinstr(stdscr, (y), (x), (s)) +#define mvvline(y, x, c, n) mvwvline(stdscr, (y), (x), (c), (n)) + +/* + * Some wide-character functions can be implemented without the extensions. + */ +#if !NCURSES_OPAQUE +#define getbkgd(win) (NCURSES_OK_ADDR(win) ? ((win)->_bkgd) : 0) +#endif /* NCURSES_OPAQUE */ + +#define slk_attr_off(a, v) ((v) ? ERR : slk_attroff(a)) +#define slk_attr_on(a, v) ((v) ? ERR : slk_attron(a)) + +#if !NCURSES_OPAQUE +#if NCURSES_WATTR_MACROS +#if NCURSES_WIDECHAR && 1 +#define wattr_set(win, a, p, opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)((win)->_attrs = ((a) & ~A_COLOR), (win)->_color = (opts) ? *(int*)(opts) : (p)), \ + OK) \ + : ERR) +#define wattr_get(win, a, p, opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)(NCURSES_OK_ADDR(a) ? (*(a) = (win)->_attrs) : OK), \ + (void)(NCURSES_OK_ADDR(p) ? (*(p) = (NCURSES_PAIRS_T)(win)->_color) : OK), \ + (void)(NCURSES_OK_ADDR(opts) ? (*(int*)(opts) = (win)->_color) : OK), \ + OK) \ + : ERR) +#else /* !(NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */ +#define wattr_set(win, a, p, opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)((win)->_attrs = (((a) & ~A_COLOR) | (attr_t)COLOR_PAIR(p))), \ + OK) \ + : ERR) +#define wattr_get(win, a, p, opts) \ + (NCURSES_OK_ADDR(win) \ + ? ((void)(NCURSES_OK_ADDR(a) ? (*(a) = (win)->_attrs) : OK), \ + (void)(NCURSES_OK_ADDR(p) ? (*(p) = (NCURSES_PAIRS_T)PAIR_NUMBER((win)->_attrs)) : OK), \ + OK) \ + : ERR) +#endif /* (NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */ +#endif /* NCURSES_WATTR_MACROS */ +#endif /* NCURSES_OPAQUE */ + +/* + * X/Open curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use + * varargs.h. It adds new calls vw_printw/vw_scanw, which are supposed to + * use POSIX stdarg.h. The ncurses versions of vwprintw/vwscanw already + * use stdarg.h, so... + */ +#define vw_printw vwprintw +#define vw_scanw vwscanw + +/* + * Export fallback function for use in C++ binding. + */ +#if !1 +#define vsscanf(a, b, c) _nc_vsscanf(a, b, c) +NCURSES_EXPORT(int) vsscanf(const char*, const char*, va_list); +#endif + +/* + * These macros are extensions - not in X/Open Curses. + */ +#if 1 +#if !NCURSES_OPAQUE +#define is_cleared(win) (NCURSES_OK_ADDR(win) ? (win)->_clear : FALSE) +#define is_idcok(win) (NCURSES_OK_ADDR(win) ? (win)->_idcok : FALSE) +#define is_idlok(win) (NCURSES_OK_ADDR(win) ? (win)->_idlok : FALSE) +#define is_immedok(win) (NCURSES_OK_ADDR(win) ? (win)->_immed : FALSE) +#define is_keypad(win) (NCURSES_OK_ADDR(win) ? (win)->_use_keypad : FALSE) +#define is_leaveok(win) (NCURSES_OK_ADDR(win) ? (win)->_leaveok : FALSE) +#define is_nodelay(win) (NCURSES_OK_ADDR(win) ? ((win)->_delay == 0) : FALSE) +#define is_notimeout(win) (NCURSES_OK_ADDR(win) ? (win)->_notimeout : FALSE) +#define is_pad(win) \ + (NCURSES_OK_ADDR(win) ? ((win)->_flags & _ISPAD) != 0 : FALSE) +#define is_scrollok(win) (NCURSES_OK_ADDR(win) ? (win)->_scroll : FALSE) +#define is_subwin(win) \ + (NCURSES_OK_ADDR(win) ? ((win)->_flags & _SUBWIN) != 0 : FALSE) +#define is_syncok(win) (NCURSES_OK_ADDR(win) ? (win)->_sync : FALSE) +#define wgetdelay(win) (NCURSES_OK_ADDR(win) ? (win)->_delay : 0) +#define wgetparent(win) (NCURSES_OK_ADDR(win) ? (win)->_parent : 0) +#define wgetscrreg(win, t, b) \ + (NCURSES_OK_ADDR(win) \ + ? (*(t) = (win)->_regtop, *(b) = (win)->_regbottom, OK) \ + : ERR) +#endif +#endif + +#endif /* NCURSES_NOMACROS */ + +/* + * Public variables. + * + * Notes: + * a. ESCDELAY was an undocumented feature under AIX curses. + * It gives the ESC expire time in milliseconds. + * b. ttytype is needed for backward compatibility + */ +#if NCURSES_REENTRANT + +NCURSES_WRAPPED_VAR(WINDOW*, curscr); +NCURSES_WRAPPED_VAR(WINDOW*, newscr); +NCURSES_WRAPPED_VAR(WINDOW*, stdscr); +NCURSES_WRAPPED_VAR(char*, ttytype); +NCURSES_WRAPPED_VAR(int, COLORS); +NCURSES_WRAPPED_VAR(int, COLOR_PAIRS); +NCURSES_WRAPPED_VAR(int, COLS); +NCURSES_WRAPPED_VAR(int, ESCDELAY); +NCURSES_WRAPPED_VAR(int, LINES); +NCURSES_WRAPPED_VAR(int, TABSIZE); + +#define curscr NCURSES_PUBLIC_VAR(curscr()) +#define newscr NCURSES_PUBLIC_VAR(newscr()) +#define stdscr NCURSES_PUBLIC_VAR(stdscr()) +#define ttytype NCURSES_PUBLIC_VAR(ttytype()) +#define COLORS NCURSES_PUBLIC_VAR(COLORS()) +#define COLOR_PAIRS NCURSES_PUBLIC_VAR(COLOR_PAIRS()) +#define COLS NCURSES_PUBLIC_VAR(COLS()) +#define ESCDELAY NCURSES_PUBLIC_VAR(ESCDELAY()) +#define LINES NCURSES_PUBLIC_VAR(LINES()) +#define TABSIZE NCURSES_PUBLIC_VAR(TABSIZE()) + +#else + +extern NCURSES_EXPORT_VAR(WINDOW*) curscr; +extern NCURSES_EXPORT_VAR(WINDOW*) newscr; +extern NCURSES_EXPORT_VAR(WINDOW*) stdscr; +extern NCURSES_EXPORT_VAR(char) ttytype[]; +extern NCURSES_EXPORT_VAR(int) COLORS; +extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS; +extern NCURSES_EXPORT_VAR(int) COLS; +extern NCURSES_EXPORT_VAR(int) ESCDELAY; +extern NCURSES_EXPORT_VAR(int) LINES; +extern NCURSES_EXPORT_VAR(int) TABSIZE; + +#endif + +/* + * Pseudo-character tokens outside ASCII range. The curses wgetch() function + * will return any given one of these only if the corresponding k- capability + * is defined in your terminal's terminfo entry. + * + * Some keys (KEY_A1, etc) are arranged like this: + * a1 up a3 + * left b2 right + * c1 down c3 + * + * A few key codes do not depend upon the terminfo entry. + */ +#define KEY_CODE_YES 0400 /* A wchar_t contains a key code */ +#define KEY_MIN 0401 /* Minimum curses key */ +#define KEY_BREAK 0401 /* Break key (unreliable) */ +#define KEY_SRESET 0530 /* Soft (partial) reset (unreliable) */ +#define KEY_RESET 0531 /* Reset or hard reset (unreliable) */ +/* + * These definitions were generated by ./MKkey_defs.sh ./Caps + */ +#define KEY_DOWN 0402 /* down-arrow key */ +#define KEY_UP 0403 /* up-arrow key */ +#define KEY_LEFT 0404 /* left-arrow key */ +#define KEY_RIGHT 0405 /* right-arrow key */ +#define KEY_HOME 0406 /* home key */ +#define KEY_BACKSPACE 0407 /* backspace key */ +#define KEY_F0 0410 /* Function keys. Space for 64 */ +#define KEY_F(n) (KEY_F0 + (n)) /* Value of function key n */ +#define KEY_DL 0510 /* delete-line key */ +#define KEY_IL 0511 /* insert-line key */ +#define KEY_DC 0512 /* delete-character key */ +#define KEY_IC 0513 /* insert-character key */ +#define KEY_EIC 0514 /* sent by rmir or smir in insert mode */ +#define KEY_CLEAR 0515 /* clear-screen or erase key */ +#define KEY_EOS 0516 /* clear-to-end-of-screen key */ +#define KEY_EOL 0517 /* clear-to-end-of-line key */ +#define KEY_SF 0520 /* scroll-forward key */ +#define KEY_SR 0521 /* scroll-backward key */ +#define KEY_NPAGE 0522 /* next-page key */ +#define KEY_PPAGE 0523 /* previous-page key */ +#define KEY_STAB 0524 /* set-tab key */ +#define KEY_CTAB 0525 /* clear-tab key */ +#define KEY_CATAB 0526 /* clear-all-tabs key */ +#define KEY_ENTER 0527 /* enter/send key */ +#define KEY_PRINT 0532 /* print key */ +#define KEY_LL 0533 /* lower-left key (home down) */ +#define KEY_A1 0534 /* upper left of keypad */ +#define KEY_A3 0535 /* upper right of keypad */ +#define KEY_B2 0536 /* center of keypad */ +#define KEY_C1 0537 /* lower left of keypad */ +#define KEY_C3 0540 /* lower right of keypad */ +#define KEY_BTAB 0541 /* back-tab key */ +#define KEY_BEG 0542 /* begin key */ +#define KEY_CANCEL 0543 /* cancel key */ +#define KEY_CLOSE 0544 /* close key */ +#define KEY_COMMAND 0545 /* command key */ +#define KEY_COPY 0546 /* copy key */ +#define KEY_CREATE 0547 /* create key */ +#define KEY_END 0550 /* end key */ +#define KEY_EXIT 0551 /* exit key */ +#define KEY_FIND 0552 /* find key */ +#define KEY_HELP 0553 /* help key */ +#define KEY_MARK 0554 /* mark key */ +#define KEY_MESSAGE 0555 /* message key */ +#define KEY_MOVE 0556 /* move key */ +#define KEY_NEXT 0557 /* next key */ +#define KEY_OPEN 0560 /* open key */ +#define KEY_OPTIONS 0561 /* options key */ +#define KEY_PREVIOUS 0562 /* previous key */ +#define KEY_REDO 0563 /* redo key */ +#define KEY_REFERENCE 0564 /* reference key */ +#define KEY_REFRESH 0565 /* refresh key */ +#define KEY_REPLACE 0566 /* replace key */ +#define KEY_RESTART 0567 /* restart key */ +#define KEY_RESUME 0570 /* resume key */ +#define KEY_SAVE 0571 /* save key */ +#define KEY_SBEG 0572 /* shifted begin key */ +#define KEY_SCANCEL 0573 /* shifted cancel key */ +#define KEY_SCOMMAND 0574 /* shifted command key */ +#define KEY_SCOPY 0575 /* shifted copy key */ +#define KEY_SCREATE 0576 /* shifted create key */ +#define KEY_SDC 0577 /* shifted delete-character key */ +#define KEY_SDL 0600 /* shifted delete-line key */ +#define KEY_SELECT 0601 /* select key */ +#define KEY_SEND 0602 /* shifted end key */ +#define KEY_SEOL 0603 /* shifted clear-to-end-of-line key */ +#define KEY_SEXIT 0604 /* shifted exit key */ +#define KEY_SFIND 0605 /* shifted find key */ +#define KEY_SHELP 0606 /* shifted help key */ +#define KEY_SHOME 0607 /* shifted home key */ +#define KEY_SIC 0610 /* shifted insert-character key */ +#define KEY_SLEFT 0611 /* shifted left-arrow key */ +#define KEY_SMESSAGE 0612 /* shifted message key */ +#define KEY_SMOVE 0613 /* shifted move key */ +#define KEY_SNEXT 0614 /* shifted next key */ +#define KEY_SOPTIONS 0615 /* shifted options key */ +#define KEY_SPREVIOUS 0616 /* shifted previous key */ +#define KEY_SPRINT 0617 /* shifted print key */ +#define KEY_SREDO 0620 /* shifted redo key */ +#define KEY_SREPLACE 0621 /* shifted replace key */ +#define KEY_SRIGHT 0622 /* shifted right-arrow key */ +#define KEY_SRSUME 0623 /* shifted resume key */ +#define KEY_SSAVE 0624 /* shifted save key */ +#define KEY_SSUSPEND 0625 /* shifted suspend key */ +#define KEY_SUNDO 0626 /* shifted undo key */ +#define KEY_SUSPEND 0627 /* suspend key */ +#define KEY_UNDO 0630 /* undo key */ +#define KEY_MOUSE 0631 /* Mouse event has occurred */ +#define KEY_RESIZE 0632 /* Terminal resize event */ +#define KEY_EVENT 0633 /* We were interrupted by an event */ + +#define KEY_MAX 0777 /* Maximum key value is 0633 */ +/* $Id: curses.wide,v 1.50 2017/03/26 16:05:21 tom Exp $ */ +/* + * vile:cmode: + * This file is part of ncurses, designed to be appended after curses.h.in + * (see that file for the relevant copyright). + */ +#define _XOPEN_CURSES 1 + +#if NCURSES_WIDECHAR + +extern NCURSES_EXPORT_VAR(cchar_t*) _nc_wacs; + +#define NCURSES_WACS(c) (&_nc_wacs[NCURSES_CAST(unsigned char, (c))]) + +#define WACS_BSSB NCURSES_WACS('l') +#define WACS_SSBB NCURSES_WACS('m') +#define WACS_BBSS NCURSES_WACS('k') +#define WACS_SBBS NCURSES_WACS('j') +#define WACS_SBSS NCURSES_WACS('u') +#define WACS_SSSB NCURSES_WACS('t') +#define WACS_SSBS NCURSES_WACS('v') +#define WACS_BSSS NCURSES_WACS('w') +#define WACS_BSBS NCURSES_WACS('q') +#define WACS_SBSB NCURSES_WACS('x') +#define WACS_SSSS NCURSES_WACS('n') + +#define WACS_ULCORNER WACS_BSSB +#define WACS_LLCORNER WACS_SSBB +#define WACS_URCORNER WACS_BBSS +#define WACS_LRCORNER WACS_SBBS +#define WACS_RTEE WACS_SBSS +#define WACS_LTEE WACS_SSSB +#define WACS_BTEE WACS_SSBS +#define WACS_TTEE WACS_BSSS +#define WACS_HLINE WACS_BSBS +#define WACS_VLINE WACS_SBSB +#define WACS_PLUS WACS_SSSS + +#define WACS_S1 NCURSES_WACS('o') /* scan line 1 */ +#define WACS_S9 NCURSES_WACS('s') /* scan line 9 */ +#define WACS_DIAMOND NCURSES_WACS('`') /* diamond */ +#define WACS_CKBOARD NCURSES_WACS('a') /* checker board */ +#define WACS_DEGREE NCURSES_WACS('f') /* degree symbol */ +#define WACS_PLMINUS NCURSES_WACS('g') /* plus/minus */ +#define WACS_BULLET NCURSES_WACS('~') /* bullet */ + +/* Teletype 5410v1 symbols */ +#define WACS_LARROW NCURSES_WACS(',') /* arrow left */ +#define WACS_RARROW NCURSES_WACS('+') /* arrow right */ +#define WACS_DARROW NCURSES_WACS('.') /* arrow down */ +#define WACS_UARROW NCURSES_WACS('-') /* arrow up */ +#define WACS_BOARD NCURSES_WACS('h') /* board of squares */ +#define WACS_LANTERN NCURSES_WACS('i') /* lantern symbol */ +#define WACS_BLOCK NCURSES_WACS('0') /* solid square block */ + +/* ncurses extensions */ +#define WACS_S3 NCURSES_WACS('p') /* scan line 3 */ +#define WACS_S7 NCURSES_WACS('r') /* scan line 7 */ +#define WACS_LEQUAL NCURSES_WACS('y') /* less/equal */ +#define WACS_GEQUAL NCURSES_WACS('z') /* greater/equal */ +#define WACS_PI NCURSES_WACS('{') /* Pi */ +#define WACS_NEQUAL NCURSES_WACS('|') /* not equal */ +#define WACS_STERLING NCURSES_WACS('}') /* UK pound sign */ + +/* double lines */ +#define WACS_BDDB NCURSES_WACS('C') +#define WACS_DDBB NCURSES_WACS('D') +#define WACS_BBDD NCURSES_WACS('B') +#define WACS_DBBD NCURSES_WACS('A') +#define WACS_DBDD NCURSES_WACS('G') +#define WACS_DDDB NCURSES_WACS('F') +#define WACS_DDBD NCURSES_WACS('H') +#define WACS_BDDD NCURSES_WACS('I') +#define WACS_BDBD NCURSES_WACS('R') +#define WACS_DBDB NCURSES_WACS('Y') +#define WACS_DDDD NCURSES_WACS('E') + +#define WACS_D_ULCORNER WACS_BDDB +#define WACS_D_LLCORNER WACS_DDBB +#define WACS_D_URCORNER WACS_BBDD +#define WACS_D_LRCORNER WACS_DBBD +#define WACS_D_RTEE WACS_DBDD +#define WACS_D_LTEE WACS_DDDB +#define WACS_D_BTEE WACS_DDBD +#define WACS_D_TTEE WACS_BDDD +#define WACS_D_HLINE WACS_BDBD +#define WACS_D_VLINE WACS_DBDB +#define WACS_D_PLUS WACS_DDDD + +/* thick lines */ +#define WACS_BTTB NCURSES_WACS('L') +#define WACS_TTBB NCURSES_WACS('M') +#define WACS_BBTT NCURSES_WACS('K') +#define WACS_TBBT NCURSES_WACS('J') +#define WACS_TBTT NCURSES_WACS('U') +#define WACS_TTTB NCURSES_WACS('T') +#define WACS_TTBT NCURSES_WACS('V') +#define WACS_BTTT NCURSES_WACS('W') +#define WACS_BTBT NCURSES_WACS('Q') +#define WACS_TBTB NCURSES_WACS('X') +#define WACS_TTTT NCURSES_WACS('N') + +#define WACS_T_ULCORNER WACS_BTTB +#define WACS_T_LLCORNER WACS_TTBB +#define WACS_T_URCORNER WACS_BBTT +#define WACS_T_LRCORNER WACS_TBBT +#define WACS_T_RTEE WACS_TBTT +#define WACS_T_LTEE WACS_TTTB +#define WACS_T_BTEE WACS_TTBT +#define WACS_T_TTEE WACS_BTTT +#define WACS_T_HLINE WACS_BTBT +#define WACS_T_VLINE WACS_TBTB +#define WACS_T_PLUS WACS_TTTT + +/* + * Function prototypes for wide-character operations. + * + * "generated" comments should include ":WIDEC" to make the corresponding + * functions ifdef'd in lib_gen.c + * + * "implemented" comments do not need this marker. + */ + +extern NCURSES_EXPORT(int) add_wch(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + add_wchnstr(const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) add_wchstr(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) addnwstr(const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) addwstr(const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) bkgrnd(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(void) bkgrndset(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) border_set( + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + box_set(WINDOW*, const cchar_t*, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) echo_wchar(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) erasewchar(wchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) get_wch(wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) get_wstr(wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) getbkgrnd(cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) getcchar( + const cchar_t*, + wchar_t*, + attr_t*, + NCURSES_PAIRS_T*, + void*); /* implemented */ +extern NCURSES_EXPORT(int) getn_wstr(wint_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) hline_set(const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) in_wch(cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) in_wchnstr(cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) in_wchstr(cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) innwstr(wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) ins_nwstr(const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) ins_wch(const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) ins_wstr(const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) inwstr(wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(NCURSES_CONST char*) key_name(wchar_t); /* implemented */ +extern NCURSES_EXPORT(int) killwchar(wchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + mvadd_wch(int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvadd_wchnstr(int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvadd_wchstr(int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvaddnwstr(int, int, const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvaddwstr(int, int, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvget_wch(int, int, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvget_wstr(int, int, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvgetn_wstr(int, int, wint_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvhline_set(int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvin_wch(int, int, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvin_wchnstr(int, int, cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvin_wchstr(int, int, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvinnwstr(int, int, wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvins_nwstr(int, int, const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvins_wch(int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvins_wstr(int, int, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvinwstr(int, int, wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvvline_set(int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwadd_wch(WINDOW*, int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) mvwadd_wchnstr( + WINDOW*, + int, + int, + const cchar_t*, + int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwadd_wchstr(WINDOW*, int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwaddnwstr(WINDOW*, int, int, const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwaddwstr(WINDOW*, int, int, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwget_wch(WINDOW*, int, int, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwget_wstr(WINDOW*, int, int, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwgetn_wstr(WINDOW*, int, int, wint_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwhline_set(WINDOW*, int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwin_wch(WINDOW*, int, int, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwin_wchnstr(WINDOW*, int, int, cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwin_wchstr(WINDOW*, int, int, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwinnwstr(WINDOW*, int, int, wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwins_nwstr(WINDOW*, int, int, const wchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwins_wch(WINDOW*, int, int, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwins_wstr(WINDOW*, int, int, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwinwstr(WINDOW*, int, int, wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + mvwvline_set(WINDOW*, int, int, const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + pecho_wchar(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) setcchar( + cchar_t*, + const wchar_t*, + const attr_t, + NCURSES_PAIRS_T, + const void*); /* implemented */ +extern NCURSES_EXPORT(int) slk_wset(int, const wchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(attr_t) term_attrs(void); /* implemented */ +extern NCURSES_EXPORT(int) unget_wch(const wchar_t); /* implemented */ +extern NCURSES_EXPORT(int) + vid_attr(attr_t, NCURSES_PAIRS_T, void*); /* implemented */ +extern NCURSES_EXPORT(int) + vid_puts(attr_t, NCURSES_PAIRS_T, void*, NCURSES_OUTC); /* implemented */ +extern NCURSES_EXPORT(int) vline_set(const cchar_t*, int); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wadd_wch(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + wadd_wchnstr(WINDOW*, const cchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) + wadd_wchstr(WINDOW*, const cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) + waddnwstr(WINDOW*, const wchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) + waddwstr(WINDOW*, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wbkgrnd(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(void) + wbkgrndset(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) wborder_set( + WINDOW*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*, + const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + wecho_wchar(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) wget_wch(WINDOW*, wint_t*); /* implemented */ +extern NCURSES_EXPORT(int) wget_wstr(WINDOW*, wint_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wgetbkgrnd(WINDOW*, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) wgetn_wstr(WINDOW*, wint_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) + whline_set(WINDOW*, const cchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) win_wch(WINDOW*, cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + win_wchnstr(WINDOW*, cchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) win_wchstr(WINDOW*, cchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) winnwstr(WINDOW*, wchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) + wins_nwstr(WINDOW*, const wchar_t*, int); /* implemented */ +extern NCURSES_EXPORT(int) wins_wch(WINDOW*, const cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + wins_wstr(WINDOW*, const wchar_t*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) winwstr(WINDOW*, wchar_t*); /* implemented */ +extern NCURSES_EXPORT(wchar_t*) wunctrl(cchar_t*); /* implemented */ +extern NCURSES_EXPORT(int) + wvline_set(WINDOW*, const cchar_t*, int); /* implemented */ + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(attr_t) + NCURSES_SP_NAME(term_attrs)(SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME( + unget_wch)(SCREEN*, const wchar_t); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(wchar_t*) + NCURSES_SP_NAME(wunctrl)(SCREEN*, cchar_t*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_attr)( + SCREEN*, + attr_t, + NCURSES_PAIRS_T, + void*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts)( + SCREEN*, + attr_t, + NCURSES_PAIRS_T, + void*, + NCURSES_SP_OUTC); /* implemented:SP_FUNC */ +#endif + +#ifndef NCURSES_NOMACROS + +/* + * XSI curses macros for XPG4 conformance. + */ +#define add_wch(c) wadd_wch(stdscr, (c)) +#define add_wchnstr(str, n) wadd_wchnstr(stdscr, (str), (n)) +#define add_wchstr(str) wadd_wchstr(stdscr, (str)) +#define addnwstr(wstr, n) waddnwstr(stdscr, (wstr), (n)) +#define addwstr(wstr) waddwstr(stdscr, (wstr)) +#define bkgrnd(c) wbkgrnd(stdscr, (c)) +#define bkgrndset(c) wbkgrndset(stdscr, (c)) +#define border_set(l, r, t, b, tl, tr, bl, br) \ + wborder_set(stdscr, (l), (r), (t), (b), tl, tr, bl, br) +#define box_set(w, v, h) wborder_set((w), (v), (v), (h), (h), 0, 0, 0, 0) +#define echo_wchar(c) wecho_wchar(stdscr, (c)) +#define get_wch(c) wget_wch(stdscr, (c)) +#define get_wstr(t) wget_wstr(stdscr, (t)) +#define getbkgrnd(wch) wgetbkgrnd(stdscr, (wch)) +#define getn_wstr(t, n) wgetn_wstr(stdscr, (t), (n)) +#define hline_set(c, n) whline_set(stdscr, (c), (n)) +#define in_wch(c) win_wch(stdscr, (c)) +#define in_wchnstr(c, n) win_wchnstr(stdscr, (c), (n)) +#define in_wchstr(c) win_wchstr(stdscr, (c)) +#define innwstr(c, n) winnwstr(stdscr, (c), (n)) +#define ins_nwstr(t, n) wins_nwstr(stdscr, (t), (n)) +#define ins_wch(c) wins_wch(stdscr, (c)) +#define ins_wstr(t) wins_wstr(stdscr, (t)) +#define inwstr(c) winwstr(stdscr, (c)) +#define vline_set(c, n) wvline_set(stdscr, (c), (n)) +#define wadd_wchstr(win, str) wadd_wchnstr((win), (str), -1) +#define waddwstr(win, wstr) waddnwstr((win), (wstr), -1) +#define wget_wstr(w, t) wgetn_wstr((w), (t), -1) +#define win_wchstr(w, c) win_wchnstr((w), (c), -1) +#define wins_wstr(w, t) wins_nwstr((w), (t), -1) + +#if !NCURSES_OPAQUE +#define wgetbkgrnd(win, wch) \ + (NCURSES_OK_ADDR(wch) ? ((win) ? (*(wch) = (win)->_bkgrnd) : *(wch), OK) \ + : ERR) +#endif + +#define mvadd_wch(y, x, c) mvwadd_wch(stdscr, (y), (x), (c)) +#define mvadd_wchnstr(y, x, s, n) mvwadd_wchnstr(stdscr, (y), (x), (s), (n)) +#define mvadd_wchstr(y, x, s) mvwadd_wchstr(stdscr, (y), (x), (s)) +#define mvaddnwstr(y, x, wstr, n) mvwaddnwstr(stdscr, (y), (x), (wstr), (n)) +#define mvaddwstr(y, x, wstr) mvwaddwstr(stdscr, (y), (x), (wstr)) +#define mvget_wch(y, x, c) mvwget_wch(stdscr, (y), (x), (c)) +#define mvget_wstr(y, x, t) mvwget_wstr(stdscr, (y), (x), (t)) +#define mvgetn_wstr(y, x, t, n) mvwgetn_wstr(stdscr, (y), (x), (t), (n)) +#define mvhline_set(y, x, c, n) mvwhline_set(stdscr, (y), (x), (c), (n)) +#define mvin_wch(y, x, c) mvwin_wch(stdscr, (y), (x), (c)) +#define mvin_wchnstr(y, x, c, n) mvwin_wchnstr(stdscr, (y), (x), (c), (n)) +#define mvin_wchstr(y, x, c) mvwin_wchstr(stdscr, (y), (x), (c)) +#define mvinnwstr(y, x, c, n) mvwinnwstr(stdscr, (y), (x), (c), (n)) +#define mvins_nwstr(y, x, t, n) mvwins_nwstr(stdscr, (y), (x), (t), (n)) +#define mvins_wch(y, x, c) mvwins_wch(stdscr, (y), (x), (c)) +#define mvins_wstr(y, x, t) mvwins_wstr(stdscr, (y), (x), (t)) +#define mvinwstr(y, x, c) mvwinwstr(stdscr, (y), (x), (c)) +#define mvvline_set(y, x, c, n) mvwvline_set(stdscr, (y), (x), (c), (n)) + +#define mvwadd_wch(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : wadd_wch((win), (c))) +#define mvwadd_wchnstr(win, y, x, s, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : wadd_wchnstr((win), (s), (n))) +#define mvwadd_wchstr(win, y, x, s) \ + (wmove(win, (y), (x)) == ERR ? ERR : wadd_wchstr((win), (s))) +#define mvwaddnwstr(win, y, x, wstr, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : waddnwstr((win), (wstr), (n))) +#define mvwaddwstr(win, y, x, wstr) \ + (wmove(win, (y), (x)) == ERR ? ERR : waddwstr((win), (wstr))) +#define mvwget_wch(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : wget_wch((win), (c))) +#define mvwget_wstr(win, y, x, t) \ + (wmove(win, (y), (x)) == ERR ? ERR : wget_wstr((win), (t))) +#define mvwgetn_wstr(win, y, x, t, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : wgetn_wstr((win), (t), (n))) +#define mvwhline_set(win, y, x, c, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : whline_set((win), (c), (n))) +#define mvwin_wch(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : win_wch((win), (c))) +#define mvwin_wchnstr(win, y, x, c, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : win_wchnstr((win), (c), (n))) +#define mvwin_wchstr(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : win_wchstr((win), (c))) +#define mvwinnwstr(win, y, x, c, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : winnwstr((win), (c), (n))) +#define mvwins_nwstr(win, y, x, t, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : wins_nwstr((win), (t), (n))) +#define mvwins_wch(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : wins_wch((win), (c))) +#define mvwins_wstr(win, y, x, t) \ + (wmove(win, (y), (x)) == ERR ? ERR : wins_wstr((win), (t))) +#define mvwinwstr(win, y, x, c) \ + (wmove(win, (y), (x)) == ERR ? ERR : winwstr((win), (c))) +#define mvwvline_set(win, y, x, c, n) \ + (wmove(win, (y), (x)) == ERR ? ERR : wvline_set((win), (c), (n))) + +#endif /* NCURSES_NOMACROS */ + +#if defined(TRACE) || defined(NCURSES_TEST) +extern NCURSES_EXPORT(const char*) _nc_viswbuf(const wchar_t*); +extern NCURSES_EXPORT(const char*) _nc_viswibuf(const wint_t*); +#endif + +#endif /* NCURSES_WIDECHAR */ +/* $Id: curses.tail,v 1.23 2016/02/13 16:37:45 tom Exp $ */ +/* + * vile:cmode: + * This file is part of ncurses, designed to be appended after curses.h.in + * (see that file for the relevant copyright). + */ + +/* mouse interface */ + +#if NCURSES_MOUSE_VERSION > 1 +#define NCURSES_MOUSE_MASK(b, m) ((m) << (((b)-1) * 5)) +#else +#define NCURSES_MOUSE_MASK(b, m) ((m) << (((b)-1) * 6)) +#endif + +#define NCURSES_BUTTON_RELEASED 001L +#define NCURSES_BUTTON_PRESSED 002L +#define NCURSES_BUTTON_CLICKED 004L +#define NCURSES_DOUBLE_CLICKED 010L +#define NCURSES_TRIPLE_CLICKED 020L +#define NCURSES_RESERVED_EVENT 040L + +/* event masks */ +#define BUTTON1_RELEASED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED) +#define BUTTON1_PRESSED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED) +#define BUTTON1_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED) +#define BUTTON1_DOUBLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED) +#define BUTTON1_TRIPLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED) + +#define BUTTON2_RELEASED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED) +#define BUTTON2_PRESSED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED) +#define BUTTON2_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED) +#define BUTTON2_DOUBLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED) +#define BUTTON2_TRIPLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED) + +#define BUTTON3_RELEASED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED) +#define BUTTON3_PRESSED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED) +#define BUTTON3_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED) +#define BUTTON3_DOUBLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED) +#define BUTTON3_TRIPLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED) + +#define BUTTON4_RELEASED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED) +#define BUTTON4_PRESSED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED) +#define BUTTON4_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED) +#define BUTTON4_DOUBLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED) +#define BUTTON4_TRIPLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED) + +/* + * In 32 bits the version-1 scheme does not provide enough space for a 5th + * button, unless we choose to change the ABI by omitting the reserved-events. + */ +#if NCURSES_MOUSE_VERSION > 1 + +#define BUTTON5_RELEASED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED) +#define BUTTON5_PRESSED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED) +#define BUTTON5_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED) +#define BUTTON5_DOUBLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED) +#define BUTTON5_TRIPLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED) + +#define BUTTON_CTRL NCURSES_MOUSE_MASK(6, 0001L) +#define BUTTON_SHIFT NCURSES_MOUSE_MASK(6, 0002L) +#define BUTTON_ALT NCURSES_MOUSE_MASK(6, 0004L) +#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(6, 0010L) + +#else + +#define BUTTON1_RESERVED_EVENT NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT) +#define BUTTON2_RESERVED_EVENT NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT) +#define BUTTON3_RESERVED_EVENT NCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT) +#define BUTTON4_RESERVED_EVENT NCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT) + +#define BUTTON_CTRL NCURSES_MOUSE_MASK(5, 0001L) +#define BUTTON_SHIFT NCURSES_MOUSE_MASK(5, 0002L) +#define BUTTON_ALT NCURSES_MOUSE_MASK(5, 0004L) +#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(5, 0010L) + +#endif + +#define ALL_MOUSE_EVENTS (REPORT_MOUSE_POSITION - 1) + +/* macros to extract single event-bits from masks */ +#define BUTTON_RELEASE(e, x) ((e)&NCURSES_MOUSE_MASK(x, 001)) +#define BUTTON_PRESS(e, x) ((e)&NCURSES_MOUSE_MASK(x, 002)) +#define BUTTON_CLICK(e, x) ((e)&NCURSES_MOUSE_MASK(x, 004)) +#define BUTTON_DOUBLE_CLICK(e, x) ((e)&NCURSES_MOUSE_MASK(x, 010)) +#define BUTTON_TRIPLE_CLICK(e, x) ((e)&NCURSES_MOUSE_MASK(x, 020)) +#define BUTTON_RESERVED_EVENT(e, x) ((e)&NCURSES_MOUSE_MASK(x, 040)) + +typedef struct { + short id; /* ID to distinguish multiple devices */ + int x, y, z; /* event coordinates (character-cell) */ + mmask_t bstate; /* button state bits */ +} MEVENT; + +extern NCURSES_EXPORT(bool) has_mouse(void); +extern NCURSES_EXPORT(int) getmouse(MEVENT*); +extern NCURSES_EXPORT(int) ungetmouse(MEVENT*); +extern NCURSES_EXPORT(mmask_t) mousemask(mmask_t, mmask_t*); +extern NCURSES_EXPORT(bool) wenclose(const WINDOW*, int, int); +extern NCURSES_EXPORT(int) mouseinterval(int); +extern NCURSES_EXPORT(bool) wmouse_trafo(const WINDOW*, int*, int*, bool); +extern NCURSES_EXPORT(bool) mouse_trafo(int*, int*, bool); /* generated */ + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_mouse)(SCREEN*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(getmouse)(SCREEN*, MEVENT*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetmouse)(SCREEN*, MEVENT*); +extern NCURSES_EXPORT(mmask_t) + NCURSES_SP_NAME(mousemask)(SCREEN*, mmask_t, mmask_t*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mouseinterval)(SCREEN*, int); +#endif + +#ifndef NCURSES_NOMACROS +#define mouse_trafo(y, x, to_screen) wmouse_trafo(stdscr, y, x, to_screen) +#endif + +/* other non-XSI functions */ + +extern NCURSES_EXPORT(int) mcprint(char*, int); /* direct data to printer */ +extern NCURSES_EXPORT(int) has_key(int); /* do we have given key? */ + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(has_key)(SCREEN*, int); /* do we have given key? */ +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(mcprint)(SCREEN*, char*, int); /* direct data to printer */ +#endif + +/* Debugging : use with libncurses_g.a */ + +extern NCURSES_EXPORT(void) _tracef(const char*, ...) GCC_PRINTFLIKE(1, 2); +extern NCURSES_EXPORT(char*) _traceattr(attr_t); +extern NCURSES_EXPORT(char*) _traceattr2(int, chtype); +extern NCURSES_EXPORT(char*) _tracechar(int); +extern NCURSES_EXPORT(char*) _tracechtype(chtype); +extern NCURSES_EXPORT(char*) _tracechtype2(int, chtype); +#if NCURSES_WIDECHAR +#define _tracech_t _tracecchar_t +extern NCURSES_EXPORT(char*) _tracecchar_t(const cchar_t*); +#define _tracech_t2 _tracecchar_t2 +extern NCURSES_EXPORT(char*) _tracecchar_t2(int, const cchar_t*); +#else +#define _tracech_t _tracechtype +#define _tracech_t2 _tracechtype2 +#endif +extern NCURSES_EXPORT(void) trace(const unsigned int); + +/* trace masks */ +#define TRACE_DISABLE 0x0000 /* turn off tracing */ +#define TRACE_TIMES 0x0001 /* trace user and system times of updates */ +#define TRACE_TPUTS 0x0002 /* trace tputs calls */ +#define TRACE_UPDATE 0x0004 /* trace update actions, old & new screens */ +#define TRACE_MOVE 0x0008 /* trace cursor moves and scrolls */ +#define TRACE_CHARPUT 0x0010 /* trace all character outputs */ +#define TRACE_ORDINARY 0x001F /* trace all update actions */ +#define TRACE_CALLS 0x0020 /* trace all curses calls */ +#define TRACE_VIRTPUT 0x0040 /* trace virtual character puts */ +#define TRACE_IEVENT 0x0080 /* trace low-level input processing */ +#define TRACE_BITS 0x0100 /* trace state of TTY control bits */ +#define TRACE_ICALLS 0x0200 /* trace internal/nested calls */ +#define TRACE_CCALLS 0x0400 /* trace per-character calls */ +#define TRACE_DATABASE 0x0800 /* trace read/write of terminfo/termcap data */ +#define TRACE_ATTRS 0x1000 /* trace attribute updates */ + +#define TRACE_SHIFT 13 /* number of bits in the trace masks */ +#define TRACE_MAXIMUM ((1 << TRACE_SHIFT) - 1) /* maximum trace level */ + +#if defined(TRACE) || defined(NCURSES_TEST) +extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable; /* enable optimizations */ +extern NCURSES_EXPORT(const char*) _nc_visbuf(const char*); +#define OPTIMIZE_MVCUR 0x01 /* cursor movement optimization */ +#define OPTIMIZE_HASHMAP 0x02 /* diff hashing to detect scrolls */ +#define OPTIMIZE_SCROLL 0x04 /* scroll optimization */ +#define OPTIMIZE_ALL 0xff /* enable all optimizations (dflt) */ +#endif + +#include + +#ifdef __cplusplus + +#ifndef NCURSES_NOMACROS + +/* these names conflict with STL */ +#undef box +#undef clear +#undef erase +#undef move +#undef refresh + +#endif /* NCURSES_NOMACROS */ +} +#endif + +#endif /* __NCURSES_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/ncurses_dll.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/ncurses_dll.h new file mode 100644 index 0000000..240f606 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/ncurses_dll.h @@ -0,0 +1,103 @@ +/**************************************************************************** + * Copyright (c) 1998-2009,2014 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ +/* $Id: ncurses_dll.h.in,v 1.9 2014/08/02 21:30:20 tom Exp $ */ + +#ifndef NCURSES_DLL_H_incl +#define NCURSES_DLL_H_incl 1 + +/* 2014-08-02 workaround for broken MinGW compiler. + * Oddly, only TRACE is mapped to trace - the other -D's are okay. + * suggest TDM as an alternative. + */ +#if defined(__MINGW64__) +#elif defined(__MINGW32__) +#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) + +#ifdef trace +#undef trace +#define TRACE +#endif + +#endif /* broken compiler */ +#endif /* MingW */ + +/* + * For reentrant code, we map the various global variables into SCREEN by + * using functions to access them. + */ +#define NCURSES_PUBLIC_VAR(name) _nc_##name +#define NCURSES_WRAPPED_VAR(type, name) \ + extern type NCURSES_PUBLIC_VAR(name)(void) + +/* no longer needed on cygwin or mingw, thanks to auto-import */ +/* but this structure may be useful at some point for an MSVC build */ +/* so, for now unconditionally define the important flags */ +/* "the right way" for proper static and dll+auto-import behavior */ +#undef NCURSES_DLL +#define NCURSES_STATIC + +#if defined(__CYGWIN__) || defined(__MINGW32__) +#if defined(NCURSES_DLL) +#if defined(NCURSES_STATIC) +#undef NCURSES_STATIC +#endif +#endif +#undef NCURSES_IMPEXP +#undef NCURSES_API +#undef NCURSES_EXPORT +#undef NCURSES_EXPORT_VAR +#if defined(NCURSES_DLL) +/* building a DLL */ +#define NCURSES_IMPEXP __declspec(dllexport) +#elif defined(NCURSES_STATIC) +/* building or linking to a static library */ +#define NCURSES_IMPEXP /* nothing */ +#else +/* linking to the DLL */ +#define NCURSES_IMPEXP __declspec(dllimport) +#endif +#define NCURSES_API __cdecl +#define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API +#define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type +#endif + +/* Take care of non-cygwin platforms */ +#if !defined(NCURSES_IMPEXP) +#define NCURSES_IMPEXP /* nothing */ +#endif +#if !defined(NCURSES_API) +#define NCURSES_API /* nothing */ +#endif +#if !defined(NCURSES_EXPORT) +#define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API +#endif +#if !defined(NCURSES_EXPORT_VAR) +#define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type +#endif + +#endif /* NCURSES_DLL_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/panel.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/panel.h new file mode 100644 index 0000000..104d587 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/panel.h @@ -0,0 +1,88 @@ +/**************************************************************************** + * Copyright (c) 1998-2009,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1995 * + * and: Eric S. Raymond * + * and: Juergen Pfeifer 1996-1999,2008 * + ****************************************************************************/ + +/* $Id: panel.h,v 1.12 2017/02/11 16:50:28 tom Exp $ */ + +/* panel.h -- interface file for panels library */ + +#ifndef NCURSES_PANEL_H_incl +#define NCURSES_PANEL_H_incl 1 + +#include + +typedef struct panel +#if !NCURSES_OPAQUE_PANEL +{ + WINDOW* win; + struct panel* below; + struct panel* above; + NCURSES_CONST void* user; +} +#endif /* !NCURSES_OPAQUE_PANEL */ +PANEL; + +#if defined(__cplusplus) +extern "C" { +#endif + +extern NCURSES_EXPORT(WINDOW*) panel_window(const PANEL*); +extern NCURSES_EXPORT(void) update_panels(void); +extern NCURSES_EXPORT(int) hide_panel(PANEL*); +extern NCURSES_EXPORT(int) show_panel(PANEL*); +extern NCURSES_EXPORT(int) del_panel(PANEL*); +extern NCURSES_EXPORT(int) top_panel(PANEL*); +extern NCURSES_EXPORT(int) bottom_panel(PANEL*); +extern NCURSES_EXPORT(PANEL*) new_panel(WINDOW*); +extern NCURSES_EXPORT(PANEL*) panel_above(const PANEL*); +extern NCURSES_EXPORT(PANEL*) panel_below(const PANEL*); +extern NCURSES_EXPORT(int) set_panel_userptr(PANEL*, NCURSES_CONST void*); +extern NCURSES_EXPORT(NCURSES_CONST void*) panel_userptr(const PANEL*); +extern NCURSES_EXPORT(int) move_panel(PANEL*, int, int); +extern NCURSES_EXPORT(int) replace_panel(PANEL*, WINDOW*); +extern NCURSES_EXPORT(int) panel_hidden(const PANEL*); + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(PANEL*) ground_panel(SCREEN*); +extern NCURSES_EXPORT(PANEL*) ceiling_panel(SCREEN*); + +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(update_panels)(SCREEN*); +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /* NCURSES_PANEL_H_incl */ + +/* end of panel.h */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/term.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/term.h new file mode 100644 index 0000000..79b83db --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/term.h @@ -0,0 +1,886 @@ +/**************************************************************************** + * Copyright (c) 1998-2013,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/****************************************************************************/ +/* Author: Zeyd M. Ben-Halim 1992,1995 */ +/* and: Eric S. Raymond */ +/* and: Thomas E. Dickey 1995-on */ +/****************************************************************************/ + +/* $Id: MKterm.h.awk.in,v 1.67 2017/04/06 00:19:26 tom Exp $ */ + +/* +** term.h -- Definition of struct term +*/ + +#ifndef NCURSES_TERM_H_incl +#define NCURSES_TERM_H_incl 1 + +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.1" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H + * definition (based on the system for which this was configured). + */ + +#undef NCURSES_CONST +#define NCURSES_CONST const + +#undef NCURSES_SBOOL +#define NCURSES_SBOOL char + +#undef NCURSES_USE_DATABASE +#define NCURSES_USE_DATABASE 1 + +#undef NCURSES_USE_TERMCAP +#define NCURSES_USE_TERMCAP 1 + +#undef NCURSES_XNAMES +#define NCURSES_XNAMES 1 + +/* We will use these symbols to hide differences between + * termios/termio/sgttyb interfaces. + */ +#undef TTY +#undef SET_TTY +#undef GET_TTY + +/* Assume POSIX termio if we have the header and function */ +/* #if HAVE_TERMIOS_H && HAVE_TCGETATTR */ +#if 1 && 1 + +#undef TERMIOS +#define TERMIOS 1 + +#include +#define TTY struct termios + +#else /* !HAVE_TERMIOS_H */ + +/* #if HAVE_TERMIO_H */ +#if 1 + +#undef TERMIOS +#define TERMIOS 1 + +#include +#define TTY struct termio + +#else /* !HAVE_TERMIO_H */ + +#if __MINGW32__ +#include +#define TTY struct termios +#else +#undef TERMIOS +#include +#include +#define TTY struct sgttyb +#endif /* MINGW32 */ +#endif /* HAVE_TERMIO_H */ + +#endif /* HAVE_TERMIOS_H */ + +#ifdef TERMIOS +#define GET_TTY(fd, buf) tcgetattr(fd, buf) +#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf) +#else +#define GET_TTY(fd, buf) gtty(fd, buf) +#define SET_TTY(fd, buf) stty(fd, buf) +#endif + +#define NAMESIZE 256 + +/* The cast works because TERMTYPE is the first data in TERMINAL */ +#define CUR ((TERMTYPE*)(cur_term))-> + +#define auto_left_margin CUR Booleans[0] +#define auto_right_margin CUR Booleans[1] +#define no_esc_ctlc CUR Booleans[2] +#define ceol_standout_glitch CUR Booleans[3] +#define eat_newline_glitch CUR Booleans[4] +#define erase_overstrike CUR Booleans[5] +#define generic_type CUR Booleans[6] +#define hard_copy CUR Booleans[7] +#define has_meta_key CUR Booleans[8] +#define has_status_line CUR Booleans[9] +#define insert_null_glitch CUR Booleans[10] +#define memory_above CUR Booleans[11] +#define memory_below CUR Booleans[12] +#define move_insert_mode CUR Booleans[13] +#define move_standout_mode CUR Booleans[14] +#define over_strike CUR Booleans[15] +#define status_line_esc_ok CUR Booleans[16] +#define dest_tabs_magic_smso CUR Booleans[17] +#define tilde_glitch CUR Booleans[18] +#define transparent_underline CUR Booleans[19] +#define xon_xoff CUR Booleans[20] +#define needs_xon_xoff CUR Booleans[21] +#define prtr_silent CUR Booleans[22] +#define hard_cursor CUR Booleans[23] +#define non_rev_rmcup CUR Booleans[24] +#define no_pad_char CUR Booleans[25] +#define non_dest_scroll_region CUR Booleans[26] +#define can_change CUR Booleans[27] +#define back_color_erase CUR Booleans[28] +#define hue_lightness_saturation CUR Booleans[29] +#define col_addr_glitch CUR Booleans[30] +#define cr_cancels_micro_mode CUR Booleans[31] +#define has_print_wheel CUR Booleans[32] +#define row_addr_glitch CUR Booleans[33] +#define semi_auto_right_margin CUR Booleans[34] +#define cpi_changes_res CUR Booleans[35] +#define lpi_changes_res CUR Booleans[36] +#define columns CUR Numbers[0] +#define init_tabs CUR Numbers[1] +#define lines CUR Numbers[2] +#define lines_of_memory CUR Numbers[3] +#define magic_cookie_glitch CUR Numbers[4] +#define padding_baud_rate CUR Numbers[5] +#define virtual_terminal CUR Numbers[6] +#define width_status_line CUR Numbers[7] +#define num_labels CUR Numbers[8] +#define label_height CUR Numbers[9] +#define label_width CUR Numbers[10] +#define max_attributes CUR Numbers[11] +#define maximum_windows CUR Numbers[12] +#define max_colors CUR Numbers[13] +#define max_pairs CUR Numbers[14] +#define no_color_video CUR Numbers[15] +#define buffer_capacity CUR Numbers[16] +#define dot_vert_spacing CUR Numbers[17] +#define dot_horz_spacing CUR Numbers[18] +#define max_micro_address CUR Numbers[19] +#define max_micro_jump CUR Numbers[20] +#define micro_col_size CUR Numbers[21] +#define micro_line_size CUR Numbers[22] +#define number_of_pins CUR Numbers[23] +#define output_res_char CUR Numbers[24] +#define output_res_line CUR Numbers[25] +#define output_res_horz_inch CUR Numbers[26] +#define output_res_vert_inch CUR Numbers[27] +#define print_rate CUR Numbers[28] +#define wide_char_size CUR Numbers[29] +#define buttons CUR Numbers[30] +#define bit_image_entwining CUR Numbers[31] +#define bit_image_type CUR Numbers[32] +#define back_tab CUR Strings[0] +#define bell CUR Strings[1] +#define carriage_return CUR Strings[2] +#define change_scroll_region CUR Strings[3] +#define clear_all_tabs CUR Strings[4] +#define clear_screen CUR Strings[5] +#define clr_eol CUR Strings[6] +#define clr_eos CUR Strings[7] +#define column_address CUR Strings[8] +#define command_character CUR Strings[9] +#define cursor_address CUR Strings[10] +#define cursor_down CUR Strings[11] +#define cursor_home CUR Strings[12] +#define cursor_invisible CUR Strings[13] +#define cursor_left CUR Strings[14] +#define cursor_mem_address CUR Strings[15] +#define cursor_normal CUR Strings[16] +#define cursor_right CUR Strings[17] +#define cursor_to_ll CUR Strings[18] +#define cursor_up CUR Strings[19] +#define cursor_visible CUR Strings[20] +#define delete_character CUR Strings[21] +#define delete_line CUR Strings[22] +#define dis_status_line CUR Strings[23] +#define down_half_line CUR Strings[24] +#define enter_alt_charset_mode CUR Strings[25] +#define enter_blink_mode CUR Strings[26] +#define enter_bold_mode CUR Strings[27] +#define enter_ca_mode CUR Strings[28] +#define enter_delete_mode CUR Strings[29] +#define enter_dim_mode CUR Strings[30] +#define enter_insert_mode CUR Strings[31] +#define enter_secure_mode CUR Strings[32] +#define enter_protected_mode CUR Strings[33] +#define enter_reverse_mode CUR Strings[34] +#define enter_standout_mode CUR Strings[35] +#define enter_underline_mode CUR Strings[36] +#define erase_chars CUR Strings[37] +#define exit_alt_charset_mode CUR Strings[38] +#define exit_attribute_mode CUR Strings[39] +#define exit_ca_mode CUR Strings[40] +#define exit_delete_mode CUR Strings[41] +#define exit_insert_mode CUR Strings[42] +#define exit_standout_mode CUR Strings[43] +#define exit_underline_mode CUR Strings[44] +#define flash_screen CUR Strings[45] +#define form_feed CUR Strings[46] +#define from_status_line CUR Strings[47] +#define init_1string CUR Strings[48] +#define init_2string CUR Strings[49] +#define init_3string CUR Strings[50] +#define init_file CUR Strings[51] +#define insert_character CUR Strings[52] +#define insert_line CUR Strings[53] +#define insert_padding CUR Strings[54] +#define key_backspace CUR Strings[55] +#define key_catab CUR Strings[56] +#define key_clear CUR Strings[57] +#define key_ctab CUR Strings[58] +#define key_dc CUR Strings[59] +#define key_dl CUR Strings[60] +#define key_down CUR Strings[61] +#define key_eic CUR Strings[62] +#define key_eol CUR Strings[63] +#define key_eos CUR Strings[64] +#define key_f0 CUR Strings[65] +#define key_f1 CUR Strings[66] +#define key_f10 CUR Strings[67] +#define key_f2 CUR Strings[68] +#define key_f3 CUR Strings[69] +#define key_f4 CUR Strings[70] +#define key_f5 CUR Strings[71] +#define key_f6 CUR Strings[72] +#define key_f7 CUR Strings[73] +#define key_f8 CUR Strings[74] +#define key_f9 CUR Strings[75] +#define key_home CUR Strings[76] +#define key_ic CUR Strings[77] +#define key_il CUR Strings[78] +#define key_left CUR Strings[79] +#define key_ll CUR Strings[80] +#define key_npage CUR Strings[81] +#define key_ppage CUR Strings[82] +#define key_right CUR Strings[83] +#define key_sf CUR Strings[84] +#define key_sr CUR Strings[85] +#define key_stab CUR Strings[86] +#define key_up CUR Strings[87] +#define keypad_local CUR Strings[88] +#define keypad_xmit CUR Strings[89] +#define lab_f0 CUR Strings[90] +#define lab_f1 CUR Strings[91] +#define lab_f10 CUR Strings[92] +#define lab_f2 CUR Strings[93] +#define lab_f3 CUR Strings[94] +#define lab_f4 CUR Strings[95] +#define lab_f5 CUR Strings[96] +#define lab_f6 CUR Strings[97] +#define lab_f7 CUR Strings[98] +#define lab_f8 CUR Strings[99] +#define lab_f9 CUR Strings[100] +#define meta_off CUR Strings[101] +#define meta_on CUR Strings[102] +#define newline CUR Strings[103] +#define pad_char CUR Strings[104] +#define parm_dch CUR Strings[105] +#define parm_delete_line CUR Strings[106] +#define parm_down_cursor CUR Strings[107] +#define parm_ich CUR Strings[108] +#define parm_index CUR Strings[109] +#define parm_insert_line CUR Strings[110] +#define parm_left_cursor CUR Strings[111] +#define parm_right_cursor CUR Strings[112] +#define parm_rindex CUR Strings[113] +#define parm_up_cursor CUR Strings[114] +#define pkey_key CUR Strings[115] +#define pkey_local CUR Strings[116] +#define pkey_xmit CUR Strings[117] +#define print_screen CUR Strings[118] +#define prtr_off CUR Strings[119] +#define prtr_on CUR Strings[120] +#define repeat_char CUR Strings[121] +#define reset_1string CUR Strings[122] +#define reset_2string CUR Strings[123] +#define reset_3string CUR Strings[124] +#define reset_file CUR Strings[125] +#define restore_cursor CUR Strings[126] +#define row_address CUR Strings[127] +#define save_cursor CUR Strings[128] +#define scroll_forward CUR Strings[129] +#define scroll_reverse CUR Strings[130] +#define set_attributes CUR Strings[131] +#define set_tab CUR Strings[132] +#define set_window CUR Strings[133] +#define tab CUR Strings[134] +#define to_status_line CUR Strings[135] +#define underline_char CUR Strings[136] +#define up_half_line CUR Strings[137] +#define init_prog CUR Strings[138] +#define key_a1 CUR Strings[139] +#define key_a3 CUR Strings[140] +#define key_b2 CUR Strings[141] +#define key_c1 CUR Strings[142] +#define key_c3 CUR Strings[143] +#define prtr_non CUR Strings[144] +#define char_padding CUR Strings[145] +#define acs_chars CUR Strings[146] +#define plab_norm CUR Strings[147] +#define key_btab CUR Strings[148] +#define enter_xon_mode CUR Strings[149] +#define exit_xon_mode CUR Strings[150] +#define enter_am_mode CUR Strings[151] +#define exit_am_mode CUR Strings[152] +#define xon_character CUR Strings[153] +#define xoff_character CUR Strings[154] +#define ena_acs CUR Strings[155] +#define label_on CUR Strings[156] +#define label_off CUR Strings[157] +#define key_beg CUR Strings[158] +#define key_cancel CUR Strings[159] +#define key_close CUR Strings[160] +#define key_command CUR Strings[161] +#define key_copy CUR Strings[162] +#define key_create CUR Strings[163] +#define key_end CUR Strings[164] +#define key_enter CUR Strings[165] +#define key_exit CUR Strings[166] +#define key_find CUR Strings[167] +#define key_help CUR Strings[168] +#define key_mark CUR Strings[169] +#define key_message CUR Strings[170] +#define key_move CUR Strings[171] +#define key_next CUR Strings[172] +#define key_open CUR Strings[173] +#define key_options CUR Strings[174] +#define key_previous CUR Strings[175] +#define key_print CUR Strings[176] +#define key_redo CUR Strings[177] +#define key_reference CUR Strings[178] +#define key_refresh CUR Strings[179] +#define key_replace CUR Strings[180] +#define key_restart CUR Strings[181] +#define key_resume CUR Strings[182] +#define key_save CUR Strings[183] +#define key_suspend CUR Strings[184] +#define key_undo CUR Strings[185] +#define key_sbeg CUR Strings[186] +#define key_scancel CUR Strings[187] +#define key_scommand CUR Strings[188] +#define key_scopy CUR Strings[189] +#define key_screate CUR Strings[190] +#define key_sdc CUR Strings[191] +#define key_sdl CUR Strings[192] +#define key_select CUR Strings[193] +#define key_send CUR Strings[194] +#define key_seol CUR Strings[195] +#define key_sexit CUR Strings[196] +#define key_sfind CUR Strings[197] +#define key_shelp CUR Strings[198] +#define key_shome CUR Strings[199] +#define key_sic CUR Strings[200] +#define key_sleft CUR Strings[201] +#define key_smessage CUR Strings[202] +#define key_smove CUR Strings[203] +#define key_snext CUR Strings[204] +#define key_soptions CUR Strings[205] +#define key_sprevious CUR Strings[206] +#define key_sprint CUR Strings[207] +#define key_sredo CUR Strings[208] +#define key_sreplace CUR Strings[209] +#define key_sright CUR Strings[210] +#define key_srsume CUR Strings[211] +#define key_ssave CUR Strings[212] +#define key_ssuspend CUR Strings[213] +#define key_sundo CUR Strings[214] +#define req_for_input CUR Strings[215] +#define key_f11 CUR Strings[216] +#define key_f12 CUR Strings[217] +#define key_f13 CUR Strings[218] +#define key_f14 CUR Strings[219] +#define key_f15 CUR Strings[220] +#define key_f16 CUR Strings[221] +#define key_f17 CUR Strings[222] +#define key_f18 CUR Strings[223] +#define key_f19 CUR Strings[224] +#define key_f20 CUR Strings[225] +#define key_f21 CUR Strings[226] +#define key_f22 CUR Strings[227] +#define key_f23 CUR Strings[228] +#define key_f24 CUR Strings[229] +#define key_f25 CUR Strings[230] +#define key_f26 CUR Strings[231] +#define key_f27 CUR Strings[232] +#define key_f28 CUR Strings[233] +#define key_f29 CUR Strings[234] +#define key_f30 CUR Strings[235] +#define key_f31 CUR Strings[236] +#define key_f32 CUR Strings[237] +#define key_f33 CUR Strings[238] +#define key_f34 CUR Strings[239] +#define key_f35 CUR Strings[240] +#define key_f36 CUR Strings[241] +#define key_f37 CUR Strings[242] +#define key_f38 CUR Strings[243] +#define key_f39 CUR Strings[244] +#define key_f40 CUR Strings[245] +#define key_f41 CUR Strings[246] +#define key_f42 CUR Strings[247] +#define key_f43 CUR Strings[248] +#define key_f44 CUR Strings[249] +#define key_f45 CUR Strings[250] +#define key_f46 CUR Strings[251] +#define key_f47 CUR Strings[252] +#define key_f48 CUR Strings[253] +#define key_f49 CUR Strings[254] +#define key_f50 CUR Strings[255] +#define key_f51 CUR Strings[256] +#define key_f52 CUR Strings[257] +#define key_f53 CUR Strings[258] +#define key_f54 CUR Strings[259] +#define key_f55 CUR Strings[260] +#define key_f56 CUR Strings[261] +#define key_f57 CUR Strings[262] +#define key_f58 CUR Strings[263] +#define key_f59 CUR Strings[264] +#define key_f60 CUR Strings[265] +#define key_f61 CUR Strings[266] +#define key_f62 CUR Strings[267] +#define key_f63 CUR Strings[268] +#define clr_bol CUR Strings[269] +#define clear_margins CUR Strings[270] +#define set_left_margin CUR Strings[271] +#define set_right_margin CUR Strings[272] +#define label_format CUR Strings[273] +#define set_clock CUR Strings[274] +#define display_clock CUR Strings[275] +#define remove_clock CUR Strings[276] +#define create_window CUR Strings[277] +#define goto_window CUR Strings[278] +#define hangup CUR Strings[279] +#define dial_phone CUR Strings[280] +#define quick_dial CUR Strings[281] +#define tone CUR Strings[282] +#define pulse CUR Strings[283] +#define flash_hook CUR Strings[284] +#define fixed_pause CUR Strings[285] +#define wait_tone CUR Strings[286] +#define user0 CUR Strings[287] +#define user1 CUR Strings[288] +#define user2 CUR Strings[289] +#define user3 CUR Strings[290] +#define user4 CUR Strings[291] +#define user5 CUR Strings[292] +#define user6 CUR Strings[293] +#define user7 CUR Strings[294] +#define user8 CUR Strings[295] +#define user9 CUR Strings[296] +#define orig_pair CUR Strings[297] +#define orig_colors CUR Strings[298] +#define initialize_color CUR Strings[299] +#define initialize_pair CUR Strings[300] +#define set_color_pair CUR Strings[301] +#define set_foreground CUR Strings[302] +#define set_background CUR Strings[303] +#define change_char_pitch CUR Strings[304] +#define change_line_pitch CUR Strings[305] +#define change_res_horz CUR Strings[306] +#define change_res_vert CUR Strings[307] +#define define_char CUR Strings[308] +#define enter_doublewide_mode CUR Strings[309] +#define enter_draft_quality CUR Strings[310] +#define enter_italics_mode CUR Strings[311] +#define enter_leftward_mode CUR Strings[312] +#define enter_micro_mode CUR Strings[313] +#define enter_near_letter_quality CUR Strings[314] +#define enter_normal_quality CUR Strings[315] +#define enter_shadow_mode CUR Strings[316] +#define enter_subscript_mode CUR Strings[317] +#define enter_superscript_mode CUR Strings[318] +#define enter_upward_mode CUR Strings[319] +#define exit_doublewide_mode CUR Strings[320] +#define exit_italics_mode CUR Strings[321] +#define exit_leftward_mode CUR Strings[322] +#define exit_micro_mode CUR Strings[323] +#define exit_shadow_mode CUR Strings[324] +#define exit_subscript_mode CUR Strings[325] +#define exit_superscript_mode CUR Strings[326] +#define exit_upward_mode CUR Strings[327] +#define micro_column_address CUR Strings[328] +#define micro_down CUR Strings[329] +#define micro_left CUR Strings[330] +#define micro_right CUR Strings[331] +#define micro_row_address CUR Strings[332] +#define micro_up CUR Strings[333] +#define order_of_pins CUR Strings[334] +#define parm_down_micro CUR Strings[335] +#define parm_left_micro CUR Strings[336] +#define parm_right_micro CUR Strings[337] +#define parm_up_micro CUR Strings[338] +#define select_char_set CUR Strings[339] +#define set_bottom_margin CUR Strings[340] +#define set_bottom_margin_parm CUR Strings[341] +#define set_left_margin_parm CUR Strings[342] +#define set_right_margin_parm CUR Strings[343] +#define set_top_margin CUR Strings[344] +#define set_top_margin_parm CUR Strings[345] +#define start_bit_image CUR Strings[346] +#define start_char_set_def CUR Strings[347] +#define stop_bit_image CUR Strings[348] +#define stop_char_set_def CUR Strings[349] +#define subscript_characters CUR Strings[350] +#define superscript_characters CUR Strings[351] +#define these_cause_cr CUR Strings[352] +#define zero_motion CUR Strings[353] +#define char_set_names CUR Strings[354] +#define key_mouse CUR Strings[355] +#define mouse_info CUR Strings[356] +#define req_mouse_pos CUR Strings[357] +#define get_mouse CUR Strings[358] +#define set_a_foreground CUR Strings[359] +#define set_a_background CUR Strings[360] +#define pkey_plab CUR Strings[361] +#define device_type CUR Strings[362] +#define code_set_init CUR Strings[363] +#define set0_des_seq CUR Strings[364] +#define set1_des_seq CUR Strings[365] +#define set2_des_seq CUR Strings[366] +#define set3_des_seq CUR Strings[367] +#define set_lr_margin CUR Strings[368] +#define set_tb_margin CUR Strings[369] +#define bit_image_repeat CUR Strings[370] +#define bit_image_newline CUR Strings[371] +#define bit_image_carriage_return CUR Strings[372] +#define color_names CUR Strings[373] +#define define_bit_image_region CUR Strings[374] +#define end_bit_image_region CUR Strings[375] +#define set_color_band CUR Strings[376] +#define set_page_length CUR Strings[377] +#define display_pc_char CUR Strings[378] +#define enter_pc_charset_mode CUR Strings[379] +#define exit_pc_charset_mode CUR Strings[380] +#define enter_scancode_mode CUR Strings[381] +#define exit_scancode_mode CUR Strings[382] +#define pc_term_options CUR Strings[383] +#define scancode_escape CUR Strings[384] +#define alt_scancode_esc CUR Strings[385] +#define enter_horizontal_hl_mode CUR Strings[386] +#define enter_left_hl_mode CUR Strings[387] +#define enter_low_hl_mode CUR Strings[388] +#define enter_right_hl_mode CUR Strings[389] +#define enter_top_hl_mode CUR Strings[390] +#define enter_vertical_hl_mode CUR Strings[391] +#define set_a_attributes CUR Strings[392] +#define set_pglen_inch CUR Strings[393] + +#define BOOLWRITE 37 +#define NUMWRITE 33 +#define STRWRITE 394 + +/* older synonyms for some capabilities */ +#define beehive_glitch no_esc_ctlc +#define teleray_glitch dest_tabs_magic_smso +#define micro_char_size micro_col_size + +#ifdef __INTERNAL_CAPS_VISIBLE +#define termcap_init2 CUR Strings[394] +#define termcap_reset CUR Strings[395] +#define magic_cookie_glitch_ul CUR Numbers[33] +#define backspaces_with_bs CUR Booleans[37] +#define crt_no_scrolling CUR Booleans[38] +#define no_correctly_working_cr CUR Booleans[39] +#define carriage_return_delay CUR Numbers[34] +#define new_line_delay CUR Numbers[35] +#define linefeed_if_not_lf CUR Strings[396] +#define backspace_if_not_bs CUR Strings[397] +#define gnu_has_meta_key CUR Booleans[40] +#define linefeed_is_newline CUR Booleans[41] +#define backspace_delay CUR Numbers[36] +#define horizontal_tab_delay CUR Numbers[37] +#define number_of_function_keys CUR Numbers[38] +#define other_non_function_keys CUR Strings[398] +#define arrow_key_map CUR Strings[399] +#define has_hardware_tabs CUR Booleans[42] +#define return_does_clr_eol CUR Booleans[43] +#define acs_ulcorner CUR Strings[400] +#define acs_llcorner CUR Strings[401] +#define acs_urcorner CUR Strings[402] +#define acs_lrcorner CUR Strings[403] +#define acs_ltee CUR Strings[404] +#define acs_rtee CUR Strings[405] +#define acs_btee CUR Strings[406] +#define acs_ttee CUR Strings[407] +#define acs_hline CUR Strings[408] +#define acs_vline CUR Strings[409] +#define acs_plus CUR Strings[410] +#define memory_lock CUR Strings[411] +#define memory_unlock CUR Strings[412] +#define box_chars_1 CUR Strings[413] +#endif /* __INTERNAL_CAPS_VISIBLE */ + +/* + * Predefined terminfo array sizes + */ +#define BOOLCOUNT 44 +#define NUMCOUNT 39 +#define STRCOUNT 414 + +/* used by code for comparing entries */ +#define acs_chars_index 146 + +typedef struct termtype { /* in-core form of terminfo data */ + char* term_names; /* str_table offset of term names */ + char* str_table; /* pointer to string table */ + NCURSES_SBOOL* Booleans; /* array of boolean values */ + short* Numbers; /* array of integer values */ + char** Strings; /* array of string offsets */ + +#if NCURSES_XNAMES + char* ext_str_table; /* pointer to extended string table */ + char** ext_Names; /* corresponding names */ + + unsigned short num_Booleans; /* count total Booleans */ + unsigned short num_Numbers; /* count total Numbers */ + unsigned short num_Strings; /* count total Strings */ + + unsigned short ext_Booleans; /* count extensions to Booleans */ + unsigned short ext_Numbers; /* count extensions to Numbers */ + unsigned short ext_Strings; /* count extensions to Strings */ +#endif /* NCURSES_XNAMES */ + +} TERMTYPE; + +/* + * The only reason these structures are visible is for read-only use. + * Programs which modify the data are not, never were, portable across + * curses implementations. + */ +#ifdef NCURSES_INTERNALS + +typedef struct termtype2 { /* in-core form of terminfo data */ + char* term_names; /* str_table offset of term names */ + char* str_table; /* pointer to string table */ + NCURSES_SBOOL* Booleans; /* array of boolean values */ + int* Numbers; /* array of integer values */ + char** Strings; /* array of string offsets */ + +#if NCURSES_XNAMES + char* ext_str_table; /* pointer to extended string table */ + char** ext_Names; /* corresponding names */ + + unsigned short num_Booleans; /* count total Booleans */ + unsigned short num_Numbers; /* count total Numbers */ + unsigned short num_Strings; /* count total Strings */ + + unsigned short ext_Booleans; /* count extensions to Booleans */ + unsigned short ext_Numbers; /* count extensions to Numbers */ + unsigned short ext_Strings; /* count extensions to Strings */ +#endif /* NCURSES_XNAMES */ + +} TERMTYPE2; + +typedef struct term { /* describe an actual terminal */ + TERMTYPE type; /* terminal type description */ + short Filedes; /* file description being written to */ + TTY Ottyb; /* original state of the terminal */ + TTY Nttyb; /* current state of the terminal */ + int _baudrate; /* used to compute padding */ + char* _termname; /* used for termname() */ + TERMTYPE2 type2; /* extended terminal type description */ +} TERMINAL; +#else +typedef struct term TERMINAL; +#endif /* NCURSES_INTERNALS */ + +#if 0 && !0 +extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term; +#elif 0 +NCURSES_WRAPPED_VAR(TERMINAL*, cur_term); +#define cur_term NCURSES_PUBLIC_VAR(cur_term()) +#else +extern NCURSES_EXPORT_VAR(TERMINAL*) cur_term; +#endif + +#if 0 || 0 +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolcodes); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolfnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numcodes); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numfnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strcodes); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strfnames); + +#define boolnames NCURSES_PUBLIC_VAR(boolnames()) +#define boolcodes NCURSES_PUBLIC_VAR(boolcodes()) +#define boolfnames NCURSES_PUBLIC_VAR(boolfnames()) +#define numnames NCURSES_PUBLIC_VAR(numnames()) +#define numcodes NCURSES_PUBLIC_VAR(numcodes()) +#define numfnames NCURSES_PUBLIC_VAR(numfnames()) +#define strnames NCURSES_PUBLIC_VAR(strnames()) +#define strcodes NCURSES_PUBLIC_VAR(strcodes()) +#define strfnames NCURSES_PUBLIC_VAR(strfnames()) + +#else + +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) boolnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) boolcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) boolfnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) numnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) numcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) numfnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) strnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) strcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) strfnames[]; + +#endif + +/* + * These entrypoints are used only by the ncurses utilities such as tic. + */ +#ifdef NCURSES_INTERNALS + +extern NCURSES_EXPORT(int) _nc_set_tty_mode(TTY* buf); +extern NCURSES_EXPORT(int) + _nc_read_entry2(const char* const, char* const, TERMTYPE2* const); +extern NCURSES_EXPORT(int) _nc_read_file_entry(const char* const, TERMTYPE2*); +extern NCURSES_EXPORT(int) _nc_read_termtype(TERMTYPE2*, char*, int); +extern NCURSES_EXPORT(char*) _nc_first_name(const char* const); +extern NCURSES_EXPORT(int) + _nc_name_match(const char* const, const char* const, const char* const); + +#endif /* NCURSES_INTERNALS */ + +/* + * These entrypoints are used by tack. + */ +extern NCURSES_EXPORT(const TERMTYPE*) _nc_fallback(const char*); +extern NCURSES_EXPORT(int) + _nc_read_entry(const char* const, char* const, TERMTYPE* const); + +/* Normal entry points */ +extern NCURSES_EXPORT(TERMINAL*) set_curterm(TERMINAL*); +extern NCURSES_EXPORT(int) del_curterm(TERMINAL*); + +/* miscellaneous entry points */ +extern NCURSES_EXPORT(int) restartterm(NCURSES_CONST char*, int, int*); +extern NCURSES_EXPORT(int) setupterm(NCURSES_CONST char*, int, int*); + +/* terminfo entry points, also declared in curses.h */ +#if !defined(__NCURSES_H) +extern NCURSES_EXPORT(char*) tigetstr(NCURSES_CONST char*); +extern NCURSES_EXPORT_VAR(char) ttytype[]; +extern NCURSES_EXPORT(int) putp(const char*); +extern NCURSES_EXPORT(int) tigetflag(NCURSES_CONST char*); +extern NCURSES_EXPORT(int) tigetnum(NCURSES_CONST char*); + +#if 1 /* NCURSES_TPARM_VARARGS */ +extern NCURSES_EXPORT(char*) tparm(NCURSES_CONST char*, ...); /* special */ +#else +extern NCURSES_EXPORT(char*) tparm( + NCURSES_CONST char*, + long, + long, + long, + long, + long, + long, + long, + long, + long); /* special */ +extern NCURSES_EXPORT(char*) + tparm_varargs(NCURSES_CONST char*, ...); /* special */ +#endif + +extern NCURSES_EXPORT(char*) tiparm(const char*, ...); /* special */ + +#endif /* __NCURSES_H */ + +/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */ +#if !defined(NCURSES_TERMCAP_H_incl) +extern NCURSES_EXPORT(char*) tgetstr(NCURSES_CONST char*, char**); +extern NCURSES_EXPORT(char*) tgoto(const char*, int, int); +extern NCURSES_EXPORT(int) tgetent(char*, const char*); +extern NCURSES_EXPORT(int) tgetflag(NCURSES_CONST char*); +extern NCURSES_EXPORT(int) tgetnum(NCURSES_CONST char*); +extern NCURSES_EXPORT(int) tputs(const char*, int, int (*)(int)); +#endif /* NCURSES_TERMCAP_H_incl */ + +/* + * Include curses.h before term.h to enable these extensions. + */ +#if defined(NCURSES_SP_FUNCS) && (NCURSES_SP_FUNCS != 0) + +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(tigetstr)(SCREEN*, NCURSES_CONST char*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(putp)(SCREEN*, const char*); +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(tigetflag)(SCREEN*, NCURSES_CONST char*); +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(tigetnum)(SCREEN*, NCURSES_CONST char*); + +#if 1 /* NCURSES_TPARM_VARARGS */ +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(tparm)(SCREEN*, NCURSES_CONST char*, ...); /* special */ +#else +extern NCURSES_EXPORT(char*) NCURSES_SP_NAME(tparm)( + SCREEN*, + NCURSES_CONST char*, + long, + long, + long, + long, + long, + long, + long, + long, + long); /* special */ +extern NCURSES_EXPORT(char*) NCURSES_SP_NAME( + tparm_varargs)(SCREEN*, NCURSES_CONST char*, ...); /* special */ +#endif + +/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */ +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(tgetstr)(SCREEN*, NCURSES_CONST char*, char**); +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(tgoto)(SCREEN*, const char*, int, int); +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(tgetent)(SCREEN*, char*, const char*); +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(tgetflag)(SCREEN*, NCURSES_CONST char*); +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(tgetnum)(SCREEN*, NCURSES_CONST char*); +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(tputs)(SCREEN*, const char*, int, NCURSES_SP_OUTC); + +extern NCURSES_EXPORT(TERMINAL*) + NCURSES_SP_NAME(set_curterm)(SCREEN*, TERMINAL*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(del_curterm)(SCREEN*, TERMINAL*); + +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(restartterm)(SCREEN*, NCURSES_CONST char*, int, int*); +#endif /* NCURSES_SP_FUNCS */ + +#ifdef __cplusplus +} +#endif + +#endif /* NCURSES_TERM_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/term_entry.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/term_entry.h new file mode 100644 index 0000000..f62326b --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/term_entry.h @@ -0,0 +1,252 @@ +/**************************************************************************** + * Copyright (c) 1998-2015,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1998-on * + ****************************************************************************/ + +/* $Id: term_entry.h,v 1.55 2017/04/06 22:45:34 tom Exp $ */ + +/* + * term_entry.h -- interface to entry-manipulation code + */ + +#ifndef NCURSES_TERM_ENTRY_H_incl +#define NCURSES_TERM_ENTRY_H_incl 1 +/* *INDENT-OFF* */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * These macros may be used by programs that know about TERMTYPE: + */ +#if NCURSES_XNAMES +#define NUM_BOOLEANS(tp) (tp)->num_Booleans +#define NUM_NUMBERS(tp) (tp)->num_Numbers +#define NUM_STRINGS(tp) (tp)->num_Strings +#define EXT_NAMES(tp, i, limit, index, table) \ + (i >= limit) ? tp->ext_Names[index] : table[i] +#else +#define NUM_BOOLEANS(tp) BOOLCOUNT +#define NUM_NUMBERS(tp) NUMCOUNT +#define NUM_STRINGS(tp) STRCOUNT +#define EXT_NAMES(tp, i, limit, index, table) table[i] +#endif + +#define NUM_EXT_NAMES(tp) \ + (unsigned)((tp)->ext_Booleans + (tp)->ext_Numbers + (tp)->ext_Strings) + +#define for_each_boolean(n, tp) for (n = 0; n < NUM_BOOLEANS(tp); n++) +#define for_each_number(n, tp) for (n = 0; n < NUM_NUMBERS(tp); n++) +#define for_each_string(n, tp) for (n = 0; n < NUM_STRINGS(tp); n++) + +#if NCURSES_XNAMES +#define for_each_ext_boolean(n, tp) \ + for (n = BOOLCOUNT; (int)n < (int)NUM_BOOLEANS(tp); n++) +#define for_each_ext_number(n, tp) \ + for (n = NUMCOUNT; (int)n < (int)NUM_NUMBERS(tp); n++) +#define for_each_ext_string(n, tp) \ + for (n = STRCOUNT; (int)n < (int)NUM_STRINGS(tp); n++) +#endif + +#define ExtBoolname(tp, i, names) \ + EXT_NAMES( \ + tp, i, BOOLCOUNT, (i - (tp->num_Booleans - tp->ext_Booleans)), names) +#define ExtNumname(tp, i, names) \ + EXT_NAMES( \ + tp, \ + i, \ + NUMCOUNT, \ + (i - (tp->num_Numbers - tp->ext_Numbers)) + tp->ext_Booleans, \ + names) +#define ExtStrname(tp, i, names) \ + EXT_NAMES( \ + tp, \ + i, \ + STRCOUNT, \ + (i - (tp->num_Strings - tp->ext_Strings)) + \ + (tp->ext_Numbers + tp->ext_Booleans), \ + names) + +/* + * The remaining type-definitions and macros are used only internally by the + * ncurses utilities. + */ +#ifdef NCURSES_INTERNALS + +/* + * see db_iterator.c - this enumeration lists the places searched for a + * terminal description and defines the order in which they are searched. + */ +typedef enum { + dbdTIC = 0, /* special, used by tic when writing entry */ +#if NCURSES_USE_DATABASE + dbdEnvOnce, /* the $TERMINFO environment variable */ + dbdHome, /* $HOME/.terminfo */ + dbdEnvList, /* the $TERMINFO_DIRS environment variable */ + dbdCfgList, /* the compiled-in TERMINFO_DIRS value */ + dbdCfgOnce, /* the compiled-in TERMINFO value */ +#endif +#if NCURSES_USE_TERMCAP + dbdEnvOnce2, /* the $TERMCAP environment variable */ + dbdEnvList2, /* the $TERMPATH environment variable */ + dbdCfgList2, /* the compiled-in TERMPATH */ +#endif + dbdLAST +} DBDIRS; + +#define MAX_USES 32 +#define MAX_CROSSLINKS 16 + +typedef struct entry ENTRY; + +typedef struct { + char* name; + ENTRY* link; + long line; +} ENTRY_USES; + +struct entry { + TERMTYPE2 tterm; + unsigned nuses; + ENTRY_USES uses[MAX_USES]; + int ncrosslinks; + ENTRY* crosslinks[MAX_CROSSLINKS]; + long cstart; + long cend; + long startline; + ENTRY* next; + ENTRY* last; +}; + +extern NCURSES_EXPORT_VAR(ENTRY*) _nc_head; +extern NCURSES_EXPORT_VAR(ENTRY*) _nc_tail; +#define for_entry_list(qp) for (qp = _nc_head; qp; qp = qp->next) + +#define MAX_LINE 132 + +#define NULLHOOK (bool (*)(ENTRY*))0 + +/* + * Note that WANTED and PRESENT are not simple inverses! If a capability + * has been explicitly cancelled, it's not considered WANTED. + */ +#define WANTED(s) ((s) == ABSENT_STRING) +#define PRESENT(s) (((s) != ABSENT_STRING) && ((s) != CANCELLED_STRING)) + +#define ANDMISSING(p, q) \ + { \ + if (PRESENT(p) && !PRESENT(q)) \ + _nc_warning(#p " but no " #q); \ + } + +#define PAIRED(p, q) \ + { \ + if (PRESENT(q) && !PRESENT(p)) \ + _nc_warning(#q " but no " #p); \ + if (PRESENT(p) && !PRESENT(q)) \ + _nc_warning(#p " but no " #q); \ + } + +/* + * These entrypoints are used only by the ncurses utilities such as tic. + */ + +/* alloc_entry.c: elementary allocation code */ +extern NCURSES_EXPORT(ENTRY*) _nc_copy_entry(ENTRY* oldp); +extern NCURSES_EXPORT(char*) _nc_save_str(const char* const); +extern NCURSES_EXPORT(void) _nc_init_entry(ENTRY* const); +extern NCURSES_EXPORT(void) _nc_merge_entry(ENTRY* const, ENTRY* const); +extern NCURSES_EXPORT(void) _nc_wrap_entry(ENTRY* const, bool); + +/* alloc_ttype.c: elementary allocation code */ +extern NCURSES_EXPORT(void) _nc_align_termtype(TERMTYPE2*, TERMTYPE2*); + +/* free_ttype.c: elementary allocation code */ +extern NCURSES_EXPORT(void) _nc_free_termtype2(TERMTYPE2*); + +/* lib_termcap.c: trim sgr0 string for termcap users */ +extern NCURSES_EXPORT(char*) _nc_trim_sgr0(TERMTYPE2*); + +/* parse_entry.c: entry-parsing code */ +#if NCURSES_XNAMES +extern NCURSES_EXPORT_VAR(bool) _nc_user_definable; +extern NCURSES_EXPORT_VAR(bool) _nc_disable_period; +#endif +extern NCURSES_EXPORT(int) _nc_parse_entry(ENTRY*, int, bool); +extern NCURSES_EXPORT(int) _nc_capcmp(const char*, const char*); + +/* write_entry.c: writing an entry to the file system */ +extern NCURSES_EXPORT(void) _nc_set_writedir(const char*); +extern NCURSES_EXPORT(void) _nc_write_entry(TERMTYPE2* const); +extern NCURSES_EXPORT(int) + _nc_write_object(TERMTYPE2*, char*, unsigned*, unsigned); + +/* comp_parse.c: entry list handling */ +extern NCURSES_EXPORT(void) + _nc_read_entry_source(FILE*, char*, int, bool, bool (*)(ENTRY*)); +extern NCURSES_EXPORT(bool) _nc_entry_match(char*, char*); +extern NCURSES_EXPORT(int) _nc_resolve_uses(bool); /* obs 20040705 */ +extern NCURSES_EXPORT(int) _nc_resolve_uses2(bool, bool); +extern NCURSES_EXPORT(void) _nc_free_entries(ENTRY*); +extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype)( + TERMTYPE*); /* obs 20040705 */ +extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype2)(TERMTYPE2*, bool); + +/* trace_xnames.c */ +extern NCURSES_EXPORT(void) _nc_trace_xnames(TERMTYPE*); + +#endif /* NCURSES_INTERNALS */ + +/* + * These entrypoints are used by tack. + */ + +/* alloc_ttype.c: elementary allocation code */ +extern NCURSES_EXPORT(void) _nc_copy_termtype(TERMTYPE*, const TERMTYPE*); + +/* lib_acs.c */ +extern NCURSES_EXPORT(void) + _nc_init_acs(void); /* corresponds to traditional 'init_acs()' */ + +/* free_ttype.c: elementary allocation code */ +extern NCURSES_EXPORT(void) _nc_free_termtype(TERMTYPE*); + +#ifdef __cplusplus +} +#endif + +/* *INDENT-ON* */ + +#endif /* NCURSES_TERM_ENTRY_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/termcap.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/termcap.h new file mode 100644 index 0000000..8bad007 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/termcap.h @@ -0,0 +1,74 @@ +/**************************************************************************** + * Copyright (c) 1998-2000,2001 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* $Id: termcap.h.in,v 1.17 2001/03/24 21:53:27 tom Exp $ */ + +#ifndef NCURSES_TERMCAP_H_incl +#define NCURSES_TERMCAP_H_incl 1 + +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.1" + +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include + +#undef NCURSES_CONST +#define NCURSES_CONST const + +#undef NCURSES_OSPEED +#define NCURSES_OSPEED short + +extern NCURSES_EXPORT_VAR(char) PC; +extern NCURSES_EXPORT_VAR(char*) UP; +extern NCURSES_EXPORT_VAR(char*) BC; +extern NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed; + +#if !defined(NCURSES_TERM_H_incl) +extern NCURSES_EXPORT(char*) tgetstr(NCURSES_CONST char*, char**); +extern NCURSES_EXPORT(char*) tgoto(const char*, int, int); +extern NCURSES_EXPORT(int) tgetent(char*, const char*); +extern NCURSES_EXPORT(int) tgetflag(NCURSES_CONST char*); +extern NCURSES_EXPORT(int) tgetnum(NCURSES_CONST char*); +extern NCURSES_EXPORT(int) tputs(const char*, int, int (*)(int)); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* NCURSES_TERMCAP_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/tic.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/tic.h new file mode 100644 index 0000000..fd2c5e6 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/tic.h @@ -0,0 +1,369 @@ +/**************************************************************************** + * Copyright (c) 1998-2012,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996 on * + ****************************************************************************/ + +/* + * $Id: tic.h,v 1.75 2017/07/29 23:21:06 tom Exp $ + * tic.h - Global variables and structures for the terminfo compiler. + */ + +#ifndef __TIC_H +#define __TIC_H +/* *INDENT-OFF* */ +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include /* for the _tracef() prototype, ERR/OK, bool defs */ + +/* +** The format of SVr2 compiled terminfo files is as follows: +** +** Header (12 bytes), containing information given below +** Names Section, containing the names of the terminal +** Boolean Section, containing the values of all of the +** boolean capabilities +** A null byte may be inserted here to make +** sure that the Number Section begins on an +** even word boundary. +** Number Section, containing the values of all of the numeric +** capabilities, each as a short integer +** String Section, containing short integer offsets into the +** String Table, one per string capability +** String Table, containing the actual characters of the string +** capabilities. +** +** In the SVr2 format, "short" means signed 16-bit numbers, which is sometimes +** inconvenient. The numbers are signed, to provide for absent and canceled +** values. ncurses6.1 introduced an extension to this compiled format, by +** making the Number Section a list of signed 32-bit integers. +** +** NOTE that all short integers in the file are stored using VAX/PDP-style +** byte-order, i.e., least-significant byte first. +** +** There is no structure definition here because it would only confuse +** matters. Terminfo format is a raw byte layout, not a structure +** dump. If you happen to be on a little-endian machine with 16-bit +** shorts that requires no padding between short members in a struct, +** then there is a natural C structure that captures the header, but +** not very helpfully. +*/ + +#define MAGIC 0432 /* first two bytes of a compiled entry */ +#define MAGIC2 01036 /* first two bytes of a compiled 32-bit entry */ + +#undef BYTE +#define BYTE(p, n) (unsigned char)((p)[n]) + +#define IS_NEG1(p) ((BYTE(p, 0) == 0377) && (BYTE(p, 1) == 0377)) +#define IS_NEG2(p) ((BYTE(p, 0) == 0376) && (BYTE(p, 1) == 0377)) +#define LOW_MSB(p) (BYTE(p, 0) + 256 * BYTE(p, 1)) + +#define IS_TIC_MAGIC(p) (LOW_MSB(p) == MAGIC || LOW_MSB(p) == MAGIC2) + +#define quick_prefix(s) (!strncmp((s), "b64:", 4) || !strncmp((s), "hex:", 4)) + +/* + * The "maximum" here is misleading; XSI guarantees minimum values, which a + * given implementation may exceed. + */ +#define MAX_NAME_SIZE 512 /* maximum legal name field size (XSI:127) */ +#define MAX_ENTRY_SIZE1 4096 /* maximum legal entry size (SVr2) */ +#define MAX_ENTRY_SIZE2 32768 /* maximum legal entry size (ncurses6.1) */ + +#if NCURSES_EXT_COLORS && HAVE_INIT_EXTENDED_COLOR +#define MAX_ENTRY_SIZE MAX_ENTRY_SIZE2 +#else +#define MAX_ENTRY_SIZE MAX_ENTRY_SIZE1 +#endif + +/* + * The maximum size of individual name or alias is guaranteed in XSI to be at + * least 14, since that corresponds to the older filename lengths. Newer + * systems allow longer aliases, though not many terminal descriptions are + * written to use them. The MAX_ALIAS symbol is used for warnings. + */ +#if HAVE_LONG_FILE_NAMES +#define MAX_ALIAS 32 /* smaller than POSIX minimum for PATH_MAX */ +#else +#define MAX_ALIAS 14 /* SVr3 filename length */ +#endif + +/* location of user's personal info directory */ +#define PRIVATE_INFO "%s/.terminfo" /* plug getenv("HOME") into %s */ + +/* + * Some traces are designed to be used via tic's verbose option (and similar in + * infocmp and toe) rather than the 'trace()' function. So we use the bits + * above the normal trace() parameter as a debug-level. + */ + +#define MAX_DEBUG_LEVEL 15 +#define DEBUG_LEVEL(n) ((n) << TRACE_SHIFT) + +#define set_trace_level(n) \ + _nc_tracing &= \ + DEBUG_LEVEL(MAX_DEBUG_LEVEL) + DEBUG_LEVEL(MAX_DEBUG_LEVEL) - 1, \ + _nc_tracing |= DEBUG_LEVEL(n) + +#ifdef TRACE +#define DEBUG(n, a) \ + if (_nc_tracing >= DEBUG_LEVEL(n)) \ + _tracef a +#else +#define DEBUG(n, a) /*nothing*/ +#endif + +/* + * These are the types of tokens returned by the scanner. The first + * three are also used in the hash table of capability names. The scanner + * returns one of these values after loading the specifics into the global + * structure curr_token. + */ + +#define BOOLEAN 0 /* Boolean capability */ +#define NUMBER 1 /* Numeric capability */ +#define STRING 2 /* String-valued capability */ +#define CANCEL 3 /* Capability to be cancelled in following tc's */ +#define NAMES 4 /* The names for a terminal type */ +#define UNDEF 5 /* Undefined */ + +#define NO_PUSHBACK -1 /* used in pushtype to indicate no pushback */ + +/* + * The global structure in which the specific parts of a + * scanned token are returned. + */ + +struct token { + char* tk_name; /* name of capability */ + int tk_valnumber; /* value of capability (if a number) */ + char* tk_valstring; /* value of capability (if a string) */ +}; + +/* + * Offsets to string capabilities, with the corresponding functionkey codes. + */ +struct tinfo_fkeys { + unsigned offset; + chtype code; +}; + +typedef short HashValue; + +/* + * The file comp_captab.c contains an array of these structures, one per + * possible capability. These are indexed by a hash table array of pointers to + * the same structures for use by the parser. + */ +struct name_table_entry { + const char* nte_name; /* name to hash on */ + int nte_type; /* BOOLEAN, NUMBER or STRING */ + HashValue nte_index; /* index of associated variable in its array */ + HashValue nte_link; /* index in table of next hash, or -1 */ +}; + +/* + * Use this structure to hide differences between terminfo and termcap tables. + */ +typedef struct { + unsigned table_size; + const HashValue* table_data; + HashValue (*hash_of)(const char*); + int (*compare_names)(const char*, const char*); +} HashData; + +struct alias { + const char* from; + const char* to; + const char* source; +}; + +#define NOTFOUND ((struct name_table_entry*)0) + +/* + * The casts are required for correct sign-propagation with systems such as + * AIX, IRIX64, Solaris which default to unsigned characters. The C standard + * leaves this detail unspecified. + */ + +/* out-of-band values for representing absent capabilities */ +#define ABSENT_BOOLEAN ((signed char)-1) /* 255 */ +#define ABSENT_NUMERIC (-1) +#define ABSENT_STRING (char*)0 + +/* out-of-band values for representing cancels */ +#define CANCELLED_BOOLEAN ((signed char)-2) /* 254 */ +#define CANCELLED_NUMERIC (-2) +#define CANCELLED_STRING (char*)(-1) + +#define VALID_BOOLEAN(s) ((unsigned char)(s) <= 1) /* reject "-1" */ +#define VALID_NUMERIC(s) ((s) >= 0) +#define VALID_STRING(s) ((s) != CANCELLED_STRING && (s) != ABSENT_STRING) + +/* termcap entries longer than this may break old binaries */ +#define MAX_TERMCAP_LENGTH 1023 + +/* this is a documented limitation of terminfo */ +#define MAX_TERMINFO_LENGTH 4096 + +#ifndef TERMINFO +#define TERMINFO "/usr/share/terminfo" +#endif + +#ifdef NCURSES_TERM_ENTRY_H_incl + +/* + * These entrypoints are used only by the ncurses utilities such as tic. + */ +#ifdef NCURSES_INTERNALS +/* access.c */ +extern NCURSES_EXPORT(unsigned) _nc_pathlast(const char*); +extern NCURSES_EXPORT(bool) _nc_is_abs_path(const char*); +extern NCURSES_EXPORT(bool) _nc_is_dir_path(const char*); +extern NCURSES_EXPORT(bool) _nc_is_file_path(const char*); +extern NCURSES_EXPORT(char*) _nc_basename(char*); +extern NCURSES_EXPORT(char*) _nc_rootname(char*); + +/* comp_captab.c */ +extern NCURSES_EXPORT(const struct name_table_entry*) _nc_get_table(bool); +extern NCURSES_EXPORT(const HashData*) _nc_get_hash_info(bool); +extern NCURSES_EXPORT(const struct alias*) _nc_get_alias_table(bool); + +/* comp_hash.c: name lookup */ +extern NCURSES_EXPORT(struct name_table_entry const*) + _nc_find_type_entry(const char*, int, bool); + +/* comp_scan.c: lexical analysis */ +extern NCURSES_EXPORT(int) _nc_get_token(bool); +extern NCURSES_EXPORT(void) _nc_panic_mode(char); +extern NCURSES_EXPORT(void) _nc_push_token(int); +extern NCURSES_EXPORT_VAR(int) _nc_curr_col; +extern NCURSES_EXPORT_VAR(int) _nc_curr_line; +extern NCURSES_EXPORT_VAR(int) _nc_syntax; +extern NCURSES_EXPORT_VAR(int) _nc_strict_bsd; +extern NCURSES_EXPORT_VAR(long) _nc_comment_end; +extern NCURSES_EXPORT_VAR(long) _nc_comment_start; +extern NCURSES_EXPORT_VAR(long) _nc_curr_file_pos; +extern NCURSES_EXPORT_VAR(long) _nc_start_line; +#define SYN_TERMINFO 0 +#define SYN_TERMCAP 1 + +/* comp_error.c: warning & abort messages */ +extern NCURSES_EXPORT(const char*) _nc_get_source(void); +extern NCURSES_EXPORT(void) _nc_err_abort(const char* const, ...) + GCC_PRINTFLIKE(1, 2) GCC_NORETURN; +extern NCURSES_EXPORT(void) _nc_get_type(char* name); +extern NCURSES_EXPORT(void) _nc_set_source(const char* const); +extern NCURSES_EXPORT(void) _nc_set_type(const char* const); +extern NCURSES_EXPORT(void) _nc_syserr_abort(const char* const, ...) + GCC_PRINTFLIKE(1, 2) GCC_NORETURN; +extern NCURSES_EXPORT(void) _nc_warning(const char* const, ...) + GCC_PRINTFLIKE(1, 2); +extern NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings; + +/* comp_scan.c */ +extern NCURSES_EXPORT_VAR(struct token) _nc_curr_token; + +/* captoinfo.c: capability conversion */ +extern NCURSES_EXPORT(char*) _nc_captoinfo(const char*, const char*, int const); +extern NCURSES_EXPORT(char*) _nc_infotocap(const char*, const char*, int const); + +/* home_terminfo.c */ +extern NCURSES_EXPORT(char*) _nc_home_terminfo(void); + +/* init_keytry.c */ +#if BROKEN_LINKER +#define _nc_tinfo_fkeys _nc_tinfo_fkeysf() +extern NCURSES_EXPORT(const struct tinfo_fkeys*) _nc_tinfo_fkeysf(void); +#else +extern NCURSES_EXPORT_VAR(const struct tinfo_fkeys) _nc_tinfo_fkeys[]; +#endif + +/* lib_tparm.c */ +#define NUM_PARM 9 + +extern NCURSES_EXPORT_VAR(int) _nc_tparm_err; + +extern NCURSES_EXPORT(int) _nc_tparm_analyze(const char*, char**, int*); + +/* lib_trace.c */ +extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing; +extern NCURSES_EXPORT(const char*) _nc_visbuf(const char*); +extern NCURSES_EXPORT(const char*) _nc_visbuf2(int, const char*); + +/* lib_tputs.c */ +extern NCURSES_EXPORT_VAR(int) _nc_nulls_sent; /* Add one for every null sent */ + +/* comp_main.c: compiler main */ +extern const char* _nc_progname; + +/* db_iterator.c */ +extern NCURSES_EXPORT(const char*) _nc_next_db(DBDIRS*, int*); +extern NCURSES_EXPORT(const char*) _nc_tic_dir(const char*); +extern NCURSES_EXPORT(void) _nc_first_db(DBDIRS*, int*); +extern NCURSES_EXPORT(void) _nc_last_db(void); + +/* write_entry.c */ +extern NCURSES_EXPORT(int) _nc_tic_written(void); + +#endif /* NCURSES_INTERNALS */ + +/* + * These entrypoints are used by tack. + */ + +/* comp_hash.c: name lookup */ +extern NCURSES_EXPORT(struct name_table_entry const*) + _nc_find_entry(const char*, const HashValue*); +extern NCURSES_EXPORT(const HashValue*) _nc_get_hash_table(bool); + +/* comp_scan.c: lexical analysis */ +extern NCURSES_EXPORT(void) _nc_reset_input(FILE*, char*); + +/* comp_expand.c: expand string into readable form */ +extern NCURSES_EXPORT(char*) _nc_tic_expand(const char*, bool, int); + +/* comp_scan.c: decode string from readable form */ +extern NCURSES_EXPORT(int) _nc_trans_string(char*, char*); + +#endif /* NCURSES_TERM_ENTRY_H_incl */ + +#ifdef __cplusplus +} +#endif + +/* *INDENT-ON* */ +#endif /* __TIC_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/unctrl.h b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/unctrl.h new file mode 100644 index 0000000..581f6a5 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/ncursesw/unctrl.h @@ -0,0 +1,67 @@ +/**************************************************************************** + * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* + * unctrl.h + * + * Display a printable version of a control character. + * Control characters are displayed in caret notation (^x), DELETE is displayed + * as ^?. Printable characters are displayed as is. + */ + +/* $Id: unctrl.h.in,v 1.11 2009/04/18 21:00:52 tom Exp $ */ + +#ifndef NCURSES_UNCTRL_H_incl +#define NCURSES_UNCTRL_H_incl 1 + +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.1" + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#undef unctrl +NCURSES_EXPORT(NCURSES_CONST char*) unctrl(chtype); + +#if 1 +NCURSES_EXPORT(NCURSES_CONST char*) NCURSES_SP_NAME(unctrl)(SCREEN*, chtype); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* NCURSES_UNCTRL_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/odbcStubs.h b/src_cpp/elfgames/tasks/elf2codingenv/include/odbcStubs.h new file mode 100644 index 0000000..3893293 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/odbcStubs.h @@ -0,0 +1,179 @@ +/* + *----------------------------------------------------------------------------- + * + * ../generic/odbcStubs.h -- + * + * Stubs for procedures in odbcStubDefs.txt + * + * Generated by genExtStubs.tcl: DO NOT EDIT + * 2017-06-05 16:16:37Z + * + *----------------------------------------------------------------------------- + */ + +typedef struct odbcStubDefs { + /* Functions from libraries: odbc32 odbc libodbc32 libodbc */ + + SQLRETURN(SQL_API* SQLAllocHandlePtr)(SQLSMALLINT, SQLHANDLE, SQLHANDLE*); + SQLRETURN(SQL_API* SQLBindParameterPtr) + (SQLHSTMT, + SQLUSMALLINT, + SQLSMALLINT, + SQLSMALLINT, + SQLSMALLINT, + SQLULEN, + SQLSMALLINT, + SQLPOINTER, + SQLLEN, + SQLLEN*); + SQLRETURN(SQL_API* SQLCloseCursorPtr)(SQLHSTMT); + SQLRETURN(SQL_API* SQLColumnsWPtr) + (SQLHSTMT, + SQLWCHAR*, + SQLSMALLINT, + SQLWCHAR*, + SQLSMALLINT, + SQLWCHAR*, + SQLSMALLINT, + SQLWCHAR*, + SQLSMALLINT); + SQLRETURN(SQL_API* SQLDataSourcesWPtr) + (SQLHENV, + SQLUSMALLINT, + SQLWCHAR*, + SQLSMALLINT, + SQLSMALLINT*, + SQLWCHAR*, + SQLSMALLINT, + SQLSMALLINT*); + SQLRETURN(SQL_API* SQLDescribeColWPtr) + (SQLHSTMT, + SQLUSMALLINT, + SQLWCHAR*, + SQLSMALLINT, + SQLSMALLINT*, + SQLSMALLINT*, + SQLULEN*, + SQLSMALLINT*, + SQLSMALLINT*); + SQLRETURN(SQL_API* SQLDescribeParamPtr) + (SQLHSTMT, SQLUSMALLINT, SQLSMALLINT*, SQLULEN*, SQLSMALLINT*, SQLSMALLINT*); + SQLRETURN(SQL_API* SQLDisconnectPtr)(SQLHDBC); + SQLRETURN(SQL_API* SQLDriverConnectWPtr) + (SQLHDBC, + SQLHWND, + SQLWCHAR*, + SQLSMALLINT, + SQLWCHAR*, + SQLSMALLINT, + SQLSMALLINT*, + SQLUSMALLINT); + SQLRETURN(SQL_API* SQLDriversWPtr) + (SQLHENV, + SQLUSMALLINT, + SQLWCHAR*, + SQLSMALLINT, + SQLSMALLINT*, + SQLWCHAR*, + SQLSMALLINT, + SQLSMALLINT*); + SQLRETURN(SQL_API* SQLEndTranPtr)(SQLSMALLINT, SQLHANDLE, SQLSMALLINT); + SQLRETURN(SQL_API* SQLExecutePtr)(SQLHSTMT); + SQLRETURN(SQL_API* SQLFetchPtr)(SQLHSTMT); + SQLRETURN(SQL_API* SQLForeignKeysWPtr) + (SQLHSTMT, + SQLWCHAR*, + SQLSMALLINT, + SQLWCHAR*, + SQLSMALLINT, + SQLWCHAR*, + SQLSMALLINT, + SQLWCHAR*, + SQLSMALLINT, + SQLWCHAR*, + SQLSMALLINT, + SQLWCHAR*, + SQLSMALLINT); + SQLRETURN(SQL_API* SQLFreeHandlePtr)(SQLSMALLINT, SQLHANDLE); + SQLRETURN(SQL_API* SQLGetConnectAttrPtr) + (SQLHDBC, SQLINTEGER, SQLPOINTER, SQLINTEGER, SQLINTEGER*); + SQLRETURN(SQL_API* SQLGetDataPtr) + (SQLHSTMT, SQLUSMALLINT, SQLSMALLINT, SQLPOINTER, SQLLEN, SQLLEN*); + SQLRETURN(SQL_API* SQLGetDiagFieldAPtr) + (SQLSMALLINT, + SQLHANDLE, + SQLSMALLINT, + SQLSMALLINT, + SQLPOINTER, + SQLSMALLINT, + SQLSMALLINT*); + SQLRETURN(SQL_API* SQLGetDiagRecWPtr) + (SQLSMALLINT, + SQLHANDLE, + SQLSMALLINT, + SQLWCHAR*, + SQLINTEGER*, + SQLWCHAR*, + SQLSMALLINT, + SQLSMALLINT*); + SQLRETURN(SQL_API* SQLGetTypeInfoPtr)(SQLHSTMT, SQLSMALLINT); + SQLRETURN(SQL_API* SQLMoreResultsPtr)(SQLHSTMT); + SQLRETURN(SQL_API* SQLNumParamsPtr)(SQLHSTMT, SQLSMALLINT*); + SQLRETURN(SQL_API* SQLNumResultColsPtr)(SQLHSTMT, SQLSMALLINT*); + SQLRETURN(SQL_API* SQLPrepareWPtr)(SQLHSTMT, SQLWCHAR*, SQLINTEGER); + SQLRETURN(SQL_API* SQLPrimaryKeysWPtr) + (SQLHSTMT, + SQLWCHAR*, + SQLSMALLINT, + SQLWCHAR*, + SQLSMALLINT, + SQLWCHAR*, + SQLSMALLINT); + SQLRETURN(SQL_API* SQLRowCountPtr)(SQLHSTMT, SQLLEN*); + SQLRETURN(SQL_API* SQLSetConnectAttrPtr) + (SQLHDBC, SQLINTEGER, SQLPOINTER, SQLINTEGER); + SQLRETURN(SQL_API* SQLSetConnectOptionPtr)(SQLHDBC, SQLUSMALLINT, SQLULEN); + SQLRETURN(SQL_API* SQLSetEnvAttrPtr) + (SQLHENV, SQLINTEGER, SQLPOINTER, SQLINTEGER); + SQLRETURN(SQL_API* SQLTablesWPtr) + (SQLHSTMT, + SQLWCHAR*, + SQLSMALLINT, + SQLWCHAR*, + SQLSMALLINT, + SQLWCHAR*, + SQLSMALLINT, + SQLWCHAR*, + SQLSMALLINT); +} odbcStubDefs; +#define SQLAllocHandle (odbcStubs->SQLAllocHandlePtr) +#define SQLBindParameter (odbcStubs->SQLBindParameterPtr) +#define SQLCloseCursor (odbcStubs->SQLCloseCursorPtr) +#define SQLColumnsW (odbcStubs->SQLColumnsWPtr) +#define SQLDataSourcesW (odbcStubs->SQLDataSourcesWPtr) +#define SQLDescribeColW (odbcStubs->SQLDescribeColWPtr) +#define SQLDescribeParam (odbcStubs->SQLDescribeParamPtr) +#define SQLDisconnect (odbcStubs->SQLDisconnectPtr) +#define SQLDriverConnectW (odbcStubs->SQLDriverConnectWPtr) +#define SQLDriversW (odbcStubs->SQLDriversWPtr) +#define SQLEndTran (odbcStubs->SQLEndTranPtr) +#define SQLExecute (odbcStubs->SQLExecutePtr) +#define SQLFetch (odbcStubs->SQLFetchPtr) +#define SQLForeignKeysW (odbcStubs->SQLForeignKeysWPtr) +#define SQLFreeHandle (odbcStubs->SQLFreeHandlePtr) +#define SQLGetConnectAttr (odbcStubs->SQLGetConnectAttrPtr) +#define SQLGetData (odbcStubs->SQLGetDataPtr) +#define SQLGetDiagFieldA (odbcStubs->SQLGetDiagFieldAPtr) +#define SQLGetDiagRecW (odbcStubs->SQLGetDiagRecWPtr) +#define SQLGetTypeInfo (odbcStubs->SQLGetTypeInfoPtr) +#define SQLMoreResults (odbcStubs->SQLMoreResultsPtr) +#define SQLNumParams (odbcStubs->SQLNumParamsPtr) +#define SQLNumResultCols (odbcStubs->SQLNumResultColsPtr) +#define SQLPrepareW (odbcStubs->SQLPrepareWPtr) +#define SQLPrimaryKeysW (odbcStubs->SQLPrimaryKeysWPtr) +#define SQLRowCount (odbcStubs->SQLRowCountPtr) +#define SQLSetConnectAttr (odbcStubs->SQLSetConnectAttrPtr) +#define SQLSetConnectOption (odbcStubs->SQLSetConnectOptionPtr) +#define SQLSetEnvAttr (odbcStubs->SQLSetEnvAttrPtr) +#define SQLTablesW (odbcStubs->SQLTablesWPtr) +MODULE_SCOPE const odbcStubDefs* odbcStubs; diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/aes.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/aes.h new file mode 100644 index 0000000..db74bf6 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/aes.h @@ -0,0 +1,203 @@ +/* crypto/aes/aes.h */ +/* ==================================================================== + * Copyright (c) 1998-2002 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + */ + +#ifndef HEADER_AES_H +#define HEADER_AES_H + +#include + +#ifdef OPENSSL_NO_AES +#error AES is disabled. +#endif + +#include + +#define AES_ENCRYPT 1 +#define AES_DECRYPT 0 + +/* + * Because array size can't be a const in C, the following two are macros. + * Both sizes are in bytes. + */ +#define AES_MAXNR 14 +#define AES_BLOCK_SIZE 16 + +#ifdef __cplusplus +extern "C" { +#endif + +/* This should be a hidden type, but EVP requires that the size be known */ +struct aes_key_st { +#ifdef AES_LONG + unsigned long rd_key[4 * (AES_MAXNR + 1)]; +#else + unsigned int rd_key[4 * (AES_MAXNR + 1)]; +#endif + int rounds; +}; +typedef struct aes_key_st AES_KEY; + +const char* AES_options(void); + +int AES_set_encrypt_key( + const unsigned char* userKey, + const int bits, + AES_KEY* key); +int AES_set_decrypt_key( + const unsigned char* userKey, + const int bits, + AES_KEY* key); + +int private_AES_set_encrypt_key( + const unsigned char* userKey, + const int bits, + AES_KEY* key); +int private_AES_set_decrypt_key( + const unsigned char* userKey, + const int bits, + AES_KEY* key); + +void AES_encrypt( + const unsigned char* in, + unsigned char* out, + const AES_KEY* key); +void AES_decrypt( + const unsigned char* in, + unsigned char* out, + const AES_KEY* key); + +void AES_ecb_encrypt( + const unsigned char* in, + unsigned char* out, + const AES_KEY* key, + const int enc); +void AES_cbc_encrypt( + const unsigned char* in, + unsigned char* out, + size_t length, + const AES_KEY* key, + unsigned char* ivec, + const int enc); +void AES_cfb128_encrypt( + const unsigned char* in, + unsigned char* out, + size_t length, + const AES_KEY* key, + unsigned char* ivec, + int* num, + const int enc); +void AES_cfb1_encrypt( + const unsigned char* in, + unsigned char* out, + size_t length, + const AES_KEY* key, + unsigned char* ivec, + int* num, + const int enc); +void AES_cfb8_encrypt( + const unsigned char* in, + unsigned char* out, + size_t length, + const AES_KEY* key, + unsigned char* ivec, + int* num, + const int enc); +void AES_ofb128_encrypt( + const unsigned char* in, + unsigned char* out, + size_t length, + const AES_KEY* key, + unsigned char* ivec, + int* num); +void AES_ctr128_encrypt( + const unsigned char* in, + unsigned char* out, + size_t length, + const AES_KEY* key, + unsigned char ivec[AES_BLOCK_SIZE], + unsigned char ecount_buf[AES_BLOCK_SIZE], + unsigned int* num); +/* NB: the IV is _two_ blocks long */ +void AES_ige_encrypt( + const unsigned char* in, + unsigned char* out, + size_t length, + const AES_KEY* key, + unsigned char* ivec, + const int enc); +/* NB: the IV is _four_ blocks long */ +void AES_bi_ige_encrypt( + const unsigned char* in, + unsigned char* out, + size_t length, + const AES_KEY* key, + const AES_KEY* key2, + const unsigned char* ivec, + const int enc); + +int AES_wrap_key( + AES_KEY* key, + const unsigned char* iv, + unsigned char* out, + const unsigned char* in, + unsigned int inlen); +int AES_unwrap_key( + AES_KEY* key, + const unsigned char* iv, + unsigned char* out, + const unsigned char* in, + unsigned int inlen); + +#ifdef __cplusplus +} +#endif + +#endif /* !HEADER_AES_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/asn1.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/asn1.h new file mode 100644 index 0000000..59a9c33 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/asn1.h @@ -0,0 +1,1478 @@ +/* crypto/asn1/asn1.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_ASN1_H +#define HEADER_ASN1_H + +#include +#include +#ifndef OPENSSL_NO_BIO +#include +#endif +#include +#include + +#include + +#include +#ifndef OPENSSL_NO_DEPRECATED +#include +#endif + +#ifdef OPENSSL_BUILD_SHLIBCRYPTO +#undef OPENSSL_EXTERN +#define OPENSSL_EXTERN OPENSSL_EXPORT +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define V_ASN1_UNIVERSAL 0x00 +#define V_ASN1_APPLICATION 0x40 +#define V_ASN1_CONTEXT_SPECIFIC 0x80 +#define V_ASN1_PRIVATE 0xc0 + +#define V_ASN1_CONSTRUCTED 0x20 +#define V_ASN1_PRIMITIVE_TAG 0x1f +#define V_ASN1_PRIMATIVE_TAG 0x1f + +#define V_ASN1_APP_CHOOSE -2 /* let the recipient choose */ +#define V_ASN1_OTHER -3 /* used in ASN1_TYPE */ +#define V_ASN1_ANY -4 /* used in ASN1 template code */ + +#define V_ASN1_NEG 0x100 /* negative flag */ + +#define V_ASN1_UNDEF -1 +#define V_ASN1_EOC 0 +#define V_ASN1_BOOLEAN 1 /**/ +#define V_ASN1_INTEGER 2 +#define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG) +#define V_ASN1_BIT_STRING 3 +#define V_ASN1_OCTET_STRING 4 +#define V_ASN1_NULL 5 +#define V_ASN1_OBJECT 6 +#define V_ASN1_OBJECT_DESCRIPTOR 7 +#define V_ASN1_EXTERNAL 8 +#define V_ASN1_REAL 9 +#define V_ASN1_ENUMERATED 10 +#define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG) +#define V_ASN1_UTF8STRING 12 +#define V_ASN1_SEQUENCE 16 +#define V_ASN1_SET 17 +#define V_ASN1_NUMERICSTRING 18 /**/ +#define V_ASN1_PRINTABLESTRING 19 +#define V_ASN1_T61STRING 20 +#define V_ASN1_TELETEXSTRING 20 /* alias */ +#define V_ASN1_VIDEOTEXSTRING 21 /**/ +#define V_ASN1_IA5STRING 22 +#define V_ASN1_UTCTIME 23 +#define V_ASN1_GENERALIZEDTIME 24 /**/ +#define V_ASN1_GRAPHICSTRING 25 /**/ +#define V_ASN1_ISO64STRING 26 /**/ +#define V_ASN1_VISIBLESTRING 26 /* alias */ +#define V_ASN1_GENERALSTRING 27 /**/ +#define V_ASN1_UNIVERSALSTRING 28 /**/ +#define V_ASN1_BMPSTRING 30 +/* For use with d2i_ASN1_type_bytes() */ +#define B_ASN1_NUMERICSTRING 0x0001 +#define B_ASN1_PRINTABLESTRING 0x0002 +#define B_ASN1_T61STRING 0x0004 +#define B_ASN1_TELETEXSTRING 0x0004 +#define B_ASN1_VIDEOTEXSTRING 0x0008 +#define B_ASN1_IA5STRING 0x0010 +#define B_ASN1_GRAPHICSTRING 0x0020 +#define B_ASN1_ISO64STRING 0x0040 +#define B_ASN1_VISIBLESTRING 0x0040 +#define B_ASN1_GENERALSTRING 0x0080 +#define B_ASN1_UNIVERSALSTRING 0x0100 +#define B_ASN1_OCTET_STRING 0x0200 +#define B_ASN1_BIT_STRING 0x0400 +#define B_ASN1_BMPSTRING 0x0800 +#define B_ASN1_UNKNOWN 0x1000 +#define B_ASN1_UTF8STRING 0x2000 +#define B_ASN1_UTCTIME 0x4000 +#define B_ASN1_GENERALIZEDTIME 0x8000 +#define B_ASN1_SEQUENCE 0x10000 +/* For use with ASN1_mbstring_copy() */ +#define MBSTRING_FLAG 0x1000 +#define MBSTRING_UTF8 (MBSTRING_FLAG) +#define MBSTRING_ASC (MBSTRING_FLAG | 1) +#define MBSTRING_BMP (MBSTRING_FLAG | 2) +#define MBSTRING_UNIV (MBSTRING_FLAG | 4) +#define SMIME_OLDMIME 0x400 +#define SMIME_CRLFEOL 0x800 +#define SMIME_STREAM 0x1000 +struct X509_algor_st; +DECLARE_STACK_OF(X509_ALGOR) + +#define DECLARE_ASN1_SET_OF(type) /* filled in by mkstack.pl */ +#define IMPLEMENT_ASN1_SET_OF(type) /* nothing, no longer needed */ + +/* + * We MUST make sure that, except for constness, asn1_ctx_st and + * asn1_const_ctx are exactly the same. Fortunately, as soon as the old ASN1 + * parsing macros are gone, we can throw this away as well... + */ +typedef struct asn1_ctx_st { + unsigned char* p; /* work char pointer */ + int eos; /* end of sequence read for indefinite + * encoding */ + int error; /* error code to use when returning an error */ + int inf; /* constructed if 0x20, indefinite is 0x21 */ + int tag; /* tag from last 'get object' */ + int xclass; /* class from last 'get object' */ + long slen; /* length of last 'get object' */ + unsigned char* max; /* largest value of p allowed */ + unsigned char* q; /* temporary variable */ + unsigned char** pp; /* variable */ + int line; /* used in error processing */ +} ASN1_CTX; + +typedef struct asn1_const_ctx_st { + const unsigned char* p; /* work char pointer */ + int eos; /* end of sequence read for indefinite + * encoding */ + int error; /* error code to use when returning an error */ + int inf; /* constructed if 0x20, indefinite is 0x21 */ + int tag; /* tag from last 'get object' */ + int xclass; /* class from last 'get object' */ + long slen; /* length of last 'get object' */ + const unsigned char* max; /* largest value of p allowed */ + const unsigned char* q; /* temporary variable */ + const unsigned char** pp; /* variable */ + int line; /* used in error processing */ +} ASN1_const_CTX; + +/* + * These are used internally in the ASN1_OBJECT to keep track of whether the + * names and data need to be free()ed + */ +#define ASN1_OBJECT_FLAG_DYNAMIC 0x01 /* internal use */ +#define ASN1_OBJECT_FLAG_CRITICAL 0x02 /* critical x509v3 object id */ +#define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04 /* internal use */ +#define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08 /* internal use */ +struct asn1_object_st { + const char *sn, *ln; + int nid; + int length; + const unsigned char* data; /* data remains const after init */ + int flags; /* Should we free this one */ +}; + +#define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */ +/* + * This indicates that the ASN1_STRING is not a real value but just a place + * holder for the location where indefinite length constructed data should be + * inserted in the memory buffer + */ +#define ASN1_STRING_FLAG_NDEF 0x010 + +/* + * This flag is used by the CMS code to indicate that a string is not + * complete and is a place holder for content when it had all been accessed. + * The flag will be reset when content has been written to it. + */ + +#define ASN1_STRING_FLAG_CONT 0x020 +/* + * This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING + * type. + */ +#define ASN1_STRING_FLAG_MSTRING 0x040 +/* This is the base type that holds just about everything :-) */ +struct asn1_string_st { + int length; + int type; + unsigned char* data; + /* + * The value of the following field depends on the type being held. It + * is mostly being used for BIT_STRING so if the input data has a + * non-zero 'unused bits' value, it will be handled correctly + */ + long flags; +}; + +/* + * ASN1_ENCODING structure: this is used to save the received encoding of an + * ASN1 type. This is useful to get round problems with invalid encodings + * which can break signatures. + */ + +typedef struct ASN1_ENCODING_st { + unsigned char* enc; /* DER encoding */ + long len; /* Length of encoding */ + int modified; /* set to 1 if 'enc' is invalid */ +} ASN1_ENCODING; + +/* Used with ASN1 LONG type: if a long is set to this it is omitted */ +#define ASN1_LONG_UNDEF 0x7fffffffL + +#define STABLE_FLAGS_MALLOC 0x01 +#define STABLE_NO_MASK 0x02 +#define DIRSTRING_TYPE \ + (B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_BMPSTRING | \ + B_ASN1_UTF8STRING) +#define PKCS9STRING_TYPE (DIRSTRING_TYPE | B_ASN1_IA5STRING) + +typedef struct asn1_string_table_st { + int nid; + long minsize; + long maxsize; + unsigned long mask; + unsigned long flags; +} ASN1_STRING_TABLE; + +DECLARE_STACK_OF(ASN1_STRING_TABLE) + +/* size limits: this stuff is taken straight from RFC2459 */ + +#define ub_name 32768 +#define ub_common_name 64 +#define ub_locality_name 128 +#define ub_state_name 128 +#define ub_organization_name 64 +#define ub_organization_unit_name 64 +#define ub_title 64 +#define ub_email_address 128 + +/* + * Declarations for template structures: for full definitions see asn1t.h + */ +typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE; +typedef struct ASN1_TLC_st ASN1_TLC; +/* This is just an opaque pointer */ +typedef struct ASN1_VALUE_st ASN1_VALUE; + +/* Declare ASN1 functions: the implement macro in in asn1t.h */ + +#define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type) + +#define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type) + +#define DECLARE_ASN1_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) + +#define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) + +#define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \ + type* d2i_##name(type** a, const unsigned char** in, long len); \ + int i2d_##name(type* a, unsigned char** out); \ + DECLARE_ASN1_ITEM(itname) + +#define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \ + type* d2i_##name(type** a, const unsigned char** in, long len); \ + int i2d_##name(const type* a, unsigned char** out); \ + DECLARE_ASN1_ITEM(name) + +#define DECLARE_ASN1_NDEF_FUNCTION(name) \ + int i2d_##name##_NDEF(name* a, unsigned char** out); + +#define DECLARE_ASN1_FUNCTIONS_const(name) \ + DECLARE_ASN1_ALLOC_FUNCTIONS(name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS_const(name, name) + +#define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ + type* name##_new(void); \ + void name##_free(type* a); + +#define DECLARE_ASN1_PRINT_FUNCTION(stname) \ + DECLARE_ASN1_PRINT_FUNCTION_fname(stname, stname) + +#define DECLARE_ASN1_PRINT_FUNCTION_fname(stname, fname) \ + int fname##_print_ctx(BIO* out, stname* x, int indent, const ASN1_PCTX* pctx); + +#define D2I_OF(type) type* (*)(type**, const unsigned char**, long) +#define I2D_OF(type) int (*)(type*, unsigned char**) +#define I2D_OF_const(type) int (*)(const type*, unsigned char**) + +#define CHECKED_D2I_OF(type, d2i) ((d2i_of_void*)(1 ? d2i : ((D2I_OF(type))0))) +#define CHECKED_I2D_OF(type, i2d) ((i2d_of_void*)(1 ? i2d : ((I2D_OF(type))0))) +#define CHECKED_NEW_OF(type, xnew) \ + ((void* (*)(void))(1 ? xnew : ((type * (*)(void))0))) +#define CHECKED_PTR_OF(type, p) ((void*)(1 ? p : (type*)0)) +#define CHECKED_PPTR_OF(type, p) ((void**)(1 ? p : (type**)0)) + +#define TYPEDEF_D2I_OF(type) \ + typedef type* d2i_of_##type(type**, const unsigned char**, long) +#define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type*, unsigned char**) +#define TYPEDEF_D2I2D_OF(type) \ + TYPEDEF_D2I_OF(type); \ + TYPEDEF_I2D_OF(type) + +TYPEDEF_D2I2D_OF(void); + +/*- + * The following macros and typedefs allow an ASN1_ITEM + * to be embedded in a structure and referenced. Since + * the ASN1_ITEM pointers need to be globally accessible + * (possibly from shared libraries) they may exist in + * different forms. On platforms that support it the + * ASN1_ITEM structure itself will be globally exported. + * Other platforms will export a function that returns + * an ASN1_ITEM pointer. + * + * To handle both cases transparently the macros below + * should be used instead of hard coding an ASN1_ITEM + * pointer in a structure. + * + * The structure will look like this: + * + * typedef struct SOMETHING_st { + * ... + * ASN1_ITEM_EXP *iptr; + * ... + * } SOMETHING; + * + * It would be initialised as e.g.: + * + * SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...}; + * + * and the actual pointer extracted with: + * + * const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr); + * + * Finally an ASN1_ITEM pointer can be extracted from an + * appropriate reference with: ASN1_ITEM_rptr(X509). This + * would be used when a function takes an ASN1_ITEM * argument. + * + */ + +#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION + +/* ASN1_ITEM pointer exported type */ +typedef const ASN1_ITEM ASN1_ITEM_EXP; + +/* Macro to obtain ASN1_ITEM pointer from exported type */ +#define ASN1_ITEM_ptr(iptr) (iptr) + +/* Macro to include ASN1_ITEM pointer from base type */ +#define ASN1_ITEM_ref(iptr) (&(iptr##_it)) + +#define ASN1_ITEM_rptr(ref) (&(ref##_it)) + +#define DECLARE_ASN1_ITEM(name) OPENSSL_EXTERN const ASN1_ITEM name##_it; + +#else + +/* + * Platforms that can't easily handle shared global variables are declared as + * functions returning ASN1_ITEM pointers. + */ + +/* ASN1_ITEM pointer exported type */ +typedef const ASN1_ITEM* ASN1_ITEM_EXP(void); + +/* Macro to obtain ASN1_ITEM pointer from exported type */ +#define ASN1_ITEM_ptr(iptr) (iptr()) + +/* Macro to include ASN1_ITEM pointer from base type */ +#define ASN1_ITEM_ref(iptr) (iptr##_it) + +#define ASN1_ITEM_rptr(ref) (ref##_it()) + +#define DECLARE_ASN1_ITEM(name) const ASN1_ITEM* name##_it(void); + +#endif + +/* Parameters used by ASN1_STRING_print_ex() */ + +/* + * These determine which characters to escape: RFC2253 special characters, + * control characters and MSB set characters + */ + +#define ASN1_STRFLGS_ESC_2253 1 +#define ASN1_STRFLGS_ESC_CTRL 2 +#define ASN1_STRFLGS_ESC_MSB 4 + +/* + * This flag determines how we do escaping: normally RC2253 backslash only, + * set this to use backslash and quote. + */ + +#define ASN1_STRFLGS_ESC_QUOTE 8 + +/* These three flags are internal use only. */ + +/* Character is a valid PrintableString character */ +#define CHARTYPE_PRINTABLESTRING 0x10 +/* Character needs escaping if it is the first character */ +#define CHARTYPE_FIRST_ESC_2253 0x20 +/* Character needs escaping if it is the last character */ +#define CHARTYPE_LAST_ESC_2253 0x40 + +/* + * NB the internal flags are safely reused below by flags handled at the top + * level. + */ + +/* + * If this is set we convert all character strings to UTF8 first + */ + +#define ASN1_STRFLGS_UTF8_CONVERT 0x10 + +/* + * If this is set we don't attempt to interpret content: just assume all + * strings are 1 byte per character. This will produce some pretty odd + * looking output! + */ + +#define ASN1_STRFLGS_IGNORE_TYPE 0x20 + +/* If this is set we include the string type in the output */ +#define ASN1_STRFLGS_SHOW_TYPE 0x40 + +/* + * This determines which strings to display and which to 'dump' (hex dump of + * content octets or DER encoding). We can only dump non character strings or + * everything. If we don't dump 'unknown' they are interpreted as character + * strings with 1 octet per character and are subject to the usual escaping + * options. + */ + +#define ASN1_STRFLGS_DUMP_ALL 0x80 +#define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 + +/* + * These determine what 'dumping' does, we can dump the content octets or the + * DER encoding: both use the RFC2253 #XXXXX notation. + */ + +#define ASN1_STRFLGS_DUMP_DER 0x200 + +/* + * All the string flags consistent with RFC2253, escaping control characters + * isn't essential in RFC2253 but it is advisable anyway. + */ + +#define ASN1_STRFLGS_RFC2253 \ + (ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | \ + ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN | \ + ASN1_STRFLGS_DUMP_DER) + +DECLARE_STACK_OF(ASN1_INTEGER) +DECLARE_ASN1_SET_OF(ASN1_INTEGER) + +DECLARE_STACK_OF(ASN1_GENERALSTRING) + +typedef struct asn1_type_st { + int type; + union { + char* ptr; + ASN1_BOOLEAN boolean; + ASN1_STRING* asn1_string; + ASN1_OBJECT* object; + ASN1_INTEGER* integer; + ASN1_ENUMERATED* enumerated; + ASN1_BIT_STRING* bit_string; + ASN1_OCTET_STRING* octet_string; + ASN1_PRINTABLESTRING* printablestring; + ASN1_T61STRING* t61string; + ASN1_IA5STRING* ia5string; + ASN1_GENERALSTRING* generalstring; + ASN1_BMPSTRING* bmpstring; + ASN1_UNIVERSALSTRING* universalstring; + ASN1_UTCTIME* utctime; + ASN1_GENERALIZEDTIME* generalizedtime; + ASN1_VISIBLESTRING* visiblestring; + ASN1_UTF8STRING* utf8string; + /* + * set and sequence are left complete and still contain the set or + * sequence bytes + */ + ASN1_STRING* set; + ASN1_STRING* sequence; + ASN1_VALUE* asn1_value; + } value; +} ASN1_TYPE; + +DECLARE_STACK_OF(ASN1_TYPE) +DECLARE_ASN1_SET_OF(ASN1_TYPE) + +typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY; + +DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY) + DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY) + + typedef struct NETSCAPE_X509_st { + ASN1_OCTET_STRING* header; + X509* cert; +} NETSCAPE_X509; + +/* This is used to contain a list of bit names */ +typedef struct BIT_STRING_BITNAME_st { + int bitnum; + const char* lname; + const char* sname; +} BIT_STRING_BITNAME; + +#define M_ASN1_STRING_length(x) ((x)->length) +#define M_ASN1_STRING_length_set(x, n) ((x)->length = (n)) +#define M_ASN1_STRING_type(x) ((x)->type) +#define M_ASN1_STRING_data(x) ((x)->data) + +/* Macros for string operations */ +#define M_ASN1_BIT_STRING_new() \ + (ASN1_BIT_STRING*)ASN1_STRING_type_new(V_ASN1_BIT_STRING) +#define M_ASN1_BIT_STRING_free(a) ASN1_STRING_free((ASN1_STRING*)a) +#define M_ASN1_BIT_STRING_dup(a) \ + (ASN1_BIT_STRING*)ASN1_STRING_dup((const ASN1_STRING*)a) +#define M_ASN1_BIT_STRING_cmp(a, b) \ + ASN1_STRING_cmp((const ASN1_STRING*)a, (const ASN1_STRING*)b) +#define M_ASN1_BIT_STRING_set(a, b, c) ASN1_STRING_set((ASN1_STRING*)a, b, c) + +#define M_ASN1_INTEGER_new() (ASN1_INTEGER*)ASN1_STRING_type_new(V_ASN1_INTEGER) +#define M_ASN1_INTEGER_free(a) ASN1_STRING_free((ASN1_STRING*)a) +#define M_ASN1_INTEGER_dup(a) \ + (ASN1_INTEGER*)ASN1_STRING_dup((const ASN1_STRING*)a) +#define M_ASN1_INTEGER_cmp(a, b) \ + ASN1_STRING_cmp((const ASN1_STRING*)a, (const ASN1_STRING*)b) + +#define M_ASN1_ENUMERATED_new() \ + (ASN1_ENUMERATED*)ASN1_STRING_type_new(V_ASN1_ENUMERATED) +#define M_ASN1_ENUMERATED_free(a) ASN1_STRING_free((ASN1_STRING*)a) +#define M_ASN1_ENUMERATED_dup(a) \ + (ASN1_ENUMERATED*)ASN1_STRING_dup((const ASN1_STRING*)a) +#define M_ASN1_ENUMERATED_cmp(a, b) \ + ASN1_STRING_cmp((const ASN1_STRING*)a, (const ASN1_STRING*)b) + +#define M_ASN1_OCTET_STRING_new() \ + (ASN1_OCTET_STRING*)ASN1_STRING_type_new(V_ASN1_OCTET_STRING) +#define M_ASN1_OCTET_STRING_free(a) ASN1_STRING_free((ASN1_STRING*)a) +#define M_ASN1_OCTET_STRING_dup(a) \ + (ASN1_OCTET_STRING*)ASN1_STRING_dup((const ASN1_STRING*)a) +#define M_ASN1_OCTET_STRING_cmp(a, b) \ + ASN1_STRING_cmp((const ASN1_STRING*)a, (const ASN1_STRING*)b) +#define M_ASN1_OCTET_STRING_set(a, b, c) ASN1_STRING_set((ASN1_STRING*)a, b, c) +#define M_ASN1_OCTET_STRING_print(a, b) ASN1_STRING_print(a, (ASN1_STRING*)b) +#define M_i2d_ASN1_OCTET_STRING(a, pp) \ + i2d_ASN1_bytes((ASN1_STRING*)a, pp, V_ASN1_OCTET_STRING, V_ASN1_UNIVERSAL) + +#define B_ASN1_TIME B_ASN1_UTCTIME | B_ASN1_GENERALIZEDTIME + +#define B_ASN1_PRINTABLE \ + B_ASN1_NUMERICSTRING | B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | \ + B_ASN1_IA5STRING | B_ASN1_BIT_STRING | B_ASN1_UNIVERSALSTRING | \ + B_ASN1_BMPSTRING | B_ASN1_UTF8STRING | B_ASN1_SEQUENCE | B_ASN1_UNKNOWN + +#define B_ASN1_DIRECTORYSTRING \ + B_ASN1_PRINTABLESTRING | B_ASN1_TELETEXSTRING | B_ASN1_BMPSTRING | \ + B_ASN1_UNIVERSALSTRING | B_ASN1_UTF8STRING + +#define B_ASN1_DISPLAYTEXT \ + B_ASN1_IA5STRING | B_ASN1_VISIBLESTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING + +#define M_ASN1_PRINTABLE_new() ASN1_STRING_type_new(V_ASN1_T61STRING) +#define M_ASN1_PRINTABLE_free(a) ASN1_STRING_free((ASN1_STRING*)a) +#define M_i2d_ASN1_PRINTABLE(a, pp) \ + i2d_ASN1_bytes((ASN1_STRING*)a, pp, a->type, V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_PRINTABLE(a, pp, l) \ + d2i_ASN1_type_bytes((ASN1_STRING**)a, pp, l, B_ASN1_PRINTABLE) + +#define M_DIRECTORYSTRING_new() ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING) +#define M_DIRECTORYSTRING_free(a) ASN1_STRING_free((ASN1_STRING*)a) +#define M_i2d_DIRECTORYSTRING(a, pp) \ + i2d_ASN1_bytes((ASN1_STRING*)a, pp, a->type, V_ASN1_UNIVERSAL) +#define M_d2i_DIRECTORYSTRING(a, pp, l) \ + d2i_ASN1_type_bytes((ASN1_STRING**)a, pp, l, B_ASN1_DIRECTORYSTRING) + +#define M_DISPLAYTEXT_new() ASN1_STRING_type_new(V_ASN1_VISIBLESTRING) +#define M_DISPLAYTEXT_free(a) ASN1_STRING_free((ASN1_STRING*)a) +#define M_i2d_DISPLAYTEXT(a, pp) \ + i2d_ASN1_bytes((ASN1_STRING*)a, pp, a->type, V_ASN1_UNIVERSAL) +#define M_d2i_DISPLAYTEXT(a, pp, l) \ + d2i_ASN1_type_bytes((ASN1_STRING**)a, pp, l, B_ASN1_DISPLAYTEXT) + +#define M_ASN1_PRINTABLESTRING_new() \ + (ASN1_PRINTABLESTRING*)ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING) +#define M_ASN1_PRINTABLESTRING_free(a) ASN1_STRING_free((ASN1_STRING*)a) +#define M_i2d_ASN1_PRINTABLESTRING(a, pp) \ + i2d_ASN1_bytes((ASN1_STRING*)a, pp, V_ASN1_PRINTABLESTRING, V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_PRINTABLESTRING(a, pp, l) \ + (ASN1_PRINTABLESTRING*)d2i_ASN1_type_bytes( \ + (ASN1_STRING**)a, pp, l, B_ASN1_PRINTABLESTRING) + +#define M_ASN1_T61STRING_new() \ + (ASN1_T61STRING*)ASN1_STRING_type_new(V_ASN1_T61STRING) +#define M_ASN1_T61STRING_free(a) ASN1_STRING_free((ASN1_STRING*)a) +#define M_i2d_ASN1_T61STRING(a, pp) \ + i2d_ASN1_bytes((ASN1_STRING*)a, pp, V_ASN1_T61STRING, V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_T61STRING(a, pp, l) \ + (ASN1_T61STRING*)d2i_ASN1_type_bytes( \ + (ASN1_STRING**)a, pp, l, B_ASN1_T61STRING) + +#define M_ASN1_IA5STRING_new() \ + (ASN1_IA5STRING*)ASN1_STRING_type_new(V_ASN1_IA5STRING) +#define M_ASN1_IA5STRING_free(a) ASN1_STRING_free((ASN1_STRING*)a) +#define M_ASN1_IA5STRING_dup(a) \ + (ASN1_IA5STRING*)ASN1_STRING_dup((const ASN1_STRING*)a) +#define M_i2d_ASN1_IA5STRING(a, pp) \ + i2d_ASN1_bytes((ASN1_STRING*)a, pp, V_ASN1_IA5STRING, V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_IA5STRING(a, pp, l) \ + (ASN1_IA5STRING*)d2i_ASN1_type_bytes( \ + (ASN1_STRING**)a, pp, l, B_ASN1_IA5STRING) + +#define M_ASN1_UTCTIME_new() (ASN1_UTCTIME*)ASN1_STRING_type_new(V_ASN1_UTCTIME) +#define M_ASN1_UTCTIME_free(a) ASN1_STRING_free((ASN1_STRING*)a) +#define M_ASN1_UTCTIME_dup(a) \ + (ASN1_UTCTIME*)ASN1_STRING_dup((const ASN1_STRING*)a) + +#define M_ASN1_GENERALIZEDTIME_new() \ + (ASN1_GENERALIZEDTIME*)ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME) +#define M_ASN1_GENERALIZEDTIME_free(a) ASN1_STRING_free((ASN1_STRING*)a) +#define M_ASN1_GENERALIZEDTIME_dup(a) \ + (ASN1_GENERALIZEDTIME*)ASN1_STRING_dup((const ASN1_STRING*)a) + +#define M_ASN1_TIME_new() (ASN1_TIME*)ASN1_STRING_type_new(V_ASN1_UTCTIME) +#define M_ASN1_TIME_free(a) ASN1_STRING_free((ASN1_STRING*)a) +#define M_ASN1_TIME_dup(a) (ASN1_TIME*)ASN1_STRING_dup((const ASN1_STRING*)a) + +#define M_ASN1_GENERALSTRING_new() \ + (ASN1_GENERALSTRING*)ASN1_STRING_type_new(V_ASN1_GENERALSTRING) +#define M_ASN1_GENERALSTRING_free(a) ASN1_STRING_free((ASN1_STRING*)a) +#define M_i2d_ASN1_GENERALSTRING(a, pp) \ + i2d_ASN1_bytes((ASN1_STRING*)a, pp, V_ASN1_GENERALSTRING, V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_GENERALSTRING(a, pp, l) \ + (ASN1_GENERALSTRING*)d2i_ASN1_type_bytes( \ + (ASN1_STRING**)a, pp, l, B_ASN1_GENERALSTRING) + +#define M_ASN1_UNIVERSALSTRING_new() \ + (ASN1_UNIVERSALSTRING*)ASN1_STRING_type_new(V_ASN1_UNIVERSALSTRING) +#define M_ASN1_UNIVERSALSTRING_free(a) ASN1_STRING_free((ASN1_STRING*)a) +#define M_i2d_ASN1_UNIVERSALSTRING(a, pp) \ + i2d_ASN1_bytes((ASN1_STRING*)a, pp, V_ASN1_UNIVERSALSTRING, V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_UNIVERSALSTRING(a, pp, l) \ + (ASN1_UNIVERSALSTRING*)d2i_ASN1_type_bytes( \ + (ASN1_STRING**)a, pp, l, B_ASN1_UNIVERSALSTRING) + +#define M_ASN1_BMPSTRING_new() \ + (ASN1_BMPSTRING*)ASN1_STRING_type_new(V_ASN1_BMPSTRING) +#define M_ASN1_BMPSTRING_free(a) ASN1_STRING_free((ASN1_STRING*)a) +#define M_i2d_ASN1_BMPSTRING(a, pp) \ + i2d_ASN1_bytes((ASN1_STRING*)a, pp, V_ASN1_BMPSTRING, V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_BMPSTRING(a, pp, l) \ + (ASN1_BMPSTRING*)d2i_ASN1_type_bytes( \ + (ASN1_STRING**)a, pp, l, B_ASN1_BMPSTRING) + +#define M_ASN1_VISIBLESTRING_new() \ + (ASN1_VISIBLESTRING*)ASN1_STRING_type_new(V_ASN1_VISIBLESTRING) +#define M_ASN1_VISIBLESTRING_free(a) ASN1_STRING_free((ASN1_STRING*)a) +#define M_i2d_ASN1_VISIBLESTRING(a, pp) \ + i2d_ASN1_bytes((ASN1_STRING*)a, pp, V_ASN1_VISIBLESTRING, V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_VISIBLESTRING(a, pp, l) \ + (ASN1_VISIBLESTRING*)d2i_ASN1_type_bytes( \ + (ASN1_STRING**)a, pp, l, B_ASN1_VISIBLESTRING) + +#define M_ASN1_UTF8STRING_new() \ + (ASN1_UTF8STRING*)ASN1_STRING_type_new(V_ASN1_UTF8STRING) +#define M_ASN1_UTF8STRING_free(a) ASN1_STRING_free((ASN1_STRING*)a) +#define M_i2d_ASN1_UTF8STRING(a, pp) \ + i2d_ASN1_bytes((ASN1_STRING*)a, pp, V_ASN1_UTF8STRING, V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_UTF8STRING(a, pp, l) \ + (ASN1_UTF8STRING*)d2i_ASN1_type_bytes( \ + (ASN1_STRING**)a, pp, l, B_ASN1_UTF8STRING) + +/* for the is_set parameter to i2d_ASN1_SET */ +#define IS_SEQUENCE 0 +#define IS_SET 1 + +DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE) + + int ASN1_TYPE_get(ASN1_TYPE* a); +void ASN1_TYPE_set(ASN1_TYPE* a, int type, void* value); +int ASN1_TYPE_set1(ASN1_TYPE* a, int type, const void* value); +int ASN1_TYPE_cmp(const ASN1_TYPE* a, const ASN1_TYPE* b); + +ASN1_OBJECT* ASN1_OBJECT_new(void); +void ASN1_OBJECT_free(ASN1_OBJECT* a); +int i2d_ASN1_OBJECT(ASN1_OBJECT* a, unsigned char** pp); +ASN1_OBJECT* +c2i_ASN1_OBJECT(ASN1_OBJECT** a, const unsigned char** pp, long length); +ASN1_OBJECT* +d2i_ASN1_OBJECT(ASN1_OBJECT** a, const unsigned char** pp, long length); + +DECLARE_ASN1_ITEM(ASN1_OBJECT) + +DECLARE_STACK_OF(ASN1_OBJECT) +DECLARE_ASN1_SET_OF(ASN1_OBJECT) + +ASN1_STRING* ASN1_STRING_new(void); +void ASN1_STRING_free(ASN1_STRING* a); +void ASN1_STRING_clear_free(ASN1_STRING* a); +int ASN1_STRING_copy(ASN1_STRING* dst, const ASN1_STRING* str); +ASN1_STRING* ASN1_STRING_dup(const ASN1_STRING* a); +ASN1_STRING* ASN1_STRING_type_new(int type); +int ASN1_STRING_cmp(const ASN1_STRING* a, const ASN1_STRING* b); +/* + * Since this is used to store all sorts of things, via macros, for now, + * make its data void * + */ +int ASN1_STRING_set(ASN1_STRING* str, const void* data, int len); +void ASN1_STRING_set0(ASN1_STRING* str, void* data, int len); +int ASN1_STRING_length(const ASN1_STRING* x); +void ASN1_STRING_length_set(ASN1_STRING* x, int n); +int ASN1_STRING_type(ASN1_STRING* x); +unsigned char* ASN1_STRING_data(ASN1_STRING* x); + +DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING) +int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING* a, unsigned char** pp); +ASN1_BIT_STRING* +c2i_ASN1_BIT_STRING(ASN1_BIT_STRING** a, const unsigned char** pp, long length); +int ASN1_BIT_STRING_set(ASN1_BIT_STRING* a, unsigned char* d, int length); +int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING* a, int n, int value); +int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING* a, int n); +int ASN1_BIT_STRING_check( + ASN1_BIT_STRING* a, + unsigned char* flags, + int flags_len); + +#ifndef OPENSSL_NO_BIO +int ASN1_BIT_STRING_name_print( + BIO* out, + ASN1_BIT_STRING* bs, + BIT_STRING_BITNAME* tbl, + int indent); +#endif +int ASN1_BIT_STRING_num_asc(char* name, BIT_STRING_BITNAME* tbl); +int ASN1_BIT_STRING_set_asc( + ASN1_BIT_STRING* bs, + char* name, + int value, + BIT_STRING_BITNAME* tbl); + +int i2d_ASN1_BOOLEAN(int a, unsigned char** pp); +int d2i_ASN1_BOOLEAN(int* a, const unsigned char** pp, long length); + +DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER) +int i2c_ASN1_INTEGER(ASN1_INTEGER* a, unsigned char** pp); +ASN1_INTEGER* +c2i_ASN1_INTEGER(ASN1_INTEGER** a, const unsigned char** pp, long length); +ASN1_INTEGER* +d2i_ASN1_UINTEGER(ASN1_INTEGER** a, const unsigned char** pp, long length); +ASN1_INTEGER* ASN1_INTEGER_dup(const ASN1_INTEGER* x); +int ASN1_INTEGER_cmp(const ASN1_INTEGER* x, const ASN1_INTEGER* y); + +DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED) + +int ASN1_UTCTIME_check(const ASN1_UTCTIME* a); +ASN1_UTCTIME* ASN1_UTCTIME_set(ASN1_UTCTIME* s, time_t t); +ASN1_UTCTIME* +ASN1_UTCTIME_adj(ASN1_UTCTIME* s, time_t t, int offset_day, long offset_sec); +int ASN1_UTCTIME_set_string(ASN1_UTCTIME* s, const char* str); +int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME* s, time_t t); +#if 0 +time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s); +#endif + +int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME* a); +ASN1_GENERALIZEDTIME* ASN1_GENERALIZEDTIME_set( + ASN1_GENERALIZEDTIME* s, + time_t t); +ASN1_GENERALIZEDTIME* ASN1_GENERALIZEDTIME_adj( + ASN1_GENERALIZEDTIME* s, + time_t t, + int offset_day, + long offset_sec); +int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME* s, const char* str); +int ASN1_TIME_diff( + int* pday, + int* psec, + const ASN1_TIME* from, + const ASN1_TIME* to); + +DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING) +ASN1_OCTET_STRING* ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING* a); +int ASN1_OCTET_STRING_cmp( + const ASN1_OCTET_STRING* a, + const ASN1_OCTET_STRING* b); +int ASN1_OCTET_STRING_set( + ASN1_OCTET_STRING* str, + const unsigned char* data, + int len); + +DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING) +DECLARE_ASN1_FUNCTIONS(ASN1_NULL) +DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING) + +int UTF8_getc(const unsigned char* str, int len, unsigned long* val); +int UTF8_putc(unsigned char* str, int len, unsigned long value); + +DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE) + + DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING) + DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT) + DECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING) DECLARE_ASN1_FUNCTIONS( + ASN1_T61STRING) DECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING) + DECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING) + DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME) DECLARE_ASN1_FUNCTIONS( + ASN1_GENERALIZEDTIME) DECLARE_ASN1_FUNCTIONS(ASN1_TIME) + + DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF) + + ASN1_TIME* ASN1_TIME_set(ASN1_TIME* s, time_t t); +ASN1_TIME* +ASN1_TIME_adj(ASN1_TIME* s, time_t t, int offset_day, long offset_sec); +int ASN1_TIME_check(ASN1_TIME* t); +ASN1_GENERALIZEDTIME* ASN1_TIME_to_generalizedtime( + ASN1_TIME* t, + ASN1_GENERALIZEDTIME** out); +int ASN1_TIME_set_string(ASN1_TIME* s, const char* str); + +int i2d_ASN1_SET( + STACK_OF(OPENSSL_BLOCK) * a, + unsigned char** pp, + i2d_of_void* i2d, + int ex_tag, + int ex_class, + int is_set); +STACK_OF(OPENSSL_BLOCK) * d2i_ASN1_SET( + STACK_OF(OPENSSL_BLOCK) * *a, + const unsigned char** pp, + long length, + d2i_of_void* d2i, + void (*free_func)(OPENSSL_BLOCK), + int ex_tag, + int ex_class); + +#ifndef OPENSSL_NO_BIO +int i2a_ASN1_INTEGER(BIO* bp, ASN1_INTEGER* a); +int a2i_ASN1_INTEGER(BIO* bp, ASN1_INTEGER* bs, char* buf, int size); +int i2a_ASN1_ENUMERATED(BIO* bp, ASN1_ENUMERATED* a); +int a2i_ASN1_ENUMERATED(BIO* bp, ASN1_ENUMERATED* bs, char* buf, int size); +int i2a_ASN1_OBJECT(BIO* bp, ASN1_OBJECT* a); +int a2i_ASN1_STRING(BIO* bp, ASN1_STRING* bs, char* buf, int size); +int i2a_ASN1_STRING(BIO* bp, ASN1_STRING* a, int type); +#endif +int i2t_ASN1_OBJECT(char* buf, int buf_len, ASN1_OBJECT* a); + +int a2d_ASN1_OBJECT(unsigned char* out, int olen, const char* buf, int num); +ASN1_OBJECT* ASN1_OBJECT_create( + int nid, + unsigned char* data, + int len, + const char* sn, + const char* ln); + +int ASN1_INTEGER_set(ASN1_INTEGER* a, long v); +long ASN1_INTEGER_get(const ASN1_INTEGER* a); +ASN1_INTEGER* BN_to_ASN1_INTEGER(const BIGNUM* bn, ASN1_INTEGER* ai); +BIGNUM* ASN1_INTEGER_to_BN(const ASN1_INTEGER* ai, BIGNUM* bn); + +int ASN1_ENUMERATED_set(ASN1_ENUMERATED* a, long v); +long ASN1_ENUMERATED_get(ASN1_ENUMERATED* a); +ASN1_ENUMERATED* BN_to_ASN1_ENUMERATED(BIGNUM* bn, ASN1_ENUMERATED* ai); +BIGNUM* ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED* ai, BIGNUM* bn); + +/* General */ +/* given a string, return the correct type, max is the maximum length */ +int ASN1_PRINTABLE_type(const unsigned char* s, int max); + +int i2d_ASN1_bytes(ASN1_STRING* a, unsigned char** pp, int tag, int xclass); +ASN1_STRING* d2i_ASN1_bytes( + ASN1_STRING** a, + const unsigned char** pp, + long length, + int Ptag, + int Pclass); +unsigned long ASN1_tag2bit(int tag); +/* type is one or more of the B_ASN1_ values. */ +ASN1_STRING* d2i_ASN1_type_bytes( + ASN1_STRING** a, + const unsigned char** pp, + long length, + int type); + +/* PARSING */ +int asn1_Finish(ASN1_CTX* c); +int asn1_const_Finish(ASN1_const_CTX* c); + +/* SPECIALS */ +int ASN1_get_object( + const unsigned char** pp, + long* plength, + int* ptag, + int* pclass, + long omax); +int ASN1_check_infinite_end(unsigned char** p, long len); +int ASN1_const_check_infinite_end(const unsigned char** p, long len); +void ASN1_put_object( + unsigned char** pp, + int constructed, + int length, + int tag, + int xclass); +int ASN1_put_eoc(unsigned char** pp); +int ASN1_object_size(int constructed, int length, int tag); + +/* Used to implement other functions */ +void* ASN1_dup(i2d_of_void* i2d, d2i_of_void* d2i, void* x); + +#define ASN1_dup_of(type, i2d, d2i, x) \ + ((type*)ASN1_dup( \ + CHECKED_I2D_OF(type, i2d), \ + CHECKED_D2I_OF(type, d2i), \ + CHECKED_PTR_OF(type, x))) + +#define ASN1_dup_of_const(type, i2d, d2i, x) \ + ((type*)ASN1_dup( \ + CHECKED_I2D_OF(const type, i2d), \ + CHECKED_D2I_OF(type, d2i), \ + CHECKED_PTR_OF(const type, x))) + +void* ASN1_item_dup(const ASN1_ITEM* it, void* x); + +/* ASN1 alloc/free macros for when a type is only used internally */ + +#define M_ASN1_new_of(type) (type*)ASN1_item_new(ASN1_ITEM_rptr(type)) +#define M_ASN1_free_of(x, type) \ + ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type)) + +#ifndef OPENSSL_NO_FP_API +void* ASN1_d2i_fp(void* (*xnew)(void), d2i_of_void* d2i, FILE* in, void** x); + +#define ASN1_d2i_fp_of(type, xnew, d2i, in, x) \ + ((type*)ASN1_d2i_fp( \ + CHECKED_NEW_OF(type, xnew), \ + CHECKED_D2I_OF(type, d2i), \ + in, \ + CHECKED_PPTR_OF(type, x))) + +void* ASN1_item_d2i_fp(const ASN1_ITEM* it, FILE* in, void* x); +int ASN1_i2d_fp(i2d_of_void* i2d, FILE* out, void* x); + +#define ASN1_i2d_fp_of(type, i2d, out, x) \ + (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), out, CHECKED_PTR_OF(type, x))) + +#define ASN1_i2d_fp_of_const(type, i2d, out, x) \ + (ASN1_i2d_fp( \ + CHECKED_I2D_OF(const type, i2d), out, CHECKED_PTR_OF(const type, x))) + +int ASN1_item_i2d_fp(const ASN1_ITEM* it, FILE* out, void* x); +int ASN1_STRING_print_ex_fp(FILE* fp, ASN1_STRING* str, unsigned long flags); +#endif + +int ASN1_STRING_to_UTF8(unsigned char** out, ASN1_STRING* in); + +#ifndef OPENSSL_NO_BIO +void* ASN1_d2i_bio(void* (*xnew)(void), d2i_of_void* d2i, BIO* in, void** x); + +#define ASN1_d2i_bio_of(type, xnew, d2i, in, x) \ + ((type*)ASN1_d2i_bio( \ + CHECKED_NEW_OF(type, xnew), \ + CHECKED_D2I_OF(type, d2i), \ + in, \ + CHECKED_PPTR_OF(type, x))) + +void* ASN1_item_d2i_bio(const ASN1_ITEM* it, BIO* in, void* x); +int ASN1_i2d_bio(i2d_of_void* i2d, BIO* out, unsigned char* x); + +#define ASN1_i2d_bio_of(type, i2d, out, x) \ + (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), out, CHECKED_PTR_OF(type, x))) + +#define ASN1_i2d_bio_of_const(type, i2d, out, x) \ + (ASN1_i2d_bio( \ + CHECKED_I2D_OF(const type, i2d), out, CHECKED_PTR_OF(const type, x))) + +int ASN1_item_i2d_bio(const ASN1_ITEM* it, BIO* out, void* x); +int ASN1_UTCTIME_print(BIO* fp, const ASN1_UTCTIME* a); +int ASN1_GENERALIZEDTIME_print(BIO* fp, const ASN1_GENERALIZEDTIME* a); +int ASN1_TIME_print(BIO* fp, const ASN1_TIME* a); +int ASN1_STRING_print(BIO* bp, const ASN1_STRING* v); +int ASN1_STRING_print_ex(BIO* out, ASN1_STRING* str, unsigned long flags); +int ASN1_bn_print( + BIO* bp, + const char* number, + const BIGNUM* num, + unsigned char* buf, + int off); +int ASN1_parse(BIO* bp, const unsigned char* pp, long len, int indent); +int ASN1_parse_dump( + BIO* bp, + const unsigned char* pp, + long len, + int indent, + int dump); +#endif +const char* ASN1_tag2str(int tag); + +/* Used to load and write netscape format cert */ + +DECLARE_ASN1_FUNCTIONS(NETSCAPE_X509) + +int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING* s); + +int ASN1_TYPE_set_octetstring(ASN1_TYPE* a, unsigned char* data, int len); +int ASN1_TYPE_get_octetstring(ASN1_TYPE* a, unsigned char* data, int max_len); +int ASN1_TYPE_set_int_octetstring( + ASN1_TYPE* a, + long num, + unsigned char* data, + int len); +int ASN1_TYPE_get_int_octetstring( + ASN1_TYPE* a, + long* num, + unsigned char* data, + int max_len); + +STACK_OF(OPENSSL_BLOCK) * ASN1_seq_unpack( + const unsigned char* buf, + int len, + d2i_of_void* d2i, + void (*free_func)(OPENSSL_BLOCK)); +unsigned char* ASN1_seq_pack( + STACK_OF(OPENSSL_BLOCK) * safes, + i2d_of_void* i2d, + unsigned char** buf, + int* len); +void* ASN1_unpack_string(ASN1_STRING* oct, d2i_of_void* d2i); +void* ASN1_item_unpack(ASN1_STRING* oct, const ASN1_ITEM* it); +ASN1_STRING* +ASN1_pack_string(void* obj, i2d_of_void* i2d, ASN1_OCTET_STRING** oct); + +#define ASN1_pack_string_of(type, obj, i2d, oct) \ + (ASN1_pack_string(CHECKED_PTR_OF(type, obj), CHECKED_I2D_OF(type, i2d), oct)) + +ASN1_STRING* +ASN1_item_pack(void* obj, const ASN1_ITEM* it, ASN1_OCTET_STRING** oct); + +void ASN1_STRING_set_default_mask(unsigned long mask); +int ASN1_STRING_set_default_mask_asc(const char* p); +unsigned long ASN1_STRING_get_default_mask(void); +int ASN1_mbstring_copy( + ASN1_STRING** out, + const unsigned char* in, + int len, + int inform, + unsigned long mask); +int ASN1_mbstring_ncopy( + ASN1_STRING** out, + const unsigned char* in, + int len, + int inform, + unsigned long mask, + long minsize, + long maxsize); + +ASN1_STRING* ASN1_STRING_set_by_NID( + ASN1_STRING** out, + const unsigned char* in, + int inlen, + int inform, + int nid); +ASN1_STRING_TABLE* ASN1_STRING_TABLE_get(int nid); +int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long); +void ASN1_STRING_TABLE_cleanup(void); + +/* ASN1 template functions */ + +/* Old API compatible functions */ +ASN1_VALUE* ASN1_item_new(const ASN1_ITEM* it); +void ASN1_item_free(ASN1_VALUE* val, const ASN1_ITEM* it); +ASN1_VALUE* ASN1_item_d2i( + ASN1_VALUE** val, + const unsigned char** in, + long len, + const ASN1_ITEM* it); +int ASN1_item_i2d(ASN1_VALUE* val, unsigned char** out, const ASN1_ITEM* it); +int ASN1_item_ndef_i2d( + ASN1_VALUE* val, + unsigned char** out, + const ASN1_ITEM* it); + +void ASN1_add_oid_module(void); + +ASN1_TYPE* ASN1_generate_nconf(char* str, CONF* nconf); +ASN1_TYPE* ASN1_generate_v3(char* str, X509V3_CTX* cnf); + +/* ASN1 Print flags */ + +/* Indicate missing OPTIONAL fields */ +#define ASN1_PCTX_FLAGS_SHOW_ABSENT 0x001 +/* Mark start and end of SEQUENCE */ +#define ASN1_PCTX_FLAGS_SHOW_SEQUENCE 0x002 +/* Mark start and end of SEQUENCE/SET OF */ +#define ASN1_PCTX_FLAGS_SHOW_SSOF 0x004 +/* Show the ASN1 type of primitives */ +#define ASN1_PCTX_FLAGS_SHOW_TYPE 0x008 +/* Don't show ASN1 type of ANY */ +#define ASN1_PCTX_FLAGS_NO_ANY_TYPE 0x010 +/* Don't show ASN1 type of MSTRINGs */ +#define ASN1_PCTX_FLAGS_NO_MSTRING_TYPE 0x020 +/* Don't show field names in SEQUENCE */ +#define ASN1_PCTX_FLAGS_NO_FIELD_NAME 0x040 +/* Show structure names of each SEQUENCE field */ +#define ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME 0x080 +/* Don't show structure name even at top level */ +#define ASN1_PCTX_FLAGS_NO_STRUCT_NAME 0x100 + +int ASN1_item_print( + BIO* out, + ASN1_VALUE* ifld, + int indent, + const ASN1_ITEM* it, + const ASN1_PCTX* pctx); +ASN1_PCTX* ASN1_PCTX_new(void); +void ASN1_PCTX_free(ASN1_PCTX* p); +unsigned long ASN1_PCTX_get_flags(ASN1_PCTX* p); +void ASN1_PCTX_set_flags(ASN1_PCTX* p, unsigned long flags); +unsigned long ASN1_PCTX_get_nm_flags(ASN1_PCTX* p); +void ASN1_PCTX_set_nm_flags(ASN1_PCTX* p, unsigned long flags); +unsigned long ASN1_PCTX_get_cert_flags(ASN1_PCTX* p); +void ASN1_PCTX_set_cert_flags(ASN1_PCTX* p, unsigned long flags); +unsigned long ASN1_PCTX_get_oid_flags(ASN1_PCTX* p); +void ASN1_PCTX_set_oid_flags(ASN1_PCTX* p, unsigned long flags); +unsigned long ASN1_PCTX_get_str_flags(ASN1_PCTX* p); +void ASN1_PCTX_set_str_flags(ASN1_PCTX* p, unsigned long flags); + +BIO_METHOD* BIO_f_asn1(void); + +BIO* BIO_new_NDEF(BIO* out, ASN1_VALUE* val, const ASN1_ITEM* it); + +int i2d_ASN1_bio_stream( + BIO* out, + ASN1_VALUE* val, + BIO* in, + int flags, + const ASN1_ITEM* it); +int PEM_write_bio_ASN1_stream( + BIO* out, + ASN1_VALUE* val, + BIO* in, + int flags, + const char* hdr, + const ASN1_ITEM* it); +int SMIME_write_ASN1( + BIO* bio, + ASN1_VALUE* val, + BIO* data, + int flags, + int ctype_nid, + int econt_nid, + STACK_OF(X509_ALGOR) * mdalgs, + const ASN1_ITEM* it); +ASN1_VALUE* SMIME_read_ASN1(BIO* bio, BIO** bcont, const ASN1_ITEM* it); +int SMIME_crlf_copy(BIO* in, BIO* out, int flags); +int SMIME_text(BIO* in, BIO* out); + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_ASN1_strings(void); + +/* Error codes for the ASN1 functions. */ + +/* Function codes. */ +#define ASN1_F_A2D_ASN1_OBJECT 100 +#define ASN1_F_A2I_ASN1_ENUMERATED 101 +#define ASN1_F_A2I_ASN1_INTEGER 102 +#define ASN1_F_A2I_ASN1_STRING 103 +#define ASN1_F_APPEND_EXP 176 +#define ASN1_F_ASN1_BIT_STRING_SET_BIT 183 +#define ASN1_F_ASN1_CB 177 +#define ASN1_F_ASN1_CHECK_TLEN 104 +#define ASN1_F_ASN1_COLLATE_PRIMITIVE 105 +#define ASN1_F_ASN1_COLLECT 106 +#define ASN1_F_ASN1_D2I_EX_PRIMITIVE 108 +#define ASN1_F_ASN1_D2I_FP 109 +#define ASN1_F_ASN1_D2I_READ_BIO 107 +#define ASN1_F_ASN1_DIGEST 184 +#define ASN1_F_ASN1_DO_ADB 110 +#define ASN1_F_ASN1_DUP 111 +#define ASN1_F_ASN1_ENUMERATED_SET 112 +#define ASN1_F_ASN1_ENUMERATED_TO_BN 113 +#define ASN1_F_ASN1_EX_C2I 204 +#define ASN1_F_ASN1_FIND_END 190 +#define ASN1_F_ASN1_GENERALIZEDTIME_ADJ 216 +#define ASN1_F_ASN1_GENERALIZEDTIME_SET 185 +#define ASN1_F_ASN1_GENERATE_V3 178 +#define ASN1_F_ASN1_GET_OBJECT 114 +#define ASN1_F_ASN1_HEADER_NEW 115 +#define ASN1_F_ASN1_I2D_BIO 116 +#define ASN1_F_ASN1_I2D_FP 117 +#define ASN1_F_ASN1_INTEGER_SET 118 +#define ASN1_F_ASN1_INTEGER_TO_BN 119 +#define ASN1_F_ASN1_ITEM_D2I_FP 206 +#define ASN1_F_ASN1_ITEM_DUP 191 +#define ASN1_F_ASN1_ITEM_EX_COMBINE_NEW 121 +#define ASN1_F_ASN1_ITEM_EX_D2I 120 +#define ASN1_F_ASN1_ITEM_I2D_BIO 192 +#define ASN1_F_ASN1_ITEM_I2D_FP 193 +#define ASN1_F_ASN1_ITEM_PACK 198 +#define ASN1_F_ASN1_ITEM_SIGN 195 +#define ASN1_F_ASN1_ITEM_SIGN_CTX 220 +#define ASN1_F_ASN1_ITEM_UNPACK 199 +#define ASN1_F_ASN1_ITEM_VERIFY 197 +#define ASN1_F_ASN1_MBSTRING_NCOPY 122 +#define ASN1_F_ASN1_OBJECT_NEW 123 +#define ASN1_F_ASN1_OUTPUT_DATA 214 +#define ASN1_F_ASN1_PACK_STRING 124 +#define ASN1_F_ASN1_PCTX_NEW 205 +#define ASN1_F_ASN1_PKCS5_PBE_SET 125 +#define ASN1_F_ASN1_SEQ_PACK 126 +#define ASN1_F_ASN1_SEQ_UNPACK 127 +#define ASN1_F_ASN1_SIGN 128 +#define ASN1_F_ASN1_STR2TYPE 179 +#define ASN1_F_ASN1_STRING_SET 186 +#define ASN1_F_ASN1_STRING_TABLE_ADD 129 +#define ASN1_F_ASN1_STRING_TYPE_NEW 130 +#define ASN1_F_ASN1_TEMPLATE_EX_D2I 132 +#define ASN1_F_ASN1_TEMPLATE_NEW 133 +#define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I 131 +#define ASN1_F_ASN1_TIME_ADJ 217 +#define ASN1_F_ASN1_TIME_SET 175 +#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134 +#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135 +#define ASN1_F_ASN1_UNPACK_STRING 136 +#define ASN1_F_ASN1_UTCTIME_ADJ 218 +#define ASN1_F_ASN1_UTCTIME_SET 187 +#define ASN1_F_ASN1_VERIFY 137 +#define ASN1_F_B64_READ_ASN1 209 +#define ASN1_F_B64_WRITE_ASN1 210 +#define ASN1_F_BIO_NEW_NDEF 208 +#define ASN1_F_BITSTR_CB 180 +#define ASN1_F_BN_TO_ASN1_ENUMERATED 138 +#define ASN1_F_BN_TO_ASN1_INTEGER 139 +#define ASN1_F_C2I_ASN1_BIT_STRING 189 +#define ASN1_F_C2I_ASN1_INTEGER 194 +#define ASN1_F_C2I_ASN1_OBJECT 196 +#define ASN1_F_COLLECT_DATA 140 +#define ASN1_F_D2I_ASN1_BIT_STRING 141 +#define ASN1_F_D2I_ASN1_BOOLEAN 142 +#define ASN1_F_D2I_ASN1_BYTES 143 +#define ASN1_F_D2I_ASN1_GENERALIZEDTIME 144 +#define ASN1_F_D2I_ASN1_HEADER 145 +#define ASN1_F_D2I_ASN1_INTEGER 146 +#define ASN1_F_D2I_ASN1_OBJECT 147 +#define ASN1_F_D2I_ASN1_SET 148 +#define ASN1_F_D2I_ASN1_TYPE_BYTES 149 +#define ASN1_F_D2I_ASN1_UINTEGER 150 +#define ASN1_F_D2I_ASN1_UTCTIME 151 +#define ASN1_F_D2I_AUTOPRIVATEKEY 207 +#define ASN1_F_D2I_NETSCAPE_RSA 152 +#define ASN1_F_D2I_NETSCAPE_RSA_2 153 +#define ASN1_F_D2I_PRIVATEKEY 154 +#define ASN1_F_D2I_PUBLICKEY 155 +#define ASN1_F_D2I_RSA_NET 200 +#define ASN1_F_D2I_RSA_NET_2 201 +#define ASN1_F_D2I_X509 156 +#define ASN1_F_D2I_X509_CINF 157 +#define ASN1_F_D2I_X509_PKEY 159 +#define ASN1_F_I2D_ASN1_BIO_STREAM 211 +#define ASN1_F_I2D_ASN1_SET 188 +#define ASN1_F_I2D_ASN1_TIME 160 +#define ASN1_F_I2D_DSA_PUBKEY 161 +#define ASN1_F_I2D_EC_PUBKEY 181 +#define ASN1_F_I2D_PRIVATEKEY 163 +#define ASN1_F_I2D_PUBLICKEY 164 +#define ASN1_F_I2D_RSA_NET 162 +#define ASN1_F_I2D_RSA_PUBKEY 165 +#define ASN1_F_LONG_C2I 166 +#define ASN1_F_OID_MODULE_INIT 174 +#define ASN1_F_PARSE_TAGGING 182 +#define ASN1_F_PKCS5_PBE2_SET_IV 167 +#define ASN1_F_PKCS5_PBE_SET 202 +#define ASN1_F_PKCS5_PBE_SET0_ALGOR 215 +#define ASN1_F_PKCS5_PBKDF2_SET 219 +#define ASN1_F_SMIME_READ_ASN1 212 +#define ASN1_F_SMIME_TEXT 213 +#define ASN1_F_X509_CINF_NEW 168 +#define ASN1_F_X509_CRL_ADD0_REVOKED 169 +#define ASN1_F_X509_INFO_NEW 170 +#define ASN1_F_X509_NAME_ENCODE 203 +#define ASN1_F_X509_NAME_EX_D2I 158 +#define ASN1_F_X509_NAME_EX_NEW 171 +#define ASN1_F_X509_NEW 172 +#define ASN1_F_X509_PKEY_NEW 173 + +/* Reason codes. */ +#define ASN1_R_ADDING_OBJECT 171 +#define ASN1_R_ASN1_PARSE_ERROR 203 +#define ASN1_R_ASN1_SIG_PARSE_ERROR 204 +#define ASN1_R_AUX_ERROR 100 +#define ASN1_R_BAD_CLASS 101 +#define ASN1_R_BAD_OBJECT_HEADER 102 +#define ASN1_R_BAD_PASSWORD_READ 103 +#define ASN1_R_BAD_TAG 104 +#define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 214 +#define ASN1_R_BN_LIB 105 +#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106 +#define ASN1_R_BUFFER_TOO_SMALL 107 +#define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 108 +#define ASN1_R_CONTEXT_NOT_INITIALISED 217 +#define ASN1_R_DATA_IS_WRONG 109 +#define ASN1_R_DECODE_ERROR 110 +#define ASN1_R_DECODING_ERROR 111 +#define ASN1_R_DEPTH_EXCEEDED 174 +#define ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED 198 +#define ASN1_R_ENCODE_ERROR 112 +#define ASN1_R_ERROR_GETTING_TIME 173 +#define ASN1_R_ERROR_LOADING_SECTION 172 +#define ASN1_R_ERROR_PARSING_SET_ELEMENT 113 +#define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 114 +#define ASN1_R_EXPECTING_AN_INTEGER 115 +#define ASN1_R_EXPECTING_AN_OBJECT 116 +#define ASN1_R_EXPECTING_A_BOOLEAN 117 +#define ASN1_R_EXPECTING_A_TIME 118 +#define ASN1_R_EXPLICIT_LENGTH_MISMATCH 119 +#define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED 120 +#define ASN1_R_FIELD_MISSING 121 +#define ASN1_R_FIRST_NUM_TOO_LARGE 122 +#define ASN1_R_HEADER_TOO_LONG 123 +#define ASN1_R_ILLEGAL_BITSTRING_FORMAT 175 +#define ASN1_R_ILLEGAL_BOOLEAN 176 +#define ASN1_R_ILLEGAL_CHARACTERS 124 +#define ASN1_R_ILLEGAL_FORMAT 177 +#define ASN1_R_ILLEGAL_HEX 178 +#define ASN1_R_ILLEGAL_IMPLICIT_TAG 179 +#define ASN1_R_ILLEGAL_INTEGER 180 +#define ASN1_R_ILLEGAL_NESTED_TAGGING 181 +#define ASN1_R_ILLEGAL_NULL 125 +#define ASN1_R_ILLEGAL_NULL_VALUE 182 +#define ASN1_R_ILLEGAL_OBJECT 183 +#define ASN1_R_ILLEGAL_OPTIONAL_ANY 126 +#define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 170 +#define ASN1_R_ILLEGAL_TAGGED_ANY 127 +#define ASN1_R_ILLEGAL_TIME_VALUE 184 +#define ASN1_R_INTEGER_NOT_ASCII_FORMAT 185 +#define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128 +#define ASN1_R_INVALID_BIT_STRING_BITS_LEFT 220 +#define ASN1_R_INVALID_BMPSTRING_LENGTH 129 +#define ASN1_R_INVALID_DIGIT 130 +#define ASN1_R_INVALID_MIME_TYPE 205 +#define ASN1_R_INVALID_MODIFIER 186 +#define ASN1_R_INVALID_NUMBER 187 +#define ASN1_R_INVALID_OBJECT_ENCODING 216 +#define ASN1_R_INVALID_SEPARATOR 131 +#define ASN1_R_INVALID_TIME_FORMAT 132 +#define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133 +#define ASN1_R_INVALID_UTF8STRING 134 +#define ASN1_R_IV_TOO_LARGE 135 +#define ASN1_R_LENGTH_ERROR 136 +#define ASN1_R_LIST_ERROR 188 +#define ASN1_R_MIME_NO_CONTENT_TYPE 206 +#define ASN1_R_MIME_PARSE_ERROR 207 +#define ASN1_R_MIME_SIG_PARSE_ERROR 208 +#define ASN1_R_MISSING_EOC 137 +#define ASN1_R_MISSING_SECOND_NUMBER 138 +#define ASN1_R_MISSING_VALUE 189 +#define ASN1_R_MSTRING_NOT_UNIVERSAL 139 +#define ASN1_R_MSTRING_WRONG_TAG 140 +#define ASN1_R_NESTED_ASN1_STRING 197 +#define ASN1_R_NESTED_TOO_DEEP 219 +#define ASN1_R_NON_HEX_CHARACTERS 141 +#define ASN1_R_NOT_ASCII_FORMAT 190 +#define ASN1_R_NOT_ENOUGH_DATA 142 +#define ASN1_R_NO_CONTENT_TYPE 209 +#define ASN1_R_NO_DEFAULT_DIGEST 201 +#define ASN1_R_NO_MATCHING_CHOICE_TYPE 143 +#define ASN1_R_NO_MULTIPART_BODY_FAILURE 210 +#define ASN1_R_NO_MULTIPART_BOUNDARY 211 +#define ASN1_R_NO_SIG_CONTENT_TYPE 212 +#define ASN1_R_NULL_IS_WRONG_LENGTH 144 +#define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191 +#define ASN1_R_ODD_NUMBER_OF_CHARS 145 +#define ASN1_R_PRIVATE_KEY_HEADER_MISSING 146 +#define ASN1_R_SECOND_NUMBER_TOO_LARGE 147 +#define ASN1_R_SEQUENCE_LENGTH_MISMATCH 148 +#define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149 +#define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 192 +#define ASN1_R_SHORT_LINE 150 +#define ASN1_R_SIG_INVALID_MIME_TYPE 213 +#define ASN1_R_STREAMING_NOT_SUPPORTED 202 +#define ASN1_R_STRING_TOO_LONG 151 +#define ASN1_R_STRING_TOO_SHORT 152 +#define ASN1_R_TAG_VALUE_TOO_HIGH 153 +#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154 +#define ASN1_R_TIME_NOT_ASCII_FORMAT 193 +#define ASN1_R_TOO_LONG 155 +#define ASN1_R_TYPE_NOT_CONSTRUCTED 156 +#define ASN1_R_TYPE_NOT_PRIMITIVE 218 +#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 157 +#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 158 +#define ASN1_R_UNEXPECTED_EOC 159 +#define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 215 +#define ASN1_R_UNKNOWN_FORMAT 160 +#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161 +#define ASN1_R_UNKNOWN_OBJECT_TYPE 162 +#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163 +#define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM 199 +#define ASN1_R_UNKNOWN_TAG 194 +#define ASN1_R_UNKOWN_FORMAT 195 +#define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164 +#define ASN1_R_UNSUPPORTED_CIPHER 165 +#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 166 +#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167 +#define ASN1_R_UNSUPPORTED_TYPE 196 +#define ASN1_R_WRONG_PUBLIC_KEY_TYPE 200 +#define ASN1_R_WRONG_TAG 168 +#define ASN1_R_WRONG_TYPE 169 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/asn1_mac.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/asn1_mac.h new file mode 100644 index 0000000..b824a42 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/asn1_mac.h @@ -0,0 +1,618 @@ +/* crypto/asn1/asn1_mac.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_ASN1_MAC_H +#define HEADER_ASN1_MAC_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef ASN1_MAC_ERR_LIB +#define ASN1_MAC_ERR_LIB ERR_LIB_ASN1 +#endif + +#define ASN1_MAC_H_err(f, r, line) \ + ERR_PUT_error(ASN1_MAC_ERR_LIB, (f), (r), __FILE__, (line)) + +#define M_ASN1_D2I_vars(a, type, func) \ + ASN1_const_CTX c; \ + type ret = NULL; \ + \ + c.pp = (const unsigned char**)pp; \ + c.q = *(const unsigned char**)pp; \ + c.error = ERR_R_NESTED_ASN1_ERROR; \ + if ((a == NULL) || ((*a) == NULL)) { \ + if ((ret = (type)func()) == NULL) { \ + c.line = __LINE__; \ + goto err; \ + } \ + } else \ + ret = (*a); + +#define M_ASN1_D2I_Init() \ + c.p = *(const unsigned char**)pp; \ + c.max = (length == 0) ? 0 : (c.p + length); + +#define M_ASN1_D2I_Finish_2(a) \ + if (!asn1_const_Finish(&c)) { \ + c.line = __LINE__; \ + goto err; \ + } \ + *(const unsigned char**)pp = c.p; \ + if (a != NULL) \ + (*a) = ret; \ + return (ret); + +#define M_ASN1_D2I_Finish(a, func, e) \ + M_ASN1_D2I_Finish_2(a); \ + err: \ + ASN1_MAC_H_err((e), c.error, c.line); \ + asn1_add_error(*(const unsigned char**)pp, (int)(c.q - *pp)); \ + if ((ret != NULL) && ((a == NULL) || (*a != ret))) \ + func(ret); \ + return (NULL) + +#define M_ASN1_D2I_start_sequence() \ + if (!asn1_GetSequence(&c, &length)) { \ + c.line = __LINE__; \ + goto err; \ + } +/* Begin reading ASN1 without a surrounding sequence */ +#define M_ASN1_D2I_begin() c.slen = length; + +/* End reading ASN1 with no check on length */ +#define M_ASN1_D2I_Finish_nolen(a, func, e) \ + *pp = c.p; \ + if (a != NULL) \ + (*a) = ret; \ + return (ret); \ + err: \ + ASN1_MAC_H_err((e), c.error, c.line); \ + asn1_add_error(*pp, (int)(c.q - *pp)); \ + if ((ret != NULL) && ((a == NULL) || (*a != ret))) \ + func(ret); \ + return (NULL) + +#define M_ASN1_D2I_end_sequence() \ + (((c.inf & 1) == 0) ? (c.slen <= 0) \ + : (c.eos = ASN1_const_check_infinite_end(&c.p, c.slen))) + +/* Don't use this with d2i_ASN1_BOOLEAN() */ +#define M_ASN1_D2I_get(b, func) \ + c.q = c.p; \ + if (func(&(b), &c.p, c.slen) == NULL) { \ + c.line = __LINE__; \ + goto err; \ + } \ + c.slen -= (c.p - c.q); + +/* Don't use this with d2i_ASN1_BOOLEAN() */ +#define M_ASN1_D2I_get_x(type, b, func) \ + c.q = c.p; \ + if (((D2I_OF(type))func)(&(b), &c.p, c.slen) == NULL) { \ + c.line = __LINE__; \ + goto err; \ + } \ + c.slen -= (c.p - c.q); + +/* use this instead () */ +#define M_ASN1_D2I_get_int(b, func) \ + c.q = c.p; \ + if (func(&(b), &c.p, c.slen) < 0) { \ + c.line = __LINE__; \ + goto err; \ + } \ + c.slen -= (c.p - c.q); + +#define M_ASN1_D2I_get_opt(b, func, type) \ + if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) == \ + (V_ASN1_UNIVERSAL | (type)))) { \ + M_ASN1_D2I_get(b, func); \ + } + +#define M_ASN1_D2I_get_int_opt(b, func, type) \ + if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) == \ + (V_ASN1_UNIVERSAL | (type)))) { \ + M_ASN1_D2I_get_int(b, func); \ + } + +#define M_ASN1_D2I_get_imp(b, func, type) \ + M_ASN1_next = (_tmp & V_ASN1_CONSTRUCTED) | type; \ + c.q = c.p; \ + if (func(&(b), &c.p, c.slen) == NULL) { \ + c.line = __LINE__; \ + M_ASN1_next_prev = _tmp; \ + goto err; \ + } \ + c.slen -= (c.p - c.q); \ + M_ASN1_next_prev = _tmp; + +#define M_ASN1_D2I_get_IMP_opt(b, func, tag, type) \ + if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) == \ + (V_ASN1_CONTEXT_SPECIFIC | (tag)))) { \ + unsigned char _tmp = M_ASN1_next; \ + M_ASN1_D2I_get_imp(b, func, type); \ + } + +#define M_ASN1_D2I_get_set(r, func, free_func) \ + M_ASN1_D2I_get_imp_set(r, func, free_func, V_ASN1_SET, V_ASN1_UNIVERSAL); + +#define M_ASN1_D2I_get_set_type(type, r, func, free_func) \ + M_ASN1_D2I_get_imp_set_type( \ + type, r, func, free_func, V_ASN1_SET, V_ASN1_UNIVERSAL); + +#define M_ASN1_D2I_get_set_opt(r, func, free_func) \ + if ((c.slen != 0) && \ + (M_ASN1_next == (V_ASN1_UNIVERSAL | V_ASN1_CONSTRUCTED | V_ASN1_SET))) { \ + M_ASN1_D2I_get_set(r, func, free_func); \ + } + +#define M_ASN1_D2I_get_set_opt_type(type, r, func, free_func) \ + if ((c.slen != 0) && \ + (M_ASN1_next == (V_ASN1_UNIVERSAL | V_ASN1_CONSTRUCTED | V_ASN1_SET))) { \ + M_ASN1_D2I_get_set_type(type, r, func, free_func); \ + } + +#define M_ASN1_I2D_len_SET_opt(a, f) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + M_ASN1_I2D_len_SET(a, f); + +#define M_ASN1_I2D_put_SET_opt(a, f) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + M_ASN1_I2D_put_SET(a, f); + +#define M_ASN1_I2D_put_SEQUENCE_opt(a, f) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + M_ASN1_I2D_put_SEQUENCE(a, f); + +#define M_ASN1_I2D_put_SEQUENCE_opt_type(type, a, f) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + M_ASN1_I2D_put_SEQUENCE_type(type, a, f); + +#define M_ASN1_D2I_get_IMP_set_opt(b, func, free_func, tag) \ + if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_CONTEXT_SPECIFIC | \ + V_ASN1_CONSTRUCTED | (tag)))) { \ + M_ASN1_D2I_get_imp_set(b, func, free_func, tag, V_ASN1_CONTEXT_SPECIFIC); \ + } + +#define M_ASN1_D2I_get_IMP_set_opt_type(type, b, func, free_func, tag) \ + if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_CONTEXT_SPECIFIC | \ + V_ASN1_CONSTRUCTED | (tag)))) { \ + M_ASN1_D2I_get_imp_set_type( \ + type, b, func, free_func, tag, V_ASN1_CONTEXT_SPECIFIC); \ + } + +#define M_ASN1_D2I_get_seq(r, func, free_func) \ + M_ASN1_D2I_get_imp_set(r, func, free_func, V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL); + +#define M_ASN1_D2I_get_seq_type(type, r, func, free_func) \ + M_ASN1_D2I_get_imp_set_type( \ + type, r, func, free_func, V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL) + +#define M_ASN1_D2I_get_seq_opt(r, func, free_func) \ + if ((c.slen != 0) && \ + (M_ASN1_next == \ + (V_ASN1_UNIVERSAL | V_ASN1_CONSTRUCTED | V_ASN1_SEQUENCE))) { \ + M_ASN1_D2I_get_seq(r, func, free_func); \ + } + +#define M_ASN1_D2I_get_seq_opt_type(type, r, func, free_func) \ + if ((c.slen != 0) && \ + (M_ASN1_next == \ + (V_ASN1_UNIVERSAL | V_ASN1_CONSTRUCTED | V_ASN1_SEQUENCE))) { \ + M_ASN1_D2I_get_seq_type(type, r, func, free_func); \ + } + +#define M_ASN1_D2I_get_IMP_set(r, func, free_func, x) \ + M_ASN1_D2I_get_imp_set(r, func, free_func, x, V_ASN1_CONTEXT_SPECIFIC); + +#define M_ASN1_D2I_get_IMP_set_type(type, r, func, free_func, x) \ + M_ASN1_D2I_get_imp_set_type( \ + type, r, func, free_func, x, V_ASN1_CONTEXT_SPECIFIC); + +#define M_ASN1_D2I_get_imp_set(r, func, free_func, a, b) \ + c.q = c.p; \ + if (d2i_ASN1_SET( \ + &(r), \ + &c.p, \ + c.slen, \ + (char* (*)())func, \ + (void (*)())free_func, \ + a, \ + b) == NULL) { \ + c.line = __LINE__; \ + goto err; \ + } \ + c.slen -= (c.p - c.q); + +#define M_ASN1_D2I_get_imp_set_type(type, r, func, free_func, a, b) \ + c.q = c.p; \ + if (d2i_ASN1_SET_OF_##type(&(r), &c.p, c.slen, func, free_func, a, b) == \ + NULL) { \ + c.line = __LINE__; \ + goto err; \ + } \ + c.slen -= (c.p - c.q); + +#define M_ASN1_D2I_get_set_strings(r, func, a, b) \ + c.q = c.p; \ + if (d2i_ASN1_STRING_SET(&(r), &c.p, c.slen, a, b) == NULL) { \ + c.line = __LINE__; \ + goto err; \ + } \ + c.slen -= (c.p - c.q); + +#define M_ASN1_D2I_get_EXP_opt(r, func, tag) \ + if ((c.slen != 0L) && \ + (M_ASN1_next == (V_ASN1_CONSTRUCTED | V_ASN1_CONTEXT_SPECIFIC | tag))) { \ + int Tinf, Ttag, Tclass; \ + long Tlen; \ + \ + c.q = c.p; \ + Tinf = ASN1_get_object(&c.p, &Tlen, &Ttag, &Tclass, c.slen); \ + if (Tinf & 0x80) { \ + c.error = ERR_R_BAD_ASN1_OBJECT_HEADER; \ + c.line = __LINE__; \ + goto err; \ + } \ + if (Tinf == (V_ASN1_CONSTRUCTED + 1)) \ + Tlen = c.slen - (c.p - c.q) - 2; \ + if (func(&(r), &c.p, Tlen) == NULL) { \ + c.line = __LINE__; \ + goto err; \ + } \ + if (Tinf == (V_ASN1_CONSTRUCTED + 1)) { \ + Tlen = c.slen - (c.p - c.q); \ + if (!ASN1_const_check_infinite_end(&c.p, Tlen)) { \ + c.error = ERR_R_MISSING_ASN1_EOS; \ + c.line = __LINE__; \ + goto err; \ + } \ + } \ + c.slen -= (c.p - c.q); \ + } + +#define M_ASN1_D2I_get_EXP_set_opt(r, func, free_func, tag, b) \ + if ((c.slen != 0) && \ + (M_ASN1_next == (V_ASN1_CONSTRUCTED | V_ASN1_CONTEXT_SPECIFIC | tag))) { \ + int Tinf, Ttag, Tclass; \ + long Tlen; \ + \ + c.q = c.p; \ + Tinf = ASN1_get_object(&c.p, &Tlen, &Ttag, &Tclass, c.slen); \ + if (Tinf & 0x80) { \ + c.error = ERR_R_BAD_ASN1_OBJECT_HEADER; \ + c.line = __LINE__; \ + goto err; \ + } \ + if (Tinf == (V_ASN1_CONSTRUCTED + 1)) \ + Tlen = c.slen - (c.p - c.q) - 2; \ + if (d2i_ASN1_SET( \ + &(r), \ + &c.p, \ + Tlen, \ + (char* (*)())func, \ + (void (*)())free_func, \ + b, \ + V_ASN1_UNIVERSAL) == NULL) { \ + c.line = __LINE__; \ + goto err; \ + } \ + if (Tinf == (V_ASN1_CONSTRUCTED + 1)) { \ + Tlen = c.slen - (c.p - c.q); \ + if (!ASN1_check_infinite_end(&c.p, Tlen)) { \ + c.error = ERR_R_MISSING_ASN1_EOS; \ + c.line = __LINE__; \ + goto err; \ + } \ + } \ + c.slen -= (c.p - c.q); \ + } + +#define M_ASN1_D2I_get_EXP_set_opt_type(type, r, func, free_func, tag, b) \ + if ((c.slen != 0) && \ + (M_ASN1_next == (V_ASN1_CONSTRUCTED | V_ASN1_CONTEXT_SPECIFIC | tag))) { \ + int Tinf, Ttag, Tclass; \ + long Tlen; \ + \ + c.q = c.p; \ + Tinf = ASN1_get_object(&c.p, &Tlen, &Ttag, &Tclass, c.slen); \ + if (Tinf & 0x80) { \ + c.error = ERR_R_BAD_ASN1_OBJECT_HEADER; \ + c.line = __LINE__; \ + goto err; \ + } \ + if (Tinf == (V_ASN1_CONSTRUCTED + 1)) \ + Tlen = c.slen - (c.p - c.q) - 2; \ + if (d2i_ASN1_SET_OF_##type( \ + &(r), &c.p, Tlen, func, free_func, b, V_ASN1_UNIVERSAL) == NULL) { \ + c.line = __LINE__; \ + goto err; \ + } \ + if (Tinf == (V_ASN1_CONSTRUCTED + 1)) { \ + Tlen = c.slen - (c.p - c.q); \ + if (!ASN1_check_infinite_end(&c.p, Tlen)) { \ + c.error = ERR_R_MISSING_ASN1_EOS; \ + c.line = __LINE__; \ + goto err; \ + } \ + } \ + c.slen -= (c.p - c.q); \ + } + +/* New macros */ +#define M_ASN1_New_Malloc(ret, type) \ + if ((ret = (type*)OPENSSL_malloc(sizeof(type))) == NULL) { \ + c.line = __LINE__; \ + goto err2; \ + } + +#define M_ASN1_New(arg, func) \ + if (((arg) = func()) == NULL) \ + return (NULL) + +#define M_ASN1_New_Error(a) \ + /*- err: ASN1_MAC_H_err((a),ERR_R_NESTED_ASN1_ERROR,c.line); \ + return(NULL);*/ \ + err2: \ + ASN1_MAC_H_err((a), ERR_R_MALLOC_FAILURE, c.line); \ + return (NULL) + +/* + * BIG UGLY WARNING! This is so damn ugly I wanna puke. Unfortunately, some + * macros that use ASN1_const_CTX still insist on writing in the input + * stream. ARGH! ARGH! ARGH! Let's get rid of this macro package. Please? -- + * Richard Levitte + */ +#define M_ASN1_next (*((unsigned char*)(c.p))) +#define M_ASN1_next_prev (*((unsigned char*)(c.q))) + +/*************************************************/ + +#define M_ASN1_I2D_vars(a) \ + int r = 0, ret = 0; \ + unsigned char* p; \ + if (a == NULL) \ + return (0) + +/* Length Macros */ +#define M_ASN1_I2D_len(a, f) ret += f(a, NULL) +#define M_ASN1_I2D_len_IMP_opt(a, f) \ + if (a != NULL) \ + M_ASN1_I2D_len(a, f) + +#define M_ASN1_I2D_len_SET(a, f) \ + ret += i2d_ASN1_SET(a, NULL, f, V_ASN1_SET, V_ASN1_UNIVERSAL, IS_SET); + +#define M_ASN1_I2D_len_SET_type(type, a, f) \ + ret += i2d_ASN1_SET_OF_##type( \ + a, NULL, f, V_ASN1_SET, V_ASN1_UNIVERSAL, IS_SET); + +#define M_ASN1_I2D_len_SEQUENCE(a, f) \ + ret += i2d_ASN1_SET( \ + a, NULL, f, V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL, IS_SEQUENCE); + +#define M_ASN1_I2D_len_SEQUENCE_type(type, a, f) \ + ret += i2d_ASN1_SET_OF_##type( \ + a, NULL, f, V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL, IS_SEQUENCE) + +#define M_ASN1_I2D_len_SEQUENCE_opt(a, f) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + M_ASN1_I2D_len_SEQUENCE(a, f); + +#define M_ASN1_I2D_len_SEQUENCE_opt_type(type, a, f) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + M_ASN1_I2D_len_SEQUENCE_type(type, a, f); + +#define M_ASN1_I2D_len_IMP_SET(a, f, x) \ + ret += i2d_ASN1_SET(a, NULL, f, x, V_ASN1_CONTEXT_SPECIFIC, IS_SET); + +#define M_ASN1_I2D_len_IMP_SET_type(type, a, f, x) \ + ret += i2d_ASN1_SET_OF_##type(a, NULL, f, x, V_ASN1_CONTEXT_SPECIFIC, IS_SET); + +#define M_ASN1_I2D_len_IMP_SET_opt(a, f, x) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + ret += i2d_ASN1_SET(a, NULL, f, x, V_ASN1_CONTEXT_SPECIFIC, IS_SET); + +#define M_ASN1_I2D_len_IMP_SET_opt_type(type, a, f, x) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + ret += i2d_ASN1_SET_OF_##type( \ + a, NULL, f, x, V_ASN1_CONTEXT_SPECIFIC, IS_SET); + +#define M_ASN1_I2D_len_IMP_SEQUENCE(a, f, x) \ + ret += i2d_ASN1_SET(a, NULL, f, x, V_ASN1_CONTEXT_SPECIFIC, IS_SEQUENCE); + +#define M_ASN1_I2D_len_IMP_SEQUENCE_opt(a, f, x) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + ret += i2d_ASN1_SET(a, NULL, f, x, V_ASN1_CONTEXT_SPECIFIC, IS_SEQUENCE); + +#define M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(type, a, f, x) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + ret += i2d_ASN1_SET_OF_##type( \ + a, NULL, f, x, V_ASN1_CONTEXT_SPECIFIC, IS_SEQUENCE); + +#define M_ASN1_I2D_len_EXP_opt(a, f, mtag, v) \ + if (a != NULL) { \ + v = f(a, NULL); \ + ret += ASN1_object_size(1, v, mtag); \ + } + +#define M_ASN1_I2D_len_EXP_SET_opt(a, f, mtag, tag, v) \ + if ((a != NULL) && (sk_num(a) != 0)) { \ + v = i2d_ASN1_SET(a, NULL, f, tag, V_ASN1_UNIVERSAL, IS_SET); \ + ret += ASN1_object_size(1, v, mtag); \ + } + +#define M_ASN1_I2D_len_EXP_SEQUENCE_opt(a, f, mtag, tag, v) \ + if ((a != NULL) && (sk_num(a) != 0)) { \ + v = i2d_ASN1_SET(a, NULL, f, tag, V_ASN1_UNIVERSAL, IS_SEQUENCE); \ + ret += ASN1_object_size(1, v, mtag); \ + } + +#define M_ASN1_I2D_len_EXP_SEQUENCE_opt_type(type, a, f, mtag, tag, v) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) { \ + v = i2d_ASN1_SET_OF_##type( \ + a, NULL, f, tag, V_ASN1_UNIVERSAL, IS_SEQUENCE); \ + ret += ASN1_object_size(1, v, mtag); \ + } + +/* Put Macros */ +#define M_ASN1_I2D_put(a, f) f(a, &p) + +#define M_ASN1_I2D_put_IMP_opt(a, f, t) \ + if (a != NULL) { \ + unsigned char* q = p; \ + f(a, &p); \ + *q = (V_ASN1_CONTEXT_SPECIFIC | t | (*q & V_ASN1_CONSTRUCTED)); \ + } + +#define M_ASN1_I2D_put_SET(a, f) \ + i2d_ASN1_SET(a, &p, f, V_ASN1_SET, V_ASN1_UNIVERSAL, IS_SET) +#define M_ASN1_I2D_put_SET_type(type, a, f) \ + i2d_ASN1_SET_OF_##type(a, &p, f, V_ASN1_SET, V_ASN1_UNIVERSAL, IS_SET) +#define M_ASN1_I2D_put_IMP_SET(a, f, x) \ + i2d_ASN1_SET(a, &p, f, x, V_ASN1_CONTEXT_SPECIFIC, IS_SET) +#define M_ASN1_I2D_put_IMP_SET_type(type, a, f, x) \ + i2d_ASN1_SET_OF_##type(a, &p, f, x, V_ASN1_CONTEXT_SPECIFIC, IS_SET) +#define M_ASN1_I2D_put_IMP_SEQUENCE(a, f, x) \ + i2d_ASN1_SET(a, &p, f, x, V_ASN1_CONTEXT_SPECIFIC, IS_SEQUENCE) + +#define M_ASN1_I2D_put_SEQUENCE(a, f) \ + i2d_ASN1_SET(a, &p, f, V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL, IS_SEQUENCE) + +#define M_ASN1_I2D_put_SEQUENCE_type(type, a, f) \ + i2d_ASN1_SET_OF_##type( \ + a, &p, f, V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL, IS_SEQUENCE) + +#define M_ASN1_I2D_put_SEQUENCE_opt(a, f) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + M_ASN1_I2D_put_SEQUENCE(a, f); + +#define M_ASN1_I2D_put_IMP_SET_opt(a, f, x) \ + if ((a != NULL) && (sk_num(a) != 0)) { \ + i2d_ASN1_SET(a, &p, f, x, V_ASN1_CONTEXT_SPECIFIC, IS_SET); \ + } + +#define M_ASN1_I2D_put_IMP_SET_opt_type(type, a, f, x) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) { \ + i2d_ASN1_SET_OF_##type(a, &p, f, x, V_ASN1_CONTEXT_SPECIFIC, IS_SET); \ + } + +#define M_ASN1_I2D_put_IMP_SEQUENCE_opt(a, f, x) \ + if ((a != NULL) && (sk_num(a) != 0)) { \ + i2d_ASN1_SET(a, &p, f, x, V_ASN1_CONTEXT_SPECIFIC, IS_SEQUENCE); \ + } + +#define M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(type, a, f, x) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) { \ + i2d_ASN1_SET_OF_##type(a, &p, f, x, V_ASN1_CONTEXT_SPECIFIC, IS_SEQUENCE); \ + } + +#define M_ASN1_I2D_put_EXP_opt(a, f, tag, v) \ + if (a != NULL) { \ + ASN1_put_object(&p, 1, v, tag, V_ASN1_CONTEXT_SPECIFIC); \ + f(a, &p); \ + } + +#define M_ASN1_I2D_put_EXP_SET_opt(a, f, mtag, tag, v) \ + if ((a != NULL) && (sk_num(a) != 0)) { \ + ASN1_put_object(&p, 1, v, mtag, V_ASN1_CONTEXT_SPECIFIC); \ + i2d_ASN1_SET(a, &p, f, tag, V_ASN1_UNIVERSAL, IS_SET); \ + } + +#define M_ASN1_I2D_put_EXP_SEQUENCE_opt(a, f, mtag, tag, v) \ + if ((a != NULL) && (sk_num(a) != 0)) { \ + ASN1_put_object(&p, 1, v, mtag, V_ASN1_CONTEXT_SPECIFIC); \ + i2d_ASN1_SET(a, &p, f, tag, V_ASN1_UNIVERSAL, IS_SEQUENCE); \ + } + +#define M_ASN1_I2D_put_EXP_SEQUENCE_opt_type(type, a, f, mtag, tag, v) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) { \ + ASN1_put_object(&p, 1, v, mtag, V_ASN1_CONTEXT_SPECIFIC); \ + i2d_ASN1_SET_OF_##type(a, &p, f, tag, V_ASN1_UNIVERSAL, IS_SEQUENCE); \ + } + +#define M_ASN1_I2D_seq_total() \ + r = ASN1_object_size(1, ret, V_ASN1_SEQUENCE); \ + if (pp == NULL) \ + return (r); \ + p = *pp; \ + ASN1_put_object(&p, 1, ret, V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL) + +#define M_ASN1_I2D_INF_seq_start(tag, ctx) \ + *(p++) = (V_ASN1_CONSTRUCTED | (tag) | (ctx)); \ + *(p++) = 0x80 + +#define M_ASN1_I2D_INF_seq_end() \ + *(p++) = 0x00; \ + *(p++) = 0x00 + +#define M_ASN1_I2D_finish() \ + *pp = p; \ + return (r); + +int asn1_GetSequence(ASN1_const_CTX* c, long* length); +void asn1_add_error(const unsigned char* address, int offset); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/asn1t.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/asn1t.h new file mode 100644 index 0000000..a403416 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/asn1t.h @@ -0,0 +1,961 @@ +/* asn1t.h */ +/* + * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project + * 2000. + */ +/* ==================================================================== + * Copyright (c) 2000-2005 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +#ifndef HEADER_ASN1T_H +#define HEADER_ASN1T_H + +#include +#include +#include + +#ifdef OPENSSL_BUILD_SHLIBCRYPTO +#undef OPENSSL_EXTERN +#define OPENSSL_EXTERN OPENSSL_EXPORT +#endif + +/* ASN1 template defines, structures and functions */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION + +/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ +#define ASN1_ADB_ptr(iptr) ((const ASN1_ADB*)(iptr)) + +/* Macros for start and end of ASN1_ITEM definition */ + +#define ASN1_ITEM_start(itname) OPENSSL_GLOBAL const ASN1_ITEM itname##_it = { +#define ASN1_ITEM_end(itname) \ + } \ + ; + +#else + +/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ +#define ASN1_ADB_ptr(iptr) ((const ASN1_ADB*)(iptr())) + +/* Macros for start and end of ASN1_ITEM definition */ + +#define ASN1_ITEM_start(itname) \ + const ASN1_ITEM* itname##_it(void) { \ + static const ASN1_ITEM local_it = { +#define ASN1_ITEM_end(itname) \ + } \ + ; \ + return &local_it; \ + } + +#endif + +/* Macros to aid ASN1 template writing */ + +#define ASN1_ITEM_TEMPLATE(tname) static const ASN1_TEMPLATE tname##_item_tt + +#define ASN1_ITEM_TEMPLATE_END(tname) \ + ; \ + ASN1_ITEM_start(tname) ASN1_ITYPE_PRIMITIVE, -1, &tname##_item_tt, 0, NULL, \ + 0, #tname ASN1_ITEM_end(tname) + +/* This is a ASN1 type which just embeds a template */ + +/*- + * This pair helps declare a SEQUENCE. We can do: + * + * ASN1_SEQUENCE(stname) = { + * ... SEQUENCE components ... + * } ASN1_SEQUENCE_END(stname) + * + * This will produce an ASN1_ITEM called stname_it + * for a structure called stname. + * + * If you want the same structure but a different + * name then use: + * + * ASN1_SEQUENCE(itname) = { + * ... SEQUENCE components ... + * } ASN1_SEQUENCE_END_name(stname, itname) + * + * This will create an item called itname_it using + * a structure called stname. + */ + +#define ASN1_SEQUENCE(tname) static const ASN1_TEMPLATE tname##_seq_tt[] + +#define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname) + +#define ASN1_SEQUENCE_END_name(stname, tname) \ + ; \ + ASN1_ITEM_start(tname) ASN1_ITYPE_SEQUENCE, V_ASN1_SEQUENCE, tname##_seq_tt, \ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE), NULL, sizeof(stname), \ + #stname ASN1_ITEM_end(tname) + +#define ASN1_NDEF_SEQUENCE(tname) ASN1_SEQUENCE(tname) + +#define ASN1_NDEF_SEQUENCE_cb(tname, cb) ASN1_SEQUENCE_cb(tname, cb) + +#define ASN1_SEQUENCE_cb(tname, cb) \ + static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ + ASN1_SEQUENCE(tname) + +#define ASN1_BROKEN_SEQUENCE(tname) \ + static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \ + ASN1_SEQUENCE(tname) + +#define ASN1_SEQUENCE_ref(tname, cb, lck) \ + static const ASN1_AUX tname##_aux = { \ + NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), lck, cb, 0}; \ + ASN1_SEQUENCE(tname) + +#define ASN1_SEQUENCE_enc(tname, enc, cb) \ + static const ASN1_AUX tname##_aux = { \ + NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \ + ASN1_SEQUENCE(tname) + +#define ASN1_NDEF_SEQUENCE_END(tname) \ + ; \ + ASN1_ITEM_start(tname) ASN1_ITYPE_NDEF_SEQUENCE, V_ASN1_SEQUENCE, \ + tname##_seq_tt, sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE), NULL, \ + sizeof(tname), #tname ASN1_ITEM_end(tname) + +#define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname) + +#define ASN1_SEQUENCE_END_enc(stname, tname) \ + ASN1_SEQUENCE_END_ref(stname, tname) + +#define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) + +#define ASN1_SEQUENCE_END_ref(stname, tname) \ + ; \ + ASN1_ITEM_start(tname) ASN1_ITYPE_SEQUENCE, V_ASN1_SEQUENCE, tname##_seq_tt, \ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE), &tname##_aux, \ + sizeof(stname), #stname ASN1_ITEM_end(tname) + +#define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \ + ; \ + ASN1_ITEM_start(tname) ASN1_ITYPE_NDEF_SEQUENCE, V_ASN1_SEQUENCE, \ + tname##_seq_tt, sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE), \ + &tname##_aux, sizeof(stname), #stname ASN1_ITEM_end(tname) + +/*- + * This pair helps declare a CHOICE type. We can do: + * + * ASN1_CHOICE(chname) = { + * ... CHOICE options ... + * ASN1_CHOICE_END(chname) + * + * This will produce an ASN1_ITEM called chname_it + * for a structure called chname. The structure + * definition must look like this: + * typedef struct { + * int type; + * union { + * ASN1_SOMETHING *opt1; + * ASN1_SOMEOTHER *opt2; + * } value; + * } chname; + * + * the name of the selector must be 'type'. + * to use an alternative selector name use the + * ASN1_CHOICE_END_selector() version. + */ + +#define ASN1_CHOICE(tname) static const ASN1_TEMPLATE tname##_ch_tt[] + +#define ASN1_CHOICE_cb(tname, cb) \ + static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ + ASN1_CHOICE(tname) + +#define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname) + +#define ASN1_CHOICE_END_name(stname, tname) \ + ASN1_CHOICE_END_selector(stname, tname, type) + +#define ASN1_CHOICE_END_selector(stname, tname, selname) \ + ; \ + ASN1_ITEM_start(tname) ASN1_ITYPE_CHOICE, offsetof(stname, selname), \ + tname##_ch_tt, sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE), NULL, \ + sizeof(stname), #stname ASN1_ITEM_end(tname) + +#define ASN1_CHOICE_END_cb(stname, tname, selname) \ + ; \ + ASN1_ITEM_start(tname) ASN1_ITYPE_CHOICE, offsetof(stname, selname), \ + tname##_ch_tt, sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE), \ + &tname##_aux, sizeof(stname), #stname ASN1_ITEM_end(tname) + +/* This helps with the template wrapper form of ASN1_ITEM */ + +#define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, type) \ + { (flags), (tag), 0, #name, ASN1_ITEM_ref(type) } + +/* These help with SEQUENCE or CHOICE components */ + +/* used to declare other types */ + +#define ASN1_EX_TYPE(flags, tag, stname, field, type) \ + { (flags), (tag), offsetof(stname, field), #field, ASN1_ITEM_ref(type) } + +/* used when the structure is combined with the parent */ + +#define ASN1_EX_COMBINE(flags, tag, type) \ + { (flags) | ASN1_TFLG_COMBINE, (tag), 0, NULL, ASN1_ITEM_ref(type) } + +/* implicit and explicit helper macros */ + +#define ASN1_IMP_EX(stname, field, type, tag, ex) \ + ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | ex, tag, stname, field, type) + +#define ASN1_EXP_EX(stname, field, type, tag, ex) \ + ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | ex, tag, stname, field, type) + +/* Any defined by macros: the field used is in the table itself */ + +#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION +#define ASN1_ADB_OBJECT(tblname) \ + { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM*)&(tblname##_adb) } +#define ASN1_ADB_INTEGER(tblname) \ + { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM*)&(tblname##_adb) } +#else +#define ASN1_ADB_OBJECT(tblname) \ + { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb } +#define ASN1_ADB_INTEGER(tblname) \ + { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb } +#endif +/* Plain simple type */ +#define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0, 0, stname, field, type) + +/* OPTIONAL simple type */ +#define ASN1_OPT(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type) + +/* IMPLICIT tagged simple type */ +#define ASN1_IMP(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, 0) + +/* IMPLICIT tagged OPTIONAL simple type */ +#define ASN1_IMP_OPT(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) + +/* Same as above but EXPLICIT */ + +#define ASN1_EXP(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, 0) +#define ASN1_EXP_OPT(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) + +/* SEQUENCE OF type */ +#define ASN1_SEQUENCE_OF(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type) + +/* OPTIONAL SEQUENCE OF */ +#define ASN1_SEQUENCE_OF_OPT(stname, field, type) \ + ASN1_EX_TYPE( \ + ASN1_TFLG_SEQUENCE_OF | ASN1_TFLG_OPTIONAL, 0, stname, field, type) + +/* Same as above but for SET OF */ + +#define ASN1_SET_OF(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type) + +#define ASN1_SET_OF_OPT(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SET_OF | ASN1_TFLG_OPTIONAL, 0, stname, field, type) + +/* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */ + +#define ASN1_IMP_SET_OF(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) + +#define ASN1_EXP_SET_OF(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) + +#define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF | ASN1_TFLG_OPTIONAL) + +#define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF | ASN1_TFLG_OPTIONAL) + +#define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) + +#define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \ + ASN1_IMP_EX( \ + stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF | ASN1_TFLG_OPTIONAL) + +#define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) + +#define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \ + ASN1_EXP_EX( \ + stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF | ASN1_TFLG_OPTIONAL) + +/* EXPLICIT using indefinite length constructed form */ +#define ASN1_NDEF_EXP(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_NDEF) + +/* EXPLICIT OPTIONAL using indefinite length constructed form */ +#define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL | ASN1_TFLG_NDEF) + +/* Macros for the ASN1_ADB structure */ + +#define ASN1_ADB(name) static const ASN1_ADB_TABLE name##_adbtbl[] + +#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION + +#define ASN1_ADB_END(name, flags, field, app_table, def, none) \ + ; \ + static const ASN1_ADB name##_adb = { \ + flags, \ + offsetof(name, field), \ + app_table, \ + name##_adbtbl, \ + sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE), \ + def, \ + none} + +#else + +#define ASN1_ADB_END(name, flags, field, app_table, def, none) \ + ; \ + static const ASN1_ITEM* name##_adb(void) { \ + static const ASN1_ADB internal_adb = { \ + flags, \ + offsetof(name, field), \ + app_table, \ + name##_adbtbl, \ + sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE), \ + def, \ + none}; \ + return (const ASN1_ITEM*)&internal_adb; \ + } \ + void dummy_function(void) + +#endif + +#define ADB_ENTRY(val, template) \ + { val, template } + +#define ASN1_ADB_TEMPLATE(name) static const ASN1_TEMPLATE name##_tt + +/* + * This is the ASN1 template structure that defines a wrapper round the + * actual type. It determines the actual position of the field in the value + * structure, various flags such as OPTIONAL and the field name. + */ + +struct ASN1_TEMPLATE_st { + unsigned long flags; /* Various flags */ + long tag; /* tag, not used if no tagging */ + unsigned long offset; /* Offset of this field in structure */ +#ifndef NO_ASN1_FIELD_NAMES + const char* field_name; /* Field name */ +#endif + ASN1_ITEM_EXP* item; /* Relevant ASN1_ITEM or ASN1_ADB */ +}; + +/* Macro to extract ASN1_ITEM and ASN1_ADB pointer from ASN1_TEMPLATE */ + +#define ASN1_TEMPLATE_item(t) (t->item_ptr) +#define ASN1_TEMPLATE_adb(t) (t->item_ptr) + +typedef struct ASN1_ADB_TABLE_st ASN1_ADB_TABLE; +typedef struct ASN1_ADB_st ASN1_ADB; + +struct ASN1_ADB_st { + unsigned long flags; /* Various flags */ + unsigned long offset; /* Offset of selector field */ + STACK_OF(ASN1_ADB_TABLE) * *app_items; /* Application defined items */ + const ASN1_ADB_TABLE* tbl; /* Table of possible types */ + long tblcount; /* Number of entries in tbl */ + const ASN1_TEMPLATE* default_tt; /* Type to use if no match */ + const ASN1_TEMPLATE* null_tt; /* Type to use if selector is NULL */ +}; + +struct ASN1_ADB_TABLE_st { + long value; /* NID for an object or value for an int */ + const ASN1_TEMPLATE tt; /* item for this value */ +}; + +/* template flags */ + +/* Field is optional */ +#define ASN1_TFLG_OPTIONAL (0x1) + +/* Field is a SET OF */ +#define ASN1_TFLG_SET_OF (0x1 << 1) + +/* Field is a SEQUENCE OF */ +#define ASN1_TFLG_SEQUENCE_OF (0x2 << 1) + +/* + * Special case: this refers to a SET OF that will be sorted into DER order + * when encoded *and* the corresponding STACK will be modified to match the + * new order. + */ +#define ASN1_TFLG_SET_ORDER (0x3 << 1) + +/* Mask for SET OF or SEQUENCE OF */ +#define ASN1_TFLG_SK_MASK (0x3 << 1) + +/* + * These flags mean the tag should be taken from the tag field. If EXPLICIT + * then the underlying type is used for the inner tag. + */ + +/* IMPLICIT tagging */ +#define ASN1_TFLG_IMPTAG (0x1 << 3) + +/* EXPLICIT tagging, inner tag from underlying type */ +#define ASN1_TFLG_EXPTAG (0x2 << 3) + +#define ASN1_TFLG_TAG_MASK (0x3 << 3) + +/* context specific IMPLICIT */ +#define ASN1_TFLG_IMPLICIT ASN1_TFLG_IMPTAG | ASN1_TFLG_CONTEXT + +/* context specific EXPLICIT */ +#define ASN1_TFLG_EXPLICIT ASN1_TFLG_EXPTAG | ASN1_TFLG_CONTEXT + +/* + * If tagging is in force these determine the type of tag to use. Otherwise + * the tag is determined by the underlying type. These values reflect the + * actual octet format. + */ + +/* Universal tag */ +#define ASN1_TFLG_UNIVERSAL (0x0 << 6) +/* Application tag */ +#define ASN1_TFLG_APPLICATION (0x1 << 6) +/* Context specific tag */ +#define ASN1_TFLG_CONTEXT (0x2 << 6) +/* Private tag */ +#define ASN1_TFLG_PRIVATE (0x3 << 6) + +#define ASN1_TFLG_TAG_CLASS (0x3 << 6) + +/* + * These are for ANY DEFINED BY type. In this case the 'item' field points to + * an ASN1_ADB structure which contains a table of values to decode the + * relevant type + */ + +#define ASN1_TFLG_ADB_MASK (0x3 << 8) + +#define ASN1_TFLG_ADB_OID (0x1 << 8) + +#define ASN1_TFLG_ADB_INT (0x1 << 9) + +/* + * This flag means a parent structure is passed instead of the field: this is + * useful is a SEQUENCE is being combined with a CHOICE for example. Since + * this means the structure and item name will differ we need to use the + * ASN1_CHOICE_END_name() macro for example. + */ + +#define ASN1_TFLG_COMBINE (0x1 << 10) + +/* + * This flag when present in a SEQUENCE OF, SET OF or EXPLICIT causes + * indefinite length constructed encoding to be used if required. + */ + +#define ASN1_TFLG_NDEF (0x1 << 11) + +/* This is the actual ASN1 item itself */ + +struct ASN1_ITEM_st { + char itype; /* The item type, primitive, SEQUENCE, CHOICE + * or extern */ + long utype; /* underlying type */ + const ASN1_TEMPLATE* templates; /* If SEQUENCE or CHOICE this contains + * the contents */ + long tcount; /* Number of templates if SEQUENCE or CHOICE */ + const void* funcs; /* functions that handle this type */ + long size; /* Structure size (usually) */ +#ifndef NO_ASN1_FIELD_NAMES + const char* sname; /* Structure name */ +#endif +}; + +/*- + * These are values for the itype field and + * determine how the type is interpreted. + * + * For PRIMITIVE types the underlying type + * determines the behaviour if items is NULL. + * + * Otherwise templates must contain a single + * template and the type is treated in the + * same way as the type specified in the template. + * + * For SEQUENCE types the templates field points + * to the members, the size field is the + * structure size. + * + * For CHOICE types the templates field points + * to each possible member (typically a union) + * and the 'size' field is the offset of the + * selector. + * + * The 'funcs' field is used for application + * specific functions. + * + * For COMPAT types the funcs field gives a + * set of functions that handle this type, this + * supports the old d2i, i2d convention. + * + * The EXTERN type uses a new style d2i/i2d. + * The new style should be used where possible + * because it avoids things like the d2i IMPLICIT + * hack. + * + * MSTRING is a multiple string type, it is used + * for a CHOICE of character strings where the + * actual strings all occupy an ASN1_STRING + * structure. In this case the 'utype' field + * has a special meaning, it is used as a mask + * of acceptable types using the B_ASN1 constants. + * + * NDEF_SEQUENCE is the same as SEQUENCE except + * that it will use indefinite length constructed + * encoding if requested. + * + */ + +#define ASN1_ITYPE_PRIMITIVE 0x0 + +#define ASN1_ITYPE_SEQUENCE 0x1 + +#define ASN1_ITYPE_CHOICE 0x2 + +#define ASN1_ITYPE_COMPAT 0x3 + +#define ASN1_ITYPE_EXTERN 0x4 + +#define ASN1_ITYPE_MSTRING 0x5 + +#define ASN1_ITYPE_NDEF_SEQUENCE 0x6 + +/* + * Cache for ASN1 tag and length, so we don't keep re-reading it for things + * like CHOICE + */ + +struct ASN1_TLC_st { + char valid; /* Values below are valid */ + int ret; /* return value */ + long plen; /* length */ + int ptag; /* class value */ + int pclass; /* class value */ + int hdrlen; /* header length */ +}; + +/* Typedefs for ASN1 function pointers */ + +typedef ASN1_VALUE* ASN1_new_func(void); +typedef void ASN1_free_func(ASN1_VALUE* a); +typedef ASN1_VALUE* +ASN1_d2i_func(ASN1_VALUE** a, const unsigned char** in, long length); +typedef int ASN1_i2d_func(ASN1_VALUE* a, unsigned char** in); + +typedef int ASN1_ex_d2i( + ASN1_VALUE** pval, + const unsigned char** in, + long len, + const ASN1_ITEM* it, + int tag, + int aclass, + char opt, + ASN1_TLC* ctx); + +typedef int ASN1_ex_i2d( + ASN1_VALUE** pval, + unsigned char** out, + const ASN1_ITEM* it, + int tag, + int aclass); +typedef int ASN1_ex_new_func(ASN1_VALUE** pval, const ASN1_ITEM* it); +typedef void ASN1_ex_free_func(ASN1_VALUE** pval, const ASN1_ITEM* it); + +typedef int ASN1_ex_print_func( + BIO* out, + ASN1_VALUE** pval, + int indent, + const char* fname, + const ASN1_PCTX* pctx); + +typedef int ASN1_primitive_i2c( + ASN1_VALUE** pval, + unsigned char* cont, + int* putype, + const ASN1_ITEM* it); +typedef int ASN1_primitive_c2i( + ASN1_VALUE** pval, + const unsigned char* cont, + int len, + int utype, + char* free_cont, + const ASN1_ITEM* it); +typedef int ASN1_primitive_print( + BIO* out, + ASN1_VALUE** pval, + const ASN1_ITEM* it, + int indent, + const ASN1_PCTX* pctx); + +typedef struct ASN1_COMPAT_FUNCS_st { + ASN1_new_func* asn1_new; + ASN1_free_func* asn1_free; + ASN1_d2i_func* asn1_d2i; + ASN1_i2d_func* asn1_i2d; +} ASN1_COMPAT_FUNCS; + +typedef struct ASN1_EXTERN_FUNCS_st { + void* app_data; + ASN1_ex_new_func* asn1_ex_new; + ASN1_ex_free_func* asn1_ex_free; + ASN1_ex_free_func* asn1_ex_clear; + ASN1_ex_d2i* asn1_ex_d2i; + ASN1_ex_i2d* asn1_ex_i2d; + ASN1_ex_print_func* asn1_ex_print; +} ASN1_EXTERN_FUNCS; + +typedef struct ASN1_PRIMITIVE_FUNCS_st { + void* app_data; + unsigned long flags; + ASN1_ex_new_func* prim_new; + ASN1_ex_free_func* prim_free; + ASN1_ex_free_func* prim_clear; + ASN1_primitive_c2i* prim_c2i; + ASN1_primitive_i2c* prim_i2c; + ASN1_primitive_print* prim_print; +} ASN1_PRIMITIVE_FUNCS; + +/* + * This is the ASN1_AUX structure: it handles various miscellaneous + * requirements. For example the use of reference counts and an informational + * callback. The "informational callback" is called at various points during + * the ASN1 encoding and decoding. It can be used to provide minor + * customisation of the structures used. This is most useful where the + * supplied routines *almost* do the right thing but need some extra help at + * a few points. If the callback returns zero then it is assumed a fatal + * error has occurred and the main operation should be abandoned. If major + * changes in the default behaviour are required then an external type is + * more appropriate. + */ + +typedef int +ASN1_aux_cb(int operation, ASN1_VALUE** in, const ASN1_ITEM* it, void* exarg); + +typedef struct ASN1_AUX_st { + void* app_data; + int flags; + int ref_offset; /* Offset of reference value */ + int ref_lock; /* Lock type to use */ + ASN1_aux_cb* asn1_cb; + int enc_offset; /* Offset of ASN1_ENCODING structure */ +} ASN1_AUX; + +/* For print related callbacks exarg points to this structure */ +typedef struct ASN1_PRINT_ARG_st { + BIO* out; + int indent; + const ASN1_PCTX* pctx; +} ASN1_PRINT_ARG; + +/* For streaming related callbacks exarg points to this structure */ +typedef struct ASN1_STREAM_ARG_st { + /* BIO to stream through */ + BIO* out; + /* BIO with filters appended */ + BIO* ndef_bio; + /* Streaming I/O boundary */ + unsigned char** boundary; +} ASN1_STREAM_ARG; + +/* Flags in ASN1_AUX */ + +/* Use a reference count */ +#define ASN1_AFLG_REFCOUNT 1 +/* Save the encoding of structure (useful for signatures) */ +#define ASN1_AFLG_ENCODING 2 +/* The Sequence length is invalid */ +#define ASN1_AFLG_BROKEN 4 + +/* operation values for asn1_cb */ + +#define ASN1_OP_NEW_PRE 0 +#define ASN1_OP_NEW_POST 1 +#define ASN1_OP_FREE_PRE 2 +#define ASN1_OP_FREE_POST 3 +#define ASN1_OP_D2I_PRE 4 +#define ASN1_OP_D2I_POST 5 +#define ASN1_OP_I2D_PRE 6 +#define ASN1_OP_I2D_POST 7 +#define ASN1_OP_PRINT_PRE 8 +#define ASN1_OP_PRINT_POST 9 +#define ASN1_OP_STREAM_PRE 10 +#define ASN1_OP_STREAM_POST 11 +#define ASN1_OP_DETACHED_PRE 12 +#define ASN1_OP_DETACHED_POST 13 + +/* Macro to implement a primitive type */ +#define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0) +#define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \ + ASN1_ITEM_start(itname) ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, \ + #itname ASN1_ITEM_end(itname) + +/* Macro to implement a multi string type */ +#define IMPLEMENT_ASN1_MSTRING(itname, mask) \ + ASN1_ITEM_start(itname) ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, \ + sizeof(ASN1_STRING), #itname ASN1_ITEM_end(itname) + +/* Macro to implement an ASN1_ITEM in terms of old style funcs */ + +#define IMPLEMENT_COMPAT_ASN1(sname) \ + IMPLEMENT_COMPAT_ASN1_type(sname, V_ASN1_SEQUENCE) + +#define IMPLEMENT_COMPAT_ASN1_type(sname, tag) \ + static const ASN1_COMPAT_FUNCS sname##_ff = { \ + (ASN1_new_func*)sname##_new, \ + (ASN1_free_func*)sname##_free, \ + (ASN1_d2i_func*)d2i_##sname, \ + (ASN1_i2d_func*)i2d_##sname, \ + }; \ + ASN1_ITEM_start(sname) ASN1_ITYPE_COMPAT, tag, NULL, 0, &sname##_ff, 0, \ + #sname ASN1_ITEM_end(sname) + +#define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \ + ASN1_ITEM_start(sname) ASN1_ITYPE_EXTERN, tag, NULL, 0, &fptrs, 0, \ + #sname ASN1_ITEM_end(sname) + +/* Macro to implement standard functions in terms of ASN1_ITEM structures */ + +#define IMPLEMENT_ASN1_FUNCTIONS(stname) \ + IMPLEMENT_ASN1_FUNCTIONS_fname(stname, stname, stname) + +#define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) \ + IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname) + +#define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \ + IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname) + +#define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname) + +#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname) + +#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \ + pre stname* fname##_new(void) { \ + return (stname*)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ + } \ + pre void fname##_free(stname* a) { \ + ASN1_item_free((ASN1_VALUE*)a, ASN1_ITEM_rptr(itname)); \ + } + +#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \ + stname* fname##_new(void) { \ + return (stname*)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ + } \ + void fname##_free(stname* a) { \ + ASN1_item_free((ASN1_VALUE*)a, ASN1_ITEM_rptr(itname)); \ + } + +#define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) + +#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ + stname* d2i_##fname(stname** a, const unsigned char** in, long len) { \ + return (stname*)ASN1_item_d2i( \ + (ASN1_VALUE**)a, in, len, ASN1_ITEM_rptr(itname)); \ + } \ + int i2d_##fname(stname* a, unsigned char** out) { \ + return ASN1_item_i2d((ASN1_VALUE*)a, out, ASN1_ITEM_rptr(itname)); \ + } + +#define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \ + int i2d_##stname##_NDEF(stname* a, unsigned char** out) { \ + return ASN1_item_ndef_i2d((ASN1_VALUE*)a, out, ASN1_ITEM_rptr(stname)); \ + } + +/* + * This includes evil casts to remove const: they will go away when full ASN1 + * constification is done. + */ +#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ + stname* d2i_##fname(stname** a, const unsigned char** in, long len) { \ + return (stname*)ASN1_item_d2i( \ + (ASN1_VALUE**)a, in, len, ASN1_ITEM_rptr(itname)); \ + } \ + int i2d_##fname(const stname* a, unsigned char** out) { \ + return ASN1_item_i2d((ASN1_VALUE*)a, out, ASN1_ITEM_rptr(itname)); \ + } + +#define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \ + stname* stname##_dup(stname* x) { \ + return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \ + } + +#define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \ + IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname) + +#define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \ + int fname##_print_ctx( \ + BIO* out, stname* x, int indent, const ASN1_PCTX* pctx) { \ + return ASN1_item_print( \ + out, (ASN1_VALUE*)x, indent, ASN1_ITEM_rptr(itname), pctx); \ + } + +#define IMPLEMENT_ASN1_FUNCTIONS_const(name) \ + IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name) + +#define IMPLEMENT_ASN1_FUNCTIONS_const_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) + +/* external definitions for primitive types */ + +DECLARE_ASN1_ITEM(ASN1_BOOLEAN) +DECLARE_ASN1_ITEM(ASN1_TBOOLEAN) +DECLARE_ASN1_ITEM(ASN1_FBOOLEAN) +DECLARE_ASN1_ITEM(ASN1_SEQUENCE) +DECLARE_ASN1_ITEM(CBIGNUM) +DECLARE_ASN1_ITEM(BIGNUM) +DECLARE_ASN1_ITEM(LONG) +DECLARE_ASN1_ITEM(ZLONG) + +DECLARE_STACK_OF(ASN1_VALUE) + +/* Functions used internally by the ASN1 code */ + +int ASN1_item_ex_new(ASN1_VALUE** pval, const ASN1_ITEM* it); +void ASN1_item_ex_free(ASN1_VALUE** pval, const ASN1_ITEM* it); +int ASN1_template_new(ASN1_VALUE** pval, const ASN1_TEMPLATE* tt); +int ASN1_primitive_new(ASN1_VALUE** pval, const ASN1_ITEM* it); + +void ASN1_template_free(ASN1_VALUE** pval, const ASN1_TEMPLATE* tt); +int ASN1_template_d2i( + ASN1_VALUE** pval, + const unsigned char** in, + long len, + const ASN1_TEMPLATE* tt); +int ASN1_item_ex_d2i( + ASN1_VALUE** pval, + const unsigned char** in, + long len, + const ASN1_ITEM* it, + int tag, + int aclass, + char opt, + ASN1_TLC* ctx); + +int ASN1_item_ex_i2d( + ASN1_VALUE** pval, + unsigned char** out, + const ASN1_ITEM* it, + int tag, + int aclass); +int ASN1_template_i2d( + ASN1_VALUE** pval, + unsigned char** out, + const ASN1_TEMPLATE* tt); +void ASN1_primitive_free(ASN1_VALUE** pval, const ASN1_ITEM* it); + +int asn1_ex_i2c( + ASN1_VALUE** pval, + unsigned char* cont, + int* putype, + const ASN1_ITEM* it); +int asn1_ex_c2i( + ASN1_VALUE** pval, + const unsigned char* cont, + int len, + int utype, + char* free_cont, + const ASN1_ITEM* it); + +int asn1_get_choice_selector(ASN1_VALUE** pval, const ASN1_ITEM* it); +int asn1_set_choice_selector(ASN1_VALUE** pval, int value, const ASN1_ITEM* it); + +ASN1_VALUE** asn1_get_field_ptr(ASN1_VALUE** pval, const ASN1_TEMPLATE* tt); + +const ASN1_TEMPLATE* +asn1_do_adb(ASN1_VALUE** pval, const ASN1_TEMPLATE* tt, int nullerr); + +int asn1_do_lock(ASN1_VALUE** pval, int op, const ASN1_ITEM* it); + +void asn1_enc_init(ASN1_VALUE** pval, const ASN1_ITEM* it); +void asn1_enc_free(ASN1_VALUE** pval, const ASN1_ITEM* it); +int asn1_enc_restore( + int* len, + unsigned char** out, + ASN1_VALUE** pval, + const ASN1_ITEM* it); +int asn1_enc_save( + ASN1_VALUE** pval, + const unsigned char* in, + int inlen, + const ASN1_ITEM* it); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/bio.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/bio.h new file mode 100644 index 0000000..0e0d278 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/bio.h @@ -0,0 +1,940 @@ +/* crypto/bio/bio.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_BIO_H +#define HEADER_BIO_H + +#include + +#ifndef OPENSSL_NO_FP_API +#include +#endif +#include + +#include + +#ifndef OPENSSL_NO_SCTP +#ifndef OPENSSL_SYS_VMS +#include +#else +#include +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* These are the 'types' of BIOs */ +#define BIO_TYPE_NONE 0 +#define BIO_TYPE_MEM (1 | 0x0400) +#define BIO_TYPE_FILE (2 | 0x0400) + +#define BIO_TYPE_FD (4 | 0x0400 | 0x0100) +#define BIO_TYPE_SOCKET (5 | 0x0400 | 0x0100) +#define BIO_TYPE_NULL (6 | 0x0400) +#define BIO_TYPE_SSL (7 | 0x0200) +#define BIO_TYPE_MD (8 | 0x0200) /* passive filter */ +#define BIO_TYPE_BUFFER (9 | 0x0200) /* filter */ +#define BIO_TYPE_CIPHER (10 | 0x0200) /* filter */ +#define BIO_TYPE_BASE64 (11 | 0x0200) /* filter */ +#define BIO_TYPE_CONNECT (12 | 0x0400 | 0x0100) /* socket - connect */ +#define BIO_TYPE_ACCEPT (13 | 0x0400 | 0x0100) /* socket for accept */ +#define BIO_TYPE_PROXY_CLIENT (14 | 0x0200) /* client proxy BIO */ +#define BIO_TYPE_PROXY_SERVER (15 | 0x0200) /* server proxy BIO */ +#define BIO_TYPE_NBIO_TEST (16 | 0x0200) /* server proxy BIO */ +#define BIO_TYPE_NULL_FILTER (17 | 0x0200) +#define BIO_TYPE_BER (18 | 0x0200) /* BER -> bin filter */ +#define BIO_TYPE_BIO (19 | 0x0400) /* (half a) BIO pair */ +#define BIO_TYPE_LINEBUFFER (20 | 0x0200) /* filter */ +#define BIO_TYPE_DGRAM (21 | 0x0400 | 0x0100) +#ifndef OPENSSL_NO_SCTP +#define BIO_TYPE_DGRAM_SCTP (24 | 0x0400 | 0x0100) +#endif +#define BIO_TYPE_ASN1 (22 | 0x0200) /* filter */ +#define BIO_TYPE_COMP (23 | 0x0200) /* filter */ + +#define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ +#define BIO_TYPE_FILTER 0x0200 +#define BIO_TYPE_SOURCE_SINK 0x0400 + +/* + * BIO_FILENAME_READ|BIO_CLOSE to open or close on free. + * BIO_set_fp(in,stdin,BIO_NOCLOSE); + */ +#define BIO_NOCLOSE 0x00 +#define BIO_CLOSE 0x01 + +/* + * These are used in the following macros and are passed to BIO_ctrl() + */ +#define BIO_CTRL_RESET 1 /* opt - rewind/zero etc */ +#define BIO_CTRL_EOF 2 /* opt - are we at the eof */ +#define BIO_CTRL_INFO 3 /* opt - extra tit-bits */ +#define BIO_CTRL_SET 4 /* man - set the 'IO' type */ +#define BIO_CTRL_GET 5 /* man - get the 'IO' type */ +#define BIO_CTRL_PUSH 6 /* opt - internal, used to signify change */ +#define BIO_CTRL_POP 7 /* opt - internal, used to signify change */ +#define BIO_CTRL_GET_CLOSE 8 /* man - set the 'close' on free */ +#define BIO_CTRL_SET_CLOSE 9 /* man - set the 'close' on free */ +#define BIO_CTRL_PENDING 10 /* opt - is their more data buffered */ +#define BIO_CTRL_FLUSH 11 /* opt - 'flush' buffered output */ +#define BIO_CTRL_DUP 12 /* man - extra stuff for 'duped' BIO */ +#define BIO_CTRL_WPENDING 13 /* opt - number of bytes still to write */ +/* callback is int cb(BIO *bio,state,ret); */ +#define BIO_CTRL_SET_CALLBACK 14 /* opt - set callback function */ +#define BIO_CTRL_GET_CALLBACK 15 /* opt - set callback function */ + +#define BIO_CTRL_SET_FILENAME 30 /* BIO_s_file special */ + +/* dgram BIO stuff */ +#define BIO_CTRL_DGRAM_CONNECT 31 /* BIO dgram special */ +#define BIO_CTRL_DGRAM_SET_CONNECTED \ + 32 /* allow for an externally connected \ + * socket to be passed in */ +#define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33 /* setsockopt, essentially */ +#define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34 /* getsockopt, essentially */ +#define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35 /* setsockopt, essentially */ +#define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36 /* getsockopt, essentially */ + +#define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37 /* flag whether the last */ +#define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38 /* I/O operation tiemd out */ + +/* #ifdef IP_MTU_DISCOVER */ +#define BIO_CTRL_DGRAM_MTU_DISCOVER 39 /* set DF bit on egress packets */ +/* #endif */ + +#define BIO_CTRL_DGRAM_QUERY_MTU 40 /* as kernel for current MTU */ +#define BIO_CTRL_DGRAM_GET_FALLBACK_MTU 47 +#define BIO_CTRL_DGRAM_GET_MTU 41 /* get cached value for MTU */ +#define BIO_CTRL_DGRAM_SET_MTU \ + 42 /* set cached value for MTU. \ + * want to use this if asking \ + * the kernel fails */ + +#define BIO_CTRL_DGRAM_MTU_EXCEEDED \ + 43 /* check whether the MTU was \ + * exceed in the previous write \ + * operation */ + +#define BIO_CTRL_DGRAM_GET_PEER 46 +#define BIO_CTRL_DGRAM_SET_PEER 44 /* Destination for the data */ + +#define BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT \ + 45 /* Next DTLS handshake timeout \ + * to adjust socket timeouts */ +#define BIO_CTRL_DGRAM_SET_DONT_FRAG 48 + +#define BIO_CTRL_DGRAM_GET_MTU_OVERHEAD 49 + +#ifndef OPENSSL_NO_SCTP +/* SCTP stuff */ +#define BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE 50 +#define BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY 51 +#define BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY 52 +#define BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD 53 +#define BIO_CTRL_DGRAM_SCTP_GET_SNDINFO 60 +#define BIO_CTRL_DGRAM_SCTP_SET_SNDINFO 61 +#define BIO_CTRL_DGRAM_SCTP_GET_RCVINFO 62 +#define BIO_CTRL_DGRAM_SCTP_SET_RCVINFO 63 +#define BIO_CTRL_DGRAM_SCTP_GET_PRINFO 64 +#define BIO_CTRL_DGRAM_SCTP_SET_PRINFO 65 +#define BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN 70 +#endif + +/* modifiers */ +#define BIO_FP_READ 0x02 +#define BIO_FP_WRITE 0x04 +#define BIO_FP_APPEND 0x08 +#define BIO_FP_TEXT 0x10 + +#define BIO_FLAGS_READ 0x01 +#define BIO_FLAGS_WRITE 0x02 +#define BIO_FLAGS_IO_SPECIAL 0x04 +#define BIO_FLAGS_RWS (BIO_FLAGS_READ | BIO_FLAGS_WRITE | BIO_FLAGS_IO_SPECIAL) +#define BIO_FLAGS_SHOULD_RETRY 0x08 +#ifndef BIO_FLAGS_UPLINK +/* + * "UPLINK" flag denotes file descriptors provided by application. It + * defaults to 0, as most platforms don't require UPLINK interface. + */ +#define BIO_FLAGS_UPLINK 0 +#endif + +/* Used in BIO_gethostbyname() */ +#define BIO_GHBN_CTRL_HITS 1 +#define BIO_GHBN_CTRL_MISSES 2 +#define BIO_GHBN_CTRL_CACHE_SIZE 3 +#define BIO_GHBN_CTRL_GET_ENTRY 4 +#define BIO_GHBN_CTRL_FLUSH 5 + +/* Mostly used in the SSL BIO */ +/*- + * Not used anymore + * #define BIO_FLAGS_PROTOCOL_DELAYED_READ 0x10 + * #define BIO_FLAGS_PROTOCOL_DELAYED_WRITE 0x20 + * #define BIO_FLAGS_PROTOCOL_STARTUP 0x40 + */ + +#define BIO_FLAGS_BASE64_NO_NL 0x100 + +/* + * This is used with memory BIOs: it means we shouldn't free up or change the + * data in any way. + */ +#define BIO_FLAGS_MEM_RDONLY 0x200 + +typedef struct bio_st BIO; + +void BIO_set_flags(BIO* b, int flags); +int BIO_test_flags(const BIO* b, int flags); +void BIO_clear_flags(BIO* b, int flags); + +#define BIO_get_flags(b) BIO_test_flags(b, ~(0x0)) +#define BIO_set_retry_special(b) \ + BIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL | BIO_FLAGS_SHOULD_RETRY)) +#define BIO_set_retry_read(b) \ + BIO_set_flags(b, (BIO_FLAGS_READ | BIO_FLAGS_SHOULD_RETRY)) +#define BIO_set_retry_write(b) \ + BIO_set_flags(b, (BIO_FLAGS_WRITE | BIO_FLAGS_SHOULD_RETRY)) + +/* These are normally used internally in BIOs */ +#define BIO_clear_retry_flags(b) \ + BIO_clear_flags(b, (BIO_FLAGS_RWS | BIO_FLAGS_SHOULD_RETRY)) +#define BIO_get_retry_flags(b) \ + BIO_test_flags(b, (BIO_FLAGS_RWS | BIO_FLAGS_SHOULD_RETRY)) + +/* These should be used by the application to tell why we should retry */ +#define BIO_should_read(a) BIO_test_flags(a, BIO_FLAGS_READ) +#define BIO_should_write(a) BIO_test_flags(a, BIO_FLAGS_WRITE) +#define BIO_should_io_special(a) BIO_test_flags(a, BIO_FLAGS_IO_SPECIAL) +#define BIO_retry_type(a) BIO_test_flags(a, BIO_FLAGS_RWS) +#define BIO_should_retry(a) BIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY) + +/* + * The next three are used in conjunction with the BIO_should_io_special() + * condition. After this returns true, BIO *BIO_get_retry_BIO(BIO *bio, int + * *reason); will walk the BIO stack and return the 'reason' for the special + * and the offending BIO. Given a BIO, BIO_get_retry_reason(bio) will return + * the code. + */ +/* + * Returned from the SSL bio when the certificate retrieval code had an error + */ +#define BIO_RR_SSL_X509_LOOKUP 0x01 +/* Returned from the connect BIO when a connect would have blocked */ +#define BIO_RR_CONNECT 0x02 +/* Returned from the accept BIO when an accept would have blocked */ +#define BIO_RR_ACCEPT 0x03 + +/* These are passed by the BIO callback */ +#define BIO_CB_FREE 0x01 +#define BIO_CB_READ 0x02 +#define BIO_CB_WRITE 0x03 +#define BIO_CB_PUTS 0x04 +#define BIO_CB_GETS 0x05 +#define BIO_CB_CTRL 0x06 + +/* + * The callback is called before and after the underling operation, The + * BIO_CB_RETURN flag indicates if it is after the call + */ +#define BIO_CB_RETURN 0x80 +#define BIO_CB_return(a) ((a) | BIO_CB_RETURN) +#define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN)) +#define BIO_cb_post(a) ((a)&BIO_CB_RETURN) + +long ( + *BIO_get_callback( + const BIO* b))(struct bio_st*, int, const char*, int, long, long); +void BIO_set_callback( + BIO* b, + long (*callback)(struct bio_st*, int, const char*, int, long, long)); +char* BIO_get_callback_arg(const BIO* b); +void BIO_set_callback_arg(BIO* b, char* arg); + +const char* BIO_method_name(const BIO* b); +int BIO_method_type(const BIO* b); + +typedef void bio_info_cb(struct bio_st*, int, const char*, int, long, long); + +typedef struct bio_method_st { + int type; + const char* name; + int (*bwrite)(BIO*, const char*, int); + int (*bread)(BIO*, char*, int); + int (*bputs)(BIO*, const char*); + int (*bgets)(BIO*, char*, int); + long (*ctrl)(BIO*, int, long, void*); + int (*create)(BIO*); + int (*destroy)(BIO*); + long (*callback_ctrl)(BIO*, int, bio_info_cb*); +} BIO_METHOD; + +struct bio_st { + BIO_METHOD* method; + /* bio, mode, argp, argi, argl, ret */ + long (*callback)(struct bio_st*, int, const char*, int, long, long); + char* cb_arg; /* first argument for the callback */ + int init; + int shutdown; + int flags; /* extra storage */ + int retry_reason; + int num; + void* ptr; + struct bio_st* next_bio; /* used by filter BIOs */ + struct bio_st* prev_bio; /* used by filter BIOs */ + int references; + unsigned long num_read; + unsigned long num_write; + CRYPTO_EX_DATA ex_data; +}; + +DECLARE_STACK_OF(BIO) + +typedef struct bio_f_buffer_ctx_struct { + /*- + * Buffers are setup like this: + * + * <---------------------- size -----------------------> + * +---------------------------------------------------+ + * | consumed | remaining | free space | + * +---------------------------------------------------+ + * <-- off --><------- len -------> + */ + /*- BIO *bio; */ /* + * this is now in the BIO struct + */ + int ibuf_size; /* how big is the input buffer */ + int obuf_size; /* how big is the output buffer */ + char* ibuf; /* the char array */ + int ibuf_len; /* how many bytes are in it */ + int ibuf_off; /* write/read offset */ + char* obuf; /* the char array */ + int obuf_len; /* how many bytes are in it */ + int obuf_off; /* write/read offset */ +} BIO_F_BUFFER_CTX; + +/* Prefix and suffix callback in ASN1 BIO */ +typedef int asn1_ps_func(BIO* b, unsigned char** pbuf, int* plen, void* parg); + +#ifndef OPENSSL_NO_SCTP +/* SCTP parameter structs */ +struct bio_dgram_sctp_sndinfo { + uint16_t snd_sid; + uint16_t snd_flags; + uint32_t snd_ppid; + uint32_t snd_context; +}; + +struct bio_dgram_sctp_rcvinfo { + uint16_t rcv_sid; + uint16_t rcv_ssn; + uint16_t rcv_flags; + uint32_t rcv_ppid; + uint32_t rcv_tsn; + uint32_t rcv_cumtsn; + uint32_t rcv_context; +}; + +struct bio_dgram_sctp_prinfo { + uint16_t pr_policy; + uint32_t pr_value; +}; +#endif + +/* connect BIO stuff */ +#define BIO_CONN_S_BEFORE 1 +#define BIO_CONN_S_GET_IP 2 +#define BIO_CONN_S_GET_PORT 3 +#define BIO_CONN_S_CREATE_SOCKET 4 +#define BIO_CONN_S_CONNECT 5 +#define BIO_CONN_S_OK 6 +#define BIO_CONN_S_BLOCKED_CONNECT 7 +#define BIO_CONN_S_NBIO 8 +/* + * #define BIO_CONN_get_param_hostname BIO_ctrl + */ + +#define BIO_C_SET_CONNECT 100 +#define BIO_C_DO_STATE_MACHINE 101 +#define BIO_C_SET_NBIO 102 +#define BIO_C_SET_PROXY_PARAM 103 +#define BIO_C_SET_FD 104 +#define BIO_C_GET_FD 105 +#define BIO_C_SET_FILE_PTR 106 +#define BIO_C_GET_FILE_PTR 107 +#define BIO_C_SET_FILENAME 108 +#define BIO_C_SET_SSL 109 +#define BIO_C_GET_SSL 110 +#define BIO_C_SET_MD 111 +#define BIO_C_GET_MD 112 +#define BIO_C_GET_CIPHER_STATUS 113 +#define BIO_C_SET_BUF_MEM 114 +#define BIO_C_GET_BUF_MEM_PTR 115 +#define BIO_C_GET_BUFF_NUM_LINES 116 +#define BIO_C_SET_BUFF_SIZE 117 +#define BIO_C_SET_ACCEPT 118 +#define BIO_C_SSL_MODE 119 +#define BIO_C_GET_MD_CTX 120 +#define BIO_C_GET_PROXY_PARAM 121 +#define BIO_C_SET_BUFF_READ_DATA 122 /* data to read first */ +#define BIO_C_GET_CONNECT 123 +#define BIO_C_GET_ACCEPT 124 +#define BIO_C_SET_SSL_RENEGOTIATE_BYTES 125 +#define BIO_C_GET_SSL_NUM_RENEGOTIATES 126 +#define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT 127 +#define BIO_C_FILE_SEEK 128 +#define BIO_C_GET_CIPHER_CTX 129 +#define BIO_C_SET_BUF_MEM_EOF_RETURN \ + 130 /* return end of input \ + * value */ +#define BIO_C_SET_BIND_MODE 131 +#define BIO_C_GET_BIND_MODE 132 +#define BIO_C_FILE_TELL 133 +#define BIO_C_GET_SOCKS 134 +#define BIO_C_SET_SOCKS 135 + +#define BIO_C_SET_WRITE_BUF_SIZE 136 /* for BIO_s_bio */ +#define BIO_C_GET_WRITE_BUF_SIZE 137 +#define BIO_C_MAKE_BIO_PAIR 138 +#define BIO_C_DESTROY_BIO_PAIR 139 +#define BIO_C_GET_WRITE_GUARANTEE 140 +#define BIO_C_GET_READ_REQUEST 141 +#define BIO_C_SHUTDOWN_WR 142 +#define BIO_C_NREAD0 143 +#define BIO_C_NREAD 144 +#define BIO_C_NWRITE0 145 +#define BIO_C_NWRITE 146 +#define BIO_C_RESET_READ_REQUEST 147 +#define BIO_C_SET_MD_CTX 148 + +#define BIO_C_SET_PREFIX 149 +#define BIO_C_GET_PREFIX 150 +#define BIO_C_SET_SUFFIX 151 +#define BIO_C_GET_SUFFIX 152 + +#define BIO_C_SET_EX_ARG 153 +#define BIO_C_GET_EX_ARG 154 + +#define BIO_set_app_data(s, arg) BIO_set_ex_data(s, 0, arg) +#define BIO_get_app_data(s) BIO_get_ex_data(s, 0) + +/* BIO_s_connect() and BIO_s_socks4a_connect() */ +#define BIO_set_conn_hostname(b, name) \ + BIO_ctrl(b, BIO_C_SET_CONNECT, 0, (char*)name) +#define BIO_set_conn_port(b, port) \ + BIO_ctrl(b, BIO_C_SET_CONNECT, 1, (char*)port) +#define BIO_set_conn_ip(b, ip) BIO_ctrl(b, BIO_C_SET_CONNECT, 2, (char*)ip) +#define BIO_set_conn_int_port(b, port) \ + BIO_ctrl(b, BIO_C_SET_CONNECT, 3, (char*)port) +#define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b, BIO_C_GET_CONNECT, 0) +#define BIO_get_conn_port(b) BIO_ptr_ctrl(b, BIO_C_GET_CONNECT, 1) +#define BIO_get_conn_ip(b) BIO_ptr_ctrl(b, BIO_C_GET_CONNECT, 2) +#define BIO_get_conn_int_port(b) BIO_ctrl(b, BIO_C_GET_CONNECT, 3, NULL) + +#define BIO_set_nbio(b, n) BIO_ctrl(b, BIO_C_SET_NBIO, (n), NULL) + +/* BIO_s_accept() */ +#define BIO_set_accept_port(b, name) \ + BIO_ctrl(b, BIO_C_SET_ACCEPT, 0, (char*)name) +#define BIO_get_accept_port(b) BIO_ptr_ctrl(b, BIO_C_GET_ACCEPT, 0) +/* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */ +#define BIO_set_nbio_accept(b, n) \ + BIO_ctrl(b, BIO_C_SET_ACCEPT, 1, (n) ? (void*)"a" : NULL) +#define BIO_set_accept_bios(b, bio) BIO_ctrl(b, BIO_C_SET_ACCEPT, 2, (char*)bio) + +#define BIO_BIND_NORMAL 0 +#define BIO_BIND_REUSEADDR_IF_UNUSED 1 +#define BIO_BIND_REUSEADDR 2 +#define BIO_set_bind_mode(b, mode) BIO_ctrl(b, BIO_C_SET_BIND_MODE, mode, NULL) +#define BIO_get_bind_mode(b, mode) BIO_ctrl(b, BIO_C_GET_BIND_MODE, 0, NULL) + +/* BIO_s_accept() and BIO_s_connect() */ +#define BIO_do_connect(b) BIO_do_handshake(b) +#define BIO_do_accept(b) BIO_do_handshake(b) +#define BIO_do_handshake(b) BIO_ctrl(b, BIO_C_DO_STATE_MACHINE, 0, NULL) + +/* BIO_s_proxy_client() */ +#define BIO_set_url(b, url) BIO_ctrl(b, BIO_C_SET_PROXY_PARAM, 0, (char*)(url)) +#define BIO_set_proxies(b, p) BIO_ctrl(b, BIO_C_SET_PROXY_PARAM, 1, (char*)(p)) +/* BIO_set_nbio(b,n) */ +#define BIO_set_filter_bio(b, s) \ + BIO_ctrl(b, BIO_C_SET_PROXY_PARAM, 2, (char*)(s)) +/* BIO *BIO_get_filter_bio(BIO *bio); */ +#define BIO_set_proxy_cb(b, cb) \ + BIO_callback_ctrl(b, BIO_C_SET_PROXY_PARAM, 3, (void* (*cb)())) +#define BIO_set_proxy_header(b, sk) \ + BIO_ctrl(b, BIO_C_SET_PROXY_PARAM, 4, (char*)sk) +#define BIO_set_no_connect_return(b, bool) \ + BIO_int_ctrl(b, BIO_C_SET_PROXY_PARAM, 5, bool) + +#define BIO_get_proxy_header(b, skp) \ + BIO_ctrl(b, BIO_C_GET_PROXY_PARAM, 0, (char*)skp) +#define BIO_get_proxies(b, pxy_p) \ + BIO_ctrl(b, BIO_C_GET_PROXY_PARAM, 1, (char*)(pxy_p)) +#define BIO_get_url(b, url) BIO_ctrl(b, BIO_C_GET_PROXY_PARAM, 2, (char*)(url)) +#define BIO_get_no_connect_return(b) BIO_ctrl(b, BIO_C_GET_PROXY_PARAM, 5, NULL) + +/* BIO_s_datagram(), BIO_s_fd(), BIO_s_socket(), BIO_s_accept() and + * BIO_s_connect() */ +#define BIO_set_fd(b, fd, c) BIO_int_ctrl(b, BIO_C_SET_FD, c, fd) +#define BIO_get_fd(b, c) BIO_ctrl(b, BIO_C_GET_FD, 0, (char*)c) + +/* BIO_s_file() */ +#define BIO_set_fp(b, fp, c) BIO_ctrl(b, BIO_C_SET_FILE_PTR, c, (char*)fp) +#define BIO_get_fp(b, fpp) BIO_ctrl(b, BIO_C_GET_FILE_PTR, 0, (char*)fpp) + +/* BIO_s_fd() and BIO_s_file() */ +#define BIO_seek(b, ofs) (int)BIO_ctrl(b, BIO_C_FILE_SEEK, ofs, NULL) +#define BIO_tell(b) (int)BIO_ctrl(b, BIO_C_FILE_TELL, 0, NULL) + +/* + * name is cast to lose const, but might be better to route through a + * function so we can do it safely + */ +#ifdef CONST_STRICT +/* + * If you are wondering why this isn't defined, its because CONST_STRICT is + * purely a compile-time kludge to allow const to be checked. + */ +int BIO_read_filename(BIO* b, const char* name); +#else +#define BIO_read_filename(b, name) \ + BIO_ctrl(b, BIO_C_SET_FILENAME, BIO_CLOSE | BIO_FP_READ, (char*)name) +#endif +#define BIO_write_filename(b, name) \ + BIO_ctrl(b, BIO_C_SET_FILENAME, BIO_CLOSE | BIO_FP_WRITE, name) +#define BIO_append_filename(b, name) \ + BIO_ctrl(b, BIO_C_SET_FILENAME, BIO_CLOSE | BIO_FP_APPEND, name) +#define BIO_rw_filename(b, name) \ + BIO_ctrl(b, BIO_C_SET_FILENAME, BIO_CLOSE | BIO_FP_READ | BIO_FP_WRITE, name) + +/* + * WARNING WARNING, this ups the reference count on the read bio of the SSL + * structure. This is because the ssl read BIO is now pointed to by the + * next_bio field in the bio. So when you free the BIO, make sure you are + * doing a BIO_free_all() to catch the underlying BIO. + */ +#define BIO_set_ssl(b, ssl, c) BIO_ctrl(b, BIO_C_SET_SSL, c, (char*)ssl) +#define BIO_get_ssl(b, sslp) BIO_ctrl(b, BIO_C_GET_SSL, 0, (char*)sslp) +#define BIO_set_ssl_mode(b, client) BIO_ctrl(b, BIO_C_SSL_MODE, client, NULL) +#define BIO_set_ssl_renegotiate_bytes(b, num) \ + BIO_ctrl(b, BIO_C_SET_SSL_RENEGOTIATE_BYTES, num, NULL) +#define BIO_get_num_renegotiates(b) \ + BIO_ctrl(b, BIO_C_GET_SSL_NUM_RENEGOTIATES, 0, NULL) +#define BIO_set_ssl_renegotiate_timeout(b, seconds) \ + BIO_ctrl(b, BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT, seconds, NULL) + +/* defined in evp.h */ +/* #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,1,(char *)md) */ + +#define BIO_get_mem_data(b, pp) BIO_ctrl(b, BIO_CTRL_INFO, 0, (char*)pp) +#define BIO_set_mem_buf(b, bm, c) BIO_ctrl(b, BIO_C_SET_BUF_MEM, c, (char*)bm) +#define BIO_get_mem_ptr(b, pp) BIO_ctrl(b, BIO_C_GET_BUF_MEM_PTR, 0, (char*)pp) +#define BIO_set_mem_eof_return(b, v) \ + BIO_ctrl(b, BIO_C_SET_BUF_MEM_EOF_RETURN, v, NULL) + +/* For the BIO_f_buffer() type */ +#define BIO_get_buffer_num_lines(b) \ + BIO_ctrl(b, BIO_C_GET_BUFF_NUM_LINES, 0, NULL) +#define BIO_set_buffer_size(b, size) \ + BIO_ctrl(b, BIO_C_SET_BUFF_SIZE, size, NULL) +#define BIO_set_read_buffer_size(b, size) \ + BIO_int_ctrl(b, BIO_C_SET_BUFF_SIZE, size, 0) +#define BIO_set_write_buffer_size(b, size) \ + BIO_int_ctrl(b, BIO_C_SET_BUFF_SIZE, size, 1) +#define BIO_set_buffer_read_data(b, buf, num) \ + BIO_ctrl(b, BIO_C_SET_BUFF_READ_DATA, num, buf) + +/* Don't use the next one unless you know what you are doing :-) */ +#define BIO_dup_state(b, ret) BIO_ctrl(b, BIO_CTRL_DUP, 0, (char*)(ret)) + +#define BIO_reset(b) (int)BIO_ctrl(b, BIO_CTRL_RESET, 0, NULL) +#define BIO_eof(b) (int)BIO_ctrl(b, BIO_CTRL_EOF, 0, NULL) +#define BIO_set_close(b, c) (int)BIO_ctrl(b, BIO_CTRL_SET_CLOSE, (c), NULL) +#define BIO_get_close(b) (int)BIO_ctrl(b, BIO_CTRL_GET_CLOSE, 0, NULL) +#define BIO_pending(b) (int)BIO_ctrl(b, BIO_CTRL_PENDING, 0, NULL) +#define BIO_wpending(b) (int)BIO_ctrl(b, BIO_CTRL_WPENDING, 0, NULL) +/* ...pending macros have inappropriate return type */ +size_t BIO_ctrl_pending(BIO* b); +size_t BIO_ctrl_wpending(BIO* b); +#define BIO_flush(b) (int)BIO_ctrl(b, BIO_CTRL_FLUSH, 0, NULL) +#define BIO_get_info_callback(b, cbp) \ + (int)BIO_ctrl(b, BIO_CTRL_GET_CALLBACK, 0, cbp) +#define BIO_set_info_callback(b, cb) \ + (int)BIO_callback_ctrl(b, BIO_CTRL_SET_CALLBACK, cb) + +/* For the BIO_f_buffer() type */ +#define BIO_buffer_get_num_lines(b) BIO_ctrl(b, BIO_CTRL_GET, 0, NULL) + +/* For BIO_s_bio() */ +#define BIO_set_write_buf_size(b, size) \ + (int)BIO_ctrl(b, BIO_C_SET_WRITE_BUF_SIZE, size, NULL) +#define BIO_get_write_buf_size(b, size) \ + (size_t) BIO_ctrl(b, BIO_C_GET_WRITE_BUF_SIZE, size, NULL) +#define BIO_make_bio_pair(b1, b2) (int)BIO_ctrl(b1, BIO_C_MAKE_BIO_PAIR, 0, b2) +#define BIO_destroy_bio_pair(b) \ + (int)BIO_ctrl(b, BIO_C_DESTROY_BIO_PAIR, 0, NULL) +#define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL) +/* macros with inappropriate type -- but ...pending macros use int too: */ +#define BIO_get_write_guarantee(b) \ + (int)BIO_ctrl(b, BIO_C_GET_WRITE_GUARANTEE, 0, NULL) +#define BIO_get_read_request(b) \ + (int)BIO_ctrl(b, BIO_C_GET_READ_REQUEST, 0, NULL) +size_t BIO_ctrl_get_write_guarantee(BIO* b); +size_t BIO_ctrl_get_read_request(BIO* b); +int BIO_ctrl_reset_read_request(BIO* b); + +/* ctrl macros for dgram */ +#define BIO_ctrl_dgram_connect(b, peer) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_CONNECT, 0, (char*)peer) +#define BIO_ctrl_set_connected(b, state, peer) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, state, (char*)peer) +#define BIO_dgram_recv_timedout(b) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL) +#define BIO_dgram_send_timedout(b) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL) +#define BIO_dgram_get_peer(b, peer) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_PEER, 0, (char*)peer) +#define BIO_dgram_set_peer(b, peer) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char*)peer) +#define BIO_dgram_get_mtu_overhead(b) \ + (unsigned int)BIO_ctrl((b), BIO_CTRL_DGRAM_GET_MTU_OVERHEAD, 0, NULL) + +/* These two aren't currently implemented */ +/* int BIO_get_ex_num(BIO *bio); */ +/* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */ +int BIO_set_ex_data(BIO* bio, int idx, void* data); +void* BIO_get_ex_data(BIO* bio, int idx); +int BIO_get_ex_new_index( + long argl, + void* argp, + CRYPTO_EX_new* new_func, + CRYPTO_EX_dup* dup_func, + CRYPTO_EX_free* free_func); +unsigned long BIO_number_read(BIO* bio); +unsigned long BIO_number_written(BIO* bio); + +/* For BIO_f_asn1() */ +int BIO_asn1_set_prefix( + BIO* b, + asn1_ps_func* prefix, + asn1_ps_func* prefix_free); +int BIO_asn1_get_prefix( + BIO* b, + asn1_ps_func** pprefix, + asn1_ps_func** pprefix_free); +int BIO_asn1_set_suffix( + BIO* b, + asn1_ps_func* suffix, + asn1_ps_func* suffix_free); +int BIO_asn1_get_suffix( + BIO* b, + asn1_ps_func** psuffix, + asn1_ps_func** psuffix_free); + +#ifndef OPENSSL_NO_FP_API +BIO_METHOD* BIO_s_file(void); +BIO* BIO_new_file(const char* filename, const char* mode); +BIO* BIO_new_fp(FILE* stream, int close_flag); +#define BIO_s_file_internal BIO_s_file +#endif +BIO* BIO_new(BIO_METHOD* type); +int BIO_set(BIO* a, BIO_METHOD* type); +int BIO_free(BIO* a); +void BIO_vfree(BIO* a); +int BIO_read(BIO* b, void* data, int len); +int BIO_gets(BIO* bp, char* buf, int size); +int BIO_write(BIO* b, const void* data, int len); +int BIO_puts(BIO* bp, const char* buf); +int BIO_indent(BIO* b, int indent, int max); +long BIO_ctrl(BIO* bp, int cmd, long larg, void* parg); +long BIO_callback_ctrl( + BIO* b, + int cmd, + void (*fp)(struct bio_st*, int, const char*, int, long, long)); +char* BIO_ptr_ctrl(BIO* bp, int cmd, long larg); +long BIO_int_ctrl(BIO* bp, int cmd, long larg, int iarg); +BIO* BIO_push(BIO* b, BIO* append); +BIO* BIO_pop(BIO* b); +void BIO_free_all(BIO* a); +BIO* BIO_find_type(BIO* b, int bio_type); +BIO* BIO_next(BIO* b); +BIO* BIO_get_retry_BIO(BIO* bio, int* reason); +int BIO_get_retry_reason(BIO* bio); +BIO* BIO_dup_chain(BIO* in); + +int BIO_nread0(BIO* bio, char** buf); +int BIO_nread(BIO* bio, char** buf, int num); +int BIO_nwrite0(BIO* bio, char** buf); +int BIO_nwrite(BIO* bio, char** buf, int num); + +long BIO_debug_callback( + BIO* bio, + int cmd, + const char* argp, + int argi, + long argl, + long ret); + +BIO_METHOD* BIO_s_mem(void); +BIO* BIO_new_mem_buf(const void* buf, int len); +BIO_METHOD* BIO_s_socket(void); +BIO_METHOD* BIO_s_connect(void); +BIO_METHOD* BIO_s_accept(void); +BIO_METHOD* BIO_s_fd(void); +#ifndef OPENSSL_SYS_OS2 +BIO_METHOD* BIO_s_log(void); +#endif +BIO_METHOD* BIO_s_bio(void); +BIO_METHOD* BIO_s_null(void); +BIO_METHOD* BIO_f_null(void); +BIO_METHOD* BIO_f_buffer(void); +#ifdef OPENSSL_SYS_VMS +BIO_METHOD* BIO_f_linebuffer(void); +#endif +BIO_METHOD* BIO_f_nbio_test(void); +#ifndef OPENSSL_NO_DGRAM +BIO_METHOD* BIO_s_datagram(void); +#ifndef OPENSSL_NO_SCTP +BIO_METHOD* BIO_s_datagram_sctp(void); +#endif +#endif + +/* BIO_METHOD *BIO_f_ber(void); */ + +int BIO_sock_should_retry(int i); +int BIO_sock_non_fatal_error(int error); +int BIO_dgram_non_fatal_error(int error); + +int BIO_fd_should_retry(int i); +int BIO_fd_non_fatal_error(int error); +int BIO_dump_cb( + int (*cb)(const void* data, size_t len, void* u), + void* u, + const char* s, + int len); +int BIO_dump_indent_cb( + int (*cb)(const void* data, size_t len, void* u), + void* u, + const char* s, + int len, + int indent); +int BIO_dump(BIO* b, const char* bytes, int len); +int BIO_dump_indent(BIO* b, const char* bytes, int len, int indent); +#ifndef OPENSSL_NO_FP_API +int BIO_dump_fp(FILE* fp, const char* s, int len); +int BIO_dump_indent_fp(FILE* fp, const char* s, int len, int indent); +#endif +int BIO_hex_string( + BIO* out, + int indent, + int width, + unsigned char* data, + int datalen); + +struct hostent* BIO_gethostbyname(const char* name); +/*- + * We might want a thread-safe interface too: + * struct hostent *BIO_gethostbyname_r(const char *name, + * struct hostent *result, void *buffer, size_t buflen); + * or something similar (caller allocates a struct hostent, + * pointed to by "result", and additional buffer space for the various + * substructures; if the buffer does not suffice, NULL is returned + * and an appropriate error code is set). + */ +int BIO_sock_error(int sock); +int BIO_socket_ioctl(int fd, long type, void* arg); +int BIO_socket_nbio(int fd, int mode); +int BIO_get_port(const char* str, unsigned short* port_ptr); +int BIO_get_host_ip(const char* str, unsigned char* ip); +int BIO_get_accept_socket(char* host_port, int mode); +int BIO_accept(int sock, char** ip_port); +int BIO_sock_init(void); +void BIO_sock_cleanup(void); +int BIO_set_tcp_ndelay(int sock, int turn_on); + +BIO* BIO_new_socket(int sock, int close_flag); +BIO* BIO_new_dgram(int fd, int close_flag); +#ifndef OPENSSL_NO_SCTP +BIO* BIO_new_dgram_sctp(int fd, int close_flag); +int BIO_dgram_is_sctp(BIO* bio); +int BIO_dgram_sctp_notification_cb( + BIO* b, + void (*handle_notifications)(BIO* bio, void* context, void* buf), + void* context); +int BIO_dgram_sctp_wait_for_dry(BIO* b); +int BIO_dgram_sctp_msg_waiting(BIO* b); +#endif +BIO* BIO_new_fd(int fd, int close_flag); +BIO* BIO_new_connect(const char* host_port); +BIO* BIO_new_accept(const char* host_port); + +int BIO_new_bio_pair( + BIO** bio1, + size_t writebuf1, + BIO** bio2, + size_t writebuf2); +/* + * If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints. + * Otherwise returns 0 and sets *bio1 and *bio2 to NULL. Size 0 uses default + * value. + */ + +void BIO_copy_next_retry(BIO* b); + +/* + * long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); + */ + +#ifdef __GNUC__ +#define __bio_h__attr__ __attribute__ +#else +#define __bio_h__attr__(x) +#endif +int BIO_printf(BIO* bio, const char* format, ...) + __bio_h__attr__((__format__(__printf__, 2, 3))); +int BIO_vprintf(BIO* bio, const char* format, va_list args) + __bio_h__attr__((__format__(__printf__, 2, 0))); +int BIO_snprintf(char* buf, size_t n, const char* format, ...) + __bio_h__attr__((__format__(__printf__, 3, 4))); +int BIO_vsnprintf(char* buf, size_t n, const char* format, va_list args) + __bio_h__attr__((__format__(__printf__, 3, 0))); +#undef __bio_h__attr__ + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_BIO_strings(void); + +/* Error codes for the BIO functions. */ + +/* Function codes. */ +#define BIO_F_ACPT_STATE 100 +#define BIO_F_BIO_ACCEPT 101 +#define BIO_F_BIO_BER_GET_HEADER 102 +#define BIO_F_BIO_CALLBACK_CTRL 131 +#define BIO_F_BIO_CTRL 103 +#define BIO_F_BIO_GETHOSTBYNAME 120 +#define BIO_F_BIO_GETS 104 +#define BIO_F_BIO_GET_ACCEPT_SOCKET 105 +#define BIO_F_BIO_GET_HOST_IP 106 +#define BIO_F_BIO_GET_PORT 107 +#define BIO_F_BIO_MAKE_PAIR 121 +#define BIO_F_BIO_NEW 108 +#define BIO_F_BIO_NEW_FILE 109 +#define BIO_F_BIO_NEW_MEM_BUF 126 +#define BIO_F_BIO_NREAD 123 +#define BIO_F_BIO_NREAD0 124 +#define BIO_F_BIO_NWRITE 125 +#define BIO_F_BIO_NWRITE0 122 +#define BIO_F_BIO_PUTS 110 +#define BIO_F_BIO_READ 111 +#define BIO_F_BIO_SOCK_INIT 112 +#define BIO_F_BIO_WRITE 113 +#define BIO_F_BUFFER_CTRL 114 +#define BIO_F_CONN_CTRL 127 +#define BIO_F_CONN_STATE 115 +#define BIO_F_DGRAM_SCTP_READ 132 +#define BIO_F_DGRAM_SCTP_WRITE 133 +#define BIO_F_FILE_CTRL 116 +#define BIO_F_FILE_READ 130 +#define BIO_F_LINEBUFFER_CTRL 129 +#define BIO_F_MEM_READ 128 +#define BIO_F_MEM_WRITE 117 +#define BIO_F_SSL_NEW 118 +#define BIO_F_WSASTARTUP 119 + +/* Reason codes. */ +#define BIO_R_ACCEPT_ERROR 100 +#define BIO_R_BAD_FOPEN_MODE 101 +#define BIO_R_BAD_HOSTNAME_LOOKUP 102 +#define BIO_R_BROKEN_PIPE 124 +#define BIO_R_CONNECT_ERROR 103 +#define BIO_R_EOF_ON_MEMORY_BIO 127 +#define BIO_R_ERROR_SETTING_NBIO 104 +#define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET 105 +#define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET 106 +#define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107 +#define BIO_R_INVALID_ARGUMENT 125 +#define BIO_R_INVALID_IP_ADDRESS 108 +#define BIO_R_IN_USE 123 +#define BIO_R_KEEPALIVE 109 +#define BIO_R_NBIO_CONNECT_ERROR 110 +#define BIO_R_NO_ACCEPT_PORT_SPECIFIED 111 +#define BIO_R_NO_HOSTNAME_SPECIFIED 112 +#define BIO_R_NO_PORT_DEFINED 113 +#define BIO_R_NO_PORT_SPECIFIED 114 +#define BIO_R_NO_SUCH_FILE 128 +#define BIO_R_NULL_PARAMETER 115 +#define BIO_R_TAG_MISMATCH 116 +#define BIO_R_UNABLE_TO_BIND_SOCKET 117 +#define BIO_R_UNABLE_TO_CREATE_SOCKET 118 +#define BIO_R_UNABLE_TO_LISTEN_SOCKET 119 +#define BIO_R_UNINITIALIZED 120 +#define BIO_R_UNSUPPORTED_METHOD 121 +#define BIO_R_WRITE_TO_READ_ONLY_BIO 126 +#define BIO_R_WSASTARTUP 122 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/blowfish.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/blowfish.h new file mode 100644 index 0000000..32f432f --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/blowfish.h @@ -0,0 +1,147 @@ +/* crypto/bf/blowfish.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_BLOWFISH_H +#define HEADER_BLOWFISH_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSSL_NO_BF +#error BF is disabled. +#endif + +#define BF_ENCRYPT 1 +#define BF_DECRYPT 0 + +/*- + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! BF_LONG has to be at least 32 bits wide. If it's wider, then ! + * ! BF_LONG_LOG2 has to be defined along. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ + +#if defined(__LP32__) +#define BF_LONG unsigned long +#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) +#define BF_LONG unsigned long +#define BF_LONG_LOG2 3 +/* + * _CRAY note. I could declare short, but I have no idea what impact + * does it have on performance on none-T3E machines. I could declare + * int, but at least on C90 sizeof(int) can be chosen at compile time. + * So I've chosen long... + * + */ +#else +#define BF_LONG unsigned int +#endif + +#define BF_ROUNDS 16 +#define BF_BLOCK 8 + +typedef struct bf_key_st { + BF_LONG P[BF_ROUNDS + 2]; + BF_LONG S[4 * 256]; +} BF_KEY; + +#ifdef OPENSSL_FIPS +void private_BF_set_key(BF_KEY* key, int len, const unsigned char* data); +#endif +void BF_set_key(BF_KEY* key, int len, const unsigned char* data); + +void BF_encrypt(BF_LONG* data, const BF_KEY* key); +void BF_decrypt(BF_LONG* data, const BF_KEY* key); + +void BF_ecb_encrypt( + const unsigned char* in, + unsigned char* out, + const BF_KEY* key, + int enc); +void BF_cbc_encrypt( + const unsigned char* in, + unsigned char* out, + long length, + const BF_KEY* schedule, + unsigned char* ivec, + int enc); +void BF_cfb64_encrypt( + const unsigned char* in, + unsigned char* out, + long length, + const BF_KEY* schedule, + unsigned char* ivec, + int* num, + int enc); +void BF_ofb64_encrypt( + const unsigned char* in, + unsigned char* out, + long length, + const BF_KEY* schedule, + unsigned char* ivec, + int* num); +const char* BF_options(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/bn.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/bn.h new file mode 100644 index 0000000..74c6a99 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/bn.h @@ -0,0 +1,1095 @@ +/* crypto/bn/bn.h */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright (c) 1998-2006 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * + * Portions of the attached software ("Contribution") are developed by + * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project. + * + * The Contribution is licensed pursuant to the Eric Young open source + * license provided above. + * + * The binary polynomial arithmetic software is originally written by + * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories. + * + */ + +#ifndef HEADER_BN_H +#define HEADER_BN_H + +#include +#include +#ifndef OPENSSL_NO_FP_API +#include /* FILE */ +#endif +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * These preprocessor symbols control various aspects of the bignum headers + * and library code. They're not defined by any "normal" configuration, as + * they are intended for development and testing purposes. NB: defining all + * three can be useful for debugging application code as well as openssl + * itself. BN_DEBUG - turn on various debugging alterations to the bignum + * code BN_DEBUG_RAND - uses random poisoning of unused words to trip up + * mismanagement of bignum internals. You must also define BN_DEBUG. + */ +/* #define BN_DEBUG */ +/* #define BN_DEBUG_RAND */ + +#ifndef OPENSSL_SMALL_FOOTPRINT +#define BN_MUL_COMBA +#define BN_SQR_COMBA +#define BN_RECURSION +#endif + +/* + * This next option uses the C libraries (2 word)/(1 word) function. If it is + * not defined, I use my C version (which is slower). The reason for this + * flag is that when the particular C compiler library routine is used, and + * the library is linked with a different compiler, the library is missing. + * This mostly happens when the library is built with gcc and then linked + * using normal cc. This would be a common occurrence because gcc normally + * produces code that is 2 times faster than system compilers for the big + * number stuff. For machines with only one compiler (or shared libraries), + * this should be on. Again this in only really a problem on machines using + * "long long's", are 32bit, and are not using my assembler code. + */ +#if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) || \ + defined(OPENSSL_SYS_WIN32) || defined(linux) +#ifndef BN_DIV2W +#define BN_DIV2W +#endif +#endif + +/* + * assuming long is 64bit - this is the DEC Alpha unsigned long long is only + * 64 bits :-(, don't define BN_LLONG for the DEC Alpha + */ +#ifdef SIXTY_FOUR_BIT_LONG +#define BN_ULLONG unsigned long long +#define BN_ULONG unsigned long +#define BN_LONG long +#define BN_BITS 128 +#define BN_BYTES 8 +#define BN_BITS2 64 +#define BN_BITS4 32 +#define BN_MASK (0xffffffffffffffffffffffffffffffffLL) +#define BN_MASK2 (0xffffffffffffffffL) +#define BN_MASK2l (0xffffffffL) +#define BN_MASK2h (0xffffffff00000000L) +#define BN_MASK2h1 (0xffffffff80000000L) +#define BN_TBIT (0x8000000000000000L) +#define BN_DEC_CONV (10000000000000000000UL) +#define BN_DEC_FMT1 "%lu" +#define BN_DEC_FMT2 "%019lu" +#define BN_DEC_NUM 19 +#define BN_HEX_FMT1 "%lX" +#define BN_HEX_FMT2 "%016lX" +#endif + +/* + * This is where the long long data type is 64 bits, but long is 32. For + * machines where there are 64bit registers, this is the mode to use. IRIX, + * on R4000 and above should use this mode, along with the relevant assembler + * code :-). Do NOT define BN_LLONG. + */ +#ifdef SIXTY_FOUR_BIT +#undef BN_LLONG +#undef BN_ULLONG +#define BN_ULONG unsigned long long +#define BN_LONG long long +#define BN_BITS 128 +#define BN_BYTES 8 +#define BN_BITS2 64 +#define BN_BITS4 32 +#define BN_MASK2 (0xffffffffffffffffLL) +#define BN_MASK2l (0xffffffffL) +#define BN_MASK2h (0xffffffff00000000LL) +#define BN_MASK2h1 (0xffffffff80000000LL) +#define BN_TBIT (0x8000000000000000LL) +#define BN_DEC_CONV (10000000000000000000ULL) +#define BN_DEC_FMT1 "%llu" +#define BN_DEC_FMT2 "%019llu" +#define BN_DEC_NUM 19 +#define BN_HEX_FMT1 "%llX" +#define BN_HEX_FMT2 "%016llX" +#endif + +#ifdef THIRTY_TWO_BIT +#ifdef BN_LLONG +#if defined(_WIN32) && !defined(__GNUC__) +#define BN_ULLONG unsigned __int64 +#define BN_MASK (0xffffffffffffffffI64) +#else +#define BN_ULLONG unsigned long long +#define BN_MASK (0xffffffffffffffffLL) +#endif +#endif +#define BN_ULONG unsigned int +#define BN_LONG int +#define BN_BITS 64 +#define BN_BYTES 4 +#define BN_BITS2 32 +#define BN_BITS4 16 +#define BN_MASK2 (0xffffffffL) +#define BN_MASK2l (0xffff) +#define BN_MASK2h1 (0xffff8000L) +#define BN_MASK2h (0xffff0000L) +#define BN_TBIT (0x80000000L) +#define BN_DEC_CONV (1000000000L) +#define BN_DEC_FMT1 "%u" +#define BN_DEC_FMT2 "%09u" +#define BN_DEC_NUM 9 +#define BN_HEX_FMT1 "%X" +#define BN_HEX_FMT2 "%08X" +#endif + +#define BN_DEFAULT_BITS 1280 + +#define BN_FLG_MALLOCED 0x01 +#define BN_FLG_STATIC_DATA 0x02 + +/* + * avoid leaking exponent information through timing, + * BN_mod_exp_mont() will call BN_mod_exp_mont_consttime, + * BN_div() will call BN_div_no_branch, + * BN_mod_inverse() will call BN_mod_inverse_no_branch. + */ +#define BN_FLG_CONSTTIME 0x04 + +#ifdef OPENSSL_NO_DEPRECATED +/* deprecated name for the flag */ +#define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME +/* + * avoid leaking exponent information through timings + * (BN_mod_exp_mont() will call BN_mod_exp_mont_consttime) + */ +#endif + +#ifndef OPENSSL_NO_DEPRECATED +#define BN_FLG_FREE 0x8000 +/* used for debuging */ +#endif +#define BN_set_flags(b, n) ((b)->flags |= (n)) +#define BN_get_flags(b, n) ((b)->flags & (n)) + +/* + * get a clone of a BIGNUM with changed flags, for *temporary* use only (the + * two BIGNUMs cannot not be used in parallel!) + */ +#define BN_with_flags(dest, b, n) \ + ((dest)->d = (b)->d, \ + (dest)->top = (b)->top, \ + (dest)->dmax = (b)->dmax, \ + (dest)->neg = (b)->neg, \ + (dest)->flags = \ + (((dest)->flags & BN_FLG_MALLOCED) | ((b)->flags & ~BN_FLG_MALLOCED) | \ + BN_FLG_STATIC_DATA | (n))) + +/* Already declared in ossl_typ.h */ +#if 0 +typedef struct bignum_st BIGNUM; +/* Used for temp variables (declaration hidden in bn_lcl.h) */ +typedef struct bignum_ctx BN_CTX; +typedef struct bn_blinding_st BN_BLINDING; +typedef struct bn_mont_ctx_st BN_MONT_CTX; +typedef struct bn_recp_ctx_st BN_RECP_CTX; +typedef struct bn_gencb_st BN_GENCB; +#endif + +struct bignum_st { + BN_ULONG* d; /* Pointer to an array of 'BN_BITS2' bit + * chunks. */ + int top; /* Index of last used d +1. */ + /* The next are internal book keeping for bn_expand. */ + int dmax; /* Size of the d array. */ + int neg; /* one if the number is negative */ + int flags; +}; + +/* Used for montgomery multiplication */ +struct bn_mont_ctx_st { + int ri; /* number of bits in R */ + BIGNUM RR; /* used to convert to montgomery form */ + BIGNUM N; /* The modulus */ + BIGNUM Ni; /* R*(1/R mod N) - N*Ni = 1 (Ni is only + * stored for bignum algorithm) */ + BN_ULONG n0[2]; /* least significant word(s) of Ni; (type + * changed with 0.9.9, was "BN_ULONG n0;" + * before) */ + int flags; +}; + +/* + * Used for reciprocal division/mod functions It cannot be shared between + * threads + */ +struct bn_recp_ctx_st { + BIGNUM N; /* the divisor */ + BIGNUM Nr; /* the reciprocal */ + int num_bits; + int shift; + int flags; +}; + +/* Used for slow "generation" functions. */ +struct bn_gencb_st { + unsigned int ver; /* To handle binary (in)compatibility */ + void* arg; /* callback-specific data */ + union { + /* if(ver==1) - handles old style callbacks */ + void (*cb_1)(int, int, void*); + /* if(ver==2) - new callback style */ + int (*cb_2)(int, int, BN_GENCB*); + } cb; +}; +/* Wrapper function to make using BN_GENCB easier, */ +int BN_GENCB_call(BN_GENCB* cb, int a, int b); +/* Macro to populate a BN_GENCB structure with an "old"-style callback */ +#define BN_GENCB_set_old(gencb, callback, cb_arg) \ + { \ + BN_GENCB* tmp_gencb = (gencb); \ + tmp_gencb->ver = 1; \ + tmp_gencb->arg = (cb_arg); \ + tmp_gencb->cb.cb_1 = (callback); \ + } +/* Macro to populate a BN_GENCB structure with a "new"-style callback */ +#define BN_GENCB_set(gencb, callback, cb_arg) \ + { \ + BN_GENCB* tmp_gencb = (gencb); \ + tmp_gencb->ver = 2; \ + tmp_gencb->arg = (cb_arg); \ + tmp_gencb->cb.cb_2 = (callback); \ + } + +#define BN_prime_checks \ + 0 /* default: select number of iterations based \ + * on the size of the number */ + +/* + * number of Miller-Rabin iterations for an error rate of less than 2^-80 for + * random 'b'-bit input, b >= 100 (taken from table 4.4 in the Handbook of + * Applied Cryptography [Menezes, van Oorschot, Vanstone; CRC Press 1996]; + * original paper: Damgaard, Landrock, Pomerance: Average case error + * estimates for the strong probable prime test. -- Math. Comp. 61 (1993) + * 177-194) + */ +#define BN_prime_checks_for_size(b) \ + ((b) >= 1300 ? 2 : (b) >= 850 ? 3 : (b) >= 650 ? 4 : (b) >= 550 \ + ? 5 \ + : (b) >= 450 ? 6 : (b) >= 400 ? 7 : (b) >= 350 \ + ? 8 \ + : (b) >= 300 ? 9 : (b) >= 250 ? 12 : (b) >= 200 \ + ? 15 \ + : (b) >= 150 ? 18 \ + : /* b >= 100 */ 27) + +#define BN_num_bytes(a) ((BN_num_bits(a) + 7) / 8) + +/* Note that BN_abs_is_word didn't work reliably for w == 0 until 0.9.8 */ +#define BN_abs_is_word(a, w) \ + ((((a)->top == 1) && ((a)->d[0] == (BN_ULONG)(w))) || \ + (((w) == 0) && ((a)->top == 0))) +#define BN_is_zero(a) ((a)->top == 0) +#define BN_is_one(a) (BN_abs_is_word((a), 1) && !(a)->neg) +#define BN_is_word(a, w) (BN_abs_is_word((a), (w)) && (!(w) || !(a)->neg)) +#define BN_is_odd(a) (((a)->top > 0) && ((a)->d[0] & 1)) + +#define BN_one(a) (BN_set_word((a), 1)) +#define BN_zero_ex(a) \ + do { \ + BIGNUM* _tmp_bn = (a); \ + _tmp_bn->top = 0; \ + _tmp_bn->neg = 0; \ + } while (0) +#ifdef OPENSSL_NO_DEPRECATED +#define BN_zero(a) BN_zero_ex(a) +#else +#define BN_zero(a) (BN_set_word((a), 0)) +#endif + +const BIGNUM* BN_value_one(void); +char* BN_options(void); +BN_CTX* BN_CTX_new(void); +#ifndef OPENSSL_NO_DEPRECATED +void BN_CTX_init(BN_CTX* c); +#endif +void BN_CTX_free(BN_CTX* c); +void BN_CTX_start(BN_CTX* ctx); +BIGNUM* BN_CTX_get(BN_CTX* ctx); +void BN_CTX_end(BN_CTX* ctx); +int BN_rand(BIGNUM* rnd, int bits, int top, int bottom); +int BN_pseudo_rand(BIGNUM* rnd, int bits, int top, int bottom); +int BN_rand_range(BIGNUM* rnd, const BIGNUM* range); +int BN_pseudo_rand_range(BIGNUM* rnd, const BIGNUM* range); +int BN_num_bits(const BIGNUM* a); +int BN_num_bits_word(BN_ULONG); +BIGNUM* BN_new(void); +void BN_init(BIGNUM*); +void BN_clear_free(BIGNUM* a); +BIGNUM* BN_copy(BIGNUM* a, const BIGNUM* b); +void BN_swap(BIGNUM* a, BIGNUM* b); +BIGNUM* BN_bin2bn(const unsigned char* s, int len, BIGNUM* ret); +int BN_bn2bin(const BIGNUM* a, unsigned char* to); +BIGNUM* BN_mpi2bn(const unsigned char* s, int len, BIGNUM* ret); +int BN_bn2mpi(const BIGNUM* a, unsigned char* to); +int BN_sub(BIGNUM* r, const BIGNUM* a, const BIGNUM* b); +int BN_usub(BIGNUM* r, const BIGNUM* a, const BIGNUM* b); +int BN_uadd(BIGNUM* r, const BIGNUM* a, const BIGNUM* b); +int BN_add(BIGNUM* r, const BIGNUM* a, const BIGNUM* b); +int BN_mul(BIGNUM* r, const BIGNUM* a, const BIGNUM* b, BN_CTX* ctx); +int BN_sqr(BIGNUM* r, const BIGNUM* a, BN_CTX* ctx); +/** BN_set_negative sets sign of a BIGNUM + * \param b pointer to the BIGNUM object + * \param n 0 if the BIGNUM b should be positive and a value != 0 otherwise + */ +void BN_set_negative(BIGNUM* b, int n); +/** BN_is_negative returns 1 if the BIGNUM is negative + * \param a pointer to the BIGNUM object + * \return 1 if a < 0 and 0 otherwise + */ +#define BN_is_negative(a) ((a)->neg != 0) + +int BN_div( + BIGNUM* dv, + BIGNUM* rem, + const BIGNUM* m, + const BIGNUM* d, + BN_CTX* ctx); +#define BN_mod(rem, m, d, ctx) BN_div(NULL, (rem), (m), (d), (ctx)) +int BN_nnmod(BIGNUM* r, const BIGNUM* m, const BIGNUM* d, BN_CTX* ctx); +int BN_mod_add( + BIGNUM* r, + const BIGNUM* a, + const BIGNUM* b, + const BIGNUM* m, + BN_CTX* ctx); +int BN_mod_add_quick( + BIGNUM* r, + const BIGNUM* a, + const BIGNUM* b, + const BIGNUM* m); +int BN_mod_sub( + BIGNUM* r, + const BIGNUM* a, + const BIGNUM* b, + const BIGNUM* m, + BN_CTX* ctx); +int BN_mod_sub_quick( + BIGNUM* r, + const BIGNUM* a, + const BIGNUM* b, + const BIGNUM* m); +int BN_mod_mul( + BIGNUM* r, + const BIGNUM* a, + const BIGNUM* b, + const BIGNUM* m, + BN_CTX* ctx); +int BN_mod_sqr(BIGNUM* r, const BIGNUM* a, const BIGNUM* m, BN_CTX* ctx); +int BN_mod_lshift1(BIGNUM* r, const BIGNUM* a, const BIGNUM* m, BN_CTX* ctx); +int BN_mod_lshift1_quick(BIGNUM* r, const BIGNUM* a, const BIGNUM* m); +int BN_mod_lshift( + BIGNUM* r, + const BIGNUM* a, + int n, + const BIGNUM* m, + BN_CTX* ctx); +int BN_mod_lshift_quick(BIGNUM* r, const BIGNUM* a, int n, const BIGNUM* m); + +BN_ULONG BN_mod_word(const BIGNUM* a, BN_ULONG w); +BN_ULONG BN_div_word(BIGNUM* a, BN_ULONG w); +int BN_mul_word(BIGNUM* a, BN_ULONG w); +int BN_add_word(BIGNUM* a, BN_ULONG w); +int BN_sub_word(BIGNUM* a, BN_ULONG w); +int BN_set_word(BIGNUM* a, BN_ULONG w); +BN_ULONG BN_get_word(const BIGNUM* a); + +int BN_cmp(const BIGNUM* a, const BIGNUM* b); +void BN_free(BIGNUM* a); +int BN_is_bit_set(const BIGNUM* a, int n); +int BN_lshift(BIGNUM* r, const BIGNUM* a, int n); +int BN_lshift1(BIGNUM* r, const BIGNUM* a); +int BN_exp(BIGNUM* r, const BIGNUM* a, const BIGNUM* p, BN_CTX* ctx); + +int BN_mod_exp( + BIGNUM* r, + const BIGNUM* a, + const BIGNUM* p, + const BIGNUM* m, + BN_CTX* ctx); +int BN_mod_exp_mont( + BIGNUM* r, + const BIGNUM* a, + const BIGNUM* p, + const BIGNUM* m, + BN_CTX* ctx, + BN_MONT_CTX* m_ctx); +int BN_mod_exp_mont_consttime( + BIGNUM* rr, + const BIGNUM* a, + const BIGNUM* p, + const BIGNUM* m, + BN_CTX* ctx, + BN_MONT_CTX* in_mont); +int BN_mod_exp_mont_word( + BIGNUM* r, + BN_ULONG a, + const BIGNUM* p, + const BIGNUM* m, + BN_CTX* ctx, + BN_MONT_CTX* m_ctx); +int BN_mod_exp2_mont( + BIGNUM* r, + const BIGNUM* a1, + const BIGNUM* p1, + const BIGNUM* a2, + const BIGNUM* p2, + const BIGNUM* m, + BN_CTX* ctx, + BN_MONT_CTX* m_ctx); +int BN_mod_exp_simple( + BIGNUM* r, + const BIGNUM* a, + const BIGNUM* p, + const BIGNUM* m, + BN_CTX* ctx); + +int BN_mask_bits(BIGNUM* a, int n); +#ifndef OPENSSL_NO_FP_API +int BN_print_fp(FILE* fp, const BIGNUM* a); +#endif +#ifdef HEADER_BIO_H +int BN_print(BIO* fp, const BIGNUM* a); +#else +int BN_print(void* fp, const BIGNUM* a); +#endif +int BN_reciprocal(BIGNUM* r, const BIGNUM* m, int len, BN_CTX* ctx); +int BN_rshift(BIGNUM* r, const BIGNUM* a, int n); +int BN_rshift1(BIGNUM* r, const BIGNUM* a); +void BN_clear(BIGNUM* a); +BIGNUM* BN_dup(const BIGNUM* a); +int BN_ucmp(const BIGNUM* a, const BIGNUM* b); +int BN_set_bit(BIGNUM* a, int n); +int BN_clear_bit(BIGNUM* a, int n); +char* BN_bn2hex(const BIGNUM* a); +char* BN_bn2dec(const BIGNUM* a); +int BN_hex2bn(BIGNUM** a, const char* str); +int BN_dec2bn(BIGNUM** a, const char* str); +int BN_asc2bn(BIGNUM** a, const char* str); +int BN_gcd(BIGNUM* r, const BIGNUM* a, const BIGNUM* b, BN_CTX* ctx); +int BN_kronecker(const BIGNUM* a, const BIGNUM* b, BN_CTX* ctx); /* returns + * -2 for + * error */ +BIGNUM* +BN_mod_inverse(BIGNUM* ret, const BIGNUM* a, const BIGNUM* n, BN_CTX* ctx); +BIGNUM* BN_mod_sqrt(BIGNUM* ret, const BIGNUM* a, const BIGNUM* n, BN_CTX* ctx); + +void BN_consttime_swap(BN_ULONG swap, BIGNUM* a, BIGNUM* b, int nwords); + +/* Deprecated versions */ +#ifndef OPENSSL_NO_DEPRECATED +BIGNUM* BN_generate_prime( + BIGNUM* ret, + int bits, + int safe, + const BIGNUM* add, + const BIGNUM* rem, + void (*callback)(int, int, void*), + void* cb_arg); +int BN_is_prime( + const BIGNUM* p, + int nchecks, + void (*callback)(int, int, void*), + BN_CTX* ctx, + void* cb_arg); +int BN_is_prime_fasttest( + const BIGNUM* p, + int nchecks, + void (*callback)(int, int, void*), + BN_CTX* ctx, + void* cb_arg, + int do_trial_division); +#endif /* !defined(OPENSSL_NO_DEPRECATED) */ + +/* Newer versions */ +int BN_generate_prime_ex( + BIGNUM* ret, + int bits, + int safe, + const BIGNUM* add, + const BIGNUM* rem, + BN_GENCB* cb); +int BN_is_prime_ex(const BIGNUM* p, int nchecks, BN_CTX* ctx, BN_GENCB* cb); +int BN_is_prime_fasttest_ex( + const BIGNUM* p, + int nchecks, + BN_CTX* ctx, + int do_trial_division, + BN_GENCB* cb); + +int BN_X931_generate_Xpq(BIGNUM* Xp, BIGNUM* Xq, int nbits, BN_CTX* ctx); + +int BN_X931_derive_prime_ex( + BIGNUM* p, + BIGNUM* p1, + BIGNUM* p2, + const BIGNUM* Xp, + const BIGNUM* Xp1, + const BIGNUM* Xp2, + const BIGNUM* e, + BN_CTX* ctx, + BN_GENCB* cb); +int BN_X931_generate_prime_ex( + BIGNUM* p, + BIGNUM* p1, + BIGNUM* p2, + BIGNUM* Xp1, + BIGNUM* Xp2, + const BIGNUM* Xp, + const BIGNUM* e, + BN_CTX* ctx, + BN_GENCB* cb); + +BN_MONT_CTX* BN_MONT_CTX_new(void); +void BN_MONT_CTX_init(BN_MONT_CTX* ctx); +int BN_mod_mul_montgomery( + BIGNUM* r, + const BIGNUM* a, + const BIGNUM* b, + BN_MONT_CTX* mont, + BN_CTX* ctx); +#define BN_to_montgomery(r, a, mont, ctx) \ + BN_mod_mul_montgomery((r), (a), &((mont)->RR), (mont), (ctx)) +int BN_from_montgomery( + BIGNUM* r, + const BIGNUM* a, + BN_MONT_CTX* mont, + BN_CTX* ctx); +void BN_MONT_CTX_free(BN_MONT_CTX* mont); +int BN_MONT_CTX_set(BN_MONT_CTX* mont, const BIGNUM* mod, BN_CTX* ctx); +BN_MONT_CTX* BN_MONT_CTX_copy(BN_MONT_CTX* to, BN_MONT_CTX* from); +BN_MONT_CTX* BN_MONT_CTX_set_locked( + BN_MONT_CTX** pmont, + int lock, + const BIGNUM* mod, + BN_CTX* ctx); + +/* BN_BLINDING flags */ +#define BN_BLINDING_NO_UPDATE 0x00000001 +#define BN_BLINDING_NO_RECREATE 0x00000002 + +BN_BLINDING* BN_BLINDING_new(const BIGNUM* A, const BIGNUM* Ai, BIGNUM* mod); +void BN_BLINDING_free(BN_BLINDING* b); +int BN_BLINDING_update(BN_BLINDING* b, BN_CTX* ctx); +int BN_BLINDING_convert(BIGNUM* n, BN_BLINDING* b, BN_CTX* ctx); +int BN_BLINDING_invert(BIGNUM* n, BN_BLINDING* b, BN_CTX* ctx); +int BN_BLINDING_convert_ex(BIGNUM* n, BIGNUM* r, BN_BLINDING* b, BN_CTX*); +int BN_BLINDING_invert_ex(BIGNUM* n, const BIGNUM* r, BN_BLINDING* b, BN_CTX*); +#ifndef OPENSSL_NO_DEPRECATED +unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING*); +void BN_BLINDING_set_thread_id(BN_BLINDING*, unsigned long); +#endif +CRYPTO_THREADID* BN_BLINDING_thread_id(BN_BLINDING*); +unsigned long BN_BLINDING_get_flags(const BN_BLINDING*); +void BN_BLINDING_set_flags(BN_BLINDING*, unsigned long); +BN_BLINDING* BN_BLINDING_create_param( + BN_BLINDING* b, + const BIGNUM* e, + BIGNUM* m, + BN_CTX* ctx, + int (*bn_mod_exp)( + BIGNUM* r, + const BIGNUM* a, + const BIGNUM* p, + const BIGNUM* m, + BN_CTX* ctx, + BN_MONT_CTX* m_ctx), + BN_MONT_CTX* m_ctx); + +#ifndef OPENSSL_NO_DEPRECATED +void BN_set_params(int mul, int high, int low, int mont); +int BN_get_params(int which); /* 0, mul, 1 high, 2 low, 3 mont */ +#endif + +void BN_RECP_CTX_init(BN_RECP_CTX* recp); +BN_RECP_CTX* BN_RECP_CTX_new(void); +void BN_RECP_CTX_free(BN_RECP_CTX* recp); +int BN_RECP_CTX_set(BN_RECP_CTX* recp, const BIGNUM* rdiv, BN_CTX* ctx); +int BN_mod_mul_reciprocal( + BIGNUM* r, + const BIGNUM* x, + const BIGNUM* y, + BN_RECP_CTX* recp, + BN_CTX* ctx); +int BN_mod_exp_recp( + BIGNUM* r, + const BIGNUM* a, + const BIGNUM* p, + const BIGNUM* m, + BN_CTX* ctx); +int BN_div_recp( + BIGNUM* dv, + BIGNUM* rem, + const BIGNUM* m, + BN_RECP_CTX* recp, + BN_CTX* ctx); + +#ifndef OPENSSL_NO_EC2M + +/* + * Functions for arithmetic over binary polynomials represented by BIGNUMs. + * The BIGNUM::neg property of BIGNUMs representing binary polynomials is + * ignored. Note that input arguments are not const so that their bit arrays + * can be expanded to the appropriate size if needed. + */ + +/* + * r = a + b + */ +int BN_GF2m_add(BIGNUM* r, const BIGNUM* a, const BIGNUM* b); +#define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b) +/* + * r=a mod p + */ +int BN_GF2m_mod(BIGNUM* r, const BIGNUM* a, const BIGNUM* p); +/* r = (a * b) mod p */ +int BN_GF2m_mod_mul( + BIGNUM* r, + const BIGNUM* a, + const BIGNUM* b, + const BIGNUM* p, + BN_CTX* ctx); +/* r = (a * a) mod p */ +int BN_GF2m_mod_sqr(BIGNUM* r, const BIGNUM* a, const BIGNUM* p, BN_CTX* ctx); +/* r = (1 / b) mod p */ +int BN_GF2m_mod_inv(BIGNUM* r, const BIGNUM* b, const BIGNUM* p, BN_CTX* ctx); +/* r = (a / b) mod p */ +int BN_GF2m_mod_div( + BIGNUM* r, + const BIGNUM* a, + const BIGNUM* b, + const BIGNUM* p, + BN_CTX* ctx); +/* r = (a ^ b) mod p */ +int BN_GF2m_mod_exp( + BIGNUM* r, + const BIGNUM* a, + const BIGNUM* b, + const BIGNUM* p, + BN_CTX* ctx); +/* r = sqrt(a) mod p */ +int BN_GF2m_mod_sqrt(BIGNUM* r, const BIGNUM* a, const BIGNUM* p, BN_CTX* ctx); +/* r^2 + r = a mod p */ +int BN_GF2m_mod_solve_quad( + BIGNUM* r, + const BIGNUM* a, + const BIGNUM* p, + BN_CTX* ctx); +#define BN_GF2m_cmp(a, b) BN_ucmp((a), (b)) +/*- + * Some functions allow for representation of the irreducible polynomials + * as an unsigned int[], say p. The irreducible f(t) is then of the form: + * t^p[0] + t^p[1] + ... + t^p[k] + * where m = p[0] > p[1] > ... > p[k] = 0. + */ +/* r = a mod p */ +int BN_GF2m_mod_arr(BIGNUM* r, const BIGNUM* a, const int p[]); +/* r = (a * b) mod p */ +int BN_GF2m_mod_mul_arr( + BIGNUM* r, + const BIGNUM* a, + const BIGNUM* b, + const int p[], + BN_CTX* ctx); +/* r = (a * a) mod p */ +int BN_GF2m_mod_sqr_arr(BIGNUM* r, const BIGNUM* a, const int p[], BN_CTX* ctx); +/* r = (1 / b) mod p */ +int BN_GF2m_mod_inv_arr(BIGNUM* r, const BIGNUM* b, const int p[], BN_CTX* ctx); +/* r = (a / b) mod p */ +int BN_GF2m_mod_div_arr( + BIGNUM* r, + const BIGNUM* a, + const BIGNUM* b, + const int p[], + BN_CTX* ctx); +/* r = (a ^ b) mod p */ +int BN_GF2m_mod_exp_arr( + BIGNUM* r, + const BIGNUM* a, + const BIGNUM* b, + const int p[], + BN_CTX* ctx); +/* r = sqrt(a) mod p */ +int BN_GF2m_mod_sqrt_arr( + BIGNUM* r, + const BIGNUM* a, + const int p[], + BN_CTX* ctx); +/* r^2 + r = a mod p */ +int BN_GF2m_mod_solve_quad_arr( + BIGNUM* r, + const BIGNUM* a, + const int p[], + BN_CTX* ctx); +int BN_GF2m_poly2arr(const BIGNUM* a, int p[], int max); +int BN_GF2m_arr2poly(const int p[], BIGNUM* a); + +#endif + +/* + * faster mod functions for the 'NIST primes' 0 <= a < p^2 + */ +int BN_nist_mod_192(BIGNUM* r, const BIGNUM* a, const BIGNUM* p, BN_CTX* ctx); +int BN_nist_mod_224(BIGNUM* r, const BIGNUM* a, const BIGNUM* p, BN_CTX* ctx); +int BN_nist_mod_256(BIGNUM* r, const BIGNUM* a, const BIGNUM* p, BN_CTX* ctx); +int BN_nist_mod_384(BIGNUM* r, const BIGNUM* a, const BIGNUM* p, BN_CTX* ctx); +int BN_nist_mod_521(BIGNUM* r, const BIGNUM* a, const BIGNUM* p, BN_CTX* ctx); + +const BIGNUM* BN_get0_nist_prime_192(void); +const BIGNUM* BN_get0_nist_prime_224(void); +const BIGNUM* BN_get0_nist_prime_256(void); +const BIGNUM* BN_get0_nist_prime_384(void); +const BIGNUM* BN_get0_nist_prime_521(void); + +/* library internal functions */ + +#define bn_expand(a, bits) \ + (bits > (INT_MAX - BN_BITS2 + 1) \ + ? NULL \ + : (((bits + BN_BITS2 - 1) / BN_BITS2) <= (a)->dmax) \ + ? (a) \ + : bn_expand2((a), (bits + BN_BITS2 - 1) / BN_BITS2)) + +#define bn_wexpand(a, words) \ + (((words) <= (a)->dmax) ? (a) : bn_expand2((a), (words))) +BIGNUM* bn_expand2(BIGNUM* a, int words); +#ifndef OPENSSL_NO_DEPRECATED +BIGNUM* bn_dup_expand(const BIGNUM* a, int words); /* unused */ +#endif + +/*- + * Bignum consistency macros + * There is one "API" macro, bn_fix_top(), for stripping leading zeroes from + * bignum data after direct manipulations on the data. There is also an + * "internal" macro, bn_check_top(), for verifying that there are no leading + * zeroes. Unfortunately, some auditing is required due to the fact that + * bn_fix_top() has become an overabused duct-tape because bignum data is + * occasionally passed around in an inconsistent state. So the following + * changes have been made to sort this out; + * - bn_fix_top()s implementation has been moved to bn_correct_top() + * - if BN_DEBUG isn't defined, bn_fix_top() maps to bn_correct_top(), and + * bn_check_top() is as before. + * - if BN_DEBUG *is* defined; + * - bn_check_top() tries to pollute unused words even if the bignum 'top' is + * consistent. (ed: only if BN_DEBUG_RAND is defined) + * - bn_fix_top() maps to bn_check_top() rather than "fixing" anything. + * The idea is to have debug builds flag up inconsistent bignums when they + * occur. If that occurs in a bn_fix_top(), we examine the code in question; if + * the use of bn_fix_top() was appropriate (ie. it follows directly after code + * that manipulates the bignum) it is converted to bn_correct_top(), and if it + * was not appropriate, we convert it permanently to bn_check_top() and track + * down the cause of the bug. Eventually, no internal code should be using the + * bn_fix_top() macro. External applications and libraries should try this with + * their own code too, both in terms of building against the openssl headers + * with BN_DEBUG defined *and* linking with a version of OpenSSL built with it + * defined. This not only improves external code, it provides more test + * coverage for openssl's own code. + */ + +#ifdef BN_DEBUG + +/* We only need assert() when debugging */ +#include + +#ifdef BN_DEBUG_RAND +/* To avoid "make update" cvs wars due to BN_DEBUG, use some tricks */ +#ifndef RAND_pseudo_bytes +int RAND_pseudo_bytes(unsigned char* buf, int num); +#define BN_DEBUG_TRIX +#endif +#define bn_pollute(a) \ + do { \ + const BIGNUM* _bnum1 = (a); \ + if (_bnum1->top < _bnum1->dmax) { \ + unsigned char _tmp_char; \ + /* We cast away const without the compiler knowing, any \ + * *genuinely* constant variables that aren't mutable \ + * wouldn't be constructed with top!=dmax. */ \ + BN_ULONG* _not_const; \ + memcpy(&_not_const, &_bnum1->d, sizeof(BN_ULONG*)); \ + /* Debug only - safe to ignore error return */ \ + RAND_pseudo_bytes(&_tmp_char, 1); \ + memset( \ + (unsigned char*)(_not_const + _bnum1->top), \ + _tmp_char, \ + (_bnum1->dmax - _bnum1->top) * sizeof(BN_ULONG)); \ + } \ + } while (0) +#ifdef BN_DEBUG_TRIX +#undef RAND_pseudo_bytes +#endif +#else +#define bn_pollute(a) +#endif +#define bn_check_top(a) \ + do { \ + const BIGNUM* _bnum2 = (a); \ + if (_bnum2 != NULL) { \ + assert((_bnum2->top == 0) || (_bnum2->d[_bnum2->top - 1] != 0)); \ + bn_pollute(_bnum2); \ + } \ + } while (0) + +#define bn_fix_top(a) bn_check_top(a) + +#define bn_check_size(bn, bits) \ + bn_wcheck_size(bn, ((bits + BN_BITS2 - 1)) / BN_BITS2) +#define bn_wcheck_size(bn, words) \ + do { \ + const BIGNUM* _bnum2 = (bn); \ + assert((words) <= (_bnum2)->dmax && (words) >= (_bnum2)->top); \ + /* avoid unused variable warning with NDEBUG */ \ + (void)(_bnum2); \ + } while (0) + +#else /* !BN_DEBUG */ + +#define bn_pollute(a) +#define bn_check_top(a) +#define bn_fix_top(a) bn_correct_top(a) +#define bn_check_size(bn, bits) +#define bn_wcheck_size(bn, words) + +#endif + +#define bn_correct_top(a) \ + { \ + BN_ULONG* ftl; \ + int tmp_top = (a)->top; \ + if (tmp_top > 0) { \ + for (ftl = &((a)->d[tmp_top - 1]); tmp_top > 0; tmp_top--) \ + if (*(ftl--)) \ + break; \ + (a)->top = tmp_top; \ + } \ + if ((a)->top == 0) \ + (a)->neg = 0; \ + bn_pollute(a); \ + } + +BN_ULONG +bn_mul_add_words(BN_ULONG* rp, const BN_ULONG* ap, int num, BN_ULONG w); +BN_ULONG bn_mul_words(BN_ULONG* rp, const BN_ULONG* ap, int num, BN_ULONG w); +void bn_sqr_words(BN_ULONG* rp, const BN_ULONG* ap, int num); +BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d); +BN_ULONG +bn_add_words(BN_ULONG* rp, const BN_ULONG* ap, const BN_ULONG* bp, int num); +BN_ULONG +bn_sub_words(BN_ULONG* rp, const BN_ULONG* ap, const BN_ULONG* bp, int num); + +/* Primes from RFC 2409 */ +BIGNUM* get_rfc2409_prime_768(BIGNUM* bn); +BIGNUM* get_rfc2409_prime_1024(BIGNUM* bn); + +/* Primes from RFC 3526 */ +BIGNUM* get_rfc3526_prime_1536(BIGNUM* bn); +BIGNUM* get_rfc3526_prime_2048(BIGNUM* bn); +BIGNUM* get_rfc3526_prime_3072(BIGNUM* bn); +BIGNUM* get_rfc3526_prime_4096(BIGNUM* bn); +BIGNUM* get_rfc3526_prime_6144(BIGNUM* bn); +BIGNUM* get_rfc3526_prime_8192(BIGNUM* bn); + +int BN_bntest_rand(BIGNUM* rnd, int bits, int top, int bottom); + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_BN_strings(void); + +/* Error codes for the BN functions. */ + +/* Function codes. */ +#define BN_F_BNRAND 127 +#define BN_F_BN_BLINDING_CONVERT_EX 100 +#define BN_F_BN_BLINDING_CREATE_PARAM 128 +#define BN_F_BN_BLINDING_INVERT_EX 101 +#define BN_F_BN_BLINDING_NEW 102 +#define BN_F_BN_BLINDING_UPDATE 103 +#define BN_F_BN_BN2DEC 104 +#define BN_F_BN_BN2HEX 105 +#define BN_F_BN_CTX_GET 116 +#define BN_F_BN_CTX_NEW 106 +#define BN_F_BN_CTX_START 129 +#define BN_F_BN_DIV 107 +#define BN_F_BN_DIV_NO_BRANCH 138 +#define BN_F_BN_DIV_RECP 130 +#define BN_F_BN_EXP 123 +#define BN_F_BN_EXPAND2 108 +#define BN_F_BN_EXPAND_INTERNAL 120 +#define BN_F_BN_GF2M_MOD 131 +#define BN_F_BN_GF2M_MOD_EXP 132 +#define BN_F_BN_GF2M_MOD_MUL 133 +#define BN_F_BN_GF2M_MOD_SOLVE_QUAD 134 +#define BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR 135 +#define BN_F_BN_GF2M_MOD_SQR 136 +#define BN_F_BN_GF2M_MOD_SQRT 137 +#define BN_F_BN_LSHIFT 145 +#define BN_F_BN_MOD_EXP2_MONT 118 +#define BN_F_BN_MOD_EXP_MONT 109 +#define BN_F_BN_MOD_EXP_MONT_CONSTTIME 124 +#define BN_F_BN_MOD_EXP_MONT_WORD 117 +#define BN_F_BN_MOD_EXP_RECP 125 +#define BN_F_BN_MOD_EXP_SIMPLE 126 +#define BN_F_BN_MOD_INVERSE 110 +#define BN_F_BN_MOD_INVERSE_NO_BRANCH 139 +#define BN_F_BN_MOD_LSHIFT_QUICK 119 +#define BN_F_BN_MOD_MUL_RECIPROCAL 111 +#define BN_F_BN_MOD_SQRT 121 +#define BN_F_BN_MPI2BN 112 +#define BN_F_BN_NEW 113 +#define BN_F_BN_RAND 114 +#define BN_F_BN_RAND_RANGE 122 +#define BN_F_BN_RSHIFT 146 +#define BN_F_BN_USUB 115 + +/* Reason codes. */ +#define BN_R_ARG2_LT_ARG3 100 +#define BN_R_BAD_RECIPROCAL 101 +#define BN_R_BIGNUM_TOO_LONG 114 +#define BN_R_BITS_TOO_SMALL 118 +#define BN_R_CALLED_WITH_EVEN_MODULUS 102 +#define BN_R_DIV_BY_ZERO 103 +#define BN_R_ENCODING_ERROR 104 +#define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA 105 +#define BN_R_INPUT_NOT_REDUCED 110 +#define BN_R_INVALID_LENGTH 106 +#define BN_R_INVALID_RANGE 115 +#define BN_R_INVALID_SHIFT 119 +#define BN_R_NOT_A_SQUARE 111 +#define BN_R_NOT_INITIALIZED 107 +#define BN_R_NO_INVERSE 108 +#define BN_R_NO_SOLUTION 116 +#define BN_R_P_IS_NOT_PRIME 112 +#define BN_R_TOO_MANY_ITERATIONS 113 +#define BN_R_TOO_MANY_TEMPORARY_VARIABLES 109 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/buffer.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/buffer.h new file mode 100644 index 0000000..db8f541 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/buffer.h @@ -0,0 +1,125 @@ +/* crypto/buffer/buffer.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_BUFFER_H +#define HEADER_BUFFER_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#if !defined(NO_SYS_TYPES_H) +#include +#endif + +/* Already declared in ossl_typ.h */ +/* typedef struct buf_mem_st BUF_MEM; */ + +struct buf_mem_st { + size_t length; /* current number of bytes */ + char* data; + size_t max; /* size of buffer */ +}; + +BUF_MEM* BUF_MEM_new(void); +void BUF_MEM_free(BUF_MEM* a); +int BUF_MEM_grow(BUF_MEM* str, size_t len); +int BUF_MEM_grow_clean(BUF_MEM* str, size_t len); +size_t BUF_strnlen(const char* str, size_t maxlen); +char* BUF_strdup(const char* str); + +/* + * Like strndup, but in addition, explicitly guarantees to never read past the + * first |siz| bytes of |str|. + */ +char* BUF_strndup(const char* str, size_t siz); + +void* BUF_memdup(const void* data, size_t siz); +void BUF_reverse(unsigned char* out, const unsigned char* in, size_t siz); + +/* safe string functions */ +size_t BUF_strlcpy(char* dst, const char* src, size_t siz); +size_t BUF_strlcat(char* dst, const char* src, size_t siz); + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_BUF_strings(void); + +/* Error codes for the BUF functions. */ + +/* Function codes. */ +#define BUF_F_BUF_MEMDUP 103 +#define BUF_F_BUF_MEM_GROW 100 +#define BUF_F_BUF_MEM_GROW_CLEAN 105 +#define BUF_F_BUF_MEM_NEW 101 +#define BUF_F_BUF_STRDUP 102 +#define BUF_F_BUF_STRNDUP 104 + +/* Reason codes. */ + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/camellia.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/camellia.h new file mode 100644 index 0000000..32901de --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/camellia.h @@ -0,0 +1,169 @@ +/* crypto/camellia/camellia.h */ +/* ==================================================================== + * Copyright (c) 2006 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + */ + +#ifndef HEADER_CAMELLIA_H +#define HEADER_CAMELLIA_H + +#include + +#ifdef OPENSSL_NO_CAMELLIA +#error CAMELLIA is disabled. +#endif + +#include + +#define CAMELLIA_ENCRYPT 1 +#define CAMELLIA_DECRYPT 0 + +/* + * Because array size can't be a const in C, the following two are macros. + * Both sizes are in bytes. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* This should be a hidden type, but EVP requires that the size be known */ + +#define CAMELLIA_BLOCK_SIZE 16 +#define CAMELLIA_TABLE_BYTE_LEN 272 +#define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4) + +typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match + * with WORD */ + +struct camellia_key_st { + union { + double d; /* ensures 64-bit align */ + KEY_TABLE_TYPE rd_key; + } u; + int grand_rounds; +}; +typedef struct camellia_key_st CAMELLIA_KEY; + +#ifdef OPENSSL_FIPS +int private_Camellia_set_key( + const unsigned char* userKey, + const int bits, + CAMELLIA_KEY* key); +#endif +int Camellia_set_key( + const unsigned char* userKey, + const int bits, + CAMELLIA_KEY* key); + +void Camellia_encrypt( + const unsigned char* in, + unsigned char* out, + const CAMELLIA_KEY* key); +void Camellia_decrypt( + const unsigned char* in, + unsigned char* out, + const CAMELLIA_KEY* key); + +void Camellia_ecb_encrypt( + const unsigned char* in, + unsigned char* out, + const CAMELLIA_KEY* key, + const int enc); +void Camellia_cbc_encrypt( + const unsigned char* in, + unsigned char* out, + size_t length, + const CAMELLIA_KEY* key, + unsigned char* ivec, + const int enc); +void Camellia_cfb128_encrypt( + const unsigned char* in, + unsigned char* out, + size_t length, + const CAMELLIA_KEY* key, + unsigned char* ivec, + int* num, + const int enc); +void Camellia_cfb1_encrypt( + const unsigned char* in, + unsigned char* out, + size_t length, + const CAMELLIA_KEY* key, + unsigned char* ivec, + int* num, + const int enc); +void Camellia_cfb8_encrypt( + const unsigned char* in, + unsigned char* out, + size_t length, + const CAMELLIA_KEY* key, + unsigned char* ivec, + int* num, + const int enc); +void Camellia_ofb128_encrypt( + const unsigned char* in, + unsigned char* out, + size_t length, + const CAMELLIA_KEY* key, + unsigned char* ivec, + int* num); +void Camellia_ctr128_encrypt( + const unsigned char* in, + unsigned char* out, + size_t length, + const CAMELLIA_KEY* key, + unsigned char ivec[CAMELLIA_BLOCK_SIZE], + unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE], + unsigned int* num); + +#ifdef __cplusplus +} +#endif + +#endif /* !HEADER_Camellia_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/cast.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/cast.h new file mode 100644 index 0000000..c408328 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/cast.h @@ -0,0 +1,123 @@ +/* crypto/cast/cast.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_CAST_H +#define HEADER_CAST_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef OPENSSL_NO_CAST +#error CAST is disabled. +#endif + +#define CAST_ENCRYPT 1 +#define CAST_DECRYPT 0 + +#define CAST_LONG unsigned int + +#define CAST_BLOCK 8 +#define CAST_KEY_LENGTH 16 + +typedef struct cast_key_st { + CAST_LONG data[32]; + int short_key; /* Use reduced rounds for short key */ +} CAST_KEY; + +#ifdef OPENSSL_FIPS +void private_CAST_set_key(CAST_KEY* key, int len, const unsigned char* data); +#endif +void CAST_set_key(CAST_KEY* key, int len, const unsigned char* data); +void CAST_ecb_encrypt( + const unsigned char* in, + unsigned char* out, + const CAST_KEY* key, + int enc); +void CAST_encrypt(CAST_LONG* data, const CAST_KEY* key); +void CAST_decrypt(CAST_LONG* data, const CAST_KEY* key); +void CAST_cbc_encrypt( + const unsigned char* in, + unsigned char* out, + long length, + const CAST_KEY* ks, + unsigned char* iv, + int enc); +void CAST_cfb64_encrypt( + const unsigned char* in, + unsigned char* out, + long length, + const CAST_KEY* schedule, + unsigned char* ivec, + int* num, + int enc); +void CAST_ofb64_encrypt( + const unsigned char* in, + unsigned char* out, + long length, + const CAST_KEY* schedule, + unsigned char* ivec, + int* num); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/cmac.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/cmac.h new file mode 100644 index 0000000..fdc5ef3 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/cmac.h @@ -0,0 +1,86 @@ +/* crypto/cmac/cmac.h */ +/* + * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL + * project. + */ +/* ==================================================================== + * Copyright (c) 2010 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + */ + +#ifndef HEADER_CMAC_H +#define HEADER_CMAC_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* Opaque */ +typedef struct CMAC_CTX_st CMAC_CTX; + +CMAC_CTX* CMAC_CTX_new(void); +void CMAC_CTX_cleanup(CMAC_CTX* ctx); +void CMAC_CTX_free(CMAC_CTX* ctx); +EVP_CIPHER_CTX* CMAC_CTX_get0_cipher_ctx(CMAC_CTX* ctx); +int CMAC_CTX_copy(CMAC_CTX* out, const CMAC_CTX* in); + +int CMAC_Init( + CMAC_CTX* ctx, + const void* key, + size_t keylen, + const EVP_CIPHER* cipher, + ENGINE* impl); +int CMAC_Update(CMAC_CTX* ctx, const void* data, size_t dlen); +int CMAC_Final(CMAC_CTX* ctx, unsigned char* out, size_t* poutlen); +int CMAC_resume(CMAC_CTX* ctx); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/cms.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/cms.h new file mode 100644 index 0000000..4f0a3f4 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/cms.h @@ -0,0 +1,666 @@ +/* crypto/cms/cms.h */ +/* + * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL + * project. + */ +/* ==================================================================== + * Copyright (c) 2008 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + */ + +#ifndef HEADER_CMS_H +#define HEADER_CMS_H + +#include + +#ifdef OPENSSL_NO_CMS +#error CMS is disabled. +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct CMS_ContentInfo_st CMS_ContentInfo; +typedef struct CMS_SignerInfo_st CMS_SignerInfo; +typedef struct CMS_CertificateChoices CMS_CertificateChoices; +typedef struct CMS_RevocationInfoChoice_st CMS_RevocationInfoChoice; +typedef struct CMS_RecipientInfo_st CMS_RecipientInfo; +typedef struct CMS_ReceiptRequest_st CMS_ReceiptRequest; +typedef struct CMS_Receipt_st CMS_Receipt; +typedef struct CMS_RecipientEncryptedKey_st CMS_RecipientEncryptedKey; +typedef struct CMS_OtherKeyAttribute_st CMS_OtherKeyAttribute; + +DECLARE_STACK_OF(CMS_SignerInfo) +DECLARE_STACK_OF(GENERAL_NAMES) +DECLARE_STACK_OF(CMS_RecipientEncryptedKey) +DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo) +DECLARE_ASN1_FUNCTIONS(CMS_ReceiptRequest) +DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo) + +#define CMS_SIGNERINFO_ISSUER_SERIAL 0 +#define CMS_SIGNERINFO_KEYIDENTIFIER 1 + +#define CMS_RECIPINFO_NONE -1 +#define CMS_RECIPINFO_TRANS 0 +#define CMS_RECIPINFO_AGREE 1 +#define CMS_RECIPINFO_KEK 2 +#define CMS_RECIPINFO_PASS 3 +#define CMS_RECIPINFO_OTHER 4 + +/* S/MIME related flags */ + +#define CMS_TEXT 0x1 +#define CMS_NOCERTS 0x2 +#define CMS_NO_CONTENT_VERIFY 0x4 +#define CMS_NO_ATTR_VERIFY 0x8 +#define CMS_NOSIGS (CMS_NO_CONTENT_VERIFY | CMS_NO_ATTR_VERIFY) +#define CMS_NOINTERN 0x10 +#define CMS_NO_SIGNER_CERT_VERIFY 0x20 +#define CMS_NOVERIFY 0x20 +#define CMS_DETACHED 0x40 +#define CMS_BINARY 0x80 +#define CMS_NOATTR 0x100 +#define CMS_NOSMIMECAP 0x200 +#define CMS_NOOLDMIMETYPE 0x400 +#define CMS_CRLFEOL 0x800 +#define CMS_STREAM 0x1000 +#define CMS_NOCRL 0x2000 +#define CMS_PARTIAL 0x4000 +#define CMS_REUSE_DIGEST 0x8000 +#define CMS_USE_KEYID 0x10000 +#define CMS_DEBUG_DECRYPT 0x20000 +#define CMS_KEY_PARAM 0x40000 + +const ASN1_OBJECT* CMS_get0_type(CMS_ContentInfo* cms); + +BIO* CMS_dataInit(CMS_ContentInfo* cms, BIO* icont); +int CMS_dataFinal(CMS_ContentInfo* cms, BIO* bio); + +ASN1_OCTET_STRING** CMS_get0_content(CMS_ContentInfo* cms); +int CMS_is_detached(CMS_ContentInfo* cms); +int CMS_set_detached(CMS_ContentInfo* cms, int detached); + +#ifdef HEADER_PEM_H +DECLARE_PEM_rw_const(CMS, CMS_ContentInfo) +#endif + int CMS_stream(unsigned char*** boundary, CMS_ContentInfo* cms); +CMS_ContentInfo* d2i_CMS_bio(BIO* bp, CMS_ContentInfo** cms); +int i2d_CMS_bio(BIO* bp, CMS_ContentInfo* cms); + +BIO* BIO_new_CMS(BIO* out, CMS_ContentInfo* cms); +int i2d_CMS_bio_stream(BIO* out, CMS_ContentInfo* cms, BIO* in, int flags); +int PEM_write_bio_CMS_stream( + BIO* out, + CMS_ContentInfo* cms, + BIO* in, + int flags); +CMS_ContentInfo* SMIME_read_CMS(BIO* bio, BIO** bcont); +int SMIME_write_CMS(BIO* bio, CMS_ContentInfo* cms, BIO* data, int flags); + +int CMS_final(CMS_ContentInfo* cms, BIO* data, BIO* dcont, unsigned int flags); + +CMS_ContentInfo* CMS_sign( + X509* signcert, + EVP_PKEY* pkey, + STACK_OF(X509) * certs, + BIO* data, + unsigned int flags); + +CMS_ContentInfo* CMS_sign_receipt( + CMS_SignerInfo* si, + X509* signcert, + EVP_PKEY* pkey, + STACK_OF(X509) * certs, + unsigned int flags); + +int CMS_data(CMS_ContentInfo* cms, BIO* out, unsigned int flags); +CMS_ContentInfo* CMS_data_create(BIO* in, unsigned int flags); + +int CMS_digest_verify( + CMS_ContentInfo* cms, + BIO* dcont, + BIO* out, + unsigned int flags); +CMS_ContentInfo* +CMS_digest_create(BIO* in, const EVP_MD* md, unsigned int flags); + +int CMS_EncryptedData_decrypt( + CMS_ContentInfo* cms, + const unsigned char* key, + size_t keylen, + BIO* dcont, + BIO* out, + unsigned int flags); + +CMS_ContentInfo* CMS_EncryptedData_encrypt( + BIO* in, + const EVP_CIPHER* cipher, + const unsigned char* key, + size_t keylen, + unsigned int flags); + +int CMS_EncryptedData_set1_key( + CMS_ContentInfo* cms, + const EVP_CIPHER* ciph, + const unsigned char* key, + size_t keylen); + +int CMS_verify( + CMS_ContentInfo* cms, + STACK_OF(X509) * certs, + X509_STORE* store, + BIO* dcont, + BIO* out, + unsigned int flags); + +int CMS_verify_receipt( + CMS_ContentInfo* rcms, + CMS_ContentInfo* ocms, + STACK_OF(X509) * certs, + X509_STORE* store, + unsigned int flags); + +STACK_OF(X509) * CMS_get0_signers(CMS_ContentInfo* cms); + +CMS_ContentInfo* CMS_encrypt( + STACK_OF(X509) * certs, + BIO* in, + const EVP_CIPHER* cipher, + unsigned int flags); + +int CMS_decrypt( + CMS_ContentInfo* cms, + EVP_PKEY* pkey, + X509* cert, + BIO* dcont, + BIO* out, + unsigned int flags); + +int CMS_decrypt_set1_pkey(CMS_ContentInfo* cms, EVP_PKEY* pk, X509* cert); +int CMS_decrypt_set1_key( + CMS_ContentInfo* cms, + unsigned char* key, + size_t keylen, + unsigned char* id, + size_t idlen); +int CMS_decrypt_set1_password( + CMS_ContentInfo* cms, + unsigned char* pass, + ossl_ssize_t passlen); + +STACK_OF(CMS_RecipientInfo) * CMS_get0_RecipientInfos(CMS_ContentInfo* cms); +int CMS_RecipientInfo_type(CMS_RecipientInfo* ri); +EVP_PKEY_CTX* CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo* ri); +CMS_ContentInfo* CMS_EnvelopedData_create(const EVP_CIPHER* cipher); +CMS_RecipientInfo* +CMS_add1_recipient_cert(CMS_ContentInfo* cms, X509* recip, unsigned int flags); +int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo* ri, EVP_PKEY* pkey); +int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo* ri, X509* cert); +int CMS_RecipientInfo_ktri_get0_algs( + CMS_RecipientInfo* ri, + EVP_PKEY** pk, + X509** recip, + X509_ALGOR** palg); +int CMS_RecipientInfo_ktri_get0_signer_id( + CMS_RecipientInfo* ri, + ASN1_OCTET_STRING** keyid, + X509_NAME** issuer, + ASN1_INTEGER** sno); + +CMS_RecipientInfo* CMS_add0_recipient_key( + CMS_ContentInfo* cms, + int nid, + unsigned char* key, + size_t keylen, + unsigned char* id, + size_t idlen, + ASN1_GENERALIZEDTIME* date, + ASN1_OBJECT* otherTypeId, + ASN1_TYPE* otherType); + +int CMS_RecipientInfo_kekri_get0_id( + CMS_RecipientInfo* ri, + X509_ALGOR** palg, + ASN1_OCTET_STRING** pid, + ASN1_GENERALIZEDTIME** pdate, + ASN1_OBJECT** potherid, + ASN1_TYPE** pothertype); + +int CMS_RecipientInfo_set0_key( + CMS_RecipientInfo* ri, + unsigned char* key, + size_t keylen); + +int CMS_RecipientInfo_kekri_id_cmp( + CMS_RecipientInfo* ri, + const unsigned char* id, + size_t idlen); + +int CMS_RecipientInfo_set0_password( + CMS_RecipientInfo* ri, + unsigned char* pass, + ossl_ssize_t passlen); + +CMS_RecipientInfo* CMS_add0_recipient_password( + CMS_ContentInfo* cms, + int iter, + int wrap_nid, + int pbe_nid, + unsigned char* pass, + ossl_ssize_t passlen, + const EVP_CIPHER* kekciph); + +int CMS_RecipientInfo_decrypt(CMS_ContentInfo* cms, CMS_RecipientInfo* ri); +int CMS_RecipientInfo_encrypt(CMS_ContentInfo* cms, CMS_RecipientInfo* ri); + +int CMS_uncompress( + CMS_ContentInfo* cms, + BIO* dcont, + BIO* out, + unsigned int flags); +CMS_ContentInfo* CMS_compress(BIO* in, int comp_nid, unsigned int flags); + +int CMS_set1_eContentType(CMS_ContentInfo* cms, const ASN1_OBJECT* oid); +const ASN1_OBJECT* CMS_get0_eContentType(CMS_ContentInfo* cms); + +CMS_CertificateChoices* CMS_add0_CertificateChoices(CMS_ContentInfo* cms); +int CMS_add0_cert(CMS_ContentInfo* cms, X509* cert); +int CMS_add1_cert(CMS_ContentInfo* cms, X509* cert); +STACK_OF(X509) * CMS_get1_certs(CMS_ContentInfo* cms); + +CMS_RevocationInfoChoice* CMS_add0_RevocationInfoChoice(CMS_ContentInfo* cms); +int CMS_add0_crl(CMS_ContentInfo* cms, X509_CRL* crl); +int CMS_add1_crl(CMS_ContentInfo* cms, X509_CRL* crl); +STACK_OF(X509_CRL) * CMS_get1_crls(CMS_ContentInfo* cms); + +int CMS_SignedData_init(CMS_ContentInfo* cms); +CMS_SignerInfo* CMS_add1_signer( + CMS_ContentInfo* cms, + X509* signer, + EVP_PKEY* pk, + const EVP_MD* md, + unsigned int flags); +EVP_PKEY_CTX* CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo* si); +EVP_MD_CTX* CMS_SignerInfo_get0_md_ctx(CMS_SignerInfo* si); +STACK_OF(CMS_SignerInfo) * CMS_get0_SignerInfos(CMS_ContentInfo* cms); + +void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo* si, X509* signer); +int CMS_SignerInfo_get0_signer_id( + CMS_SignerInfo* si, + ASN1_OCTET_STRING** keyid, + X509_NAME** issuer, + ASN1_INTEGER** sno); +int CMS_SignerInfo_cert_cmp(CMS_SignerInfo* si, X509* cert); +int CMS_set1_signers_certs( + CMS_ContentInfo* cms, + STACK_OF(X509) * certs, + unsigned int flags); +void CMS_SignerInfo_get0_algs( + CMS_SignerInfo* si, + EVP_PKEY** pk, + X509** signer, + X509_ALGOR** pdig, + X509_ALGOR** psig); +ASN1_OCTET_STRING* CMS_SignerInfo_get0_signature(CMS_SignerInfo* si); +int CMS_SignerInfo_sign(CMS_SignerInfo* si); +int CMS_SignerInfo_verify(CMS_SignerInfo* si); +int CMS_SignerInfo_verify_content(CMS_SignerInfo* si, BIO* chain); + +int CMS_add_smimecap(CMS_SignerInfo* si, STACK_OF(X509_ALGOR) * algs); +int CMS_add_simple_smimecap( + STACK_OF(X509_ALGOR) * *algs, + int algnid, + int keysize); +int CMS_add_standard_smimecap(STACK_OF(X509_ALGOR) * *smcap); + +int CMS_signed_get_attr_count(const CMS_SignerInfo* si); +int CMS_signed_get_attr_by_NID(const CMS_SignerInfo* si, int nid, int lastpos); +int CMS_signed_get_attr_by_OBJ( + const CMS_SignerInfo* si, + ASN1_OBJECT* obj, + int lastpos); +X509_ATTRIBUTE* CMS_signed_get_attr(const CMS_SignerInfo* si, int loc); +X509_ATTRIBUTE* CMS_signed_delete_attr(CMS_SignerInfo* si, int loc); +int CMS_signed_add1_attr(CMS_SignerInfo* si, X509_ATTRIBUTE* attr); +int CMS_signed_add1_attr_by_OBJ( + CMS_SignerInfo* si, + const ASN1_OBJECT* obj, + int type, + const void* bytes, + int len); +int CMS_signed_add1_attr_by_NID( + CMS_SignerInfo* si, + int nid, + int type, + const void* bytes, + int len); +int CMS_signed_add1_attr_by_txt( + CMS_SignerInfo* si, + const char* attrname, + int type, + const void* bytes, + int len); +void* CMS_signed_get0_data_by_OBJ( + CMS_SignerInfo* si, + ASN1_OBJECT* oid, + int lastpos, + int type); + +int CMS_unsigned_get_attr_count(const CMS_SignerInfo* si); +int CMS_unsigned_get_attr_by_NID( + const CMS_SignerInfo* si, + int nid, + int lastpos); +int CMS_unsigned_get_attr_by_OBJ( + const CMS_SignerInfo* si, + ASN1_OBJECT* obj, + int lastpos); +X509_ATTRIBUTE* CMS_unsigned_get_attr(const CMS_SignerInfo* si, int loc); +X509_ATTRIBUTE* CMS_unsigned_delete_attr(CMS_SignerInfo* si, int loc); +int CMS_unsigned_add1_attr(CMS_SignerInfo* si, X509_ATTRIBUTE* attr); +int CMS_unsigned_add1_attr_by_OBJ( + CMS_SignerInfo* si, + const ASN1_OBJECT* obj, + int type, + const void* bytes, + int len); +int CMS_unsigned_add1_attr_by_NID( + CMS_SignerInfo* si, + int nid, + int type, + const void* bytes, + int len); +int CMS_unsigned_add1_attr_by_txt( + CMS_SignerInfo* si, + const char* attrname, + int type, + const void* bytes, + int len); +void* CMS_unsigned_get0_data_by_OBJ( + CMS_SignerInfo* si, + ASN1_OBJECT* oid, + int lastpos, + int type); + +#ifdef HEADER_X509V3_H + +int CMS_get1_ReceiptRequest(CMS_SignerInfo* si, CMS_ReceiptRequest** prr); +CMS_ReceiptRequest* CMS_ReceiptRequest_create0( + unsigned char* id, + int idlen, + int allorfirst, + STACK_OF(GENERAL_NAMES) * receiptList, + STACK_OF(GENERAL_NAMES) * receiptsTo); +int CMS_add1_ReceiptRequest(CMS_SignerInfo* si, CMS_ReceiptRequest* rr); +void CMS_ReceiptRequest_get0_values( + CMS_ReceiptRequest* rr, + ASN1_STRING** pcid, + int* pallorfirst, + STACK_OF(GENERAL_NAMES) * *plist, + STACK_OF(GENERAL_NAMES) * *prto); +#endif +int CMS_RecipientInfo_kari_get0_alg( + CMS_RecipientInfo* ri, + X509_ALGOR** palg, + ASN1_OCTET_STRING** pukm); +STACK_OF(CMS_RecipientEncryptedKey) +*CMS_RecipientInfo_kari_get0_reks(CMS_RecipientInfo* ri); + +int CMS_RecipientInfo_kari_get0_orig_id( + CMS_RecipientInfo* ri, + X509_ALGOR** pubalg, + ASN1_BIT_STRING** pubkey, + ASN1_OCTET_STRING** keyid, + X509_NAME** issuer, + ASN1_INTEGER** sno); + +int CMS_RecipientInfo_kari_orig_id_cmp(CMS_RecipientInfo* ri, X509* cert); + +int CMS_RecipientEncryptedKey_get0_id( + CMS_RecipientEncryptedKey* rek, + ASN1_OCTET_STRING** keyid, + ASN1_GENERALIZEDTIME** tm, + CMS_OtherKeyAttribute** other, + X509_NAME** issuer, + ASN1_INTEGER** sno); +int CMS_RecipientEncryptedKey_cert_cmp( + CMS_RecipientEncryptedKey* rek, + X509* cert); +int CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo* ri, EVP_PKEY* pk); +EVP_CIPHER_CTX* CMS_RecipientInfo_kari_get0_ctx(CMS_RecipientInfo* ri); +int CMS_RecipientInfo_kari_decrypt( + CMS_ContentInfo* cms, + CMS_RecipientInfo* ri, + CMS_RecipientEncryptedKey* rek); + +int CMS_SharedInfo_encode( + unsigned char** pder, + X509_ALGOR* kekalg, + ASN1_OCTET_STRING* ukm, + int keylen); + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_CMS_strings(void); + +/* Error codes for the CMS functions. */ + +/* Function codes. */ +#define CMS_F_CHECK_CONTENT 99 +#define CMS_F_CMS_ADD0_CERT 164 +#define CMS_F_CMS_ADD0_RECIPIENT_KEY 100 +#define CMS_F_CMS_ADD0_RECIPIENT_PASSWORD 165 +#define CMS_F_CMS_ADD1_RECEIPTREQUEST 158 +#define CMS_F_CMS_ADD1_RECIPIENT_CERT 101 +#define CMS_F_CMS_ADD1_SIGNER 102 +#define CMS_F_CMS_ADD1_SIGNINGTIME 103 +#define CMS_F_CMS_COMPRESS 104 +#define CMS_F_CMS_COMPRESSEDDATA_CREATE 105 +#define CMS_F_CMS_COMPRESSEDDATA_INIT_BIO 106 +#define CMS_F_CMS_COPY_CONTENT 107 +#define CMS_F_CMS_COPY_MESSAGEDIGEST 108 +#define CMS_F_CMS_DATA 109 +#define CMS_F_CMS_DATAFINAL 110 +#define CMS_F_CMS_DATAINIT 111 +#define CMS_F_CMS_DECRYPT 112 +#define CMS_F_CMS_DECRYPT_SET1_KEY 113 +#define CMS_F_CMS_DECRYPT_SET1_PASSWORD 166 +#define CMS_F_CMS_DECRYPT_SET1_PKEY 114 +#define CMS_F_CMS_DIGESTALGORITHM_FIND_CTX 115 +#define CMS_F_CMS_DIGESTALGORITHM_INIT_BIO 116 +#define CMS_F_CMS_DIGESTEDDATA_DO_FINAL 117 +#define CMS_F_CMS_DIGEST_VERIFY 118 +#define CMS_F_CMS_ENCODE_RECEIPT 161 +#define CMS_F_CMS_ENCRYPT 119 +#define CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO 120 +#define CMS_F_CMS_ENCRYPTEDDATA_DECRYPT 121 +#define CMS_F_CMS_ENCRYPTEDDATA_ENCRYPT 122 +#define CMS_F_CMS_ENCRYPTEDDATA_SET1_KEY 123 +#define CMS_F_CMS_ENVELOPEDDATA_CREATE 124 +#define CMS_F_CMS_ENVELOPEDDATA_INIT_BIO 125 +#define CMS_F_CMS_ENVELOPED_DATA_INIT 126 +#define CMS_F_CMS_ENV_ASN1_CTRL 171 +#define CMS_F_CMS_FINAL 127 +#define CMS_F_CMS_GET0_CERTIFICATE_CHOICES 128 +#define CMS_F_CMS_GET0_CONTENT 129 +#define CMS_F_CMS_GET0_ECONTENT_TYPE 130 +#define CMS_F_CMS_GET0_ENVELOPED 131 +#define CMS_F_CMS_GET0_REVOCATION_CHOICES 132 +#define CMS_F_CMS_GET0_SIGNED 133 +#define CMS_F_CMS_MSGSIGDIGEST_ADD1 162 +#define CMS_F_CMS_RECEIPTREQUEST_CREATE0 159 +#define CMS_F_CMS_RECEIPT_VERIFY 160 +#define CMS_F_CMS_RECIPIENTINFO_DECRYPT 134 +#define CMS_F_CMS_RECIPIENTINFO_ENCRYPT 169 +#define CMS_F_CMS_RECIPIENTINFO_KARI_ENCRYPT 178 +#define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ALG 175 +#define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ORIG_ID 173 +#define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_REKS 172 +#define CMS_F_CMS_RECIPIENTINFO_KARI_ORIG_ID_CMP 174 +#define CMS_F_CMS_RECIPIENTINFO_KEKRI_DECRYPT 135 +#define CMS_F_CMS_RECIPIENTINFO_KEKRI_ENCRYPT 136 +#define CMS_F_CMS_RECIPIENTINFO_KEKRI_GET0_ID 137 +#define CMS_F_CMS_RECIPIENTINFO_KEKRI_ID_CMP 138 +#define CMS_F_CMS_RECIPIENTINFO_KTRI_CERT_CMP 139 +#define CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT 140 +#define CMS_F_CMS_RECIPIENTINFO_KTRI_ENCRYPT 141 +#define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_ALGS 142 +#define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_SIGNER_ID 143 +#define CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT 167 +#define CMS_F_CMS_RECIPIENTINFO_SET0_KEY 144 +#define CMS_F_CMS_RECIPIENTINFO_SET0_PASSWORD 168 +#define CMS_F_CMS_RECIPIENTINFO_SET0_PKEY 145 +#define CMS_F_CMS_SD_ASN1_CTRL 170 +#define CMS_F_CMS_SET1_IAS 176 +#define CMS_F_CMS_SET1_KEYID 177 +#define CMS_F_CMS_SET1_SIGNERIDENTIFIER 146 +#define CMS_F_CMS_SET_DETACHED 147 +#define CMS_F_CMS_SIGN 148 +#define CMS_F_CMS_SIGNED_DATA_INIT 149 +#define CMS_F_CMS_SIGNERINFO_CONTENT_SIGN 150 +#define CMS_F_CMS_SIGNERINFO_SIGN 151 +#define CMS_F_CMS_SIGNERINFO_VERIFY 152 +#define CMS_F_CMS_SIGNERINFO_VERIFY_CERT 153 +#define CMS_F_CMS_SIGNERINFO_VERIFY_CONTENT 154 +#define CMS_F_CMS_SIGN_RECEIPT 163 +#define CMS_F_CMS_STREAM 155 +#define CMS_F_CMS_UNCOMPRESS 156 +#define CMS_F_CMS_VERIFY 157 + +/* Reason codes. */ +#define CMS_R_ADD_SIGNER_ERROR 99 +#define CMS_R_CERTIFICATE_ALREADY_PRESENT 175 +#define CMS_R_CERTIFICATE_HAS_NO_KEYID 160 +#define CMS_R_CERTIFICATE_VERIFY_ERROR 100 +#define CMS_R_CIPHER_INITIALISATION_ERROR 101 +#define CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR 102 +#define CMS_R_CMS_DATAFINAL_ERROR 103 +#define CMS_R_CMS_LIB 104 +#define CMS_R_CONTENTIDENTIFIER_MISMATCH 170 +#define CMS_R_CONTENT_NOT_FOUND 105 +#define CMS_R_CONTENT_TYPE_MISMATCH 171 +#define CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA 106 +#define CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA 107 +#define CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA 108 +#define CMS_R_CONTENT_VERIFY_ERROR 109 +#define CMS_R_CTRL_ERROR 110 +#define CMS_R_CTRL_FAILURE 111 +#define CMS_R_DECRYPT_ERROR 112 +#define CMS_R_DIGEST_ERROR 161 +#define CMS_R_ERROR_GETTING_PUBLIC_KEY 113 +#define CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE 114 +#define CMS_R_ERROR_SETTING_KEY 115 +#define CMS_R_ERROR_SETTING_RECIPIENTINFO 116 +#define CMS_R_INVALID_ENCRYPTED_KEY_LENGTH 117 +#define CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER 176 +#define CMS_R_INVALID_KEY_LENGTH 118 +#define CMS_R_MD_BIO_INIT_ERROR 119 +#define CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH 120 +#define CMS_R_MESSAGEDIGEST_WRONG_LENGTH 121 +#define CMS_R_MSGSIGDIGEST_ERROR 172 +#define CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE 162 +#define CMS_R_MSGSIGDIGEST_WRONG_LENGTH 163 +#define CMS_R_NEED_ONE_SIGNER 164 +#define CMS_R_NOT_A_SIGNED_RECEIPT 165 +#define CMS_R_NOT_ENCRYPTED_DATA 122 +#define CMS_R_NOT_KEK 123 +#define CMS_R_NOT_KEY_AGREEMENT 181 +#define CMS_R_NOT_KEY_TRANSPORT 124 +#define CMS_R_NOT_PWRI 177 +#define CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 125 +#define CMS_R_NO_CIPHER 126 +#define CMS_R_NO_CONTENT 127 +#define CMS_R_NO_CONTENT_TYPE 173 +#define CMS_R_NO_DEFAULT_DIGEST 128 +#define CMS_R_NO_DIGEST_SET 129 +#define CMS_R_NO_KEY 130 +#define CMS_R_NO_KEY_OR_CERT 174 +#define CMS_R_NO_MATCHING_DIGEST 131 +#define CMS_R_NO_MATCHING_RECIPIENT 132 +#define CMS_R_NO_MATCHING_SIGNATURE 166 +#define CMS_R_NO_MSGSIGDIGEST 167 +#define CMS_R_NO_PASSWORD 178 +#define CMS_R_NO_PRIVATE_KEY 133 +#define CMS_R_NO_PUBLIC_KEY 134 +#define CMS_R_NO_RECEIPT_REQUEST 168 +#define CMS_R_NO_SIGNERS 135 +#define CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 136 +#define CMS_R_RECEIPT_DECODE_ERROR 169 +#define CMS_R_RECIPIENT_ERROR 137 +#define CMS_R_SIGNER_CERTIFICATE_NOT_FOUND 138 +#define CMS_R_SIGNFINAL_ERROR 139 +#define CMS_R_SMIME_TEXT_ERROR 140 +#define CMS_R_STORE_INIT_ERROR 141 +#define CMS_R_TYPE_NOT_COMPRESSED_DATA 142 +#define CMS_R_TYPE_NOT_DATA 143 +#define CMS_R_TYPE_NOT_DIGESTED_DATA 144 +#define CMS_R_TYPE_NOT_ENCRYPTED_DATA 145 +#define CMS_R_TYPE_NOT_ENVELOPED_DATA 146 +#define CMS_R_UNABLE_TO_FINALIZE_CONTEXT 147 +#define CMS_R_UNKNOWN_CIPHER 148 +#define CMS_R_UNKNOWN_DIGEST_ALGORIHM 149 +#define CMS_R_UNKNOWN_ID 150 +#define CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM 151 +#define CMS_R_UNSUPPORTED_CONTENT_TYPE 152 +#define CMS_R_UNSUPPORTED_KEK_ALGORITHM 153 +#define CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM 179 +#define CMS_R_UNSUPPORTED_RECIPIENT_TYPE 154 +#define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE 155 +#define CMS_R_UNSUPPORTED_TYPE 156 +#define CMS_R_UNWRAP_ERROR 157 +#define CMS_R_UNWRAP_FAILURE 180 +#define CMS_R_VERIFICATION_FAILURE 158 +#define CMS_R_WRAP_ERROR 159 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/comp.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/comp.h new file mode 100644 index 0000000..75a343f --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/comp.h @@ -0,0 +1,97 @@ + +#ifndef HEADER_COMP_H +#define HEADER_COMP_H + +#include + +#ifdef OPENSSL_NO_COMP +#error COMP is disabled. +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct comp_ctx_st COMP_CTX; + +struct comp_method_st { + int type; /* NID for compression library */ + const char* name; /* A text string to identify the library */ + int (*init)(COMP_CTX* ctx); + void (*finish)(COMP_CTX* ctx); + int (*compress)( + COMP_CTX* ctx, + unsigned char* out, + unsigned int olen, + unsigned char* in, + unsigned int ilen); + int (*expand)( + COMP_CTX* ctx, + unsigned char* out, + unsigned int olen, + unsigned char* in, + unsigned int ilen); + /* + * The following two do NOTHING, but are kept for backward compatibility + */ + long (*ctrl)(void); + long (*callback_ctrl)(void); +}; + +struct comp_ctx_st { + COMP_METHOD* meth; + unsigned long compress_in; + unsigned long compress_out; + unsigned long expand_in; + unsigned long expand_out; + CRYPTO_EX_DATA ex_data; +}; + +COMP_CTX* COMP_CTX_new(COMP_METHOD* meth); +void COMP_CTX_free(COMP_CTX* ctx); +int COMP_compress_block( + COMP_CTX* ctx, + unsigned char* out, + int olen, + unsigned char* in, + int ilen); +int COMP_expand_block( + COMP_CTX* ctx, + unsigned char* out, + int olen, + unsigned char* in, + int ilen); +COMP_METHOD* COMP_rle(void); +COMP_METHOD* COMP_zlib(void); +void COMP_zlib_cleanup(void); + +#ifdef HEADER_BIO_H +#ifdef ZLIB +BIO_METHOD* BIO_f_zlib(void); +#endif +#endif + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_COMP_strings(void); + +/* Error codes for the COMP functions. */ + +/* Function codes. */ +#define COMP_F_BIO_ZLIB_FLUSH 99 +#define COMP_F_BIO_ZLIB_NEW 100 +#define COMP_F_BIO_ZLIB_READ 101 +#define COMP_F_BIO_ZLIB_WRITE 102 + +/* Reason codes. */ +#define COMP_R_ZLIB_DEFLATE_ERROR 99 +#define COMP_R_ZLIB_INFLATE_ERROR 100 +#define COMP_R_ZLIB_NOT_SUPPORTED 101 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/conf.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/conf.h new file mode 100644 index 0000000..11d8a07 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/conf.h @@ -0,0 +1,283 @@ +/* crypto/conf/conf.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_CONF_H +#define HEADER_CONF_H + +#include +#include +#include +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + char* section; + char* name; + char* value; +} CONF_VALUE; + +DECLARE_STACK_OF(CONF_VALUE) +DECLARE_LHASH_OF(CONF_VALUE); + +struct conf_st; +struct conf_method_st; +typedef struct conf_method_st CONF_METHOD; + +struct conf_method_st { + const char* name; + CONF* (*create)(CONF_METHOD* meth); + int (*init)(CONF* conf); + int (*destroy)(CONF* conf); + int (*destroy_data)(CONF* conf); + int (*load_bio)(CONF* conf, BIO* bp, long* eline); + int (*dump)(const CONF* conf, BIO* bp); + int (*is_number)(const CONF* conf, char c); + int (*to_int)(const CONF* conf, char c); + int (*load)(CONF* conf, const char* name, long* eline); +}; + +/* Module definitions */ + +typedef struct conf_imodule_st CONF_IMODULE; +typedef struct conf_module_st CONF_MODULE; + +DECLARE_STACK_OF(CONF_MODULE) +DECLARE_STACK_OF(CONF_IMODULE) + +/* DSO module function typedefs */ +typedef int conf_init_func(CONF_IMODULE* md, const CONF* cnf); +typedef void conf_finish_func(CONF_IMODULE* md); + +#define CONF_MFLAGS_IGNORE_ERRORS 0x1 +#define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2 +#define CONF_MFLAGS_SILENT 0x4 +#define CONF_MFLAGS_NO_DSO 0x8 +#define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10 +#define CONF_MFLAGS_DEFAULT_SECTION 0x20 + +int CONF_set_default_method(CONF_METHOD* meth); +void CONF_set_nconf(CONF* conf, LHASH_OF(CONF_VALUE) * hash); +LHASH_OF(CONF_VALUE) * + CONF_load(LHASH_OF(CONF_VALUE) * conf, const char* file, long* eline); +#ifndef OPENSSL_NO_FP_API +LHASH_OF(CONF_VALUE) * + CONF_load_fp(LHASH_OF(CONF_VALUE) * conf, FILE* fp, long* eline); +#endif +LHASH_OF(CONF_VALUE) * + CONF_load_bio(LHASH_OF(CONF_VALUE) * conf, BIO* bp, long* eline); +STACK_OF(CONF_VALUE) * + CONF_get_section(LHASH_OF(CONF_VALUE) * conf, const char* section); +char* CONF_get_string( + LHASH_OF(CONF_VALUE) * conf, + const char* group, + const char* name); +long CONF_get_number( + LHASH_OF(CONF_VALUE) * conf, + const char* group, + const char* name); +void CONF_free(LHASH_OF(CONF_VALUE) * conf); +int CONF_dump_fp(LHASH_OF(CONF_VALUE) * conf, FILE* out); +int CONF_dump_bio(LHASH_OF(CONF_VALUE) * conf, BIO* out); + +void OPENSSL_config(const char* config_name); +void OPENSSL_no_config(void); + +/* + * New conf code. The semantics are different from the functions above. If + * that wasn't the case, the above functions would have been replaced + */ + +struct conf_st { + CONF_METHOD* meth; + void* meth_data; + LHASH_OF(CONF_VALUE) * data; +}; + +CONF* NCONF_new(CONF_METHOD* meth); +CONF_METHOD* NCONF_default(void); +CONF_METHOD* NCONF_WIN32(void); +#if 0 /* Just to give you an idea of what I have in \ + * mind */ +CONF_METHOD *NCONF_XML(void); +#endif +void NCONF_free(CONF* conf); +void NCONF_free_data(CONF* conf); + +int NCONF_load(CONF* conf, const char* file, long* eline); +#ifndef OPENSSL_NO_FP_API +int NCONF_load_fp(CONF* conf, FILE* fp, long* eline); +#endif +int NCONF_load_bio(CONF* conf, BIO* bp, long* eline); +STACK_OF(CONF_VALUE) * NCONF_get_section(const CONF* conf, const char* section); +char* NCONF_get_string(const CONF* conf, const char* group, const char* name); +int NCONF_get_number_e( + const CONF* conf, + const char* group, + const char* name, + long* result); +int NCONF_dump_fp(const CONF* conf, FILE* out); +int NCONF_dump_bio(const CONF* conf, BIO* out); + +#if 0 /* The following function has no error \ + * checking, and should therefore be avoided */ +long NCONF_get_number(CONF *conf, char *group, char *name); +#else +#define NCONF_get_number(c, g, n, r) NCONF_get_number_e(c, g, n, r) +#endif + +/* Module functions */ + +int CONF_modules_load( + const CONF* cnf, + const char* appname, + unsigned long flags); +int CONF_modules_load_file( + const char* filename, + const char* appname, + unsigned long flags); +void CONF_modules_unload(int all); +void CONF_modules_finish(void); +void CONF_modules_free(void); +int CONF_module_add( + const char* name, + conf_init_func* ifunc, + conf_finish_func* ffunc); + +const char* CONF_imodule_get_name(const CONF_IMODULE* md); +const char* CONF_imodule_get_value(const CONF_IMODULE* md); +void* CONF_imodule_get_usr_data(const CONF_IMODULE* md); +void CONF_imodule_set_usr_data(CONF_IMODULE* md, void* usr_data); +CONF_MODULE* CONF_imodule_get_module(const CONF_IMODULE* md); +unsigned long CONF_imodule_get_flags(const CONF_IMODULE* md); +void CONF_imodule_set_flags(CONF_IMODULE* md, unsigned long flags); +void* CONF_module_get_usr_data(CONF_MODULE* pmod); +void CONF_module_set_usr_data(CONF_MODULE* pmod, void* usr_data); + +char* CONF_get1_default_config_file(void); + +int CONF_parse_list( + const char* list, + int sep, + int nospc, + int (*list_cb)(const char* elem, int len, void* usr), + void* arg); + +void OPENSSL_load_builtin_modules(void); + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_CONF_strings(void); + +/* Error codes for the CONF functions. */ + +/* Function codes. */ +#define CONF_F_CONF_DUMP_FP 104 +#define CONF_F_CONF_LOAD 100 +#define CONF_F_CONF_LOAD_BIO 102 +#define CONF_F_CONF_LOAD_FP 103 +#define CONF_F_CONF_MODULES_LOAD 116 +#define CONF_F_CONF_PARSE_LIST 119 +#define CONF_F_DEF_LOAD 120 +#define CONF_F_DEF_LOAD_BIO 121 +#define CONF_F_MODULE_INIT 115 +#define CONF_F_MODULE_LOAD_DSO 117 +#define CONF_F_MODULE_RUN 118 +#define CONF_F_NCONF_DUMP_BIO 105 +#define CONF_F_NCONF_DUMP_FP 106 +#define CONF_F_NCONF_GET_NUMBER 107 +#define CONF_F_NCONF_GET_NUMBER_E 112 +#define CONF_F_NCONF_GET_SECTION 108 +#define CONF_F_NCONF_GET_STRING 109 +#define CONF_F_NCONF_LOAD 113 +#define CONF_F_NCONF_LOAD_BIO 110 +#define CONF_F_NCONF_LOAD_FP 114 +#define CONF_F_NCONF_NEW 111 +#define CONF_F_STR_COPY 101 + +/* Reason codes. */ +#define CONF_R_ERROR_LOADING_DSO 110 +#define CONF_R_LIST_CANNOT_BE_NULL 115 +#define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100 +#define CONF_R_MISSING_EQUAL_SIGN 101 +#define CONF_R_MISSING_FINISH_FUNCTION 111 +#define CONF_R_MISSING_INIT_FUNCTION 112 +#define CONF_R_MODULE_INITIALIZATION_ERROR 109 +#define CONF_R_NO_CLOSE_BRACE 102 +#define CONF_R_NO_CONF 105 +#define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106 +#define CONF_R_NO_SECTION 107 +#define CONF_R_NO_SUCH_FILE 114 +#define CONF_R_NO_VALUE 108 +#define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 +#define CONF_R_UNKNOWN_MODULE_NAME 113 +#define CONF_R_VARIABLE_EXPANSION_TOO_LONG 116 +#define CONF_R_VARIABLE_HAS_NO_VALUE 104 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/conf_api.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/conf_api.h new file mode 100644 index 0000000..54ca83d --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/conf_api.h @@ -0,0 +1,87 @@ +/* conf_api.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_CONF_API_H +#define HEADER_CONF_API_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Up until OpenSSL 0.9.5a, this was new_section */ +CONF_VALUE* _CONF_new_section(CONF* conf, const char* section); +/* Up until OpenSSL 0.9.5a, this was get_section */ +CONF_VALUE* _CONF_get_section(const CONF* conf, const char* section); +/* Up until OpenSSL 0.9.5a, this was CONF_get_section */ +STACK_OF(CONF_VALUE) * + _CONF_get_section_values(const CONF* conf, const char* section); + +int _CONF_add_string(CONF* conf, CONF_VALUE* section, CONF_VALUE* value); +char* _CONF_get_string(const CONF* conf, const char* section, const char* name); +long _CONF_get_number(const CONF* conf, const char* section, const char* name); + +int _CONF_new_data(CONF* conf); +void _CONF_free_data(CONF* conf); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/crypto.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/crypto.h new file mode 100644 index 0000000..95e77c8 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/crypto.h @@ -0,0 +1,702 @@ +/* crypto/crypto.h */ +/* ==================================================================== + * Copyright (c) 1998-2006 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * ECDH support in OpenSSL originally developed by + * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. + */ + +#ifndef HEADER_CRYPTO_H +#define HEADER_CRYPTO_H + +#include + +#include + +#ifndef OPENSSL_NO_FP_API +#include +#endif + +#include +#include +#include +#include + +#ifdef CHARSET_EBCDIC +#include +#endif + +/* + * Resolve problems on some operating systems with symbol names that clash + * one way or another + */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Backward compatibility to SSLeay */ +/* + * This is more to be used to check the correct DLL is being used in the MS + * world. + */ +#define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER +#define SSLEAY_VERSION 0 +/* #define SSLEAY_OPTIONS 1 no longer supported */ +#define SSLEAY_CFLAGS 2 +#define SSLEAY_BUILT_ON 3 +#define SSLEAY_PLATFORM 4 +#define SSLEAY_DIR 5 + +/* Already declared in ossl_typ.h */ +#if 0 +typedef struct crypto_ex_data_st CRYPTO_EX_DATA; +/* Called when a new object is created */ +typedef int CRYPTO_EX_new (void *parent, void *ptr, CRYPTO_EX_DATA *ad, + int idx, long argl, void *argp); +/* Called when an object is free()ed */ +typedef void CRYPTO_EX_free (void *parent, void *ptr, CRYPTO_EX_DATA *ad, + int idx, long argl, void *argp); +/* Called when we need to dup an object */ +typedef int CRYPTO_EX_dup (CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, + void *from_d, int idx, long argl, void *argp); +#endif + +/* A generic structure to pass assorted data in a expandable way */ +typedef struct openssl_item_st { + int code; + void* value; /* Not used for flag attributes */ + size_t value_size; /* Max size of value for output, length for + * input */ + size_t* value_length; /* Returned length of value for output */ +} OPENSSL_ITEM; + +/* + * When changing the CRYPTO_LOCK_* list, be sure to maintin the text lock + * names in cryptlib.c + */ + +#define CRYPTO_LOCK_ERR 1 +#define CRYPTO_LOCK_EX_DATA 2 +#define CRYPTO_LOCK_X509 3 +#define CRYPTO_LOCK_X509_INFO 4 +#define CRYPTO_LOCK_X509_PKEY 5 +#define CRYPTO_LOCK_X509_CRL 6 +#define CRYPTO_LOCK_X509_REQ 7 +#define CRYPTO_LOCK_DSA 8 +#define CRYPTO_LOCK_RSA 9 +#define CRYPTO_LOCK_EVP_PKEY 10 +#define CRYPTO_LOCK_X509_STORE 11 +#define CRYPTO_LOCK_SSL_CTX 12 +#define CRYPTO_LOCK_SSL_CERT 13 +#define CRYPTO_LOCK_SSL_SESSION 14 +#define CRYPTO_LOCK_SSL_SESS_CERT 15 +#define CRYPTO_LOCK_SSL 16 +#define CRYPTO_LOCK_SSL_METHOD 17 +#define CRYPTO_LOCK_RAND 18 +#define CRYPTO_LOCK_RAND2 19 +#define CRYPTO_LOCK_MALLOC 20 +#define CRYPTO_LOCK_BIO 21 +#define CRYPTO_LOCK_GETHOSTBYNAME 22 +#define CRYPTO_LOCK_GETSERVBYNAME 23 +#define CRYPTO_LOCK_READDIR 24 +#define CRYPTO_LOCK_RSA_BLINDING 25 +#define CRYPTO_LOCK_DH 26 +#define CRYPTO_LOCK_MALLOC2 27 +#define CRYPTO_LOCK_DSO 28 +#define CRYPTO_LOCK_DYNLOCK 29 +#define CRYPTO_LOCK_ENGINE 30 +#define CRYPTO_LOCK_UI 31 +#define CRYPTO_LOCK_ECDSA 32 +#define CRYPTO_LOCK_EC 33 +#define CRYPTO_LOCK_ECDH 34 +#define CRYPTO_LOCK_BN 35 +#define CRYPTO_LOCK_EC_PRE_COMP 36 +#define CRYPTO_LOCK_STORE 37 +#define CRYPTO_LOCK_COMP 38 +#define CRYPTO_LOCK_FIPS 39 +#define CRYPTO_LOCK_FIPS2 40 +#define CRYPTO_NUM_LOCKS 41 + +#define CRYPTO_LOCK 1 +#define CRYPTO_UNLOCK 2 +#define CRYPTO_READ 4 +#define CRYPTO_WRITE 8 + +#ifndef OPENSSL_NO_LOCKING +#ifndef CRYPTO_w_lock +#define CRYPTO_w_lock(type) \ + CRYPTO_lock(CRYPTO_LOCK | CRYPTO_WRITE, type, __FILE__, __LINE__) +#define CRYPTO_w_unlock(type) \ + CRYPTO_lock(CRYPTO_UNLOCK | CRYPTO_WRITE, type, __FILE__, __LINE__) +#define CRYPTO_r_lock(type) \ + CRYPTO_lock(CRYPTO_LOCK | CRYPTO_READ, type, __FILE__, __LINE__) +#define CRYPTO_r_unlock(type) \ + CRYPTO_lock(CRYPTO_UNLOCK | CRYPTO_READ, type, __FILE__, __LINE__) +#define CRYPTO_add(addr, amount, type) \ + CRYPTO_add_lock(addr, amount, type, __FILE__, __LINE__) +#endif +#else +#define CRYPTO_w_lock(a) +#define CRYPTO_w_unlock(a) +#define CRYPTO_r_lock(a) +#define CRYPTO_r_unlock(a) +#define CRYPTO_add(a, b, c) ((*(a)) += (b)) +#endif + +/* + * Some applications as well as some parts of OpenSSL need to allocate and + * deallocate locks in a dynamic fashion. The following typedef makes this + * possible in a type-safe manner. + */ +/* struct CRYPTO_dynlock_value has to be defined by the application. */ +typedef struct { + int references; + struct CRYPTO_dynlock_value* data; +} CRYPTO_dynlock; + +/* + * The following can be used to detect memory leaks in the SSLeay library. It + * used, it turns on malloc checking + */ + +#define CRYPTO_MEM_CHECK_OFF 0x0 /* an enume */ +#define CRYPTO_MEM_CHECK_ON 0x1 /* a bit */ +#define CRYPTO_MEM_CHECK_ENABLE 0x2 /* a bit */ +#define CRYPTO_MEM_CHECK_DISABLE 0x3 /* an enume */ + +/* + * The following are bit values to turn on or off options connected to the + * malloc checking functionality + */ + +/* Adds time to the memory checking information */ +#define V_CRYPTO_MDEBUG_TIME 0x1 /* a bit */ +/* Adds thread number to the memory checking information */ +#define V_CRYPTO_MDEBUG_THREAD 0x2 /* a bit */ + +#define V_CRYPTO_MDEBUG_ALL (V_CRYPTO_MDEBUG_TIME | V_CRYPTO_MDEBUG_THREAD) + +/* predec of the BIO type */ +typedef struct bio_st BIO_dummy; + +struct crypto_ex_data_st { + STACK_OF(void) * sk; + /* gcc is screwing up this data structure :-( */ + int dummy; +}; +DECLARE_STACK_OF(void) + +/* + * This stuff is basically class callback functions The current classes are + * SSL_CTX, SSL, SSL_SESSION, and a few more + */ + +typedef struct crypto_ex_data_func_st { + long argl; /* Arbitary long */ + void* argp; /* Arbitary void * */ + CRYPTO_EX_new* new_func; + CRYPTO_EX_free* free_func; + CRYPTO_EX_dup* dup_func; +} CRYPTO_EX_DATA_FUNCS; + +DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS) + +/* + * Per class, we have a STACK of CRYPTO_EX_DATA_FUNCS for each CRYPTO_EX_DATA + * entry. + */ + +#define CRYPTO_EX_INDEX_BIO 0 +#define CRYPTO_EX_INDEX_SSL 1 +#define CRYPTO_EX_INDEX_SSL_CTX 2 +#define CRYPTO_EX_INDEX_SSL_SESSION 3 +#define CRYPTO_EX_INDEX_X509_STORE 4 +#define CRYPTO_EX_INDEX_X509_STORE_CTX 5 +#define CRYPTO_EX_INDEX_RSA 6 +#define CRYPTO_EX_INDEX_DSA 7 +#define CRYPTO_EX_INDEX_DH 8 +#define CRYPTO_EX_INDEX_ENGINE 9 +#define CRYPTO_EX_INDEX_X509 10 +#define CRYPTO_EX_INDEX_UI 11 +#define CRYPTO_EX_INDEX_ECDSA 12 +#define CRYPTO_EX_INDEX_ECDH 13 +#define CRYPTO_EX_INDEX_COMP 14 +#define CRYPTO_EX_INDEX_STORE 15 + +/* + * Dynamically assigned indexes start from this value (don't use directly, + * use via CRYPTO_ex_data_new_class). + */ +#define CRYPTO_EX_INDEX_USER 100 + +/* + * This is the default callbacks, but we can have others as well: this is + * needed in Win32 where the application malloc and the library malloc may + * not be the same. + */ +#define CRYPTO_malloc_init() CRYPTO_set_mem_functions(malloc, realloc, free) + +#if defined CRYPTO_MDEBUG_ALL || defined CRYPTO_MDEBUG_TIME || \ + defined CRYPTO_MDEBUG_THREAD +#ifndef CRYPTO_MDEBUG /* avoid duplicate #define */ +#define CRYPTO_MDEBUG +#endif +#endif + +/* + * Set standard debugging functions (not done by default unless CRYPTO_MDEBUG + * is defined) + */ +#define CRYPTO_malloc_debug_init() \ + do { \ + CRYPTO_set_mem_debug_functions( \ + CRYPTO_dbg_malloc, \ + CRYPTO_dbg_realloc, \ + CRYPTO_dbg_free, \ + CRYPTO_dbg_set_options, \ + CRYPTO_dbg_get_options); \ + } while (0) + +int CRYPTO_mem_ctrl(int mode); +int CRYPTO_is_mem_check_on(void); + +/* for applications */ +#define MemCheck_start() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON) +#define MemCheck_stop() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_OFF) + +/* for library-internal use */ +#define MemCheck_on() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE) +#define MemCheck_off() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE) +#define is_MemCheck_on() CRYPTO_is_mem_check_on() + +#define OPENSSL_malloc(num) CRYPTO_malloc((int)num, __FILE__, __LINE__) +#define OPENSSL_strdup(str) CRYPTO_strdup((str), __FILE__, __LINE__) +#define OPENSSL_realloc(addr, num) \ + CRYPTO_realloc((char*)addr, (int)num, __FILE__, __LINE__) +#define OPENSSL_realloc_clean(addr, old_num, num) \ + CRYPTO_realloc_clean(addr, old_num, num, __FILE__, __LINE__) +#define OPENSSL_remalloc(addr, num) \ + CRYPTO_remalloc((char**)addr, (int)num, __FILE__, __LINE__) +#define OPENSSL_freeFunc CRYPTO_free +#define OPENSSL_free(addr) CRYPTO_free(addr) + +#define OPENSSL_malloc_locked(num) \ + CRYPTO_malloc_locked((int)num, __FILE__, __LINE__) +#define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr) + +const char* SSLeay_version(int type); +unsigned long SSLeay(void); + +int OPENSSL_issetugid(void); + +/* An opaque type representing an implementation of "ex_data" support */ +typedef struct st_CRYPTO_EX_DATA_IMPL CRYPTO_EX_DATA_IMPL; +/* Return an opaque pointer to the current "ex_data" implementation */ +const CRYPTO_EX_DATA_IMPL* CRYPTO_get_ex_data_implementation(void); +/* Sets the "ex_data" implementation to be used (if it's not too late) */ +int CRYPTO_set_ex_data_implementation(const CRYPTO_EX_DATA_IMPL* i); +/* Get a new "ex_data" class, and return the corresponding "class_index" */ +int CRYPTO_ex_data_new_class(void); +/* Within a given class, get/register a new index */ +int CRYPTO_get_ex_new_index( + int class_index, + long argl, + void* argp, + CRYPTO_EX_new* new_func, + CRYPTO_EX_dup* dup_func, + CRYPTO_EX_free* free_func); +/* + * Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a + * given class (invokes whatever per-class callbacks are applicable) + */ +int CRYPTO_new_ex_data(int class_index, void* obj, CRYPTO_EX_DATA* ad); +int CRYPTO_dup_ex_data( + int class_index, + CRYPTO_EX_DATA* to, + CRYPTO_EX_DATA* from); +void CRYPTO_free_ex_data(int class_index, void* obj, CRYPTO_EX_DATA* ad); +/* + * Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular + * index (relative to the class type involved) + */ +int CRYPTO_set_ex_data(CRYPTO_EX_DATA* ad, int idx, void* val); +void* CRYPTO_get_ex_data(const CRYPTO_EX_DATA* ad, int idx); +/* + * This function cleans up all "ex_data" state. It mustn't be called under + * potential race-conditions. + */ +void CRYPTO_cleanup_all_ex_data(void); + +int CRYPTO_get_new_lockid(char* name); + +int CRYPTO_num_locks(void); /* return CRYPTO_NUM_LOCKS (shared libs!) */ +void CRYPTO_lock(int mode, int type, const char* file, int line); +void CRYPTO_set_locking_callback( + void (*func)(int mode, int type, const char* file, int line)); +void (*CRYPTO_get_locking_callback(void))( + int mode, + int type, + const char* file, + int line); +void CRYPTO_set_add_lock_callback( + int (*func)(int* num, int mount, int type, const char* file, int line)); +int ( + *CRYPTO_get_add_lock_callback( + void))(int* num, int mount, int type, const char* file, int line); + +/* Don't use this structure directly. */ +typedef struct crypto_threadid_st { + void* ptr; + unsigned long val; +} CRYPTO_THREADID; +/* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */ +void CRYPTO_THREADID_set_numeric(CRYPTO_THREADID* id, unsigned long val); +void CRYPTO_THREADID_set_pointer(CRYPTO_THREADID* id, void* ptr); +int CRYPTO_THREADID_set_callback(void (*threadid_func)(CRYPTO_THREADID*)); +void (*CRYPTO_THREADID_get_callback(void))(CRYPTO_THREADID*); +void CRYPTO_THREADID_current(CRYPTO_THREADID* id); +int CRYPTO_THREADID_cmp(const CRYPTO_THREADID* a, const CRYPTO_THREADID* b); +void CRYPTO_THREADID_cpy(CRYPTO_THREADID* dest, const CRYPTO_THREADID* src); +unsigned long CRYPTO_THREADID_hash(const CRYPTO_THREADID* id); +#ifndef OPENSSL_NO_DEPRECATED +void CRYPTO_set_id_callback(unsigned long (*func)(void)); +unsigned long (*CRYPTO_get_id_callback(void))(void); +unsigned long CRYPTO_thread_id(void); +#endif + +const char* CRYPTO_get_lock_name(int type); +int CRYPTO_add_lock( + int* pointer, + int amount, + int type, + const char* file, + int line); + +int CRYPTO_get_new_dynlockid(void); +void CRYPTO_destroy_dynlockid(int i); +struct CRYPTO_dynlock_value* CRYPTO_get_dynlock_value(int i); +void CRYPTO_set_dynlock_create_callback( + struct CRYPTO_dynlock_value* ( + *dyn_create_function)(const char* file, int line)); +void CRYPTO_set_dynlock_lock_callback( + void (*dyn_lock_function)( + int mode, + struct CRYPTO_dynlock_value* l, + const char* file, + int line)); +void CRYPTO_set_dynlock_destroy_callback( + void (*dyn_destroy_function)( + struct CRYPTO_dynlock_value* l, + const char* file, + int line)); +struct CRYPTO_dynlock_value* ( + *CRYPTO_get_dynlock_create_callback(void))(const char* file, int line); +void (*CRYPTO_get_dynlock_lock_callback(void))( + int mode, + struct CRYPTO_dynlock_value* l, + const char* file, + int line); +void (*CRYPTO_get_dynlock_destroy_callback(void))( + struct CRYPTO_dynlock_value* l, + const char* file, + int line); + +/* + * CRYPTO_set_mem_functions includes CRYPTO_set_locked_mem_functions -- call + * the latter last if you need different functions + */ +int CRYPTO_set_mem_functions( + void* (*m)(size_t), + void* (*r)(void*, size_t), + void (*f)(void*)); +int CRYPTO_set_locked_mem_functions( + void* (*m)(size_t), + void (*free_func)(void*)); +int CRYPTO_set_mem_ex_functions( + void* (*m)(size_t, const char*, int), + void* (*r)(void*, size_t, const char*, int), + void (*f)(void*)); +int CRYPTO_set_locked_mem_ex_functions( + void* (*m)(size_t, const char*, int), + void (*free_func)(void*)); +int CRYPTO_set_mem_debug_functions( + void (*m)(void*, int, const char*, int, int), + void (*r)(void*, void*, int, const char*, int, int), + void (*f)(void*, int), + void (*so)(long), + long (*go)(void)); +void CRYPTO_get_mem_functions( + void* (**m)(size_t), + void* (**r)(void*, size_t), + void (**f)(void*)); +void CRYPTO_get_locked_mem_functions(void* (**m)(size_t), void (**f)(void*)); +void CRYPTO_get_mem_ex_functions( + void* (**m)(size_t, const char*, int), + void* (**r)(void*, size_t, const char*, int), + void (**f)(void*)); +void CRYPTO_get_locked_mem_ex_functions( + void* (**m)(size_t, const char*, int), + void (**f)(void*)); +void CRYPTO_get_mem_debug_functions( + void (**m)(void*, int, const char*, int, int), + void (**r)(void*, void*, int, const char*, int, int), + void (**f)(void*, int), + void (**so)(long), + long (**go)(void)); + +void* CRYPTO_malloc_locked(int num, const char* file, int line); +void CRYPTO_free_locked(void* ptr); +void* CRYPTO_malloc(int num, const char* file, int line); +char* CRYPTO_strdup(const char* str, const char* file, int line); +void CRYPTO_free(void* ptr); +void* CRYPTO_realloc(void* addr, int num, const char* file, int line); +void* CRYPTO_realloc_clean( + void* addr, + int old_num, + int num, + const char* file, + int line); +void* CRYPTO_remalloc(void* addr, int num, const char* file, int line); + +void OPENSSL_cleanse(void* ptr, size_t len); + +void CRYPTO_set_mem_debug_options(long bits); +long CRYPTO_get_mem_debug_options(void); + +#define CRYPTO_push_info(info) CRYPTO_push_info_(info, __FILE__, __LINE__); +int CRYPTO_push_info_(const char* info, const char* file, int line); +int CRYPTO_pop_info(void); +int CRYPTO_remove_all_info(void); + +/* + * Default debugging functions (enabled by CRYPTO_malloc_debug_init() macro; + * used as default in CRYPTO_MDEBUG compilations): + */ +/*- + * The last argument has the following significance: + * + * 0: called before the actual memory allocation has taken place + * 1: called after the actual memory allocation has taken place + */ +void CRYPTO_dbg_malloc( + void* addr, + int num, + const char* file, + int line, + int before_p); +void CRYPTO_dbg_realloc( + void* addr1, + void* addr2, + int num, + const char* file, + int line, + int before_p); +void CRYPTO_dbg_free(void* addr, int before_p); +/*- + * Tell the debugging code about options. By default, the following values + * apply: + * + * 0: Clear all options. + * V_CRYPTO_MDEBUG_TIME (1): Set the "Show Time" option. + * V_CRYPTO_MDEBUG_THREAD (2): Set the "Show Thread Number" option. + * V_CRYPTO_MDEBUG_ALL (3): 1 + 2 + */ +void CRYPTO_dbg_set_options(long bits); +long CRYPTO_dbg_get_options(void); + +#ifndef OPENSSL_NO_FP_API +void CRYPTO_mem_leaks_fp(FILE*); +#endif +void CRYPTO_mem_leaks(struct bio_st* bio); +/* unsigned long order, char *file, int line, int num_bytes, char *addr */ +typedef void* CRYPTO_MEM_LEAK_CB(unsigned long, const char*, int, int, void*); +void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB* cb); + +/* die if we have to */ +void OpenSSLDie(const char* file, int line, const char* assertion); +#define OPENSSL_assert(e) \ + (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e), 1)) + +unsigned long* OPENSSL_ia32cap_loc(void); +#define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc())) +int OPENSSL_isservice(void); + +int FIPS_mode(void); +int FIPS_mode_set(int r); + +void OPENSSL_init(void); + +#define fips_md_init(alg) fips_md_init_ctx(alg, alg) + +#ifdef OPENSSL_FIPS +#define fips_md_init_ctx(alg, cx) \ + int alg##_Init(cx##_CTX* c) { \ + if (FIPS_mode()) \ + OpenSSLDie( \ + __FILE__, \ + __LINE__, \ + "Low level API call to digest " #alg " forbidden in FIPS mode!"); \ + return private_##alg##_Init(c); \ + } \ + int private_##alg##_Init(cx##_CTX* c) + +#define fips_cipher_abort(alg) \ + if (FIPS_mode()) \ + OpenSSLDie( \ + __FILE__, \ + __LINE__, \ + "Low level API call to cipher " #alg " forbidden in FIPS mode!") + +#else +#define fips_md_init_ctx(alg, cx) int alg##_Init(cx##_CTX* c) +#define fips_cipher_abort(alg) while (0) +#endif + +/* + * CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal. + * It takes an amount of time dependent on |len|, but independent of the + * contents of |a| and |b|. Unlike memcmp, it cannot be used to put elements + * into a defined order as the return value when a != b is undefined, other + * than to be non-zero. + */ +int CRYPTO_memcmp(const volatile void* a, const volatile void* b, size_t len); + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_CRYPTO_strings(void); + +/* Error codes for the CRYPTO functions. */ + +/* Function codes. */ +#define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100 +#define CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID 103 +#define CRYPTO_F_CRYPTO_GET_NEW_LOCKID 101 +#define CRYPTO_F_CRYPTO_SET_EX_DATA 102 +#define CRYPTO_F_DEF_ADD_INDEX 104 +#define CRYPTO_F_DEF_GET_CLASS 105 +#define CRYPTO_F_FIPS_MODE_SET 109 +#define CRYPTO_F_INT_DUP_EX_DATA 106 +#define CRYPTO_F_INT_FREE_EX_DATA 107 +#define CRYPTO_F_INT_NEW_EX_DATA 108 + +/* Reason codes. */ +#define CRYPTO_R_FIPS_MODE_NOT_SUPPORTED 101 +#define CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK 100 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/des.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/des.h new file mode 100644 index 0000000..9f20d9a --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/des.h @@ -0,0 +1,351 @@ +/* crypto/des/des.h */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_NEW_DES_H +#define HEADER_NEW_DES_H + +#include /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG + * (via openssl/opensslconf.h */ + +#ifdef OPENSSL_NO_DES +#error DES is disabled. +#endif + +#ifdef OPENSSL_BUILD_SHLIBCRYPTO +#undef OPENSSL_EXTERN +#define OPENSSL_EXTERN OPENSSL_EXPORT +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef unsigned char DES_cblock[8]; +typedef /* const */ unsigned char const_DES_cblock[8]; +/* + * With "const", gcc 2.8.1 on Solaris thinks that DES_cblock * and + * const_DES_cblock * are incompatible pointer types. + */ + +typedef struct DES_ks { + union { + DES_cblock cblock; + /* + * make sure things are correct size on machines with 8 byte longs + */ + DES_LONG deslong[2]; + } ks[16]; +} DES_key_schedule; + +#ifndef OPENSSL_DISABLE_OLD_DES_SUPPORT +#ifndef OPENSSL_ENABLE_OLD_DES_SUPPORT +#define OPENSSL_ENABLE_OLD_DES_SUPPORT +#endif +#endif + +#ifdef OPENSSL_ENABLE_OLD_DES_SUPPORT +#include +#endif + +#define DES_KEY_SZ (sizeof(DES_cblock)) +#define DES_SCHEDULE_SZ (sizeof(DES_key_schedule)) + +#define DES_ENCRYPT 1 +#define DES_DECRYPT 0 + +#define DES_CBC_MODE 0 +#define DES_PCBC_MODE 1 + +#define DES_ecb2_encrypt(i, o, k1, k2, e) \ + DES_ecb3_encrypt((i), (o), (k1), (k2), (k1), (e)) + +#define DES_ede2_cbc_encrypt(i, o, l, k1, k2, iv, e) \ + DES_ede3_cbc_encrypt((i), (o), (l), (k1), (k2), (k1), (iv), (e)) + +#define DES_ede2_cfb64_encrypt(i, o, l, k1, k2, iv, n, e) \ + DES_ede3_cfb64_encrypt((i), (o), (l), (k1), (k2), (k1), (iv), (n), (e)) + +#define DES_ede2_ofb64_encrypt(i, o, l, k1, k2, iv, n) \ + DES_ede3_ofb64_encrypt((i), (o), (l), (k1), (k2), (k1), (iv), (n)) + +OPENSSL_DECLARE_GLOBAL(int, DES_check_key); /* defaults to false */ +#define DES_check_key OPENSSL_GLOBAL_REF(DES_check_key) +OPENSSL_DECLARE_GLOBAL(int, DES_rw_mode); /* defaults to DES_PCBC_MODE */ +#define DES_rw_mode OPENSSL_GLOBAL_REF(DES_rw_mode) + +const char* DES_options(void); +void DES_ecb3_encrypt( + const_DES_cblock* input, + DES_cblock* output, + DES_key_schedule* ks1, + DES_key_schedule* ks2, + DES_key_schedule* ks3, + int enc); +DES_LONG DES_cbc_cksum( + const unsigned char* input, + DES_cblock* output, + long length, + DES_key_schedule* schedule, + const_DES_cblock* ivec); +/* DES_cbc_encrypt does not update the IV! Use DES_ncbc_encrypt instead. */ +void DES_cbc_encrypt( + const unsigned char* input, + unsigned char* output, + long length, + DES_key_schedule* schedule, + DES_cblock* ivec, + int enc); +void DES_ncbc_encrypt( + const unsigned char* input, + unsigned char* output, + long length, + DES_key_schedule* schedule, + DES_cblock* ivec, + int enc); +void DES_xcbc_encrypt( + const unsigned char* input, + unsigned char* output, + long length, + DES_key_schedule* schedule, + DES_cblock* ivec, + const_DES_cblock* inw, + const_DES_cblock* outw, + int enc); +void DES_cfb_encrypt( + const unsigned char* in, + unsigned char* out, + int numbits, + long length, + DES_key_schedule* schedule, + DES_cblock* ivec, + int enc); +void DES_ecb_encrypt( + const_DES_cblock* input, + DES_cblock* output, + DES_key_schedule* ks, + int enc); + +/* + * This is the DES encryption function that gets called by just about every + * other DES routine in the library. You should not use this function except + * to implement 'modes' of DES. I say this because the functions that call + * this routine do the conversion from 'char *' to long, and this needs to be + * done to make sure 'non-aligned' memory access do not occur. The + * characters are loaded 'little endian'. Data is a pointer to 2 unsigned + * long's and ks is the DES_key_schedule to use. enc, is non zero specifies + * encryption, zero if decryption. + */ +void DES_encrypt1(DES_LONG* data, DES_key_schedule* ks, int enc); + +/* + * This functions is the same as DES_encrypt1() except that the DES initial + * permutation (IP) and final permutation (FP) have been left out. As for + * DES_encrypt1(), you should not use this function. It is used by the + * routines in the library that implement triple DES. IP() DES_encrypt2() + * DES_encrypt2() DES_encrypt2() FP() is the same as DES_encrypt1() + * DES_encrypt1() DES_encrypt1() except faster :-). + */ +void DES_encrypt2(DES_LONG* data, DES_key_schedule* ks, int enc); + +void DES_encrypt3( + DES_LONG* data, + DES_key_schedule* ks1, + DES_key_schedule* ks2, + DES_key_schedule* ks3); +void DES_decrypt3( + DES_LONG* data, + DES_key_schedule* ks1, + DES_key_schedule* ks2, + DES_key_schedule* ks3); +void DES_ede3_cbc_encrypt( + const unsigned char* input, + unsigned char* output, + long length, + DES_key_schedule* ks1, + DES_key_schedule* ks2, + DES_key_schedule* ks3, + DES_cblock* ivec, + int enc); +void DES_ede3_cbcm_encrypt( + const unsigned char* in, + unsigned char* out, + long length, + DES_key_schedule* ks1, + DES_key_schedule* ks2, + DES_key_schedule* ks3, + DES_cblock* ivec1, + DES_cblock* ivec2, + int enc); +void DES_ede3_cfb64_encrypt( + const unsigned char* in, + unsigned char* out, + long length, + DES_key_schedule* ks1, + DES_key_schedule* ks2, + DES_key_schedule* ks3, + DES_cblock* ivec, + int* num, + int enc); +void DES_ede3_cfb_encrypt( + const unsigned char* in, + unsigned char* out, + int numbits, + long length, + DES_key_schedule* ks1, + DES_key_schedule* ks2, + DES_key_schedule* ks3, + DES_cblock* ivec, + int enc); +void DES_ede3_ofb64_encrypt( + const unsigned char* in, + unsigned char* out, + long length, + DES_key_schedule* ks1, + DES_key_schedule* ks2, + DES_key_schedule* ks3, + DES_cblock* ivec, + int* num); +#if 0 +void DES_xwhite_in2out(const_DES_cblock *DES_key, const_DES_cblock *in_white, + DES_cblock *out_white); +#endif + +int DES_enc_read( + int fd, + void* buf, + int len, + DES_key_schedule* sched, + DES_cblock* iv); +int DES_enc_write( + int fd, + const void* buf, + int len, + DES_key_schedule* sched, + DES_cblock* iv); +char* DES_fcrypt(const char* buf, const char* salt, char* ret); +char* DES_crypt(const char* buf, const char* salt); +void DES_ofb_encrypt( + const unsigned char* in, + unsigned char* out, + int numbits, + long length, + DES_key_schedule* schedule, + DES_cblock* ivec); +void DES_pcbc_encrypt( + const unsigned char* input, + unsigned char* output, + long length, + DES_key_schedule* schedule, + DES_cblock* ivec, + int enc); +DES_LONG DES_quad_cksum( + const unsigned char* input, + DES_cblock output[], + long length, + int out_count, + DES_cblock* seed); +int DES_random_key(DES_cblock* ret); +void DES_set_odd_parity(DES_cblock* key); +int DES_check_key_parity(const_DES_cblock* key); +int DES_is_weak_key(const_DES_cblock* key); +/* + * DES_set_key (= set_key = DES_key_sched = key_sched) calls + * DES_set_key_checked if global variable DES_check_key is set, + * DES_set_key_unchecked otherwise. + */ +int DES_set_key(const_DES_cblock* key, DES_key_schedule* schedule); +int DES_key_sched(const_DES_cblock* key, DES_key_schedule* schedule); +int DES_set_key_checked(const_DES_cblock* key, DES_key_schedule* schedule); +void DES_set_key_unchecked(const_DES_cblock* key, DES_key_schedule* schedule); +#ifdef OPENSSL_FIPS +void private_DES_set_key_unchecked( + const_DES_cblock* key, + DES_key_schedule* schedule); +#endif +void DES_string_to_key(const char* str, DES_cblock* key); +void DES_string_to_2keys(const char* str, DES_cblock* key1, DES_cblock* key2); +void DES_cfb64_encrypt( + const unsigned char* in, + unsigned char* out, + long length, + DES_key_schedule* schedule, + DES_cblock* ivec, + int* num, + int enc); +void DES_ofb64_encrypt( + const unsigned char* in, + unsigned char* out, + long length, + DES_key_schedule* schedule, + DES_cblock* ivec, + int* num); + +int DES_read_password(DES_cblock* key, const char* prompt, int verify); +int DES_read_2passwords( + DES_cblock* key1, + DES_cblock* key2, + const char* prompt, + int verify); + +#define DES_fixup_key_parity DES_set_odd_parity + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/des_old.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/des_old.h new file mode 100644 index 0000000..f74bde1 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/des_old.h @@ -0,0 +1,523 @@ +/* crypto/des/des_old.h */ + +/*- + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * The function names in here are deprecated and are only present to + * provide an interface compatible with openssl 0.9.6 and older as + * well as libdes. OpenSSL now provides functions where "des_" has + * been replaced with "DES_" in the names, to make it possible to + * make incompatible changes that are needed for C type security and + * other stuff. + * + * This include files has two compatibility modes: + * + * - If OPENSSL_DES_LIBDES_COMPATIBILITY is defined, you get an API + * that is compatible with libdes and SSLeay. + * - If OPENSSL_DES_LIBDES_COMPATIBILITY isn't defined, you get an + * API that is compatible with OpenSSL 0.9.5x to 0.9.6x. + * + * Note that these modes break earlier snapshots of OpenSSL, where + * libdes compatibility was the only available mode or (later on) the + * prefered compatibility mode. However, after much consideration + * (and more or less violent discussions with external parties), it + * was concluded that OpenSSL should be compatible with earlier versions + * of itself before anything else. Also, in all honesty, libdes is + * an old beast that shouldn't really be used any more. + * + * Please consider starting to use the DES_ functions rather than the + * des_ ones. The des_ functions will disappear completely before + * OpenSSL 1.0! + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + +/* + * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project + * 2001. + */ +/* ==================================================================== + * Copyright (c) 1998-2002 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_DES_H +#define HEADER_DES_H + +#include /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG */ + +#ifdef OPENSSL_NO_DES +#error DES is disabled. +#endif + +#ifndef HEADER_NEW_DES_H +#error You must include des.h, not des_old.h directly. +#endif + +#ifdef _KERBEROS_DES_H +#error replaces . +#endif + +#include + +#ifdef OPENSSL_BUILD_SHLIBCRYPTO +#undef OPENSSL_EXTERN +#define OPENSSL_EXTERN OPENSSL_EXPORT +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _ +#undef _ +#endif + +typedef unsigned char _ossl_old_des_cblock[8]; +typedef struct _ossl_old_des_ks_struct { + union { + _ossl_old_des_cblock _; + /* + * make sure things are correct size on machines with 8 byte longs + */ + DES_LONG pad[2]; + } ks; +} _ossl_old_des_key_schedule[16]; + +#ifndef OPENSSL_DES_LIBDES_COMPATIBILITY +#define des_cblock DES_cblock +#define const_des_cblock const_DES_cblock +#define des_key_schedule DES_key_schedule +#define des_ecb3_encrypt(i, o, k1, k2, k3, e) \ + DES_ecb3_encrypt((i), (o), &(k1), &(k2), &(k3), (e)) +#define des_ede3_cbc_encrypt(i, o, l, k1, k2, k3, iv, e) \ + DES_ede3_cbc_encrypt((i), (o), (l), &(k1), &(k2), &(k3), (iv), (e)) +#define des_ede3_cbcm_encrypt(i, o, l, k1, k2, k3, iv1, iv2, e) \ + DES_ede3_cbcm_encrypt((i), (o), (l), &(k1), &(k2), &(k3), (iv1), (iv2), (e)) +#define des_ede3_cfb64_encrypt(i, o, l, k1, k2, k3, iv, n, e) \ + DES_ede3_cfb64_encrypt((i), (o), (l), &(k1), &(k2), &(k3), (iv), (n), (e)) +#define des_ede3_ofb64_encrypt(i, o, l, k1, k2, k3, iv, n) \ + DES_ede3_ofb64_encrypt((i), (o), (l), &(k1), &(k2), &(k3), (iv), (n)) +#define des_options() DES_options() +#define des_cbc_cksum(i, o, l, k, iv) DES_cbc_cksum((i), (o), (l), &(k), (iv)) +#define des_cbc_encrypt(i, o, l, k, iv, e) \ + DES_cbc_encrypt((i), (o), (l), &(k), (iv), (e)) +#define des_ncbc_encrypt(i, o, l, k, iv, e) \ + DES_ncbc_encrypt((i), (o), (l), &(k), (iv), (e)) +#define des_xcbc_encrypt(i, o, l, k, iv, inw, outw, e) \ + DES_xcbc_encrypt((i), (o), (l), &(k), (iv), (inw), (outw), (e)) +#define des_cfb_encrypt(i, o, n, l, k, iv, e) \ + DES_cfb_encrypt((i), (o), (n), (l), &(k), (iv), (e)) +#define des_ecb_encrypt(i, o, k, e) DES_ecb_encrypt((i), (o), &(k), (e)) +#define des_encrypt1(d, k, e) DES_encrypt1((d), &(k), (e)) +#define des_encrypt2(d, k, e) DES_encrypt2((d), &(k), (e)) +#define des_encrypt3(d, k1, k2, k3) DES_encrypt3((d), &(k1), &(k2), &(k3)) +#define des_decrypt3(d, k1, k2, k3) DES_decrypt3((d), &(k1), &(k2), &(k3)) +#define des_xwhite_in2out(k, i, o) DES_xwhite_in2out((k), (i), (o)) +#define des_enc_read(f, b, l, k, iv) DES_enc_read((f), (b), (l), &(k), (iv)) +#define des_enc_write(f, b, l, k, iv) DES_enc_write((f), (b), (l), &(k), (iv)) +#define des_fcrypt(b, s, r) DES_fcrypt((b), (s), (r)) +#if 0 +#define des_crypt(b, s) DES_crypt((b), (s)) +#if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) && \ + !defined(__OpenBSD__) +#define crypt(b, s) DES_crypt((b), (s)) +#endif +#endif +#define des_ofb_encrypt(i, o, n, l, k, iv) \ + DES_ofb_encrypt((i), (o), (n), (l), &(k), (iv)) +#define des_pcbc_encrypt(i, o, l, k, iv, e) \ + DES_pcbc_encrypt((i), (o), (l), &(k), (iv), (e)) +#define des_quad_cksum(i, o, l, c, s) DES_quad_cksum((i), (o), (l), (c), (s)) +#define des_random_seed(k) _ossl_096_des_random_seed((k)) +#define des_random_key(r) DES_random_key((r)) +#define des_read_password(k, p, v) DES_read_password((k), (p), (v)) +#define des_read_2passwords(k1, k2, p, v) \ + DES_read_2passwords((k1), (k2), (p), (v)) +#define des_set_odd_parity(k) DES_set_odd_parity((k)) +#define des_check_key_parity(k) DES_check_key_parity((k)) +#define des_is_weak_key(k) DES_is_weak_key((k)) +#define des_set_key(k, ks) DES_set_key((k), &(ks)) +#define des_key_sched(k, ks) DES_key_sched((k), &(ks)) +#define des_set_key_checked(k, ks) DES_set_key_checked((k), &(ks)) +#define des_set_key_unchecked(k, ks) DES_set_key_unchecked((k), &(ks)) +#define des_string_to_key(s, k) DES_string_to_key((s), (k)) +#define des_string_to_2keys(s, k1, k2) DES_string_to_2keys((s), (k1), (k2)) +#define des_cfb64_encrypt(i, o, l, ks, iv, n, e) \ + DES_cfb64_encrypt((i), (o), (l), &(ks), (iv), (n), (e)) +#define des_ofb64_encrypt(i, o, l, ks, iv, n) \ + DES_ofb64_encrypt((i), (o), (l), &(ks), (iv), (n)) + +#define des_ecb2_encrypt(i, o, k1, k2, e) \ + des_ecb3_encrypt((i), (o), (k1), (k2), (k1), (e)) + +#define des_ede2_cbc_encrypt(i, o, l, k1, k2, iv, e) \ + des_ede3_cbc_encrypt((i), (o), (l), (k1), (k2), (k1), (iv), (e)) + +#define des_ede2_cfb64_encrypt(i, o, l, k1, k2, iv, n, e) \ + des_ede3_cfb64_encrypt((i), (o), (l), (k1), (k2), (k1), (iv), (n), (e)) + +#define des_ede2_ofb64_encrypt(i, o, l, k1, k2, iv, n) \ + des_ede3_ofb64_encrypt((i), (o), (l), (k1), (k2), (k1), (iv), (n)) + +#define des_check_key DES_check_key +#define des_rw_mode DES_rw_mode +#else /* libdes compatibility */ +/* + * Map all symbol names to _ossl_old_des_* form, so we avoid all clashes with + * libdes + */ +#define des_cblock _ossl_old_des_cblock +#define des_key_schedule _ossl_old_des_key_schedule +#define des_ecb3_encrypt(i, o, k1, k2, k3, e) \ + _ossl_old_des_ecb3_encrypt((i), (o), (k1), (k2), (k3), (e)) +#define des_ede3_cbc_encrypt(i, o, l, k1, k2, k3, iv, e) \ + _ossl_old_des_ede3_cbc_encrypt((i), (o), (l), (k1), (k2), (k3), (iv), (e)) +#define des_ede3_cfb64_encrypt(i, o, l, k1, k2, k3, iv, n, e) \ + _ossl_old_des_ede3_cfb64_encrypt( \ + (i), (o), (l), (k1), (k2), (k3), (iv), (n), (e)) +#define des_ede3_ofb64_encrypt(i, o, l, k1, k2, k3, iv, n) \ + _ossl_old_des_ede3_ofb64_encrypt((i), (o), (l), (k1), (k2), (k3), (iv), (n)) +#define des_options() _ossl_old_des_options() +#define des_cbc_cksum(i, o, l, k, iv) \ + _ossl_old_des_cbc_cksum((i), (o), (l), (k), (iv)) +#define des_cbc_encrypt(i, o, l, k, iv, e) \ + _ossl_old_des_cbc_encrypt((i), (o), (l), (k), (iv), (e)) +#define des_ncbc_encrypt(i, o, l, k, iv, e) \ + _ossl_old_des_ncbc_encrypt((i), (o), (l), (k), (iv), (e)) +#define des_xcbc_encrypt(i, o, l, k, iv, inw, outw, e) \ + _ossl_old_des_xcbc_encrypt((i), (o), (l), (k), (iv), (inw), (outw), (e)) +#define des_cfb_encrypt(i, o, n, l, k, iv, e) \ + _ossl_old_des_cfb_encrypt((i), (o), (n), (l), (k), (iv), (e)) +#define des_ecb_encrypt(i, o, k, e) \ + _ossl_old_des_ecb_encrypt((i), (o), (k), (e)) +#define des_encrypt(d, k, e) _ossl_old_des_encrypt((d), (k), (e)) +#define des_encrypt2(d, k, e) _ossl_old_des_encrypt2((d), (k), (e)) +#define des_encrypt3(d, k1, k2, k3) \ + _ossl_old_des_encrypt3((d), (k1), (k2), (k3)) +#define des_decrypt3(d, k1, k2, k3) \ + _ossl_old_des_decrypt3((d), (k1), (k2), (k3)) +#define des_xwhite_in2out(k, i, o) _ossl_old_des_xwhite_in2out((k), (i), (o)) +#define des_enc_read(f, b, l, k, iv) \ + _ossl_old_des_enc_read((f), (b), (l), (k), (iv)) +#define des_enc_write(f, b, l, k, iv) \ + _ossl_old_des_enc_write((f), (b), (l), (k), (iv)) +#define des_fcrypt(b, s, r) _ossl_old_des_fcrypt((b), (s), (r)) +#define des_crypt(b, s) _ossl_old_des_crypt((b), (s)) +#if 0 +#define crypt(b, s) _ossl_old_crypt((b), (s)) +#endif +#define des_ofb_encrypt(i, o, n, l, k, iv) \ + _ossl_old_des_ofb_encrypt((i), (o), (n), (l), (k), (iv)) +#define des_pcbc_encrypt(i, o, l, k, iv, e) \ + _ossl_old_des_pcbc_encrypt((i), (o), (l), (k), (iv), (e)) +#define des_quad_cksum(i, o, l, c, s) \ + _ossl_old_des_quad_cksum((i), (o), (l), (c), (s)) +#define des_random_seed(k) _ossl_old_des_random_seed((k)) +#define des_random_key(r) _ossl_old_des_random_key((r)) +#define des_read_password(k, p, v) _ossl_old_des_read_password((k), (p), (v)) +#define des_read_2passwords(k1, k2, p, v) \ + _ossl_old_des_read_2passwords((k1), (k2), (p), (v)) +#define des_set_odd_parity(k) _ossl_old_des_set_odd_parity((k)) +#define des_is_weak_key(k) _ossl_old_des_is_weak_key((k)) +#define des_set_key(k, ks) _ossl_old_des_set_key((k), (ks)) +#define des_key_sched(k, ks) _ossl_old_des_key_sched((k), (ks)) +#define des_string_to_key(s, k) _ossl_old_des_string_to_key((s), (k)) +#define des_string_to_2keys(s, k1, k2) \ + _ossl_old_des_string_to_2keys((s), (k1), (k2)) +#define des_cfb64_encrypt(i, o, l, ks, iv, n, e) \ + _ossl_old_des_cfb64_encrypt((i), (o), (l), (ks), (iv), (n), (e)) +#define des_ofb64_encrypt(i, o, l, ks, iv, n) \ + _ossl_old_des_ofb64_encrypt((i), (o), (l), (ks), (iv), (n)) + +#define des_ecb2_encrypt(i, o, k1, k2, e) \ + des_ecb3_encrypt((i), (o), (k1), (k2), (k1), (e)) + +#define des_ede2_cbc_encrypt(i, o, l, k1, k2, iv, e) \ + des_ede3_cbc_encrypt((i), (o), (l), (k1), (k2), (k1), (iv), (e)) + +#define des_ede2_cfb64_encrypt(i, o, l, k1, k2, iv, n, e) \ + des_ede3_cfb64_encrypt((i), (o), (l), (k1), (k2), (k1), (iv), (n), (e)) + +#define des_ede2_ofb64_encrypt(i, o, l, k1, k2, iv, n) \ + des_ede3_ofb64_encrypt((i), (o), (l), (k1), (k2), (k1), (iv), (n)) + +#define des_check_key DES_check_key +#define des_rw_mode DES_rw_mode +#endif + +const char* _ossl_old_des_options(void); +void _ossl_old_des_ecb3_encrypt( + _ossl_old_des_cblock* input, + _ossl_old_des_cblock* output, + _ossl_old_des_key_schedule ks1, + _ossl_old_des_key_schedule ks2, + _ossl_old_des_key_schedule ks3, + int enc); +DES_LONG _ossl_old_des_cbc_cksum( + _ossl_old_des_cblock* input, + _ossl_old_des_cblock* output, + long length, + _ossl_old_des_key_schedule schedule, + _ossl_old_des_cblock* ivec); +void _ossl_old_des_cbc_encrypt( + _ossl_old_des_cblock* input, + _ossl_old_des_cblock* output, + long length, + _ossl_old_des_key_schedule schedule, + _ossl_old_des_cblock* ivec, + int enc); +void _ossl_old_des_ncbc_encrypt( + _ossl_old_des_cblock* input, + _ossl_old_des_cblock* output, + long length, + _ossl_old_des_key_schedule schedule, + _ossl_old_des_cblock* ivec, + int enc); +void _ossl_old_des_xcbc_encrypt( + _ossl_old_des_cblock* input, + _ossl_old_des_cblock* output, + long length, + _ossl_old_des_key_schedule schedule, + _ossl_old_des_cblock* ivec, + _ossl_old_des_cblock* inw, + _ossl_old_des_cblock* outw, + int enc); +void _ossl_old_des_cfb_encrypt( + unsigned char* in, + unsigned char* out, + int numbits, + long length, + _ossl_old_des_key_schedule schedule, + _ossl_old_des_cblock* ivec, + int enc); +void _ossl_old_des_ecb_encrypt( + _ossl_old_des_cblock* input, + _ossl_old_des_cblock* output, + _ossl_old_des_key_schedule ks, + int enc); +void _ossl_old_des_encrypt( + DES_LONG* data, + _ossl_old_des_key_schedule ks, + int enc); +void _ossl_old_des_encrypt2( + DES_LONG* data, + _ossl_old_des_key_schedule ks, + int enc); +void _ossl_old_des_encrypt3( + DES_LONG* data, + _ossl_old_des_key_schedule ks1, + _ossl_old_des_key_schedule ks2, + _ossl_old_des_key_schedule ks3); +void _ossl_old_des_decrypt3( + DES_LONG* data, + _ossl_old_des_key_schedule ks1, + _ossl_old_des_key_schedule ks2, + _ossl_old_des_key_schedule ks3); +void _ossl_old_des_ede3_cbc_encrypt( + _ossl_old_des_cblock* input, + _ossl_old_des_cblock* output, + long length, + _ossl_old_des_key_schedule ks1, + _ossl_old_des_key_schedule ks2, + _ossl_old_des_key_schedule ks3, + _ossl_old_des_cblock* ivec, + int enc); +void _ossl_old_des_ede3_cfb64_encrypt( + unsigned char* in, + unsigned char* out, + long length, + _ossl_old_des_key_schedule ks1, + _ossl_old_des_key_schedule ks2, + _ossl_old_des_key_schedule ks3, + _ossl_old_des_cblock* ivec, + int* num, + int enc); +void _ossl_old_des_ede3_ofb64_encrypt( + unsigned char* in, + unsigned char* out, + long length, + _ossl_old_des_key_schedule ks1, + _ossl_old_des_key_schedule ks2, + _ossl_old_des_key_schedule ks3, + _ossl_old_des_cblock* ivec, + int* num); +#if 0 +void _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key), + _ossl_old_des_cblock (*in_white), + _ossl_old_des_cblock (*out_white)); +#endif + +int _ossl_old_des_enc_read( + int fd, + char* buf, + int len, + _ossl_old_des_key_schedule sched, + _ossl_old_des_cblock* iv); +int _ossl_old_des_enc_write( + int fd, + char* buf, + int len, + _ossl_old_des_key_schedule sched, + _ossl_old_des_cblock* iv); +char* _ossl_old_des_fcrypt(const char* buf, const char* salt, char* ret); +char* _ossl_old_des_crypt(const char* buf, const char* salt); +#if !defined(PERL5) && !defined(NeXT) +char* _ossl_old_crypt(const char* buf, const char* salt); +#endif +void _ossl_old_des_ofb_encrypt( + unsigned char* in, + unsigned char* out, + int numbits, + long length, + _ossl_old_des_key_schedule schedule, + _ossl_old_des_cblock* ivec); +void _ossl_old_des_pcbc_encrypt( + _ossl_old_des_cblock* input, + _ossl_old_des_cblock* output, + long length, + _ossl_old_des_key_schedule schedule, + _ossl_old_des_cblock* ivec, + int enc); +DES_LONG _ossl_old_des_quad_cksum( + _ossl_old_des_cblock* input, + _ossl_old_des_cblock* output, + long length, + int out_count, + _ossl_old_des_cblock* seed); +void _ossl_old_des_random_seed(_ossl_old_des_cblock key); +void _ossl_old_des_random_key(_ossl_old_des_cblock ret); +int _ossl_old_des_read_password( + _ossl_old_des_cblock* key, + const char* prompt, + int verify); +int _ossl_old_des_read_2passwords( + _ossl_old_des_cblock* key1, + _ossl_old_des_cblock* key2, + const char* prompt, + int verify); +void _ossl_old_des_set_odd_parity(_ossl_old_des_cblock* key); +int _ossl_old_des_is_weak_key(_ossl_old_des_cblock* key); +int _ossl_old_des_set_key( + _ossl_old_des_cblock* key, + _ossl_old_des_key_schedule schedule); +int _ossl_old_des_key_sched( + _ossl_old_des_cblock* key, + _ossl_old_des_key_schedule schedule); +void _ossl_old_des_string_to_key(char* str, _ossl_old_des_cblock* key); +void _ossl_old_des_string_to_2keys( + char* str, + _ossl_old_des_cblock* key1, + _ossl_old_des_cblock* key2); +void _ossl_old_des_cfb64_encrypt( + unsigned char* in, + unsigned char* out, + long length, + _ossl_old_des_key_schedule schedule, + _ossl_old_des_cblock* ivec, + int* num, + int enc); +void _ossl_old_des_ofb64_encrypt( + unsigned char* in, + unsigned char* out, + long length, + _ossl_old_des_key_schedule schedule, + _ossl_old_des_cblock* ivec, + int* num); + +void _ossl_096_des_random_seed(des_cblock* key); + +/* + * The following definitions provide compatibility with the MIT Kerberos + * library. The _ossl_old_des_key_schedule structure is not binary + * compatible. + */ + +#define _KERBEROS_DES_H + +#define KRBDES_ENCRYPT DES_ENCRYPT +#define KRBDES_DECRYPT DES_DECRYPT + +#ifdef KERBEROS +#define ENCRYPT DES_ENCRYPT +#define DECRYPT DES_DECRYPT +#endif + +#ifndef NCOMPAT +#define C_Block des_cblock +#define Key_schedule des_key_schedule +#define KEY_SZ DES_KEY_SZ +#define string_to_key des_string_to_key +#define read_pw_string des_read_pw_string +#define random_key des_random_key +#define pcbc_encrypt des_pcbc_encrypt +#define set_key des_set_key +#define key_sched des_key_sched +#define ecb_encrypt des_ecb_encrypt +#define cbc_encrypt des_cbc_encrypt +#define ncbc_encrypt des_ncbc_encrypt +#define xcbc_encrypt des_xcbc_encrypt +#define cbc_cksum des_cbc_cksum +#define quad_cksum des_quad_cksum +#define check_parity des_check_key_parity +#endif + +#define des_fixup_key_parity DES_fixup_key_parity + +#ifdef __cplusplus +} +#endif + +/* for DES_read_pw_string et al */ +#include + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/dh.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/dh.h new file mode 100644 index 0000000..e1023bb --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/dh.h @@ -0,0 +1,500 @@ +/* crypto/dh/dh.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_DH_H +#define HEADER_DH_H + +#include + +#ifdef OPENSSL_NO_DH +#error DH is disabled. +#endif + +#ifndef OPENSSL_NO_BIO +#include +#endif +#include +#ifndef OPENSSL_NO_DEPRECATED +#include +#endif + +#ifndef OPENSSL_DH_MAX_MODULUS_BITS +#define OPENSSL_DH_MAX_MODULUS_BITS 10000 +#endif + +#define DH_FLAG_CACHE_MONT_P 0x01 + +/* + * new with 0.9.7h; the built-in DH + * implementation now uses constant time + * modular exponentiation for secret exponents + * by default. This flag causes the + * faster variable sliding window method to + * be used for all exponents. + */ +#define DH_FLAG_NO_EXP_CONSTTIME 0x02 + +/* + * If this flag is set the DH method is FIPS compliant and can be used in + * FIPS mode. This is set in the validated module method. If an application + * sets this flag in its own methods it is its reposibility to ensure the + * result is compliant. + */ + +#define DH_FLAG_FIPS_METHOD 0x0400 + +/* + * If this flag is set the operations normally disabled in FIPS mode are + * permitted it is then the applications responsibility to ensure that the + * usage is compliant. + */ + +#define DH_FLAG_NON_FIPS_ALLOW 0x0400 + +#ifdef __cplusplus +extern "C" { +#endif + +/* Already defined in ossl_typ.h */ +/* typedef struct dh_st DH; */ +/* typedef struct dh_method DH_METHOD; */ + +struct dh_method { + const char* name; + /* Methods here */ + int (*generate_key)(DH* dh); + int (*compute_key)(unsigned char* key, const BIGNUM* pub_key, DH* dh); + /* Can be null */ + int (*bn_mod_exp)( + const DH* dh, + BIGNUM* r, + const BIGNUM* a, + const BIGNUM* p, + const BIGNUM* m, + BN_CTX* ctx, + BN_MONT_CTX* m_ctx); + int (*init)(DH* dh); + int (*finish)(DH* dh); + int flags; + char* app_data; + /* If this is non-NULL, it will be used to generate parameters */ + int (*generate_params)(DH* dh, int prime_len, int generator, BN_GENCB* cb); +}; + +struct dh_st { + /* + * This first argument is used to pick up errors when a DH is passed + * instead of a EVP_PKEY + */ + int pad; + int version; + BIGNUM* p; + BIGNUM* g; + long length; /* optional */ + BIGNUM* pub_key; /* g^x % p */ + BIGNUM* priv_key; /* x */ + int flags; + BN_MONT_CTX* method_mont_p; + /* Place holders if we want to do X9.42 DH */ + BIGNUM* q; + BIGNUM* j; + unsigned char* seed; + int seedlen; + BIGNUM* counter; + int references; + CRYPTO_EX_DATA ex_data; + const DH_METHOD* meth; + ENGINE* engine; +}; + +#define DH_GENERATOR_2 2 +/* #define DH_GENERATOR_3 3 */ +#define DH_GENERATOR_5 5 + +/* DH_check error codes */ +#define DH_CHECK_P_NOT_PRIME 0x01 +#define DH_CHECK_P_NOT_SAFE_PRIME 0x02 +#define DH_UNABLE_TO_CHECK_GENERATOR 0x04 +#define DH_NOT_SUITABLE_GENERATOR 0x08 +#define DH_CHECK_Q_NOT_PRIME 0x10 +#define DH_CHECK_INVALID_Q_VALUE 0x20 +#define DH_CHECK_INVALID_J_VALUE 0x40 + +/* DH_check_pub_key error codes */ +#define DH_CHECK_PUBKEY_TOO_SMALL 0x01 +#define DH_CHECK_PUBKEY_TOO_LARGE 0x02 +#define DH_CHECK_PUBKEY_INVALID 0x04 + +/* + * primes p where (p-1)/2 is prime too are called "safe"; we define this for + * backward compatibility: + */ +#define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME + +#define d2i_DHparams_fp(fp, x) \ + (DH*)ASN1_d2i_fp( \ + (char* (*)())DH_new, \ + (char* (*)())d2i_DHparams, \ + (fp), \ + (unsigned char**)(x)) +#define i2d_DHparams_fp(fp, x) \ + ASN1_i2d_fp(i2d_DHparams, (fp), (unsigned char*)(x)) +#define d2i_DHparams_bio(bp, x) ASN1_d2i_bio_of(DH, DH_new, d2i_DHparams, bp, x) +#define i2d_DHparams_bio(bp, x) ASN1_i2d_bio_of_const(DH, i2d_DHparams, bp, x) + +#define d2i_DHxparams_fp(fp, x) \ + (DH*)ASN1_d2i_fp( \ + (char* (*)())DH_new, \ + (char* (*)())d2i_DHxparams, \ + (fp), \ + (unsigned char**)(x)) +#define i2d_DHxparams_fp(fp, x) \ + ASN1_i2d_fp(i2d_DHxparams, (fp), (unsigned char*)(x)) +#define d2i_DHxparams_bio(bp, x) \ + ASN1_d2i_bio_of(DH, DH_new, d2i_DHxparams, bp, x) +#define i2d_DHxparams_bio(bp, x) ASN1_i2d_bio_of_const(DH, i2d_DHxparams, bp, x) + +DH* DHparams_dup(DH*); + +const DH_METHOD* DH_OpenSSL(void); + +void DH_set_default_method(const DH_METHOD* meth); +const DH_METHOD* DH_get_default_method(void); +int DH_set_method(DH* dh, const DH_METHOD* meth); +DH* DH_new_method(ENGINE* engine); + +DH* DH_new(void); +void DH_free(DH* dh); +int DH_up_ref(DH* dh); +int DH_size(const DH* dh); +int DH_get_ex_new_index( + long argl, + void* argp, + CRYPTO_EX_new* new_func, + CRYPTO_EX_dup* dup_func, + CRYPTO_EX_free* free_func); +int DH_set_ex_data(DH* d, int idx, void* arg); +void* DH_get_ex_data(DH* d, int idx); + +/* Deprecated version */ +#ifndef OPENSSL_NO_DEPRECATED +DH* DH_generate_parameters( + int prime_len, + int generator, + void (*callback)(int, int, void*), + void* cb_arg); +#endif /* !defined(OPENSSL_NO_DEPRECATED) */ + +/* New version */ +int DH_generate_parameters_ex( + DH* dh, + int prime_len, + int generator, + BN_GENCB* cb); + +int DH_check(const DH* dh, int* codes); +int DH_check_pub_key(const DH* dh, const BIGNUM* pub_key, int* codes); +int DH_generate_key(DH* dh); +int DH_compute_key(unsigned char* key, const BIGNUM* pub_key, DH* dh); +int DH_compute_key_padded(unsigned char* key, const BIGNUM* pub_key, DH* dh); +DH* d2i_DHparams(DH** a, const unsigned char** pp, long length); +int i2d_DHparams(const DH* a, unsigned char** pp); +DH* d2i_DHxparams(DH** a, const unsigned char** pp, long length); +int i2d_DHxparams(const DH* a, unsigned char** pp); +#ifndef OPENSSL_NO_FP_API +int DHparams_print_fp(FILE* fp, const DH* x); +#endif +#ifndef OPENSSL_NO_BIO +int DHparams_print(BIO* bp, const DH* x); +#else +int DHparams_print(char* bp, const DH* x); +#endif + +/* RFC 5114 parameters */ +DH* DH_get_1024_160(void); +DH* DH_get_2048_224(void); +DH* DH_get_2048_256(void); + +#ifndef OPENSSL_NO_CMS +/* RFC2631 KDF */ +int DH_KDF_X9_42( + unsigned char* out, + size_t outlen, + const unsigned char* Z, + size_t Zlen, + ASN1_OBJECT* key_oid, + const unsigned char* ukm, + size_t ukmlen, + const EVP_MD* md); +#endif + +#define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_DH, \ + EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN, \ + len, \ + NULL) + +#define EVP_PKEY_CTX_set_dh_paramgen_subprime_len(ctx, len) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_DH, \ + EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN, \ + len, \ + NULL) + +#define EVP_PKEY_CTX_set_dh_paramgen_type(ctx, typ) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_DH, \ + EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DH_PARAMGEN_TYPE, \ + typ, \ + NULL) + +#define EVP_PKEY_CTX_set_dh_paramgen_generator(ctx, gen) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_DH, \ + EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR, \ + gen, \ + NULL) + +#define EVP_PKEY_CTX_set_dh_rfc5114(ctx, gen) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_DHX, \ + EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DH_RFC5114, \ + gen, \ + NULL) + +#define EVP_PKEY_CTX_set_dhx_rfc5114(ctx, gen) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_DHX, \ + EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DH_RFC5114, \ + gen, \ + NULL) + +#define EVP_PKEY_CTX_set_dh_kdf_type(ctx, kdf) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_KDF_TYPE, \ + kdf, \ + NULL) + +#define EVP_PKEY_CTX_get_dh_kdf_type(ctx) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_KDF_TYPE, \ + -2, \ + NULL) + +#define EVP_PKEY_CTX_set0_dh_kdf_oid(ctx, oid) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_KDF_OID, \ + 0, \ + (void*)oid) + +#define EVP_PKEY_CTX_get0_dh_kdf_oid(ctx, poid) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_DH_KDF_OID, \ + 0, \ + (void*)poid) + +#define EVP_PKEY_CTX_set_dh_kdf_md(ctx, md) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_KDF_MD, \ + 0, \ + (void*)md) + +#define EVP_PKEY_CTX_get_dh_kdf_md(ctx, pmd) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_DH_KDF_MD, \ + 0, \ + (void*)pmd) + +#define EVP_PKEY_CTX_set_dh_kdf_outlen(ctx, len) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_KDF_OUTLEN, \ + len, \ + NULL) + +#define EVP_PKEY_CTX_get_dh_kdf_outlen(ctx, plen) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN, \ + 0, \ + (void*)plen) + +#define EVP_PKEY_CTX_set0_dh_kdf_ukm(ctx, p, plen) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_KDF_UKM, \ + plen, \ + (void*)p) + +#define EVP_PKEY_CTX_get0_dh_kdf_ukm(ctx, p) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_DH_KDF_UKM, \ + 0, \ + (void*)p) + +#define EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN (EVP_PKEY_ALG_CTRL + 1) +#define EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR (EVP_PKEY_ALG_CTRL + 2) +#define EVP_PKEY_CTRL_DH_RFC5114 (EVP_PKEY_ALG_CTRL + 3) +#define EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN (EVP_PKEY_ALG_CTRL + 4) +#define EVP_PKEY_CTRL_DH_PARAMGEN_TYPE (EVP_PKEY_ALG_CTRL + 5) +#define EVP_PKEY_CTRL_DH_KDF_TYPE (EVP_PKEY_ALG_CTRL + 6) +#define EVP_PKEY_CTRL_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 7) +#define EVP_PKEY_CTRL_GET_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 8) +#define EVP_PKEY_CTRL_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 9) +#define EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 10) +#define EVP_PKEY_CTRL_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 11) +#define EVP_PKEY_CTRL_GET_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 12) +#define EVP_PKEY_CTRL_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 13) +#define EVP_PKEY_CTRL_GET_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 14) + +/* KDF types */ +#define EVP_PKEY_DH_KDF_NONE 1 +#define EVP_PKEY_DH_KDF_X9_42 2 + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_DH_strings(void); + +/* Error codes for the DH functions. */ + +/* Function codes. */ +#define DH_F_COMPUTE_KEY 102 +#define DH_F_DHPARAMS_PRINT_FP 101 +#define DH_F_DH_BUILTIN_GENPARAMS 106 +#define DH_F_DH_CMS_DECRYPT 117 +#define DH_F_DH_CMS_SET_PEERKEY 118 +#define DH_F_DH_CMS_SET_SHARED_INFO 119 +#define DH_F_DH_COMPUTE_KEY 114 +#define DH_F_DH_GENERATE_KEY 115 +#define DH_F_DH_GENERATE_PARAMETERS_EX 116 +#define DH_F_DH_NEW_METHOD 105 +#define DH_F_DH_PARAM_DECODE 107 +#define DH_F_DH_PRIV_DECODE 110 +#define DH_F_DH_PRIV_ENCODE 111 +#define DH_F_DH_PUB_DECODE 108 +#define DH_F_DH_PUB_ENCODE 109 +#define DH_F_DO_DH_PRINT 100 +#define DH_F_GENERATE_KEY 103 +#define DH_F_GENERATE_PARAMETERS 104 +#define DH_F_PKEY_DH_DERIVE 112 +#define DH_F_PKEY_DH_KEYGEN 113 + +/* Reason codes. */ +#define DH_R_BAD_GENERATOR 101 +#define DH_R_BN_DECODE_ERROR 109 +#define DH_R_BN_ERROR 106 +#define DH_R_DECODE_ERROR 104 +#define DH_R_INVALID_PUBKEY 102 +#define DH_R_KDF_PARAMETER_ERROR 112 +#define DH_R_KEYS_NOT_SET 108 +#define DH_R_KEY_SIZE_TOO_SMALL 110 +#define DH_R_MODULUS_TOO_LARGE 103 +#define DH_R_NON_FIPS_METHOD 111 +#define DH_R_NO_PARAMETERS_SET 107 +#define DH_R_NO_PRIVATE_VALUE 100 +#define DH_R_PARAMETER_ENCODING_ERROR 105 +#define DH_R_PEER_KEY_ERROR 113 +#define DH_R_SHARED_INFO_ERROR 114 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/dsa.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/dsa.h new file mode 100644 index 0000000..68a79fb --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/dsa.h @@ -0,0 +1,387 @@ +/* crypto/dsa/dsa.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* + * The DSS routines are based on patches supplied by + * Steven Schoch . He basically did the + * work and I have just tweaked them a little to fit into my + * stylistic vision for SSLeay :-) */ + +#ifndef HEADER_DSA_H +#define HEADER_DSA_H + +#include + +#ifdef OPENSSL_NO_DSA +#error DSA is disabled. +#endif + +#ifndef OPENSSL_NO_BIO +#include +#endif +#include +#include + +#ifndef OPENSSL_NO_DEPRECATED +#include +#ifndef OPENSSL_NO_DH +#include +#endif +#endif + +#ifndef OPENSSL_DSA_MAX_MODULUS_BITS +#define OPENSSL_DSA_MAX_MODULUS_BITS 10000 +#endif + +#define DSA_FLAG_CACHE_MONT_P 0x01 +/* + * new with 0.9.7h; the built-in DSA implementation now uses constant time + * modular exponentiation for secret exponents by default. This flag causes + * the faster variable sliding window method to be used for all exponents. + */ +#define DSA_FLAG_NO_EXP_CONSTTIME 0x02 + +/* + * If this flag is set the DSA method is FIPS compliant and can be used in + * FIPS mode. This is set in the validated module method. If an application + * sets this flag in its own methods it is its reposibility to ensure the + * result is compliant. + */ + +#define DSA_FLAG_FIPS_METHOD 0x0400 + +/* + * If this flag is set the operations normally disabled in FIPS mode are + * permitted it is then the applications responsibility to ensure that the + * usage is compliant. + */ + +#define DSA_FLAG_NON_FIPS_ALLOW 0x0400 + +#ifdef __cplusplus +extern "C" { +#endif + +/* Already defined in ossl_typ.h */ +/* typedef struct dsa_st DSA; */ +/* typedef struct dsa_method DSA_METHOD; */ + +typedef struct DSA_SIG_st { + BIGNUM* r; + BIGNUM* s; +} DSA_SIG; + +struct dsa_method { + const char* name; + DSA_SIG* (*dsa_do_sign)(const unsigned char* dgst, int dlen, DSA* dsa); + int (*dsa_sign_setup)(DSA* dsa, BN_CTX* ctx_in, BIGNUM** kinvp, BIGNUM** rp); + int (*dsa_do_verify)( + const unsigned char* dgst, + int dgst_len, + DSA_SIG* sig, + DSA* dsa); + int (*dsa_mod_exp)( + DSA* dsa, + BIGNUM* rr, + BIGNUM* a1, + BIGNUM* p1, + BIGNUM* a2, + BIGNUM* p2, + BIGNUM* m, + BN_CTX* ctx, + BN_MONT_CTX* in_mont); + /* Can be null */ + int (*bn_mod_exp)( + DSA* dsa, + BIGNUM* r, + BIGNUM* a, + const BIGNUM* p, + const BIGNUM* m, + BN_CTX* ctx, + BN_MONT_CTX* m_ctx); + int (*init)(DSA* dsa); + int (*finish)(DSA* dsa); + int flags; + char* app_data; + /* If this is non-NULL, it is used to generate DSA parameters */ + int (*dsa_paramgen)( + DSA* dsa, + int bits, + const unsigned char* seed, + int seed_len, + int* counter_ret, + unsigned long* h_ret, + BN_GENCB* cb); + /* If this is non-NULL, it is used to generate DSA keys */ + int (*dsa_keygen)(DSA* dsa); +}; + +struct dsa_st { + /* + * This first variable is used to pick up errors where a DSA is passed + * instead of of a EVP_PKEY + */ + int pad; + long version; + int write_params; + BIGNUM* p; + BIGNUM* q; /* == 20 */ + BIGNUM* g; + BIGNUM* pub_key; /* y public key */ + BIGNUM* priv_key; /* x private key */ + BIGNUM* kinv; /* Signing pre-calc */ + BIGNUM* r; /* Signing pre-calc */ + int flags; + /* Normally used to cache montgomery values */ + BN_MONT_CTX* method_mont_p; + int references; + CRYPTO_EX_DATA ex_data; + const DSA_METHOD* meth; + /* functional reference if 'meth' is ENGINE-provided */ + ENGINE* engine; +}; + +#define d2i_DSAparams_fp(fp, x) \ + (DSA*)ASN1_d2i_fp( \ + (char* (*)())DSA_new, \ + (char* (*)())d2i_DSAparams, \ + (fp), \ + (unsigned char**)(x)) +#define i2d_DSAparams_fp(fp, x) \ + ASN1_i2d_fp(i2d_DSAparams, (fp), (unsigned char*)(x)) +#define d2i_DSAparams_bio(bp, x) \ + ASN1_d2i_bio_of(DSA, DSA_new, d2i_DSAparams, bp, x) +#define i2d_DSAparams_bio(bp, x) \ + ASN1_i2d_bio_of_const(DSA, i2d_DSAparams, bp, x) + +DSA* DSAparams_dup(DSA* x); +DSA_SIG* DSA_SIG_new(void); +void DSA_SIG_free(DSA_SIG* a); +int i2d_DSA_SIG(const DSA_SIG* a, unsigned char** pp); +DSA_SIG* d2i_DSA_SIG(DSA_SIG** v, const unsigned char** pp, long length); + +DSA_SIG* DSA_do_sign(const unsigned char* dgst, int dlen, DSA* dsa); +int DSA_do_verify( + const unsigned char* dgst, + int dgst_len, + DSA_SIG* sig, + DSA* dsa); + +const DSA_METHOD* DSA_OpenSSL(void); + +void DSA_set_default_method(const DSA_METHOD*); +const DSA_METHOD* DSA_get_default_method(void); +int DSA_set_method(DSA* dsa, const DSA_METHOD*); + +DSA* DSA_new(void); +DSA* DSA_new_method(ENGINE* engine); +void DSA_free(DSA* r); +/* "up" the DSA object's reference count */ +int DSA_up_ref(DSA* r); +int DSA_size(const DSA*); +/* next 4 return -1 on error */ +int DSA_sign_setup(DSA* dsa, BN_CTX* ctx_in, BIGNUM** kinvp, BIGNUM** rp); +int DSA_sign( + int type, + const unsigned char* dgst, + int dlen, + unsigned char* sig, + unsigned int* siglen, + DSA* dsa); +int DSA_verify( + int type, + const unsigned char* dgst, + int dgst_len, + const unsigned char* sigbuf, + int siglen, + DSA* dsa); +int DSA_get_ex_new_index( + long argl, + void* argp, + CRYPTO_EX_new* new_func, + CRYPTO_EX_dup* dup_func, + CRYPTO_EX_free* free_func); +int DSA_set_ex_data(DSA* d, int idx, void* arg); +void* DSA_get_ex_data(DSA* d, int idx); + +DSA* d2i_DSAPublicKey(DSA** a, const unsigned char** pp, long length); +DSA* d2i_DSAPrivateKey(DSA** a, const unsigned char** pp, long length); +DSA* d2i_DSAparams(DSA** a, const unsigned char** pp, long length); + +/* Deprecated version */ +#ifndef OPENSSL_NO_DEPRECATED +DSA* DSA_generate_parameters( + int bits, + unsigned char* seed, + int seed_len, + int* counter_ret, + unsigned long* h_ret, + void (*callback)(int, int, void*), + void* cb_arg); +#endif /* !defined(OPENSSL_NO_DEPRECATED) */ + +/* New version */ +int DSA_generate_parameters_ex( + DSA* dsa, + int bits, + const unsigned char* seed, + int seed_len, + int* counter_ret, + unsigned long* h_ret, + BN_GENCB* cb); + +int DSA_generate_key(DSA* a); +int i2d_DSAPublicKey(const DSA* a, unsigned char** pp); +int i2d_DSAPrivateKey(const DSA* a, unsigned char** pp); +int i2d_DSAparams(const DSA* a, unsigned char** pp); + +#ifndef OPENSSL_NO_BIO +int DSAparams_print(BIO* bp, const DSA* x); +int DSA_print(BIO* bp, const DSA* x, int off); +#endif +#ifndef OPENSSL_NO_FP_API +int DSAparams_print_fp(FILE* fp, const DSA* x); +int DSA_print_fp(FILE* bp, const DSA* x, int off); +#endif + +#define DSS_prime_checks 50 +/* + * Primality test according to FIPS PUB 186[-1], Appendix 2.1: 50 rounds of + * Rabin-Miller + */ +#define DSA_is_prime(n, callback, cb_arg) \ + BN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg) + +#ifndef OPENSSL_NO_DH +/* + * Convert DSA structure (key or just parameters) into DH structure (be + * careful to avoid small subgroup attacks when using this!) + */ +DH* DSA_dup_DH(const DSA* r); +#endif + +#define EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, nbits) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_DSA, \ + EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DSA_PARAMGEN_BITS, \ + nbits, \ + NULL) + +#define EVP_PKEY_CTRL_DSA_PARAMGEN_BITS (EVP_PKEY_ALG_CTRL + 1) +#define EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS (EVP_PKEY_ALG_CTRL + 2) +#define EVP_PKEY_CTRL_DSA_PARAMGEN_MD (EVP_PKEY_ALG_CTRL + 3) + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_DSA_strings(void); + +/* Error codes for the DSA functions. */ + +/* Function codes. */ +#define DSA_F_D2I_DSA_SIG 110 +#define DSA_F_DO_DSA_PRINT 104 +#define DSA_F_DSAPARAMS_PRINT 100 +#define DSA_F_DSAPARAMS_PRINT_FP 101 +#define DSA_F_DSA_BUILTIN_PARAMGEN2 126 +#define DSA_F_DSA_DO_SIGN 112 +#define DSA_F_DSA_DO_VERIFY 113 +#define DSA_F_DSA_GENERATE_KEY 124 +#define DSA_F_DSA_GENERATE_PARAMETERS_EX 123 +#define DSA_F_DSA_NEW_METHOD 103 +#define DSA_F_DSA_PARAM_DECODE 119 +#define DSA_F_DSA_PRINT_FP 105 +#define DSA_F_DSA_PRIV_DECODE 115 +#define DSA_F_DSA_PRIV_ENCODE 116 +#define DSA_F_DSA_PUB_DECODE 117 +#define DSA_F_DSA_PUB_ENCODE 118 +#define DSA_F_DSA_SIGN 106 +#define DSA_F_DSA_SIGN_SETUP 107 +#define DSA_F_DSA_SIG_NEW 109 +#define DSA_F_DSA_SIG_PRINT 125 +#define DSA_F_DSA_VERIFY 108 +#define DSA_F_I2D_DSA_SIG 111 +#define DSA_F_OLD_DSA_PRIV_DECODE 122 +#define DSA_F_PKEY_DSA_CTRL 120 +#define DSA_F_PKEY_DSA_KEYGEN 121 +#define DSA_F_SIG_CB 114 + +/* Reason codes. */ +#define DSA_R_BAD_Q_VALUE 102 +#define DSA_R_BN_DECODE_ERROR 108 +#define DSA_R_BN_ERROR 109 +#define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 100 +#define DSA_R_DECODE_ERROR 104 +#define DSA_R_INVALID_DIGEST_TYPE 106 +#define DSA_R_INVALID_PARAMETERS 112 +#define DSA_R_MISSING_PARAMETERS 101 +#define DSA_R_MODULUS_TOO_LARGE 103 +#define DSA_R_NEED_NEW_SETUP_VALUES 110 +#define DSA_R_NON_FIPS_DSA_METHOD 111 +#define DSA_R_NO_PARAMETERS_SET 107 +#define DSA_R_PARAMETER_ENCODING_ERROR 105 +#define DSA_R_Q_NOT_PRIME 113 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/dso.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/dso.h new file mode 100644 index 0000000..38e8362 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/dso.h @@ -0,0 +1,453 @@ +/* dso.h */ +/* + * Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL project + * 2000. + */ +/* ==================================================================== + * Copyright (c) 2000 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_DSO_H +#define HEADER_DSO_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* These values are used as commands to DSO_ctrl() */ +#define DSO_CTRL_GET_FLAGS 1 +#define DSO_CTRL_SET_FLAGS 2 +#define DSO_CTRL_OR_FLAGS 3 + +/* + * By default, DSO_load() will translate the provided filename into a form + * typical for the platform (more specifically the DSO_METHOD) using the + * dso_name_converter function of the method. Eg. win32 will transform "blah" + * into "blah.dll", and dlfcn will transform it into "libblah.so". The + * behaviour can be overriden by setting the name_converter callback in the + * DSO object (using DSO_set_name_converter()). This callback could even + * utilise the DSO_METHOD's converter too if it only wants to override + * behaviour for one or two possible DSO methods. However, the following flag + * can be set in a DSO to prevent *any* native name-translation at all - eg. + * if the caller has prompted the user for a path to a driver library so the + * filename should be interpreted as-is. + */ +#define DSO_FLAG_NO_NAME_TRANSLATION 0x01 +/* + * An extra flag to give if only the extension should be added as + * translation. This is obviously only of importance on Unix and other + * operating systems where the translation also may prefix the name with + * something, like 'lib', and ignored everywhere else. This flag is also + * ignored if DSO_FLAG_NO_NAME_TRANSLATION is used at the same time. + */ +#define DSO_FLAG_NAME_TRANSLATION_EXT_ONLY 0x02 + +/* + * The following flag controls the translation of symbol names to upper case. + * This is currently only being implemented for OpenVMS. + */ +#define DSO_FLAG_UPCASE_SYMBOL 0x10 + +/* + * This flag loads the library with public symbols. Meaning: The exported + * symbols of this library are public to all libraries loaded after this + * library. At the moment only implemented in unix. + */ +#define DSO_FLAG_GLOBAL_SYMBOLS 0x20 + +typedef void (*DSO_FUNC_TYPE)(void); + +typedef struct dso_st DSO; + +/* + * The function prototype used for method functions (or caller-provided + * callbacks) that transform filenames. They are passed a DSO structure + * pointer (or NULL if they are to be used independantly of a DSO object) and + * a filename to transform. They should either return NULL (if there is an + * error condition) or a newly allocated string containing the transformed + * form that the caller will need to free with OPENSSL_free() when done. + */ +typedef char* (*DSO_NAME_CONVERTER_FUNC)(DSO*, const char*); +/* + * The function prototype used for method functions (or caller-provided + * callbacks) that merge two file specifications. They are passed a DSO + * structure pointer (or NULL if they are to be used independantly of a DSO + * object) and two file specifications to merge. They should either return + * NULL (if there is an error condition) or a newly allocated string + * containing the result of merging that the caller will need to free with + * OPENSSL_free() when done. Here, merging means that bits and pieces are + * taken from each of the file specifications and added together in whatever + * fashion that is sensible for the DSO method in question. The only rule + * that really applies is that if the two specification contain pieces of the + * same type, the copy from the first string takes priority. One could see + * it as the first specification is the one given by the user and the second + * being a bunch of defaults to add on if they're missing in the first. + */ +typedef char* (*DSO_MERGER_FUNC)(DSO*, const char*, const char*); + +typedef struct dso_meth_st { + const char* name; + /* + * Loads a shared library, NB: new DSO_METHODs must ensure that a + * successful load populates the loaded_filename field, and likewise a + * successful unload OPENSSL_frees and NULLs it out. + */ + int (*dso_load)(DSO* dso); + /* Unloads a shared library */ + int (*dso_unload)(DSO* dso); + /* Binds a variable */ + void* (*dso_bind_var)(DSO* dso, const char* symname); + /* + * Binds a function - assumes a return type of DSO_FUNC_TYPE. This should + * be cast to the real function prototype by the caller. Platforms that + * don't have compatible representations for different prototypes (this + * is possible within ANSI C) are highly unlikely to have shared + * libraries at all, let alone a DSO_METHOD implemented for them. + */ + DSO_FUNC_TYPE (*dso_bind_func)(DSO* dso, const char* symname); +/* I don't think this would actually be used in any circumstances. */ +#if 0 + /* Unbinds a variable */ + int (*dso_unbind_var) (DSO *dso, char *symname, void *symptr); + /* Unbinds a function */ + int (*dso_unbind_func) (DSO *dso, char *symname, DSO_FUNC_TYPE symptr); +#endif + /* + * The generic (yuck) "ctrl()" function. NB: Negative return values + * (rather than zero) indicate errors. + */ + long (*dso_ctrl)(DSO* dso, int cmd, long larg, void* parg); + /* + * The default DSO_METHOD-specific function for converting filenames to a + * canonical native form. + */ + DSO_NAME_CONVERTER_FUNC dso_name_converter; + /* + * The default DSO_METHOD-specific function for converting filenames to a + * canonical native form. + */ + DSO_MERGER_FUNC dso_merger; + /* [De]Initialisation handlers. */ + int (*init)(DSO* dso); + int (*finish)(DSO* dso); + /* Return pathname of the module containing location */ + int (*pathbyaddr)(void* addr, char* path, int sz); + /* Perform global symbol lookup, i.e. among *all* modules */ + void* (*globallookup)(const char* symname); +} DSO_METHOD; + +/**********************************************************************/ +/* The low-level handle type used to refer to a loaded shared library */ + +struct dso_st { + DSO_METHOD* meth; + /* + * Standard dlopen uses a (void *). Win32 uses a HANDLE. VMS doesn't use + * anything but will need to cache the filename for use in the dso_bind + * handler. All in all, let each method control its own destiny. + * "Handles" and such go in a STACK. + */ + STACK_OF(void) * meth_data; + int references; + int flags; + /* + * For use by applications etc ... use this for your bits'n'pieces, don't + * touch meth_data! + */ + CRYPTO_EX_DATA ex_data; + /* + * If this callback function pointer is set to non-NULL, then it will be + * used in DSO_load() in place of meth->dso_name_converter. NB: This + * should normally set using DSO_set_name_converter(). + */ + DSO_NAME_CONVERTER_FUNC name_converter; + /* + * If this callback function pointer is set to non-NULL, then it will be + * used in DSO_load() in place of meth->dso_merger. NB: This should + * normally set using DSO_set_merger(). + */ + DSO_MERGER_FUNC merger; + /* + * This is populated with (a copy of) the platform-independant filename + * used for this DSO. + */ + char* filename; + /* + * This is populated with (a copy of) the translated filename by which + * the DSO was actually loaded. It is NULL iff the DSO is not currently + * loaded. NB: This is here because the filename translation process may + * involve a callback being invoked more than once not only to convert to + * a platform-specific form, but also to try different filenames in the + * process of trying to perform a load. As such, this variable can be + * used to indicate (a) whether this DSO structure corresponds to a + * loaded library or not, and (b) the filename with which it was actually + * loaded. + */ + char* loaded_filename; +}; + +DSO* DSO_new(void); +DSO* DSO_new_method(DSO_METHOD* method); +int DSO_free(DSO* dso); +int DSO_flags(DSO* dso); +int DSO_up_ref(DSO* dso); +long DSO_ctrl(DSO* dso, int cmd, long larg, void* parg); + +/* + * This function sets the DSO's name_converter callback. If it is non-NULL, + * then it will be used instead of the associated DSO_METHOD's function. If + * oldcb is non-NULL then it is set to the function pointer value being + * replaced. Return value is non-zero for success. + */ +int DSO_set_name_converter( + DSO* dso, + DSO_NAME_CONVERTER_FUNC cb, + DSO_NAME_CONVERTER_FUNC* oldcb); +/* + * These functions can be used to get/set the platform-independant filename + * used for a DSO. NB: set will fail if the DSO is already loaded. + */ +const char* DSO_get_filename(DSO* dso); +int DSO_set_filename(DSO* dso, const char* filename); +/* + * This function will invoke the DSO's name_converter callback to translate a + * filename, or if the callback isn't set it will instead use the DSO_METHOD's + * converter. If "filename" is NULL, the "filename" in the DSO itself will be + * used. If the DSO_FLAG_NO_NAME_TRANSLATION flag is set, then the filename is + * simply duplicated. NB: This function is usually called from within a + * DSO_METHOD during the processing of a DSO_load() call, and is exposed so + * that caller-created DSO_METHODs can do the same thing. A non-NULL return + * value will need to be OPENSSL_free()'d. + */ +char* DSO_convert_filename(DSO* dso, const char* filename); +/* + * This function will invoke the DSO's merger callback to merge two file + * specifications, or if the callback isn't set it will instead use the + * DSO_METHOD's merger. A non-NULL return value will need to be + * OPENSSL_free()'d. + */ +char* DSO_merge(DSO* dso, const char* filespec1, const char* filespec2); +/* + * If the DSO is currently loaded, this returns the filename that it was + * loaded under, otherwise it returns NULL. So it is also useful as a test as + * to whether the DSO is currently loaded. NB: This will not necessarily + * return the same value as DSO_convert_filename(dso, dso->filename), because + * the DSO_METHOD's load function may have tried a variety of filenames (with + * and/or without the aid of the converters) before settling on the one it + * actually loaded. + */ +const char* DSO_get_loaded_filename(DSO* dso); + +void DSO_set_default_method(DSO_METHOD* meth); +DSO_METHOD* DSO_get_default_method(void); +DSO_METHOD* DSO_get_method(DSO* dso); +DSO_METHOD* DSO_set_method(DSO* dso, DSO_METHOD* meth); + +/* + * The all-singing all-dancing load function, you normally pass NULL for the + * first and third parameters. Use DSO_up and DSO_free for subsequent + * reference count handling. Any flags passed in will be set in the + * constructed DSO after its init() function but before the load operation. + * If 'dso' is non-NULL, 'flags' is ignored. + */ +DSO* DSO_load(DSO* dso, const char* filename, DSO_METHOD* meth, int flags); + +/* This function binds to a variable inside a shared library. */ +void* DSO_bind_var(DSO* dso, const char* symname); + +/* This function binds to a function inside a shared library. */ +DSO_FUNC_TYPE DSO_bind_func(DSO* dso, const char* symname); + +/* + * This method is the default, but will beg, borrow, or steal whatever method + * should be the default on any particular platform (including + * DSO_METH_null() if necessary). + */ +DSO_METHOD* DSO_METHOD_openssl(void); + +/* + * This method is defined for all platforms - if a platform has no DSO + * support then this will be the only method! + */ +DSO_METHOD* DSO_METHOD_null(void); + +/* + * If DSO_DLFCN is defined, the standard dlfcn.h-style functions (dlopen, + * dlclose, dlsym, etc) will be used and incorporated into this method. If + * not, this method will return NULL. + */ +DSO_METHOD* DSO_METHOD_dlfcn(void); + +/* + * If DSO_DL is defined, the standard dl.h-style functions (shl_load, + * shl_unload, shl_findsym, etc) will be used and incorporated into this + * method. If not, this method will return NULL. + */ +DSO_METHOD* DSO_METHOD_dl(void); + +/* If WIN32 is defined, use DLLs. If not, return NULL. */ +DSO_METHOD* DSO_METHOD_win32(void); + +/* If VMS is defined, use shared images. If not, return NULL. */ +DSO_METHOD* DSO_METHOD_vms(void); + +/* + * This function writes null-terminated pathname of DSO module containing + * 'addr' into 'sz' large caller-provided 'path' and returns the number of + * characters [including trailing zero] written to it. If 'sz' is 0 or + * negative, 'path' is ignored and required amount of charachers [including + * trailing zero] to accomodate pathname is returned. If 'addr' is NULL, then + * pathname of cryptolib itself is returned. Negative or zero return value + * denotes error. + */ +int DSO_pathbyaddr(void* addr, char* path, int sz); + +/* + * This function should be used with caution! It looks up symbols in *all* + * loaded modules and if module gets unloaded by somebody else attempt to + * dereference the pointer is doomed to have fatal consequences. Primary + * usage for this function is to probe *core* system functionality, e.g. + * check if getnameinfo(3) is available at run-time without bothering about + * OS-specific details such as libc.so.versioning or where does it actually + * reside: in libc itself or libsocket. + */ +void* DSO_global_lookup(const char* name); + +/* If BeOS is defined, use shared images. If not, return NULL. */ +DSO_METHOD* DSO_METHOD_beos(void); + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_DSO_strings(void); + +/* Error codes for the DSO functions. */ + +/* Function codes. */ +#define DSO_F_BEOS_BIND_FUNC 144 +#define DSO_F_BEOS_BIND_VAR 145 +#define DSO_F_BEOS_LOAD 146 +#define DSO_F_BEOS_NAME_CONVERTER 147 +#define DSO_F_BEOS_UNLOAD 148 +#define DSO_F_DLFCN_BIND_FUNC 100 +#define DSO_F_DLFCN_BIND_VAR 101 +#define DSO_F_DLFCN_LOAD 102 +#define DSO_F_DLFCN_MERGER 130 +#define DSO_F_DLFCN_NAME_CONVERTER 123 +#define DSO_F_DLFCN_UNLOAD 103 +#define DSO_F_DL_BIND_FUNC 104 +#define DSO_F_DL_BIND_VAR 105 +#define DSO_F_DL_LOAD 106 +#define DSO_F_DL_MERGER 131 +#define DSO_F_DL_NAME_CONVERTER 124 +#define DSO_F_DL_UNLOAD 107 +#define DSO_F_DSO_BIND_FUNC 108 +#define DSO_F_DSO_BIND_VAR 109 +#define DSO_F_DSO_CONVERT_FILENAME 126 +#define DSO_F_DSO_CTRL 110 +#define DSO_F_DSO_FREE 111 +#define DSO_F_DSO_GET_FILENAME 127 +#define DSO_F_DSO_GET_LOADED_FILENAME 128 +#define DSO_F_DSO_GLOBAL_LOOKUP 139 +#define DSO_F_DSO_LOAD 112 +#define DSO_F_DSO_MERGE 132 +#define DSO_F_DSO_NEW_METHOD 113 +#define DSO_F_DSO_PATHBYADDR 140 +#define DSO_F_DSO_SET_FILENAME 129 +#define DSO_F_DSO_SET_NAME_CONVERTER 122 +#define DSO_F_DSO_UP_REF 114 +#define DSO_F_GLOBAL_LOOKUP_FUNC 138 +#define DSO_F_PATHBYADDR 137 +#define DSO_F_VMS_BIND_SYM 115 +#define DSO_F_VMS_LOAD 116 +#define DSO_F_VMS_MERGER 133 +#define DSO_F_VMS_UNLOAD 117 +#define DSO_F_WIN32_BIND_FUNC 118 +#define DSO_F_WIN32_BIND_VAR 119 +#define DSO_F_WIN32_GLOBALLOOKUP 142 +#define DSO_F_WIN32_GLOBALLOOKUP_FUNC 143 +#define DSO_F_WIN32_JOINER 135 +#define DSO_F_WIN32_LOAD 120 +#define DSO_F_WIN32_MERGER 134 +#define DSO_F_WIN32_NAME_CONVERTER 125 +#define DSO_F_WIN32_PATHBYADDR 141 +#define DSO_F_WIN32_SPLITTER 136 +#define DSO_F_WIN32_UNLOAD 121 + +/* Reason codes. */ +#define DSO_R_CTRL_FAILED 100 +#define DSO_R_DSO_ALREADY_LOADED 110 +#define DSO_R_EMPTY_FILE_STRUCTURE 113 +#define DSO_R_FAILURE 114 +#define DSO_R_FILENAME_TOO_BIG 101 +#define DSO_R_FINISH_FAILED 102 +#define DSO_R_INCORRECT_FILE_SYNTAX 115 +#define DSO_R_LOAD_FAILED 103 +#define DSO_R_NAME_TRANSLATION_FAILED 109 +#define DSO_R_NO_FILENAME 111 +#define DSO_R_NO_FILE_SPECIFICATION 116 +#define DSO_R_NULL_HANDLE 104 +#define DSO_R_SET_FILENAME_FAILED 112 +#define DSO_R_STACK_ERROR 105 +#define DSO_R_SYM_FAILURE 106 +#define DSO_R_UNLOAD_FAILED 107 +#define DSO_R_UNSUPPORTED 108 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/dtls1.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/dtls1.h new file mode 100644 index 0000000..bd8a316 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/dtls1.h @@ -0,0 +1,272 @@ +/* ssl/dtls1.h */ +/* + * DTLS implementation written by Nagendra Modadugu + * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. + */ +/* ==================================================================== + * Copyright (c) 1999-2005 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_DTLS1_H +#define HEADER_DTLS1_H + +#include +#include +#ifdef OPENSSL_SYS_VMS +#include +#include +#endif +#ifdef OPENSSL_SYS_WIN32 +/* Needed for struct timeval */ +#include +#elif defined(OPENSSL_SYS_NETWARE) && !defined(_WINSOCK2API_) +#include +#else +#if defined(OPENSSL_SYS_VXWORKS) +#include +#else +#include +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define DTLS1_VERSION 0xFEFF +#define DTLS1_2_VERSION 0xFEFD +#define DTLS_MAX_VERSION DTLS1_2_VERSION +#define DTLS1_VERSION_MAJOR 0xFE + +#define DTLS1_BAD_VER 0x0100 + +/* Special value for method supporting multiple versions */ +#define DTLS_ANY_VERSION 0x1FFFF + +#if 0 +/* this alert description is not specified anywhere... */ +#define DTLS1_AD_MISSING_HANDSHAKE_MESSAGE 110 +#endif + +/* lengths of messages */ +#define DTLS1_COOKIE_LENGTH 256 + +#define DTLS1_RT_HEADER_LENGTH 13 + +#define DTLS1_HM_HEADER_LENGTH 12 + +#define DTLS1_HM_BAD_FRAGMENT -2 +#define DTLS1_HM_FRAGMENT_RETRY -3 + +#define DTLS1_CCS_HEADER_LENGTH 1 + +#ifdef DTLS1_AD_MISSING_HANDSHAKE_MESSAGE +#define DTLS1_AL_HEADER_LENGTH 7 +#else +#define DTLS1_AL_HEADER_LENGTH 2 +#endif + +#ifndef OPENSSL_NO_SSL_INTERN + +#ifndef OPENSSL_NO_SCTP +#define DTLS1_SCTP_AUTH_LABEL "EXPORTER_DTLS_OVER_SCTP" +#endif + +/* Max MTU overhead we know about so far is 40 for IPv6 + 8 for UDP */ +#define DTLS1_MAX_MTU_OVERHEAD 48 + +typedef struct dtls1_bitmap_st { + unsigned long map; /* track 32 packets on 32-bit systems and 64 + * - on 64-bit systems */ + unsigned char max_seq_num[8]; /* max record number seen so far, 64-bit + * value in big-endian encoding */ +} DTLS1_BITMAP; + +struct dtls1_retransmit_state { + EVP_CIPHER_CTX* enc_write_ctx; /* cryptographic state */ + EVP_MD_CTX* write_hash; /* used for mac generation */ +#ifndef OPENSSL_NO_COMP + COMP_CTX* compress; /* compression */ +#else + char* compress; +#endif + SSL_SESSION* session; + unsigned short epoch; +}; + +struct hm_header_st { + unsigned char type; + unsigned long msg_len; + unsigned short seq; + unsigned long frag_off; + unsigned long frag_len; + unsigned int is_ccs; + struct dtls1_retransmit_state saved_retransmit_state; +}; + +struct ccs_header_st { + unsigned char type; + unsigned short seq; +}; + +struct dtls1_timeout_st { + /* Number of read timeouts so far */ + unsigned int read_timeouts; + /* Number of write timeouts so far */ + unsigned int write_timeouts; + /* Number of alerts received so far */ + unsigned int num_alerts; +}; + +typedef struct record_pqueue_st { + unsigned short epoch; + pqueue q; +} record_pqueue; + +typedef struct hm_fragment_st { + struct hm_header_st msg_header; + unsigned char* fragment; + unsigned char* reassembly; +} hm_fragment; + +typedef struct dtls1_state_st { + unsigned int send_cookie; + unsigned char cookie[DTLS1_COOKIE_LENGTH]; + unsigned char rcvd_cookie[DTLS1_COOKIE_LENGTH]; + unsigned int cookie_len; + /* + * The current data and handshake epoch. This is initially + * undefined, and starts at zero once the initial handshake is + * completed + */ + unsigned short r_epoch; + unsigned short w_epoch; + /* records being received in the current epoch */ + DTLS1_BITMAP bitmap; + /* renegotiation starts a new set of sequence numbers */ + DTLS1_BITMAP next_bitmap; + /* handshake message numbers */ + unsigned short handshake_write_seq; + unsigned short next_handshake_write_seq; + unsigned short handshake_read_seq; + /* save last sequence number for retransmissions */ + unsigned char last_write_sequence[8]; + /* Received handshake records (processed and unprocessed) */ + record_pqueue unprocessed_rcds; + record_pqueue processed_rcds; + /* Buffered handshake messages */ + pqueue buffered_messages; + /* Buffered (sent) handshake records */ + pqueue sent_messages; + /* + * Buffered application records. Only for records between CCS and + * Finished to prevent either protocol violation or unnecessary message + * loss. + */ + record_pqueue buffered_app_data; + /* Is set when listening for new connections with dtls1_listen() */ + unsigned int listen; + unsigned int link_mtu; /* max on-the-wire DTLS packet size */ + unsigned int mtu; /* max DTLS packet size */ + struct hm_header_st w_msg_hdr; + struct hm_header_st r_msg_hdr; + struct dtls1_timeout_st timeout; + /* + * Indicates when the last handshake msg or heartbeat sent will timeout + */ + struct timeval next_timeout; + /* Timeout duration */ + unsigned short timeout_duration; + /* + * storage for Alert/Handshake protocol data received but not yet + * processed by ssl3_read_bytes: + */ + unsigned char alert_fragment[DTLS1_AL_HEADER_LENGTH]; + unsigned int alert_fragment_len; + unsigned char handshake_fragment[DTLS1_HM_HEADER_LENGTH]; + unsigned int handshake_fragment_len; + unsigned int retransmitting; + /* + * Set when the handshake is ready to process peer's ChangeCipherSpec message. + * Cleared after the message has been processed. + */ + unsigned int change_cipher_spec_ok; +#ifndef OPENSSL_NO_SCTP + /* used when SSL_ST_XX_FLUSH is entered */ + int next_state; + int shutdown_received; +#endif +} DTLS1_STATE; + +typedef struct dtls1_record_data_st { + unsigned char* packet; + unsigned int packet_length; + SSL3_BUFFER rbuf; + SSL3_RECORD rrec; +#ifndef OPENSSL_NO_SCTP + struct bio_dgram_sctp_rcvinfo recordinfo; +#endif +} DTLS1_RECORD_DATA; + +#endif + +/* Timeout multipliers (timeout slice is defined in apps/timeouts.h */ +#define DTLS1_TMO_READ_COUNT 2 +#define DTLS1_TMO_WRITE_COUNT 2 + +#define DTLS1_TMO_ALERT_COUNT 12 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/e_os2.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/e_os2.h new file mode 100644 index 0000000..3a441d5 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/e_os2.h @@ -0,0 +1,333 @@ +/* e_os2.h */ +/* ==================================================================== + * Copyright (c) 1998-2000 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#include + +#ifndef HEADER_E_OS2_H +#define HEADER_E_OS2_H + +#ifdef __cplusplus +extern "C" { +#endif + +/****************************************************************************** + * Detect operating systems. This probably needs completing. + * The result is that at least one OPENSSL_SYS_os macro should be defined. + * However, if none is defined, Unix is assumed. + **/ + +#define OPENSSL_SYS_UNIX + +/* ---------------------- Macintosh, before MacOS X ----------------------- */ +#if defined(__MWERKS__) && defined(macintosh) || defined(OPENSSL_SYSNAME_MAC) +#undef OPENSSL_SYS_UNIX +#define OPENSSL_SYS_MACINTOSH_CLASSIC +#endif + +/* ---------------------- NetWare ----------------------------------------- */ +#if defined(NETWARE) || defined(OPENSSL_SYSNAME_NETWARE) +#undef OPENSSL_SYS_UNIX +#define OPENSSL_SYS_NETWARE +#endif + +/* --------------------- Microsoft operating systems ---------------------- */ + +/* + * Note that MSDOS actually denotes 32-bit environments running on top of + * MS-DOS, such as DJGPP one. + */ +#if defined(OPENSSL_SYSNAME_MSDOS) +#undef OPENSSL_SYS_UNIX +#define OPENSSL_SYS_MSDOS +#endif + +/* + * For 32 bit environment, there seems to be the CygWin environment and then + * all the others that try to do the same thing Microsoft does... + */ +#if defined(OPENSSL_SYSNAME_UWIN) +#undef OPENSSL_SYS_UNIX +#define OPENSSL_SYS_WIN32_UWIN +#else +#if defined(__CYGWIN__) || defined(OPENSSL_SYSNAME_CYGWIN) +#undef OPENSSL_SYS_UNIX +#define OPENSSL_SYS_WIN32_CYGWIN +#else +#if defined(_WIN32) || defined(OPENSSL_SYSNAME_WIN32) +#undef OPENSSL_SYS_UNIX +#define OPENSSL_SYS_WIN32 +#endif +#if defined(_WIN64) || defined(OPENSSL_SYSNAME_WIN64) +#undef OPENSSL_SYS_UNIX +#if !defined(OPENSSL_SYS_WIN64) +#define OPENSSL_SYS_WIN64 +#endif +#endif +#if defined(OPENSSL_SYSNAME_WINNT) +#undef OPENSSL_SYS_UNIX +#define OPENSSL_SYS_WINNT +#endif +#if defined(OPENSSL_SYSNAME_WINCE) +#undef OPENSSL_SYS_UNIX +#define OPENSSL_SYS_WINCE +#endif +#endif +#endif + +/* Anything that tries to look like Microsoft is "Windows" */ +#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN64) || \ + defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE) +#undef OPENSSL_SYS_UNIX +#define OPENSSL_SYS_WINDOWS +#ifndef OPENSSL_SYS_MSDOS +#define OPENSSL_SYS_MSDOS +#endif +#endif + +/* + * DLL settings. This part is a bit tough, because it's up to the + * application implementor how he or she will link the application, so it + * requires some macro to be used. + */ +#ifdef OPENSSL_SYS_WINDOWS +#ifndef OPENSSL_OPT_WINDLL +#if defined(_WINDLL) /* This is used when building OpenSSL to \ + * indicate that DLL linkage should be used */ +#define OPENSSL_OPT_WINDLL +#endif +#endif +#endif + +/* ------------------------------- OpenVMS -------------------------------- */ +#if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYSNAME_VMS) +#undef OPENSSL_SYS_UNIX +#define OPENSSL_SYS_VMS +#if defined(__DECC) +#define OPENSSL_SYS_VMS_DECC +#elif defined(__DECCXX) +#define OPENSSL_SYS_VMS_DECC +#define OPENSSL_SYS_VMS_DECCXX +#else +#define OPENSSL_SYS_VMS_NODECC +#endif +#endif + +/* -------------------------------- OS/2 ---------------------------------- */ +#if defined(__EMX__) || defined(__OS2__) +#undef OPENSSL_SYS_UNIX +#define OPENSSL_SYS_OS2 +#endif + +/* -------------------------------- Unix ---------------------------------- */ +#ifdef OPENSSL_SYS_UNIX +#if defined(linux) || defined(__linux__) || defined(OPENSSL_SYSNAME_LINUX) +#define OPENSSL_SYS_LINUX +#endif +#ifdef OPENSSL_SYSNAME_MPE +#define OPENSSL_SYS_MPE +#endif +#ifdef OPENSSL_SYSNAME_SNI +#define OPENSSL_SYS_SNI +#endif +#ifdef OPENSSL_SYSNAME_ULTRASPARC +#define OPENSSL_SYS_ULTRASPARC +#endif +#ifdef OPENSSL_SYSNAME_NEWS4 +#define OPENSSL_SYS_NEWS4 +#endif +#ifdef OPENSSL_SYSNAME_MACOSX +#define OPENSSL_SYS_MACOSX +#endif +#ifdef OPENSSL_SYSNAME_MACOSX_RHAPSODY +#define OPENSSL_SYS_MACOSX_RHAPSODY +#define OPENSSL_SYS_MACOSX +#endif +#ifdef OPENSSL_SYSNAME_SUNOS +#define OPENSSL_SYS_SUNOS +#endif +#if defined(_CRAY) || defined(OPENSSL_SYSNAME_CRAY) +#define OPENSSL_SYS_CRAY +#endif +#if defined(_AIX) || defined(OPENSSL_SYSNAME_AIX) +#define OPENSSL_SYS_AIX +#endif +#endif + +/* -------------------------------- VOS ----------------------------------- */ +#if defined(__VOS__) || defined(OPENSSL_SYSNAME_VOS) +#define OPENSSL_SYS_VOS +#ifdef __HPPA__ +#define OPENSSL_SYS_VOS_HPPA +#endif +#ifdef __IA32__ +#define OPENSSL_SYS_VOS_IA32 +#endif +#endif + +/* ------------------------------ VxWorks --------------------------------- */ +#ifdef OPENSSL_SYSNAME_VXWORKS +#define OPENSSL_SYS_VXWORKS +#endif + +/* -------------------------------- BeOS ---------------------------------- */ +#if defined(__BEOS__) +#define OPENSSL_SYS_BEOS +#include +#if defined(BONE_VERSION) +#define OPENSSL_SYS_BEOS_BONE +#else +#define OPENSSL_SYS_BEOS_R5 +#endif +#endif + +/** + * That's it for OS-specific stuff + *****************************************************************************/ + +/* Specials for I/O an exit */ +#ifdef OPENSSL_SYS_MSDOS +#define OPENSSL_UNISTD_IO +#define OPENSSL_DECLARE_EXIT extern void exit(int); +#else +#define OPENSSL_UNISTD_IO OPENSSL_UNISTD +#define OPENSSL_DECLARE_EXIT /* declared in unistd.h */ +#endif + +/*- + * Definitions of OPENSSL_GLOBAL and OPENSSL_EXTERN, to define and declare + * certain global symbols that, with some compilers under VMS, have to be + * defined and declared explicitely with globaldef and globalref. + * Definitions of OPENSSL_EXPORT and OPENSSL_IMPORT, to define and declare + * DLL exports and imports for compilers under Win32. These are a little + * more complicated to use. Basically, for any library that exports some + * global variables, the following code must be present in the header file + * that declares them, before OPENSSL_EXTERN is used: + * + * #ifdef SOME_BUILD_FLAG_MACRO + * # undef OPENSSL_EXTERN + * # define OPENSSL_EXTERN OPENSSL_EXPORT + * #endif + * + * The default is to have OPENSSL_EXPORT, OPENSSL_IMPORT and OPENSSL_GLOBAL + * have some generally sensible values, and for OPENSSL_EXTERN to have the + * value OPENSSL_IMPORT. + */ + +#if defined(OPENSSL_SYS_VMS_NODECC) +#define OPENSSL_EXPORT globalref +#define OPENSSL_IMPORT globalref +#define OPENSSL_GLOBAL globaldef +#elif defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL) +#define OPENSSL_EXPORT extern __declspec(dllexport) +#define OPENSSL_IMPORT extern __declspec(dllimport) +#define OPENSSL_GLOBAL +#else +#define OPENSSL_EXPORT extern +#define OPENSSL_IMPORT extern +#define OPENSSL_GLOBAL +#endif +#define OPENSSL_EXTERN OPENSSL_IMPORT + +/*- + * Macros to allow global variables to be reached through function calls when + * required (if a shared library version requires it, for example. + * The way it's done allows definitions like this: + * + * // in foobar.c + * OPENSSL_IMPLEMENT_GLOBAL(int,foobar,0) + * // in foobar.h + * OPENSSL_DECLARE_GLOBAL(int,foobar); + * #define foobar OPENSSL_GLOBAL_REF(foobar) + */ +#ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION +#define OPENSSL_IMPLEMENT_GLOBAL(type, name, value) \ + type* _shadow_##name(void) { \ + static type _hide_##name = value; \ + return &_hide_##name; \ + } +#define OPENSSL_DECLARE_GLOBAL(type, name) type* _shadow_##name(void) +#define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name())) +#else +#define OPENSSL_IMPLEMENT_GLOBAL(type, name, value) \ + OPENSSL_GLOBAL type _shadow_##name = value; +#define OPENSSL_DECLARE_GLOBAL(type, name) OPENSSL_EXPORT type _shadow_##name +#define OPENSSL_GLOBAL_REF(name) _shadow_##name +#endif + +#if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) && macintosh == 1 && \ + !defined(MAC_OS_GUSI_SOURCE) +#define ossl_ssize_t long +#endif + +#ifdef OPENSSL_SYS_MSDOS +#define ossl_ssize_t long +#endif + +#if defined(NeXT) || defined(OPENSSL_SYS_NEWS4) || defined(OPENSSL_SYS_SUNOS) +#define ssize_t int +#endif + +#if defined(__ultrix) && !defined(ssize_t) +#define ossl_ssize_t int +#endif + +#ifndef ossl_ssize_t +#define ossl_ssize_t ssize_t +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ebcdic.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ebcdic.h new file mode 100644 index 0000000..7e5f3ab --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ebcdic.h @@ -0,0 +1,26 @@ +/* crypto/ebcdic.h */ + +#ifndef HEADER_EBCDIC_H +#define HEADER_EBCDIC_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Avoid name clashes with other applications */ +#define os_toascii _openssl_os_toascii +#define os_toebcdic _openssl_os_toebcdic +#define ebcdic2ascii _openssl_ebcdic2ascii +#define ascii2ebcdic _openssl_ascii2ebcdic + +extern const unsigned char os_toascii[256]; +extern const unsigned char os_toebcdic[256]; +void* ebcdic2ascii(void* dest, const void* srce, size_t count); +void* ascii2ebcdic(void* dest, const void* srce, size_t count); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ec.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ec.h new file mode 100644 index 0000000..faca8a4 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ec.h @@ -0,0 +1,1430 @@ +/* crypto/ec/ec.h */ +/* + * Originally written by Bodo Moeller for the OpenSSL project. + */ +/** + * \file crypto/ec/ec.h Include file for the OpenSSL EC functions + * \author Originally written by Bodo Moeller for the OpenSSL project + */ +/* ==================================================================== + * Copyright (c) 1998-2005 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * + * Portions of the attached software ("Contribution") are developed by + * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project. + * + * The Contribution is licensed pursuant to the OpenSSL open source + * license provided above. + * + * The elliptic curve binary polynomial software is originally written by + * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories. + * + */ + +#ifndef HEADER_EC_H +#define HEADER_EC_H + +#include + +#ifdef OPENSSL_NO_EC +#error EC is disabled. +#endif + +#include +#include +#ifndef OPENSSL_NO_DEPRECATED +#include +#endif + +#ifdef __cplusplus +extern "C" { +#elif defined(__SUNPRO_C) +#if __SUNPRO_C >= 0x520 +#pragma error_messages(off, E_ARRAY_OF_INCOMPLETE_NONAME, E_ARRAY_OF_INCOMPLETE) +#endif +#endif + +#ifndef OPENSSL_ECC_MAX_FIELD_BITS +#define OPENSSL_ECC_MAX_FIELD_BITS 661 +#endif + +/** Enum for the point conversion form as defined in X9.62 (ECDSA) + * for the encoding of a elliptic curve point (x,y) */ +typedef enum { + /** the point is encoded as z||x, where the octet z specifies + * which solution of the quadratic equation y is */ + POINT_CONVERSION_COMPRESSED = 2, + /** the point is encoded as z||x||y, where z is the octet 0x04 */ + POINT_CONVERSION_UNCOMPRESSED = 4, + /** the point is encoded as z||x||y, where the octet z specifies + * which solution of the quadratic equation y is */ + POINT_CONVERSION_HYBRID = 6 +} point_conversion_form_t; + +typedef struct ec_method_st EC_METHOD; + +typedef struct ec_group_st + /*- + EC_METHOD *meth; + -- field definition + -- curve coefficients + -- optional generator with associated information (order, cofactor) + -- optional extra data (precomputed table for fast computation of multiples + of generator) + -- ASN1 stuff + */ + EC_GROUP; + +typedef struct ec_point_st EC_POINT; + +/********************************************************************/ +/* EC_METHODs for curves over GF(p) */ +/********************************************************************/ + +/** Returns the basic GFp ec methods which provides the basis for the + * optimized methods. + * \return EC_METHOD object + */ +const EC_METHOD* EC_GFp_simple_method(void); + +/** Returns GFp methods using montgomery multiplication. + * \return EC_METHOD object + */ +const EC_METHOD* EC_GFp_mont_method(void); + +/** Returns GFp methods using optimized methods for NIST recommended curves + * \return EC_METHOD object + */ +const EC_METHOD* EC_GFp_nist_method(void); + +#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 +/** Returns 64-bit optimized methods for nistp224 + * \return EC_METHOD object + */ +const EC_METHOD* EC_GFp_nistp224_method(void); + +/** Returns 64-bit optimized methods for nistp256 + * \return EC_METHOD object + */ +const EC_METHOD* EC_GFp_nistp256_method(void); + +/** Returns 64-bit optimized methods for nistp521 + * \return EC_METHOD object + */ +const EC_METHOD* EC_GFp_nistp521_method(void); +#endif + +#ifndef OPENSSL_NO_EC2M +/********************************************************************/ +/* EC_METHOD for curves over GF(2^m) */ +/********************************************************************/ + +/** Returns the basic GF2m ec method + * \return EC_METHOD object + */ +const EC_METHOD* EC_GF2m_simple_method(void); + +#endif + +/********************************************************************/ +/* EC_GROUP functions */ +/********************************************************************/ + +/** Creates a new EC_GROUP object + * \param meth EC_METHOD to use + * \return newly created EC_GROUP object or NULL in case of an error. + */ +EC_GROUP* EC_GROUP_new(const EC_METHOD* meth); + +/** Frees a EC_GROUP object + * \param group EC_GROUP object to be freed. + */ +void EC_GROUP_free(EC_GROUP* group); + +/** Clears and frees a EC_GROUP object + * \param group EC_GROUP object to be cleared and freed. + */ +void EC_GROUP_clear_free(EC_GROUP* group); + +/** Copies EC_GROUP objects. Note: both EC_GROUPs must use the same EC_METHOD. + * \param dst destination EC_GROUP object + * \param src source EC_GROUP object + * \return 1 on success and 0 if an error occurred. + */ +int EC_GROUP_copy(EC_GROUP* dst, const EC_GROUP* src); + +/** Creates a new EC_GROUP object and copies the copies the content + * form src to the newly created EC_KEY object + * \param src source EC_GROUP object + * \return newly created EC_GROUP object or NULL in case of an error. + */ +EC_GROUP* EC_GROUP_dup(const EC_GROUP* src); + +/** Returns the EC_METHOD of the EC_GROUP object. + * \param group EC_GROUP object + * \return EC_METHOD used in this EC_GROUP object. + */ +const EC_METHOD* EC_GROUP_method_of(const EC_GROUP* group); + +/** Returns the field type of the EC_METHOD. + * \param meth EC_METHOD object + * \return NID of the underlying field type OID. + */ +int EC_METHOD_get_field_type(const EC_METHOD* meth); + +/** Sets the generator and it's order/cofactor of a EC_GROUP object. + * \param group EC_GROUP object + * \param generator EC_POINT object with the generator. + * \param order the order of the group generated by the generator. + * \param cofactor the index of the sub-group generated by the generator + * in the group of all points on the elliptic curve. + * \return 1 on success and 0 if an error occured + */ +int EC_GROUP_set_generator( + EC_GROUP* group, + const EC_POINT* generator, + const BIGNUM* order, + const BIGNUM* cofactor); + +/** Returns the generator of a EC_GROUP object. + * \param group EC_GROUP object + * \return the currently used generator (possibly NULL). + */ +const EC_POINT* EC_GROUP_get0_generator(const EC_GROUP* group); + +/** Returns the montgomery data for order(Generator) + * \param group EC_GROUP object + * \return the currently used generator (possibly NULL). +*/ +BN_MONT_CTX* EC_GROUP_get_mont_data(const EC_GROUP* group); + +/** Gets the order of a EC_GROUP + * \param group EC_GROUP object + * \param order BIGNUM to which the order is copied + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occured + */ +int EC_GROUP_get_order(const EC_GROUP* group, BIGNUM* order, BN_CTX* ctx); + +/** Gets the cofactor of a EC_GROUP + * \param group EC_GROUP object + * \param cofactor BIGNUM to which the cofactor is copied + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occured + */ +int EC_GROUP_get_cofactor(const EC_GROUP* group, BIGNUM* cofactor, BN_CTX* ctx); + +/** Sets the name of a EC_GROUP object + * \param group EC_GROUP object + * \param nid NID of the curve name OID + */ +void EC_GROUP_set_curve_name(EC_GROUP* group, int nid); + +/** Returns the curve name of a EC_GROUP object + * \param group EC_GROUP object + * \return NID of the curve name OID or 0 if not set. + */ +int EC_GROUP_get_curve_name(const EC_GROUP* group); + +void EC_GROUP_set_asn1_flag(EC_GROUP* group, int flag); +int EC_GROUP_get_asn1_flag(const EC_GROUP* group); + +void EC_GROUP_set_point_conversion_form( + EC_GROUP* group, + point_conversion_form_t form); +point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP*); + +unsigned char* EC_GROUP_get0_seed(const EC_GROUP* x); +size_t EC_GROUP_get_seed_len(const EC_GROUP*); +size_t EC_GROUP_set_seed(EC_GROUP*, const unsigned char*, size_t len); + +/** Sets the parameter of a ec over GFp defined by y^2 = x^3 + a*x + b + * \param group EC_GROUP object + * \param p BIGNUM with the prime number + * \param a BIGNUM with parameter a of the equation + * \param b BIGNUM with parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occured + */ +int EC_GROUP_set_curve_GFp( + EC_GROUP* group, + const BIGNUM* p, + const BIGNUM* a, + const BIGNUM* b, + BN_CTX* ctx); + +/** Gets the parameter of the ec over GFp defined by y^2 = x^3 + a*x + b + * \param group EC_GROUP object + * \param p BIGNUM for the prime number + * \param a BIGNUM for parameter a of the equation + * \param b BIGNUM for parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occured + */ +int EC_GROUP_get_curve_GFp( + const EC_GROUP* group, + BIGNUM* p, + BIGNUM* a, + BIGNUM* b, + BN_CTX* ctx); + +#ifndef OPENSSL_NO_EC2M +/** Sets the parameter of a ec over GF2m defined by y^2 + x*y = x^3 + a*x^2 + b + * \param group EC_GROUP object + * \param p BIGNUM with the polynomial defining the underlying field + * \param a BIGNUM with parameter a of the equation + * \param b BIGNUM with parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occured + */ +int EC_GROUP_set_curve_GF2m( + EC_GROUP* group, + const BIGNUM* p, + const BIGNUM* a, + const BIGNUM* b, + BN_CTX* ctx); + +/** Gets the parameter of the ec over GF2m defined by y^2 + x*y = x^3 + a*x^2 + + * b + * \param group EC_GROUP object + * \param p BIGNUM for the polynomial defining the underlying field + * \param a BIGNUM for parameter a of the equation + * \param b BIGNUM for parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occured + */ +int EC_GROUP_get_curve_GF2m( + const EC_GROUP* group, + BIGNUM* p, + BIGNUM* a, + BIGNUM* b, + BN_CTX* ctx); +#endif +/** Returns the number of bits needed to represent a field element + * \param group EC_GROUP object + * \return number of bits needed to represent a field element + */ +int EC_GROUP_get_degree(const EC_GROUP* group); + +/** Checks whether the parameter in the EC_GROUP define a valid ec group + * \param group EC_GROUP object + * \param ctx BN_CTX object (optional) + * \return 1 if group is a valid ec group and 0 otherwise + */ +int EC_GROUP_check(const EC_GROUP* group, BN_CTX* ctx); + +/** Checks whether the discriminant of the elliptic curve is zero or not + * \param group EC_GROUP object + * \param ctx BN_CTX object (optional) + * \return 1 if the discriminant is not zero and 0 otherwise + */ +int EC_GROUP_check_discriminant(const EC_GROUP* group, BN_CTX* ctx); + +/** Compares two EC_GROUP objects + * \param a first EC_GROUP object + * \param b second EC_GROUP object + * \param ctx BN_CTX object (optional) + * \return 0 if both groups are equal and 1 otherwise + */ +int EC_GROUP_cmp(const EC_GROUP* a, const EC_GROUP* b, BN_CTX* ctx); + +/* + * EC_GROUP_new_GF*() calls EC_GROUP_new() and EC_GROUP_set_GF*() after + * choosing an appropriate EC_METHOD + */ + +/** Creates a new EC_GROUP object with the specified parameters defined + * over GFp (defined by the equation y^2 = x^3 + a*x + b) + * \param p BIGNUM with the prime number + * \param a BIGNUM with the parameter a of the equation + * \param b BIGNUM with the parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return newly created EC_GROUP object with the specified parameters + */ +EC_GROUP* EC_GROUP_new_curve_GFp( + const BIGNUM* p, + const BIGNUM* a, + const BIGNUM* b, + BN_CTX* ctx); +#ifndef OPENSSL_NO_EC2M +/** Creates a new EC_GROUP object with the specified parameters defined + * over GF2m (defined by the equation y^2 + x*y = x^3 + a*x^2 + b) + * \param p BIGNUM with the polynomial defining the underlying field + * \param a BIGNUM with the parameter a of the equation + * \param b BIGNUM with the parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return newly created EC_GROUP object with the specified parameters + */ +EC_GROUP* EC_GROUP_new_curve_GF2m( + const BIGNUM* p, + const BIGNUM* a, + const BIGNUM* b, + BN_CTX* ctx); +#endif +/** Creates a EC_GROUP object with a curve specified by a NID + * \param nid NID of the OID of the curve name + * \return newly created EC_GROUP object with specified curve or NULL + * if an error occurred + */ +EC_GROUP* EC_GROUP_new_by_curve_name(int nid); + +/********************************************************************/ +/* handling of internal curves */ +/********************************************************************/ + +typedef struct { + int nid; + const char* comment; +} EC_builtin_curve; + +/* + * EC_builtin_curves(EC_builtin_curve *r, size_t size) returns number of all + * available curves or zero if a error occurred. In case r ist not zero + * nitems EC_builtin_curve structures are filled with the data of the first + * nitems internal groups + */ +size_t EC_get_builtin_curves(EC_builtin_curve* r, size_t nitems); + +const char* EC_curve_nid2nist(int nid); +int EC_curve_nist2nid(const char* name); + +/********************************************************************/ +/* EC_POINT functions */ +/********************************************************************/ + +/** Creates a new EC_POINT object for the specified EC_GROUP + * \param group EC_GROUP the underlying EC_GROUP object + * \return newly created EC_POINT object or NULL if an error occurred + */ +EC_POINT* EC_POINT_new(const EC_GROUP* group); + +/** Frees a EC_POINT object + * \param point EC_POINT object to be freed + */ +void EC_POINT_free(EC_POINT* point); + +/** Clears and frees a EC_POINT object + * \param point EC_POINT object to be cleared and freed + */ +void EC_POINT_clear_free(EC_POINT* point); + +/** Copies EC_POINT object + * \param dst destination EC_POINT object + * \param src source EC_POINT object + * \return 1 on success and 0 if an error occured + */ +int EC_POINT_copy(EC_POINT* dst, const EC_POINT* src); + +/** Creates a new EC_POINT object and copies the content of the supplied + * EC_POINT + * \param src source EC_POINT object + * \param group underlying the EC_GROUP object + * \return newly created EC_POINT object or NULL if an error occurred + */ +EC_POINT* EC_POINT_dup(const EC_POINT* src, const EC_GROUP* group); + +/** Returns the EC_METHOD used in EC_POINT object + * \param point EC_POINT object + * \return the EC_METHOD used + */ +const EC_METHOD* EC_POINT_method_of(const EC_POINT* point); + +/** Sets a point to infinity (neutral element) + * \param group underlying EC_GROUP object + * \param point EC_POINT to set to infinity + * \return 1 on success and 0 if an error occured + */ +int EC_POINT_set_to_infinity(const EC_GROUP* group, EC_POINT* point); + +/** Sets the jacobian projective coordinates of a EC_POINT over GFp + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with the x-coordinate + * \param y BIGNUM with the y-coordinate + * \param z BIGNUM with the z-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occured + */ +int EC_POINT_set_Jprojective_coordinates_GFp( + const EC_GROUP* group, + EC_POINT* p, + const BIGNUM* x, + const BIGNUM* y, + const BIGNUM* z, + BN_CTX* ctx); + +/** Gets the jacobian projective coordinates of a EC_POINT over GFp + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM for the x-coordinate + * \param y BIGNUM for the y-coordinate + * \param z BIGNUM for the z-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occured + */ +int EC_POINT_get_Jprojective_coordinates_GFp( + const EC_GROUP* group, + const EC_POINT* p, + BIGNUM* x, + BIGNUM* y, + BIGNUM* z, + BN_CTX* ctx); + +/** Sets the affine coordinates of a EC_POINT over GFp + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with the x-coordinate + * \param y BIGNUM with the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occured + */ +int EC_POINT_set_affine_coordinates_GFp( + const EC_GROUP* group, + EC_POINT* p, + const BIGNUM* x, + const BIGNUM* y, + BN_CTX* ctx); + +/** Gets the affine coordinates of a EC_POINT over GFp + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM for the x-coordinate + * \param y BIGNUM for the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occured + */ +int EC_POINT_get_affine_coordinates_GFp( + const EC_GROUP* group, + const EC_POINT* p, + BIGNUM* x, + BIGNUM* y, + BN_CTX* ctx); + +/** Sets the x9.62 compressed coordinates of a EC_POINT over GFp + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with x-coordinate + * \param y_bit integer with the y-Bit (either 0 or 1) + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occured + */ +int EC_POINT_set_compressed_coordinates_GFp( + const EC_GROUP* group, + EC_POINT* p, + const BIGNUM* x, + int y_bit, + BN_CTX* ctx); +#ifndef OPENSSL_NO_EC2M +/** Sets the affine coordinates of a EC_POINT over GF2m + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with the x-coordinate + * \param y BIGNUM with the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occured + */ +int EC_POINT_set_affine_coordinates_GF2m( + const EC_GROUP* group, + EC_POINT* p, + const BIGNUM* x, + const BIGNUM* y, + BN_CTX* ctx); + +/** Gets the affine coordinates of a EC_POINT over GF2m + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM for the x-coordinate + * \param y BIGNUM for the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occured + */ +int EC_POINT_get_affine_coordinates_GF2m( + const EC_GROUP* group, + const EC_POINT* p, + BIGNUM* x, + BIGNUM* y, + BN_CTX* ctx); + +/** Sets the x9.62 compressed coordinates of a EC_POINT over GF2m + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with x-coordinate + * \param y_bit integer with the y-Bit (either 0 or 1) + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occured + */ +int EC_POINT_set_compressed_coordinates_GF2m( + const EC_GROUP* group, + EC_POINT* p, + const BIGNUM* x, + int y_bit, + BN_CTX* ctx); +#endif +/** Encodes a EC_POINT object to a octet string + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param form point conversion form + * \param buf memory buffer for the result. If NULL the function returns + * required buffer size. + * \param len length of the memory buffer + * \param ctx BN_CTX object (optional) + * \return the length of the encoded octet string or 0 if an error occurred + */ +size_t EC_POINT_point2oct( + const EC_GROUP* group, + const EC_POINT* p, + point_conversion_form_t form, + unsigned char* buf, + size_t len, + BN_CTX* ctx); + +/** Decodes a EC_POINT from a octet string + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param buf memory buffer with the encoded ec point + * \param len length of the encoded ec point + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occured + */ +int EC_POINT_oct2point( + const EC_GROUP* group, + EC_POINT* p, + const unsigned char* buf, + size_t len, + BN_CTX* ctx); + +/* other interfaces to point2oct/oct2point: */ +BIGNUM* EC_POINT_point2bn( + const EC_GROUP*, + const EC_POINT*, + point_conversion_form_t form, + BIGNUM*, + BN_CTX*); +EC_POINT* EC_POINT_bn2point(const EC_GROUP*, const BIGNUM*, EC_POINT*, BN_CTX*); +char* EC_POINT_point2hex( + const EC_GROUP*, + const EC_POINT*, + point_conversion_form_t form, + BN_CTX*); +EC_POINT* EC_POINT_hex2point(const EC_GROUP*, const char*, EC_POINT*, BN_CTX*); + +/********************************************************************/ +/* functions for doing EC_POINT arithmetic */ +/********************************************************************/ + +/** Computes the sum of two EC_POINT + * \param group underlying EC_GROUP object + * \param r EC_POINT object for the result (r = a + b) + * \param a EC_POINT object with the first summand + * \param b EC_POINT object with the second summand + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occured + */ +int EC_POINT_add( + const EC_GROUP* group, + EC_POINT* r, + const EC_POINT* a, + const EC_POINT* b, + BN_CTX* ctx); + +/** Computes the double of a EC_POINT + * \param group underlying EC_GROUP object + * \param r EC_POINT object for the result (r = 2 * a) + * \param a EC_POINT object + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occured + */ +int EC_POINT_dbl( + const EC_GROUP* group, + EC_POINT* r, + const EC_POINT* a, + BN_CTX* ctx); + +/** Computes the inverse of a EC_POINT + * \param group underlying EC_GROUP object + * \param a EC_POINT object to be inverted (it's used for the result as + * well) + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occured + */ +int EC_POINT_invert(const EC_GROUP* group, EC_POINT* a, BN_CTX* ctx); + +/** Checks whether the point is the neutral element of the group + * \param group the underlying EC_GROUP object + * \param p EC_POINT object + * \return 1 if the point is the neutral element and 0 otherwise + */ +int EC_POINT_is_at_infinity(const EC_GROUP* group, const EC_POINT* p); + +/** Checks whether the point is on the curve + * \param group underlying EC_GROUP object + * \param point EC_POINT object to check + * \param ctx BN_CTX object (optional) + * \return 1 if point if on the curve and 0 otherwise + */ +int EC_POINT_is_on_curve( + const EC_GROUP* group, + const EC_POINT* point, + BN_CTX* ctx); + +/** Compares two EC_POINTs + * \param group underlying EC_GROUP object + * \param a first EC_POINT object + * \param b second EC_POINT object + * \param ctx BN_CTX object (optional) + * \return 0 if both points are equal and a value != 0 otherwise + */ +int EC_POINT_cmp( + const EC_GROUP* group, + const EC_POINT* a, + const EC_POINT* b, + BN_CTX* ctx); + +int EC_POINT_make_affine(const EC_GROUP* group, EC_POINT* point, BN_CTX* ctx); +int EC_POINTs_make_affine( + const EC_GROUP* group, + size_t num, + EC_POINT* points[], + BN_CTX* ctx); + +/** Computes r = generator * n sum_{i=0}^{num-1} p[i] * m[i] + * \param group underlying EC_GROUP object + * \param r EC_POINT object for the result + * \param n BIGNUM with the multiplier for the group generator (optional) + * \param num number futher summands + * \param p array of size num of EC_POINT objects + * \param m array of size num of BIGNUM objects + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occured + */ +int EC_POINTs_mul( + const EC_GROUP* group, + EC_POINT* r, + const BIGNUM* n, + size_t num, + const EC_POINT* p[], + const BIGNUM* m[], + BN_CTX* ctx); + +/** Computes r = generator * n + q * m + * \param group underlying EC_GROUP object + * \param r EC_POINT object for the result + * \param n BIGNUM with the multiplier for the group generator (optional) + * \param q EC_POINT object with the first factor of the second summand + * \param m BIGNUM with the second factor of the second summand + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occured + */ +int EC_POINT_mul( + const EC_GROUP* group, + EC_POINT* r, + const BIGNUM* n, + const EC_POINT* q, + const BIGNUM* m, + BN_CTX* ctx); + +/** Stores multiples of generator for faster point multiplication + * \param group EC_GROUP object + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occured + */ +int EC_GROUP_precompute_mult(EC_GROUP* group, BN_CTX* ctx); + +/** Reports whether a precomputation has been done + * \param group EC_GROUP object + * \return 1 if a pre-computation has been done and 0 otherwise + */ +int EC_GROUP_have_precompute_mult(const EC_GROUP* group); + +/********************************************************************/ +/* ASN1 stuff */ +/********************************************************************/ + +/* + * EC_GROUP_get_basis_type() returns the NID of the basis type used to + * represent the field elements + */ +int EC_GROUP_get_basis_type(const EC_GROUP*); +#ifndef OPENSSL_NO_EC2M +int EC_GROUP_get_trinomial_basis(const EC_GROUP*, unsigned int* k); +int EC_GROUP_get_pentanomial_basis( + const EC_GROUP*, + unsigned int* k1, + unsigned int* k2, + unsigned int* k3); +#endif + +#define OPENSSL_EC_NAMED_CURVE 0x001 + +typedef struct ecpk_parameters_st ECPKPARAMETERS; + +EC_GROUP* d2i_ECPKParameters(EC_GROUP**, const unsigned char** in, long len); +int i2d_ECPKParameters(const EC_GROUP*, unsigned char** out); + +#define d2i_ECPKParameters_bio(bp, x) \ + ASN1_d2i_bio_of(EC_GROUP, NULL, d2i_ECPKParameters, bp, x) +#define i2d_ECPKParameters_bio(bp, x) \ + ASN1_i2d_bio_of_const(EC_GROUP, i2d_ECPKParameters, bp, x) +#define d2i_ECPKParameters_fp(fp, x) \ + (EC_GROUP*)ASN1_d2i_fp( \ + NULL, (char* (*)())d2i_ECPKParameters, (fp), (unsigned char**)(x)) +#define i2d_ECPKParameters_fp(fp, x) \ + ASN1_i2d_fp(i2d_ECPKParameters, (fp), (unsigned char*)(x)) + +#ifndef OPENSSL_NO_BIO +int ECPKParameters_print(BIO* bp, const EC_GROUP* x, int off); +#endif +#ifndef OPENSSL_NO_FP_API +int ECPKParameters_print_fp(FILE* fp, const EC_GROUP* x, int off); +#endif + +/********************************************************************/ +/* EC_KEY functions */ +/********************************************************************/ + +typedef struct ec_key_st EC_KEY; + +/* some values for the encoding_flag */ +#define EC_PKEY_NO_PARAMETERS 0x001 +#define EC_PKEY_NO_PUBKEY 0x002 + +/* some values for the flags field */ +#define EC_FLAG_NON_FIPS_ALLOW 0x1 +#define EC_FLAG_FIPS_CHECKED 0x2 + +/** Creates a new EC_KEY object. + * \return EC_KEY object or NULL if an error occurred. + */ +EC_KEY* EC_KEY_new(void); + +int EC_KEY_get_flags(const EC_KEY* key); + +void EC_KEY_set_flags(EC_KEY* key, int flags); + +void EC_KEY_clear_flags(EC_KEY* key, int flags); + +/** Creates a new EC_KEY object using a named curve as underlying + * EC_GROUP object. + * \param nid NID of the named curve. + * \return EC_KEY object or NULL if an error occurred. + */ +EC_KEY* EC_KEY_new_by_curve_name(int nid); + +/** Frees a EC_KEY object. + * \param key EC_KEY object to be freed. + */ +void EC_KEY_free(EC_KEY* key); + +/** Copies a EC_KEY object. + * \param dst destination EC_KEY object + * \param src src EC_KEY object + * \return dst or NULL if an error occurred. + */ +EC_KEY* EC_KEY_copy(EC_KEY* dst, const EC_KEY* src); + +/** Creates a new EC_KEY object and copies the content from src to it. + * \param src the source EC_KEY object + * \return newly created EC_KEY object or NULL if an error occurred. + */ +EC_KEY* EC_KEY_dup(const EC_KEY* src); + +/** Increases the internal reference count of a EC_KEY object. + * \param key EC_KEY object + * \return 1 on success and 0 if an error occurred. + */ +int EC_KEY_up_ref(EC_KEY* key); + +/** Returns the EC_GROUP object of a EC_KEY object + * \param key EC_KEY object + * \return the EC_GROUP object (possibly NULL). + */ +const EC_GROUP* EC_KEY_get0_group(const EC_KEY* key); + +/** Sets the EC_GROUP of a EC_KEY object. + * \param key EC_KEY object + * \param group EC_GROUP to use in the EC_KEY object (note: the EC_KEY + * object will use an own copy of the EC_GROUP). + * \return 1 on success and 0 if an error occurred. + */ +int EC_KEY_set_group(EC_KEY* key, const EC_GROUP* group); + +/** Returns the private key of a EC_KEY object. + * \param key EC_KEY object + * \return a BIGNUM with the private key (possibly NULL). + */ +const BIGNUM* EC_KEY_get0_private_key(const EC_KEY* key); + +/** Sets the private key of a EC_KEY object. + * \param key EC_KEY object + * \param prv BIGNUM with the private key (note: the EC_KEY object + * will use an own copy of the BIGNUM). + * \return 1 on success and 0 if an error occurred. + */ +int EC_KEY_set_private_key(EC_KEY* key, const BIGNUM* prv); + +/** Returns the public key of a EC_KEY object. + * \param key the EC_KEY object + * \return a EC_POINT object with the public key (possibly NULL) + */ +const EC_POINT* EC_KEY_get0_public_key(const EC_KEY* key); + +/** Sets the public key of a EC_KEY object. + * \param key EC_KEY object + * \param pub EC_POINT object with the public key (note: the EC_KEY object + * will use an own copy of the EC_POINT object). + * \return 1 on success and 0 if an error occurred. + */ +int EC_KEY_set_public_key(EC_KEY* key, const EC_POINT* pub); + +unsigned EC_KEY_get_enc_flags(const EC_KEY* key); +void EC_KEY_set_enc_flags(EC_KEY* eckey, unsigned int flags); +point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY* key); +void EC_KEY_set_conv_form(EC_KEY* eckey, point_conversion_form_t cform); +/* functions to set/get method specific data */ +void* EC_KEY_get_key_method_data( + EC_KEY* key, + void* (*dup_func)(void*), + void (*free_func)(void*), + void (*clear_free_func)(void*)); +/** Sets the key method data of an EC_KEY object, if none has yet been set. + * \param key EC_KEY object + * \param data opaque data to install. + * \param dup_func a function that duplicates |data|. + * \param free_func a function that frees |data|. + * \param clear_free_func a function that wipes and frees |data|. + * \return the previously set data pointer, or NULL if |data| was inserted. + */ +void* EC_KEY_insert_key_method_data( + EC_KEY* key, + void* data, + void* (*dup_func)(void*), + void (*free_func)(void*), + void (*clear_free_func)(void*)); +/* wrapper functions for the underlying EC_GROUP object */ +void EC_KEY_set_asn1_flag(EC_KEY* eckey, int asn1_flag); + +/** Creates a table of pre-computed multiples of the generator to + * accelerate further EC_KEY operations. + * \param key EC_KEY object + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred. + */ +int EC_KEY_precompute_mult(EC_KEY* key, BN_CTX* ctx); + +/** Creates a new ec private (and optional a new public) key. + * \param key EC_KEY object + * \return 1 on success and 0 if an error occurred. + */ +int EC_KEY_generate_key(EC_KEY* key); + +/** Verifies that a private and/or public key is valid. + * \param key the EC_KEY object + * \return 1 on success and 0 otherwise. + */ +int EC_KEY_check_key(const EC_KEY* key); + +/** Sets a public key from affine coordindates performing + * neccessary NIST PKV tests. + * \param key the EC_KEY object + * \param x public key x coordinate + * \param y public key y coordinate + * \return 1 on success and 0 otherwise. + */ +int EC_KEY_set_public_key_affine_coordinates(EC_KEY* key, BIGNUM* x, BIGNUM* y); + +/********************************************************************/ +/* de- and encoding functions for SEC1 ECPrivateKey */ +/********************************************************************/ + +/** Decodes a private key from a memory buffer. + * \param key a pointer to a EC_KEY object which should be used (or NULL) + * \param in pointer to memory with the DER encoded private key + * \param len length of the DER encoded private key + * \return the decoded private key or NULL if an error occurred. + */ +EC_KEY* d2i_ECPrivateKey(EC_KEY** key, const unsigned char** in, long len); + +/** Encodes a private key object and stores the result in a buffer. + * \param key the EC_KEY object to encode + * \param out the buffer for the result (if NULL the function returns number + * of bytes needed). + * \return 1 on success and 0 if an error occurred. + */ +int i2d_ECPrivateKey(EC_KEY* key, unsigned char** out); + +/********************************************************************/ +/* de- and encoding functions for EC parameters */ +/********************************************************************/ + +/** Decodes ec parameter from a memory buffer. + * \param key a pointer to a EC_KEY object which should be used (or NULL) + * \param in pointer to memory with the DER encoded ec parameters + * \param len length of the DER encoded ec parameters + * \return a EC_KEY object with the decoded parameters or NULL if an error + * occurred. + */ +EC_KEY* d2i_ECParameters(EC_KEY** key, const unsigned char** in, long len); + +/** Encodes ec parameter and stores the result in a buffer. + * \param key the EC_KEY object with ec paramters to encode + * \param out the buffer for the result (if NULL the function returns number + * of bytes needed). + * \return 1 on success and 0 if an error occurred. + */ +int i2d_ECParameters(EC_KEY* key, unsigned char** out); + +/********************************************************************/ +/* de- and encoding functions for EC public key */ +/* (octet string, not DER -- hence 'o2i' and 'i2o') */ +/********************************************************************/ + +/** Decodes a ec public key from a octet string. + * \param key a pointer to a EC_KEY object which should be used + * \param in memory buffer with the encoded public key + * \param len length of the encoded public key + * \return EC_KEY object with decoded public key or NULL if an error + * occurred. + */ +EC_KEY* o2i_ECPublicKey(EC_KEY** key, const unsigned char** in, long len); + +/** Encodes a ec public key in an octet string. + * \param key the EC_KEY object with the public key + * \param out the buffer for the result (if NULL the function returns number + * of bytes needed). + * \return 1 on success and 0 if an error occurred + */ +int i2o_ECPublicKey(EC_KEY* key, unsigned char** out); + +#ifndef OPENSSL_NO_BIO +/** Prints out the ec parameters on human readable form. + * \param bp BIO object to which the information is printed + * \param key EC_KEY object + * \return 1 on success and 0 if an error occurred + */ +int ECParameters_print(BIO* bp, const EC_KEY* key); + +/** Prints out the contents of a EC_KEY object + * \param bp BIO object to which the information is printed + * \param key EC_KEY object + * \param off line offset + * \return 1 on success and 0 if an error occurred + */ +int EC_KEY_print(BIO* bp, const EC_KEY* key, int off); + +#endif +#ifndef OPENSSL_NO_FP_API +/** Prints out the ec parameters on human readable form. + * \param fp file descriptor to which the information is printed + * \param key EC_KEY object + * \return 1 on success and 0 if an error occurred + */ +int ECParameters_print_fp(FILE* fp, const EC_KEY* key); + +/** Prints out the contents of a EC_KEY object + * \param fp file descriptor to which the information is printed + * \param key EC_KEY object + * \param off line offset + * \return 1 on success and 0 if an error occurred + */ +int EC_KEY_print_fp(FILE* fp, const EC_KEY* key, int off); + +#endif + +#define ECParameters_dup(x) \ + ASN1_dup_of(EC_KEY, i2d_ECParameters, d2i_ECParameters, x) + +#ifndef __cplusplus +#if defined(__SUNPRO_C) +#if __SUNPRO_C >= 0x520 +#pragma error_messages( \ + default, E_ARRAY_OF_INCOMPLETE_NONAME, E_ARRAY_OF_INCOMPLETE) +#endif +#endif +#endif + +#define EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, nid) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_EC, \ + EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID, \ + nid, \ + NULL) + +#define EVP_PKEY_CTX_set_ec_param_enc(ctx, flag) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_EC, \ + EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_EC_PARAM_ENC, \ + flag, \ + NULL) + +#define EVP_PKEY_CTX_set_ecdh_cofactor_mode(ctx, flag) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_ECDH_COFACTOR, \ + flag, \ + NULL) + +#define EVP_PKEY_CTX_get_ecdh_cofactor_mode(ctx) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_ECDH_COFACTOR, \ + -2, \ + NULL) + +#define EVP_PKEY_CTX_set_ecdh_kdf_type(ctx, kdf) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_KDF_TYPE, \ + kdf, \ + NULL) + +#define EVP_PKEY_CTX_get_ecdh_kdf_type(ctx) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_KDF_TYPE, \ + -2, \ + NULL) + +#define EVP_PKEY_CTX_set_ecdh_kdf_md(ctx, md) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_KDF_MD, \ + 0, \ + (void*)md) + +#define EVP_PKEY_CTX_get_ecdh_kdf_md(ctx, pmd) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_EC_KDF_MD, \ + 0, \ + (void*)pmd) + +#define EVP_PKEY_CTX_set_ecdh_kdf_outlen(ctx, len) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_KDF_OUTLEN, \ + len, \ + NULL) + +#define EVP_PKEY_CTX_get_ecdh_kdf_outlen(ctx, plen) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_EC_KDF_OUTLEN, \ + 0, \ + (void*)plen) + +#define EVP_PKEY_CTX_set0_ecdh_kdf_ukm(ctx, p, plen) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_KDF_UKM, \ + plen, \ + (void*)p) + +#define EVP_PKEY_CTX_get0_ecdh_kdf_ukm(ctx, p) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_EC_KDF_UKM, \ + 0, \ + (void*)p) + +#define EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID (EVP_PKEY_ALG_CTRL + 1) +#define EVP_PKEY_CTRL_EC_PARAM_ENC (EVP_PKEY_ALG_CTRL + 2) +#define EVP_PKEY_CTRL_EC_ECDH_COFACTOR (EVP_PKEY_ALG_CTRL + 3) +#define EVP_PKEY_CTRL_EC_KDF_TYPE (EVP_PKEY_ALG_CTRL + 4) +#define EVP_PKEY_CTRL_EC_KDF_MD (EVP_PKEY_ALG_CTRL + 5) +#define EVP_PKEY_CTRL_GET_EC_KDF_MD (EVP_PKEY_ALG_CTRL + 6) +#define EVP_PKEY_CTRL_EC_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 7) +#define EVP_PKEY_CTRL_GET_EC_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 8) +#define EVP_PKEY_CTRL_EC_KDF_UKM (EVP_PKEY_ALG_CTRL + 9) +#define EVP_PKEY_CTRL_GET_EC_KDF_UKM (EVP_PKEY_ALG_CTRL + 10) +/* KDF types */ +#define EVP_PKEY_ECDH_KDF_NONE 1 +#define EVP_PKEY_ECDH_KDF_X9_62 2 + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_EC_strings(void); + +/* Error codes for the EC functions. */ + +/* Function codes. */ +#define EC_F_BN_TO_FELEM 224 +#define EC_F_COMPUTE_WNAF 143 +#define EC_F_D2I_ECPARAMETERS 144 +#define EC_F_D2I_ECPKPARAMETERS 145 +#define EC_F_D2I_ECPRIVATEKEY 146 +#define EC_F_DO_EC_KEY_PRINT 221 +#define EC_F_ECDH_CMS_DECRYPT 238 +#define EC_F_ECDH_CMS_SET_SHARED_INFO 239 +#define EC_F_ECKEY_PARAM2TYPE 223 +#define EC_F_ECKEY_PARAM_DECODE 212 +#define EC_F_ECKEY_PRIV_DECODE 213 +#define EC_F_ECKEY_PRIV_ENCODE 214 +#define EC_F_ECKEY_PUB_DECODE 215 +#define EC_F_ECKEY_PUB_ENCODE 216 +#define EC_F_ECKEY_TYPE2PARAM 220 +#define EC_F_ECPARAMETERS_PRINT 147 +#define EC_F_ECPARAMETERS_PRINT_FP 148 +#define EC_F_ECPKPARAMETERS_PRINT 149 +#define EC_F_ECPKPARAMETERS_PRINT_FP 150 +#define EC_F_ECP_NISTZ256_GET_AFFINE 240 +#define EC_F_ECP_NISTZ256_MULT_PRECOMPUTE 243 +#define EC_F_ECP_NISTZ256_POINTS_MUL 241 +#define EC_F_ECP_NISTZ256_PRE_COMP_NEW 244 +#define EC_F_ECP_NISTZ256_SET_WORDS 245 +#define EC_F_ECP_NISTZ256_WINDOWED_MUL 242 +#define EC_F_ECP_NIST_MOD_192 203 +#define EC_F_ECP_NIST_MOD_224 204 +#define EC_F_ECP_NIST_MOD_256 205 +#define EC_F_ECP_NIST_MOD_521 206 +#define EC_F_EC_ASN1_GROUP2CURVE 153 +#define EC_F_EC_ASN1_GROUP2FIELDID 154 +#define EC_F_EC_ASN1_GROUP2PARAMETERS 155 +#define EC_F_EC_ASN1_GROUP2PKPARAMETERS 156 +#define EC_F_EC_ASN1_PARAMETERS2GROUP 157 +#define EC_F_EC_ASN1_PKPARAMETERS2GROUP 158 +#define EC_F_EC_EX_DATA_SET_DATA 211 +#define EC_F_EC_GF2M_MONTGOMERY_POINT_MULTIPLY 208 +#define EC_F_EC_GF2M_SIMPLE_GROUP_CHECK_DISCRIMINANT 159 +#define EC_F_EC_GF2M_SIMPLE_GROUP_SET_CURVE 195 +#define EC_F_EC_GF2M_SIMPLE_OCT2POINT 160 +#define EC_F_EC_GF2M_SIMPLE_POINT2OCT 161 +#define EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES 162 +#define EC_F_EC_GF2M_SIMPLE_POINT_SET_AFFINE_COORDINATES 163 +#define EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES 164 +#define EC_F_EC_GFP_MONT_FIELD_DECODE 133 +#define EC_F_EC_GFP_MONT_FIELD_ENCODE 134 +#define EC_F_EC_GFP_MONT_FIELD_MUL 131 +#define EC_F_EC_GFP_MONT_FIELD_SET_TO_ONE 209 +#define EC_F_EC_GFP_MONT_FIELD_SQR 132 +#define EC_F_EC_GFP_MONT_GROUP_SET_CURVE 189 +#define EC_F_EC_GFP_MONT_GROUP_SET_CURVE_GFP 135 +#define EC_F_EC_GFP_NISTP224_GROUP_SET_CURVE 225 +#define EC_F_EC_GFP_NISTP224_POINTS_MUL 228 +#define EC_F_EC_GFP_NISTP224_POINT_GET_AFFINE_COORDINATES 226 +#define EC_F_EC_GFP_NISTP256_GROUP_SET_CURVE 230 +#define EC_F_EC_GFP_NISTP256_POINTS_MUL 231 +#define EC_F_EC_GFP_NISTP256_POINT_GET_AFFINE_COORDINATES 232 +#define EC_F_EC_GFP_NISTP521_GROUP_SET_CURVE 233 +#define EC_F_EC_GFP_NISTP521_POINTS_MUL 234 +#define EC_F_EC_GFP_NISTP521_POINT_GET_AFFINE_COORDINATES 235 +#define EC_F_EC_GFP_NIST_FIELD_MUL 200 +#define EC_F_EC_GFP_NIST_FIELD_SQR 201 +#define EC_F_EC_GFP_NIST_GROUP_SET_CURVE 202 +#define EC_F_EC_GFP_SIMPLE_GROUP_CHECK_DISCRIMINANT 165 +#define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE 166 +#define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE_GFP 100 +#define EC_F_EC_GFP_SIMPLE_GROUP_SET_GENERATOR 101 +#define EC_F_EC_GFP_SIMPLE_MAKE_AFFINE 102 +#define EC_F_EC_GFP_SIMPLE_OCT2POINT 103 +#define EC_F_EC_GFP_SIMPLE_POINT2OCT 104 +#define EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE 137 +#define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES 167 +#define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES_GFP 105 +#define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES 168 +#define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES_GFP 128 +#define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES 169 +#define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES_GFP 129 +#define EC_F_EC_GROUP_CHECK 170 +#define EC_F_EC_GROUP_CHECK_DISCRIMINANT 171 +#define EC_F_EC_GROUP_COPY 106 +#define EC_F_EC_GROUP_GET0_GENERATOR 139 +#define EC_F_EC_GROUP_GET_COFACTOR 140 +#define EC_F_EC_GROUP_GET_CURVE_GF2M 172 +#define EC_F_EC_GROUP_GET_CURVE_GFP 130 +#define EC_F_EC_GROUP_GET_DEGREE 173 +#define EC_F_EC_GROUP_GET_ORDER 141 +#define EC_F_EC_GROUP_GET_PENTANOMIAL_BASIS 193 +#define EC_F_EC_GROUP_GET_TRINOMIAL_BASIS 194 +#define EC_F_EC_GROUP_NEW 108 +#define EC_F_EC_GROUP_NEW_BY_CURVE_NAME 174 +#define EC_F_EC_GROUP_NEW_FROM_DATA 175 +#define EC_F_EC_GROUP_PRECOMPUTE_MULT 142 +#define EC_F_EC_GROUP_SET_CURVE_GF2M 176 +#define EC_F_EC_GROUP_SET_CURVE_GFP 109 +#define EC_F_EC_GROUP_SET_EXTRA_DATA 110 +#define EC_F_EC_GROUP_SET_GENERATOR 111 +#define EC_F_EC_KEY_CHECK_KEY 177 +#define EC_F_EC_KEY_COPY 178 +#define EC_F_EC_KEY_GENERATE_KEY 179 +#define EC_F_EC_KEY_NEW 182 +#define EC_F_EC_KEY_PRINT 180 +#define EC_F_EC_KEY_PRINT_FP 181 +#define EC_F_EC_KEY_SET_PUBLIC_KEY_AFFINE_COORDINATES 229 +#define EC_F_EC_POINTS_MAKE_AFFINE 136 +#define EC_F_EC_POINT_ADD 112 +#define EC_F_EC_POINT_CMP 113 +#define EC_F_EC_POINT_COPY 114 +#define EC_F_EC_POINT_DBL 115 +#define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M 183 +#define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP 116 +#define EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP 117 +#define EC_F_EC_POINT_INVERT 210 +#define EC_F_EC_POINT_IS_AT_INFINITY 118 +#define EC_F_EC_POINT_IS_ON_CURVE 119 +#define EC_F_EC_POINT_MAKE_AFFINE 120 +#define EC_F_EC_POINT_MUL 184 +#define EC_F_EC_POINT_NEW 121 +#define EC_F_EC_POINT_OCT2POINT 122 +#define EC_F_EC_POINT_POINT2OCT 123 +#define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M 185 +#define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP 124 +#define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M 186 +#define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP 125 +#define EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP 126 +#define EC_F_EC_POINT_SET_TO_INFINITY 127 +#define EC_F_EC_PRE_COMP_DUP 207 +#define EC_F_EC_PRE_COMP_NEW 196 +#define EC_F_EC_WNAF_MUL 187 +#define EC_F_EC_WNAF_PRECOMPUTE_MULT 188 +#define EC_F_I2D_ECPARAMETERS 190 +#define EC_F_I2D_ECPKPARAMETERS 191 +#define EC_F_I2D_ECPRIVATEKEY 192 +#define EC_F_I2O_ECPUBLICKEY 151 +#define EC_F_NISTP224_PRE_COMP_NEW 227 +#define EC_F_NISTP256_PRE_COMP_NEW 236 +#define EC_F_NISTP521_PRE_COMP_NEW 237 +#define EC_F_O2I_ECPUBLICKEY 152 +#define EC_F_OLD_EC_PRIV_DECODE 222 +#define EC_F_PKEY_EC_CTRL 197 +#define EC_F_PKEY_EC_CTRL_STR 198 +#define EC_F_PKEY_EC_DERIVE 217 +#define EC_F_PKEY_EC_KEYGEN 199 +#define EC_F_PKEY_EC_PARAMGEN 219 +#define EC_F_PKEY_EC_SIGN 218 + +/* Reason codes. */ +#define EC_R_ASN1_ERROR 115 +#define EC_R_ASN1_UNKNOWN_FIELD 116 +#define EC_R_BIGNUM_OUT_OF_RANGE 144 +#define EC_R_BUFFER_TOO_SMALL 100 +#define EC_R_COORDINATES_OUT_OF_RANGE 146 +#define EC_R_D2I_ECPKPARAMETERS_FAILURE 117 +#define EC_R_DECODE_ERROR 142 +#define EC_R_DISCRIMINANT_IS_ZERO 118 +#define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 119 +#define EC_R_FIELD_TOO_LARGE 143 +#define EC_R_GF2M_NOT_SUPPORTED 147 +#define EC_R_GROUP2PKPARAMETERS_FAILURE 120 +#define EC_R_I2D_ECPKPARAMETERS_FAILURE 121 +#define EC_R_INCOMPATIBLE_OBJECTS 101 +#define EC_R_INVALID_ARGUMENT 112 +#define EC_R_INVALID_COMPRESSED_POINT 110 +#define EC_R_INVALID_COMPRESSION_BIT 109 +#define EC_R_INVALID_CURVE 141 +#define EC_R_INVALID_DIGEST 151 +#define EC_R_INVALID_DIGEST_TYPE 138 +#define EC_R_INVALID_ENCODING 102 +#define EC_R_INVALID_FIELD 103 +#define EC_R_INVALID_FORM 104 +#define EC_R_INVALID_GROUP_ORDER 122 +#define EC_R_INVALID_PENTANOMIAL_BASIS 132 +#define EC_R_INVALID_PRIVATE_KEY 123 +#define EC_R_INVALID_TRINOMIAL_BASIS 137 +#define EC_R_KDF_PARAMETER_ERROR 148 +#define EC_R_KEYS_NOT_SET 140 +#define EC_R_MISSING_PARAMETERS 124 +#define EC_R_MISSING_PRIVATE_KEY 125 +#define EC_R_NOT_A_NIST_PRIME 135 +#define EC_R_NOT_A_SUPPORTED_NIST_PRIME 136 +#define EC_R_NOT_IMPLEMENTED 126 +#define EC_R_NOT_INITIALIZED 111 +#define EC_R_NO_FIELD_MOD 133 +#define EC_R_NO_PARAMETERS_SET 139 +#define EC_R_PASSED_NULL_PARAMETER 134 +#define EC_R_PEER_KEY_ERROR 149 +#define EC_R_PKPARAMETERS2GROUP_FAILURE 127 +#define EC_R_POINT_AT_INFINITY 106 +#define EC_R_POINT_IS_NOT_ON_CURVE 107 +#define EC_R_SHARED_INFO_ERROR 150 +#define EC_R_SLOT_FULL 108 +#define EC_R_UNDEFINED_GENERATOR 113 +#define EC_R_UNDEFINED_ORDER 128 +#define EC_R_UNKNOWN_GROUP 129 +#define EC_R_UNKNOWN_ORDER 114 +#define EC_R_UNSUPPORTED_FIELD 131 +#define EC_R_WRONG_CURVE_PARAMETERS 145 +#define EC_R_WRONG_ORDER 130 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ecdh.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ecdh.h new file mode 100644 index 0000000..69a0869 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ecdh.h @@ -0,0 +1,144 @@ +/* crypto/ecdh/ecdh.h */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * + * The Elliptic Curve Public-Key Crypto Library (ECC Code) included + * herein is developed by SUN MICROSYSTEMS, INC., and is contributed + * to the OpenSSL project. + * + * The ECC Code is licensed pursuant to the OpenSSL open source + * license provided below. + * + * The ECDH software is originally written by Douglas Stebila of + * Sun Microsystems Laboratories. + * + */ +/* ==================================================================== + * Copyright (c) 2000-2002 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +#ifndef HEADER_ECDH_H +#define HEADER_ECDH_H + +#include + +#ifdef OPENSSL_NO_ECDH +#error ECDH is disabled. +#endif + +#include +#include +#ifndef OPENSSL_NO_DEPRECATED +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define EC_FLAG_COFACTOR_ECDH 0x1000 + +const ECDH_METHOD* ECDH_OpenSSL(void); + +void ECDH_set_default_method(const ECDH_METHOD*); +const ECDH_METHOD* ECDH_get_default_method(void); +int ECDH_set_method(EC_KEY*, const ECDH_METHOD*); + +int ECDH_compute_key( + void* out, + size_t outlen, + const EC_POINT* pub_key, + EC_KEY* ecdh, + void* (*KDF)(const void* in, size_t inlen, void* out, size_t* outlen)); + +int ECDH_get_ex_new_index( + long argl, + void* argp, + CRYPTO_EX_new* new_func, + CRYPTO_EX_dup* dup_func, + CRYPTO_EX_free* free_func); +int ECDH_set_ex_data(EC_KEY* d, int idx, void* arg); +void* ECDH_get_ex_data(EC_KEY* d, int idx); + +int ECDH_KDF_X9_62( + unsigned char* out, + size_t outlen, + const unsigned char* Z, + size_t Zlen, + const unsigned char* sinfo, + size_t sinfolen, + const EVP_MD* md); + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_ECDH_strings(void); + +/* Error codes for the ECDH functions. */ + +/* Function codes. */ +#define ECDH_F_ECDH_CHECK 102 +#define ECDH_F_ECDH_COMPUTE_KEY 100 +#define ECDH_F_ECDH_DATA_NEW_METHOD 101 + +/* Reason codes. */ +#define ECDH_R_KDF_FAILED 102 +#define ECDH_R_NON_FIPS_METHOD 103 +#define ECDH_R_NO_PRIVATE_VALUE 100 +#define ECDH_R_POINT_ARITHMETIC_FAILURE 101 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ecdsa.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ecdsa.h new file mode 100644 index 0000000..20db4b1 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ecdsa.h @@ -0,0 +1,366 @@ +/* crypto/ecdsa/ecdsa.h */ +/** + * \file crypto/ecdsa/ecdsa.h Include file for the OpenSSL ECDSA functions + * \author Written by Nils Larsch for the OpenSSL project + */ +/* ==================================================================== + * Copyright (c) 2000-2005 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +#ifndef HEADER_ECDSA_H +#define HEADER_ECDSA_H + +#include + +#ifdef OPENSSL_NO_ECDSA +#error ECDSA is disabled. +#endif + +#include +#include +#ifndef OPENSSL_NO_DEPRECATED +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ECDSA_SIG_st { + BIGNUM* r; + BIGNUM* s; +} ECDSA_SIG; + +/** Allocates and initialize a ECDSA_SIG structure + * \return pointer to a ECDSA_SIG structure or NULL if an error occurred + */ +ECDSA_SIG* ECDSA_SIG_new(void); + +/** frees a ECDSA_SIG structure + * \param sig pointer to the ECDSA_SIG structure + */ +void ECDSA_SIG_free(ECDSA_SIG* sig); + +/** DER encode content of ECDSA_SIG object (note: this function modifies *pp + * (*pp += length of the DER encoded signature)). + * \param sig pointer to the ECDSA_SIG object + * \param pp pointer to a unsigned char pointer for the output or NULL + * \return the length of the DER encoded ECDSA_SIG object or 0 + */ +int i2d_ECDSA_SIG(const ECDSA_SIG* sig, unsigned char** pp); + +/** Decodes a DER encoded ECDSA signature (note: this function changes *pp + * (*pp += len)). + * \param sig pointer to ECDSA_SIG pointer (may be NULL) + * \param pp memory buffer with the DER encoded signature + * \param len length of the buffer + * \return pointer to the decoded ECDSA_SIG structure (or NULL) + */ +ECDSA_SIG* d2i_ECDSA_SIG(ECDSA_SIG** sig, const unsigned char** pp, long len); + +/** Computes the ECDSA signature of the given hash value using + * the supplied private key and returns the created signature. + * \param dgst pointer to the hash value + * \param dgst_len length of the hash value + * \param eckey EC_KEY object containing a private EC key + * \return pointer to a ECDSA_SIG structure or NULL if an error occurred + */ +ECDSA_SIG* +ECDSA_do_sign(const unsigned char* dgst, int dgst_len, EC_KEY* eckey); + +/** Computes ECDSA signature of a given hash value using the supplied + * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). + * \param dgst pointer to the hash value to sign + * \param dgstlen length of the hash value + * \param kinv BIGNUM with a pre-computed inverse k (optional) + * \param rp BIGNUM with a pre-computed rp value (optioanl), + * see ECDSA_sign_setup + * \param eckey EC_KEY object containing a private EC key + * \return pointer to a ECDSA_SIG structure or NULL if an error occurred + */ +ECDSA_SIG* ECDSA_do_sign_ex( + const unsigned char* dgst, + int dgstlen, + const BIGNUM* kinv, + const BIGNUM* rp, + EC_KEY* eckey); + +/** Verifies that the supplied signature is a valid ECDSA + * signature of the supplied hash value using the supplied public key. + * \param dgst pointer to the hash value + * \param dgst_len length of the hash value + * \param sig ECDSA_SIG structure + * \param eckey EC_KEY object containing a public EC key + * \return 1 if the signature is valid, 0 if the signature is invalid + * and -1 on error + */ +int ECDSA_do_verify( + const unsigned char* dgst, + int dgst_len, + const ECDSA_SIG* sig, + EC_KEY* eckey); + +const ECDSA_METHOD* ECDSA_OpenSSL(void); + +/** Sets the default ECDSA method + * \param meth new default ECDSA_METHOD + */ +void ECDSA_set_default_method(const ECDSA_METHOD* meth); + +/** Returns the default ECDSA method + * \return pointer to ECDSA_METHOD structure containing the default method + */ +const ECDSA_METHOD* ECDSA_get_default_method(void); + +/** Sets method to be used for the ECDSA operations + * \param eckey EC_KEY object + * \param meth new method + * \return 1 on success and 0 otherwise + */ +int ECDSA_set_method(EC_KEY* eckey, const ECDSA_METHOD* meth); + +/** Returns the maximum length of the DER encoded signature + * \param eckey EC_KEY object + * \return numbers of bytes required for the DER encoded signature + */ +int ECDSA_size(const EC_KEY* eckey); + +/** Precompute parts of the signing operation + * \param eckey EC_KEY object containing a private EC key + * \param ctx BN_CTX object (optional) + * \param kinv BIGNUM pointer for the inverse of k + * \param rp BIGNUM pointer for x coordinate of k * generator + * \return 1 on success and 0 otherwise + */ +int ECDSA_sign_setup(EC_KEY* eckey, BN_CTX* ctx, BIGNUM** kinv, BIGNUM** rp); + +/** Computes ECDSA signature of a given hash value using the supplied + * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). + * \param type this parameter is ignored + * \param dgst pointer to the hash value to sign + * \param dgstlen length of the hash value + * \param sig memory for the DER encoded created signature + * \param siglen pointer to the length of the returned signature + * \param eckey EC_KEY object containing a private EC key + * \return 1 on success and 0 otherwise + */ +int ECDSA_sign( + int type, + const unsigned char* dgst, + int dgstlen, + unsigned char* sig, + unsigned int* siglen, + EC_KEY* eckey); + +/** Computes ECDSA signature of a given hash value using the supplied + * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). + * \param type this parameter is ignored + * \param dgst pointer to the hash value to sign + * \param dgstlen length of the hash value + * \param sig buffer to hold the DER encoded signature + * \param siglen pointer to the length of the returned signature + * \param kinv BIGNUM with a pre-computed inverse k (optional) + * \param rp BIGNUM with a pre-computed rp value (optioanl), + * see ECDSA_sign_setup + * \param eckey EC_KEY object containing a private EC key + * \return 1 on success and 0 otherwise + */ +int ECDSA_sign_ex( + int type, + const unsigned char* dgst, + int dgstlen, + unsigned char* sig, + unsigned int* siglen, + const BIGNUM* kinv, + const BIGNUM* rp, + EC_KEY* eckey); + +/** Verifies that the given signature is valid ECDSA signature + * of the supplied hash value using the specified public key. + * \param type this parameter is ignored + * \param dgst pointer to the hash value + * \param dgstlen length of the hash value + * \param sig pointer to the DER encoded signature + * \param siglen length of the DER encoded signature + * \param eckey EC_KEY object containing a public EC key + * \return 1 if the signature is valid, 0 if the signature is invalid + * and -1 on error + */ +int ECDSA_verify( + int type, + const unsigned char* dgst, + int dgstlen, + const unsigned char* sig, + int siglen, + EC_KEY* eckey); + +/* the standard ex_data functions */ +int ECDSA_get_ex_new_index( + long argl, + void* argp, + CRYPTO_EX_new* new_func, + CRYPTO_EX_dup* dup_func, + CRYPTO_EX_free* free_func); +int ECDSA_set_ex_data(EC_KEY* d, int idx, void* arg); +void* ECDSA_get_ex_data(EC_KEY* d, int idx); + +/** Allocates and initialize a ECDSA_METHOD structure + * \param ecdsa_method pointer to ECDSA_METHOD to copy. (May be NULL) + * \return pointer to a ECDSA_METHOD structure or NULL if an error occurred + */ + +ECDSA_METHOD* ECDSA_METHOD_new(const ECDSA_METHOD* ecdsa_method); + +/** frees a ECDSA_METHOD structure + * \param ecdsa_method pointer to the ECDSA_METHOD structure + */ +void ECDSA_METHOD_free(ECDSA_METHOD* ecdsa_method); + +/** Sets application specific data in the ECDSA_METHOD + * \param ecdsa_method pointer to existing ECDSA_METHOD + * \param app application specific data to set + */ + +void ECDSA_METHOD_set_app_data(ECDSA_METHOD* ecdsa_method, void* app); + +/** Returns application specific data from a ECDSA_METHOD structure + * \param ecdsa_method pointer to ECDSA_METHOD structure + * \return pointer to application specific data. + */ + +void* ECDSA_METHOD_get_app_data(ECDSA_METHOD* ecdsa_method); + +/** Set the ECDSA_do_sign function in the ECDSA_METHOD + * \param ecdsa_method pointer to existing ECDSA_METHOD + * \param ecdsa_do_sign a funtion of type ECDSA_do_sign + */ + +void ECDSA_METHOD_set_sign( + ECDSA_METHOD* ecdsa_method, + ECDSA_SIG* (*ecdsa_do_sign)( + const unsigned char* dgst, + int dgst_len, + const BIGNUM* inv, + const BIGNUM* rp, + EC_KEY* eckey)); + +/** Set the ECDSA_sign_setup function in the ECDSA_METHOD + * \param ecdsa_method pointer to existing ECDSA_METHOD + * \param ecdsa_sign_setup a funtion of type ECDSA_sign_setup + */ + +void ECDSA_METHOD_set_sign_setup( + ECDSA_METHOD* ecdsa_method, + int (*ecdsa_sign_setup)( + EC_KEY* eckey, + BN_CTX* ctx, + BIGNUM** kinv, + BIGNUM** r)); + +/** Set the ECDSA_do_verify function in the ECDSA_METHOD + * \param ecdsa_method pointer to existing ECDSA_METHOD + * \param ecdsa_do_verify a funtion of type ECDSA_do_verify + */ + +void ECDSA_METHOD_set_verify( + ECDSA_METHOD* ecdsa_method, + int (*ecdsa_do_verify)( + const unsigned char* dgst, + int dgst_len, + const ECDSA_SIG* sig, + EC_KEY* eckey)); + +void ECDSA_METHOD_set_flags(ECDSA_METHOD* ecdsa_method, int flags); + +/** Set the flags field in the ECDSA_METHOD + * \param ecdsa_method pointer to existing ECDSA_METHOD + * \param flags flags value to set + */ + +void ECDSA_METHOD_set_name(ECDSA_METHOD* ecdsa_method, char* name); + +/** Set the name field in the ECDSA_METHOD + * \param ecdsa_method pointer to existing ECDSA_METHOD + * \param name name to set + */ + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_ECDSA_strings(void); + +/* Error codes for the ECDSA functions. */ + +/* Function codes. */ +#define ECDSA_F_ECDSA_CHECK 104 +#define ECDSA_F_ECDSA_DATA_NEW_METHOD 100 +#define ECDSA_F_ECDSA_DO_SIGN 101 +#define ECDSA_F_ECDSA_DO_VERIFY 102 +#define ECDSA_F_ECDSA_METHOD_NEW 105 +#define ECDSA_F_ECDSA_SIGN_SETUP 103 + +/* Reason codes. */ +#define ECDSA_R_BAD_SIGNATURE 100 +#define ECDSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 101 +#define ECDSA_R_ERR_EC_LIB 102 +#define ECDSA_R_MISSING_PARAMETERS 103 +#define ECDSA_R_NEED_NEW_SETUP_VALUES 106 +#define ECDSA_R_NON_FIPS_METHOD 107 +#define ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED 104 +#define ECDSA_R_SIGNATURE_MALLOC_FAILED 105 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/engine.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/engine.h new file mode 100644 index 0000000..81b03f6 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/engine.h @@ -0,0 +1,997 @@ +/* openssl/engine.h */ +/* + * Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL project + * 2000. + */ +/* ==================================================================== + * Copyright (c) 1999-2004 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * ECDH support in OpenSSL originally developed by + * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. + */ + +#ifndef HEADER_ENGINE_H +#define HEADER_ENGINE_H + +#include + +#ifdef OPENSSL_NO_ENGINE +#error ENGINE is disabled. +#endif + +#ifndef OPENSSL_NO_DEPRECATED +#include +#ifndef OPENSSL_NO_RSA +#include +#endif +#ifndef OPENSSL_NO_DSA +#include +#endif +#ifndef OPENSSL_NO_DH +#include +#endif +#ifndef OPENSSL_NO_ECDH +#include +#endif +#ifndef OPENSSL_NO_ECDSA +#include +#endif +#include +#include +#include +#endif + +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * These flags are used to control combinations of algorithm (methods) by + * bitwise "OR"ing. + */ +#define ENGINE_METHOD_RSA (unsigned int)0x0001 +#define ENGINE_METHOD_DSA (unsigned int)0x0002 +#define ENGINE_METHOD_DH (unsigned int)0x0004 +#define ENGINE_METHOD_RAND (unsigned int)0x0008 +#define ENGINE_METHOD_ECDH (unsigned int)0x0010 +#define ENGINE_METHOD_ECDSA (unsigned int)0x0020 +#define ENGINE_METHOD_CIPHERS (unsigned int)0x0040 +#define ENGINE_METHOD_DIGESTS (unsigned int)0x0080 +#define ENGINE_METHOD_STORE (unsigned int)0x0100 +#define ENGINE_METHOD_PKEY_METHS (unsigned int)0x0200 +#define ENGINE_METHOD_PKEY_ASN1_METHS (unsigned int)0x0400 +/* Obvious all-or-nothing cases. */ +#define ENGINE_METHOD_ALL (unsigned int)0xFFFF +#define ENGINE_METHOD_NONE (unsigned int)0x0000 + +/* + * This(ese) flag(s) controls behaviour of the ENGINE_TABLE mechanism used + * internally to control registration of ENGINE implementations, and can be + * set by ENGINE_set_table_flags(). The "NOINIT" flag prevents attempts to + * initialise registered ENGINEs if they are not already initialised. + */ +#define ENGINE_TABLE_FLAG_NOINIT (unsigned int)0x0001 + +/* ENGINE flags that can be set by ENGINE_set_flags(). */ +/* Not used */ +/* #define ENGINE_FLAGS_MALLOCED 0x0001 */ + +/* + * This flag is for ENGINEs that wish to handle the various 'CMD'-related + * control commands on their own. Without this flag, ENGINE_ctrl() handles + * these control commands on behalf of the ENGINE using their "cmd_defns" + * data. + */ +#define ENGINE_FLAGS_MANUAL_CMD_CTRL (int)0x0002 + +/* + * This flag is for ENGINEs who return new duplicate structures when found + * via "ENGINE_by_id()". When an ENGINE must store state (eg. if + * ENGINE_ctrl() commands are called in sequence as part of some stateful + * process like key-generation setup and execution), it can set this flag - + * then each attempt to obtain the ENGINE will result in it being copied into + * a new structure. Normally, ENGINEs don't declare this flag so + * ENGINE_by_id() just increments the existing ENGINE's structural reference + * count. + */ +#define ENGINE_FLAGS_BY_ID_COPY (int)0x0004 + +/* + * This flag if for an ENGINE that does not want its methods registered as + * part of ENGINE_register_all_complete() for example if the methods are not + * usable as default methods. + */ + +#define ENGINE_FLAGS_NO_REGISTER_ALL (int)0x0008 + +/* + * ENGINEs can support their own command types, and these flags are used in + * ENGINE_CTRL_GET_CMD_FLAGS to indicate to the caller what kind of input + * each command expects. Currently only numeric and string input is + * supported. If a control command supports none of the _NUMERIC, _STRING, or + * _NO_INPUT options, then it is regarded as an "internal" control command - + * and not for use in config setting situations. As such, they're not + * available to the ENGINE_ctrl_cmd_string() function, only raw ENGINE_ctrl() + * access. Changes to this list of 'command types' should be reflected + * carefully in ENGINE_cmd_is_executable() and ENGINE_ctrl_cmd_string(). + */ + +/* accepts a 'long' input value (3rd parameter to ENGINE_ctrl) */ +#define ENGINE_CMD_FLAG_NUMERIC (unsigned int)0x0001 +/* + * accepts string input (cast from 'void*' to 'const char *', 4th parameter + * to ENGINE_ctrl) + */ +#define ENGINE_CMD_FLAG_STRING (unsigned int)0x0002 +/* + * Indicates that the control command takes *no* input. Ie. the control + * command is unparameterised. + */ +#define ENGINE_CMD_FLAG_NO_INPUT (unsigned int)0x0004 +/* + * Indicates that the control command is internal. This control command won't + * be shown in any output, and is only usable through the ENGINE_ctrl_cmd() + * function. + */ +#define ENGINE_CMD_FLAG_INTERNAL (unsigned int)0x0008 + +/* + * NB: These 3 control commands are deprecated and should not be used. + * ENGINEs relying on these commands should compile conditional support for + * compatibility (eg. if these symbols are defined) but should also migrate + * the same functionality to their own ENGINE-specific control functions that + * can be "discovered" by calling applications. The fact these control + * commands wouldn't be "executable" (ie. usable by text-based config) + * doesn't change the fact that application code can find and use them + * without requiring per-ENGINE hacking. + */ + +/* + * These flags are used to tell the ctrl function what should be done. All + * command numbers are shared between all engines, even if some don't make + * sense to some engines. In such a case, they do nothing but return the + * error ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED. + */ +#define ENGINE_CTRL_SET_LOGSTREAM 1 +#define ENGINE_CTRL_SET_PASSWORD_CALLBACK 2 +#define ENGINE_CTRL_HUP \ + 3 /* Close and reinitialise \ + * any handles/connections \ + * etc. */ +#define ENGINE_CTRL_SET_USER_INTERFACE 4 /* Alternative to callback */ +#define ENGINE_CTRL_SET_CALLBACK_DATA \ + 5 /* User-specific data, used \ + * when calling the password \ + * callback and the user \ + * interface */ +#define ENGINE_CTRL_LOAD_CONFIGURATION \ + 6 /* Load a configuration, \ + * given a string that \ + * represents a file name \ + * or so */ +#define ENGINE_CTRL_LOAD_SECTION \ + 7 /* Load data from a given \ + * section in the already \ + * loaded configuration */ + +/* + * These control commands allow an application to deal with an arbitrary + * engine in a dynamic way. Warn: Negative return values indicate errors FOR + * THESE COMMANDS because zero is used to indicate 'end-of-list'. Other + * commands, including ENGINE-specific command types, return zero for an + * error. An ENGINE can choose to implement these ctrl functions, and can + * internally manage things however it chooses - it does so by setting the + * ENGINE_FLAGS_MANUAL_CMD_CTRL flag (using ENGINE_set_flags()). Otherwise + * the ENGINE_ctrl() code handles this on the ENGINE's behalf using the + * cmd_defns data (set using ENGINE_set_cmd_defns()). This means an ENGINE's + * ctrl() handler need only implement its own commands - the above "meta" + * commands will be taken care of. + */ + +/* + * Returns non-zero if the supplied ENGINE has a ctrl() handler. If "not", + * then all the remaining control commands will return failure, so it is + * worth checking this first if the caller is trying to "discover" the + * engine's capabilities and doesn't want errors generated unnecessarily. + */ +#define ENGINE_CTRL_HAS_CTRL_FUNCTION 10 +/* + * Returns a positive command number for the first command supported by the + * engine. Returns zero if no ctrl commands are supported. + */ +#define ENGINE_CTRL_GET_FIRST_CMD_TYPE 11 +/* + * The 'long' argument specifies a command implemented by the engine, and the + * return value is the next command supported, or zero if there are no more. + */ +#define ENGINE_CTRL_GET_NEXT_CMD_TYPE 12 +/* + * The 'void*' argument is a command name (cast from 'const char *'), and the + * return value is the command that corresponds to it. + */ +#define ENGINE_CTRL_GET_CMD_FROM_NAME 13 +/* + * The next two allow a command to be converted into its corresponding string + * form. In each case, the 'long' argument supplies the command. In the + * NAME_LEN case, the return value is the length of the command name (not + * counting a trailing EOL). In the NAME case, the 'void*' argument must be a + * string buffer large enough, and it will be populated with the name of the + * command (WITH a trailing EOL). + */ +#define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD 14 +#define ENGINE_CTRL_GET_NAME_FROM_CMD 15 +/* The next two are similar but give a "short description" of a command. */ +#define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD 16 +#define ENGINE_CTRL_GET_DESC_FROM_CMD 17 +/* + * With this command, the return value is the OR'd combination of + * ENGINE_CMD_FLAG_*** values that indicate what kind of input a given + * engine-specific ctrl command expects. + */ +#define ENGINE_CTRL_GET_CMD_FLAGS 18 + +/* + * ENGINE implementations should start the numbering of their own control + * commands from this value. (ie. ENGINE_CMD_BASE, ENGINE_CMD_BASE + 1, etc). + */ +#define ENGINE_CMD_BASE 200 + +/* + * NB: These 2 nCipher "chil" control commands are deprecated, and their + * functionality is now available through ENGINE-specific control commands + * (exposed through the above-mentioned 'CMD'-handling). Code using these 2 + * commands should be migrated to the more general command handling before + * these are removed. + */ + +/* Flags specific to the nCipher "chil" engine */ +#define ENGINE_CTRL_CHIL_SET_FORKCHECK 100 +/* + * Depending on the value of the (long)i argument, this sets or + * unsets the SimpleForkCheck flag in the CHIL API to enable or + * disable checking and workarounds for applications that fork(). + */ +#define ENGINE_CTRL_CHIL_NO_LOCKING 101 +/* + * This prevents the initialisation function from providing mutex + * callbacks to the nCipher library. + */ + +/* + * If an ENGINE supports its own specific control commands and wishes the + * framework to handle the above 'ENGINE_CMD_***'-manipulation commands on + * its behalf, it should supply a null-terminated array of ENGINE_CMD_DEFN + * entries to ENGINE_set_cmd_defns(). It should also implement a ctrl() + * handler that supports the stated commands (ie. the "cmd_num" entries as + * described by the array). NB: The array must be ordered in increasing order + * of cmd_num. "null-terminated" means that the last ENGINE_CMD_DEFN element + * has cmd_num set to zero and/or cmd_name set to NULL. + */ +typedef struct ENGINE_CMD_DEFN_st { + unsigned int cmd_num; /* The command number */ + const char* cmd_name; /* The command name itself */ + const char* cmd_desc; /* A short description of the command */ + unsigned int cmd_flags; /* The input the command expects */ +} ENGINE_CMD_DEFN; + +/* Generic function pointer */ +typedef int (*ENGINE_GEN_FUNC_PTR)(void); +/* Generic function pointer taking no arguments */ +typedef int (*ENGINE_GEN_INT_FUNC_PTR)(ENGINE*); +/* Specific control function pointer */ +typedef int (*ENGINE_CTRL_FUNC_PTR)(ENGINE*, int, long, void*, void (*f)(void)); +/* Generic load_key function pointer */ +typedef EVP_PKEY* (*ENGINE_LOAD_KEY_PTR)( + ENGINE*, + const char*, + UI_METHOD* ui_method, + void* callback_data); +typedef int (*ENGINE_SSL_CLIENT_CERT_PTR)( + ENGINE*, + SSL* ssl, + STACK_OF(X509_NAME) * ca_dn, + X509** pcert, + EVP_PKEY** pkey, + STACK_OF(X509) * *pother, + UI_METHOD* ui_method, + void* callback_data); +/*- + * These callback types are for an ENGINE's handler for cipher and digest logic. + * These handlers have these prototypes; + * int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid); + * int foo(ENGINE *e, const EVP_MD **digest, const int **nids, int nid); + * Looking at how to implement these handlers in the case of cipher support, if + * the framework wants the EVP_CIPHER for 'nid', it will call; + * foo(e, &p_evp_cipher, NULL, nid); (return zero for failure) + * If the framework wants a list of supported 'nid's, it will call; + * foo(e, NULL, &p_nids, 0); (returns number of 'nids' or -1 for error) + */ +/* + * Returns to a pointer to the array of supported cipher 'nid's. If the + * second parameter is non-NULL it is set to the size of the returned array. + */ +typedef int ( + *ENGINE_CIPHERS_PTR)(ENGINE*, const EVP_CIPHER**, const int**, int); +typedef int (*ENGINE_DIGESTS_PTR)(ENGINE*, const EVP_MD**, const int**, int); +typedef int ( + *ENGINE_PKEY_METHS_PTR)(ENGINE*, EVP_PKEY_METHOD**, const int**, int); +typedef int (*ENGINE_PKEY_ASN1_METHS_PTR)( + ENGINE*, + EVP_PKEY_ASN1_METHOD**, + const int**, + int); +/* + * STRUCTURE functions ... all of these functions deal with pointers to + * ENGINE structures where the pointers have a "structural reference". This + * means that their reference is to allowed access to the structure but it + * does not imply that the structure is functional. To simply increment or + * decrement the structural reference count, use ENGINE_by_id and + * ENGINE_free. NB: This is not required when iterating using ENGINE_get_next + * as it will automatically decrement the structural reference count of the + * "current" ENGINE and increment the structural reference count of the + * ENGINE it returns (unless it is NULL). + */ + +/* Get the first/last "ENGINE" type available. */ +ENGINE* ENGINE_get_first(void); +ENGINE* ENGINE_get_last(void); +/* Iterate to the next/previous "ENGINE" type (NULL = end of the list). */ +ENGINE* ENGINE_get_next(ENGINE* e); +ENGINE* ENGINE_get_prev(ENGINE* e); +/* Add another "ENGINE" type into the array. */ +int ENGINE_add(ENGINE* e); +/* Remove an existing "ENGINE" type from the array. */ +int ENGINE_remove(ENGINE* e); +/* Retrieve an engine from the list by its unique "id" value. */ +ENGINE* ENGINE_by_id(const char* id); +/* Add all the built-in engines. */ +void ENGINE_load_openssl(void); +void ENGINE_load_dynamic(void); +#ifndef OPENSSL_NO_STATIC_ENGINE +void ENGINE_load_4758cca(void); +void ENGINE_load_aep(void); +void ENGINE_load_atalla(void); +void ENGINE_load_chil(void); +void ENGINE_load_cswift(void); +void ENGINE_load_nuron(void); +void ENGINE_load_sureware(void); +void ENGINE_load_ubsec(void); +void ENGINE_load_padlock(void); +void ENGINE_load_capi(void); +#ifndef OPENSSL_NO_GMP +void ENGINE_load_gmp(void); +#endif +#ifndef OPENSSL_NO_GOST +void ENGINE_load_gost(void); +#endif +#endif +void ENGINE_load_cryptodev(void); +void ENGINE_load_rdrand(void); +void ENGINE_load_builtin_engines(void); + +/* + * Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation + * "registry" handling. + */ +unsigned int ENGINE_get_table_flags(void); +void ENGINE_set_table_flags(unsigned int flags); + +/*- Manage registration of ENGINEs per "table". For each type, there are 3 + * functions; + * ENGINE_register_***(e) - registers the implementation from 'e' (if it has + * one) + * ENGINE_unregister_***(e) - unregister the implementation from 'e' + * ENGINE_register_all_***() - call ENGINE_register_***() for each 'e' in the + * list + * Cleanup is automatically registered from each table when required, so + * ENGINE_cleanup() will reverse any "register" operations. + */ + +int ENGINE_register_RSA(ENGINE* e); +void ENGINE_unregister_RSA(ENGINE* e); +void ENGINE_register_all_RSA(void); + +int ENGINE_register_DSA(ENGINE* e); +void ENGINE_unregister_DSA(ENGINE* e); +void ENGINE_register_all_DSA(void); + +int ENGINE_register_ECDH(ENGINE* e); +void ENGINE_unregister_ECDH(ENGINE* e); +void ENGINE_register_all_ECDH(void); + +int ENGINE_register_ECDSA(ENGINE* e); +void ENGINE_unregister_ECDSA(ENGINE* e); +void ENGINE_register_all_ECDSA(void); + +int ENGINE_register_DH(ENGINE* e); +void ENGINE_unregister_DH(ENGINE* e); +void ENGINE_register_all_DH(void); + +int ENGINE_register_RAND(ENGINE* e); +void ENGINE_unregister_RAND(ENGINE* e); +void ENGINE_register_all_RAND(void); + +int ENGINE_register_STORE(ENGINE* e); +void ENGINE_unregister_STORE(ENGINE* e); +void ENGINE_register_all_STORE(void); + +int ENGINE_register_ciphers(ENGINE* e); +void ENGINE_unregister_ciphers(ENGINE* e); +void ENGINE_register_all_ciphers(void); + +int ENGINE_register_digests(ENGINE* e); +void ENGINE_unregister_digests(ENGINE* e); +void ENGINE_register_all_digests(void); + +int ENGINE_register_pkey_meths(ENGINE* e); +void ENGINE_unregister_pkey_meths(ENGINE* e); +void ENGINE_register_all_pkey_meths(void); + +int ENGINE_register_pkey_asn1_meths(ENGINE* e); +void ENGINE_unregister_pkey_asn1_meths(ENGINE* e); +void ENGINE_register_all_pkey_asn1_meths(void); + +/* + * These functions register all support from the above categories. Note, use + * of these functions can result in static linkage of code your application + * may not need. If you only need a subset of functionality, consider using + * more selective initialisation. + */ +int ENGINE_register_complete(ENGINE* e); +int ENGINE_register_all_complete(void); + +/* + * Send parametrised control commands to the engine. The possibilities to + * send down an integer, a pointer to data or a function pointer are + * provided. Any of the parameters may or may not be NULL, depending on the + * command number. In actuality, this function only requires a structural + * (rather than functional) reference to an engine, but many control commands + * may require the engine be functional. The caller should be aware of trying + * commands that require an operational ENGINE, and only use functional + * references in such situations. + */ +int ENGINE_ctrl(ENGINE* e, int cmd, long i, void* p, void (*f)(void)); + +/* + * This function tests if an ENGINE-specific command is usable as a + * "setting". Eg. in an application's config file that gets processed through + * ENGINE_ctrl_cmd_string(). If this returns zero, it is not available to + * ENGINE_ctrl_cmd_string(), only ENGINE_ctrl(). + */ +int ENGINE_cmd_is_executable(ENGINE* e, int cmd); + +/* + * This function works like ENGINE_ctrl() with the exception of taking a + * command name instead of a command number, and can handle optional + * commands. See the comment on ENGINE_ctrl_cmd_string() for an explanation + * on how to use the cmd_name and cmd_optional. + */ +int ENGINE_ctrl_cmd( + ENGINE* e, + const char* cmd_name, + long i, + void* p, + void (*f)(void), + int cmd_optional); + +/* + * This function passes a command-name and argument to an ENGINE. The + * cmd_name is converted to a command number and the control command is + * called using 'arg' as an argument (unless the ENGINE doesn't support such + * a command, in which case no control command is called). The command is + * checked for input flags, and if necessary the argument will be converted + * to a numeric value. If cmd_optional is non-zero, then if the ENGINE + * doesn't support the given cmd_name the return value will be success + * anyway. This function is intended for applications to use so that users + * (or config files) can supply engine-specific config data to the ENGINE at + * run-time to control behaviour of specific engines. As such, it shouldn't + * be used for calling ENGINE_ctrl() functions that return data, deal with + * binary data, or that are otherwise supposed to be used directly through + * ENGINE_ctrl() in application code. Any "return" data from an ENGINE_ctrl() + * operation in this function will be lost - the return value is interpreted + * as failure if the return value is zero, success otherwise, and this + * function returns a boolean value as a result. In other words, vendors of + * 'ENGINE'-enabled devices should write ENGINE implementations with + * parameterisations that work in this scheme, so that compliant ENGINE-based + * applications can work consistently with the same configuration for the + * same ENGINE-enabled devices, across applications. + */ +int ENGINE_ctrl_cmd_string( + ENGINE* e, + const char* cmd_name, + const char* arg, + int cmd_optional); + +/* + * These functions are useful for manufacturing new ENGINE structures. They + * don't address reference counting at all - one uses them to populate an + * ENGINE structure with personalised implementations of things prior to + * using it directly or adding it to the builtin ENGINE list in OpenSSL. + * These are also here so that the ENGINE structure doesn't have to be + * exposed and break binary compatibility! + */ +ENGINE* ENGINE_new(void); +int ENGINE_free(ENGINE* e); +int ENGINE_up_ref(ENGINE* e); +int ENGINE_set_id(ENGINE* e, const char* id); +int ENGINE_set_name(ENGINE* e, const char* name); +int ENGINE_set_RSA(ENGINE* e, const RSA_METHOD* rsa_meth); +int ENGINE_set_DSA(ENGINE* e, const DSA_METHOD* dsa_meth); +int ENGINE_set_ECDH(ENGINE* e, const ECDH_METHOD* ecdh_meth); +int ENGINE_set_ECDSA(ENGINE* e, const ECDSA_METHOD* ecdsa_meth); +int ENGINE_set_DH(ENGINE* e, const DH_METHOD* dh_meth); +int ENGINE_set_RAND(ENGINE* e, const RAND_METHOD* rand_meth); +int ENGINE_set_STORE(ENGINE* e, const STORE_METHOD* store_meth); +int ENGINE_set_destroy_function(ENGINE* e, ENGINE_GEN_INT_FUNC_PTR destroy_f); +int ENGINE_set_init_function(ENGINE* e, ENGINE_GEN_INT_FUNC_PTR init_f); +int ENGINE_set_finish_function(ENGINE* e, ENGINE_GEN_INT_FUNC_PTR finish_f); +int ENGINE_set_ctrl_function(ENGINE* e, ENGINE_CTRL_FUNC_PTR ctrl_f); +int ENGINE_set_load_privkey_function(ENGINE* e, ENGINE_LOAD_KEY_PTR loadpriv_f); +int ENGINE_set_load_pubkey_function(ENGINE* e, ENGINE_LOAD_KEY_PTR loadpub_f); +int ENGINE_set_load_ssl_client_cert_function( + ENGINE* e, + ENGINE_SSL_CLIENT_CERT_PTR loadssl_f); +int ENGINE_set_ciphers(ENGINE* e, ENGINE_CIPHERS_PTR f); +int ENGINE_set_digests(ENGINE* e, ENGINE_DIGESTS_PTR f); +int ENGINE_set_pkey_meths(ENGINE* e, ENGINE_PKEY_METHS_PTR f); +int ENGINE_set_pkey_asn1_meths(ENGINE* e, ENGINE_PKEY_ASN1_METHS_PTR f); +int ENGINE_set_flags(ENGINE* e, int flags); +int ENGINE_set_cmd_defns(ENGINE* e, const ENGINE_CMD_DEFN* defns); +/* These functions allow control over any per-structure ENGINE data. */ +int ENGINE_get_ex_new_index( + long argl, + void* argp, + CRYPTO_EX_new* new_func, + CRYPTO_EX_dup* dup_func, + CRYPTO_EX_free* free_func); +int ENGINE_set_ex_data(ENGINE* e, int idx, void* arg); +void* ENGINE_get_ex_data(const ENGINE* e, int idx); + +/* + * This function cleans up anything that needs it. Eg. the ENGINE_add() + * function automatically ensures the list cleanup function is registered to + * be called from ENGINE_cleanup(). Similarly, all ENGINE_register_*** + * functions ensure ENGINE_cleanup() will clean up after them. + */ +void ENGINE_cleanup(void); + +/* + * These return values from within the ENGINE structure. These can be useful + * with functional references as well as structural references - it depends + * which you obtained. Using the result for functional purposes if you only + * obtained a structural reference may be problematic! + */ +const char* ENGINE_get_id(const ENGINE* e); +const char* ENGINE_get_name(const ENGINE* e); +const RSA_METHOD* ENGINE_get_RSA(const ENGINE* e); +const DSA_METHOD* ENGINE_get_DSA(const ENGINE* e); +const ECDH_METHOD* ENGINE_get_ECDH(const ENGINE* e); +const ECDSA_METHOD* ENGINE_get_ECDSA(const ENGINE* e); +const DH_METHOD* ENGINE_get_DH(const ENGINE* e); +const RAND_METHOD* ENGINE_get_RAND(const ENGINE* e); +const STORE_METHOD* ENGINE_get_STORE(const ENGINE* e); +ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE* e); +ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE* e); +ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE* e); +ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE* e); +ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE* e); +ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE* e); +ENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGINE* e); +ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE* e); +ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE* e); +ENGINE_PKEY_METHS_PTR ENGINE_get_pkey_meths(const ENGINE* e); +ENGINE_PKEY_ASN1_METHS_PTR ENGINE_get_pkey_asn1_meths(const ENGINE* e); +const EVP_CIPHER* ENGINE_get_cipher(ENGINE* e, int nid); +const EVP_MD* ENGINE_get_digest(ENGINE* e, int nid); +const EVP_PKEY_METHOD* ENGINE_get_pkey_meth(ENGINE* e, int nid); +const EVP_PKEY_ASN1_METHOD* ENGINE_get_pkey_asn1_meth(ENGINE* e, int nid); +const EVP_PKEY_ASN1_METHOD* +ENGINE_get_pkey_asn1_meth_str(ENGINE* e, const char* str, int len); +const EVP_PKEY_ASN1_METHOD* +ENGINE_pkey_asn1_find_str(ENGINE** pe, const char* str, int len); +const ENGINE_CMD_DEFN* ENGINE_get_cmd_defns(const ENGINE* e); +int ENGINE_get_flags(const ENGINE* e); + +/* + * FUNCTIONAL functions. These functions deal with ENGINE structures that + * have (or will) be initialised for use. Broadly speaking, the structural + * functions are useful for iterating the list of available engine types, + * creating new engine types, and other "list" operations. These functions + * actually deal with ENGINEs that are to be used. As such these functions + * can fail (if applicable) when particular engines are unavailable - eg. if + * a hardware accelerator is not attached or not functioning correctly. Each + * ENGINE has 2 reference counts; structural and functional. Every time a + * functional reference is obtained or released, a corresponding structural + * reference is automatically obtained or released too. + */ + +/* + * Initialise a engine type for use (or up its reference count if it's + * already in use). This will fail if the engine is not currently operational + * and cannot initialise. + */ +int ENGINE_init(ENGINE* e); +/* + * Free a functional reference to a engine type. This does not require a + * corresponding call to ENGINE_free as it also releases a structural + * reference. + */ +int ENGINE_finish(ENGINE* e); + +/* + * The following functions handle keys that are stored in some secondary + * location, handled by the engine. The storage may be on a card or + * whatever. + */ +EVP_PKEY* ENGINE_load_private_key( + ENGINE* e, + const char* key_id, + UI_METHOD* ui_method, + void* callback_data); +EVP_PKEY* ENGINE_load_public_key( + ENGINE* e, + const char* key_id, + UI_METHOD* ui_method, + void* callback_data); +int ENGINE_load_ssl_client_cert( + ENGINE* e, + SSL* s, + STACK_OF(X509_NAME) * ca_dn, + X509** pcert, + EVP_PKEY** ppkey, + STACK_OF(X509) * *pother, + UI_METHOD* ui_method, + void* callback_data); + +/* + * This returns a pointer for the current ENGINE structure that is (by + * default) performing any RSA operations. The value returned is an + * incremented reference, so it should be free'd (ENGINE_finish) before it is + * discarded. + */ +ENGINE* ENGINE_get_default_RSA(void); +/* Same for the other "methods" */ +ENGINE* ENGINE_get_default_DSA(void); +ENGINE* ENGINE_get_default_ECDH(void); +ENGINE* ENGINE_get_default_ECDSA(void); +ENGINE* ENGINE_get_default_DH(void); +ENGINE* ENGINE_get_default_RAND(void); +/* + * These functions can be used to get a functional reference to perform + * ciphering or digesting corresponding to "nid". + */ +ENGINE* ENGINE_get_cipher_engine(int nid); +ENGINE* ENGINE_get_digest_engine(int nid); +ENGINE* ENGINE_get_pkey_meth_engine(int nid); +ENGINE* ENGINE_get_pkey_asn1_meth_engine(int nid); + +/* + * This sets a new default ENGINE structure for performing RSA operations. If + * the result is non-zero (success) then the ENGINE structure will have had + * its reference count up'd so the caller should still free their own + * reference 'e'. + */ +int ENGINE_set_default_RSA(ENGINE* e); +int ENGINE_set_default_string(ENGINE* e, const char* def_list); +/* Same for the other "methods" */ +int ENGINE_set_default_DSA(ENGINE* e); +int ENGINE_set_default_ECDH(ENGINE* e); +int ENGINE_set_default_ECDSA(ENGINE* e); +int ENGINE_set_default_DH(ENGINE* e); +int ENGINE_set_default_RAND(ENGINE* e); +int ENGINE_set_default_ciphers(ENGINE* e); +int ENGINE_set_default_digests(ENGINE* e); +int ENGINE_set_default_pkey_meths(ENGINE* e); +int ENGINE_set_default_pkey_asn1_meths(ENGINE* e); + +/* + * The combination "set" - the flags are bitwise "OR"d from the + * ENGINE_METHOD_*** defines above. As with the "ENGINE_register_complete()" + * function, this function can result in unnecessary static linkage. If your + * application requires only specific functionality, consider using more + * selective functions. + */ +int ENGINE_set_default(ENGINE* e, unsigned int flags); + +void ENGINE_add_conf_module(void); + +/* Deprecated functions ... */ +/* int ENGINE_clear_defaults(void); */ + +/**************************/ +/* DYNAMIC ENGINE SUPPORT */ +/**************************/ + +/* Binary/behaviour compatibility levels */ +#define OSSL_DYNAMIC_VERSION (unsigned long)0x00020000 +/* + * Binary versions older than this are too old for us (whether we're a loader + * or a loadee) + */ +#define OSSL_DYNAMIC_OLDEST (unsigned long)0x00020000 + +/* + * When compiling an ENGINE entirely as an external shared library, loadable + * by the "dynamic" ENGINE, these types are needed. The 'dynamic_fns' + * structure type provides the calling application's (or library's) error + * functionality and memory management function pointers to the loaded + * library. These should be used/set in the loaded library code so that the + * loading application's 'state' will be used/changed in all operations. The + * 'static_state' pointer allows the loaded library to know if it shares the + * same static data as the calling application (or library), and thus whether + * these callbacks need to be set or not. + */ +typedef void* (*dyn_MEM_malloc_cb)(size_t); +typedef void* (*dyn_MEM_realloc_cb)(void*, size_t); +typedef void (*dyn_MEM_free_cb)(void*); +typedef struct st_dynamic_MEM_fns { + dyn_MEM_malloc_cb malloc_cb; + dyn_MEM_realloc_cb realloc_cb; + dyn_MEM_free_cb free_cb; +} dynamic_MEM_fns; +/* + * FIXME: Perhaps the memory and locking code (crypto.h) should declare and + * use these types so we (and any other dependant code) can simplify a bit?? + */ +typedef void (*dyn_lock_locking_cb)(int, int, const char*, int); +typedef int (*dyn_lock_add_lock_cb)(int*, int, int, const char*, int); +typedef struct CRYPTO_dynlock_value* (*dyn_dynlock_create_cb)(const char*, int); +typedef void ( + *dyn_dynlock_lock_cb)(int, struct CRYPTO_dynlock_value*, const char*, int); +typedef void ( + *dyn_dynlock_destroy_cb)(struct CRYPTO_dynlock_value*, const char*, int); +typedef struct st_dynamic_LOCK_fns { + dyn_lock_locking_cb lock_locking_cb; + dyn_lock_add_lock_cb lock_add_lock_cb; + dyn_dynlock_create_cb dynlock_create_cb; + dyn_dynlock_lock_cb dynlock_lock_cb; + dyn_dynlock_destroy_cb dynlock_destroy_cb; +} dynamic_LOCK_fns; +/* The top-level structure */ +typedef struct st_dynamic_fns { + void* static_state; + const ERR_FNS* err_fns; + const CRYPTO_EX_DATA_IMPL* ex_data_fns; + dynamic_MEM_fns mem_fns; + dynamic_LOCK_fns lock_fns; +} dynamic_fns; + +/* + * The version checking function should be of this prototype. NB: The + * ossl_version value passed in is the OSSL_DYNAMIC_VERSION of the loading + * code. If this function returns zero, it indicates a (potential) version + * incompatibility and the loaded library doesn't believe it can proceed. + * Otherwise, the returned value is the (latest) version supported by the + * loading library. The loader may still decide that the loaded code's + * version is unsatisfactory and could veto the load. The function is + * expected to be implemented with the symbol name "v_check", and a default + * implementation can be fully instantiated with + * IMPLEMENT_DYNAMIC_CHECK_FN(). + */ +typedef unsigned long (*dynamic_v_check_fn)(unsigned long ossl_version); +#define IMPLEMENT_DYNAMIC_CHECK_FN() \ + OPENSSL_EXPORT unsigned long v_check(unsigned long v); \ + OPENSSL_EXPORT unsigned long v_check(unsigned long v) { \ + if (v >= OSSL_DYNAMIC_OLDEST) \ + return OSSL_DYNAMIC_VERSION; \ + return 0; \ + } + +/* + * This function is passed the ENGINE structure to initialise with its own + * function and command settings. It should not adjust the structural or + * functional reference counts. If this function returns zero, (a) the load + * will be aborted, (b) the previous ENGINE state will be memcpy'd back onto + * the structure, and (c) the shared library will be unloaded. So + * implementations should do their own internal cleanup in failure + * circumstances otherwise they could leak. The 'id' parameter, if non-NULL, + * represents the ENGINE id that the loader is looking for. If this is NULL, + * the shared library can choose to return failure or to initialise a + * 'default' ENGINE. If non-NULL, the shared library must initialise only an + * ENGINE matching the passed 'id'. The function is expected to be + * implemented with the symbol name "bind_engine". A standard implementation + * can be instantiated with IMPLEMENT_DYNAMIC_BIND_FN(fn) where the parameter + * 'fn' is a callback function that populates the ENGINE structure and + * returns an int value (zero for failure). 'fn' should have prototype; + * [static] int fn(ENGINE *e, const char *id); + */ +typedef int ( + *dynamic_bind_engine)(ENGINE* e, const char* id, const dynamic_fns* fns); +#define IMPLEMENT_DYNAMIC_BIND_FN(fn) \ + OPENSSL_EXPORT \ + int bind_engine(ENGINE* e, const char* id, const dynamic_fns* fns); \ + OPENSSL_EXPORT \ + int bind_engine(ENGINE* e, const char* id, const dynamic_fns* fns) { \ + if (ENGINE_get_static_state() == fns->static_state) \ + goto skip_cbs; \ + if (!CRYPTO_set_mem_functions( \ + fns->mem_fns.malloc_cb, \ + fns->mem_fns.realloc_cb, \ + fns->mem_fns.free_cb)) \ + return 0; \ + CRYPTO_set_locking_callback(fns->lock_fns.lock_locking_cb); \ + CRYPTO_set_add_lock_callback(fns->lock_fns.lock_add_lock_cb); \ + CRYPTO_set_dynlock_create_callback(fns->lock_fns.dynlock_create_cb); \ + CRYPTO_set_dynlock_lock_callback(fns->lock_fns.dynlock_lock_cb); \ + CRYPTO_set_dynlock_destroy_callback(fns->lock_fns.dynlock_destroy_cb); \ + if (!CRYPTO_set_ex_data_implementation(fns->ex_data_fns)) \ + return 0; \ + if (!ERR_set_implementation(fns->err_fns)) \ + return 0; \ + skip_cbs: \ + if (!fn(e, id)) \ + return 0; \ + return 1; \ + } + +/* + * If the loading application (or library) and the loaded ENGINE library + * share the same static data (eg. they're both dynamically linked to the + * same libcrypto.so) we need a way to avoid trying to set system callbacks - + * this would fail, and for the same reason that it's unnecessary to try. If + * the loaded ENGINE has (or gets from through the loader) its own copy of + * the libcrypto static data, we will need to set the callbacks. The easiest + * way to detect this is to have a function that returns a pointer to some + * static data and let the loading application and loaded ENGINE compare + * their respective values. + */ +void* ENGINE_get_static_state(void); + +#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV) +void ENGINE_setup_bsd_cryptodev(void); +#endif + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_ENGINE_strings(void); + +/* Error codes for the ENGINE functions. */ + +/* Function codes. */ +#define ENGINE_F_DYNAMIC_CTRL 180 +#define ENGINE_F_DYNAMIC_GET_DATA_CTX 181 +#define ENGINE_F_DYNAMIC_LOAD 182 +#define ENGINE_F_DYNAMIC_SET_DATA_CTX 183 +#define ENGINE_F_ENGINE_ADD 105 +#define ENGINE_F_ENGINE_BY_ID 106 +#define ENGINE_F_ENGINE_CMD_IS_EXECUTABLE 170 +#define ENGINE_F_ENGINE_CTRL 142 +#define ENGINE_F_ENGINE_CTRL_CMD 178 +#define ENGINE_F_ENGINE_CTRL_CMD_STRING 171 +#define ENGINE_F_ENGINE_FINISH 107 +#define ENGINE_F_ENGINE_FREE_UTIL 108 +#define ENGINE_F_ENGINE_GET_CIPHER 185 +#define ENGINE_F_ENGINE_GET_DEFAULT_TYPE 177 +#define ENGINE_F_ENGINE_GET_DIGEST 186 +#define ENGINE_F_ENGINE_GET_NEXT 115 +#define ENGINE_F_ENGINE_GET_PKEY_ASN1_METH 193 +#define ENGINE_F_ENGINE_GET_PKEY_METH 192 +#define ENGINE_F_ENGINE_GET_PREV 116 +#define ENGINE_F_ENGINE_INIT 119 +#define ENGINE_F_ENGINE_LIST_ADD 120 +#define ENGINE_F_ENGINE_LIST_REMOVE 121 +#define ENGINE_F_ENGINE_LOAD_PRIVATE_KEY 150 +#define ENGINE_F_ENGINE_LOAD_PUBLIC_KEY 151 +#define ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT 194 +#define ENGINE_F_ENGINE_NEW 122 +#define ENGINE_F_ENGINE_REMOVE 123 +#define ENGINE_F_ENGINE_SET_DEFAULT_STRING 189 +#define ENGINE_F_ENGINE_SET_DEFAULT_TYPE 126 +#define ENGINE_F_ENGINE_SET_ID 129 +#define ENGINE_F_ENGINE_SET_NAME 130 +#define ENGINE_F_ENGINE_TABLE_REGISTER 184 +#define ENGINE_F_ENGINE_UNLOAD_KEY 152 +#define ENGINE_F_ENGINE_UNLOCKED_FINISH 191 +#define ENGINE_F_ENGINE_UP_REF 190 +#define ENGINE_F_INT_CTRL_HELPER 172 +#define ENGINE_F_INT_ENGINE_CONFIGURE 188 +#define ENGINE_F_INT_ENGINE_MODULE_INIT 187 +#define ENGINE_F_LOG_MESSAGE 141 + +/* Reason codes. */ +#define ENGINE_R_ALREADY_LOADED 100 +#define ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER 133 +#define ENGINE_R_CMD_NOT_EXECUTABLE 134 +#define ENGINE_R_COMMAND_TAKES_INPUT 135 +#define ENGINE_R_COMMAND_TAKES_NO_INPUT 136 +#define ENGINE_R_CONFLICTING_ENGINE_ID 103 +#define ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED 119 +#define ENGINE_R_DH_NOT_IMPLEMENTED 139 +#define ENGINE_R_DSA_NOT_IMPLEMENTED 140 +#define ENGINE_R_DSO_FAILURE 104 +#define ENGINE_R_DSO_NOT_FOUND 132 +#define ENGINE_R_ENGINES_SECTION_ERROR 148 +#define ENGINE_R_ENGINE_CONFIGURATION_ERROR 102 +#define ENGINE_R_ENGINE_IS_NOT_IN_LIST 105 +#define ENGINE_R_ENGINE_SECTION_ERROR 149 +#define ENGINE_R_FAILED_LOADING_PRIVATE_KEY 128 +#define ENGINE_R_FAILED_LOADING_PUBLIC_KEY 129 +#define ENGINE_R_FINISH_FAILED 106 +#define ENGINE_R_GET_HANDLE_FAILED 107 +#define ENGINE_R_ID_OR_NAME_MISSING 108 +#define ENGINE_R_INIT_FAILED 109 +#define ENGINE_R_INTERNAL_LIST_ERROR 110 +#define ENGINE_R_INVALID_ARGUMENT 143 +#define ENGINE_R_INVALID_CMD_NAME 137 +#define ENGINE_R_INVALID_CMD_NUMBER 138 +#define ENGINE_R_INVALID_INIT_VALUE 151 +#define ENGINE_R_INVALID_STRING 150 +#define ENGINE_R_NOT_INITIALISED 117 +#define ENGINE_R_NOT_LOADED 112 +#define ENGINE_R_NO_CONTROL_FUNCTION 120 +#define ENGINE_R_NO_INDEX 144 +#define ENGINE_R_NO_LOAD_FUNCTION 125 +#define ENGINE_R_NO_REFERENCE 130 +#define ENGINE_R_NO_SUCH_ENGINE 116 +#define ENGINE_R_NO_UNLOAD_FUNCTION 126 +#define ENGINE_R_PROVIDE_PARAMETERS 113 +#define ENGINE_R_RSA_NOT_IMPLEMENTED 141 +#define ENGINE_R_UNIMPLEMENTED_CIPHER 146 +#define ENGINE_R_UNIMPLEMENTED_DIGEST 147 +#define ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD 101 +#define ENGINE_R_VERSION_INCOMPATIBILITY 145 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/err.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/err.h new file mode 100644 index 0000000..e6bd9a3 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/err.h @@ -0,0 +1,408 @@ +/* crypto/err/err.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright (c) 1998-2006 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_ERR_H +#define HEADER_ERR_H + +#include + +#ifndef OPENSSL_NO_FP_API +#include +#include +#endif + +#include +#ifndef OPENSSL_NO_BIO +#include +#endif +#ifndef OPENSSL_NO_LHASH +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef OPENSSL_NO_ERR +#define ERR_PUT_error(a, b, c, d, e) ERR_put_error(a, b, c, d, e) +#else +#define ERR_PUT_error(a, b, c, d, e) ERR_put_error(a, b, c, NULL, 0) +#endif + +#include + +#define ERR_TXT_MALLOCED 0x01 +#define ERR_TXT_STRING 0x02 + +#define ERR_FLAG_MARK 0x01 + +#define ERR_NUM_ERRORS 16 +typedef struct err_state_st { + CRYPTO_THREADID tid; + int err_flags[ERR_NUM_ERRORS]; + unsigned long err_buffer[ERR_NUM_ERRORS]; + char* err_data[ERR_NUM_ERRORS]; + int err_data_flags[ERR_NUM_ERRORS]; + const char* err_file[ERR_NUM_ERRORS]; + int err_line[ERR_NUM_ERRORS]; + int top, bottom; +} ERR_STATE; + +/* library */ +#define ERR_LIB_NONE 1 +#define ERR_LIB_SYS 2 +#define ERR_LIB_BN 3 +#define ERR_LIB_RSA 4 +#define ERR_LIB_DH 5 +#define ERR_LIB_EVP 6 +#define ERR_LIB_BUF 7 +#define ERR_LIB_OBJ 8 +#define ERR_LIB_PEM 9 +#define ERR_LIB_DSA 10 +#define ERR_LIB_X509 11 +/* #define ERR_LIB_METH 12 */ +#define ERR_LIB_ASN1 13 +#define ERR_LIB_CONF 14 +#define ERR_LIB_CRYPTO 15 +#define ERR_LIB_EC 16 +#define ERR_LIB_SSL 20 +/* #define ERR_LIB_SSL23 21 */ +/* #define ERR_LIB_SSL2 22 */ +/* #define ERR_LIB_SSL3 23 */ +/* #define ERR_LIB_RSAREF 30 */ +/* #define ERR_LIB_PROXY 31 */ +#define ERR_LIB_BIO 32 +#define ERR_LIB_PKCS7 33 +#define ERR_LIB_X509V3 34 +#define ERR_LIB_PKCS12 35 +#define ERR_LIB_RAND 36 +#define ERR_LIB_DSO 37 +#define ERR_LIB_ENGINE 38 +#define ERR_LIB_OCSP 39 +#define ERR_LIB_UI 40 +#define ERR_LIB_COMP 41 +#define ERR_LIB_ECDSA 42 +#define ERR_LIB_ECDH 43 +#define ERR_LIB_STORE 44 +#define ERR_LIB_FIPS 45 +#define ERR_LIB_CMS 46 +#define ERR_LIB_TS 47 +#define ERR_LIB_HMAC 48 +#define ERR_LIB_JPAKE 49 + +#define ERR_LIB_USER 128 + +#define SYSerr(f, r) ERR_PUT_error(ERR_LIB_SYS, (f), (r), __FILE__, __LINE__) +#define BNerr(f, r) ERR_PUT_error(ERR_LIB_BN, (f), (r), __FILE__, __LINE__) +#define RSAerr(f, r) ERR_PUT_error(ERR_LIB_RSA, (f), (r), __FILE__, __LINE__) +#define DHerr(f, r) ERR_PUT_error(ERR_LIB_DH, (f), (r), __FILE__, __LINE__) +#define EVPerr(f, r) ERR_PUT_error(ERR_LIB_EVP, (f), (r), __FILE__, __LINE__) +#define BUFerr(f, r) ERR_PUT_error(ERR_LIB_BUF, (f), (r), __FILE__, __LINE__) +#define OBJerr(f, r) ERR_PUT_error(ERR_LIB_OBJ, (f), (r), __FILE__, __LINE__) +#define PEMerr(f, r) ERR_PUT_error(ERR_LIB_PEM, (f), (r), __FILE__, __LINE__) +#define DSAerr(f, r) ERR_PUT_error(ERR_LIB_DSA, (f), (r), __FILE__, __LINE__) +#define X509err(f, r) ERR_PUT_error(ERR_LIB_X509, (f), (r), __FILE__, __LINE__) +#define ASN1err(f, r) ERR_PUT_error(ERR_LIB_ASN1, (f), (r), __FILE__, __LINE__) +#define CONFerr(f, r) ERR_PUT_error(ERR_LIB_CONF, (f), (r), __FILE__, __LINE__) +#define CRYPTOerr(f, r) \ + ERR_PUT_error(ERR_LIB_CRYPTO, (f), (r), __FILE__, __LINE__) +#define ECerr(f, r) ERR_PUT_error(ERR_LIB_EC, (f), (r), __FILE__, __LINE__) +#define SSLerr(f, r) ERR_PUT_error(ERR_LIB_SSL, (f), (r), __FILE__, __LINE__) +#define BIOerr(f, r) ERR_PUT_error(ERR_LIB_BIO, (f), (r), __FILE__, __LINE__) +#define PKCS7err(f, r) \ + ERR_PUT_error(ERR_LIB_PKCS7, (f), (r), __FILE__, __LINE__) +#define X509V3err(f, r) \ + ERR_PUT_error(ERR_LIB_X509V3, (f), (r), __FILE__, __LINE__) +#define PKCS12err(f, r) \ + ERR_PUT_error(ERR_LIB_PKCS12, (f), (r), __FILE__, __LINE__) +#define RANDerr(f, r) ERR_PUT_error(ERR_LIB_RAND, (f), (r), __FILE__, __LINE__) +#define DSOerr(f, r) ERR_PUT_error(ERR_LIB_DSO, (f), (r), __FILE__, __LINE__) +#define ENGINEerr(f, r) \ + ERR_PUT_error(ERR_LIB_ENGINE, (f), (r), __FILE__, __LINE__) +#define OCSPerr(f, r) ERR_PUT_error(ERR_LIB_OCSP, (f), (r), __FILE__, __LINE__) +#define UIerr(f, r) ERR_PUT_error(ERR_LIB_UI, (f), (r), __FILE__, __LINE__) +#define COMPerr(f, r) ERR_PUT_error(ERR_LIB_COMP, (f), (r), __FILE__, __LINE__) +#define ECDSAerr(f, r) \ + ERR_PUT_error(ERR_LIB_ECDSA, (f), (r), __FILE__, __LINE__) +#define ECDHerr(f, r) ERR_PUT_error(ERR_LIB_ECDH, (f), (r), __FILE__, __LINE__) +#define STOREerr(f, r) \ + ERR_PUT_error(ERR_LIB_STORE, (f), (r), __FILE__, __LINE__) +#define FIPSerr(f, r) ERR_PUT_error(ERR_LIB_FIPS, (f), (r), __FILE__, __LINE__) +#define CMSerr(f, r) ERR_PUT_error(ERR_LIB_CMS, (f), (r), __FILE__, __LINE__) +#define TSerr(f, r) ERR_PUT_error(ERR_LIB_TS, (f), (r), __FILE__, __LINE__) +#define HMACerr(f, r) ERR_PUT_error(ERR_LIB_HMAC, (f), (r), __FILE__, __LINE__) +#define JPAKEerr(f, r) \ + ERR_PUT_error(ERR_LIB_JPAKE, (f), (r), __FILE__, __LINE__) + +/* + * Borland C seems too stupid to be able to shift and do longs in the + * pre-processor :-( + */ +#define ERR_PACK(l, f, r) \ + (((((unsigned long)l) & 0xffL) * 0x1000000) | \ + ((((unsigned long)f) & 0xfffL) * 0x1000) | ((((unsigned long)r) & 0xfffL))) +#define ERR_GET_LIB(l) (int)((((unsigned long)l) >> 24L) & 0xffL) +#define ERR_GET_FUNC(l) (int)((((unsigned long)l) >> 12L) & 0xfffL) +#define ERR_GET_REASON(l) (int)((l)&0xfffL) +#define ERR_FATAL_ERROR(l) (int)((l)&ERR_R_FATAL) + +/* OS functions */ +#define SYS_F_FOPEN 1 +#define SYS_F_CONNECT 2 +#define SYS_F_GETSERVBYNAME 3 +#define SYS_F_SOCKET 4 +#define SYS_F_IOCTLSOCKET 5 +#define SYS_F_BIND 6 +#define SYS_F_LISTEN 7 +#define SYS_F_ACCEPT 8 +#define SYS_F_WSASTARTUP 9 /* Winsock stuff */ +#define SYS_F_OPENDIR 10 +#define SYS_F_FREAD 11 +#define SYS_F_FFLUSH 18 + +/* reasons */ +#define ERR_R_SYS_LIB ERR_LIB_SYS /* 2 */ +#define ERR_R_BN_LIB ERR_LIB_BN /* 3 */ +#define ERR_R_RSA_LIB ERR_LIB_RSA /* 4 */ +#define ERR_R_DH_LIB ERR_LIB_DH /* 5 */ +#define ERR_R_EVP_LIB ERR_LIB_EVP /* 6 */ +#define ERR_R_BUF_LIB ERR_LIB_BUF /* 7 */ +#define ERR_R_OBJ_LIB ERR_LIB_OBJ /* 8 */ +#define ERR_R_PEM_LIB ERR_LIB_PEM /* 9 */ +#define ERR_R_DSA_LIB ERR_LIB_DSA /* 10 */ +#define ERR_R_X509_LIB ERR_LIB_X509 /* 11 */ +#define ERR_R_ASN1_LIB ERR_LIB_ASN1 /* 13 */ +#define ERR_R_CONF_LIB ERR_LIB_CONF /* 14 */ +#define ERR_R_CRYPTO_LIB ERR_LIB_CRYPTO /* 15 */ +#define ERR_R_EC_LIB ERR_LIB_EC /* 16 */ +#define ERR_R_SSL_LIB ERR_LIB_SSL /* 20 */ +#define ERR_R_BIO_LIB ERR_LIB_BIO /* 32 */ +#define ERR_R_PKCS7_LIB ERR_LIB_PKCS7 /* 33 */ +#define ERR_R_X509V3_LIB ERR_LIB_X509V3 /* 34 */ +#define ERR_R_PKCS12_LIB ERR_LIB_PKCS12 /* 35 */ +#define ERR_R_RAND_LIB ERR_LIB_RAND /* 36 */ +#define ERR_R_DSO_LIB ERR_LIB_DSO /* 37 */ +#define ERR_R_ENGINE_LIB ERR_LIB_ENGINE /* 38 */ +#define ERR_R_OCSP_LIB ERR_LIB_OCSP /* 39 */ +#define ERR_R_UI_LIB ERR_LIB_UI /* 40 */ +#define ERR_R_COMP_LIB ERR_LIB_COMP /* 41 */ +#define ERR_R_ECDSA_LIB ERR_LIB_ECDSA /* 42 */ +#define ERR_R_ECDH_LIB ERR_LIB_ECDH /* 43 */ +#define ERR_R_STORE_LIB ERR_LIB_STORE /* 44 */ +#define ERR_R_TS_LIB ERR_LIB_TS /* 45 */ + +#define ERR_R_NESTED_ASN1_ERROR 58 +#define ERR_R_BAD_ASN1_OBJECT_HEADER 59 +#define ERR_R_BAD_GET_ASN1_OBJECT_CALL 60 +#define ERR_R_EXPECTING_AN_ASN1_SEQUENCE 61 +#define ERR_R_ASN1_LENGTH_MISMATCH 62 +#define ERR_R_MISSING_ASN1_EOS 63 + +/* fatal error */ +#define ERR_R_FATAL 64 +#define ERR_R_MALLOC_FAILURE (1 | ERR_R_FATAL) +#define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2 | ERR_R_FATAL) +#define ERR_R_PASSED_NULL_PARAMETER (3 | ERR_R_FATAL) +#define ERR_R_INTERNAL_ERROR (4 | ERR_R_FATAL) +#define ERR_R_DISABLED (5 | ERR_R_FATAL) + +/* + * 99 is the maximum possible ERR_R_... code, higher values are reserved for + * the individual libraries + */ + +typedef struct ERR_string_data_st { + unsigned long error; + const char* string; +} ERR_STRING_DATA; + +void ERR_put_error(int lib, int func, int reason, const char* file, int line); +void ERR_set_error_data(char* data, int flags); + +unsigned long ERR_get_error(void); +unsigned long ERR_get_error_line(const char** file, int* line); +unsigned long ERR_get_error_line_data( + const char** file, + int* line, + const char** data, + int* flags); +unsigned long ERR_peek_error(void); +unsigned long ERR_peek_error_line(const char** file, int* line); +unsigned long ERR_peek_error_line_data( + const char** file, + int* line, + const char** data, + int* flags); +unsigned long ERR_peek_last_error(void); +unsigned long ERR_peek_last_error_line(const char** file, int* line); +unsigned long ERR_peek_last_error_line_data( + const char** file, + int* line, + const char** data, + int* flags); +void ERR_clear_error(void); +char* ERR_error_string(unsigned long e, char* buf); +void ERR_error_string_n(unsigned long e, char* buf, size_t len); +const char* ERR_lib_error_string(unsigned long e); +const char* ERR_func_error_string(unsigned long e); +const char* ERR_reason_error_string(unsigned long e); +void ERR_print_errors_cb( + int (*cb)(const char* str, size_t len, void* u), + void* u); +#ifndef OPENSSL_NO_FP_API +void ERR_print_errors_fp(FILE* fp); +#endif +#ifndef OPENSSL_NO_BIO +void ERR_print_errors(BIO* bp); +#endif +void ERR_add_error_data(int num, ...); +void ERR_add_error_vdata(int num, va_list args); +void ERR_load_strings(int lib, ERR_STRING_DATA str[]); +void ERR_unload_strings(int lib, ERR_STRING_DATA str[]); +void ERR_load_ERR_strings(void); +void ERR_load_crypto_strings(void); +void ERR_free_strings(void); + +void ERR_remove_thread_state(const CRYPTO_THREADID* tid); +#ifndef OPENSSL_NO_DEPRECATED +void ERR_remove_state(unsigned long pid); /* if zero we look it up */ +#endif +ERR_STATE* ERR_get_state(void); + +#ifndef OPENSSL_NO_LHASH +LHASH_OF(ERR_STRING_DATA) * ERR_get_string_table(void); +LHASH_OF(ERR_STATE) * ERR_get_err_state_table(void); +void ERR_release_err_state_table(LHASH_OF(ERR_STATE) * *hash); +#endif + +int ERR_get_next_error_library(void); + +int ERR_set_mark(void); +int ERR_pop_to_mark(void); + +/* Already defined in ossl_typ.h */ +/* typedef struct st_ERR_FNS ERR_FNS; */ +/* + * An application can use this function and provide the return value to + * loaded modules that should use the application's ERR state/functionality + */ +const ERR_FNS* ERR_get_implementation(void); +/* + * A loaded module should call this function prior to any ERR operations + * using the application's "ERR_FNS". + */ +int ERR_set_implementation(const ERR_FNS* fns); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/evp.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/evp.h new file mode 100644 index 0000000..8284e18 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/evp.h @@ -0,0 +1,1838 @@ +/* crypto/evp/evp.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_ENVELOPE_H +#define HEADER_ENVELOPE_H + +#ifdef OPENSSL_ALGORITHM_DEFINES +#include +#else +#define OPENSSL_ALGORITHM_DEFINES +#include +#undef OPENSSL_ALGORITHM_DEFINES +#endif + +#include + +#include + +#ifndef OPENSSL_NO_BIO +#include +#endif + +/*- +#define EVP_RC2_KEY_SIZE 16 +#define EVP_RC4_KEY_SIZE 16 +#define EVP_BLOWFISH_KEY_SIZE 16 +#define EVP_CAST5_KEY_SIZE 16 +#define EVP_RC5_32_12_16_KEY_SIZE 16 +*/ +#define EVP_MAX_MD_SIZE 64 /* longest known is SHA512 */ +#define EVP_MAX_KEY_LENGTH 64 +#define EVP_MAX_IV_LENGTH 16 +#define EVP_MAX_BLOCK_LENGTH 32 + +#define PKCS5_SALT_LEN 8 +/* Default PKCS#5 iteration count */ +#define PKCS5_DEFAULT_ITER 2048 + +#include + +#define EVP_PK_RSA 0x0001 +#define EVP_PK_DSA 0x0002 +#define EVP_PK_DH 0x0004 +#define EVP_PK_EC 0x0008 +#define EVP_PKT_SIGN 0x0010 +#define EVP_PKT_ENC 0x0020 +#define EVP_PKT_EXCH 0x0040 +#define EVP_PKS_RSA 0x0100 +#define EVP_PKS_DSA 0x0200 +#define EVP_PKS_EC 0x0400 + +#define EVP_PKEY_NONE NID_undef +#define EVP_PKEY_RSA NID_rsaEncryption +#define EVP_PKEY_RSA2 NID_rsa +#define EVP_PKEY_DSA NID_dsa +#define EVP_PKEY_DSA1 NID_dsa_2 +#define EVP_PKEY_DSA2 NID_dsaWithSHA +#define EVP_PKEY_DSA3 NID_dsaWithSHA1 +#define EVP_PKEY_DSA4 NID_dsaWithSHA1_2 +#define EVP_PKEY_DH NID_dhKeyAgreement +#define EVP_PKEY_DHX NID_dhpublicnumber +#define EVP_PKEY_EC NID_X9_62_id_ecPublicKey +#define EVP_PKEY_HMAC NID_hmac +#define EVP_PKEY_CMAC NID_cmac + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Type needs to be a bit field Sub-type needs to be for variations on the + * method, as in, can it do arbitrary encryption.... + */ +struct evp_pkey_st { + int type; + int save_type; + int references; + const EVP_PKEY_ASN1_METHOD* ameth; + ENGINE* engine; + union { + char* ptr; +#ifndef OPENSSL_NO_RSA + struct rsa_st* rsa; /* RSA */ +#endif +#ifndef OPENSSL_NO_DSA + struct dsa_st* dsa; /* DSA */ +#endif +#ifndef OPENSSL_NO_DH + struct dh_st* dh; /* DH */ +#endif +#ifndef OPENSSL_NO_EC + struct ec_key_st* ec; /* ECC */ +#endif + } pkey; + int save_parameters; + STACK_OF(X509_ATTRIBUTE) * attributes; /* [ 0 ] */ +} /* EVP_PKEY */; + +#define EVP_PKEY_MO_SIGN 0x0001 +#define EVP_PKEY_MO_VERIFY 0x0002 +#define EVP_PKEY_MO_ENCRYPT 0x0004 +#define EVP_PKEY_MO_DECRYPT 0x0008 + +#ifndef EVP_MD +struct env_md_st { + int type; + int pkey_type; + int md_size; + unsigned long flags; + int (*init)(EVP_MD_CTX* ctx); + int (*update)(EVP_MD_CTX* ctx, const void* data, size_t count); + int (* final)(EVP_MD_CTX* ctx, unsigned char* md); + int (*copy)(EVP_MD_CTX* to, const EVP_MD_CTX* from); + int (*cleanup)(EVP_MD_CTX* ctx); + /* FIXME: prototype these some day */ + int (*sign)( + int type, + const unsigned char* m, + unsigned int m_length, + unsigned char* sigret, + unsigned int* siglen, + void* key); + int (*verify)( + int type, + const unsigned char* m, + unsigned int m_length, + const unsigned char* sigbuf, + unsigned int siglen, + void* key); + int required_pkey_type[5]; /* EVP_PKEY_xxx */ + int block_size; + int ctx_size; /* how big does the ctx->md_data need to be */ + /* control function */ + int (*md_ctrl)(EVP_MD_CTX* ctx, int cmd, int p1, void* p2); +} /* EVP_MD */; + +typedef int evp_sign_method( + int type, + const unsigned char* m, + unsigned int m_length, + unsigned char* sigret, + unsigned int* siglen, + void* key); +typedef int evp_verify_method( + int type, + const unsigned char* m, + unsigned int m_length, + const unsigned char* sigbuf, + unsigned int siglen, + void* key); + +/* digest can only handle a single block */ +#define EVP_MD_FLAG_ONESHOT 0x0001 + +/* + * digest is a "clone" digest used + * which is a copy of an existing + * one for a specific public key type. + * EVP_dss1() etc + */ +#define EVP_MD_FLAG_PKEY_DIGEST 0x0002 + +/* Digest uses EVP_PKEY_METHOD for signing instead of MD specific signing */ + +#define EVP_MD_FLAG_PKEY_METHOD_SIGNATURE 0x0004 + +/* DigestAlgorithmIdentifier flags... */ + +#define EVP_MD_FLAG_DIGALGID_MASK 0x0018 + +/* NULL or absent parameter accepted. Use NULL */ + +#define EVP_MD_FLAG_DIGALGID_NULL 0x0000 + +/* NULL or absent parameter accepted. Use NULL for PKCS#1 otherwise absent */ + +#define EVP_MD_FLAG_DIGALGID_ABSENT 0x0008 + +/* Custom handling via ctrl */ + +#define EVP_MD_FLAG_DIGALGID_CUSTOM 0x0018 + +/* Note if suitable for use in FIPS mode */ +#define EVP_MD_FLAG_FIPS 0x0400 + +/* Digest ctrls */ + +#define EVP_MD_CTRL_DIGALGID 0x1 +#define EVP_MD_CTRL_MICALG 0x2 + +/* Minimum Algorithm specific ctrl value */ + +#define EVP_MD_CTRL_ALG_CTRL 0x1000 + +#define EVP_PKEY_NULL_method \ + NULL, NULL, { \ + 0, 0, 0, 0 \ + } + +#ifndef OPENSSL_NO_DSA +#define EVP_PKEY_DSA_method \ + (evp_sign_method*)DSA_sign, (evp_verify_method*)DSA_verify, { \ + EVP_PKEY_DSA, EVP_PKEY_DSA2, EVP_PKEY_DSA3, EVP_PKEY_DSA4, 0 \ + } +#else +#define EVP_PKEY_DSA_method EVP_PKEY_NULL_method +#endif + +#ifndef OPENSSL_NO_ECDSA +#define EVP_PKEY_ECDSA_method \ + (evp_sign_method*)ECDSA_sign, (evp_verify_method*)ECDSA_verify, { \ + EVP_PKEY_EC, 0, 0, 0 \ + } +#else +#define EVP_PKEY_ECDSA_method EVP_PKEY_NULL_method +#endif + +#ifndef OPENSSL_NO_RSA +#define EVP_PKEY_RSA_method \ + (evp_sign_method*)RSA_sign, (evp_verify_method*)RSA_verify, { \ + EVP_PKEY_RSA, EVP_PKEY_RSA2, 0, 0 \ + } +#define EVP_PKEY_RSA_ASN1_OCTET_STRING_method \ + (evp_sign_method*)RSA_sign_ASN1_OCTET_STRING, \ + (evp_verify_method*)RSA_verify_ASN1_OCTET_STRING, { \ + EVP_PKEY_RSA, EVP_PKEY_RSA2, 0, 0 \ + } +#else +#define EVP_PKEY_RSA_method EVP_PKEY_NULL_method +#define EVP_PKEY_RSA_ASN1_OCTET_STRING_method EVP_PKEY_NULL_method +#endif + +#endif /* !EVP_MD */ + +struct env_md_ctx_st { + const EVP_MD* digest; + ENGINE* engine; /* functional reference if 'digest' is + * ENGINE-provided */ + unsigned long flags; + void* md_data; + /* Public key context for sign/verify */ + EVP_PKEY_CTX* pctx; + /* Update function: usually copied from EVP_MD */ + int (*update)(EVP_MD_CTX* ctx, const void* data, size_t count); +} /* EVP_MD_CTX */; + +/* values for EVP_MD_CTX flags */ + +#define EVP_MD_CTX_FLAG_ONESHOT \ + 0x0001 /* digest update will be \ + * called once only */ +#define EVP_MD_CTX_FLAG_CLEANED \ + 0x0002 /* context has already been \ + * cleaned */ +#define EVP_MD_CTX_FLAG_REUSE \ + 0x0004 /* Don't free up ctx->md_data \ + * in EVP_MD_CTX_cleanup */ +/* + * FIPS and pad options are ignored in 1.0.0, definitions are here so we + * don't accidentally reuse the values for other purposes. + */ + +#define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW \ + 0x0008 /* Allow use of non FIPS \ + * digest in FIPS mode */ + +/* + * The following PAD options are also currently ignored in 1.0.0, digest + * parameters are handled through EVP_DigestSign*() and EVP_DigestVerify*() + * instead. + */ +#define EVP_MD_CTX_FLAG_PAD_MASK 0xF0 /* RSA mode to use */ +#define EVP_MD_CTX_FLAG_PAD_PKCS1 0x00 /* PKCS#1 v1.5 mode */ +#define EVP_MD_CTX_FLAG_PAD_X931 0x10 /* X9.31 mode */ +#define EVP_MD_CTX_FLAG_PAD_PSS 0x20 /* PSS mode */ + +#define EVP_MD_CTX_FLAG_NO_INIT 0x0100 /* Don't initialize md_data */ + +struct evp_cipher_st { + int nid; + int block_size; + /* Default value for variable length ciphers */ + int key_len; + int iv_len; + /* Various flags */ + unsigned long flags; + /* init key */ + int (*init)( + EVP_CIPHER_CTX* ctx, + const unsigned char* key, + const unsigned char* iv, + int enc); + /* encrypt/decrypt data */ + int (*do_cipher)( + EVP_CIPHER_CTX* ctx, + unsigned char* out, + const unsigned char* in, + size_t inl); + /* cleanup ctx */ + int (*cleanup)(EVP_CIPHER_CTX*); + /* how big ctx->cipher_data needs to be */ + int ctx_size; + /* Populate a ASN1_TYPE with parameters */ + int (*set_asn1_parameters)(EVP_CIPHER_CTX*, ASN1_TYPE*); + /* Get parameters from a ASN1_TYPE */ + int (*get_asn1_parameters)(EVP_CIPHER_CTX*, ASN1_TYPE*); + /* Miscellaneous operations */ + int (*ctrl)(EVP_CIPHER_CTX*, int type, int arg, void* ptr); + /* Application data */ + void* app_data; +} /* EVP_CIPHER */; + +/* Values for cipher flags */ + +/* Modes for ciphers */ + +#define EVP_CIPH_STREAM_CIPHER 0x0 +#define EVP_CIPH_ECB_MODE 0x1 +#define EVP_CIPH_CBC_MODE 0x2 +#define EVP_CIPH_CFB_MODE 0x3 +#define EVP_CIPH_OFB_MODE 0x4 +#define EVP_CIPH_CTR_MODE 0x5 +#define EVP_CIPH_GCM_MODE 0x6 +#define EVP_CIPH_CCM_MODE 0x7 +#define EVP_CIPH_XTS_MODE 0x10001 +#define EVP_CIPH_WRAP_MODE 0x10002 +#define EVP_CIPH_MODE 0xF0007 +/* Set if variable length cipher */ +#define EVP_CIPH_VARIABLE_LENGTH 0x8 +/* Set if the iv handling should be done by the cipher itself */ +#define EVP_CIPH_CUSTOM_IV 0x10 +/* Set if the cipher's init() function should be called if key is NULL */ +#define EVP_CIPH_ALWAYS_CALL_INIT 0x20 +/* Call ctrl() to init cipher parameters */ +#define EVP_CIPH_CTRL_INIT 0x40 +/* Don't use standard key length function */ +#define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80 +/* Don't use standard block padding */ +#define EVP_CIPH_NO_PADDING 0x100 +/* cipher handles random key generation */ +#define EVP_CIPH_RAND_KEY 0x200 +/* cipher has its own additional copying logic */ +#define EVP_CIPH_CUSTOM_COPY 0x400 +/* Allow use default ASN1 get/set iv */ +#define EVP_CIPH_FLAG_DEFAULT_ASN1 0x1000 +/* Buffer length in bits not bytes: CFB1 mode only */ +#define EVP_CIPH_FLAG_LENGTH_BITS 0x2000 +/* Note if suitable for use in FIPS mode */ +#define EVP_CIPH_FLAG_FIPS 0x4000 +/* Allow non FIPS cipher in FIPS mode */ +#define EVP_CIPH_FLAG_NON_FIPS_ALLOW 0x8000 +/* + * Cipher handles any and all padding logic as well as finalisation. + */ +#define EVP_CIPH_FLAG_CUSTOM_CIPHER 0x100000 +#define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000 +#define EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK 0x400000 + +/* + * Cipher context flag to indicate we can handle wrap mode: if allowed in + * older applications it could overflow buffers. + */ + +#define EVP_CIPHER_CTX_FLAG_WRAP_ALLOW 0x1 + +/* ctrl() values */ + +#define EVP_CTRL_INIT 0x0 +#define EVP_CTRL_SET_KEY_LENGTH 0x1 +#define EVP_CTRL_GET_RC2_KEY_BITS 0x2 +#define EVP_CTRL_SET_RC2_KEY_BITS 0x3 +#define EVP_CTRL_GET_RC5_ROUNDS 0x4 +#define EVP_CTRL_SET_RC5_ROUNDS 0x5 +#define EVP_CTRL_RAND_KEY 0x6 +#define EVP_CTRL_PBE_PRF_NID 0x7 +#define EVP_CTRL_COPY 0x8 +#define EVP_CTRL_GCM_SET_IVLEN 0x9 +#define EVP_CTRL_GCM_GET_TAG 0x10 +#define EVP_CTRL_GCM_SET_TAG 0x11 +#define EVP_CTRL_GCM_SET_IV_FIXED 0x12 +#define EVP_CTRL_GCM_IV_GEN 0x13 +#define EVP_CTRL_CCM_SET_IVLEN EVP_CTRL_GCM_SET_IVLEN +#define EVP_CTRL_CCM_GET_TAG EVP_CTRL_GCM_GET_TAG +#define EVP_CTRL_CCM_SET_TAG EVP_CTRL_GCM_SET_TAG +#define EVP_CTRL_CCM_SET_L 0x14 +#define EVP_CTRL_CCM_SET_MSGLEN 0x15 +/* + * AEAD cipher deduces payload length and returns number of bytes required to + * store MAC and eventual padding. Subsequent call to EVP_Cipher even + * appends/verifies MAC. + */ +#define EVP_CTRL_AEAD_TLS1_AAD 0x16 +/* Used by composite AEAD ciphers, no-op in GCM, CCM... */ +#define EVP_CTRL_AEAD_SET_MAC_KEY 0x17 +/* Set the GCM invocation field, decrypt only */ +#define EVP_CTRL_GCM_SET_IV_INV 0x18 + +#define EVP_CTRL_TLS1_1_MULTIBLOCK_AAD 0x19 +#define EVP_CTRL_TLS1_1_MULTIBLOCK_ENCRYPT 0x1a +#define EVP_CTRL_TLS1_1_MULTIBLOCK_DECRYPT 0x1b +#define EVP_CTRL_TLS1_1_MULTIBLOCK_MAX_BUFSIZE 0x1c + +/* RFC 5246 defines additional data to be 13 bytes in length */ +#define EVP_AEAD_TLS1_AAD_LEN 13 + +typedef struct { + unsigned char* out; + const unsigned char* inp; + size_t len; + unsigned int interleave; +} EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM; + +/* GCM TLS constants */ +/* Length of fixed part of IV derived from PRF */ +#define EVP_GCM_TLS_FIXED_IV_LEN 4 +/* Length of explicit part of IV part of TLS records */ +#define EVP_GCM_TLS_EXPLICIT_IV_LEN 8 +/* Length of tag for TLS */ +#define EVP_GCM_TLS_TAG_LEN 16 + +typedef struct evp_cipher_info_st { + const EVP_CIPHER* cipher; + unsigned char iv[EVP_MAX_IV_LENGTH]; +} EVP_CIPHER_INFO; + +struct evp_cipher_ctx_st { + const EVP_CIPHER* cipher; + ENGINE* engine; /* functional reference if 'cipher' is + * ENGINE-provided */ + int encrypt; /* encrypt or decrypt */ + int buf_len; /* number we have left */ + unsigned char oiv[EVP_MAX_IV_LENGTH]; /* original iv */ + unsigned char iv[EVP_MAX_IV_LENGTH]; /* working iv */ + unsigned char buf[EVP_MAX_BLOCK_LENGTH]; /* saved partial block */ + int num; /* used by cfb/ofb/ctr mode */ + void* app_data; /* application stuff */ + int key_len; /* May change for variable length cipher */ + unsigned long flags; /* Various flags */ + void* cipher_data; /* per EVP data */ + int final_used; + int block_mask; + unsigned char final[EVP_MAX_BLOCK_LENGTH]; /* possible final block */ +} /* EVP_CIPHER_CTX */; + +typedef struct evp_Encode_Ctx_st { + /* number saved in a partial encode/decode */ + int num; + /* + * The length is either the output line length (in input bytes) or the + * shortest input line length that is ok. Once decoding begins, the + * length is adjusted up each time a longer line is decoded + */ + int length; + /* data to encode */ + unsigned char enc_data[80]; + /* number read on current line */ + int line_num; + int expect_nl; +} EVP_ENCODE_CTX; + +/* Password based encryption function */ +typedef int(EVP_PBE_KEYGEN)( + EVP_CIPHER_CTX* ctx, + const char* pass, + int passlen, + ASN1_TYPE* param, + const EVP_CIPHER* cipher, + const EVP_MD* md, + int en_de); + +#ifndef OPENSSL_NO_RSA +#define EVP_PKEY_assign_RSA(pkey, rsa) \ + EVP_PKEY_assign((pkey), EVP_PKEY_RSA, (char*)(rsa)) +#endif + +#ifndef OPENSSL_NO_DSA +#define EVP_PKEY_assign_DSA(pkey, dsa) \ + EVP_PKEY_assign((pkey), EVP_PKEY_DSA, (char*)(dsa)) +#endif + +#ifndef OPENSSL_NO_DH +#define EVP_PKEY_assign_DH(pkey, dh) \ + EVP_PKEY_assign((pkey), EVP_PKEY_DH, (char*)(dh)) +#endif + +#ifndef OPENSSL_NO_EC +#define EVP_PKEY_assign_EC_KEY(pkey, eckey) \ + EVP_PKEY_assign((pkey), EVP_PKEY_EC, (char*)(eckey)) +#endif + +/* Add some extra combinations */ +#define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a)) +#define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a)) +#define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) +#define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a)) + +int EVP_MD_type(const EVP_MD* md); +#define EVP_MD_nid(e) EVP_MD_type(e) +#define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e)) +int EVP_MD_pkey_type(const EVP_MD* md); +int EVP_MD_size(const EVP_MD* md); +int EVP_MD_block_size(const EVP_MD* md); +unsigned long EVP_MD_flags(const EVP_MD* md); + +const EVP_MD* EVP_MD_CTX_md(const EVP_MD_CTX* ctx); +#define EVP_MD_CTX_size(e) EVP_MD_size(EVP_MD_CTX_md(e)) +#define EVP_MD_CTX_block_size(e) EVP_MD_block_size(EVP_MD_CTX_md(e)) +#define EVP_MD_CTX_type(e) EVP_MD_type(EVP_MD_CTX_md(e)) + +int EVP_CIPHER_nid(const EVP_CIPHER* cipher); +#define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e)) +int EVP_CIPHER_block_size(const EVP_CIPHER* cipher); +int EVP_CIPHER_key_length(const EVP_CIPHER* cipher); +int EVP_CIPHER_iv_length(const EVP_CIPHER* cipher); +unsigned long EVP_CIPHER_flags(const EVP_CIPHER* cipher); +#define EVP_CIPHER_mode(e) (EVP_CIPHER_flags(e) & EVP_CIPH_MODE) + +const EVP_CIPHER* EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX* ctx); +int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX* ctx); +int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX* ctx); +int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX* ctx); +int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX* ctx); +int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX* out, const EVP_CIPHER_CTX* in); +void* EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX* ctx); +void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX* ctx, void* data); +#define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) +unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX* ctx); +#define EVP_CIPHER_CTX_mode(e) (EVP_CIPHER_CTX_flags(e) & EVP_CIPH_MODE) + +#define EVP_ENCODE_LENGTH(l) (((l + 2) / 3 * 4) + (l / 48 + 1) * 2 + 80) +#define EVP_DECODE_LENGTH(l) ((l + 3) / 4 * 3 + 80) + +#define EVP_SignInit_ex(a, b, c) EVP_DigestInit_ex(a, b, c) +#define EVP_SignInit(a, b) EVP_DigestInit(a, b) +#define EVP_SignUpdate(a, b, c) EVP_DigestUpdate(a, b, c) +#define EVP_VerifyInit_ex(a, b, c) EVP_DigestInit_ex(a, b, c) +#define EVP_VerifyInit(a, b) EVP_DigestInit(a, b) +#define EVP_VerifyUpdate(a, b, c) EVP_DigestUpdate(a, b, c) +#define EVP_OpenUpdate(a, b, c, d, e) EVP_DecryptUpdate(a, b, c, d, e) +#define EVP_SealUpdate(a, b, c, d, e) EVP_EncryptUpdate(a, b, c, d, e) +#define EVP_DigestSignUpdate(a, b, c) EVP_DigestUpdate(a, b, c) +#define EVP_DigestVerifyUpdate(a, b, c) EVP_DigestUpdate(a, b, c) + +#ifdef CONST_STRICT +void BIO_set_md(BIO*, const EVP_MD* md); +#else +#define BIO_set_md(b, md) BIO_ctrl(b, BIO_C_SET_MD, 0, (char*)md) +#endif +#define BIO_get_md(b, mdp) BIO_ctrl(b, BIO_C_GET_MD, 0, (char*)mdp) +#define BIO_get_md_ctx(b, mdcp) BIO_ctrl(b, BIO_C_GET_MD_CTX, 0, (char*)mdcp) +#define BIO_set_md_ctx(b, mdcp) BIO_ctrl(b, BIO_C_SET_MD_CTX, 0, (char*)mdcp) +#define BIO_get_cipher_status(b) BIO_ctrl(b, BIO_C_GET_CIPHER_STATUS, 0, NULL) +#define BIO_get_cipher_ctx(b, c_pp) \ + BIO_ctrl(b, BIO_C_GET_CIPHER_CTX, 0, (char*)c_pp) + +int EVP_Cipher( + EVP_CIPHER_CTX* c, + unsigned char* out, + const unsigned char* in, + unsigned int inl); + +#define EVP_add_cipher_alias(n, alias) \ + OBJ_NAME_add((alias), OBJ_NAME_TYPE_CIPHER_METH | OBJ_NAME_ALIAS, (n)) +#define EVP_add_digest_alias(n, alias) \ + OBJ_NAME_add((alias), OBJ_NAME_TYPE_MD_METH | OBJ_NAME_ALIAS, (n)) +#define EVP_delete_cipher_alias(alias) \ + OBJ_NAME_remove(alias, OBJ_NAME_TYPE_CIPHER_METH | OBJ_NAME_ALIAS); +#define EVP_delete_digest_alias(alias) \ + OBJ_NAME_remove(alias, OBJ_NAME_TYPE_MD_METH | OBJ_NAME_ALIAS); + +void EVP_MD_CTX_init(EVP_MD_CTX* ctx); +int EVP_MD_CTX_cleanup(EVP_MD_CTX* ctx); +EVP_MD_CTX* EVP_MD_CTX_create(void); +void EVP_MD_CTX_destroy(EVP_MD_CTX* ctx); +int EVP_MD_CTX_copy_ex(EVP_MD_CTX* out, const EVP_MD_CTX* in); +void EVP_MD_CTX_set_flags(EVP_MD_CTX* ctx, int flags); +void EVP_MD_CTX_clear_flags(EVP_MD_CTX* ctx, int flags); +int EVP_MD_CTX_test_flags(const EVP_MD_CTX* ctx, int flags); +int EVP_DigestInit_ex(EVP_MD_CTX* ctx, const EVP_MD* type, ENGINE* impl); +int EVP_DigestUpdate(EVP_MD_CTX* ctx, const void* d, size_t cnt); +int EVP_DigestFinal_ex(EVP_MD_CTX* ctx, unsigned char* md, unsigned int* s); +int EVP_Digest( + const void* data, + size_t count, + unsigned char* md, + unsigned int* size, + const EVP_MD* type, + ENGINE* impl); + +int EVP_MD_CTX_copy(EVP_MD_CTX* out, const EVP_MD_CTX* in); +int EVP_DigestInit(EVP_MD_CTX* ctx, const EVP_MD* type); +int EVP_DigestFinal(EVP_MD_CTX* ctx, unsigned char* md, unsigned int* s); + +int EVP_read_pw_string(char* buf, int length, const char* prompt, int verify); +int EVP_read_pw_string_min( + char* buf, + int minlen, + int maxlen, + const char* prompt, + int verify); +void EVP_set_pw_prompt(const char* prompt); +char* EVP_get_pw_prompt(void); + +int EVP_BytesToKey( + const EVP_CIPHER* type, + const EVP_MD* md, + const unsigned char* salt, + const unsigned char* data, + int datal, + int count, + unsigned char* key, + unsigned char* iv); + +void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX* ctx, int flags); +void EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX* ctx, int flags); +int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX* ctx, int flags); + +int EVP_EncryptInit( + EVP_CIPHER_CTX* ctx, + const EVP_CIPHER* cipher, + const unsigned char* key, + const unsigned char* iv); +int EVP_EncryptInit_ex( + EVP_CIPHER_CTX* ctx, + const EVP_CIPHER* cipher, + ENGINE* impl, + const unsigned char* key, + const unsigned char* iv); +int EVP_EncryptUpdate( + EVP_CIPHER_CTX* ctx, + unsigned char* out, + int* outl, + const unsigned char* in, + int inl); +int EVP_EncryptFinal_ex(EVP_CIPHER_CTX* ctx, unsigned char* out, int* outl); +int EVP_EncryptFinal(EVP_CIPHER_CTX* ctx, unsigned char* out, int* outl); + +int EVP_DecryptInit( + EVP_CIPHER_CTX* ctx, + const EVP_CIPHER* cipher, + const unsigned char* key, + const unsigned char* iv); +int EVP_DecryptInit_ex( + EVP_CIPHER_CTX* ctx, + const EVP_CIPHER* cipher, + ENGINE* impl, + const unsigned char* key, + const unsigned char* iv); +int EVP_DecryptUpdate( + EVP_CIPHER_CTX* ctx, + unsigned char* out, + int* outl, + const unsigned char* in, + int inl); +int EVP_DecryptFinal(EVP_CIPHER_CTX* ctx, unsigned char* outm, int* outl); +int EVP_DecryptFinal_ex(EVP_CIPHER_CTX* ctx, unsigned char* outm, int* outl); + +int EVP_CipherInit( + EVP_CIPHER_CTX* ctx, + const EVP_CIPHER* cipher, + const unsigned char* key, + const unsigned char* iv, + int enc); +int EVP_CipherInit_ex( + EVP_CIPHER_CTX* ctx, + const EVP_CIPHER* cipher, + ENGINE* impl, + const unsigned char* key, + const unsigned char* iv, + int enc); +int EVP_CipherUpdate( + EVP_CIPHER_CTX* ctx, + unsigned char* out, + int* outl, + const unsigned char* in, + int inl); +int EVP_CipherFinal(EVP_CIPHER_CTX* ctx, unsigned char* outm, int* outl); +int EVP_CipherFinal_ex(EVP_CIPHER_CTX* ctx, unsigned char* outm, int* outl); + +int EVP_SignFinal( + EVP_MD_CTX* ctx, + unsigned char* md, + unsigned int* s, + EVP_PKEY* pkey); + +int EVP_VerifyFinal( + EVP_MD_CTX* ctx, + const unsigned char* sigbuf, + unsigned int siglen, + EVP_PKEY* pkey); + +int EVP_DigestSignInit( + EVP_MD_CTX* ctx, + EVP_PKEY_CTX** pctx, + const EVP_MD* type, + ENGINE* e, + EVP_PKEY* pkey); +int EVP_DigestSignFinal(EVP_MD_CTX* ctx, unsigned char* sigret, size_t* siglen); + +int EVP_DigestVerifyInit( + EVP_MD_CTX* ctx, + EVP_PKEY_CTX** pctx, + const EVP_MD* type, + ENGINE* e, + EVP_PKEY* pkey); +int EVP_DigestVerifyFinal( + EVP_MD_CTX* ctx, + const unsigned char* sig, + size_t siglen); + +int EVP_OpenInit( + EVP_CIPHER_CTX* ctx, + const EVP_CIPHER* type, + const unsigned char* ek, + int ekl, + const unsigned char* iv, + EVP_PKEY* priv); +int EVP_OpenFinal(EVP_CIPHER_CTX* ctx, unsigned char* out, int* outl); + +int EVP_SealInit( + EVP_CIPHER_CTX* ctx, + const EVP_CIPHER* type, + unsigned char** ek, + int* ekl, + unsigned char* iv, + EVP_PKEY** pubk, + int npubk); +int EVP_SealFinal(EVP_CIPHER_CTX* ctx, unsigned char* out, int* outl); + +void EVP_EncodeInit(EVP_ENCODE_CTX* ctx); +void EVP_EncodeUpdate( + EVP_ENCODE_CTX* ctx, + unsigned char* out, + int* outl, + const unsigned char* in, + int inl); +void EVP_EncodeFinal(EVP_ENCODE_CTX* ctx, unsigned char* out, int* outl); +int EVP_EncodeBlock(unsigned char* t, const unsigned char* f, int n); + +void EVP_DecodeInit(EVP_ENCODE_CTX* ctx); +int EVP_DecodeUpdate( + EVP_ENCODE_CTX* ctx, + unsigned char* out, + int* outl, + const unsigned char* in, + int inl); +int EVP_DecodeFinal(EVP_ENCODE_CTX* ctx, unsigned char* out, int* outl); +int EVP_DecodeBlock(unsigned char* t, const unsigned char* f, int n); + +void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX* a); +int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX* a); +EVP_CIPHER_CTX* EVP_CIPHER_CTX_new(void); +void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX* a); +int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX* x, int keylen); +int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX* c, int pad); +int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX* ctx, int type, int arg, void* ptr); +int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX* ctx, unsigned char* key); + +#ifndef OPENSSL_NO_BIO +BIO_METHOD* BIO_f_md(void); +BIO_METHOD* BIO_f_base64(void); +BIO_METHOD* BIO_f_cipher(void); +BIO_METHOD* BIO_f_reliable(void); +void BIO_set_cipher( + BIO* b, + const EVP_CIPHER* c, + const unsigned char* k, + const unsigned char* i, + int enc); +#endif + +const EVP_MD* EVP_md_null(void); +#ifndef OPENSSL_NO_MD2 +const EVP_MD* EVP_md2(void); +#endif +#ifndef OPENSSL_NO_MD4 +const EVP_MD* EVP_md4(void); +#endif +#ifndef OPENSSL_NO_MD5 +const EVP_MD* EVP_md5(void); +#endif +#ifndef OPENSSL_NO_SHA +const EVP_MD* EVP_sha(void); +const EVP_MD* EVP_sha1(void); +const EVP_MD* EVP_dss(void); +const EVP_MD* EVP_dss1(void); +const EVP_MD* EVP_ecdsa(void); +#endif +#ifndef OPENSSL_NO_SHA256 +const EVP_MD* EVP_sha224(void); +const EVP_MD* EVP_sha256(void); +#endif +#ifndef OPENSSL_NO_SHA512 +const EVP_MD* EVP_sha384(void); +const EVP_MD* EVP_sha512(void); +#endif +#ifndef OPENSSL_NO_MDC2 +const EVP_MD* EVP_mdc2(void); +#endif +#ifndef OPENSSL_NO_RIPEMD +const EVP_MD* EVP_ripemd160(void); +#endif +#ifndef OPENSSL_NO_WHIRLPOOL +const EVP_MD* EVP_whirlpool(void); +#endif +const EVP_CIPHER* EVP_enc_null(void); /* does nothing :-) */ +#ifndef OPENSSL_NO_DES +const EVP_CIPHER* EVP_des_ecb(void); +const EVP_CIPHER* EVP_des_ede(void); +const EVP_CIPHER* EVP_des_ede3(void); +const EVP_CIPHER* EVP_des_ede_ecb(void); +const EVP_CIPHER* EVP_des_ede3_ecb(void); +const EVP_CIPHER* EVP_des_cfb64(void); +#define EVP_des_cfb EVP_des_cfb64 +const EVP_CIPHER* EVP_des_cfb1(void); +const EVP_CIPHER* EVP_des_cfb8(void); +const EVP_CIPHER* EVP_des_ede_cfb64(void); +#define EVP_des_ede_cfb EVP_des_ede_cfb64 +#if 0 +const EVP_CIPHER *EVP_des_ede_cfb1(void); +const EVP_CIPHER *EVP_des_ede_cfb8(void); +#endif +const EVP_CIPHER* EVP_des_ede3_cfb64(void); +#define EVP_des_ede3_cfb EVP_des_ede3_cfb64 +const EVP_CIPHER* EVP_des_ede3_cfb1(void); +const EVP_CIPHER* EVP_des_ede3_cfb8(void); +const EVP_CIPHER* EVP_des_ofb(void); +const EVP_CIPHER* EVP_des_ede_ofb(void); +const EVP_CIPHER* EVP_des_ede3_ofb(void); +const EVP_CIPHER* EVP_des_cbc(void); +const EVP_CIPHER* EVP_des_ede_cbc(void); +const EVP_CIPHER* EVP_des_ede3_cbc(void); +const EVP_CIPHER* EVP_desx_cbc(void); +const EVP_CIPHER* EVP_des_ede3_wrap(void); +/* + * This should now be supported through the dev_crypto ENGINE. But also, why + * are rc4 and md5 declarations made here inside a "NO_DES" precompiler + * branch? + */ +#if 0 +#ifdef OPENSSL_OPENBSD_DEV_CRYPTO +const EVP_CIPHER *EVP_dev_crypto_des_ede3_cbc(void); +const EVP_CIPHER *EVP_dev_crypto_rc4(void); +const EVP_MD *EVP_dev_crypto_md5(void); +#endif +#endif +#endif +#ifndef OPENSSL_NO_RC4 +const EVP_CIPHER* EVP_rc4(void); +const EVP_CIPHER* EVP_rc4_40(void); +#ifndef OPENSSL_NO_MD5 +const EVP_CIPHER* EVP_rc4_hmac_md5(void); +#endif +#endif +#ifndef OPENSSL_NO_IDEA +const EVP_CIPHER* EVP_idea_ecb(void); +const EVP_CIPHER* EVP_idea_cfb64(void); +#define EVP_idea_cfb EVP_idea_cfb64 +const EVP_CIPHER* EVP_idea_ofb(void); +const EVP_CIPHER* EVP_idea_cbc(void); +#endif +#ifndef OPENSSL_NO_RC2 +const EVP_CIPHER* EVP_rc2_ecb(void); +const EVP_CIPHER* EVP_rc2_cbc(void); +const EVP_CIPHER* EVP_rc2_40_cbc(void); +const EVP_CIPHER* EVP_rc2_64_cbc(void); +const EVP_CIPHER* EVP_rc2_cfb64(void); +#define EVP_rc2_cfb EVP_rc2_cfb64 +const EVP_CIPHER* EVP_rc2_ofb(void); +#endif +#ifndef OPENSSL_NO_BF +const EVP_CIPHER* EVP_bf_ecb(void); +const EVP_CIPHER* EVP_bf_cbc(void); +const EVP_CIPHER* EVP_bf_cfb64(void); +#define EVP_bf_cfb EVP_bf_cfb64 +const EVP_CIPHER* EVP_bf_ofb(void); +#endif +#ifndef OPENSSL_NO_CAST +const EVP_CIPHER* EVP_cast5_ecb(void); +const EVP_CIPHER* EVP_cast5_cbc(void); +const EVP_CIPHER* EVP_cast5_cfb64(void); +#define EVP_cast5_cfb EVP_cast5_cfb64 +const EVP_CIPHER* EVP_cast5_ofb(void); +#endif +#ifndef OPENSSL_NO_RC5 +const EVP_CIPHER* EVP_rc5_32_12_16_cbc(void); +const EVP_CIPHER* EVP_rc5_32_12_16_ecb(void); +const EVP_CIPHER* EVP_rc5_32_12_16_cfb64(void); +#define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64 +const EVP_CIPHER* EVP_rc5_32_12_16_ofb(void); +#endif +#ifndef OPENSSL_NO_AES +const EVP_CIPHER* EVP_aes_128_ecb(void); +const EVP_CIPHER* EVP_aes_128_cbc(void); +const EVP_CIPHER* EVP_aes_128_cfb1(void); +const EVP_CIPHER* EVP_aes_128_cfb8(void); +const EVP_CIPHER* EVP_aes_128_cfb128(void); +#define EVP_aes_128_cfb EVP_aes_128_cfb128 +const EVP_CIPHER* EVP_aes_128_ofb(void); +const EVP_CIPHER* EVP_aes_128_ctr(void); +const EVP_CIPHER* EVP_aes_128_ccm(void); +const EVP_CIPHER* EVP_aes_128_gcm(void); +const EVP_CIPHER* EVP_aes_128_xts(void); +const EVP_CIPHER* EVP_aes_128_wrap(void); +const EVP_CIPHER* EVP_aes_192_ecb(void); +const EVP_CIPHER* EVP_aes_192_cbc(void); +const EVP_CIPHER* EVP_aes_192_cfb1(void); +const EVP_CIPHER* EVP_aes_192_cfb8(void); +const EVP_CIPHER* EVP_aes_192_cfb128(void); +#define EVP_aes_192_cfb EVP_aes_192_cfb128 +const EVP_CIPHER* EVP_aes_192_ofb(void); +const EVP_CIPHER* EVP_aes_192_ctr(void); +const EVP_CIPHER* EVP_aes_192_ccm(void); +const EVP_CIPHER* EVP_aes_192_gcm(void); +const EVP_CIPHER* EVP_aes_192_wrap(void); +const EVP_CIPHER* EVP_aes_256_ecb(void); +const EVP_CIPHER* EVP_aes_256_cbc(void); +const EVP_CIPHER* EVP_aes_256_cfb1(void); +const EVP_CIPHER* EVP_aes_256_cfb8(void); +const EVP_CIPHER* EVP_aes_256_cfb128(void); +#define EVP_aes_256_cfb EVP_aes_256_cfb128 +const EVP_CIPHER* EVP_aes_256_ofb(void); +const EVP_CIPHER* EVP_aes_256_ctr(void); +const EVP_CIPHER* EVP_aes_256_ccm(void); +const EVP_CIPHER* EVP_aes_256_gcm(void); +const EVP_CIPHER* EVP_aes_256_xts(void); +const EVP_CIPHER* EVP_aes_256_wrap(void); +#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1) +const EVP_CIPHER* EVP_aes_128_cbc_hmac_sha1(void); +const EVP_CIPHER* EVP_aes_256_cbc_hmac_sha1(void); +#endif +#ifndef OPENSSL_NO_SHA256 +const EVP_CIPHER* EVP_aes_128_cbc_hmac_sha256(void); +const EVP_CIPHER* EVP_aes_256_cbc_hmac_sha256(void); +#endif +#endif +#ifndef OPENSSL_NO_CAMELLIA +const EVP_CIPHER* EVP_camellia_128_ecb(void); +const EVP_CIPHER* EVP_camellia_128_cbc(void); +const EVP_CIPHER* EVP_camellia_128_cfb1(void); +const EVP_CIPHER* EVP_camellia_128_cfb8(void); +const EVP_CIPHER* EVP_camellia_128_cfb128(void); +#define EVP_camellia_128_cfb EVP_camellia_128_cfb128 +const EVP_CIPHER* EVP_camellia_128_ofb(void); +const EVP_CIPHER* EVP_camellia_192_ecb(void); +const EVP_CIPHER* EVP_camellia_192_cbc(void); +const EVP_CIPHER* EVP_camellia_192_cfb1(void); +const EVP_CIPHER* EVP_camellia_192_cfb8(void); +const EVP_CIPHER* EVP_camellia_192_cfb128(void); +#define EVP_camellia_192_cfb EVP_camellia_192_cfb128 +const EVP_CIPHER* EVP_camellia_192_ofb(void); +const EVP_CIPHER* EVP_camellia_256_ecb(void); +const EVP_CIPHER* EVP_camellia_256_cbc(void); +const EVP_CIPHER* EVP_camellia_256_cfb1(void); +const EVP_CIPHER* EVP_camellia_256_cfb8(void); +const EVP_CIPHER* EVP_camellia_256_cfb128(void); +#define EVP_camellia_256_cfb EVP_camellia_256_cfb128 +const EVP_CIPHER* EVP_camellia_256_ofb(void); +#endif + +#ifndef OPENSSL_NO_SEED +const EVP_CIPHER* EVP_seed_ecb(void); +const EVP_CIPHER* EVP_seed_cbc(void); +const EVP_CIPHER* EVP_seed_cfb128(void); +#define EVP_seed_cfb EVP_seed_cfb128 +const EVP_CIPHER* EVP_seed_ofb(void); +#endif + +void OPENSSL_add_all_algorithms_noconf(void); +void OPENSSL_add_all_algorithms_conf(void); + +#ifdef OPENSSL_LOAD_CONF +#define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_conf() +#else +#define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_noconf() +#endif + +void OpenSSL_add_all_ciphers(void); +void OpenSSL_add_all_digests(void); +#define SSLeay_add_all_algorithms() OpenSSL_add_all_algorithms() +#define SSLeay_add_all_ciphers() OpenSSL_add_all_ciphers() +#define SSLeay_add_all_digests() OpenSSL_add_all_digests() + +int EVP_add_cipher(const EVP_CIPHER* cipher); +int EVP_add_digest(const EVP_MD* digest); + +const EVP_CIPHER* EVP_get_cipherbyname(const char* name); +const EVP_MD* EVP_get_digestbyname(const char* name); +void EVP_cleanup(void); + +void EVP_CIPHER_do_all( + void ( + *fn)(const EVP_CIPHER* ciph, const char* from, const char* to, void* x), + void* arg); +void EVP_CIPHER_do_all_sorted( + void ( + *fn)(const EVP_CIPHER* ciph, const char* from, const char* to, void* x), + void* arg); + +void EVP_MD_do_all( + void (*fn)(const EVP_MD* ciph, const char* from, const char* to, void* x), + void* arg); +void EVP_MD_do_all_sorted( + void (*fn)(const EVP_MD* ciph, const char* from, const char* to, void* x), + void* arg); + +int EVP_PKEY_decrypt_old( + unsigned char* dec_key, + const unsigned char* enc_key, + int enc_key_len, + EVP_PKEY* private_key); +int EVP_PKEY_encrypt_old( + unsigned char* enc_key, + const unsigned char* key, + int key_len, + EVP_PKEY* pub_key); +int EVP_PKEY_type(int type); +int EVP_PKEY_id(const EVP_PKEY* pkey); +int EVP_PKEY_base_id(const EVP_PKEY* pkey); +int EVP_PKEY_bits(EVP_PKEY* pkey); +int EVP_PKEY_size(EVP_PKEY* pkey); +int EVP_PKEY_set_type(EVP_PKEY* pkey, int type); +int EVP_PKEY_set_type_str(EVP_PKEY* pkey, const char* str, int len); +int EVP_PKEY_assign(EVP_PKEY* pkey, int type, void* key); +void* EVP_PKEY_get0(EVP_PKEY* pkey); + +#ifndef OPENSSL_NO_RSA +struct rsa_st; +int EVP_PKEY_set1_RSA(EVP_PKEY* pkey, struct rsa_st* key); +struct rsa_st* EVP_PKEY_get1_RSA(EVP_PKEY* pkey); +#endif +#ifndef OPENSSL_NO_DSA +struct dsa_st; +int EVP_PKEY_set1_DSA(EVP_PKEY* pkey, struct dsa_st* key); +struct dsa_st* EVP_PKEY_get1_DSA(EVP_PKEY* pkey); +#endif +#ifndef OPENSSL_NO_DH +struct dh_st; +int EVP_PKEY_set1_DH(EVP_PKEY* pkey, struct dh_st* key); +struct dh_st* EVP_PKEY_get1_DH(EVP_PKEY* pkey); +#endif +#ifndef OPENSSL_NO_EC +struct ec_key_st; +int EVP_PKEY_set1_EC_KEY(EVP_PKEY* pkey, struct ec_key_st* key); +struct ec_key_st* EVP_PKEY_get1_EC_KEY(EVP_PKEY* pkey); +#endif + +EVP_PKEY* EVP_PKEY_new(void); +void EVP_PKEY_free(EVP_PKEY* pkey); + +EVP_PKEY* +d2i_PublicKey(int type, EVP_PKEY** a, const unsigned char** pp, long length); +int i2d_PublicKey(EVP_PKEY* a, unsigned char** pp); + +EVP_PKEY* +d2i_PrivateKey(int type, EVP_PKEY** a, const unsigned char** pp, long length); +EVP_PKEY* +d2i_AutoPrivateKey(EVP_PKEY** a, const unsigned char** pp, long length); +int i2d_PrivateKey(EVP_PKEY* a, unsigned char** pp); + +int EVP_PKEY_copy_parameters(EVP_PKEY* to, const EVP_PKEY* from); +int EVP_PKEY_missing_parameters(const EVP_PKEY* pkey); +int EVP_PKEY_save_parameters(EVP_PKEY* pkey, int mode); +int EVP_PKEY_cmp_parameters(const EVP_PKEY* a, const EVP_PKEY* b); + +int EVP_PKEY_cmp(const EVP_PKEY* a, const EVP_PKEY* b); + +int EVP_PKEY_print_public( + BIO* out, + const EVP_PKEY* pkey, + int indent, + ASN1_PCTX* pctx); +int EVP_PKEY_print_private( + BIO* out, + const EVP_PKEY* pkey, + int indent, + ASN1_PCTX* pctx); +int EVP_PKEY_print_params( + BIO* out, + const EVP_PKEY* pkey, + int indent, + ASN1_PCTX* pctx); + +int EVP_PKEY_get_default_digest_nid(EVP_PKEY* pkey, int* pnid); + +int EVP_CIPHER_type(const EVP_CIPHER* ctx); + +/* calls methods */ +int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX* c, ASN1_TYPE* type); +int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX* c, ASN1_TYPE* type); + +/* These are used by EVP_CIPHER methods */ +int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX* c, ASN1_TYPE* type); +int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX* c, ASN1_TYPE* type); + +/* PKCS5 password based encryption */ +int PKCS5_PBE_keyivgen( + EVP_CIPHER_CTX* ctx, + const char* pass, + int passlen, + ASN1_TYPE* param, + const EVP_CIPHER* cipher, + const EVP_MD* md, + int en_de); +int PKCS5_PBKDF2_HMAC_SHA1( + const char* pass, + int passlen, + const unsigned char* salt, + int saltlen, + int iter, + int keylen, + unsigned char* out); +int PKCS5_PBKDF2_HMAC( + const char* pass, + int passlen, + const unsigned char* salt, + int saltlen, + int iter, + const EVP_MD* digest, + int keylen, + unsigned char* out); +int PKCS5_v2_PBE_keyivgen( + EVP_CIPHER_CTX* ctx, + const char* pass, + int passlen, + ASN1_TYPE* param, + const EVP_CIPHER* cipher, + const EVP_MD* md, + int en_de); + +void PKCS5_PBE_add(void); + +int EVP_PBE_CipherInit( + ASN1_OBJECT* pbe_obj, + const char* pass, + int passlen, + ASN1_TYPE* param, + EVP_CIPHER_CTX* ctx, + int en_de); + +/* PBE type */ + +/* Can appear as the outermost AlgorithmIdentifier */ +#define EVP_PBE_TYPE_OUTER 0x0 +/* Is an PRF type OID */ +#define EVP_PBE_TYPE_PRF 0x1 + +int EVP_PBE_alg_add_type( + int pbe_type, + int pbe_nid, + int cipher_nid, + int md_nid, + EVP_PBE_KEYGEN* keygen); +int EVP_PBE_alg_add( + int nid, + const EVP_CIPHER* cipher, + const EVP_MD* md, + EVP_PBE_KEYGEN* keygen); +int EVP_PBE_find( + int type, + int pbe_nid, + int* pcnid, + int* pmnid, + EVP_PBE_KEYGEN** pkeygen); +void EVP_PBE_cleanup(void); + +#define ASN1_PKEY_ALIAS 0x1 +#define ASN1_PKEY_DYNAMIC 0x2 +#define ASN1_PKEY_SIGPARAM_NULL 0x4 + +#define ASN1_PKEY_CTRL_PKCS7_SIGN 0x1 +#define ASN1_PKEY_CTRL_PKCS7_ENCRYPT 0x2 +#define ASN1_PKEY_CTRL_DEFAULT_MD_NID 0x3 +#define ASN1_PKEY_CTRL_CMS_SIGN 0x5 +#define ASN1_PKEY_CTRL_CMS_ENVELOPE 0x7 +#define ASN1_PKEY_CTRL_CMS_RI_TYPE 0x8 + +int EVP_PKEY_asn1_get_count(void); +const EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_get0(int idx); +const EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_find(ENGINE** pe, int type); +const EVP_PKEY_ASN1_METHOD* +EVP_PKEY_asn1_find_str(ENGINE** pe, const char* str, int len); +int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD* ameth); +int EVP_PKEY_asn1_add_alias(int to, int from); +int EVP_PKEY_asn1_get0_info( + int* ppkey_id, + int* pkey_base_id, + int* ppkey_flags, + const char** pinfo, + const char** ppem_str, + const EVP_PKEY_ASN1_METHOD* ameth); + +const EVP_PKEY_ASN1_METHOD* EVP_PKEY_get0_asn1(EVP_PKEY* pkey); +EVP_PKEY_ASN1_METHOD* +EVP_PKEY_asn1_new(int id, int flags, const char* pem_str, const char* info); +void EVP_PKEY_asn1_copy( + EVP_PKEY_ASN1_METHOD* dst, + const EVP_PKEY_ASN1_METHOD* src); +void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD* ameth); +void EVP_PKEY_asn1_set_public( + EVP_PKEY_ASN1_METHOD* ameth, + int (*pub_decode)(EVP_PKEY* pk, X509_PUBKEY* pub), + int (*pub_encode)(X509_PUBKEY* pub, const EVP_PKEY* pk), + int (*pub_cmp)(const EVP_PKEY* a, const EVP_PKEY* b), + int (*pub_print)( + BIO* out, + const EVP_PKEY* pkey, + int indent, + ASN1_PCTX* pctx), + int (*pkey_size)(const EVP_PKEY* pk), + int (*pkey_bits)(const EVP_PKEY* pk)); +void EVP_PKEY_asn1_set_private( + EVP_PKEY_ASN1_METHOD* ameth, + int (*priv_decode)(EVP_PKEY* pk, PKCS8_PRIV_KEY_INFO* p8inf), + int (*priv_encode)(PKCS8_PRIV_KEY_INFO* p8, const EVP_PKEY* pk), + int (*priv_print)( + BIO* out, + const EVP_PKEY* pkey, + int indent, + ASN1_PCTX* pctx)); +void EVP_PKEY_asn1_set_param( + EVP_PKEY_ASN1_METHOD* ameth, + int (*param_decode)(EVP_PKEY* pkey, const unsigned char** pder, int derlen), + int (*param_encode)(const EVP_PKEY* pkey, unsigned char** pder), + int (*param_missing)(const EVP_PKEY* pk), + int (*param_copy)(EVP_PKEY* to, const EVP_PKEY* from), + int (*param_cmp)(const EVP_PKEY* a, const EVP_PKEY* b), + int (*param_print)( + BIO* out, + const EVP_PKEY* pkey, + int indent, + ASN1_PCTX* pctx)); + +void EVP_PKEY_asn1_set_free( + EVP_PKEY_ASN1_METHOD* ameth, + void (*pkey_free)(EVP_PKEY* pkey)); +void EVP_PKEY_asn1_set_ctrl( + EVP_PKEY_ASN1_METHOD* ameth, + int (*pkey_ctrl)(EVP_PKEY* pkey, int op, long arg1, void* arg2)); +void EVP_PKEY_asn1_set_item( + EVP_PKEY_ASN1_METHOD* ameth, + int (*item_verify)( + EVP_MD_CTX* ctx, + const ASN1_ITEM* it, + void* asn, + X509_ALGOR* a, + ASN1_BIT_STRING* sig, + EVP_PKEY* pkey), + int (*item_sign)( + EVP_MD_CTX* ctx, + const ASN1_ITEM* it, + void* asn, + X509_ALGOR* alg1, + X509_ALGOR* alg2, + ASN1_BIT_STRING* sig)); + +#define EVP_PKEY_OP_UNDEFINED 0 +#define EVP_PKEY_OP_PARAMGEN (1 << 1) +#define EVP_PKEY_OP_KEYGEN (1 << 2) +#define EVP_PKEY_OP_SIGN (1 << 3) +#define EVP_PKEY_OP_VERIFY (1 << 4) +#define EVP_PKEY_OP_VERIFYRECOVER (1 << 5) +#define EVP_PKEY_OP_SIGNCTX (1 << 6) +#define EVP_PKEY_OP_VERIFYCTX (1 << 7) +#define EVP_PKEY_OP_ENCRYPT (1 << 8) +#define EVP_PKEY_OP_DECRYPT (1 << 9) +#define EVP_PKEY_OP_DERIVE (1 << 10) + +#define EVP_PKEY_OP_TYPE_SIG \ + (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYRECOVER | \ + EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX) + +#define EVP_PKEY_OP_TYPE_CRYPT (EVP_PKEY_OP_ENCRYPT | EVP_PKEY_OP_DECRYPT) + +#define EVP_PKEY_OP_TYPE_NOGEN \ + (EVP_PKEY_OP_SIG | EVP_PKEY_OP_CRYPT | EVP_PKEY_OP_DERIVE) + +#define EVP_PKEY_OP_TYPE_GEN (EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN) + +#define EVP_PKEY_CTX_set_signature_md(ctx, md) \ + EVP_PKEY_CTX_ctrl( \ + ctx, -1, EVP_PKEY_OP_TYPE_SIG, EVP_PKEY_CTRL_MD, 0, (void*)md) + +#define EVP_PKEY_CTX_get_signature_md(ctx, pmd) \ + EVP_PKEY_CTX_ctrl( \ + ctx, -1, EVP_PKEY_OP_TYPE_SIG, EVP_PKEY_CTRL_GET_MD, 0, (void*)pmd) + +#define EVP_PKEY_CTRL_MD 1 +#define EVP_PKEY_CTRL_PEER_KEY 2 + +#define EVP_PKEY_CTRL_PKCS7_ENCRYPT 3 +#define EVP_PKEY_CTRL_PKCS7_DECRYPT 4 + +#define EVP_PKEY_CTRL_PKCS7_SIGN 5 + +#define EVP_PKEY_CTRL_SET_MAC_KEY 6 + +#define EVP_PKEY_CTRL_DIGESTINIT 7 + +/* Used by GOST key encryption in TLS */ +#define EVP_PKEY_CTRL_SET_IV 8 + +#define EVP_PKEY_CTRL_CMS_ENCRYPT 9 +#define EVP_PKEY_CTRL_CMS_DECRYPT 10 +#define EVP_PKEY_CTRL_CMS_SIGN 11 + +#define EVP_PKEY_CTRL_CIPHER 12 + +#define EVP_PKEY_CTRL_GET_MD 13 + +#define EVP_PKEY_ALG_CTRL 0x1000 + +#define EVP_PKEY_FLAG_AUTOARGLEN 2 +/* + * Method handles all operations: don't assume any digest related defaults. + */ +#define EVP_PKEY_FLAG_SIGCTX_CUSTOM 4 + +const EVP_PKEY_METHOD* EVP_PKEY_meth_find(int type); +EVP_PKEY_METHOD* EVP_PKEY_meth_new(int id, int flags); +void EVP_PKEY_meth_get0_info( + int* ppkey_id, + int* pflags, + const EVP_PKEY_METHOD* meth); +void EVP_PKEY_meth_copy(EVP_PKEY_METHOD* dst, const EVP_PKEY_METHOD* src); +void EVP_PKEY_meth_free(EVP_PKEY_METHOD* pmeth); +int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD* pmeth); + +EVP_PKEY_CTX* EVP_PKEY_CTX_new(EVP_PKEY* pkey, ENGINE* e); +EVP_PKEY_CTX* EVP_PKEY_CTX_new_id(int id, ENGINE* e); +EVP_PKEY_CTX* EVP_PKEY_CTX_dup(EVP_PKEY_CTX* ctx); +void EVP_PKEY_CTX_free(EVP_PKEY_CTX* ctx); + +int EVP_PKEY_CTX_ctrl( + EVP_PKEY_CTX* ctx, + int keytype, + int optype, + int cmd, + int p1, + void* p2); +int EVP_PKEY_CTX_ctrl_str( + EVP_PKEY_CTX* ctx, + const char* type, + const char* value); + +int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX* ctx); +void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX* ctx, int* dat, int datlen); + +EVP_PKEY* +EVP_PKEY_new_mac_key(int type, ENGINE* e, const unsigned char* key, int keylen); + +void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX* ctx, void* data); +void* EVP_PKEY_CTX_get_data(EVP_PKEY_CTX* ctx); +EVP_PKEY* EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX* ctx); + +EVP_PKEY* EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX* ctx); + +void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX* ctx, void* data); +void* EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX* ctx); + +int EVP_PKEY_sign_init(EVP_PKEY_CTX* ctx); +int EVP_PKEY_sign( + EVP_PKEY_CTX* ctx, + unsigned char* sig, + size_t* siglen, + const unsigned char* tbs, + size_t tbslen); +int EVP_PKEY_verify_init(EVP_PKEY_CTX* ctx); +int EVP_PKEY_verify( + EVP_PKEY_CTX* ctx, + const unsigned char* sig, + size_t siglen, + const unsigned char* tbs, + size_t tbslen); +int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX* ctx); +int EVP_PKEY_verify_recover( + EVP_PKEY_CTX* ctx, + unsigned char* rout, + size_t* routlen, + const unsigned char* sig, + size_t siglen); +int EVP_PKEY_encrypt_init(EVP_PKEY_CTX* ctx); +int EVP_PKEY_encrypt( + EVP_PKEY_CTX* ctx, + unsigned char* out, + size_t* outlen, + const unsigned char* in, + size_t inlen); +int EVP_PKEY_decrypt_init(EVP_PKEY_CTX* ctx); +int EVP_PKEY_decrypt( + EVP_PKEY_CTX* ctx, + unsigned char* out, + size_t* outlen, + const unsigned char* in, + size_t inlen); + +int EVP_PKEY_derive_init(EVP_PKEY_CTX* ctx); +int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX* ctx, EVP_PKEY* peer); +int EVP_PKEY_derive(EVP_PKEY_CTX* ctx, unsigned char* key, size_t* keylen); + +typedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX* ctx); + +int EVP_PKEY_paramgen_init(EVP_PKEY_CTX* ctx); +int EVP_PKEY_paramgen(EVP_PKEY_CTX* ctx, EVP_PKEY** ppkey); +int EVP_PKEY_keygen_init(EVP_PKEY_CTX* ctx); +int EVP_PKEY_keygen(EVP_PKEY_CTX* ctx, EVP_PKEY** ppkey); + +void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX* ctx, EVP_PKEY_gen_cb* cb); +EVP_PKEY_gen_cb* EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX* ctx); + +int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX* ctx, int idx); + +void EVP_PKEY_meth_set_init( + EVP_PKEY_METHOD* pmeth, + int (*init)(EVP_PKEY_CTX* ctx)); + +void EVP_PKEY_meth_set_copy( + EVP_PKEY_METHOD* pmeth, + int (*copy)(EVP_PKEY_CTX* dst, EVP_PKEY_CTX* src)); + +void EVP_PKEY_meth_set_cleanup( + EVP_PKEY_METHOD* pmeth, + void (*cleanup)(EVP_PKEY_CTX* ctx)); + +void EVP_PKEY_meth_set_paramgen( + EVP_PKEY_METHOD* pmeth, + int (*paramgen_init)(EVP_PKEY_CTX* ctx), + int (*paramgen)(EVP_PKEY_CTX* ctx, EVP_PKEY* pkey)); + +void EVP_PKEY_meth_set_keygen( + EVP_PKEY_METHOD* pmeth, + int (*keygen_init)(EVP_PKEY_CTX* ctx), + int (*keygen)(EVP_PKEY_CTX* ctx, EVP_PKEY* pkey)); + +void EVP_PKEY_meth_set_sign( + EVP_PKEY_METHOD* pmeth, + int (*sign_init)(EVP_PKEY_CTX* ctx), + int (*sign)( + EVP_PKEY_CTX* ctx, + unsigned char* sig, + size_t* siglen, + const unsigned char* tbs, + size_t tbslen)); + +void EVP_PKEY_meth_set_verify( + EVP_PKEY_METHOD* pmeth, + int (*verify_init)(EVP_PKEY_CTX* ctx), + int (*verify)( + EVP_PKEY_CTX* ctx, + const unsigned char* sig, + size_t siglen, + const unsigned char* tbs, + size_t tbslen)); + +void EVP_PKEY_meth_set_verify_recover( + EVP_PKEY_METHOD* pmeth, + int (*verify_recover_init)(EVP_PKEY_CTX* ctx), + int (*verify_recover)( + EVP_PKEY_CTX* ctx, + unsigned char* sig, + size_t* siglen, + const unsigned char* tbs, + size_t tbslen)); + +void EVP_PKEY_meth_set_signctx( + EVP_PKEY_METHOD* pmeth, + int (*signctx_init)(EVP_PKEY_CTX* ctx, EVP_MD_CTX* mctx), + int (*signctx)( + EVP_PKEY_CTX* ctx, + unsigned char* sig, + size_t* siglen, + EVP_MD_CTX* mctx)); + +void EVP_PKEY_meth_set_verifyctx( + EVP_PKEY_METHOD* pmeth, + int (*verifyctx_init)(EVP_PKEY_CTX* ctx, EVP_MD_CTX* mctx), + int (*verifyctx)( + EVP_PKEY_CTX* ctx, + const unsigned char* sig, + int siglen, + EVP_MD_CTX* mctx)); + +void EVP_PKEY_meth_set_encrypt( + EVP_PKEY_METHOD* pmeth, + int (*encrypt_init)(EVP_PKEY_CTX* ctx), + int (*encryptfn)( + EVP_PKEY_CTX* ctx, + unsigned char* out, + size_t* outlen, + const unsigned char* in, + size_t inlen)); + +void EVP_PKEY_meth_set_decrypt( + EVP_PKEY_METHOD* pmeth, + int (*decrypt_init)(EVP_PKEY_CTX* ctx), + int (*decrypt)( + EVP_PKEY_CTX* ctx, + unsigned char* out, + size_t* outlen, + const unsigned char* in, + size_t inlen)); + +void EVP_PKEY_meth_set_derive( + EVP_PKEY_METHOD* pmeth, + int (*derive_init)(EVP_PKEY_CTX* ctx), + int (*derive)(EVP_PKEY_CTX* ctx, unsigned char* key, size_t* keylen)); + +void EVP_PKEY_meth_set_ctrl( + EVP_PKEY_METHOD* pmeth, + int (*ctrl)(EVP_PKEY_CTX* ctx, int type, int p1, void* p2), + int (*ctrl_str)(EVP_PKEY_CTX* ctx, const char* type, const char* value)); + +void EVP_PKEY_meth_get_init( + EVP_PKEY_METHOD* pmeth, + int (**pinit)(EVP_PKEY_CTX* ctx)); + +void EVP_PKEY_meth_get_copy( + EVP_PKEY_METHOD* pmeth, + int (**pcopy)(EVP_PKEY_CTX* dst, EVP_PKEY_CTX* src)); + +void EVP_PKEY_meth_get_cleanup( + EVP_PKEY_METHOD* pmeth, + void (**pcleanup)(EVP_PKEY_CTX* ctx)); + +void EVP_PKEY_meth_get_paramgen( + EVP_PKEY_METHOD* pmeth, + int (**pparamgen_init)(EVP_PKEY_CTX* ctx), + int (**pparamgen)(EVP_PKEY_CTX* ctx, EVP_PKEY* pkey)); + +void EVP_PKEY_meth_get_keygen( + EVP_PKEY_METHOD* pmeth, + int (**pkeygen_init)(EVP_PKEY_CTX* ctx), + int (**pkeygen)(EVP_PKEY_CTX* ctx, EVP_PKEY* pkey)); + +void EVP_PKEY_meth_get_sign( + EVP_PKEY_METHOD* pmeth, + int (**psign_init)(EVP_PKEY_CTX* ctx), + int (**psign)( + EVP_PKEY_CTX* ctx, + unsigned char* sig, + size_t* siglen, + const unsigned char* tbs, + size_t tbslen)); + +void EVP_PKEY_meth_get_verify( + EVP_PKEY_METHOD* pmeth, + int (**pverify_init)(EVP_PKEY_CTX* ctx), + int (**pverify)( + EVP_PKEY_CTX* ctx, + const unsigned char* sig, + size_t siglen, + const unsigned char* tbs, + size_t tbslen)); + +void EVP_PKEY_meth_get_verify_recover( + EVP_PKEY_METHOD* pmeth, + int (**pverify_recover_init)(EVP_PKEY_CTX* ctx), + int (**pverify_recover)( + EVP_PKEY_CTX* ctx, + unsigned char* sig, + size_t* siglen, + const unsigned char* tbs, + size_t tbslen)); + +void EVP_PKEY_meth_get_signctx( + EVP_PKEY_METHOD* pmeth, + int (**psignctx_init)(EVP_PKEY_CTX* ctx, EVP_MD_CTX* mctx), + int (**psignctx)( + EVP_PKEY_CTX* ctx, + unsigned char* sig, + size_t* siglen, + EVP_MD_CTX* mctx)); + +void EVP_PKEY_meth_get_verifyctx( + EVP_PKEY_METHOD* pmeth, + int (**pverifyctx_init)(EVP_PKEY_CTX* ctx, EVP_MD_CTX* mctx), + int (**pverifyctx)( + EVP_PKEY_CTX* ctx, + const unsigned char* sig, + int siglen, + EVP_MD_CTX* mctx)); + +void EVP_PKEY_meth_get_encrypt( + EVP_PKEY_METHOD* pmeth, + int (**pencrypt_init)(EVP_PKEY_CTX* ctx), + int (**pencryptfn)( + EVP_PKEY_CTX* ctx, + unsigned char* out, + size_t* outlen, + const unsigned char* in, + size_t inlen)); + +void EVP_PKEY_meth_get_decrypt( + EVP_PKEY_METHOD* pmeth, + int (**pdecrypt_init)(EVP_PKEY_CTX* ctx), + int (**pdecrypt)( + EVP_PKEY_CTX* ctx, + unsigned char* out, + size_t* outlen, + const unsigned char* in, + size_t inlen)); + +void EVP_PKEY_meth_get_derive( + EVP_PKEY_METHOD* pmeth, + int (**pderive_init)(EVP_PKEY_CTX* ctx), + int (**pderive)(EVP_PKEY_CTX* ctx, unsigned char* key, size_t* keylen)); + +void EVP_PKEY_meth_get_ctrl( + EVP_PKEY_METHOD* pmeth, + int (**pctrl)(EVP_PKEY_CTX* ctx, int type, int p1, void* p2), + int (**pctrl_str)(EVP_PKEY_CTX* ctx, const char* type, const char* value)); + +void EVP_add_alg_module(void); + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ + +void ERR_load_EVP_strings(void); + +/* Error codes for the EVP functions. */ + +/* Function codes. */ +#define EVP_F_AESNI_INIT_KEY 165 +#define EVP_F_AESNI_XTS_CIPHER 176 +#define EVP_F_AES_INIT_KEY 133 +#define EVP_F_AES_T4_INIT_KEY 178 +#define EVP_F_AES_XTS 172 +#define EVP_F_AES_XTS_CIPHER 175 +#define EVP_F_ALG_MODULE_INIT 177 +#define EVP_F_CAMELLIA_INIT_KEY 159 +#define EVP_F_CMAC_INIT 173 +#define EVP_F_CMLL_T4_INIT_KEY 179 +#define EVP_F_D2I_PKEY 100 +#define EVP_F_DO_SIGVER_INIT 161 +#define EVP_F_DSAPKEY2PKCS8 134 +#define EVP_F_DSA_PKEY2PKCS8 135 +#define EVP_F_ECDSA_PKEY2PKCS8 129 +#define EVP_F_ECKEY_PKEY2PKCS8 132 +#define EVP_F_EVP_CIPHERINIT_EX 123 +#define EVP_F_EVP_CIPHER_CTX_COPY 163 +#define EVP_F_EVP_CIPHER_CTX_CTRL 124 +#define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 122 +#define EVP_F_EVP_DECRYPTFINAL_EX 101 +#define EVP_F_EVP_DIGESTINIT_EX 128 +#define EVP_F_EVP_ENCRYPTFINAL_EX 127 +#define EVP_F_EVP_MD_CTX_COPY_EX 110 +#define EVP_F_EVP_MD_SIZE 162 +#define EVP_F_EVP_OPENINIT 102 +#define EVP_F_EVP_PBE_ALG_ADD 115 +#define EVP_F_EVP_PBE_ALG_ADD_TYPE 160 +#define EVP_F_EVP_PBE_CIPHERINIT 116 +#define EVP_F_EVP_PKCS82PKEY 111 +#define EVP_F_EVP_PKCS82PKEY_BROKEN 136 +#define EVP_F_EVP_PKEY2PKCS8_BROKEN 113 +#define EVP_F_EVP_PKEY_COPY_PARAMETERS 103 +#define EVP_F_EVP_PKEY_CTX_CTRL 137 +#define EVP_F_EVP_PKEY_CTX_CTRL_STR 150 +#define EVP_F_EVP_PKEY_CTX_DUP 156 +#define EVP_F_EVP_PKEY_DECRYPT 104 +#define EVP_F_EVP_PKEY_DECRYPT_INIT 138 +#define EVP_F_EVP_PKEY_DECRYPT_OLD 151 +#define EVP_F_EVP_PKEY_DERIVE 153 +#define EVP_F_EVP_PKEY_DERIVE_INIT 154 +#define EVP_F_EVP_PKEY_DERIVE_SET_PEER 155 +#define EVP_F_EVP_PKEY_ENCRYPT 105 +#define EVP_F_EVP_PKEY_ENCRYPT_INIT 139 +#define EVP_F_EVP_PKEY_ENCRYPT_OLD 152 +#define EVP_F_EVP_PKEY_GET1_DH 119 +#define EVP_F_EVP_PKEY_GET1_DSA 120 +#define EVP_F_EVP_PKEY_GET1_ECDSA 130 +#define EVP_F_EVP_PKEY_GET1_EC_KEY 131 +#define EVP_F_EVP_PKEY_GET1_RSA 121 +#define EVP_F_EVP_PKEY_KEYGEN 146 +#define EVP_F_EVP_PKEY_KEYGEN_INIT 147 +#define EVP_F_EVP_PKEY_NEW 106 +#define EVP_F_EVP_PKEY_PARAMGEN 148 +#define EVP_F_EVP_PKEY_PARAMGEN_INIT 149 +#define EVP_F_EVP_PKEY_SIGN 140 +#define EVP_F_EVP_PKEY_SIGN_INIT 141 +#define EVP_F_EVP_PKEY_VERIFY 142 +#define EVP_F_EVP_PKEY_VERIFY_INIT 143 +#define EVP_F_EVP_PKEY_VERIFY_RECOVER 144 +#define EVP_F_EVP_PKEY_VERIFY_RECOVER_INIT 145 +#define EVP_F_EVP_RIJNDAEL 126 +#define EVP_F_EVP_SIGNFINAL 107 +#define EVP_F_EVP_VERIFYFINAL 108 +#define EVP_F_FIPS_CIPHERINIT 166 +#define EVP_F_FIPS_CIPHER_CTX_COPY 170 +#define EVP_F_FIPS_CIPHER_CTX_CTRL 167 +#define EVP_F_FIPS_CIPHER_CTX_SET_KEY_LENGTH 171 +#define EVP_F_FIPS_DIGESTINIT 168 +#define EVP_F_FIPS_MD_CTX_COPY 169 +#define EVP_F_HMAC_INIT_EX 174 +#define EVP_F_INT_CTX_NEW 157 +#define EVP_F_PKCS5_PBE_KEYIVGEN 117 +#define EVP_F_PKCS5_V2_PBE_KEYIVGEN 118 +#define EVP_F_PKCS5_V2_PBKDF2_KEYIVGEN 164 +#define EVP_F_PKCS8_SET_BROKEN 112 +#define EVP_F_PKEY_SET_TYPE 158 +#define EVP_F_RC2_MAGIC_TO_METH 109 +#define EVP_F_RC5_CTRL 125 + +/* Reason codes. */ +#define EVP_R_AES_IV_SETUP_FAILED 162 +#define EVP_R_AES_KEY_SETUP_FAILED 143 +#define EVP_R_ASN1_LIB 140 +#define EVP_R_BAD_BLOCK_LENGTH 136 +#define EVP_R_BAD_DECRYPT 100 +#define EVP_R_BAD_KEY_LENGTH 137 +#define EVP_R_BN_DECODE_ERROR 112 +#define EVP_R_BN_PUBKEY_ERROR 113 +#define EVP_R_BUFFER_TOO_SMALL 155 +#define EVP_R_CAMELLIA_KEY_SETUP_FAILED 157 +#define EVP_R_CIPHER_PARAMETER_ERROR 122 +#define EVP_R_COMMAND_NOT_SUPPORTED 147 +#define EVP_R_CTRL_NOT_IMPLEMENTED 132 +#define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED 133 +#define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 138 +#define EVP_R_DECODE_ERROR 114 +#define EVP_R_DIFFERENT_KEY_TYPES 101 +#define EVP_R_DIFFERENT_PARAMETERS 153 +#define EVP_R_DISABLED_FOR_FIPS 163 +#define EVP_R_ENCODE_ERROR 115 +#define EVP_R_ERROR_LOADING_SECTION 165 +#define EVP_R_ERROR_SETTING_FIPS_MODE 166 +#define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119 +#define EVP_R_EXPECTING_AN_RSA_KEY 127 +#define EVP_R_EXPECTING_A_DH_KEY 128 +#define EVP_R_EXPECTING_A_DSA_KEY 129 +#define EVP_R_EXPECTING_A_ECDSA_KEY 141 +#define EVP_R_EXPECTING_A_EC_KEY 142 +#define EVP_R_FIPS_MODE_NOT_SUPPORTED 167 +#define EVP_R_INITIALIZATION_ERROR 134 +#define EVP_R_INPUT_NOT_INITIALIZED 111 +#define EVP_R_INVALID_DIGEST 152 +#define EVP_R_INVALID_FIPS_MODE 168 +#define EVP_R_INVALID_KEY 171 +#define EVP_R_INVALID_KEY_LENGTH 130 +#define EVP_R_INVALID_OPERATION 148 +#define EVP_R_IV_TOO_LARGE 102 +#define EVP_R_KEYGEN_FAILURE 120 +#define EVP_R_MESSAGE_DIGEST_IS_NULL 159 +#define EVP_R_METHOD_NOT_SUPPORTED 144 +#define EVP_R_MISSING_PARAMETERS 103 +#define EVP_R_NO_CIPHER_SET 131 +#define EVP_R_NO_DEFAULT_DIGEST 158 +#define EVP_R_NO_DIGEST_SET 139 +#define EVP_R_NO_DSA_PARAMETERS 116 +#define EVP_R_NO_KEY_SET 154 +#define EVP_R_NO_OPERATION_SET 149 +#define EVP_R_NO_SIGN_FUNCTION_CONFIGURED 104 +#define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED 105 +#define EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 150 +#define EVP_R_OPERATON_NOT_INITIALIZED 151 +#define EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE 117 +#define EVP_R_PRIVATE_KEY_DECODE_ERROR 145 +#define EVP_R_PRIVATE_KEY_ENCODE_ERROR 146 +#define EVP_R_PUBLIC_KEY_NOT_RSA 106 +#define EVP_R_TOO_LARGE 164 +#define EVP_R_UNKNOWN_CIPHER 160 +#define EVP_R_UNKNOWN_DIGEST 161 +#define EVP_R_UNKNOWN_OPTION 169 +#define EVP_R_UNKNOWN_PBE_ALGORITHM 121 +#define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS 135 +#define EVP_R_UNSUPPORTED_ALGORITHM 156 +#define EVP_R_UNSUPPORTED_CIPHER 107 +#define EVP_R_UNSUPPORTED_KEYLENGTH 123 +#define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION 124 +#define EVP_R_UNSUPPORTED_KEY_SIZE 108 +#define EVP_R_UNSUPPORTED_PRF 125 +#define EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM 118 +#define EVP_R_UNSUPPORTED_SALT_TYPE 126 +#define EVP_R_WRAP_MODE_NOT_ALLOWED 170 +#define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109 +#define EVP_R_WRONG_PUBLIC_KEY_TYPE 110 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/hmac.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/hmac.h new file mode 100644 index 0000000..6e6f113 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/hmac.h @@ -0,0 +1,118 @@ +/* crypto/hmac/hmac.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +#ifndef HEADER_HMAC_H +#define HEADER_HMAC_H + +#include + +#ifdef OPENSSL_NO_HMAC +#error HMAC is disabled. +#endif + +#include + +#define HMAC_MAX_MD_CBLOCK 128 /* largest known is SHA512 */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct hmac_ctx_st { + const EVP_MD* md; + EVP_MD_CTX md_ctx; + EVP_MD_CTX i_ctx; + EVP_MD_CTX o_ctx; + unsigned int key_length; + unsigned char key[HMAC_MAX_MD_CBLOCK]; +} HMAC_CTX; + +#define HMAC_size(e) (EVP_MD_size((e)->md)) + +void HMAC_CTX_init(HMAC_CTX* ctx); +void HMAC_CTX_cleanup(HMAC_CTX* ctx); + +/* deprecated */ +#define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) + +/* deprecated */ +int HMAC_Init(HMAC_CTX* ctx, const void* key, int len, const EVP_MD* md); +int HMAC_Init_ex( + HMAC_CTX* ctx, + const void* key, + int len, + const EVP_MD* md, + ENGINE* impl); +int HMAC_Update(HMAC_CTX* ctx, const unsigned char* data, size_t len); +int HMAC_Final(HMAC_CTX* ctx, unsigned char* md, unsigned int* len); +unsigned char* HMAC( + const EVP_MD* evp_md, + const void* key, + int key_len, + const unsigned char* d, + size_t n, + unsigned char* md, + unsigned int* md_len); +int HMAC_CTX_copy(HMAC_CTX* dctx, HMAC_CTX* sctx); + +void HMAC_CTX_set_flags(HMAC_CTX* ctx, unsigned long flags); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/idea.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/idea.h new file mode 100644 index 0000000..9c77d15 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/idea.h @@ -0,0 +1,119 @@ +/* crypto/idea/idea.h */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_IDEA_H +#define HEADER_IDEA_H + +#include /* IDEA_INT, OPENSSL_NO_IDEA */ + +#ifdef OPENSSL_NO_IDEA +#error IDEA is disabled. +#endif + +#define IDEA_ENCRYPT 1 +#define IDEA_DECRYPT 0 + +#define IDEA_BLOCK 8 +#define IDEA_KEY_LENGTH 16 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct idea_key_st { IDEA_INT data[9][6]; } IDEA_KEY_SCHEDULE; + +const char* idea_options(void); +void idea_ecb_encrypt( + const unsigned char* in, + unsigned char* out, + IDEA_KEY_SCHEDULE* ks); +#ifdef OPENSSL_FIPS +void private_idea_set_encrypt_key( + const unsigned char* key, + IDEA_KEY_SCHEDULE* ks); +#endif +void idea_set_encrypt_key(const unsigned char* key, IDEA_KEY_SCHEDULE* ks); +void idea_set_decrypt_key(IDEA_KEY_SCHEDULE* ek, IDEA_KEY_SCHEDULE* dk); +void idea_cbc_encrypt( + const unsigned char* in, + unsigned char* out, + long length, + IDEA_KEY_SCHEDULE* ks, + unsigned char* iv, + int enc); +void idea_cfb64_encrypt( + const unsigned char* in, + unsigned char* out, + long length, + IDEA_KEY_SCHEDULE* ks, + unsigned char* iv, + int* num, + int enc); +void idea_ofb64_encrypt( + const unsigned char* in, + unsigned char* out, + long length, + IDEA_KEY_SCHEDULE* ks, + unsigned char* iv, + int* num); +void idea_encrypt(unsigned long* in, IDEA_KEY_SCHEDULE* ks); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/krb5_asn.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/krb5_asn.h new file mode 100644 index 0000000..8862330 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/krb5_asn.h @@ -0,0 +1,240 @@ +/* krb5_asn.h */ +/* + * Written by Vern Staats for the OpenSSL project, ** + * using ocsp/{*.h,*asn*.c} as a starting point + */ + +/* ==================================================================== + * Copyright (c) 1998-2000 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_KRB5_ASN_H +#define HEADER_KRB5_ASN_H + +/* + * #include + */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * ASN.1 from Kerberos RFC 1510 + */ + +/*- EncryptedData ::= SEQUENCE { + * etype[0] INTEGER, -- EncryptionType + * kvno[1] INTEGER OPTIONAL, + * cipher[2] OCTET STRING -- ciphertext + * } + */ +typedef struct krb5_encdata_st { + ASN1_INTEGER* etype; + ASN1_INTEGER* kvno; + ASN1_OCTET_STRING* cipher; +} KRB5_ENCDATA; + +DECLARE_STACK_OF(KRB5_ENCDATA) + +/*- PrincipalName ::= SEQUENCE { + * name-type[0] INTEGER, + * name-string[1] SEQUENCE OF GeneralString + * } + */ +typedef struct krb5_princname_st { + ASN1_INTEGER* nametype; + STACK_OF(ASN1_GENERALSTRING) * namestring; +} KRB5_PRINCNAME; + +DECLARE_STACK_OF(KRB5_PRINCNAME) + +/*- Ticket ::= [APPLICATION 1] SEQUENCE { + * tkt-vno[0] INTEGER, + * realm[1] Realm, + * sname[2] PrincipalName, + * enc-part[3] EncryptedData + * } + */ +typedef struct krb5_tktbody_st { + ASN1_INTEGER* tktvno; + ASN1_GENERALSTRING* realm; + KRB5_PRINCNAME* sname; + KRB5_ENCDATA* encdata; +} KRB5_TKTBODY; + +typedef STACK_OF(KRB5_TKTBODY) KRB5_TICKET; +DECLARE_STACK_OF(KRB5_TKTBODY) + +/*- AP-REQ ::= [APPLICATION 14] SEQUENCE { + * pvno[0] INTEGER, + * msg-type[1] INTEGER, + * ap-options[2] APOptions, + * ticket[3] Ticket, + * authenticator[4] EncryptedData + * } + * + * APOptions ::= BIT STRING { + * reserved(0), use-session-key(1), mutual-required(2) } + */ +typedef struct krb5_ap_req_st { + ASN1_INTEGER* pvno; + ASN1_INTEGER* msgtype; + ASN1_BIT_STRING* apoptions; + KRB5_TICKET* ticket; + KRB5_ENCDATA* authenticator; +} KRB5_APREQBODY; + +typedef STACK_OF(KRB5_APREQBODY) KRB5_APREQ; +DECLARE_STACK_OF(KRB5_APREQBODY) + +/* Authenticator Stuff */ + +/*- Checksum ::= SEQUENCE { + * cksumtype[0] INTEGER, + * checksum[1] OCTET STRING + * } + */ +typedef struct krb5_checksum_st { + ASN1_INTEGER* ctype; + ASN1_OCTET_STRING* checksum; +} KRB5_CHECKSUM; + +DECLARE_STACK_OF(KRB5_CHECKSUM) + +/*- EncryptionKey ::= SEQUENCE { + * keytype[0] INTEGER, + * keyvalue[1] OCTET STRING + * } + */ +typedef struct krb5_encryptionkey_st { + ASN1_INTEGER* ktype; + ASN1_OCTET_STRING* keyvalue; +} KRB5_ENCKEY; + +DECLARE_STACK_OF(KRB5_ENCKEY) + +/*- AuthorizationData ::= SEQUENCE OF SEQUENCE { + * ad-type[0] INTEGER, + * ad-data[1] OCTET STRING + * } + */ +typedef struct krb5_authorization_st { + ASN1_INTEGER* adtype; + ASN1_OCTET_STRING* addata; +} KRB5_AUTHDATA; + +DECLARE_STACK_OF(KRB5_AUTHDATA) + +/*- -- Unencrypted authenticator + * Authenticator ::= [APPLICATION 2] SEQUENCE { + * authenticator-vno[0] INTEGER, + * crealm[1] Realm, + * cname[2] PrincipalName, + * cksum[3] Checksum OPTIONAL, + * cusec[4] INTEGER, + * ctime[5] KerberosTime, + * subkey[6] EncryptionKey OPTIONAL, + * seq-number[7] INTEGER OPTIONAL, + * authorization-data[8] AuthorizationData OPTIONAL + * } + */ +typedef struct krb5_authenticator_st { + ASN1_INTEGER* avno; + ASN1_GENERALSTRING* crealm; + KRB5_PRINCNAME* cname; + KRB5_CHECKSUM* cksum; + ASN1_INTEGER* cusec; + ASN1_GENERALIZEDTIME* ctime; + KRB5_ENCKEY* subkey; + ASN1_INTEGER* seqnum; + KRB5_AUTHDATA* authorization; +} KRB5_AUTHENTBODY; + +typedef STACK_OF(KRB5_AUTHENTBODY) KRB5_AUTHENT; +DECLARE_STACK_OF(KRB5_AUTHENTBODY) + +/*- DECLARE_ASN1_FUNCTIONS(type) = DECLARE_ASN1_FUNCTIONS_name(type, type) = + * type *name##_new(void); + * void name##_free(type *a); + * DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) = + * DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) = + * type *d2i_##name(type **a, const unsigned char **in, long len); + * int i2d_##name(type *a, unsigned char **out); + * DECLARE_ASN1_ITEM(itname) = OPENSSL_EXTERN const ASN1_ITEM itname##_it + */ + +DECLARE_ASN1_FUNCTIONS(KRB5_ENCDATA) +DECLARE_ASN1_FUNCTIONS(KRB5_PRINCNAME) +DECLARE_ASN1_FUNCTIONS(KRB5_TKTBODY) +DECLARE_ASN1_FUNCTIONS(KRB5_APREQBODY) +DECLARE_ASN1_FUNCTIONS(KRB5_TICKET) +DECLARE_ASN1_FUNCTIONS(KRB5_APREQ) + +DECLARE_ASN1_FUNCTIONS(KRB5_CHECKSUM) +DECLARE_ASN1_FUNCTIONS(KRB5_ENCKEY) +DECLARE_ASN1_FUNCTIONS(KRB5_AUTHDATA) +DECLARE_ASN1_FUNCTIONS(KRB5_AUTHENTBODY) +DECLARE_ASN1_FUNCTIONS(KRB5_AUTHENT) + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/kssl.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/kssl.h new file mode 100644 index 0000000..ba571bc --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/kssl.h @@ -0,0 +1,213 @@ +/* ssl/kssl.h */ +/* + * Written by Vern Staats for the OpenSSL project + * 2000. project 2000. + */ +/* ==================================================================== + * Copyright (c) 2000 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +/* + ** 19990701 VRS Started. + */ + +#ifndef KSSL_H +#define KSSL_H + +#include + +#ifndef OPENSSL_NO_KRB5 + +#include +#include +#include +#ifdef OPENSSL_SYS_WIN32 +/* + * These can sometimes get redefined indirectly by krb5 header files after + * they get undefed in ossl_typ.h + */ +#undef X509_NAME +#undef X509_EXTENSIONS +#undef OCSP_REQUEST +#undef OCSP_RESPONSE +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Depending on which KRB5 implementation used, some types from + * the other may be missing. Resolve that here and now + */ +#ifdef KRB5_HEIMDAL +typedef unsigned char krb5_octet; +#define FAR +#else + +#ifndef FAR +#define FAR +#endif + +#endif + +/*- + * Uncomment this to debug kssl problems or + * to trace usage of the Kerberos session key + * + * #define KSSL_DEBUG + */ + +#ifndef KRB5SVC +#define KRB5SVC "host" +#endif + +#ifndef KRB5KEYTAB +#define KRB5KEYTAB "/etc/krb5.keytab" +#endif + +#ifndef KRB5SENDAUTH +#define KRB5SENDAUTH 1 +#endif + +#ifndef KRB5CHECKAUTH +#define KRB5CHECKAUTH 1 +#endif + +#ifndef KSSL_CLOCKSKEW +#define KSSL_CLOCKSKEW 300; +#endif + +#define KSSL_ERR_MAX 255 +typedef struct kssl_err_st { + int reason; + char text[KSSL_ERR_MAX + 1]; +} KSSL_ERR; + +/*- Context for passing + * (1) Kerberos session key to SSL, and + * (2) Config data between application and SSL lib + */ +typedef struct kssl_ctx_st { + /* used by: disposition: */ + char* service_name; /* C,S default ok (kssl) */ + char* service_host; /* C input, REQUIRED */ + char* client_princ; /* S output from krb5 ticket */ + char* keytab_file; /* S NULL (/etc/krb5.keytab) */ + char* cred_cache; /* C NULL (default) */ + krb5_enctype enctype; + int length; + krb5_octet FAR* key; +} KSSL_CTX; + +#define KSSL_CLIENT 1 +#define KSSL_SERVER 2 +#define KSSL_SERVICE 3 +#define KSSL_KEYTAB 4 + +#define KSSL_CTX_OK 0 +#define KSSL_CTX_ERR 1 +#define KSSL_NOMEM 2 + +/* Public (for use by applications that use OpenSSL with Kerberos 5 support */ +krb5_error_code kssl_ctx_setstring(KSSL_CTX* kssl_ctx, int which, char* text); +KSSL_CTX* kssl_ctx_new(void); +KSSL_CTX* kssl_ctx_free(KSSL_CTX* kssl_ctx); +void kssl_ctx_show(KSSL_CTX* kssl_ctx); +krb5_error_code kssl_ctx_setprinc( + KSSL_CTX* kssl_ctx, + int which, + krb5_data* realm, + krb5_data* entity, + int nentities); +krb5_error_code kssl_cget_tkt( + KSSL_CTX* kssl_ctx, + krb5_data** enc_tktp, + krb5_data* authenp, + KSSL_ERR* kssl_err); +krb5_error_code kssl_sget_tkt( + KSSL_CTX* kssl_ctx, + krb5_data* indata, + krb5_ticket_times* ttimes, + KSSL_ERR* kssl_err); +krb5_error_code kssl_ctx_setkey(KSSL_CTX* kssl_ctx, krb5_keyblock* session); +void kssl_err_set(KSSL_ERR* kssl_err, int reason, char* text); +void kssl_krb5_free_data_contents(krb5_context context, krb5_data* data); +krb5_error_code kssl_build_principal_2( + krb5_context context, + krb5_principal* princ, + int rlen, + const char* realm, + int slen, + const char* svc, + int hlen, + const char* host); +krb5_error_code kssl_validate_times( + krb5_timestamp atime, + krb5_ticket_times* ttimes); +krb5_error_code kssl_check_authent( + KSSL_CTX* kssl_ctx, + krb5_data* authentp, + krb5_timestamp* atimep, + KSSL_ERR* kssl_err); +unsigned char* kssl_skip_confound(krb5_enctype enctype, unsigned char* authn); + +void SSL_set0_kssl_ctx(SSL* s, KSSL_CTX* kctx); +KSSL_CTX* SSL_get0_kssl_ctx(SSL* s); +char* kssl_ctx_get0_client_princ(KSSL_CTX* kctx); + +#ifdef __cplusplus +} +#endif +#endif /* OPENSSL_NO_KRB5 */ +#endif /* KSSL_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/lhash.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/lhash.h new file mode 100644 index 0000000..e49cf5f --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/lhash.h @@ -0,0 +1,241 @@ +/* crypto/lhash/lhash.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* + * Header for dynamic hash table routines Author - Eric Young + */ + +#ifndef HEADER_LHASH_H +#define HEADER_LHASH_H + +#include +#ifndef OPENSSL_NO_FP_API +#include +#endif + +#ifndef OPENSSL_NO_BIO +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct lhash_node_st { + void* data; + struct lhash_node_st* next; +#ifndef OPENSSL_NO_HASH_COMP + unsigned long hash; +#endif +} LHASH_NODE; + +typedef int (*LHASH_COMP_FN_TYPE)(const void*, const void*); +typedef unsigned long (*LHASH_HASH_FN_TYPE)(const void*); +typedef void (*LHASH_DOALL_FN_TYPE)(void*); +typedef void (*LHASH_DOALL_ARG_FN_TYPE)(void*, void*); + +/* + * Macros for declaring and implementing type-safe wrappers for LHASH + * callbacks. This way, callbacks can be provided to LHASH structures without + * function pointer casting and the macro-defined callbacks provide + * per-variable casting before deferring to the underlying type-specific + * callbacks. NB: It is possible to place a "static" in front of both the + * DECLARE and IMPLEMENT macros if the functions are strictly internal. + */ + +/* First: "hash" functions */ +#define DECLARE_LHASH_HASH_FN(name, o_type) \ + unsigned long name##_LHASH_HASH(const void*); +#define IMPLEMENT_LHASH_HASH_FN(name, o_type) \ + unsigned long name##_LHASH_HASH(const void* arg) { \ + const o_type* a = arg; \ + return name##_hash(a); \ + } +#define LHASH_HASH_FN(name) name##_LHASH_HASH + +/* Second: "compare" functions */ +#define DECLARE_LHASH_COMP_FN(name, o_type) \ + int name##_LHASH_COMP(const void*, const void*); +#define IMPLEMENT_LHASH_COMP_FN(name, o_type) \ + int name##_LHASH_COMP(const void* arg1, const void* arg2) { \ + const o_type* a = arg1; \ + const o_type* b = arg2; \ + return name##_cmp(a, b); \ + } +#define LHASH_COMP_FN(name) name##_LHASH_COMP + +/* Third: "doall" functions */ +#define DECLARE_LHASH_DOALL_FN(name, o_type) void name##_LHASH_DOALL(void*); +#define IMPLEMENT_LHASH_DOALL_FN(name, o_type) \ + void name##_LHASH_DOALL(void* arg) { \ + o_type* a = arg; \ + name##_doall(a); \ + } +#define LHASH_DOALL_FN(name) name##_LHASH_DOALL + +/* Fourth: "doall_arg" functions */ +#define DECLARE_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ + void name##_LHASH_DOALL_ARG(void*, void*); +#define IMPLEMENT_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ + void name##_LHASH_DOALL_ARG(void* arg1, void* arg2) { \ + o_type* a = arg1; \ + a_type* b = arg2; \ + name##_doall_arg(a, b); \ + } +#define LHASH_DOALL_ARG_FN(name) name##_LHASH_DOALL_ARG + +typedef struct lhash_st { + LHASH_NODE** b; + LHASH_COMP_FN_TYPE comp; + LHASH_HASH_FN_TYPE hash; + unsigned int num_nodes; + unsigned int num_alloc_nodes; + unsigned int p; + unsigned int pmax; + unsigned long up_load; /* load times 256 */ + unsigned long down_load; /* load times 256 */ + unsigned long num_items; + unsigned long num_expands; + unsigned long num_expand_reallocs; + unsigned long num_contracts; + unsigned long num_contract_reallocs; + unsigned long num_hash_calls; + unsigned long num_comp_calls; + unsigned long num_insert; + unsigned long num_replace; + unsigned long num_delete; + unsigned long num_no_delete; + unsigned long num_retrieve; + unsigned long num_retrieve_miss; + unsigned long num_hash_comps; + int error; +} _LHASH; /* Do not use _LHASH directly, use LHASH_OF + * and friends */ + +#define LH_LOAD_MULT 256 + +/* + * Indicates a malloc() error in the last call, this is only bad in + * lh_insert(). + */ +#define lh_error(lh) ((lh)->error) + +_LHASH* lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c); +void lh_free(_LHASH* lh); +void* lh_insert(_LHASH* lh, void* data); +void* lh_delete(_LHASH* lh, const void* data); +void* lh_retrieve(_LHASH* lh, const void* data); +void lh_doall(_LHASH* lh, LHASH_DOALL_FN_TYPE func); +void lh_doall_arg(_LHASH* lh, LHASH_DOALL_ARG_FN_TYPE func, void* arg); +unsigned long lh_strhash(const char* c); +unsigned long lh_num_items(const _LHASH* lh); + +#ifndef OPENSSL_NO_FP_API +void lh_stats(const _LHASH* lh, FILE* out); +void lh_node_stats(const _LHASH* lh, FILE* out); +void lh_node_usage_stats(const _LHASH* lh, FILE* out); +#endif + +#ifndef OPENSSL_NO_BIO +void lh_stats_bio(const _LHASH* lh, BIO* out); +void lh_node_stats_bio(const _LHASH* lh, BIO* out); +void lh_node_usage_stats_bio(const _LHASH* lh, BIO* out); +#endif + +/* Type checking... */ + +#define LHASH_OF(type) struct lhash_st_##type + +#define DECLARE_LHASH_OF(type) \ + LHASH_OF(type) { \ + int dummy; \ + } + +#define CHECKED_LHASH_OF(type, lh) ((_LHASH*)CHECKED_PTR_OF(LHASH_OF(type), lh)) + +/* Define wrapper functions. */ +#define LHM_lh_new(type, name) \ + ((LHASH_OF(type)*)lh_new(LHASH_HASH_FN(name), LHASH_COMP_FN(name))) +#define LHM_lh_error(type, lh) lh_error(CHECKED_LHASH_OF(type, lh)) +#define LHM_lh_insert(type, lh, inst) \ + ((type*)lh_insert(CHECKED_LHASH_OF(type, lh), CHECKED_PTR_OF(type, inst))) +#define LHM_lh_retrieve(type, lh, inst) \ + ((type*)lh_retrieve(CHECKED_LHASH_OF(type, lh), CHECKED_PTR_OF(type, inst))) +#define LHM_lh_delete(type, lh, inst) \ + ((type*)lh_delete(CHECKED_LHASH_OF(type, lh), CHECKED_PTR_OF(type, inst))) +#define LHM_lh_doall(type, lh, fn) lh_doall(CHECKED_LHASH_OF(type, lh), fn) +#define LHM_lh_doall_arg(type, lh, fn, arg_type, arg) \ + lh_doall_arg(CHECKED_LHASH_OF(type, lh), fn, CHECKED_PTR_OF(arg_type, arg)) +#define LHM_lh_num_items(type, lh) lh_num_items(CHECKED_LHASH_OF(type, lh)) +#define LHM_lh_down_load(type, lh) (CHECKED_LHASH_OF(type, lh)->down_load) +#define LHM_lh_node_stats_bio(type, lh, out) \ + lh_node_stats_bio(CHECKED_LHASH_OF(type, lh), out) +#define LHM_lh_node_usage_stats_bio(type, lh, out) \ + lh_node_usage_stats_bio(CHECKED_LHASH_OF(type, lh), out) +#define LHM_lh_stats_bio(type, lh, out) \ + lh_stats_bio(CHECKED_LHASH_OF(type, lh), out) +#define LHM_lh_free(type, lh) lh_free(CHECKED_LHASH_OF(type, lh)) + +DECLARE_LHASH_OF(OPENSSL_STRING); +DECLARE_LHASH_OF(OPENSSL_CSTRING); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/md4.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/md4.h new file mode 100644 index 0000000..edfc257 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/md4.h @@ -0,0 +1,119 @@ +/* crypto/md4/md4.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_MD4_H +#define HEADER_MD4_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSSL_NO_MD4 +#error MD4 is disabled. +#endif + +/*- + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! MD4_LONG has to be at least 32 bits wide. If it's wider, then ! + * ! MD4_LONG_LOG2 has to be defined along. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ + +#if defined(__LP32__) +#define MD4_LONG unsigned long +#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) +#define MD4_LONG unsigned long +#define MD4_LONG_LOG2 3 +/* + * _CRAY note. I could declare short, but I have no idea what impact + * does it have on performance on none-T3E machines. I could declare + * int, but at least on C90 sizeof(int) can be chosen at compile time. + * So I've chosen long... + * + */ +#else +#define MD4_LONG unsigned int +#endif + +#define MD4_CBLOCK 64 +#define MD4_LBLOCK (MD4_CBLOCK / 4) +#define MD4_DIGEST_LENGTH 16 + +typedef struct MD4state_st { + MD4_LONG A, B, C, D; + MD4_LONG Nl, Nh; + MD4_LONG data[MD4_LBLOCK]; + unsigned int num; +} MD4_CTX; + +#ifdef OPENSSL_FIPS +int private_MD4_Init(MD4_CTX* c); +#endif +int MD4_Init(MD4_CTX* c); +int MD4_Update(MD4_CTX* c, const void* data, size_t len); +int MD4_Final(unsigned char* md, MD4_CTX* c); +unsigned char* MD4(const unsigned char* d, size_t n, unsigned char* md); +void MD4_Transform(MD4_CTX* c, const unsigned char* b); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/md5.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/md5.h new file mode 100644 index 0000000..3f4bf82 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/md5.h @@ -0,0 +1,119 @@ +/* crypto/md5/md5.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_MD5_H +#define HEADER_MD5_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSSL_NO_MD5 +#error MD5 is disabled. +#endif + +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! MD5_LONG has to be at least 32 bits wide. If it's wider, then ! + * ! MD5_LONG_LOG2 has to be defined along. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ + +#if defined(__LP32__) +#define MD5_LONG unsigned long +#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) +#define MD5_LONG unsigned long +#define MD5_LONG_LOG2 3 +/* + * _CRAY note. I could declare short, but I have no idea what impact + * does it have on performance on none-T3E machines. I could declare + * int, but at least on C90 sizeof(int) can be chosen at compile time. + * So I've chosen long... + * + */ +#else +#define MD5_LONG unsigned int +#endif + +#define MD5_CBLOCK 64 +#define MD5_LBLOCK (MD5_CBLOCK / 4) +#define MD5_DIGEST_LENGTH 16 + +typedef struct MD5state_st { + MD5_LONG A, B, C, D; + MD5_LONG Nl, Nh; + MD5_LONG data[MD5_LBLOCK]; + unsigned int num; +} MD5_CTX; + +#ifdef OPENSSL_FIPS +int private_MD5_Init(MD5_CTX* c); +#endif +int MD5_Init(MD5_CTX* c); +int MD5_Update(MD5_CTX* c, const void* data, size_t len); +int MD5_Final(unsigned char* md, MD5_CTX* c); +unsigned char* MD5(const unsigned char* d, size_t n, unsigned char* md); +void MD5_Transform(MD5_CTX* c, const unsigned char* b); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/mdc2.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/mdc2.h new file mode 100644 index 0000000..cb6d9c9 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/mdc2.h @@ -0,0 +1,94 @@ +/* crypto/mdc2/mdc2.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_MDC2_H +#define HEADER_MDC2_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSSL_NO_MDC2 +#error MDC2 is disabled. +#endif + +#define MDC2_BLOCK 8 +#define MDC2_DIGEST_LENGTH 16 + +typedef struct mdc2_ctx_st { + unsigned int num; + unsigned char data[MDC2_BLOCK]; + DES_cblock h, hh; + int pad_type; /* either 1 or 2, default 1 */ +} MDC2_CTX; + +#ifdef OPENSSL_FIPS +int private_MDC2_Init(MDC2_CTX* c); +#endif +int MDC2_Init(MDC2_CTX* c); +int MDC2_Update(MDC2_CTX* c, const unsigned char* data, size_t len); +int MDC2_Final(unsigned char* md, MDC2_CTX* c); +unsigned char* MDC2(const unsigned char* d, size_t n, unsigned char* md); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/modes.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/modes.h new file mode 100644 index 0000000..24185ef --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/modes.h @@ -0,0 +1,281 @@ +/* ==================================================================== + * Copyright (c) 2008 The OpenSSL Project. All rights reserved. + * + * Rights for redistribution and usage in source and binary + * forms are granted according to the OpenSSL license. + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif +typedef void (*block128_f)( + const unsigned char in[16], + unsigned char out[16], + const void* key); + +typedef void (*cbc128_f)( + const unsigned char* in, + unsigned char* out, + size_t len, + const void* key, + unsigned char ivec[16], + int enc); + +typedef void (*ctr128_f)( + const unsigned char* in, + unsigned char* out, + size_t blocks, + const void* key, + const unsigned char ivec[16]); + +typedef void (*ccm128_f)( + const unsigned char* in, + unsigned char* out, + size_t blocks, + const void* key, + const unsigned char ivec[16], + unsigned char cmac[16]); + +void CRYPTO_cbc128_encrypt( + const unsigned char* in, + unsigned char* out, + size_t len, + const void* key, + unsigned char ivec[16], + block128_f block); +void CRYPTO_cbc128_decrypt( + const unsigned char* in, + unsigned char* out, + size_t len, + const void* key, + unsigned char ivec[16], + block128_f block); + +void CRYPTO_ctr128_encrypt( + const unsigned char* in, + unsigned char* out, + size_t len, + const void* key, + unsigned char ivec[16], + unsigned char ecount_buf[16], + unsigned int* num, + block128_f block); + +void CRYPTO_ctr128_encrypt_ctr32( + const unsigned char* in, + unsigned char* out, + size_t len, + const void* key, + unsigned char ivec[16], + unsigned char ecount_buf[16], + unsigned int* num, + ctr128_f ctr); + +void CRYPTO_ofb128_encrypt( + const unsigned char* in, + unsigned char* out, + size_t len, + const void* key, + unsigned char ivec[16], + int* num, + block128_f block); + +void CRYPTO_cfb128_encrypt( + const unsigned char* in, + unsigned char* out, + size_t len, + const void* key, + unsigned char ivec[16], + int* num, + int enc, + block128_f block); +void CRYPTO_cfb128_8_encrypt( + const unsigned char* in, + unsigned char* out, + size_t length, + const void* key, + unsigned char ivec[16], + int* num, + int enc, + block128_f block); +void CRYPTO_cfb128_1_encrypt( + const unsigned char* in, + unsigned char* out, + size_t bits, + const void* key, + unsigned char ivec[16], + int* num, + int enc, + block128_f block); + +size_t CRYPTO_cts128_encrypt_block( + const unsigned char* in, + unsigned char* out, + size_t len, + const void* key, + unsigned char ivec[16], + block128_f block); +size_t CRYPTO_cts128_encrypt( + const unsigned char* in, + unsigned char* out, + size_t len, + const void* key, + unsigned char ivec[16], + cbc128_f cbc); +size_t CRYPTO_cts128_decrypt_block( + const unsigned char* in, + unsigned char* out, + size_t len, + const void* key, + unsigned char ivec[16], + block128_f block); +size_t CRYPTO_cts128_decrypt( + const unsigned char* in, + unsigned char* out, + size_t len, + const void* key, + unsigned char ivec[16], + cbc128_f cbc); + +size_t CRYPTO_nistcts128_encrypt_block( + const unsigned char* in, + unsigned char* out, + size_t len, + const void* key, + unsigned char ivec[16], + block128_f block); +size_t CRYPTO_nistcts128_encrypt( + const unsigned char* in, + unsigned char* out, + size_t len, + const void* key, + unsigned char ivec[16], + cbc128_f cbc); +size_t CRYPTO_nistcts128_decrypt_block( + const unsigned char* in, + unsigned char* out, + size_t len, + const void* key, + unsigned char ivec[16], + block128_f block); +size_t CRYPTO_nistcts128_decrypt( + const unsigned char* in, + unsigned char* out, + size_t len, + const void* key, + unsigned char ivec[16], + cbc128_f cbc); + +typedef struct gcm128_context GCM128_CONTEXT; + +GCM128_CONTEXT* CRYPTO_gcm128_new(void* key, block128_f block); +void CRYPTO_gcm128_init(GCM128_CONTEXT* ctx, void* key, block128_f block); +void CRYPTO_gcm128_setiv( + GCM128_CONTEXT* ctx, + const unsigned char* iv, + size_t len); +int CRYPTO_gcm128_aad( + GCM128_CONTEXT* ctx, + const unsigned char* aad, + size_t len); +int CRYPTO_gcm128_encrypt( + GCM128_CONTEXT* ctx, + const unsigned char* in, + unsigned char* out, + size_t len); +int CRYPTO_gcm128_decrypt( + GCM128_CONTEXT* ctx, + const unsigned char* in, + unsigned char* out, + size_t len); +int CRYPTO_gcm128_encrypt_ctr32( + GCM128_CONTEXT* ctx, + const unsigned char* in, + unsigned char* out, + size_t len, + ctr128_f stream); +int CRYPTO_gcm128_decrypt_ctr32( + GCM128_CONTEXT* ctx, + const unsigned char* in, + unsigned char* out, + size_t len, + ctr128_f stream); +int CRYPTO_gcm128_finish( + GCM128_CONTEXT* ctx, + const unsigned char* tag, + size_t len); +void CRYPTO_gcm128_tag(GCM128_CONTEXT* ctx, unsigned char* tag, size_t len); +void CRYPTO_gcm128_release(GCM128_CONTEXT* ctx); + +typedef struct ccm128_context CCM128_CONTEXT; + +void CRYPTO_ccm128_init( + CCM128_CONTEXT* ctx, + unsigned int M, + unsigned int L, + void* key, + block128_f block); +int CRYPTO_ccm128_setiv( + CCM128_CONTEXT* ctx, + const unsigned char* nonce, + size_t nlen, + size_t mlen); +void CRYPTO_ccm128_aad( + CCM128_CONTEXT* ctx, + const unsigned char* aad, + size_t alen); +int CRYPTO_ccm128_encrypt( + CCM128_CONTEXT* ctx, + const unsigned char* inp, + unsigned char* out, + size_t len); +int CRYPTO_ccm128_decrypt( + CCM128_CONTEXT* ctx, + const unsigned char* inp, + unsigned char* out, + size_t len); +int CRYPTO_ccm128_encrypt_ccm64( + CCM128_CONTEXT* ctx, + const unsigned char* inp, + unsigned char* out, + size_t len, + ccm128_f stream); +int CRYPTO_ccm128_decrypt_ccm64( + CCM128_CONTEXT* ctx, + const unsigned char* inp, + unsigned char* out, + size_t len, + ccm128_f stream); +size_t CRYPTO_ccm128_tag(CCM128_CONTEXT* ctx, unsigned char* tag, size_t len); + +typedef struct xts128_context XTS128_CONTEXT; + +int CRYPTO_xts128_encrypt( + const XTS128_CONTEXT* ctx, + const unsigned char iv[16], + const unsigned char* inp, + unsigned char* out, + size_t len, + int enc); + +size_t CRYPTO_128_wrap( + void* key, + const unsigned char* iv, + unsigned char* out, + const unsigned char* in, + size_t inlen, + block128_f block); + +size_t CRYPTO_128_unwrap( + void* key, + const unsigned char* iv, + unsigned char* out, + const unsigned char* in, + size_t inlen, + block128_f block); + +#ifdef __cplusplus +} +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/obj_mac.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/obj_mac.h new file mode 100644 index 0000000..fd831ff --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/obj_mac.h @@ -0,0 +1,4235 @@ +/* crypto/objects/obj_mac.h */ + +/* + * THIS FILE IS GENERATED FROM objects.txt by objects.pl via the following + * command: perl objects.pl objects.txt obj_mac.num obj_mac.h + */ + +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#define SN_undef "UNDEF" +#define LN_undef "undefined" +#define NID_undef 0 +#define OBJ_undef 0L + +#define SN_itu_t "ITU-T" +#define LN_itu_t "itu-t" +#define NID_itu_t 645 +#define OBJ_itu_t 0L + +#define NID_ccitt 404 +#define OBJ_ccitt OBJ_itu_t + +#define SN_iso "ISO" +#define LN_iso "iso" +#define NID_iso 181 +#define OBJ_iso 1L + +#define SN_joint_iso_itu_t "JOINT-ISO-ITU-T" +#define LN_joint_iso_itu_t "joint-iso-itu-t" +#define NID_joint_iso_itu_t 646 +#define OBJ_joint_iso_itu_t 2L + +#define NID_joint_iso_ccitt 393 +#define OBJ_joint_iso_ccitt OBJ_joint_iso_itu_t + +#define SN_member_body "member-body" +#define LN_member_body "ISO Member Body" +#define NID_member_body 182 +#define OBJ_member_body OBJ_iso, 2L + +#define SN_identified_organization "identified-organization" +#define NID_identified_organization 676 +#define OBJ_identified_organization OBJ_iso, 3L + +#define SN_hmac_md5 "HMAC-MD5" +#define LN_hmac_md5 "hmac-md5" +#define NID_hmac_md5 780 +#define OBJ_hmac_md5 OBJ_identified_organization, 6L, 1L, 5L, 5L, 8L, 1L, 1L + +#define SN_hmac_sha1 "HMAC-SHA1" +#define LN_hmac_sha1 "hmac-sha1" +#define NID_hmac_sha1 781 +#define OBJ_hmac_sha1 OBJ_identified_organization, 6L, 1L, 5L, 5L, 8L, 1L, 2L + +#define SN_certicom_arc "certicom-arc" +#define NID_certicom_arc 677 +#define OBJ_certicom_arc OBJ_identified_organization, 132L + +#define SN_international_organizations "international-organizations" +#define LN_international_organizations "International Organizations" +#define NID_international_organizations 647 +#define OBJ_international_organizations OBJ_joint_iso_itu_t, 23L + +#define SN_wap "wap" +#define NID_wap 678 +#define OBJ_wap OBJ_international_organizations, 43L + +#define SN_wap_wsg "wap-wsg" +#define NID_wap_wsg 679 +#define OBJ_wap_wsg OBJ_wap, 1L + +#define SN_selected_attribute_types "selected-attribute-types" +#define LN_selected_attribute_types "Selected Attribute Types" +#define NID_selected_attribute_types 394 +#define OBJ_selected_attribute_types OBJ_joint_iso_itu_t, 5L, 1L, 5L + +#define SN_clearance "clearance" +#define NID_clearance 395 +#define OBJ_clearance OBJ_selected_attribute_types, 55L + +#define SN_ISO_US "ISO-US" +#define LN_ISO_US "ISO US Member Body" +#define NID_ISO_US 183 +#define OBJ_ISO_US OBJ_member_body, 840L + +#define SN_X9_57 "X9-57" +#define LN_X9_57 "X9.57" +#define NID_X9_57 184 +#define OBJ_X9_57 OBJ_ISO_US, 10040L + +#define SN_X9cm "X9cm" +#define LN_X9cm "X9.57 CM ?" +#define NID_X9cm 185 +#define OBJ_X9cm OBJ_X9_57, 4L + +#define SN_dsa "DSA" +#define LN_dsa "dsaEncryption" +#define NID_dsa 116 +#define OBJ_dsa OBJ_X9cm, 1L + +#define SN_dsaWithSHA1 "DSA-SHA1" +#define LN_dsaWithSHA1 "dsaWithSHA1" +#define NID_dsaWithSHA1 113 +#define OBJ_dsaWithSHA1 OBJ_X9cm, 3L + +#define SN_ansi_X9_62 "ansi-X9-62" +#define LN_ansi_X9_62 "ANSI X9.62" +#define NID_ansi_X9_62 405 +#define OBJ_ansi_X9_62 OBJ_ISO_US, 10045L + +#define OBJ_X9_62_id_fieldType OBJ_ansi_X9_62, 1L + +#define SN_X9_62_prime_field "prime-field" +#define NID_X9_62_prime_field 406 +#define OBJ_X9_62_prime_field OBJ_X9_62_id_fieldType, 1L + +#define SN_X9_62_characteristic_two_field "characteristic-two-field" +#define NID_X9_62_characteristic_two_field 407 +#define OBJ_X9_62_characteristic_two_field OBJ_X9_62_id_fieldType, 2L + +#define SN_X9_62_id_characteristic_two_basis "id-characteristic-two-basis" +#define NID_X9_62_id_characteristic_two_basis 680 +#define OBJ_X9_62_id_characteristic_two_basis \ + OBJ_X9_62_characteristic_two_field, 3L + +#define SN_X9_62_onBasis "onBasis" +#define NID_X9_62_onBasis 681 +#define OBJ_X9_62_onBasis OBJ_X9_62_id_characteristic_two_basis, 1L + +#define SN_X9_62_tpBasis "tpBasis" +#define NID_X9_62_tpBasis 682 +#define OBJ_X9_62_tpBasis OBJ_X9_62_id_characteristic_two_basis, 2L + +#define SN_X9_62_ppBasis "ppBasis" +#define NID_X9_62_ppBasis 683 +#define OBJ_X9_62_ppBasis OBJ_X9_62_id_characteristic_two_basis, 3L + +#define OBJ_X9_62_id_publicKeyType OBJ_ansi_X9_62, 2L + +#define SN_X9_62_id_ecPublicKey "id-ecPublicKey" +#define NID_X9_62_id_ecPublicKey 408 +#define OBJ_X9_62_id_ecPublicKey OBJ_X9_62_id_publicKeyType, 1L + +#define OBJ_X9_62_ellipticCurve OBJ_ansi_X9_62, 3L + +#define OBJ_X9_62_c_TwoCurve OBJ_X9_62_ellipticCurve, 0L + +#define SN_X9_62_c2pnb163v1 "c2pnb163v1" +#define NID_X9_62_c2pnb163v1 684 +#define OBJ_X9_62_c2pnb163v1 OBJ_X9_62_c_TwoCurve, 1L + +#define SN_X9_62_c2pnb163v2 "c2pnb163v2" +#define NID_X9_62_c2pnb163v2 685 +#define OBJ_X9_62_c2pnb163v2 OBJ_X9_62_c_TwoCurve, 2L + +#define SN_X9_62_c2pnb163v3 "c2pnb163v3" +#define NID_X9_62_c2pnb163v3 686 +#define OBJ_X9_62_c2pnb163v3 OBJ_X9_62_c_TwoCurve, 3L + +#define SN_X9_62_c2pnb176v1 "c2pnb176v1" +#define NID_X9_62_c2pnb176v1 687 +#define OBJ_X9_62_c2pnb176v1 OBJ_X9_62_c_TwoCurve, 4L + +#define SN_X9_62_c2tnb191v1 "c2tnb191v1" +#define NID_X9_62_c2tnb191v1 688 +#define OBJ_X9_62_c2tnb191v1 OBJ_X9_62_c_TwoCurve, 5L + +#define SN_X9_62_c2tnb191v2 "c2tnb191v2" +#define NID_X9_62_c2tnb191v2 689 +#define OBJ_X9_62_c2tnb191v2 OBJ_X9_62_c_TwoCurve, 6L + +#define SN_X9_62_c2tnb191v3 "c2tnb191v3" +#define NID_X9_62_c2tnb191v3 690 +#define OBJ_X9_62_c2tnb191v3 OBJ_X9_62_c_TwoCurve, 7L + +#define SN_X9_62_c2onb191v4 "c2onb191v4" +#define NID_X9_62_c2onb191v4 691 +#define OBJ_X9_62_c2onb191v4 OBJ_X9_62_c_TwoCurve, 8L + +#define SN_X9_62_c2onb191v5 "c2onb191v5" +#define NID_X9_62_c2onb191v5 692 +#define OBJ_X9_62_c2onb191v5 OBJ_X9_62_c_TwoCurve, 9L + +#define SN_X9_62_c2pnb208w1 "c2pnb208w1" +#define NID_X9_62_c2pnb208w1 693 +#define OBJ_X9_62_c2pnb208w1 OBJ_X9_62_c_TwoCurve, 10L + +#define SN_X9_62_c2tnb239v1 "c2tnb239v1" +#define NID_X9_62_c2tnb239v1 694 +#define OBJ_X9_62_c2tnb239v1 OBJ_X9_62_c_TwoCurve, 11L + +#define SN_X9_62_c2tnb239v2 "c2tnb239v2" +#define NID_X9_62_c2tnb239v2 695 +#define OBJ_X9_62_c2tnb239v2 OBJ_X9_62_c_TwoCurve, 12L + +#define SN_X9_62_c2tnb239v3 "c2tnb239v3" +#define NID_X9_62_c2tnb239v3 696 +#define OBJ_X9_62_c2tnb239v3 OBJ_X9_62_c_TwoCurve, 13L + +#define SN_X9_62_c2onb239v4 "c2onb239v4" +#define NID_X9_62_c2onb239v4 697 +#define OBJ_X9_62_c2onb239v4 OBJ_X9_62_c_TwoCurve, 14L + +#define SN_X9_62_c2onb239v5 "c2onb239v5" +#define NID_X9_62_c2onb239v5 698 +#define OBJ_X9_62_c2onb239v5 OBJ_X9_62_c_TwoCurve, 15L + +#define SN_X9_62_c2pnb272w1 "c2pnb272w1" +#define NID_X9_62_c2pnb272w1 699 +#define OBJ_X9_62_c2pnb272w1 OBJ_X9_62_c_TwoCurve, 16L + +#define SN_X9_62_c2pnb304w1 "c2pnb304w1" +#define NID_X9_62_c2pnb304w1 700 +#define OBJ_X9_62_c2pnb304w1 OBJ_X9_62_c_TwoCurve, 17L + +#define SN_X9_62_c2tnb359v1 "c2tnb359v1" +#define NID_X9_62_c2tnb359v1 701 +#define OBJ_X9_62_c2tnb359v1 OBJ_X9_62_c_TwoCurve, 18L + +#define SN_X9_62_c2pnb368w1 "c2pnb368w1" +#define NID_X9_62_c2pnb368w1 702 +#define OBJ_X9_62_c2pnb368w1 OBJ_X9_62_c_TwoCurve, 19L + +#define SN_X9_62_c2tnb431r1 "c2tnb431r1" +#define NID_X9_62_c2tnb431r1 703 +#define OBJ_X9_62_c2tnb431r1 OBJ_X9_62_c_TwoCurve, 20L + +#define OBJ_X9_62_primeCurve OBJ_X9_62_ellipticCurve, 1L + +#define SN_X9_62_prime192v1 "prime192v1" +#define NID_X9_62_prime192v1 409 +#define OBJ_X9_62_prime192v1 OBJ_X9_62_primeCurve, 1L + +#define SN_X9_62_prime192v2 "prime192v2" +#define NID_X9_62_prime192v2 410 +#define OBJ_X9_62_prime192v2 OBJ_X9_62_primeCurve, 2L + +#define SN_X9_62_prime192v3 "prime192v3" +#define NID_X9_62_prime192v3 411 +#define OBJ_X9_62_prime192v3 OBJ_X9_62_primeCurve, 3L + +#define SN_X9_62_prime239v1 "prime239v1" +#define NID_X9_62_prime239v1 412 +#define OBJ_X9_62_prime239v1 OBJ_X9_62_primeCurve, 4L + +#define SN_X9_62_prime239v2 "prime239v2" +#define NID_X9_62_prime239v2 413 +#define OBJ_X9_62_prime239v2 OBJ_X9_62_primeCurve, 5L + +#define SN_X9_62_prime239v3 "prime239v3" +#define NID_X9_62_prime239v3 414 +#define OBJ_X9_62_prime239v3 OBJ_X9_62_primeCurve, 6L + +#define SN_X9_62_prime256v1 "prime256v1" +#define NID_X9_62_prime256v1 415 +#define OBJ_X9_62_prime256v1 OBJ_X9_62_primeCurve, 7L + +#define OBJ_X9_62_id_ecSigType OBJ_ansi_X9_62, 4L + +#define SN_ecdsa_with_SHA1 "ecdsa-with-SHA1" +#define NID_ecdsa_with_SHA1 416 +#define OBJ_ecdsa_with_SHA1 OBJ_X9_62_id_ecSigType, 1L + +#define SN_ecdsa_with_Recommended "ecdsa-with-Recommended" +#define NID_ecdsa_with_Recommended 791 +#define OBJ_ecdsa_with_Recommended OBJ_X9_62_id_ecSigType, 2L + +#define SN_ecdsa_with_Specified "ecdsa-with-Specified" +#define NID_ecdsa_with_Specified 792 +#define OBJ_ecdsa_with_Specified OBJ_X9_62_id_ecSigType, 3L + +#define SN_ecdsa_with_SHA224 "ecdsa-with-SHA224" +#define NID_ecdsa_with_SHA224 793 +#define OBJ_ecdsa_with_SHA224 OBJ_ecdsa_with_Specified, 1L + +#define SN_ecdsa_with_SHA256 "ecdsa-with-SHA256" +#define NID_ecdsa_with_SHA256 794 +#define OBJ_ecdsa_with_SHA256 OBJ_ecdsa_with_Specified, 2L + +#define SN_ecdsa_with_SHA384 "ecdsa-with-SHA384" +#define NID_ecdsa_with_SHA384 795 +#define OBJ_ecdsa_with_SHA384 OBJ_ecdsa_with_Specified, 3L + +#define SN_ecdsa_with_SHA512 "ecdsa-with-SHA512" +#define NID_ecdsa_with_SHA512 796 +#define OBJ_ecdsa_with_SHA512 OBJ_ecdsa_with_Specified, 4L + +#define OBJ_secg_ellipticCurve OBJ_certicom_arc, 0L + +#define SN_secp112r1 "secp112r1" +#define NID_secp112r1 704 +#define OBJ_secp112r1 OBJ_secg_ellipticCurve, 6L + +#define SN_secp112r2 "secp112r2" +#define NID_secp112r2 705 +#define OBJ_secp112r2 OBJ_secg_ellipticCurve, 7L + +#define SN_secp128r1 "secp128r1" +#define NID_secp128r1 706 +#define OBJ_secp128r1 OBJ_secg_ellipticCurve, 28L + +#define SN_secp128r2 "secp128r2" +#define NID_secp128r2 707 +#define OBJ_secp128r2 OBJ_secg_ellipticCurve, 29L + +#define SN_secp160k1 "secp160k1" +#define NID_secp160k1 708 +#define OBJ_secp160k1 OBJ_secg_ellipticCurve, 9L + +#define SN_secp160r1 "secp160r1" +#define NID_secp160r1 709 +#define OBJ_secp160r1 OBJ_secg_ellipticCurve, 8L + +#define SN_secp160r2 "secp160r2" +#define NID_secp160r2 710 +#define OBJ_secp160r2 OBJ_secg_ellipticCurve, 30L + +#define SN_secp192k1 "secp192k1" +#define NID_secp192k1 711 +#define OBJ_secp192k1 OBJ_secg_ellipticCurve, 31L + +#define SN_secp224k1 "secp224k1" +#define NID_secp224k1 712 +#define OBJ_secp224k1 OBJ_secg_ellipticCurve, 32L + +#define SN_secp224r1 "secp224r1" +#define NID_secp224r1 713 +#define OBJ_secp224r1 OBJ_secg_ellipticCurve, 33L + +#define SN_secp256k1 "secp256k1" +#define NID_secp256k1 714 +#define OBJ_secp256k1 OBJ_secg_ellipticCurve, 10L + +#define SN_secp384r1 "secp384r1" +#define NID_secp384r1 715 +#define OBJ_secp384r1 OBJ_secg_ellipticCurve, 34L + +#define SN_secp521r1 "secp521r1" +#define NID_secp521r1 716 +#define OBJ_secp521r1 OBJ_secg_ellipticCurve, 35L + +#define SN_sect113r1 "sect113r1" +#define NID_sect113r1 717 +#define OBJ_sect113r1 OBJ_secg_ellipticCurve, 4L + +#define SN_sect113r2 "sect113r2" +#define NID_sect113r2 718 +#define OBJ_sect113r2 OBJ_secg_ellipticCurve, 5L + +#define SN_sect131r1 "sect131r1" +#define NID_sect131r1 719 +#define OBJ_sect131r1 OBJ_secg_ellipticCurve, 22L + +#define SN_sect131r2 "sect131r2" +#define NID_sect131r2 720 +#define OBJ_sect131r2 OBJ_secg_ellipticCurve, 23L + +#define SN_sect163k1 "sect163k1" +#define NID_sect163k1 721 +#define OBJ_sect163k1 OBJ_secg_ellipticCurve, 1L + +#define SN_sect163r1 "sect163r1" +#define NID_sect163r1 722 +#define OBJ_sect163r1 OBJ_secg_ellipticCurve, 2L + +#define SN_sect163r2 "sect163r2" +#define NID_sect163r2 723 +#define OBJ_sect163r2 OBJ_secg_ellipticCurve, 15L + +#define SN_sect193r1 "sect193r1" +#define NID_sect193r1 724 +#define OBJ_sect193r1 OBJ_secg_ellipticCurve, 24L + +#define SN_sect193r2 "sect193r2" +#define NID_sect193r2 725 +#define OBJ_sect193r2 OBJ_secg_ellipticCurve, 25L + +#define SN_sect233k1 "sect233k1" +#define NID_sect233k1 726 +#define OBJ_sect233k1 OBJ_secg_ellipticCurve, 26L + +#define SN_sect233r1 "sect233r1" +#define NID_sect233r1 727 +#define OBJ_sect233r1 OBJ_secg_ellipticCurve, 27L + +#define SN_sect239k1 "sect239k1" +#define NID_sect239k1 728 +#define OBJ_sect239k1 OBJ_secg_ellipticCurve, 3L + +#define SN_sect283k1 "sect283k1" +#define NID_sect283k1 729 +#define OBJ_sect283k1 OBJ_secg_ellipticCurve, 16L + +#define SN_sect283r1 "sect283r1" +#define NID_sect283r1 730 +#define OBJ_sect283r1 OBJ_secg_ellipticCurve, 17L + +#define SN_sect409k1 "sect409k1" +#define NID_sect409k1 731 +#define OBJ_sect409k1 OBJ_secg_ellipticCurve, 36L + +#define SN_sect409r1 "sect409r1" +#define NID_sect409r1 732 +#define OBJ_sect409r1 OBJ_secg_ellipticCurve, 37L + +#define SN_sect571k1 "sect571k1" +#define NID_sect571k1 733 +#define OBJ_sect571k1 OBJ_secg_ellipticCurve, 38L + +#define SN_sect571r1 "sect571r1" +#define NID_sect571r1 734 +#define OBJ_sect571r1 OBJ_secg_ellipticCurve, 39L + +#define OBJ_wap_wsg_idm_ecid OBJ_wap_wsg, 4L + +#define SN_wap_wsg_idm_ecid_wtls1 "wap-wsg-idm-ecid-wtls1" +#define NID_wap_wsg_idm_ecid_wtls1 735 +#define OBJ_wap_wsg_idm_ecid_wtls1 OBJ_wap_wsg_idm_ecid, 1L + +#define SN_wap_wsg_idm_ecid_wtls3 "wap-wsg-idm-ecid-wtls3" +#define NID_wap_wsg_idm_ecid_wtls3 736 +#define OBJ_wap_wsg_idm_ecid_wtls3 OBJ_wap_wsg_idm_ecid, 3L + +#define SN_wap_wsg_idm_ecid_wtls4 "wap-wsg-idm-ecid-wtls4" +#define NID_wap_wsg_idm_ecid_wtls4 737 +#define OBJ_wap_wsg_idm_ecid_wtls4 OBJ_wap_wsg_idm_ecid, 4L + +#define SN_wap_wsg_idm_ecid_wtls5 "wap-wsg-idm-ecid-wtls5" +#define NID_wap_wsg_idm_ecid_wtls5 738 +#define OBJ_wap_wsg_idm_ecid_wtls5 OBJ_wap_wsg_idm_ecid, 5L + +#define SN_wap_wsg_idm_ecid_wtls6 "wap-wsg-idm-ecid-wtls6" +#define NID_wap_wsg_idm_ecid_wtls6 739 +#define OBJ_wap_wsg_idm_ecid_wtls6 OBJ_wap_wsg_idm_ecid, 6L + +#define SN_wap_wsg_idm_ecid_wtls7 "wap-wsg-idm-ecid-wtls7" +#define NID_wap_wsg_idm_ecid_wtls7 740 +#define OBJ_wap_wsg_idm_ecid_wtls7 OBJ_wap_wsg_idm_ecid, 7L + +#define SN_wap_wsg_idm_ecid_wtls8 "wap-wsg-idm-ecid-wtls8" +#define NID_wap_wsg_idm_ecid_wtls8 741 +#define OBJ_wap_wsg_idm_ecid_wtls8 OBJ_wap_wsg_idm_ecid, 8L + +#define SN_wap_wsg_idm_ecid_wtls9 "wap-wsg-idm-ecid-wtls9" +#define NID_wap_wsg_idm_ecid_wtls9 742 +#define OBJ_wap_wsg_idm_ecid_wtls9 OBJ_wap_wsg_idm_ecid, 9L + +#define SN_wap_wsg_idm_ecid_wtls10 "wap-wsg-idm-ecid-wtls10" +#define NID_wap_wsg_idm_ecid_wtls10 743 +#define OBJ_wap_wsg_idm_ecid_wtls10 OBJ_wap_wsg_idm_ecid, 10L + +#define SN_wap_wsg_idm_ecid_wtls11 "wap-wsg-idm-ecid-wtls11" +#define NID_wap_wsg_idm_ecid_wtls11 744 +#define OBJ_wap_wsg_idm_ecid_wtls11 OBJ_wap_wsg_idm_ecid, 11L + +#define SN_wap_wsg_idm_ecid_wtls12 "wap-wsg-idm-ecid-wtls12" +#define NID_wap_wsg_idm_ecid_wtls12 745 +#define OBJ_wap_wsg_idm_ecid_wtls12 OBJ_wap_wsg_idm_ecid, 12L + +#define SN_cast5_cbc "CAST5-CBC" +#define LN_cast5_cbc "cast5-cbc" +#define NID_cast5_cbc 108 +#define OBJ_cast5_cbc OBJ_ISO_US, 113533L, 7L, 66L, 10L + +#define SN_cast5_ecb "CAST5-ECB" +#define LN_cast5_ecb "cast5-ecb" +#define NID_cast5_ecb 109 + +#define SN_cast5_cfb64 "CAST5-CFB" +#define LN_cast5_cfb64 "cast5-cfb" +#define NID_cast5_cfb64 110 + +#define SN_cast5_ofb64 "CAST5-OFB" +#define LN_cast5_ofb64 "cast5-ofb" +#define NID_cast5_ofb64 111 + +#define LN_pbeWithMD5AndCast5_CBC "pbeWithMD5AndCast5CBC" +#define NID_pbeWithMD5AndCast5_CBC 112 +#define OBJ_pbeWithMD5AndCast5_CBC OBJ_ISO_US, 113533L, 7L, 66L, 12L + +#define SN_id_PasswordBasedMAC "id-PasswordBasedMAC" +#define LN_id_PasswordBasedMAC "password based MAC" +#define NID_id_PasswordBasedMAC 782 +#define OBJ_id_PasswordBasedMAC OBJ_ISO_US, 113533L, 7L, 66L, 13L + +#define SN_id_DHBasedMac "id-DHBasedMac" +#define LN_id_DHBasedMac "Diffie-Hellman based MAC" +#define NID_id_DHBasedMac 783 +#define OBJ_id_DHBasedMac OBJ_ISO_US, 113533L, 7L, 66L, 30L + +#define SN_rsadsi "rsadsi" +#define LN_rsadsi "RSA Data Security, Inc." +#define NID_rsadsi 1 +#define OBJ_rsadsi OBJ_ISO_US, 113549L + +#define SN_pkcs "pkcs" +#define LN_pkcs "RSA Data Security, Inc. PKCS" +#define NID_pkcs 2 +#define OBJ_pkcs OBJ_rsadsi, 1L + +#define SN_pkcs1 "pkcs1" +#define NID_pkcs1 186 +#define OBJ_pkcs1 OBJ_pkcs, 1L + +#define LN_rsaEncryption "rsaEncryption" +#define NID_rsaEncryption 6 +#define OBJ_rsaEncryption OBJ_pkcs1, 1L + +#define SN_md2WithRSAEncryption "RSA-MD2" +#define LN_md2WithRSAEncryption "md2WithRSAEncryption" +#define NID_md2WithRSAEncryption 7 +#define OBJ_md2WithRSAEncryption OBJ_pkcs1, 2L + +#define SN_md4WithRSAEncryption "RSA-MD4" +#define LN_md4WithRSAEncryption "md4WithRSAEncryption" +#define NID_md4WithRSAEncryption 396 +#define OBJ_md4WithRSAEncryption OBJ_pkcs1, 3L + +#define SN_md5WithRSAEncryption "RSA-MD5" +#define LN_md5WithRSAEncryption "md5WithRSAEncryption" +#define NID_md5WithRSAEncryption 8 +#define OBJ_md5WithRSAEncryption OBJ_pkcs1, 4L + +#define SN_sha1WithRSAEncryption "RSA-SHA1" +#define LN_sha1WithRSAEncryption "sha1WithRSAEncryption" +#define NID_sha1WithRSAEncryption 65 +#define OBJ_sha1WithRSAEncryption OBJ_pkcs1, 5L + +#define SN_rsaesOaep "RSAES-OAEP" +#define LN_rsaesOaep "rsaesOaep" +#define NID_rsaesOaep 919 +#define OBJ_rsaesOaep OBJ_pkcs1, 7L + +#define SN_mgf1 "MGF1" +#define LN_mgf1 "mgf1" +#define NID_mgf1 911 +#define OBJ_mgf1 OBJ_pkcs1, 8L + +#define SN_pSpecified "PSPECIFIED" +#define LN_pSpecified "pSpecified" +#define NID_pSpecified 935 +#define OBJ_pSpecified OBJ_pkcs1, 9L + +#define SN_rsassaPss "RSASSA-PSS" +#define LN_rsassaPss "rsassaPss" +#define NID_rsassaPss 912 +#define OBJ_rsassaPss OBJ_pkcs1, 10L + +#define SN_sha256WithRSAEncryption "RSA-SHA256" +#define LN_sha256WithRSAEncryption "sha256WithRSAEncryption" +#define NID_sha256WithRSAEncryption 668 +#define OBJ_sha256WithRSAEncryption OBJ_pkcs1, 11L + +#define SN_sha384WithRSAEncryption "RSA-SHA384" +#define LN_sha384WithRSAEncryption "sha384WithRSAEncryption" +#define NID_sha384WithRSAEncryption 669 +#define OBJ_sha384WithRSAEncryption OBJ_pkcs1, 12L + +#define SN_sha512WithRSAEncryption "RSA-SHA512" +#define LN_sha512WithRSAEncryption "sha512WithRSAEncryption" +#define NID_sha512WithRSAEncryption 670 +#define OBJ_sha512WithRSAEncryption OBJ_pkcs1, 13L + +#define SN_sha224WithRSAEncryption "RSA-SHA224" +#define LN_sha224WithRSAEncryption "sha224WithRSAEncryption" +#define NID_sha224WithRSAEncryption 671 +#define OBJ_sha224WithRSAEncryption OBJ_pkcs1, 14L + +#define SN_pkcs3 "pkcs3" +#define NID_pkcs3 27 +#define OBJ_pkcs3 OBJ_pkcs, 3L + +#define LN_dhKeyAgreement "dhKeyAgreement" +#define NID_dhKeyAgreement 28 +#define OBJ_dhKeyAgreement OBJ_pkcs3, 1L + +#define SN_pkcs5 "pkcs5" +#define NID_pkcs5 187 +#define OBJ_pkcs5 OBJ_pkcs, 5L + +#define SN_pbeWithMD2AndDES_CBC "PBE-MD2-DES" +#define LN_pbeWithMD2AndDES_CBC "pbeWithMD2AndDES-CBC" +#define NID_pbeWithMD2AndDES_CBC 9 +#define OBJ_pbeWithMD2AndDES_CBC OBJ_pkcs5, 1L + +#define SN_pbeWithMD5AndDES_CBC "PBE-MD5-DES" +#define LN_pbeWithMD5AndDES_CBC "pbeWithMD5AndDES-CBC" +#define NID_pbeWithMD5AndDES_CBC 10 +#define OBJ_pbeWithMD5AndDES_CBC OBJ_pkcs5, 3L + +#define SN_pbeWithMD2AndRC2_CBC "PBE-MD2-RC2-64" +#define LN_pbeWithMD2AndRC2_CBC "pbeWithMD2AndRC2-CBC" +#define NID_pbeWithMD2AndRC2_CBC 168 +#define OBJ_pbeWithMD2AndRC2_CBC OBJ_pkcs5, 4L + +#define SN_pbeWithMD5AndRC2_CBC "PBE-MD5-RC2-64" +#define LN_pbeWithMD5AndRC2_CBC "pbeWithMD5AndRC2-CBC" +#define NID_pbeWithMD5AndRC2_CBC 169 +#define OBJ_pbeWithMD5AndRC2_CBC OBJ_pkcs5, 6L + +#define SN_pbeWithSHA1AndDES_CBC "PBE-SHA1-DES" +#define LN_pbeWithSHA1AndDES_CBC "pbeWithSHA1AndDES-CBC" +#define NID_pbeWithSHA1AndDES_CBC 170 +#define OBJ_pbeWithSHA1AndDES_CBC OBJ_pkcs5, 10L + +#define SN_pbeWithSHA1AndRC2_CBC "PBE-SHA1-RC2-64" +#define LN_pbeWithSHA1AndRC2_CBC "pbeWithSHA1AndRC2-CBC" +#define NID_pbeWithSHA1AndRC2_CBC 68 +#define OBJ_pbeWithSHA1AndRC2_CBC OBJ_pkcs5, 11L + +#define LN_id_pbkdf2 "PBKDF2" +#define NID_id_pbkdf2 69 +#define OBJ_id_pbkdf2 OBJ_pkcs5, 12L + +#define LN_pbes2 "PBES2" +#define NID_pbes2 161 +#define OBJ_pbes2 OBJ_pkcs5, 13L + +#define LN_pbmac1 "PBMAC1" +#define NID_pbmac1 162 +#define OBJ_pbmac1 OBJ_pkcs5, 14L + +#define SN_pkcs7 "pkcs7" +#define NID_pkcs7 20 +#define OBJ_pkcs7 OBJ_pkcs, 7L + +#define LN_pkcs7_data "pkcs7-data" +#define NID_pkcs7_data 21 +#define OBJ_pkcs7_data OBJ_pkcs7, 1L + +#define LN_pkcs7_signed "pkcs7-signedData" +#define NID_pkcs7_signed 22 +#define OBJ_pkcs7_signed OBJ_pkcs7, 2L + +#define LN_pkcs7_enveloped "pkcs7-envelopedData" +#define NID_pkcs7_enveloped 23 +#define OBJ_pkcs7_enveloped OBJ_pkcs7, 3L + +#define LN_pkcs7_signedAndEnveloped "pkcs7-signedAndEnvelopedData" +#define NID_pkcs7_signedAndEnveloped 24 +#define OBJ_pkcs7_signedAndEnveloped OBJ_pkcs7, 4L + +#define LN_pkcs7_digest "pkcs7-digestData" +#define NID_pkcs7_digest 25 +#define OBJ_pkcs7_digest OBJ_pkcs7, 5L + +#define LN_pkcs7_encrypted "pkcs7-encryptedData" +#define NID_pkcs7_encrypted 26 +#define OBJ_pkcs7_encrypted OBJ_pkcs7, 6L + +#define SN_pkcs9 "pkcs9" +#define NID_pkcs9 47 +#define OBJ_pkcs9 OBJ_pkcs, 9L + +#define LN_pkcs9_emailAddress "emailAddress" +#define NID_pkcs9_emailAddress 48 +#define OBJ_pkcs9_emailAddress OBJ_pkcs9, 1L + +#define LN_pkcs9_unstructuredName "unstructuredName" +#define NID_pkcs9_unstructuredName 49 +#define OBJ_pkcs9_unstructuredName OBJ_pkcs9, 2L + +#define LN_pkcs9_contentType "contentType" +#define NID_pkcs9_contentType 50 +#define OBJ_pkcs9_contentType OBJ_pkcs9, 3L + +#define LN_pkcs9_messageDigest "messageDigest" +#define NID_pkcs9_messageDigest 51 +#define OBJ_pkcs9_messageDigest OBJ_pkcs9, 4L + +#define LN_pkcs9_signingTime "signingTime" +#define NID_pkcs9_signingTime 52 +#define OBJ_pkcs9_signingTime OBJ_pkcs9, 5L + +#define LN_pkcs9_countersignature "countersignature" +#define NID_pkcs9_countersignature 53 +#define OBJ_pkcs9_countersignature OBJ_pkcs9, 6L + +#define LN_pkcs9_challengePassword "challengePassword" +#define NID_pkcs9_challengePassword 54 +#define OBJ_pkcs9_challengePassword OBJ_pkcs9, 7L + +#define LN_pkcs9_unstructuredAddress "unstructuredAddress" +#define NID_pkcs9_unstructuredAddress 55 +#define OBJ_pkcs9_unstructuredAddress OBJ_pkcs9, 8L + +#define LN_pkcs9_extCertAttributes "extendedCertificateAttributes" +#define NID_pkcs9_extCertAttributes 56 +#define OBJ_pkcs9_extCertAttributes OBJ_pkcs9, 9L + +#define SN_ext_req "extReq" +#define LN_ext_req "Extension Request" +#define NID_ext_req 172 +#define OBJ_ext_req OBJ_pkcs9, 14L + +#define SN_SMIMECapabilities "SMIME-CAPS" +#define LN_SMIMECapabilities "S/MIME Capabilities" +#define NID_SMIMECapabilities 167 +#define OBJ_SMIMECapabilities OBJ_pkcs9, 15L + +#define SN_SMIME "SMIME" +#define LN_SMIME "S/MIME" +#define NID_SMIME 188 +#define OBJ_SMIME OBJ_pkcs9, 16L + +#define SN_id_smime_mod "id-smime-mod" +#define NID_id_smime_mod 189 +#define OBJ_id_smime_mod OBJ_SMIME, 0L + +#define SN_id_smime_ct "id-smime-ct" +#define NID_id_smime_ct 190 +#define OBJ_id_smime_ct OBJ_SMIME, 1L + +#define SN_id_smime_aa "id-smime-aa" +#define NID_id_smime_aa 191 +#define OBJ_id_smime_aa OBJ_SMIME, 2L + +#define SN_id_smime_alg "id-smime-alg" +#define NID_id_smime_alg 192 +#define OBJ_id_smime_alg OBJ_SMIME, 3L + +#define SN_id_smime_cd "id-smime-cd" +#define NID_id_smime_cd 193 +#define OBJ_id_smime_cd OBJ_SMIME, 4L + +#define SN_id_smime_spq "id-smime-spq" +#define NID_id_smime_spq 194 +#define OBJ_id_smime_spq OBJ_SMIME, 5L + +#define SN_id_smime_cti "id-smime-cti" +#define NID_id_smime_cti 195 +#define OBJ_id_smime_cti OBJ_SMIME, 6L + +#define SN_id_smime_mod_cms "id-smime-mod-cms" +#define NID_id_smime_mod_cms 196 +#define OBJ_id_smime_mod_cms OBJ_id_smime_mod, 1L + +#define SN_id_smime_mod_ess "id-smime-mod-ess" +#define NID_id_smime_mod_ess 197 +#define OBJ_id_smime_mod_ess OBJ_id_smime_mod, 2L + +#define SN_id_smime_mod_oid "id-smime-mod-oid" +#define NID_id_smime_mod_oid 198 +#define OBJ_id_smime_mod_oid OBJ_id_smime_mod, 3L + +#define SN_id_smime_mod_msg_v3 "id-smime-mod-msg-v3" +#define NID_id_smime_mod_msg_v3 199 +#define OBJ_id_smime_mod_msg_v3 OBJ_id_smime_mod, 4L + +#define SN_id_smime_mod_ets_eSignature_88 "id-smime-mod-ets-eSignature-88" +#define NID_id_smime_mod_ets_eSignature_88 200 +#define OBJ_id_smime_mod_ets_eSignature_88 OBJ_id_smime_mod, 5L + +#define SN_id_smime_mod_ets_eSignature_97 "id-smime-mod-ets-eSignature-97" +#define NID_id_smime_mod_ets_eSignature_97 201 +#define OBJ_id_smime_mod_ets_eSignature_97 OBJ_id_smime_mod, 6L + +#define SN_id_smime_mod_ets_eSigPolicy_88 "id-smime-mod-ets-eSigPolicy-88" +#define NID_id_smime_mod_ets_eSigPolicy_88 202 +#define OBJ_id_smime_mod_ets_eSigPolicy_88 OBJ_id_smime_mod, 7L + +#define SN_id_smime_mod_ets_eSigPolicy_97 "id-smime-mod-ets-eSigPolicy-97" +#define NID_id_smime_mod_ets_eSigPolicy_97 203 +#define OBJ_id_smime_mod_ets_eSigPolicy_97 OBJ_id_smime_mod, 8L + +#define SN_id_smime_ct_receipt "id-smime-ct-receipt" +#define NID_id_smime_ct_receipt 204 +#define OBJ_id_smime_ct_receipt OBJ_id_smime_ct, 1L + +#define SN_id_smime_ct_authData "id-smime-ct-authData" +#define NID_id_smime_ct_authData 205 +#define OBJ_id_smime_ct_authData OBJ_id_smime_ct, 2L + +#define SN_id_smime_ct_publishCert "id-smime-ct-publishCert" +#define NID_id_smime_ct_publishCert 206 +#define OBJ_id_smime_ct_publishCert OBJ_id_smime_ct, 3L + +#define SN_id_smime_ct_TSTInfo "id-smime-ct-TSTInfo" +#define NID_id_smime_ct_TSTInfo 207 +#define OBJ_id_smime_ct_TSTInfo OBJ_id_smime_ct, 4L + +#define SN_id_smime_ct_TDTInfo "id-smime-ct-TDTInfo" +#define NID_id_smime_ct_TDTInfo 208 +#define OBJ_id_smime_ct_TDTInfo OBJ_id_smime_ct, 5L + +#define SN_id_smime_ct_contentInfo "id-smime-ct-contentInfo" +#define NID_id_smime_ct_contentInfo 209 +#define OBJ_id_smime_ct_contentInfo OBJ_id_smime_ct, 6L + +#define SN_id_smime_ct_DVCSRequestData "id-smime-ct-DVCSRequestData" +#define NID_id_smime_ct_DVCSRequestData 210 +#define OBJ_id_smime_ct_DVCSRequestData OBJ_id_smime_ct, 7L + +#define SN_id_smime_ct_DVCSResponseData "id-smime-ct-DVCSResponseData" +#define NID_id_smime_ct_DVCSResponseData 211 +#define OBJ_id_smime_ct_DVCSResponseData OBJ_id_smime_ct, 8L + +#define SN_id_smime_ct_compressedData "id-smime-ct-compressedData" +#define NID_id_smime_ct_compressedData 786 +#define OBJ_id_smime_ct_compressedData OBJ_id_smime_ct, 9L + +#define SN_id_ct_asciiTextWithCRLF "id-ct-asciiTextWithCRLF" +#define NID_id_ct_asciiTextWithCRLF 787 +#define OBJ_id_ct_asciiTextWithCRLF OBJ_id_smime_ct, 27L + +#define SN_id_smime_aa_receiptRequest "id-smime-aa-receiptRequest" +#define NID_id_smime_aa_receiptRequest 212 +#define OBJ_id_smime_aa_receiptRequest OBJ_id_smime_aa, 1L + +#define SN_id_smime_aa_securityLabel "id-smime-aa-securityLabel" +#define NID_id_smime_aa_securityLabel 213 +#define OBJ_id_smime_aa_securityLabel OBJ_id_smime_aa, 2L + +#define SN_id_smime_aa_mlExpandHistory "id-smime-aa-mlExpandHistory" +#define NID_id_smime_aa_mlExpandHistory 214 +#define OBJ_id_smime_aa_mlExpandHistory OBJ_id_smime_aa, 3L + +#define SN_id_smime_aa_contentHint "id-smime-aa-contentHint" +#define NID_id_smime_aa_contentHint 215 +#define OBJ_id_smime_aa_contentHint OBJ_id_smime_aa, 4L + +#define SN_id_smime_aa_msgSigDigest "id-smime-aa-msgSigDigest" +#define NID_id_smime_aa_msgSigDigest 216 +#define OBJ_id_smime_aa_msgSigDigest OBJ_id_smime_aa, 5L + +#define SN_id_smime_aa_encapContentType "id-smime-aa-encapContentType" +#define NID_id_smime_aa_encapContentType 217 +#define OBJ_id_smime_aa_encapContentType OBJ_id_smime_aa, 6L + +#define SN_id_smime_aa_contentIdentifier "id-smime-aa-contentIdentifier" +#define NID_id_smime_aa_contentIdentifier 218 +#define OBJ_id_smime_aa_contentIdentifier OBJ_id_smime_aa, 7L + +#define SN_id_smime_aa_macValue "id-smime-aa-macValue" +#define NID_id_smime_aa_macValue 219 +#define OBJ_id_smime_aa_macValue OBJ_id_smime_aa, 8L + +#define SN_id_smime_aa_equivalentLabels "id-smime-aa-equivalentLabels" +#define NID_id_smime_aa_equivalentLabels 220 +#define OBJ_id_smime_aa_equivalentLabels OBJ_id_smime_aa, 9L + +#define SN_id_smime_aa_contentReference "id-smime-aa-contentReference" +#define NID_id_smime_aa_contentReference 221 +#define OBJ_id_smime_aa_contentReference OBJ_id_smime_aa, 10L + +#define SN_id_smime_aa_encrypKeyPref "id-smime-aa-encrypKeyPref" +#define NID_id_smime_aa_encrypKeyPref 222 +#define OBJ_id_smime_aa_encrypKeyPref OBJ_id_smime_aa, 11L + +#define SN_id_smime_aa_signingCertificate "id-smime-aa-signingCertificate" +#define NID_id_smime_aa_signingCertificate 223 +#define OBJ_id_smime_aa_signingCertificate OBJ_id_smime_aa, 12L + +#define SN_id_smime_aa_smimeEncryptCerts "id-smime-aa-smimeEncryptCerts" +#define NID_id_smime_aa_smimeEncryptCerts 224 +#define OBJ_id_smime_aa_smimeEncryptCerts OBJ_id_smime_aa, 13L + +#define SN_id_smime_aa_timeStampToken "id-smime-aa-timeStampToken" +#define NID_id_smime_aa_timeStampToken 225 +#define OBJ_id_smime_aa_timeStampToken OBJ_id_smime_aa, 14L + +#define SN_id_smime_aa_ets_sigPolicyId "id-smime-aa-ets-sigPolicyId" +#define NID_id_smime_aa_ets_sigPolicyId 226 +#define OBJ_id_smime_aa_ets_sigPolicyId OBJ_id_smime_aa, 15L + +#define SN_id_smime_aa_ets_commitmentType "id-smime-aa-ets-commitmentType" +#define NID_id_smime_aa_ets_commitmentType 227 +#define OBJ_id_smime_aa_ets_commitmentType OBJ_id_smime_aa, 16L + +#define SN_id_smime_aa_ets_signerLocation "id-smime-aa-ets-signerLocation" +#define NID_id_smime_aa_ets_signerLocation 228 +#define OBJ_id_smime_aa_ets_signerLocation OBJ_id_smime_aa, 17L + +#define SN_id_smime_aa_ets_signerAttr "id-smime-aa-ets-signerAttr" +#define NID_id_smime_aa_ets_signerAttr 229 +#define OBJ_id_smime_aa_ets_signerAttr OBJ_id_smime_aa, 18L + +#define SN_id_smime_aa_ets_otherSigCert "id-smime-aa-ets-otherSigCert" +#define NID_id_smime_aa_ets_otherSigCert 230 +#define OBJ_id_smime_aa_ets_otherSigCert OBJ_id_smime_aa, 19L + +#define SN_id_smime_aa_ets_contentTimestamp "id-smime-aa-ets-contentTimestamp" +#define NID_id_smime_aa_ets_contentTimestamp 231 +#define OBJ_id_smime_aa_ets_contentTimestamp OBJ_id_smime_aa, 20L + +#define SN_id_smime_aa_ets_CertificateRefs "id-smime-aa-ets-CertificateRefs" +#define NID_id_smime_aa_ets_CertificateRefs 232 +#define OBJ_id_smime_aa_ets_CertificateRefs OBJ_id_smime_aa, 21L + +#define SN_id_smime_aa_ets_RevocationRefs "id-smime-aa-ets-RevocationRefs" +#define NID_id_smime_aa_ets_RevocationRefs 233 +#define OBJ_id_smime_aa_ets_RevocationRefs OBJ_id_smime_aa, 22L + +#define SN_id_smime_aa_ets_certValues "id-smime-aa-ets-certValues" +#define NID_id_smime_aa_ets_certValues 234 +#define OBJ_id_smime_aa_ets_certValues OBJ_id_smime_aa, 23L + +#define SN_id_smime_aa_ets_revocationValues "id-smime-aa-ets-revocationValues" +#define NID_id_smime_aa_ets_revocationValues 235 +#define OBJ_id_smime_aa_ets_revocationValues OBJ_id_smime_aa, 24L + +#define SN_id_smime_aa_ets_escTimeStamp "id-smime-aa-ets-escTimeStamp" +#define NID_id_smime_aa_ets_escTimeStamp 236 +#define OBJ_id_smime_aa_ets_escTimeStamp OBJ_id_smime_aa, 25L + +#define SN_id_smime_aa_ets_certCRLTimestamp "id-smime-aa-ets-certCRLTimestamp" +#define NID_id_smime_aa_ets_certCRLTimestamp 237 +#define OBJ_id_smime_aa_ets_certCRLTimestamp OBJ_id_smime_aa, 26L + +#define SN_id_smime_aa_ets_archiveTimeStamp "id-smime-aa-ets-archiveTimeStamp" +#define NID_id_smime_aa_ets_archiveTimeStamp 238 +#define OBJ_id_smime_aa_ets_archiveTimeStamp OBJ_id_smime_aa, 27L + +#define SN_id_smime_aa_signatureType "id-smime-aa-signatureType" +#define NID_id_smime_aa_signatureType 239 +#define OBJ_id_smime_aa_signatureType OBJ_id_smime_aa, 28L + +#define SN_id_smime_aa_dvcs_dvc "id-smime-aa-dvcs-dvc" +#define NID_id_smime_aa_dvcs_dvc 240 +#define OBJ_id_smime_aa_dvcs_dvc OBJ_id_smime_aa, 29L + +#define SN_id_smime_alg_ESDHwith3DES "id-smime-alg-ESDHwith3DES" +#define NID_id_smime_alg_ESDHwith3DES 241 +#define OBJ_id_smime_alg_ESDHwith3DES OBJ_id_smime_alg, 1L + +#define SN_id_smime_alg_ESDHwithRC2 "id-smime-alg-ESDHwithRC2" +#define NID_id_smime_alg_ESDHwithRC2 242 +#define OBJ_id_smime_alg_ESDHwithRC2 OBJ_id_smime_alg, 2L + +#define SN_id_smime_alg_3DESwrap "id-smime-alg-3DESwrap" +#define NID_id_smime_alg_3DESwrap 243 +#define OBJ_id_smime_alg_3DESwrap OBJ_id_smime_alg, 3L + +#define SN_id_smime_alg_RC2wrap "id-smime-alg-RC2wrap" +#define NID_id_smime_alg_RC2wrap 244 +#define OBJ_id_smime_alg_RC2wrap OBJ_id_smime_alg, 4L + +#define SN_id_smime_alg_ESDH "id-smime-alg-ESDH" +#define NID_id_smime_alg_ESDH 245 +#define OBJ_id_smime_alg_ESDH OBJ_id_smime_alg, 5L + +#define SN_id_smime_alg_CMS3DESwrap "id-smime-alg-CMS3DESwrap" +#define NID_id_smime_alg_CMS3DESwrap 246 +#define OBJ_id_smime_alg_CMS3DESwrap OBJ_id_smime_alg, 6L + +#define SN_id_smime_alg_CMSRC2wrap "id-smime-alg-CMSRC2wrap" +#define NID_id_smime_alg_CMSRC2wrap 247 +#define OBJ_id_smime_alg_CMSRC2wrap OBJ_id_smime_alg, 7L + +#define SN_id_alg_PWRI_KEK "id-alg-PWRI-KEK" +#define NID_id_alg_PWRI_KEK 893 +#define OBJ_id_alg_PWRI_KEK OBJ_id_smime_alg, 9L + +#define SN_id_smime_cd_ldap "id-smime-cd-ldap" +#define NID_id_smime_cd_ldap 248 +#define OBJ_id_smime_cd_ldap OBJ_id_smime_cd, 1L + +#define SN_id_smime_spq_ets_sqt_uri "id-smime-spq-ets-sqt-uri" +#define NID_id_smime_spq_ets_sqt_uri 249 +#define OBJ_id_smime_spq_ets_sqt_uri OBJ_id_smime_spq, 1L + +#define SN_id_smime_spq_ets_sqt_unotice "id-smime-spq-ets-sqt-unotice" +#define NID_id_smime_spq_ets_sqt_unotice 250 +#define OBJ_id_smime_spq_ets_sqt_unotice OBJ_id_smime_spq, 2L + +#define SN_id_smime_cti_ets_proofOfOrigin "id-smime-cti-ets-proofOfOrigin" +#define NID_id_smime_cti_ets_proofOfOrigin 251 +#define OBJ_id_smime_cti_ets_proofOfOrigin OBJ_id_smime_cti, 1L + +#define SN_id_smime_cti_ets_proofOfReceipt "id-smime-cti-ets-proofOfReceipt" +#define NID_id_smime_cti_ets_proofOfReceipt 252 +#define OBJ_id_smime_cti_ets_proofOfReceipt OBJ_id_smime_cti, 2L + +#define SN_id_smime_cti_ets_proofOfDelivery "id-smime-cti-ets-proofOfDelivery" +#define NID_id_smime_cti_ets_proofOfDelivery 253 +#define OBJ_id_smime_cti_ets_proofOfDelivery OBJ_id_smime_cti, 3L + +#define SN_id_smime_cti_ets_proofOfSender "id-smime-cti-ets-proofOfSender" +#define NID_id_smime_cti_ets_proofOfSender 254 +#define OBJ_id_smime_cti_ets_proofOfSender OBJ_id_smime_cti, 4L + +#define SN_id_smime_cti_ets_proofOfApproval "id-smime-cti-ets-proofOfApproval" +#define NID_id_smime_cti_ets_proofOfApproval 255 +#define OBJ_id_smime_cti_ets_proofOfApproval OBJ_id_smime_cti, 5L + +#define SN_id_smime_cti_ets_proofOfCreation "id-smime-cti-ets-proofOfCreation" +#define NID_id_smime_cti_ets_proofOfCreation 256 +#define OBJ_id_smime_cti_ets_proofOfCreation OBJ_id_smime_cti, 6L + +#define LN_friendlyName "friendlyName" +#define NID_friendlyName 156 +#define OBJ_friendlyName OBJ_pkcs9, 20L + +#define LN_localKeyID "localKeyID" +#define NID_localKeyID 157 +#define OBJ_localKeyID OBJ_pkcs9, 21L + +#define SN_ms_csp_name "CSPName" +#define LN_ms_csp_name "Microsoft CSP Name" +#define NID_ms_csp_name 417 +#define OBJ_ms_csp_name 1L, 3L, 6L, 1L, 4L, 1L, 311L, 17L, 1L + +#define SN_LocalKeySet "LocalKeySet" +#define LN_LocalKeySet "Microsoft Local Key set" +#define NID_LocalKeySet 856 +#define OBJ_LocalKeySet 1L, 3L, 6L, 1L, 4L, 1L, 311L, 17L, 2L + +#define OBJ_certTypes OBJ_pkcs9, 22L + +#define LN_x509Certificate "x509Certificate" +#define NID_x509Certificate 158 +#define OBJ_x509Certificate OBJ_certTypes, 1L + +#define LN_sdsiCertificate "sdsiCertificate" +#define NID_sdsiCertificate 159 +#define OBJ_sdsiCertificate OBJ_certTypes, 2L + +#define OBJ_crlTypes OBJ_pkcs9, 23L + +#define LN_x509Crl "x509Crl" +#define NID_x509Crl 160 +#define OBJ_x509Crl OBJ_crlTypes, 1L + +#define OBJ_pkcs12 OBJ_pkcs, 12L + +#define OBJ_pkcs12_pbeids OBJ_pkcs12, 1L + +#define SN_pbe_WithSHA1And128BitRC4 "PBE-SHA1-RC4-128" +#define LN_pbe_WithSHA1And128BitRC4 "pbeWithSHA1And128BitRC4" +#define NID_pbe_WithSHA1And128BitRC4 144 +#define OBJ_pbe_WithSHA1And128BitRC4 OBJ_pkcs12_pbeids, 1L + +#define SN_pbe_WithSHA1And40BitRC4 "PBE-SHA1-RC4-40" +#define LN_pbe_WithSHA1And40BitRC4 "pbeWithSHA1And40BitRC4" +#define NID_pbe_WithSHA1And40BitRC4 145 +#define OBJ_pbe_WithSHA1And40BitRC4 OBJ_pkcs12_pbeids, 2L + +#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC "PBE-SHA1-3DES" +#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC "pbeWithSHA1And3-KeyTripleDES-CBC" +#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC 146 +#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC OBJ_pkcs12_pbeids, 3L + +#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC "PBE-SHA1-2DES" +#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC "pbeWithSHA1And2-KeyTripleDES-CBC" +#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC 147 +#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC OBJ_pkcs12_pbeids, 4L + +#define SN_pbe_WithSHA1And128BitRC2_CBC "PBE-SHA1-RC2-128" +#define LN_pbe_WithSHA1And128BitRC2_CBC "pbeWithSHA1And128BitRC2-CBC" +#define NID_pbe_WithSHA1And128BitRC2_CBC 148 +#define OBJ_pbe_WithSHA1And128BitRC2_CBC OBJ_pkcs12_pbeids, 5L + +#define SN_pbe_WithSHA1And40BitRC2_CBC "PBE-SHA1-RC2-40" +#define LN_pbe_WithSHA1And40BitRC2_CBC "pbeWithSHA1And40BitRC2-CBC" +#define NID_pbe_WithSHA1And40BitRC2_CBC 149 +#define OBJ_pbe_WithSHA1And40BitRC2_CBC OBJ_pkcs12_pbeids, 6L + +#define OBJ_pkcs12_Version1 OBJ_pkcs12, 10L + +#define OBJ_pkcs12_BagIds OBJ_pkcs12_Version1, 1L + +#define LN_keyBag "keyBag" +#define NID_keyBag 150 +#define OBJ_keyBag OBJ_pkcs12_BagIds, 1L + +#define LN_pkcs8ShroudedKeyBag "pkcs8ShroudedKeyBag" +#define NID_pkcs8ShroudedKeyBag 151 +#define OBJ_pkcs8ShroudedKeyBag OBJ_pkcs12_BagIds, 2L + +#define LN_certBag "certBag" +#define NID_certBag 152 +#define OBJ_certBag OBJ_pkcs12_BagIds, 3L + +#define LN_crlBag "crlBag" +#define NID_crlBag 153 +#define OBJ_crlBag OBJ_pkcs12_BagIds, 4L + +#define LN_secretBag "secretBag" +#define NID_secretBag 154 +#define OBJ_secretBag OBJ_pkcs12_BagIds, 5L + +#define LN_safeContentsBag "safeContentsBag" +#define NID_safeContentsBag 155 +#define OBJ_safeContentsBag OBJ_pkcs12_BagIds, 6L + +#define SN_md2 "MD2" +#define LN_md2 "md2" +#define NID_md2 3 +#define OBJ_md2 OBJ_rsadsi, 2L, 2L + +#define SN_md4 "MD4" +#define LN_md4 "md4" +#define NID_md4 257 +#define OBJ_md4 OBJ_rsadsi, 2L, 4L + +#define SN_md5 "MD5" +#define LN_md5 "md5" +#define NID_md5 4 +#define OBJ_md5 OBJ_rsadsi, 2L, 5L + +#define SN_md5_sha1 "MD5-SHA1" +#define LN_md5_sha1 "md5-sha1" +#define NID_md5_sha1 114 + +#define LN_hmacWithMD5 "hmacWithMD5" +#define NID_hmacWithMD5 797 +#define OBJ_hmacWithMD5 OBJ_rsadsi, 2L, 6L + +#define LN_hmacWithSHA1 "hmacWithSHA1" +#define NID_hmacWithSHA1 163 +#define OBJ_hmacWithSHA1 OBJ_rsadsi, 2L, 7L + +#define LN_hmacWithSHA224 "hmacWithSHA224" +#define NID_hmacWithSHA224 798 +#define OBJ_hmacWithSHA224 OBJ_rsadsi, 2L, 8L + +#define LN_hmacWithSHA256 "hmacWithSHA256" +#define NID_hmacWithSHA256 799 +#define OBJ_hmacWithSHA256 OBJ_rsadsi, 2L, 9L + +#define LN_hmacWithSHA384 "hmacWithSHA384" +#define NID_hmacWithSHA384 800 +#define OBJ_hmacWithSHA384 OBJ_rsadsi, 2L, 10L + +#define LN_hmacWithSHA512 "hmacWithSHA512" +#define NID_hmacWithSHA512 801 +#define OBJ_hmacWithSHA512 OBJ_rsadsi, 2L, 11L + +#define SN_rc2_cbc "RC2-CBC" +#define LN_rc2_cbc "rc2-cbc" +#define NID_rc2_cbc 37 +#define OBJ_rc2_cbc OBJ_rsadsi, 3L, 2L + +#define SN_rc2_ecb "RC2-ECB" +#define LN_rc2_ecb "rc2-ecb" +#define NID_rc2_ecb 38 + +#define SN_rc2_cfb64 "RC2-CFB" +#define LN_rc2_cfb64 "rc2-cfb" +#define NID_rc2_cfb64 39 + +#define SN_rc2_ofb64 "RC2-OFB" +#define LN_rc2_ofb64 "rc2-ofb" +#define NID_rc2_ofb64 40 + +#define SN_rc2_40_cbc "RC2-40-CBC" +#define LN_rc2_40_cbc "rc2-40-cbc" +#define NID_rc2_40_cbc 98 + +#define SN_rc2_64_cbc "RC2-64-CBC" +#define LN_rc2_64_cbc "rc2-64-cbc" +#define NID_rc2_64_cbc 166 + +#define SN_rc4 "RC4" +#define LN_rc4 "rc4" +#define NID_rc4 5 +#define OBJ_rc4 OBJ_rsadsi, 3L, 4L + +#define SN_rc4_40 "RC4-40" +#define LN_rc4_40 "rc4-40" +#define NID_rc4_40 97 + +#define SN_des_ede3_cbc "DES-EDE3-CBC" +#define LN_des_ede3_cbc "des-ede3-cbc" +#define NID_des_ede3_cbc 44 +#define OBJ_des_ede3_cbc OBJ_rsadsi, 3L, 7L + +#define SN_rc5_cbc "RC5-CBC" +#define LN_rc5_cbc "rc5-cbc" +#define NID_rc5_cbc 120 +#define OBJ_rc5_cbc OBJ_rsadsi, 3L, 8L + +#define SN_rc5_ecb "RC5-ECB" +#define LN_rc5_ecb "rc5-ecb" +#define NID_rc5_ecb 121 + +#define SN_rc5_cfb64 "RC5-CFB" +#define LN_rc5_cfb64 "rc5-cfb" +#define NID_rc5_cfb64 122 + +#define SN_rc5_ofb64 "RC5-OFB" +#define LN_rc5_ofb64 "rc5-ofb" +#define NID_rc5_ofb64 123 + +#define SN_ms_ext_req "msExtReq" +#define LN_ms_ext_req "Microsoft Extension Request" +#define NID_ms_ext_req 171 +#define OBJ_ms_ext_req 1L, 3L, 6L, 1L, 4L, 1L, 311L, 2L, 1L, 14L + +#define SN_ms_code_ind "msCodeInd" +#define LN_ms_code_ind "Microsoft Individual Code Signing" +#define NID_ms_code_ind 134 +#define OBJ_ms_code_ind 1L, 3L, 6L, 1L, 4L, 1L, 311L, 2L, 1L, 21L + +#define SN_ms_code_com "msCodeCom" +#define LN_ms_code_com "Microsoft Commercial Code Signing" +#define NID_ms_code_com 135 +#define OBJ_ms_code_com 1L, 3L, 6L, 1L, 4L, 1L, 311L, 2L, 1L, 22L + +#define SN_ms_ctl_sign "msCTLSign" +#define LN_ms_ctl_sign "Microsoft Trust List Signing" +#define NID_ms_ctl_sign 136 +#define OBJ_ms_ctl_sign 1L, 3L, 6L, 1L, 4L, 1L, 311L, 10L, 3L, 1L + +#define SN_ms_sgc "msSGC" +#define LN_ms_sgc "Microsoft Server Gated Crypto" +#define NID_ms_sgc 137 +#define OBJ_ms_sgc 1L, 3L, 6L, 1L, 4L, 1L, 311L, 10L, 3L, 3L + +#define SN_ms_efs "msEFS" +#define LN_ms_efs "Microsoft Encrypted File System" +#define NID_ms_efs 138 +#define OBJ_ms_efs 1L, 3L, 6L, 1L, 4L, 1L, 311L, 10L, 3L, 4L + +#define SN_ms_smartcard_login "msSmartcardLogin" +#define LN_ms_smartcard_login "Microsoft Smartcardlogin" +#define NID_ms_smartcard_login 648 +#define OBJ_ms_smartcard_login 1L, 3L, 6L, 1L, 4L, 1L, 311L, 20L, 2L, 2L + +#define SN_ms_upn "msUPN" +#define LN_ms_upn "Microsoft Universal Principal Name" +#define NID_ms_upn 649 +#define OBJ_ms_upn 1L, 3L, 6L, 1L, 4L, 1L, 311L, 20L, 2L, 3L + +#define SN_idea_cbc "IDEA-CBC" +#define LN_idea_cbc "idea-cbc" +#define NID_idea_cbc 34 +#define OBJ_idea_cbc 1L, 3L, 6L, 1L, 4L, 1L, 188L, 7L, 1L, 1L, 2L + +#define SN_idea_ecb "IDEA-ECB" +#define LN_idea_ecb "idea-ecb" +#define NID_idea_ecb 36 + +#define SN_idea_cfb64 "IDEA-CFB" +#define LN_idea_cfb64 "idea-cfb" +#define NID_idea_cfb64 35 + +#define SN_idea_ofb64 "IDEA-OFB" +#define LN_idea_ofb64 "idea-ofb" +#define NID_idea_ofb64 46 + +#define SN_bf_cbc "BF-CBC" +#define LN_bf_cbc "bf-cbc" +#define NID_bf_cbc 91 +#define OBJ_bf_cbc 1L, 3L, 6L, 1L, 4L, 1L, 3029L, 1L, 2L + +#define SN_bf_ecb "BF-ECB" +#define LN_bf_ecb "bf-ecb" +#define NID_bf_ecb 92 + +#define SN_bf_cfb64 "BF-CFB" +#define LN_bf_cfb64 "bf-cfb" +#define NID_bf_cfb64 93 + +#define SN_bf_ofb64 "BF-OFB" +#define LN_bf_ofb64 "bf-ofb" +#define NID_bf_ofb64 94 + +#define SN_id_pkix "PKIX" +#define NID_id_pkix 127 +#define OBJ_id_pkix 1L, 3L, 6L, 1L, 5L, 5L, 7L + +#define SN_id_pkix_mod "id-pkix-mod" +#define NID_id_pkix_mod 258 +#define OBJ_id_pkix_mod OBJ_id_pkix, 0L + +#define SN_id_pe "id-pe" +#define NID_id_pe 175 +#define OBJ_id_pe OBJ_id_pkix, 1L + +#define SN_id_qt "id-qt" +#define NID_id_qt 259 +#define OBJ_id_qt OBJ_id_pkix, 2L + +#define SN_id_kp "id-kp" +#define NID_id_kp 128 +#define OBJ_id_kp OBJ_id_pkix, 3L + +#define SN_id_it "id-it" +#define NID_id_it 260 +#define OBJ_id_it OBJ_id_pkix, 4L + +#define SN_id_pkip "id-pkip" +#define NID_id_pkip 261 +#define OBJ_id_pkip OBJ_id_pkix, 5L + +#define SN_id_alg "id-alg" +#define NID_id_alg 262 +#define OBJ_id_alg OBJ_id_pkix, 6L + +#define SN_id_cmc "id-cmc" +#define NID_id_cmc 263 +#define OBJ_id_cmc OBJ_id_pkix, 7L + +#define SN_id_on "id-on" +#define NID_id_on 264 +#define OBJ_id_on OBJ_id_pkix, 8L + +#define SN_id_pda "id-pda" +#define NID_id_pda 265 +#define OBJ_id_pda OBJ_id_pkix, 9L + +#define SN_id_aca "id-aca" +#define NID_id_aca 266 +#define OBJ_id_aca OBJ_id_pkix, 10L + +#define SN_id_qcs "id-qcs" +#define NID_id_qcs 267 +#define OBJ_id_qcs OBJ_id_pkix, 11L + +#define SN_id_cct "id-cct" +#define NID_id_cct 268 +#define OBJ_id_cct OBJ_id_pkix, 12L + +#define SN_id_ppl "id-ppl" +#define NID_id_ppl 662 +#define OBJ_id_ppl OBJ_id_pkix, 21L + +#define SN_id_ad "id-ad" +#define NID_id_ad 176 +#define OBJ_id_ad OBJ_id_pkix, 48L + +#define SN_id_pkix1_explicit_88 "id-pkix1-explicit-88" +#define NID_id_pkix1_explicit_88 269 +#define OBJ_id_pkix1_explicit_88 OBJ_id_pkix_mod, 1L + +#define SN_id_pkix1_implicit_88 "id-pkix1-implicit-88" +#define NID_id_pkix1_implicit_88 270 +#define OBJ_id_pkix1_implicit_88 OBJ_id_pkix_mod, 2L + +#define SN_id_pkix1_explicit_93 "id-pkix1-explicit-93" +#define NID_id_pkix1_explicit_93 271 +#define OBJ_id_pkix1_explicit_93 OBJ_id_pkix_mod, 3L + +#define SN_id_pkix1_implicit_93 "id-pkix1-implicit-93" +#define NID_id_pkix1_implicit_93 272 +#define OBJ_id_pkix1_implicit_93 OBJ_id_pkix_mod, 4L + +#define SN_id_mod_crmf "id-mod-crmf" +#define NID_id_mod_crmf 273 +#define OBJ_id_mod_crmf OBJ_id_pkix_mod, 5L + +#define SN_id_mod_cmc "id-mod-cmc" +#define NID_id_mod_cmc 274 +#define OBJ_id_mod_cmc OBJ_id_pkix_mod, 6L + +#define SN_id_mod_kea_profile_88 "id-mod-kea-profile-88" +#define NID_id_mod_kea_profile_88 275 +#define OBJ_id_mod_kea_profile_88 OBJ_id_pkix_mod, 7L + +#define SN_id_mod_kea_profile_93 "id-mod-kea-profile-93" +#define NID_id_mod_kea_profile_93 276 +#define OBJ_id_mod_kea_profile_93 OBJ_id_pkix_mod, 8L + +#define SN_id_mod_cmp "id-mod-cmp" +#define NID_id_mod_cmp 277 +#define OBJ_id_mod_cmp OBJ_id_pkix_mod, 9L + +#define SN_id_mod_qualified_cert_88 "id-mod-qualified-cert-88" +#define NID_id_mod_qualified_cert_88 278 +#define OBJ_id_mod_qualified_cert_88 OBJ_id_pkix_mod, 10L + +#define SN_id_mod_qualified_cert_93 "id-mod-qualified-cert-93" +#define NID_id_mod_qualified_cert_93 279 +#define OBJ_id_mod_qualified_cert_93 OBJ_id_pkix_mod, 11L + +#define SN_id_mod_attribute_cert "id-mod-attribute-cert" +#define NID_id_mod_attribute_cert 280 +#define OBJ_id_mod_attribute_cert OBJ_id_pkix_mod, 12L + +#define SN_id_mod_timestamp_protocol "id-mod-timestamp-protocol" +#define NID_id_mod_timestamp_protocol 281 +#define OBJ_id_mod_timestamp_protocol OBJ_id_pkix_mod, 13L + +#define SN_id_mod_ocsp "id-mod-ocsp" +#define NID_id_mod_ocsp 282 +#define OBJ_id_mod_ocsp OBJ_id_pkix_mod, 14L + +#define SN_id_mod_dvcs "id-mod-dvcs" +#define NID_id_mod_dvcs 283 +#define OBJ_id_mod_dvcs OBJ_id_pkix_mod, 15L + +#define SN_id_mod_cmp2000 "id-mod-cmp2000" +#define NID_id_mod_cmp2000 284 +#define OBJ_id_mod_cmp2000 OBJ_id_pkix_mod, 16L + +#define SN_info_access "authorityInfoAccess" +#define LN_info_access "Authority Information Access" +#define NID_info_access 177 +#define OBJ_info_access OBJ_id_pe, 1L + +#define SN_biometricInfo "biometricInfo" +#define LN_biometricInfo "Biometric Info" +#define NID_biometricInfo 285 +#define OBJ_biometricInfo OBJ_id_pe, 2L + +#define SN_qcStatements "qcStatements" +#define NID_qcStatements 286 +#define OBJ_qcStatements OBJ_id_pe, 3L + +#define SN_ac_auditEntity "ac-auditEntity" +#define NID_ac_auditEntity 287 +#define OBJ_ac_auditEntity OBJ_id_pe, 4L + +#define SN_ac_targeting "ac-targeting" +#define NID_ac_targeting 288 +#define OBJ_ac_targeting OBJ_id_pe, 5L + +#define SN_aaControls "aaControls" +#define NID_aaControls 289 +#define OBJ_aaControls OBJ_id_pe, 6L + +#define SN_sbgp_ipAddrBlock "sbgp-ipAddrBlock" +#define NID_sbgp_ipAddrBlock 290 +#define OBJ_sbgp_ipAddrBlock OBJ_id_pe, 7L + +#define SN_sbgp_autonomousSysNum "sbgp-autonomousSysNum" +#define NID_sbgp_autonomousSysNum 291 +#define OBJ_sbgp_autonomousSysNum OBJ_id_pe, 8L + +#define SN_sbgp_routerIdentifier "sbgp-routerIdentifier" +#define NID_sbgp_routerIdentifier 292 +#define OBJ_sbgp_routerIdentifier OBJ_id_pe, 9L + +#define SN_ac_proxying "ac-proxying" +#define NID_ac_proxying 397 +#define OBJ_ac_proxying OBJ_id_pe, 10L + +#define SN_sinfo_access "subjectInfoAccess" +#define LN_sinfo_access "Subject Information Access" +#define NID_sinfo_access 398 +#define OBJ_sinfo_access OBJ_id_pe, 11L + +#define SN_proxyCertInfo "proxyCertInfo" +#define LN_proxyCertInfo "Proxy Certificate Information" +#define NID_proxyCertInfo 663 +#define OBJ_proxyCertInfo OBJ_id_pe, 14L + +#define SN_id_qt_cps "id-qt-cps" +#define LN_id_qt_cps "Policy Qualifier CPS" +#define NID_id_qt_cps 164 +#define OBJ_id_qt_cps OBJ_id_qt, 1L + +#define SN_id_qt_unotice "id-qt-unotice" +#define LN_id_qt_unotice "Policy Qualifier User Notice" +#define NID_id_qt_unotice 165 +#define OBJ_id_qt_unotice OBJ_id_qt, 2L + +#define SN_textNotice "textNotice" +#define NID_textNotice 293 +#define OBJ_textNotice OBJ_id_qt, 3L + +#define SN_server_auth "serverAuth" +#define LN_server_auth "TLS Web Server Authentication" +#define NID_server_auth 129 +#define OBJ_server_auth OBJ_id_kp, 1L + +#define SN_client_auth "clientAuth" +#define LN_client_auth "TLS Web Client Authentication" +#define NID_client_auth 130 +#define OBJ_client_auth OBJ_id_kp, 2L + +#define SN_code_sign "codeSigning" +#define LN_code_sign "Code Signing" +#define NID_code_sign 131 +#define OBJ_code_sign OBJ_id_kp, 3L + +#define SN_email_protect "emailProtection" +#define LN_email_protect "E-mail Protection" +#define NID_email_protect 132 +#define OBJ_email_protect OBJ_id_kp, 4L + +#define SN_ipsecEndSystem "ipsecEndSystem" +#define LN_ipsecEndSystem "IPSec End System" +#define NID_ipsecEndSystem 294 +#define OBJ_ipsecEndSystem OBJ_id_kp, 5L + +#define SN_ipsecTunnel "ipsecTunnel" +#define LN_ipsecTunnel "IPSec Tunnel" +#define NID_ipsecTunnel 295 +#define OBJ_ipsecTunnel OBJ_id_kp, 6L + +#define SN_ipsecUser "ipsecUser" +#define LN_ipsecUser "IPSec User" +#define NID_ipsecUser 296 +#define OBJ_ipsecUser OBJ_id_kp, 7L + +#define SN_time_stamp "timeStamping" +#define LN_time_stamp "Time Stamping" +#define NID_time_stamp 133 +#define OBJ_time_stamp OBJ_id_kp, 8L + +#define SN_OCSP_sign "OCSPSigning" +#define LN_OCSP_sign "OCSP Signing" +#define NID_OCSP_sign 180 +#define OBJ_OCSP_sign OBJ_id_kp, 9L + +#define SN_dvcs "DVCS" +#define LN_dvcs "dvcs" +#define NID_dvcs 297 +#define OBJ_dvcs OBJ_id_kp, 10L + +#define SN_id_it_caProtEncCert "id-it-caProtEncCert" +#define NID_id_it_caProtEncCert 298 +#define OBJ_id_it_caProtEncCert OBJ_id_it, 1L + +#define SN_id_it_signKeyPairTypes "id-it-signKeyPairTypes" +#define NID_id_it_signKeyPairTypes 299 +#define OBJ_id_it_signKeyPairTypes OBJ_id_it, 2L + +#define SN_id_it_encKeyPairTypes "id-it-encKeyPairTypes" +#define NID_id_it_encKeyPairTypes 300 +#define OBJ_id_it_encKeyPairTypes OBJ_id_it, 3L + +#define SN_id_it_preferredSymmAlg "id-it-preferredSymmAlg" +#define NID_id_it_preferredSymmAlg 301 +#define OBJ_id_it_preferredSymmAlg OBJ_id_it, 4L + +#define SN_id_it_caKeyUpdateInfo "id-it-caKeyUpdateInfo" +#define NID_id_it_caKeyUpdateInfo 302 +#define OBJ_id_it_caKeyUpdateInfo OBJ_id_it, 5L + +#define SN_id_it_currentCRL "id-it-currentCRL" +#define NID_id_it_currentCRL 303 +#define OBJ_id_it_currentCRL OBJ_id_it, 6L + +#define SN_id_it_unsupportedOIDs "id-it-unsupportedOIDs" +#define NID_id_it_unsupportedOIDs 304 +#define OBJ_id_it_unsupportedOIDs OBJ_id_it, 7L + +#define SN_id_it_subscriptionRequest "id-it-subscriptionRequest" +#define NID_id_it_subscriptionRequest 305 +#define OBJ_id_it_subscriptionRequest OBJ_id_it, 8L + +#define SN_id_it_subscriptionResponse "id-it-subscriptionResponse" +#define NID_id_it_subscriptionResponse 306 +#define OBJ_id_it_subscriptionResponse OBJ_id_it, 9L + +#define SN_id_it_keyPairParamReq "id-it-keyPairParamReq" +#define NID_id_it_keyPairParamReq 307 +#define OBJ_id_it_keyPairParamReq OBJ_id_it, 10L + +#define SN_id_it_keyPairParamRep "id-it-keyPairParamRep" +#define NID_id_it_keyPairParamRep 308 +#define OBJ_id_it_keyPairParamRep OBJ_id_it, 11L + +#define SN_id_it_revPassphrase "id-it-revPassphrase" +#define NID_id_it_revPassphrase 309 +#define OBJ_id_it_revPassphrase OBJ_id_it, 12L + +#define SN_id_it_implicitConfirm "id-it-implicitConfirm" +#define NID_id_it_implicitConfirm 310 +#define OBJ_id_it_implicitConfirm OBJ_id_it, 13L + +#define SN_id_it_confirmWaitTime "id-it-confirmWaitTime" +#define NID_id_it_confirmWaitTime 311 +#define OBJ_id_it_confirmWaitTime OBJ_id_it, 14L + +#define SN_id_it_origPKIMessage "id-it-origPKIMessage" +#define NID_id_it_origPKIMessage 312 +#define OBJ_id_it_origPKIMessage OBJ_id_it, 15L + +#define SN_id_it_suppLangTags "id-it-suppLangTags" +#define NID_id_it_suppLangTags 784 +#define OBJ_id_it_suppLangTags OBJ_id_it, 16L + +#define SN_id_regCtrl "id-regCtrl" +#define NID_id_regCtrl 313 +#define OBJ_id_regCtrl OBJ_id_pkip, 1L + +#define SN_id_regInfo "id-regInfo" +#define NID_id_regInfo 314 +#define OBJ_id_regInfo OBJ_id_pkip, 2L + +#define SN_id_regCtrl_regToken "id-regCtrl-regToken" +#define NID_id_regCtrl_regToken 315 +#define OBJ_id_regCtrl_regToken OBJ_id_regCtrl, 1L + +#define SN_id_regCtrl_authenticator "id-regCtrl-authenticator" +#define NID_id_regCtrl_authenticator 316 +#define OBJ_id_regCtrl_authenticator OBJ_id_regCtrl, 2L + +#define SN_id_regCtrl_pkiPublicationInfo "id-regCtrl-pkiPublicationInfo" +#define NID_id_regCtrl_pkiPublicationInfo 317 +#define OBJ_id_regCtrl_pkiPublicationInfo OBJ_id_regCtrl, 3L + +#define SN_id_regCtrl_pkiArchiveOptions "id-regCtrl-pkiArchiveOptions" +#define NID_id_regCtrl_pkiArchiveOptions 318 +#define OBJ_id_regCtrl_pkiArchiveOptions OBJ_id_regCtrl, 4L + +#define SN_id_regCtrl_oldCertID "id-regCtrl-oldCertID" +#define NID_id_regCtrl_oldCertID 319 +#define OBJ_id_regCtrl_oldCertID OBJ_id_regCtrl, 5L + +#define SN_id_regCtrl_protocolEncrKey "id-regCtrl-protocolEncrKey" +#define NID_id_regCtrl_protocolEncrKey 320 +#define OBJ_id_regCtrl_protocolEncrKey OBJ_id_regCtrl, 6L + +#define SN_id_regInfo_utf8Pairs "id-regInfo-utf8Pairs" +#define NID_id_regInfo_utf8Pairs 321 +#define OBJ_id_regInfo_utf8Pairs OBJ_id_regInfo, 1L + +#define SN_id_regInfo_certReq "id-regInfo-certReq" +#define NID_id_regInfo_certReq 322 +#define OBJ_id_regInfo_certReq OBJ_id_regInfo, 2L + +#define SN_id_alg_des40 "id-alg-des40" +#define NID_id_alg_des40 323 +#define OBJ_id_alg_des40 OBJ_id_alg, 1L + +#define SN_id_alg_noSignature "id-alg-noSignature" +#define NID_id_alg_noSignature 324 +#define OBJ_id_alg_noSignature OBJ_id_alg, 2L + +#define SN_id_alg_dh_sig_hmac_sha1 "id-alg-dh-sig-hmac-sha1" +#define NID_id_alg_dh_sig_hmac_sha1 325 +#define OBJ_id_alg_dh_sig_hmac_sha1 OBJ_id_alg, 3L + +#define SN_id_alg_dh_pop "id-alg-dh-pop" +#define NID_id_alg_dh_pop 326 +#define OBJ_id_alg_dh_pop OBJ_id_alg, 4L + +#define SN_id_cmc_statusInfo "id-cmc-statusInfo" +#define NID_id_cmc_statusInfo 327 +#define OBJ_id_cmc_statusInfo OBJ_id_cmc, 1L + +#define SN_id_cmc_identification "id-cmc-identification" +#define NID_id_cmc_identification 328 +#define OBJ_id_cmc_identification OBJ_id_cmc, 2L + +#define SN_id_cmc_identityProof "id-cmc-identityProof" +#define NID_id_cmc_identityProof 329 +#define OBJ_id_cmc_identityProof OBJ_id_cmc, 3L + +#define SN_id_cmc_dataReturn "id-cmc-dataReturn" +#define NID_id_cmc_dataReturn 330 +#define OBJ_id_cmc_dataReturn OBJ_id_cmc, 4L + +#define SN_id_cmc_transactionId "id-cmc-transactionId" +#define NID_id_cmc_transactionId 331 +#define OBJ_id_cmc_transactionId OBJ_id_cmc, 5L + +#define SN_id_cmc_senderNonce "id-cmc-senderNonce" +#define NID_id_cmc_senderNonce 332 +#define OBJ_id_cmc_senderNonce OBJ_id_cmc, 6L + +#define SN_id_cmc_recipientNonce "id-cmc-recipientNonce" +#define NID_id_cmc_recipientNonce 333 +#define OBJ_id_cmc_recipientNonce OBJ_id_cmc, 7L + +#define SN_id_cmc_addExtensions "id-cmc-addExtensions" +#define NID_id_cmc_addExtensions 334 +#define OBJ_id_cmc_addExtensions OBJ_id_cmc, 8L + +#define SN_id_cmc_encryptedPOP "id-cmc-encryptedPOP" +#define NID_id_cmc_encryptedPOP 335 +#define OBJ_id_cmc_encryptedPOP OBJ_id_cmc, 9L + +#define SN_id_cmc_decryptedPOP "id-cmc-decryptedPOP" +#define NID_id_cmc_decryptedPOP 336 +#define OBJ_id_cmc_decryptedPOP OBJ_id_cmc, 10L + +#define SN_id_cmc_lraPOPWitness "id-cmc-lraPOPWitness" +#define NID_id_cmc_lraPOPWitness 337 +#define OBJ_id_cmc_lraPOPWitness OBJ_id_cmc, 11L + +#define SN_id_cmc_getCert "id-cmc-getCert" +#define NID_id_cmc_getCert 338 +#define OBJ_id_cmc_getCert OBJ_id_cmc, 15L + +#define SN_id_cmc_getCRL "id-cmc-getCRL" +#define NID_id_cmc_getCRL 339 +#define OBJ_id_cmc_getCRL OBJ_id_cmc, 16L + +#define SN_id_cmc_revokeRequest "id-cmc-revokeRequest" +#define NID_id_cmc_revokeRequest 340 +#define OBJ_id_cmc_revokeRequest OBJ_id_cmc, 17L + +#define SN_id_cmc_regInfo "id-cmc-regInfo" +#define NID_id_cmc_regInfo 341 +#define OBJ_id_cmc_regInfo OBJ_id_cmc, 18L + +#define SN_id_cmc_responseInfo "id-cmc-responseInfo" +#define NID_id_cmc_responseInfo 342 +#define OBJ_id_cmc_responseInfo OBJ_id_cmc, 19L + +#define SN_id_cmc_queryPending "id-cmc-queryPending" +#define NID_id_cmc_queryPending 343 +#define OBJ_id_cmc_queryPending OBJ_id_cmc, 21L + +#define SN_id_cmc_popLinkRandom "id-cmc-popLinkRandom" +#define NID_id_cmc_popLinkRandom 344 +#define OBJ_id_cmc_popLinkRandom OBJ_id_cmc, 22L + +#define SN_id_cmc_popLinkWitness "id-cmc-popLinkWitness" +#define NID_id_cmc_popLinkWitness 345 +#define OBJ_id_cmc_popLinkWitness OBJ_id_cmc, 23L + +#define SN_id_cmc_confirmCertAcceptance "id-cmc-confirmCertAcceptance" +#define NID_id_cmc_confirmCertAcceptance 346 +#define OBJ_id_cmc_confirmCertAcceptance OBJ_id_cmc, 24L + +#define SN_id_on_personalData "id-on-personalData" +#define NID_id_on_personalData 347 +#define OBJ_id_on_personalData OBJ_id_on, 1L + +#define SN_id_on_permanentIdentifier "id-on-permanentIdentifier" +#define LN_id_on_permanentIdentifier "Permanent Identifier" +#define NID_id_on_permanentIdentifier 858 +#define OBJ_id_on_permanentIdentifier OBJ_id_on, 3L + +#define SN_id_pda_dateOfBirth "id-pda-dateOfBirth" +#define NID_id_pda_dateOfBirth 348 +#define OBJ_id_pda_dateOfBirth OBJ_id_pda, 1L + +#define SN_id_pda_placeOfBirth "id-pda-placeOfBirth" +#define NID_id_pda_placeOfBirth 349 +#define OBJ_id_pda_placeOfBirth OBJ_id_pda, 2L + +#define SN_id_pda_gender "id-pda-gender" +#define NID_id_pda_gender 351 +#define OBJ_id_pda_gender OBJ_id_pda, 3L + +#define SN_id_pda_countryOfCitizenship "id-pda-countryOfCitizenship" +#define NID_id_pda_countryOfCitizenship 352 +#define OBJ_id_pda_countryOfCitizenship OBJ_id_pda, 4L + +#define SN_id_pda_countryOfResidence "id-pda-countryOfResidence" +#define NID_id_pda_countryOfResidence 353 +#define OBJ_id_pda_countryOfResidence OBJ_id_pda, 5L + +#define SN_id_aca_authenticationInfo "id-aca-authenticationInfo" +#define NID_id_aca_authenticationInfo 354 +#define OBJ_id_aca_authenticationInfo OBJ_id_aca, 1L + +#define SN_id_aca_accessIdentity "id-aca-accessIdentity" +#define NID_id_aca_accessIdentity 355 +#define OBJ_id_aca_accessIdentity OBJ_id_aca, 2L + +#define SN_id_aca_chargingIdentity "id-aca-chargingIdentity" +#define NID_id_aca_chargingIdentity 356 +#define OBJ_id_aca_chargingIdentity OBJ_id_aca, 3L + +#define SN_id_aca_group "id-aca-group" +#define NID_id_aca_group 357 +#define OBJ_id_aca_group OBJ_id_aca, 4L + +#define SN_id_aca_role "id-aca-role" +#define NID_id_aca_role 358 +#define OBJ_id_aca_role OBJ_id_aca, 5L + +#define SN_id_aca_encAttrs "id-aca-encAttrs" +#define NID_id_aca_encAttrs 399 +#define OBJ_id_aca_encAttrs OBJ_id_aca, 6L + +#define SN_id_qcs_pkixQCSyntax_v1 "id-qcs-pkixQCSyntax-v1" +#define NID_id_qcs_pkixQCSyntax_v1 359 +#define OBJ_id_qcs_pkixQCSyntax_v1 OBJ_id_qcs, 1L + +#define SN_id_cct_crs "id-cct-crs" +#define NID_id_cct_crs 360 +#define OBJ_id_cct_crs OBJ_id_cct, 1L + +#define SN_id_cct_PKIData "id-cct-PKIData" +#define NID_id_cct_PKIData 361 +#define OBJ_id_cct_PKIData OBJ_id_cct, 2L + +#define SN_id_cct_PKIResponse "id-cct-PKIResponse" +#define NID_id_cct_PKIResponse 362 +#define OBJ_id_cct_PKIResponse OBJ_id_cct, 3L + +#define SN_id_ppl_anyLanguage "id-ppl-anyLanguage" +#define LN_id_ppl_anyLanguage "Any language" +#define NID_id_ppl_anyLanguage 664 +#define OBJ_id_ppl_anyLanguage OBJ_id_ppl, 0L + +#define SN_id_ppl_inheritAll "id-ppl-inheritAll" +#define LN_id_ppl_inheritAll "Inherit all" +#define NID_id_ppl_inheritAll 665 +#define OBJ_id_ppl_inheritAll OBJ_id_ppl, 1L + +#define SN_Independent "id-ppl-independent" +#define LN_Independent "Independent" +#define NID_Independent 667 +#define OBJ_Independent OBJ_id_ppl, 2L + +#define SN_ad_OCSP "OCSP" +#define LN_ad_OCSP "OCSP" +#define NID_ad_OCSP 178 +#define OBJ_ad_OCSP OBJ_id_ad, 1L + +#define SN_ad_ca_issuers "caIssuers" +#define LN_ad_ca_issuers "CA Issuers" +#define NID_ad_ca_issuers 179 +#define OBJ_ad_ca_issuers OBJ_id_ad, 2L + +#define SN_ad_timeStamping "ad_timestamping" +#define LN_ad_timeStamping "AD Time Stamping" +#define NID_ad_timeStamping 363 +#define OBJ_ad_timeStamping OBJ_id_ad, 3L + +#define SN_ad_dvcs "AD_DVCS" +#define LN_ad_dvcs "ad dvcs" +#define NID_ad_dvcs 364 +#define OBJ_ad_dvcs OBJ_id_ad, 4L + +#define SN_caRepository "caRepository" +#define LN_caRepository "CA Repository" +#define NID_caRepository 785 +#define OBJ_caRepository OBJ_id_ad, 5L + +#define OBJ_id_pkix_OCSP OBJ_ad_OCSP + +#define SN_id_pkix_OCSP_basic "basicOCSPResponse" +#define LN_id_pkix_OCSP_basic "Basic OCSP Response" +#define NID_id_pkix_OCSP_basic 365 +#define OBJ_id_pkix_OCSP_basic OBJ_id_pkix_OCSP, 1L + +#define SN_id_pkix_OCSP_Nonce "Nonce" +#define LN_id_pkix_OCSP_Nonce "OCSP Nonce" +#define NID_id_pkix_OCSP_Nonce 366 +#define OBJ_id_pkix_OCSP_Nonce OBJ_id_pkix_OCSP, 2L + +#define SN_id_pkix_OCSP_CrlID "CrlID" +#define LN_id_pkix_OCSP_CrlID "OCSP CRL ID" +#define NID_id_pkix_OCSP_CrlID 367 +#define OBJ_id_pkix_OCSP_CrlID OBJ_id_pkix_OCSP, 3L + +#define SN_id_pkix_OCSP_acceptableResponses "acceptableResponses" +#define LN_id_pkix_OCSP_acceptableResponses "Acceptable OCSP Responses" +#define NID_id_pkix_OCSP_acceptableResponses 368 +#define OBJ_id_pkix_OCSP_acceptableResponses OBJ_id_pkix_OCSP, 4L + +#define SN_id_pkix_OCSP_noCheck "noCheck" +#define LN_id_pkix_OCSP_noCheck "OCSP No Check" +#define NID_id_pkix_OCSP_noCheck 369 +#define OBJ_id_pkix_OCSP_noCheck OBJ_id_pkix_OCSP, 5L + +#define SN_id_pkix_OCSP_archiveCutoff "archiveCutoff" +#define LN_id_pkix_OCSP_archiveCutoff "OCSP Archive Cutoff" +#define NID_id_pkix_OCSP_archiveCutoff 370 +#define OBJ_id_pkix_OCSP_archiveCutoff OBJ_id_pkix_OCSP, 6L + +#define SN_id_pkix_OCSP_serviceLocator "serviceLocator" +#define LN_id_pkix_OCSP_serviceLocator "OCSP Service Locator" +#define NID_id_pkix_OCSP_serviceLocator 371 +#define OBJ_id_pkix_OCSP_serviceLocator OBJ_id_pkix_OCSP, 7L + +#define SN_id_pkix_OCSP_extendedStatus "extendedStatus" +#define LN_id_pkix_OCSP_extendedStatus "Extended OCSP Status" +#define NID_id_pkix_OCSP_extendedStatus 372 +#define OBJ_id_pkix_OCSP_extendedStatus OBJ_id_pkix_OCSP, 8L + +#define SN_id_pkix_OCSP_valid "valid" +#define NID_id_pkix_OCSP_valid 373 +#define OBJ_id_pkix_OCSP_valid OBJ_id_pkix_OCSP, 9L + +#define SN_id_pkix_OCSP_path "path" +#define NID_id_pkix_OCSP_path 374 +#define OBJ_id_pkix_OCSP_path OBJ_id_pkix_OCSP, 10L + +#define SN_id_pkix_OCSP_trustRoot "trustRoot" +#define LN_id_pkix_OCSP_trustRoot "Trust Root" +#define NID_id_pkix_OCSP_trustRoot 375 +#define OBJ_id_pkix_OCSP_trustRoot OBJ_id_pkix_OCSP, 11L + +#define SN_algorithm "algorithm" +#define LN_algorithm "algorithm" +#define NID_algorithm 376 +#define OBJ_algorithm 1L, 3L, 14L, 3L, 2L + +#define SN_md5WithRSA "RSA-NP-MD5" +#define LN_md5WithRSA "md5WithRSA" +#define NID_md5WithRSA 104 +#define OBJ_md5WithRSA OBJ_algorithm, 3L + +#define SN_des_ecb "DES-ECB" +#define LN_des_ecb "des-ecb" +#define NID_des_ecb 29 +#define OBJ_des_ecb OBJ_algorithm, 6L + +#define SN_des_cbc "DES-CBC" +#define LN_des_cbc "des-cbc" +#define NID_des_cbc 31 +#define OBJ_des_cbc OBJ_algorithm, 7L + +#define SN_des_ofb64 "DES-OFB" +#define LN_des_ofb64 "des-ofb" +#define NID_des_ofb64 45 +#define OBJ_des_ofb64 OBJ_algorithm, 8L + +#define SN_des_cfb64 "DES-CFB" +#define LN_des_cfb64 "des-cfb" +#define NID_des_cfb64 30 +#define OBJ_des_cfb64 OBJ_algorithm, 9L + +#define SN_rsaSignature "rsaSignature" +#define NID_rsaSignature 377 +#define OBJ_rsaSignature OBJ_algorithm, 11L + +#define SN_dsa_2 "DSA-old" +#define LN_dsa_2 "dsaEncryption-old" +#define NID_dsa_2 67 +#define OBJ_dsa_2 OBJ_algorithm, 12L + +#define SN_dsaWithSHA "DSA-SHA" +#define LN_dsaWithSHA "dsaWithSHA" +#define NID_dsaWithSHA 66 +#define OBJ_dsaWithSHA OBJ_algorithm, 13L + +#define SN_shaWithRSAEncryption "RSA-SHA" +#define LN_shaWithRSAEncryption "shaWithRSAEncryption" +#define NID_shaWithRSAEncryption 42 +#define OBJ_shaWithRSAEncryption OBJ_algorithm, 15L + +#define SN_des_ede_ecb "DES-EDE" +#define LN_des_ede_ecb "des-ede" +#define NID_des_ede_ecb 32 +#define OBJ_des_ede_ecb OBJ_algorithm, 17L + +#define SN_des_ede3_ecb "DES-EDE3" +#define LN_des_ede3_ecb "des-ede3" +#define NID_des_ede3_ecb 33 + +#define SN_des_ede_cbc "DES-EDE-CBC" +#define LN_des_ede_cbc "des-ede-cbc" +#define NID_des_ede_cbc 43 + +#define SN_des_ede_cfb64 "DES-EDE-CFB" +#define LN_des_ede_cfb64 "des-ede-cfb" +#define NID_des_ede_cfb64 60 + +#define SN_des_ede3_cfb64 "DES-EDE3-CFB" +#define LN_des_ede3_cfb64 "des-ede3-cfb" +#define NID_des_ede3_cfb64 61 + +#define SN_des_ede_ofb64 "DES-EDE-OFB" +#define LN_des_ede_ofb64 "des-ede-ofb" +#define NID_des_ede_ofb64 62 + +#define SN_des_ede3_ofb64 "DES-EDE3-OFB" +#define LN_des_ede3_ofb64 "des-ede3-ofb" +#define NID_des_ede3_ofb64 63 + +#define SN_desx_cbc "DESX-CBC" +#define LN_desx_cbc "desx-cbc" +#define NID_desx_cbc 80 + +#define SN_sha "SHA" +#define LN_sha "sha" +#define NID_sha 41 +#define OBJ_sha OBJ_algorithm, 18L + +#define SN_sha1 "SHA1" +#define LN_sha1 "sha1" +#define NID_sha1 64 +#define OBJ_sha1 OBJ_algorithm, 26L + +#define SN_dsaWithSHA1_2 "DSA-SHA1-old" +#define LN_dsaWithSHA1_2 "dsaWithSHA1-old" +#define NID_dsaWithSHA1_2 70 +#define OBJ_dsaWithSHA1_2 OBJ_algorithm, 27L + +#define SN_sha1WithRSA "RSA-SHA1-2" +#define LN_sha1WithRSA "sha1WithRSA" +#define NID_sha1WithRSA 115 +#define OBJ_sha1WithRSA OBJ_algorithm, 29L + +#define SN_ripemd160 "RIPEMD160" +#define LN_ripemd160 "ripemd160" +#define NID_ripemd160 117 +#define OBJ_ripemd160 1L, 3L, 36L, 3L, 2L, 1L + +#define SN_ripemd160WithRSA "RSA-RIPEMD160" +#define LN_ripemd160WithRSA "ripemd160WithRSA" +#define NID_ripemd160WithRSA 119 +#define OBJ_ripemd160WithRSA 1L, 3L, 36L, 3L, 3L, 1L, 2L + +#define SN_sxnet "SXNetID" +#define LN_sxnet "Strong Extranet ID" +#define NID_sxnet 143 +#define OBJ_sxnet 1L, 3L, 101L, 1L, 4L, 1L + +#define SN_X500 "X500" +#define LN_X500 "directory services (X.500)" +#define NID_X500 11 +#define OBJ_X500 2L, 5L + +#define SN_X509 "X509" +#define NID_X509 12 +#define OBJ_X509 OBJ_X500, 4L + +#define SN_commonName "CN" +#define LN_commonName "commonName" +#define NID_commonName 13 +#define OBJ_commonName OBJ_X509, 3L + +#define SN_surname "SN" +#define LN_surname "surname" +#define NID_surname 100 +#define OBJ_surname OBJ_X509, 4L + +#define LN_serialNumber "serialNumber" +#define NID_serialNumber 105 +#define OBJ_serialNumber OBJ_X509, 5L + +#define SN_countryName "C" +#define LN_countryName "countryName" +#define NID_countryName 14 +#define OBJ_countryName OBJ_X509, 6L + +#define SN_localityName "L" +#define LN_localityName "localityName" +#define NID_localityName 15 +#define OBJ_localityName OBJ_X509, 7L + +#define SN_stateOrProvinceName "ST" +#define LN_stateOrProvinceName "stateOrProvinceName" +#define NID_stateOrProvinceName 16 +#define OBJ_stateOrProvinceName OBJ_X509, 8L + +#define SN_streetAddress "street" +#define LN_streetAddress "streetAddress" +#define NID_streetAddress 660 +#define OBJ_streetAddress OBJ_X509, 9L + +#define SN_organizationName "O" +#define LN_organizationName "organizationName" +#define NID_organizationName 17 +#define OBJ_organizationName OBJ_X509, 10L + +#define SN_organizationalUnitName "OU" +#define LN_organizationalUnitName "organizationalUnitName" +#define NID_organizationalUnitName 18 +#define OBJ_organizationalUnitName OBJ_X509, 11L + +#define SN_title "title" +#define LN_title "title" +#define NID_title 106 +#define OBJ_title OBJ_X509, 12L + +#define LN_description "description" +#define NID_description 107 +#define OBJ_description OBJ_X509, 13L + +#define LN_searchGuide "searchGuide" +#define NID_searchGuide 859 +#define OBJ_searchGuide OBJ_X509, 14L + +#define LN_businessCategory "businessCategory" +#define NID_businessCategory 860 +#define OBJ_businessCategory OBJ_X509, 15L + +#define LN_postalAddress "postalAddress" +#define NID_postalAddress 861 +#define OBJ_postalAddress OBJ_X509, 16L + +#define LN_postalCode "postalCode" +#define NID_postalCode 661 +#define OBJ_postalCode OBJ_X509, 17L + +#define LN_postOfficeBox "postOfficeBox" +#define NID_postOfficeBox 862 +#define OBJ_postOfficeBox OBJ_X509, 18L + +#define LN_physicalDeliveryOfficeName "physicalDeliveryOfficeName" +#define NID_physicalDeliveryOfficeName 863 +#define OBJ_physicalDeliveryOfficeName OBJ_X509, 19L + +#define LN_telephoneNumber "telephoneNumber" +#define NID_telephoneNumber 864 +#define OBJ_telephoneNumber OBJ_X509, 20L + +#define LN_telexNumber "telexNumber" +#define NID_telexNumber 865 +#define OBJ_telexNumber OBJ_X509, 21L + +#define LN_teletexTerminalIdentifier "teletexTerminalIdentifier" +#define NID_teletexTerminalIdentifier 866 +#define OBJ_teletexTerminalIdentifier OBJ_X509, 22L + +#define LN_facsimileTelephoneNumber "facsimileTelephoneNumber" +#define NID_facsimileTelephoneNumber 867 +#define OBJ_facsimileTelephoneNumber OBJ_X509, 23L + +#define LN_x121Address "x121Address" +#define NID_x121Address 868 +#define OBJ_x121Address OBJ_X509, 24L + +#define LN_internationaliSDNNumber "internationaliSDNNumber" +#define NID_internationaliSDNNumber 869 +#define OBJ_internationaliSDNNumber OBJ_X509, 25L + +#define LN_registeredAddress "registeredAddress" +#define NID_registeredAddress 870 +#define OBJ_registeredAddress OBJ_X509, 26L + +#define LN_destinationIndicator "destinationIndicator" +#define NID_destinationIndicator 871 +#define OBJ_destinationIndicator OBJ_X509, 27L + +#define LN_preferredDeliveryMethod "preferredDeliveryMethod" +#define NID_preferredDeliveryMethod 872 +#define OBJ_preferredDeliveryMethod OBJ_X509, 28L + +#define LN_presentationAddress "presentationAddress" +#define NID_presentationAddress 873 +#define OBJ_presentationAddress OBJ_X509, 29L + +#define LN_supportedApplicationContext "supportedApplicationContext" +#define NID_supportedApplicationContext 874 +#define OBJ_supportedApplicationContext OBJ_X509, 30L + +#define SN_member "member" +#define NID_member 875 +#define OBJ_member OBJ_X509, 31L + +#define SN_owner "owner" +#define NID_owner 876 +#define OBJ_owner OBJ_X509, 32L + +#define LN_roleOccupant "roleOccupant" +#define NID_roleOccupant 877 +#define OBJ_roleOccupant OBJ_X509, 33L + +#define SN_seeAlso "seeAlso" +#define NID_seeAlso 878 +#define OBJ_seeAlso OBJ_X509, 34L + +#define LN_userPassword "userPassword" +#define NID_userPassword 879 +#define OBJ_userPassword OBJ_X509, 35L + +#define LN_userCertificate "userCertificate" +#define NID_userCertificate 880 +#define OBJ_userCertificate OBJ_X509, 36L + +#define LN_cACertificate "cACertificate" +#define NID_cACertificate 881 +#define OBJ_cACertificate OBJ_X509, 37L + +#define LN_authorityRevocationList "authorityRevocationList" +#define NID_authorityRevocationList 882 +#define OBJ_authorityRevocationList OBJ_X509, 38L + +#define LN_certificateRevocationList "certificateRevocationList" +#define NID_certificateRevocationList 883 +#define OBJ_certificateRevocationList OBJ_X509, 39L + +#define LN_crossCertificatePair "crossCertificatePair" +#define NID_crossCertificatePair 884 +#define OBJ_crossCertificatePair OBJ_X509, 40L + +#define SN_name "name" +#define LN_name "name" +#define NID_name 173 +#define OBJ_name OBJ_X509, 41L + +#define SN_givenName "GN" +#define LN_givenName "givenName" +#define NID_givenName 99 +#define OBJ_givenName OBJ_X509, 42L + +#define SN_initials "initials" +#define LN_initials "initials" +#define NID_initials 101 +#define OBJ_initials OBJ_X509, 43L + +#define LN_generationQualifier "generationQualifier" +#define NID_generationQualifier 509 +#define OBJ_generationQualifier OBJ_X509, 44L + +#define LN_x500UniqueIdentifier "x500UniqueIdentifier" +#define NID_x500UniqueIdentifier 503 +#define OBJ_x500UniqueIdentifier OBJ_X509, 45L + +#define SN_dnQualifier "dnQualifier" +#define LN_dnQualifier "dnQualifier" +#define NID_dnQualifier 174 +#define OBJ_dnQualifier OBJ_X509, 46L + +#define LN_enhancedSearchGuide "enhancedSearchGuide" +#define NID_enhancedSearchGuide 885 +#define OBJ_enhancedSearchGuide OBJ_X509, 47L + +#define LN_protocolInformation "protocolInformation" +#define NID_protocolInformation 886 +#define OBJ_protocolInformation OBJ_X509, 48L + +#define LN_distinguishedName "distinguishedName" +#define NID_distinguishedName 887 +#define OBJ_distinguishedName OBJ_X509, 49L + +#define LN_uniqueMember "uniqueMember" +#define NID_uniqueMember 888 +#define OBJ_uniqueMember OBJ_X509, 50L + +#define LN_houseIdentifier "houseIdentifier" +#define NID_houseIdentifier 889 +#define OBJ_houseIdentifier OBJ_X509, 51L + +#define LN_supportedAlgorithms "supportedAlgorithms" +#define NID_supportedAlgorithms 890 +#define OBJ_supportedAlgorithms OBJ_X509, 52L + +#define LN_deltaRevocationList "deltaRevocationList" +#define NID_deltaRevocationList 891 +#define OBJ_deltaRevocationList OBJ_X509, 53L + +#define SN_dmdName "dmdName" +#define NID_dmdName 892 +#define OBJ_dmdName OBJ_X509, 54L + +#define LN_pseudonym "pseudonym" +#define NID_pseudonym 510 +#define OBJ_pseudonym OBJ_X509, 65L + +#define SN_role "role" +#define LN_role "role" +#define NID_role 400 +#define OBJ_role OBJ_X509, 72L + +#define SN_X500algorithms "X500algorithms" +#define LN_X500algorithms "directory services - algorithms" +#define NID_X500algorithms 378 +#define OBJ_X500algorithms OBJ_X500, 8L + +#define SN_rsa "RSA" +#define LN_rsa "rsa" +#define NID_rsa 19 +#define OBJ_rsa OBJ_X500algorithms, 1L, 1L + +#define SN_mdc2WithRSA "RSA-MDC2" +#define LN_mdc2WithRSA "mdc2WithRSA" +#define NID_mdc2WithRSA 96 +#define OBJ_mdc2WithRSA OBJ_X500algorithms, 3L, 100L + +#define SN_mdc2 "MDC2" +#define LN_mdc2 "mdc2" +#define NID_mdc2 95 +#define OBJ_mdc2 OBJ_X500algorithms, 3L, 101L + +#define SN_id_ce "id-ce" +#define NID_id_ce 81 +#define OBJ_id_ce OBJ_X500, 29L + +#define SN_subject_directory_attributes "subjectDirectoryAttributes" +#define LN_subject_directory_attributes "X509v3 Subject Directory Attributes" +#define NID_subject_directory_attributes 769 +#define OBJ_subject_directory_attributes OBJ_id_ce, 9L + +#define SN_subject_key_identifier "subjectKeyIdentifier" +#define LN_subject_key_identifier "X509v3 Subject Key Identifier" +#define NID_subject_key_identifier 82 +#define OBJ_subject_key_identifier OBJ_id_ce, 14L + +#define SN_key_usage "keyUsage" +#define LN_key_usage "X509v3 Key Usage" +#define NID_key_usage 83 +#define OBJ_key_usage OBJ_id_ce, 15L + +#define SN_private_key_usage_period "privateKeyUsagePeriod" +#define LN_private_key_usage_period "X509v3 Private Key Usage Period" +#define NID_private_key_usage_period 84 +#define OBJ_private_key_usage_period OBJ_id_ce, 16L + +#define SN_subject_alt_name "subjectAltName" +#define LN_subject_alt_name "X509v3 Subject Alternative Name" +#define NID_subject_alt_name 85 +#define OBJ_subject_alt_name OBJ_id_ce, 17L + +#define SN_issuer_alt_name "issuerAltName" +#define LN_issuer_alt_name "X509v3 Issuer Alternative Name" +#define NID_issuer_alt_name 86 +#define OBJ_issuer_alt_name OBJ_id_ce, 18L + +#define SN_basic_constraints "basicConstraints" +#define LN_basic_constraints "X509v3 Basic Constraints" +#define NID_basic_constraints 87 +#define OBJ_basic_constraints OBJ_id_ce, 19L + +#define SN_crl_number "crlNumber" +#define LN_crl_number "X509v3 CRL Number" +#define NID_crl_number 88 +#define OBJ_crl_number OBJ_id_ce, 20L + +#define SN_crl_reason "CRLReason" +#define LN_crl_reason "X509v3 CRL Reason Code" +#define NID_crl_reason 141 +#define OBJ_crl_reason OBJ_id_ce, 21L + +#define SN_invalidity_date "invalidityDate" +#define LN_invalidity_date "Invalidity Date" +#define NID_invalidity_date 142 +#define OBJ_invalidity_date OBJ_id_ce, 24L + +#define SN_delta_crl "deltaCRL" +#define LN_delta_crl "X509v3 Delta CRL Indicator" +#define NID_delta_crl 140 +#define OBJ_delta_crl OBJ_id_ce, 27L + +#define SN_issuing_distribution_point "issuingDistributionPoint" +#define LN_issuing_distribution_point "X509v3 Issuing Distrubution Point" +#define NID_issuing_distribution_point 770 +#define OBJ_issuing_distribution_point OBJ_id_ce, 28L + +#define SN_certificate_issuer "certificateIssuer" +#define LN_certificate_issuer "X509v3 Certificate Issuer" +#define NID_certificate_issuer 771 +#define OBJ_certificate_issuer OBJ_id_ce, 29L + +#define SN_name_constraints "nameConstraints" +#define LN_name_constraints "X509v3 Name Constraints" +#define NID_name_constraints 666 +#define OBJ_name_constraints OBJ_id_ce, 30L + +#define SN_crl_distribution_points "crlDistributionPoints" +#define LN_crl_distribution_points "X509v3 CRL Distribution Points" +#define NID_crl_distribution_points 103 +#define OBJ_crl_distribution_points OBJ_id_ce, 31L + +#define SN_certificate_policies "certificatePolicies" +#define LN_certificate_policies "X509v3 Certificate Policies" +#define NID_certificate_policies 89 +#define OBJ_certificate_policies OBJ_id_ce, 32L + +#define SN_any_policy "anyPolicy" +#define LN_any_policy "X509v3 Any Policy" +#define NID_any_policy 746 +#define OBJ_any_policy OBJ_certificate_policies, 0L + +#define SN_policy_mappings "policyMappings" +#define LN_policy_mappings "X509v3 Policy Mappings" +#define NID_policy_mappings 747 +#define OBJ_policy_mappings OBJ_id_ce, 33L + +#define SN_authority_key_identifier "authorityKeyIdentifier" +#define LN_authority_key_identifier "X509v3 Authority Key Identifier" +#define NID_authority_key_identifier 90 +#define OBJ_authority_key_identifier OBJ_id_ce, 35L + +#define SN_policy_constraints "policyConstraints" +#define LN_policy_constraints "X509v3 Policy Constraints" +#define NID_policy_constraints 401 +#define OBJ_policy_constraints OBJ_id_ce, 36L + +#define SN_ext_key_usage "extendedKeyUsage" +#define LN_ext_key_usage "X509v3 Extended Key Usage" +#define NID_ext_key_usage 126 +#define OBJ_ext_key_usage OBJ_id_ce, 37L + +#define SN_freshest_crl "freshestCRL" +#define LN_freshest_crl "X509v3 Freshest CRL" +#define NID_freshest_crl 857 +#define OBJ_freshest_crl OBJ_id_ce, 46L + +#define SN_inhibit_any_policy "inhibitAnyPolicy" +#define LN_inhibit_any_policy "X509v3 Inhibit Any Policy" +#define NID_inhibit_any_policy 748 +#define OBJ_inhibit_any_policy OBJ_id_ce, 54L + +#define SN_target_information "targetInformation" +#define LN_target_information "X509v3 AC Targeting" +#define NID_target_information 402 +#define OBJ_target_information OBJ_id_ce, 55L + +#define SN_no_rev_avail "noRevAvail" +#define LN_no_rev_avail "X509v3 No Revocation Available" +#define NID_no_rev_avail 403 +#define OBJ_no_rev_avail OBJ_id_ce, 56L + +#define SN_anyExtendedKeyUsage "anyExtendedKeyUsage" +#define LN_anyExtendedKeyUsage "Any Extended Key Usage" +#define NID_anyExtendedKeyUsage 910 +#define OBJ_anyExtendedKeyUsage OBJ_ext_key_usage, 0L + +#define SN_netscape "Netscape" +#define LN_netscape "Netscape Communications Corp." +#define NID_netscape 57 +#define OBJ_netscape 2L, 16L, 840L, 1L, 113730L + +#define SN_netscape_cert_extension "nsCertExt" +#define LN_netscape_cert_extension "Netscape Certificate Extension" +#define NID_netscape_cert_extension 58 +#define OBJ_netscape_cert_extension OBJ_netscape, 1L + +#define SN_netscape_data_type "nsDataType" +#define LN_netscape_data_type "Netscape Data Type" +#define NID_netscape_data_type 59 +#define OBJ_netscape_data_type OBJ_netscape, 2L + +#define SN_netscape_cert_type "nsCertType" +#define LN_netscape_cert_type "Netscape Cert Type" +#define NID_netscape_cert_type 71 +#define OBJ_netscape_cert_type OBJ_netscape_cert_extension, 1L + +#define SN_netscape_base_url "nsBaseUrl" +#define LN_netscape_base_url "Netscape Base Url" +#define NID_netscape_base_url 72 +#define OBJ_netscape_base_url OBJ_netscape_cert_extension, 2L + +#define SN_netscape_revocation_url "nsRevocationUrl" +#define LN_netscape_revocation_url "Netscape Revocation Url" +#define NID_netscape_revocation_url 73 +#define OBJ_netscape_revocation_url OBJ_netscape_cert_extension, 3L + +#define SN_netscape_ca_revocation_url "nsCaRevocationUrl" +#define LN_netscape_ca_revocation_url "Netscape CA Revocation Url" +#define NID_netscape_ca_revocation_url 74 +#define OBJ_netscape_ca_revocation_url OBJ_netscape_cert_extension, 4L + +#define SN_netscape_renewal_url "nsRenewalUrl" +#define LN_netscape_renewal_url "Netscape Renewal Url" +#define NID_netscape_renewal_url 75 +#define OBJ_netscape_renewal_url OBJ_netscape_cert_extension, 7L + +#define SN_netscape_ca_policy_url "nsCaPolicyUrl" +#define LN_netscape_ca_policy_url "Netscape CA Policy Url" +#define NID_netscape_ca_policy_url 76 +#define OBJ_netscape_ca_policy_url OBJ_netscape_cert_extension, 8L + +#define SN_netscape_ssl_server_name "nsSslServerName" +#define LN_netscape_ssl_server_name "Netscape SSL Server Name" +#define NID_netscape_ssl_server_name 77 +#define OBJ_netscape_ssl_server_name OBJ_netscape_cert_extension, 12L + +#define SN_netscape_comment "nsComment" +#define LN_netscape_comment "Netscape Comment" +#define NID_netscape_comment 78 +#define OBJ_netscape_comment OBJ_netscape_cert_extension, 13L + +#define SN_netscape_cert_sequence "nsCertSequence" +#define LN_netscape_cert_sequence "Netscape Certificate Sequence" +#define NID_netscape_cert_sequence 79 +#define OBJ_netscape_cert_sequence OBJ_netscape_data_type, 5L + +#define SN_ns_sgc "nsSGC" +#define LN_ns_sgc "Netscape Server Gated Crypto" +#define NID_ns_sgc 139 +#define OBJ_ns_sgc OBJ_netscape, 4L, 1L + +#define SN_org "ORG" +#define LN_org "org" +#define NID_org 379 +#define OBJ_org OBJ_iso, 3L + +#define SN_dod "DOD" +#define LN_dod "dod" +#define NID_dod 380 +#define OBJ_dod OBJ_org, 6L + +#define SN_iana "IANA" +#define LN_iana "iana" +#define NID_iana 381 +#define OBJ_iana OBJ_dod, 1L + +#define OBJ_internet OBJ_iana + +#define SN_Directory "directory" +#define LN_Directory "Directory" +#define NID_Directory 382 +#define OBJ_Directory OBJ_internet, 1L + +#define SN_Management "mgmt" +#define LN_Management "Management" +#define NID_Management 383 +#define OBJ_Management OBJ_internet, 2L + +#define SN_Experimental "experimental" +#define LN_Experimental "Experimental" +#define NID_Experimental 384 +#define OBJ_Experimental OBJ_internet, 3L + +#define SN_Private "private" +#define LN_Private "Private" +#define NID_Private 385 +#define OBJ_Private OBJ_internet, 4L + +#define SN_Security "security" +#define LN_Security "Security" +#define NID_Security 386 +#define OBJ_Security OBJ_internet, 5L + +#define SN_SNMPv2 "snmpv2" +#define LN_SNMPv2 "SNMPv2" +#define NID_SNMPv2 387 +#define OBJ_SNMPv2 OBJ_internet, 6L + +#define LN_Mail "Mail" +#define NID_Mail 388 +#define OBJ_Mail OBJ_internet, 7L + +#define SN_Enterprises "enterprises" +#define LN_Enterprises "Enterprises" +#define NID_Enterprises 389 +#define OBJ_Enterprises OBJ_Private, 1L + +#define SN_dcObject "dcobject" +#define LN_dcObject "dcObject" +#define NID_dcObject 390 +#define OBJ_dcObject OBJ_Enterprises, 1466L, 344L + +#define SN_mime_mhs "mime-mhs" +#define LN_mime_mhs "MIME MHS" +#define NID_mime_mhs 504 +#define OBJ_mime_mhs OBJ_Mail, 1L + +#define SN_mime_mhs_headings "mime-mhs-headings" +#define LN_mime_mhs_headings "mime-mhs-headings" +#define NID_mime_mhs_headings 505 +#define OBJ_mime_mhs_headings OBJ_mime_mhs, 1L + +#define SN_mime_mhs_bodies "mime-mhs-bodies" +#define LN_mime_mhs_bodies "mime-mhs-bodies" +#define NID_mime_mhs_bodies 506 +#define OBJ_mime_mhs_bodies OBJ_mime_mhs, 2L + +#define SN_id_hex_partial_message "id-hex-partial-message" +#define LN_id_hex_partial_message "id-hex-partial-message" +#define NID_id_hex_partial_message 507 +#define OBJ_id_hex_partial_message OBJ_mime_mhs_headings, 1L + +#define SN_id_hex_multipart_message "id-hex-multipart-message" +#define LN_id_hex_multipart_message "id-hex-multipart-message" +#define NID_id_hex_multipart_message 508 +#define OBJ_id_hex_multipart_message OBJ_mime_mhs_headings, 2L + +#define SN_rle_compression "RLE" +#define LN_rle_compression "run length compression" +#define NID_rle_compression 124 +#define OBJ_rle_compression 1L, 1L, 1L, 1L, 666L, 1L + +#define SN_zlib_compression "ZLIB" +#define LN_zlib_compression "zlib compression" +#define NID_zlib_compression 125 +#define OBJ_zlib_compression OBJ_id_smime_alg, 8L + +#define OBJ_csor 2L, 16L, 840L, 1L, 101L, 3L + +#define OBJ_nistAlgorithms OBJ_csor, 4L + +#define OBJ_aes OBJ_nistAlgorithms, 1L + +#define SN_aes_128_ecb "AES-128-ECB" +#define LN_aes_128_ecb "aes-128-ecb" +#define NID_aes_128_ecb 418 +#define OBJ_aes_128_ecb OBJ_aes, 1L + +#define SN_aes_128_cbc "AES-128-CBC" +#define LN_aes_128_cbc "aes-128-cbc" +#define NID_aes_128_cbc 419 +#define OBJ_aes_128_cbc OBJ_aes, 2L + +#define SN_aes_128_ofb128 "AES-128-OFB" +#define LN_aes_128_ofb128 "aes-128-ofb" +#define NID_aes_128_ofb128 420 +#define OBJ_aes_128_ofb128 OBJ_aes, 3L + +#define SN_aes_128_cfb128 "AES-128-CFB" +#define LN_aes_128_cfb128 "aes-128-cfb" +#define NID_aes_128_cfb128 421 +#define OBJ_aes_128_cfb128 OBJ_aes, 4L + +#define SN_id_aes128_wrap "id-aes128-wrap" +#define NID_id_aes128_wrap 788 +#define OBJ_id_aes128_wrap OBJ_aes, 5L + +#define SN_aes_128_gcm "id-aes128-GCM" +#define LN_aes_128_gcm "aes-128-gcm" +#define NID_aes_128_gcm 895 +#define OBJ_aes_128_gcm OBJ_aes, 6L + +#define SN_aes_128_ccm "id-aes128-CCM" +#define LN_aes_128_ccm "aes-128-ccm" +#define NID_aes_128_ccm 896 +#define OBJ_aes_128_ccm OBJ_aes, 7L + +#define SN_id_aes128_wrap_pad "id-aes128-wrap-pad" +#define NID_id_aes128_wrap_pad 897 +#define OBJ_id_aes128_wrap_pad OBJ_aes, 8L + +#define SN_aes_192_ecb "AES-192-ECB" +#define LN_aes_192_ecb "aes-192-ecb" +#define NID_aes_192_ecb 422 +#define OBJ_aes_192_ecb OBJ_aes, 21L + +#define SN_aes_192_cbc "AES-192-CBC" +#define LN_aes_192_cbc "aes-192-cbc" +#define NID_aes_192_cbc 423 +#define OBJ_aes_192_cbc OBJ_aes, 22L + +#define SN_aes_192_ofb128 "AES-192-OFB" +#define LN_aes_192_ofb128 "aes-192-ofb" +#define NID_aes_192_ofb128 424 +#define OBJ_aes_192_ofb128 OBJ_aes, 23L + +#define SN_aes_192_cfb128 "AES-192-CFB" +#define LN_aes_192_cfb128 "aes-192-cfb" +#define NID_aes_192_cfb128 425 +#define OBJ_aes_192_cfb128 OBJ_aes, 24L + +#define SN_id_aes192_wrap "id-aes192-wrap" +#define NID_id_aes192_wrap 789 +#define OBJ_id_aes192_wrap OBJ_aes, 25L + +#define SN_aes_192_gcm "id-aes192-GCM" +#define LN_aes_192_gcm "aes-192-gcm" +#define NID_aes_192_gcm 898 +#define OBJ_aes_192_gcm OBJ_aes, 26L + +#define SN_aes_192_ccm "id-aes192-CCM" +#define LN_aes_192_ccm "aes-192-ccm" +#define NID_aes_192_ccm 899 +#define OBJ_aes_192_ccm OBJ_aes, 27L + +#define SN_id_aes192_wrap_pad "id-aes192-wrap-pad" +#define NID_id_aes192_wrap_pad 900 +#define OBJ_id_aes192_wrap_pad OBJ_aes, 28L + +#define SN_aes_256_ecb "AES-256-ECB" +#define LN_aes_256_ecb "aes-256-ecb" +#define NID_aes_256_ecb 426 +#define OBJ_aes_256_ecb OBJ_aes, 41L + +#define SN_aes_256_cbc "AES-256-CBC" +#define LN_aes_256_cbc "aes-256-cbc" +#define NID_aes_256_cbc 427 +#define OBJ_aes_256_cbc OBJ_aes, 42L + +#define SN_aes_256_ofb128 "AES-256-OFB" +#define LN_aes_256_ofb128 "aes-256-ofb" +#define NID_aes_256_ofb128 428 +#define OBJ_aes_256_ofb128 OBJ_aes, 43L + +#define SN_aes_256_cfb128 "AES-256-CFB" +#define LN_aes_256_cfb128 "aes-256-cfb" +#define NID_aes_256_cfb128 429 +#define OBJ_aes_256_cfb128 OBJ_aes, 44L + +#define SN_id_aes256_wrap "id-aes256-wrap" +#define NID_id_aes256_wrap 790 +#define OBJ_id_aes256_wrap OBJ_aes, 45L + +#define SN_aes_256_gcm "id-aes256-GCM" +#define LN_aes_256_gcm "aes-256-gcm" +#define NID_aes_256_gcm 901 +#define OBJ_aes_256_gcm OBJ_aes, 46L + +#define SN_aes_256_ccm "id-aes256-CCM" +#define LN_aes_256_ccm "aes-256-ccm" +#define NID_aes_256_ccm 902 +#define OBJ_aes_256_ccm OBJ_aes, 47L + +#define SN_id_aes256_wrap_pad "id-aes256-wrap-pad" +#define NID_id_aes256_wrap_pad 903 +#define OBJ_id_aes256_wrap_pad OBJ_aes, 48L + +#define SN_aes_128_cfb1 "AES-128-CFB1" +#define LN_aes_128_cfb1 "aes-128-cfb1" +#define NID_aes_128_cfb1 650 + +#define SN_aes_192_cfb1 "AES-192-CFB1" +#define LN_aes_192_cfb1 "aes-192-cfb1" +#define NID_aes_192_cfb1 651 + +#define SN_aes_256_cfb1 "AES-256-CFB1" +#define LN_aes_256_cfb1 "aes-256-cfb1" +#define NID_aes_256_cfb1 652 + +#define SN_aes_128_cfb8 "AES-128-CFB8" +#define LN_aes_128_cfb8 "aes-128-cfb8" +#define NID_aes_128_cfb8 653 + +#define SN_aes_192_cfb8 "AES-192-CFB8" +#define LN_aes_192_cfb8 "aes-192-cfb8" +#define NID_aes_192_cfb8 654 + +#define SN_aes_256_cfb8 "AES-256-CFB8" +#define LN_aes_256_cfb8 "aes-256-cfb8" +#define NID_aes_256_cfb8 655 + +#define SN_aes_128_ctr "AES-128-CTR" +#define LN_aes_128_ctr "aes-128-ctr" +#define NID_aes_128_ctr 904 + +#define SN_aes_192_ctr "AES-192-CTR" +#define LN_aes_192_ctr "aes-192-ctr" +#define NID_aes_192_ctr 905 + +#define SN_aes_256_ctr "AES-256-CTR" +#define LN_aes_256_ctr "aes-256-ctr" +#define NID_aes_256_ctr 906 + +#define SN_aes_128_xts "AES-128-XTS" +#define LN_aes_128_xts "aes-128-xts" +#define NID_aes_128_xts 913 + +#define SN_aes_256_xts "AES-256-XTS" +#define LN_aes_256_xts "aes-256-xts" +#define NID_aes_256_xts 914 + +#define SN_des_cfb1 "DES-CFB1" +#define LN_des_cfb1 "des-cfb1" +#define NID_des_cfb1 656 + +#define SN_des_cfb8 "DES-CFB8" +#define LN_des_cfb8 "des-cfb8" +#define NID_des_cfb8 657 + +#define SN_des_ede3_cfb1 "DES-EDE3-CFB1" +#define LN_des_ede3_cfb1 "des-ede3-cfb1" +#define NID_des_ede3_cfb1 658 + +#define SN_des_ede3_cfb8 "DES-EDE3-CFB8" +#define LN_des_ede3_cfb8 "des-ede3-cfb8" +#define NID_des_ede3_cfb8 659 + +#define OBJ_nist_hashalgs OBJ_nistAlgorithms, 2L + +#define SN_sha256 "SHA256" +#define LN_sha256 "sha256" +#define NID_sha256 672 +#define OBJ_sha256 OBJ_nist_hashalgs, 1L + +#define SN_sha384 "SHA384" +#define LN_sha384 "sha384" +#define NID_sha384 673 +#define OBJ_sha384 OBJ_nist_hashalgs, 2L + +#define SN_sha512 "SHA512" +#define LN_sha512 "sha512" +#define NID_sha512 674 +#define OBJ_sha512 OBJ_nist_hashalgs, 3L + +#define SN_sha224 "SHA224" +#define LN_sha224 "sha224" +#define NID_sha224 675 +#define OBJ_sha224 OBJ_nist_hashalgs, 4L + +#define OBJ_dsa_with_sha2 OBJ_nistAlgorithms, 3L + +#define SN_dsa_with_SHA224 "dsa_with_SHA224" +#define NID_dsa_with_SHA224 802 +#define OBJ_dsa_with_SHA224 OBJ_dsa_with_sha2, 1L + +#define SN_dsa_with_SHA256 "dsa_with_SHA256" +#define NID_dsa_with_SHA256 803 +#define OBJ_dsa_with_SHA256 OBJ_dsa_with_sha2, 2L + +#define SN_hold_instruction_code "holdInstructionCode" +#define LN_hold_instruction_code "Hold Instruction Code" +#define NID_hold_instruction_code 430 +#define OBJ_hold_instruction_code OBJ_id_ce, 23L + +#define OBJ_holdInstruction OBJ_X9_57, 2L + +#define SN_hold_instruction_none "holdInstructionNone" +#define LN_hold_instruction_none "Hold Instruction None" +#define NID_hold_instruction_none 431 +#define OBJ_hold_instruction_none OBJ_holdInstruction, 1L + +#define SN_hold_instruction_call_issuer "holdInstructionCallIssuer" +#define LN_hold_instruction_call_issuer "Hold Instruction Call Issuer" +#define NID_hold_instruction_call_issuer 432 +#define OBJ_hold_instruction_call_issuer OBJ_holdInstruction, 2L + +#define SN_hold_instruction_reject "holdInstructionReject" +#define LN_hold_instruction_reject "Hold Instruction Reject" +#define NID_hold_instruction_reject 433 +#define OBJ_hold_instruction_reject OBJ_holdInstruction, 3L + +#define SN_data "data" +#define NID_data 434 +#define OBJ_data OBJ_itu_t, 9L + +#define SN_pss "pss" +#define NID_pss 435 +#define OBJ_pss OBJ_data, 2342L + +#define SN_ucl "ucl" +#define NID_ucl 436 +#define OBJ_ucl OBJ_pss, 19200300L + +#define SN_pilot "pilot" +#define NID_pilot 437 +#define OBJ_pilot OBJ_ucl, 100L + +#define LN_pilotAttributeType "pilotAttributeType" +#define NID_pilotAttributeType 438 +#define OBJ_pilotAttributeType OBJ_pilot, 1L + +#define LN_pilotAttributeSyntax "pilotAttributeSyntax" +#define NID_pilotAttributeSyntax 439 +#define OBJ_pilotAttributeSyntax OBJ_pilot, 3L + +#define LN_pilotObjectClass "pilotObjectClass" +#define NID_pilotObjectClass 440 +#define OBJ_pilotObjectClass OBJ_pilot, 4L + +#define LN_pilotGroups "pilotGroups" +#define NID_pilotGroups 441 +#define OBJ_pilotGroups OBJ_pilot, 10L + +#define LN_iA5StringSyntax "iA5StringSyntax" +#define NID_iA5StringSyntax 442 +#define OBJ_iA5StringSyntax OBJ_pilotAttributeSyntax, 4L + +#define LN_caseIgnoreIA5StringSyntax "caseIgnoreIA5StringSyntax" +#define NID_caseIgnoreIA5StringSyntax 443 +#define OBJ_caseIgnoreIA5StringSyntax OBJ_pilotAttributeSyntax, 5L + +#define LN_pilotObject "pilotObject" +#define NID_pilotObject 444 +#define OBJ_pilotObject OBJ_pilotObjectClass, 3L + +#define LN_pilotPerson "pilotPerson" +#define NID_pilotPerson 445 +#define OBJ_pilotPerson OBJ_pilotObjectClass, 4L + +#define SN_account "account" +#define NID_account 446 +#define OBJ_account OBJ_pilotObjectClass, 5L + +#define SN_document "document" +#define NID_document 447 +#define OBJ_document OBJ_pilotObjectClass, 6L + +#define SN_room "room" +#define NID_room 448 +#define OBJ_room OBJ_pilotObjectClass, 7L + +#define LN_documentSeries "documentSeries" +#define NID_documentSeries 449 +#define OBJ_documentSeries OBJ_pilotObjectClass, 9L + +#define SN_Domain "domain" +#define LN_Domain "Domain" +#define NID_Domain 392 +#define OBJ_Domain OBJ_pilotObjectClass, 13L + +#define LN_rFC822localPart "rFC822localPart" +#define NID_rFC822localPart 450 +#define OBJ_rFC822localPart OBJ_pilotObjectClass, 14L + +#define LN_dNSDomain "dNSDomain" +#define NID_dNSDomain 451 +#define OBJ_dNSDomain OBJ_pilotObjectClass, 15L + +#define LN_domainRelatedObject "domainRelatedObject" +#define NID_domainRelatedObject 452 +#define OBJ_domainRelatedObject OBJ_pilotObjectClass, 17L + +#define LN_friendlyCountry "friendlyCountry" +#define NID_friendlyCountry 453 +#define OBJ_friendlyCountry OBJ_pilotObjectClass, 18L + +#define LN_simpleSecurityObject "simpleSecurityObject" +#define NID_simpleSecurityObject 454 +#define OBJ_simpleSecurityObject OBJ_pilotObjectClass, 19L + +#define LN_pilotOrganization "pilotOrganization" +#define NID_pilotOrganization 455 +#define OBJ_pilotOrganization OBJ_pilotObjectClass, 20L + +#define LN_pilotDSA "pilotDSA" +#define NID_pilotDSA 456 +#define OBJ_pilotDSA OBJ_pilotObjectClass, 21L + +#define LN_qualityLabelledData "qualityLabelledData" +#define NID_qualityLabelledData 457 +#define OBJ_qualityLabelledData OBJ_pilotObjectClass, 22L + +#define SN_userId "UID" +#define LN_userId "userId" +#define NID_userId 458 +#define OBJ_userId OBJ_pilotAttributeType, 1L + +#define LN_textEncodedORAddress "textEncodedORAddress" +#define NID_textEncodedORAddress 459 +#define OBJ_textEncodedORAddress OBJ_pilotAttributeType, 2L + +#define SN_rfc822Mailbox "mail" +#define LN_rfc822Mailbox "rfc822Mailbox" +#define NID_rfc822Mailbox 460 +#define OBJ_rfc822Mailbox OBJ_pilotAttributeType, 3L + +#define SN_info "info" +#define NID_info 461 +#define OBJ_info OBJ_pilotAttributeType, 4L + +#define LN_favouriteDrink "favouriteDrink" +#define NID_favouriteDrink 462 +#define OBJ_favouriteDrink OBJ_pilotAttributeType, 5L + +#define LN_roomNumber "roomNumber" +#define NID_roomNumber 463 +#define OBJ_roomNumber OBJ_pilotAttributeType, 6L + +#define SN_photo "photo" +#define NID_photo 464 +#define OBJ_photo OBJ_pilotAttributeType, 7L + +#define LN_userClass "userClass" +#define NID_userClass 465 +#define OBJ_userClass OBJ_pilotAttributeType, 8L + +#define SN_host "host" +#define NID_host 466 +#define OBJ_host OBJ_pilotAttributeType, 9L + +#define SN_manager "manager" +#define NID_manager 467 +#define OBJ_manager OBJ_pilotAttributeType, 10L + +#define LN_documentIdentifier "documentIdentifier" +#define NID_documentIdentifier 468 +#define OBJ_documentIdentifier OBJ_pilotAttributeType, 11L + +#define LN_documentTitle "documentTitle" +#define NID_documentTitle 469 +#define OBJ_documentTitle OBJ_pilotAttributeType, 12L + +#define LN_documentVersion "documentVersion" +#define NID_documentVersion 470 +#define OBJ_documentVersion OBJ_pilotAttributeType, 13L + +#define LN_documentAuthor "documentAuthor" +#define NID_documentAuthor 471 +#define OBJ_documentAuthor OBJ_pilotAttributeType, 14L + +#define LN_documentLocation "documentLocation" +#define NID_documentLocation 472 +#define OBJ_documentLocation OBJ_pilotAttributeType, 15L + +#define LN_homeTelephoneNumber "homeTelephoneNumber" +#define NID_homeTelephoneNumber 473 +#define OBJ_homeTelephoneNumber OBJ_pilotAttributeType, 20L + +#define SN_secretary "secretary" +#define NID_secretary 474 +#define OBJ_secretary OBJ_pilotAttributeType, 21L + +#define LN_otherMailbox "otherMailbox" +#define NID_otherMailbox 475 +#define OBJ_otherMailbox OBJ_pilotAttributeType, 22L + +#define LN_lastModifiedTime "lastModifiedTime" +#define NID_lastModifiedTime 476 +#define OBJ_lastModifiedTime OBJ_pilotAttributeType, 23L + +#define LN_lastModifiedBy "lastModifiedBy" +#define NID_lastModifiedBy 477 +#define OBJ_lastModifiedBy OBJ_pilotAttributeType, 24L + +#define SN_domainComponent "DC" +#define LN_domainComponent "domainComponent" +#define NID_domainComponent 391 +#define OBJ_domainComponent OBJ_pilotAttributeType, 25L + +#define LN_aRecord "aRecord" +#define NID_aRecord 478 +#define OBJ_aRecord OBJ_pilotAttributeType, 26L + +#define LN_pilotAttributeType27 "pilotAttributeType27" +#define NID_pilotAttributeType27 479 +#define OBJ_pilotAttributeType27 OBJ_pilotAttributeType, 27L + +#define LN_mXRecord "mXRecord" +#define NID_mXRecord 480 +#define OBJ_mXRecord OBJ_pilotAttributeType, 28L + +#define LN_nSRecord "nSRecord" +#define NID_nSRecord 481 +#define OBJ_nSRecord OBJ_pilotAttributeType, 29L + +#define LN_sOARecord "sOARecord" +#define NID_sOARecord 482 +#define OBJ_sOARecord OBJ_pilotAttributeType, 30L + +#define LN_cNAMERecord "cNAMERecord" +#define NID_cNAMERecord 483 +#define OBJ_cNAMERecord OBJ_pilotAttributeType, 31L + +#define LN_associatedDomain "associatedDomain" +#define NID_associatedDomain 484 +#define OBJ_associatedDomain OBJ_pilotAttributeType, 37L + +#define LN_associatedName "associatedName" +#define NID_associatedName 485 +#define OBJ_associatedName OBJ_pilotAttributeType, 38L + +#define LN_homePostalAddress "homePostalAddress" +#define NID_homePostalAddress 486 +#define OBJ_homePostalAddress OBJ_pilotAttributeType, 39L + +#define LN_personalTitle "personalTitle" +#define NID_personalTitle 487 +#define OBJ_personalTitle OBJ_pilotAttributeType, 40L + +#define LN_mobileTelephoneNumber "mobileTelephoneNumber" +#define NID_mobileTelephoneNumber 488 +#define OBJ_mobileTelephoneNumber OBJ_pilotAttributeType, 41L + +#define LN_pagerTelephoneNumber "pagerTelephoneNumber" +#define NID_pagerTelephoneNumber 489 +#define OBJ_pagerTelephoneNumber OBJ_pilotAttributeType, 42L + +#define LN_friendlyCountryName "friendlyCountryName" +#define NID_friendlyCountryName 490 +#define OBJ_friendlyCountryName OBJ_pilotAttributeType, 43L + +#define LN_organizationalStatus "organizationalStatus" +#define NID_organizationalStatus 491 +#define OBJ_organizationalStatus OBJ_pilotAttributeType, 45L + +#define LN_janetMailbox "janetMailbox" +#define NID_janetMailbox 492 +#define OBJ_janetMailbox OBJ_pilotAttributeType, 46L + +#define LN_mailPreferenceOption "mailPreferenceOption" +#define NID_mailPreferenceOption 493 +#define OBJ_mailPreferenceOption OBJ_pilotAttributeType, 47L + +#define LN_buildingName "buildingName" +#define NID_buildingName 494 +#define OBJ_buildingName OBJ_pilotAttributeType, 48L + +#define LN_dSAQuality "dSAQuality" +#define NID_dSAQuality 495 +#define OBJ_dSAQuality OBJ_pilotAttributeType, 49L + +#define LN_singleLevelQuality "singleLevelQuality" +#define NID_singleLevelQuality 496 +#define OBJ_singleLevelQuality OBJ_pilotAttributeType, 50L + +#define LN_subtreeMinimumQuality "subtreeMinimumQuality" +#define NID_subtreeMinimumQuality 497 +#define OBJ_subtreeMinimumQuality OBJ_pilotAttributeType, 51L + +#define LN_subtreeMaximumQuality "subtreeMaximumQuality" +#define NID_subtreeMaximumQuality 498 +#define OBJ_subtreeMaximumQuality OBJ_pilotAttributeType, 52L + +#define LN_personalSignature "personalSignature" +#define NID_personalSignature 499 +#define OBJ_personalSignature OBJ_pilotAttributeType, 53L + +#define LN_dITRedirect "dITRedirect" +#define NID_dITRedirect 500 +#define OBJ_dITRedirect OBJ_pilotAttributeType, 54L + +#define SN_audio "audio" +#define NID_audio 501 +#define OBJ_audio OBJ_pilotAttributeType, 55L + +#define LN_documentPublisher "documentPublisher" +#define NID_documentPublisher 502 +#define OBJ_documentPublisher OBJ_pilotAttributeType, 56L + +#define SN_id_set "id-set" +#define LN_id_set "Secure Electronic Transactions" +#define NID_id_set 512 +#define OBJ_id_set OBJ_international_organizations, 42L + +#define SN_set_ctype "set-ctype" +#define LN_set_ctype "content types" +#define NID_set_ctype 513 +#define OBJ_set_ctype OBJ_id_set, 0L + +#define SN_set_msgExt "set-msgExt" +#define LN_set_msgExt "message extensions" +#define NID_set_msgExt 514 +#define OBJ_set_msgExt OBJ_id_set, 1L + +#define SN_set_attr "set-attr" +#define NID_set_attr 515 +#define OBJ_set_attr OBJ_id_set, 3L + +#define SN_set_policy "set-policy" +#define NID_set_policy 516 +#define OBJ_set_policy OBJ_id_set, 5L + +#define SN_set_certExt "set-certExt" +#define LN_set_certExt "certificate extensions" +#define NID_set_certExt 517 +#define OBJ_set_certExt OBJ_id_set, 7L + +#define SN_set_brand "set-brand" +#define NID_set_brand 518 +#define OBJ_set_brand OBJ_id_set, 8L + +#define SN_setct_PANData "setct-PANData" +#define NID_setct_PANData 519 +#define OBJ_setct_PANData OBJ_set_ctype, 0L + +#define SN_setct_PANToken "setct-PANToken" +#define NID_setct_PANToken 520 +#define OBJ_setct_PANToken OBJ_set_ctype, 1L + +#define SN_setct_PANOnly "setct-PANOnly" +#define NID_setct_PANOnly 521 +#define OBJ_setct_PANOnly OBJ_set_ctype, 2L + +#define SN_setct_OIData "setct-OIData" +#define NID_setct_OIData 522 +#define OBJ_setct_OIData OBJ_set_ctype, 3L + +#define SN_setct_PI "setct-PI" +#define NID_setct_PI 523 +#define OBJ_setct_PI OBJ_set_ctype, 4L + +#define SN_setct_PIData "setct-PIData" +#define NID_setct_PIData 524 +#define OBJ_setct_PIData OBJ_set_ctype, 5L + +#define SN_setct_PIDataUnsigned "setct-PIDataUnsigned" +#define NID_setct_PIDataUnsigned 525 +#define OBJ_setct_PIDataUnsigned OBJ_set_ctype, 6L + +#define SN_setct_HODInput "setct-HODInput" +#define NID_setct_HODInput 526 +#define OBJ_setct_HODInput OBJ_set_ctype, 7L + +#define SN_setct_AuthResBaggage "setct-AuthResBaggage" +#define NID_setct_AuthResBaggage 527 +#define OBJ_setct_AuthResBaggage OBJ_set_ctype, 8L + +#define SN_setct_AuthRevReqBaggage "setct-AuthRevReqBaggage" +#define NID_setct_AuthRevReqBaggage 528 +#define OBJ_setct_AuthRevReqBaggage OBJ_set_ctype, 9L + +#define SN_setct_AuthRevResBaggage "setct-AuthRevResBaggage" +#define NID_setct_AuthRevResBaggage 529 +#define OBJ_setct_AuthRevResBaggage OBJ_set_ctype, 10L + +#define SN_setct_CapTokenSeq "setct-CapTokenSeq" +#define NID_setct_CapTokenSeq 530 +#define OBJ_setct_CapTokenSeq OBJ_set_ctype, 11L + +#define SN_setct_PInitResData "setct-PInitResData" +#define NID_setct_PInitResData 531 +#define OBJ_setct_PInitResData OBJ_set_ctype, 12L + +#define SN_setct_PI_TBS "setct-PI-TBS" +#define NID_setct_PI_TBS 532 +#define OBJ_setct_PI_TBS OBJ_set_ctype, 13L + +#define SN_setct_PResData "setct-PResData" +#define NID_setct_PResData 533 +#define OBJ_setct_PResData OBJ_set_ctype, 14L + +#define SN_setct_AuthReqTBS "setct-AuthReqTBS" +#define NID_setct_AuthReqTBS 534 +#define OBJ_setct_AuthReqTBS OBJ_set_ctype, 16L + +#define SN_setct_AuthResTBS "setct-AuthResTBS" +#define NID_setct_AuthResTBS 535 +#define OBJ_setct_AuthResTBS OBJ_set_ctype, 17L + +#define SN_setct_AuthResTBSX "setct-AuthResTBSX" +#define NID_setct_AuthResTBSX 536 +#define OBJ_setct_AuthResTBSX OBJ_set_ctype, 18L + +#define SN_setct_AuthTokenTBS "setct-AuthTokenTBS" +#define NID_setct_AuthTokenTBS 537 +#define OBJ_setct_AuthTokenTBS OBJ_set_ctype, 19L + +#define SN_setct_CapTokenData "setct-CapTokenData" +#define NID_setct_CapTokenData 538 +#define OBJ_setct_CapTokenData OBJ_set_ctype, 20L + +#define SN_setct_CapTokenTBS "setct-CapTokenTBS" +#define NID_setct_CapTokenTBS 539 +#define OBJ_setct_CapTokenTBS OBJ_set_ctype, 21L + +#define SN_setct_AcqCardCodeMsg "setct-AcqCardCodeMsg" +#define NID_setct_AcqCardCodeMsg 540 +#define OBJ_setct_AcqCardCodeMsg OBJ_set_ctype, 22L + +#define SN_setct_AuthRevReqTBS "setct-AuthRevReqTBS" +#define NID_setct_AuthRevReqTBS 541 +#define OBJ_setct_AuthRevReqTBS OBJ_set_ctype, 23L + +#define SN_setct_AuthRevResData "setct-AuthRevResData" +#define NID_setct_AuthRevResData 542 +#define OBJ_setct_AuthRevResData OBJ_set_ctype, 24L + +#define SN_setct_AuthRevResTBS "setct-AuthRevResTBS" +#define NID_setct_AuthRevResTBS 543 +#define OBJ_setct_AuthRevResTBS OBJ_set_ctype, 25L + +#define SN_setct_CapReqTBS "setct-CapReqTBS" +#define NID_setct_CapReqTBS 544 +#define OBJ_setct_CapReqTBS OBJ_set_ctype, 26L + +#define SN_setct_CapReqTBSX "setct-CapReqTBSX" +#define NID_setct_CapReqTBSX 545 +#define OBJ_setct_CapReqTBSX OBJ_set_ctype, 27L + +#define SN_setct_CapResData "setct-CapResData" +#define NID_setct_CapResData 546 +#define OBJ_setct_CapResData OBJ_set_ctype, 28L + +#define SN_setct_CapRevReqTBS "setct-CapRevReqTBS" +#define NID_setct_CapRevReqTBS 547 +#define OBJ_setct_CapRevReqTBS OBJ_set_ctype, 29L + +#define SN_setct_CapRevReqTBSX "setct-CapRevReqTBSX" +#define NID_setct_CapRevReqTBSX 548 +#define OBJ_setct_CapRevReqTBSX OBJ_set_ctype, 30L + +#define SN_setct_CapRevResData "setct-CapRevResData" +#define NID_setct_CapRevResData 549 +#define OBJ_setct_CapRevResData OBJ_set_ctype, 31L + +#define SN_setct_CredReqTBS "setct-CredReqTBS" +#define NID_setct_CredReqTBS 550 +#define OBJ_setct_CredReqTBS OBJ_set_ctype, 32L + +#define SN_setct_CredReqTBSX "setct-CredReqTBSX" +#define NID_setct_CredReqTBSX 551 +#define OBJ_setct_CredReqTBSX OBJ_set_ctype, 33L + +#define SN_setct_CredResData "setct-CredResData" +#define NID_setct_CredResData 552 +#define OBJ_setct_CredResData OBJ_set_ctype, 34L + +#define SN_setct_CredRevReqTBS "setct-CredRevReqTBS" +#define NID_setct_CredRevReqTBS 553 +#define OBJ_setct_CredRevReqTBS OBJ_set_ctype, 35L + +#define SN_setct_CredRevReqTBSX "setct-CredRevReqTBSX" +#define NID_setct_CredRevReqTBSX 554 +#define OBJ_setct_CredRevReqTBSX OBJ_set_ctype, 36L + +#define SN_setct_CredRevResData "setct-CredRevResData" +#define NID_setct_CredRevResData 555 +#define OBJ_setct_CredRevResData OBJ_set_ctype, 37L + +#define SN_setct_PCertReqData "setct-PCertReqData" +#define NID_setct_PCertReqData 556 +#define OBJ_setct_PCertReqData OBJ_set_ctype, 38L + +#define SN_setct_PCertResTBS "setct-PCertResTBS" +#define NID_setct_PCertResTBS 557 +#define OBJ_setct_PCertResTBS OBJ_set_ctype, 39L + +#define SN_setct_BatchAdminReqData "setct-BatchAdminReqData" +#define NID_setct_BatchAdminReqData 558 +#define OBJ_setct_BatchAdminReqData OBJ_set_ctype, 40L + +#define SN_setct_BatchAdminResData "setct-BatchAdminResData" +#define NID_setct_BatchAdminResData 559 +#define OBJ_setct_BatchAdminResData OBJ_set_ctype, 41L + +#define SN_setct_CardCInitResTBS "setct-CardCInitResTBS" +#define NID_setct_CardCInitResTBS 560 +#define OBJ_setct_CardCInitResTBS OBJ_set_ctype, 42L + +#define SN_setct_MeAqCInitResTBS "setct-MeAqCInitResTBS" +#define NID_setct_MeAqCInitResTBS 561 +#define OBJ_setct_MeAqCInitResTBS OBJ_set_ctype, 43L + +#define SN_setct_RegFormResTBS "setct-RegFormResTBS" +#define NID_setct_RegFormResTBS 562 +#define OBJ_setct_RegFormResTBS OBJ_set_ctype, 44L + +#define SN_setct_CertReqData "setct-CertReqData" +#define NID_setct_CertReqData 563 +#define OBJ_setct_CertReqData OBJ_set_ctype, 45L + +#define SN_setct_CertReqTBS "setct-CertReqTBS" +#define NID_setct_CertReqTBS 564 +#define OBJ_setct_CertReqTBS OBJ_set_ctype, 46L + +#define SN_setct_CertResData "setct-CertResData" +#define NID_setct_CertResData 565 +#define OBJ_setct_CertResData OBJ_set_ctype, 47L + +#define SN_setct_CertInqReqTBS "setct-CertInqReqTBS" +#define NID_setct_CertInqReqTBS 566 +#define OBJ_setct_CertInqReqTBS OBJ_set_ctype, 48L + +#define SN_setct_ErrorTBS "setct-ErrorTBS" +#define NID_setct_ErrorTBS 567 +#define OBJ_setct_ErrorTBS OBJ_set_ctype, 49L + +#define SN_setct_PIDualSignedTBE "setct-PIDualSignedTBE" +#define NID_setct_PIDualSignedTBE 568 +#define OBJ_setct_PIDualSignedTBE OBJ_set_ctype, 50L + +#define SN_setct_PIUnsignedTBE "setct-PIUnsignedTBE" +#define NID_setct_PIUnsignedTBE 569 +#define OBJ_setct_PIUnsignedTBE OBJ_set_ctype, 51L + +#define SN_setct_AuthReqTBE "setct-AuthReqTBE" +#define NID_setct_AuthReqTBE 570 +#define OBJ_setct_AuthReqTBE OBJ_set_ctype, 52L + +#define SN_setct_AuthResTBE "setct-AuthResTBE" +#define NID_setct_AuthResTBE 571 +#define OBJ_setct_AuthResTBE OBJ_set_ctype, 53L + +#define SN_setct_AuthResTBEX "setct-AuthResTBEX" +#define NID_setct_AuthResTBEX 572 +#define OBJ_setct_AuthResTBEX OBJ_set_ctype, 54L + +#define SN_setct_AuthTokenTBE "setct-AuthTokenTBE" +#define NID_setct_AuthTokenTBE 573 +#define OBJ_setct_AuthTokenTBE OBJ_set_ctype, 55L + +#define SN_setct_CapTokenTBE "setct-CapTokenTBE" +#define NID_setct_CapTokenTBE 574 +#define OBJ_setct_CapTokenTBE OBJ_set_ctype, 56L + +#define SN_setct_CapTokenTBEX "setct-CapTokenTBEX" +#define NID_setct_CapTokenTBEX 575 +#define OBJ_setct_CapTokenTBEX OBJ_set_ctype, 57L + +#define SN_setct_AcqCardCodeMsgTBE "setct-AcqCardCodeMsgTBE" +#define NID_setct_AcqCardCodeMsgTBE 576 +#define OBJ_setct_AcqCardCodeMsgTBE OBJ_set_ctype, 58L + +#define SN_setct_AuthRevReqTBE "setct-AuthRevReqTBE" +#define NID_setct_AuthRevReqTBE 577 +#define OBJ_setct_AuthRevReqTBE OBJ_set_ctype, 59L + +#define SN_setct_AuthRevResTBE "setct-AuthRevResTBE" +#define NID_setct_AuthRevResTBE 578 +#define OBJ_setct_AuthRevResTBE OBJ_set_ctype, 60L + +#define SN_setct_AuthRevResTBEB "setct-AuthRevResTBEB" +#define NID_setct_AuthRevResTBEB 579 +#define OBJ_setct_AuthRevResTBEB OBJ_set_ctype, 61L + +#define SN_setct_CapReqTBE "setct-CapReqTBE" +#define NID_setct_CapReqTBE 580 +#define OBJ_setct_CapReqTBE OBJ_set_ctype, 62L + +#define SN_setct_CapReqTBEX "setct-CapReqTBEX" +#define NID_setct_CapReqTBEX 581 +#define OBJ_setct_CapReqTBEX OBJ_set_ctype, 63L + +#define SN_setct_CapResTBE "setct-CapResTBE" +#define NID_setct_CapResTBE 582 +#define OBJ_setct_CapResTBE OBJ_set_ctype, 64L + +#define SN_setct_CapRevReqTBE "setct-CapRevReqTBE" +#define NID_setct_CapRevReqTBE 583 +#define OBJ_setct_CapRevReqTBE OBJ_set_ctype, 65L + +#define SN_setct_CapRevReqTBEX "setct-CapRevReqTBEX" +#define NID_setct_CapRevReqTBEX 584 +#define OBJ_setct_CapRevReqTBEX OBJ_set_ctype, 66L + +#define SN_setct_CapRevResTBE "setct-CapRevResTBE" +#define NID_setct_CapRevResTBE 585 +#define OBJ_setct_CapRevResTBE OBJ_set_ctype, 67L + +#define SN_setct_CredReqTBE "setct-CredReqTBE" +#define NID_setct_CredReqTBE 586 +#define OBJ_setct_CredReqTBE OBJ_set_ctype, 68L + +#define SN_setct_CredReqTBEX "setct-CredReqTBEX" +#define NID_setct_CredReqTBEX 587 +#define OBJ_setct_CredReqTBEX OBJ_set_ctype, 69L + +#define SN_setct_CredResTBE "setct-CredResTBE" +#define NID_setct_CredResTBE 588 +#define OBJ_setct_CredResTBE OBJ_set_ctype, 70L + +#define SN_setct_CredRevReqTBE "setct-CredRevReqTBE" +#define NID_setct_CredRevReqTBE 589 +#define OBJ_setct_CredRevReqTBE OBJ_set_ctype, 71L + +#define SN_setct_CredRevReqTBEX "setct-CredRevReqTBEX" +#define NID_setct_CredRevReqTBEX 590 +#define OBJ_setct_CredRevReqTBEX OBJ_set_ctype, 72L + +#define SN_setct_CredRevResTBE "setct-CredRevResTBE" +#define NID_setct_CredRevResTBE 591 +#define OBJ_setct_CredRevResTBE OBJ_set_ctype, 73L + +#define SN_setct_BatchAdminReqTBE "setct-BatchAdminReqTBE" +#define NID_setct_BatchAdminReqTBE 592 +#define OBJ_setct_BatchAdminReqTBE OBJ_set_ctype, 74L + +#define SN_setct_BatchAdminResTBE "setct-BatchAdminResTBE" +#define NID_setct_BatchAdminResTBE 593 +#define OBJ_setct_BatchAdminResTBE OBJ_set_ctype, 75L + +#define SN_setct_RegFormReqTBE "setct-RegFormReqTBE" +#define NID_setct_RegFormReqTBE 594 +#define OBJ_setct_RegFormReqTBE OBJ_set_ctype, 76L + +#define SN_setct_CertReqTBE "setct-CertReqTBE" +#define NID_setct_CertReqTBE 595 +#define OBJ_setct_CertReqTBE OBJ_set_ctype, 77L + +#define SN_setct_CertReqTBEX "setct-CertReqTBEX" +#define NID_setct_CertReqTBEX 596 +#define OBJ_setct_CertReqTBEX OBJ_set_ctype, 78L + +#define SN_setct_CertResTBE "setct-CertResTBE" +#define NID_setct_CertResTBE 597 +#define OBJ_setct_CertResTBE OBJ_set_ctype, 79L + +#define SN_setct_CRLNotificationTBS "setct-CRLNotificationTBS" +#define NID_setct_CRLNotificationTBS 598 +#define OBJ_setct_CRLNotificationTBS OBJ_set_ctype, 80L + +#define SN_setct_CRLNotificationResTBS "setct-CRLNotificationResTBS" +#define NID_setct_CRLNotificationResTBS 599 +#define OBJ_setct_CRLNotificationResTBS OBJ_set_ctype, 81L + +#define SN_setct_BCIDistributionTBS "setct-BCIDistributionTBS" +#define NID_setct_BCIDistributionTBS 600 +#define OBJ_setct_BCIDistributionTBS OBJ_set_ctype, 82L + +#define SN_setext_genCrypt "setext-genCrypt" +#define LN_setext_genCrypt "generic cryptogram" +#define NID_setext_genCrypt 601 +#define OBJ_setext_genCrypt OBJ_set_msgExt, 1L + +#define SN_setext_miAuth "setext-miAuth" +#define LN_setext_miAuth "merchant initiated auth" +#define NID_setext_miAuth 602 +#define OBJ_setext_miAuth OBJ_set_msgExt, 3L + +#define SN_setext_pinSecure "setext-pinSecure" +#define NID_setext_pinSecure 603 +#define OBJ_setext_pinSecure OBJ_set_msgExt, 4L + +#define SN_setext_pinAny "setext-pinAny" +#define NID_setext_pinAny 604 +#define OBJ_setext_pinAny OBJ_set_msgExt, 5L + +#define SN_setext_track2 "setext-track2" +#define NID_setext_track2 605 +#define OBJ_setext_track2 OBJ_set_msgExt, 7L + +#define SN_setext_cv "setext-cv" +#define LN_setext_cv "additional verification" +#define NID_setext_cv 606 +#define OBJ_setext_cv OBJ_set_msgExt, 8L + +#define SN_set_policy_root "set-policy-root" +#define NID_set_policy_root 607 +#define OBJ_set_policy_root OBJ_set_policy, 0L + +#define SN_setCext_hashedRoot "setCext-hashedRoot" +#define NID_setCext_hashedRoot 608 +#define OBJ_setCext_hashedRoot OBJ_set_certExt, 0L + +#define SN_setCext_certType "setCext-certType" +#define NID_setCext_certType 609 +#define OBJ_setCext_certType OBJ_set_certExt, 1L + +#define SN_setCext_merchData "setCext-merchData" +#define NID_setCext_merchData 610 +#define OBJ_setCext_merchData OBJ_set_certExt, 2L + +#define SN_setCext_cCertRequired "setCext-cCertRequired" +#define NID_setCext_cCertRequired 611 +#define OBJ_setCext_cCertRequired OBJ_set_certExt, 3L + +#define SN_setCext_tunneling "setCext-tunneling" +#define NID_setCext_tunneling 612 +#define OBJ_setCext_tunneling OBJ_set_certExt, 4L + +#define SN_setCext_setExt "setCext-setExt" +#define NID_setCext_setExt 613 +#define OBJ_setCext_setExt OBJ_set_certExt, 5L + +#define SN_setCext_setQualf "setCext-setQualf" +#define NID_setCext_setQualf 614 +#define OBJ_setCext_setQualf OBJ_set_certExt, 6L + +#define SN_setCext_PGWYcapabilities "setCext-PGWYcapabilities" +#define NID_setCext_PGWYcapabilities 615 +#define OBJ_setCext_PGWYcapabilities OBJ_set_certExt, 7L + +#define SN_setCext_TokenIdentifier "setCext-TokenIdentifier" +#define NID_setCext_TokenIdentifier 616 +#define OBJ_setCext_TokenIdentifier OBJ_set_certExt, 8L + +#define SN_setCext_Track2Data "setCext-Track2Data" +#define NID_setCext_Track2Data 617 +#define OBJ_setCext_Track2Data OBJ_set_certExt, 9L + +#define SN_setCext_TokenType "setCext-TokenType" +#define NID_setCext_TokenType 618 +#define OBJ_setCext_TokenType OBJ_set_certExt, 10L + +#define SN_setCext_IssuerCapabilities "setCext-IssuerCapabilities" +#define NID_setCext_IssuerCapabilities 619 +#define OBJ_setCext_IssuerCapabilities OBJ_set_certExt, 11L + +#define SN_setAttr_Cert "setAttr-Cert" +#define NID_setAttr_Cert 620 +#define OBJ_setAttr_Cert OBJ_set_attr, 0L + +#define SN_setAttr_PGWYcap "setAttr-PGWYcap" +#define LN_setAttr_PGWYcap "payment gateway capabilities" +#define NID_setAttr_PGWYcap 621 +#define OBJ_setAttr_PGWYcap OBJ_set_attr, 1L + +#define SN_setAttr_TokenType "setAttr-TokenType" +#define NID_setAttr_TokenType 622 +#define OBJ_setAttr_TokenType OBJ_set_attr, 2L + +#define SN_setAttr_IssCap "setAttr-IssCap" +#define LN_setAttr_IssCap "issuer capabilities" +#define NID_setAttr_IssCap 623 +#define OBJ_setAttr_IssCap OBJ_set_attr, 3L + +#define SN_set_rootKeyThumb "set-rootKeyThumb" +#define NID_set_rootKeyThumb 624 +#define OBJ_set_rootKeyThumb OBJ_setAttr_Cert, 0L + +#define SN_set_addPolicy "set-addPolicy" +#define NID_set_addPolicy 625 +#define OBJ_set_addPolicy OBJ_setAttr_Cert, 1L + +#define SN_setAttr_Token_EMV "setAttr-Token-EMV" +#define NID_setAttr_Token_EMV 626 +#define OBJ_setAttr_Token_EMV OBJ_setAttr_TokenType, 1L + +#define SN_setAttr_Token_B0Prime "setAttr-Token-B0Prime" +#define NID_setAttr_Token_B0Prime 627 +#define OBJ_setAttr_Token_B0Prime OBJ_setAttr_TokenType, 2L + +#define SN_setAttr_IssCap_CVM "setAttr-IssCap-CVM" +#define NID_setAttr_IssCap_CVM 628 +#define OBJ_setAttr_IssCap_CVM OBJ_setAttr_IssCap, 3L + +#define SN_setAttr_IssCap_T2 "setAttr-IssCap-T2" +#define NID_setAttr_IssCap_T2 629 +#define OBJ_setAttr_IssCap_T2 OBJ_setAttr_IssCap, 4L + +#define SN_setAttr_IssCap_Sig "setAttr-IssCap-Sig" +#define NID_setAttr_IssCap_Sig 630 +#define OBJ_setAttr_IssCap_Sig OBJ_setAttr_IssCap, 5L + +#define SN_setAttr_GenCryptgrm "setAttr-GenCryptgrm" +#define LN_setAttr_GenCryptgrm "generate cryptogram" +#define NID_setAttr_GenCryptgrm 631 +#define OBJ_setAttr_GenCryptgrm OBJ_setAttr_IssCap_CVM, 1L + +#define SN_setAttr_T2Enc "setAttr-T2Enc" +#define LN_setAttr_T2Enc "encrypted track 2" +#define NID_setAttr_T2Enc 632 +#define OBJ_setAttr_T2Enc OBJ_setAttr_IssCap_T2, 1L + +#define SN_setAttr_T2cleartxt "setAttr-T2cleartxt" +#define LN_setAttr_T2cleartxt "cleartext track 2" +#define NID_setAttr_T2cleartxt 633 +#define OBJ_setAttr_T2cleartxt OBJ_setAttr_IssCap_T2, 2L + +#define SN_setAttr_TokICCsig "setAttr-TokICCsig" +#define LN_setAttr_TokICCsig "ICC or token signature" +#define NID_setAttr_TokICCsig 634 +#define OBJ_setAttr_TokICCsig OBJ_setAttr_IssCap_Sig, 1L + +#define SN_setAttr_SecDevSig "setAttr-SecDevSig" +#define LN_setAttr_SecDevSig "secure device signature" +#define NID_setAttr_SecDevSig 635 +#define OBJ_setAttr_SecDevSig OBJ_setAttr_IssCap_Sig, 2L + +#define SN_set_brand_IATA_ATA "set-brand-IATA-ATA" +#define NID_set_brand_IATA_ATA 636 +#define OBJ_set_brand_IATA_ATA OBJ_set_brand, 1L + +#define SN_set_brand_Diners "set-brand-Diners" +#define NID_set_brand_Diners 637 +#define OBJ_set_brand_Diners OBJ_set_brand, 30L + +#define SN_set_brand_AmericanExpress "set-brand-AmericanExpress" +#define NID_set_brand_AmericanExpress 638 +#define OBJ_set_brand_AmericanExpress OBJ_set_brand, 34L + +#define SN_set_brand_JCB "set-brand-JCB" +#define NID_set_brand_JCB 639 +#define OBJ_set_brand_JCB OBJ_set_brand, 35L + +#define SN_set_brand_Visa "set-brand-Visa" +#define NID_set_brand_Visa 640 +#define OBJ_set_brand_Visa OBJ_set_brand, 4L + +#define SN_set_brand_MasterCard "set-brand-MasterCard" +#define NID_set_brand_MasterCard 641 +#define OBJ_set_brand_MasterCard OBJ_set_brand, 5L + +#define SN_set_brand_Novus "set-brand-Novus" +#define NID_set_brand_Novus 642 +#define OBJ_set_brand_Novus OBJ_set_brand, 6011L + +#define SN_des_cdmf "DES-CDMF" +#define LN_des_cdmf "des-cdmf" +#define NID_des_cdmf 643 +#define OBJ_des_cdmf OBJ_rsadsi, 3L, 10L + +#define SN_rsaOAEPEncryptionSET "rsaOAEPEncryptionSET" +#define NID_rsaOAEPEncryptionSET 644 +#define OBJ_rsaOAEPEncryptionSET OBJ_rsadsi, 1L, 1L, 6L + +#define SN_ipsec3 "Oakley-EC2N-3" +#define LN_ipsec3 "ipsec3" +#define NID_ipsec3 749 + +#define SN_ipsec4 "Oakley-EC2N-4" +#define LN_ipsec4 "ipsec4" +#define NID_ipsec4 750 + +#define SN_whirlpool "whirlpool" +#define NID_whirlpool 804 +#define OBJ_whirlpool OBJ_iso, 0L, 10118L, 3L, 0L, 55L + +#define SN_cryptopro "cryptopro" +#define NID_cryptopro 805 +#define OBJ_cryptopro OBJ_member_body, 643L, 2L, 2L + +#define SN_cryptocom "cryptocom" +#define NID_cryptocom 806 +#define OBJ_cryptocom OBJ_member_body, 643L, 2L, 9L + +#define SN_id_GostR3411_94_with_GostR3410_2001 \ + "id-GostR3411-94-with-GostR3410-2001" +#define LN_id_GostR3411_94_with_GostR3410_2001 \ + "GOST R 34.11-94 with GOST R 34.10-2001" +#define NID_id_GostR3411_94_with_GostR3410_2001 807 +#define OBJ_id_GostR3411_94_with_GostR3410_2001 OBJ_cryptopro, 3L + +#define SN_id_GostR3411_94_with_GostR3410_94 "id-GostR3411-94-with-GostR3410-94" +#define LN_id_GostR3411_94_with_GostR3410_94 \ + "GOST R 34.11-94 with GOST R 34.10-94" +#define NID_id_GostR3411_94_with_GostR3410_94 808 +#define OBJ_id_GostR3411_94_with_GostR3410_94 OBJ_cryptopro, 4L + +#define SN_id_GostR3411_94 "md_gost94" +#define LN_id_GostR3411_94 "GOST R 34.11-94" +#define NID_id_GostR3411_94 809 +#define OBJ_id_GostR3411_94 OBJ_cryptopro, 9L + +#define SN_id_HMACGostR3411_94 "id-HMACGostR3411-94" +#define LN_id_HMACGostR3411_94 "HMAC GOST 34.11-94" +#define NID_id_HMACGostR3411_94 810 +#define OBJ_id_HMACGostR3411_94 OBJ_cryptopro, 10L + +#define SN_id_GostR3410_2001 "gost2001" +#define LN_id_GostR3410_2001 "GOST R 34.10-2001" +#define NID_id_GostR3410_2001 811 +#define OBJ_id_GostR3410_2001 OBJ_cryptopro, 19L + +#define SN_id_GostR3410_94 "gost94" +#define LN_id_GostR3410_94 "GOST R 34.10-94" +#define NID_id_GostR3410_94 812 +#define OBJ_id_GostR3410_94 OBJ_cryptopro, 20L + +#define SN_id_Gost28147_89 "gost89" +#define LN_id_Gost28147_89 "GOST 28147-89" +#define NID_id_Gost28147_89 813 +#define OBJ_id_Gost28147_89 OBJ_cryptopro, 21L + +#define SN_gost89_cnt "gost89-cnt" +#define NID_gost89_cnt 814 + +#define SN_id_Gost28147_89_MAC "gost-mac" +#define LN_id_Gost28147_89_MAC "GOST 28147-89 MAC" +#define NID_id_Gost28147_89_MAC 815 +#define OBJ_id_Gost28147_89_MAC OBJ_cryptopro, 22L + +#define SN_id_GostR3411_94_prf "prf-gostr3411-94" +#define LN_id_GostR3411_94_prf "GOST R 34.11-94 PRF" +#define NID_id_GostR3411_94_prf 816 +#define OBJ_id_GostR3411_94_prf OBJ_cryptopro, 23L + +#define SN_id_GostR3410_2001DH "id-GostR3410-2001DH" +#define LN_id_GostR3410_2001DH "GOST R 34.10-2001 DH" +#define NID_id_GostR3410_2001DH 817 +#define OBJ_id_GostR3410_2001DH OBJ_cryptopro, 98L + +#define SN_id_GostR3410_94DH "id-GostR3410-94DH" +#define LN_id_GostR3410_94DH "GOST R 34.10-94 DH" +#define NID_id_GostR3410_94DH 818 +#define OBJ_id_GostR3410_94DH OBJ_cryptopro, 99L + +#define SN_id_Gost28147_89_CryptoPro_KeyMeshing \ + "id-Gost28147-89-CryptoPro-KeyMeshing" +#define NID_id_Gost28147_89_CryptoPro_KeyMeshing 819 +#define OBJ_id_Gost28147_89_CryptoPro_KeyMeshing OBJ_cryptopro, 14L, 1L + +#define SN_id_Gost28147_89_None_KeyMeshing "id-Gost28147-89-None-KeyMeshing" +#define NID_id_Gost28147_89_None_KeyMeshing 820 +#define OBJ_id_Gost28147_89_None_KeyMeshing OBJ_cryptopro, 14L, 0L + +#define SN_id_GostR3411_94_TestParamSet "id-GostR3411-94-TestParamSet" +#define NID_id_GostR3411_94_TestParamSet 821 +#define OBJ_id_GostR3411_94_TestParamSet OBJ_cryptopro, 30L, 0L + +#define SN_id_GostR3411_94_CryptoProParamSet "id-GostR3411-94-CryptoProParamSet" +#define NID_id_GostR3411_94_CryptoProParamSet 822 +#define OBJ_id_GostR3411_94_CryptoProParamSet OBJ_cryptopro, 30L, 1L + +#define SN_id_Gost28147_89_TestParamSet "id-Gost28147-89-TestParamSet" +#define NID_id_Gost28147_89_TestParamSet 823 +#define OBJ_id_Gost28147_89_TestParamSet OBJ_cryptopro, 31L, 0L + +#define SN_id_Gost28147_89_CryptoPro_A_ParamSet \ + "id-Gost28147-89-CryptoPro-A-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_A_ParamSet 824 +#define OBJ_id_Gost28147_89_CryptoPro_A_ParamSet OBJ_cryptopro, 31L, 1L + +#define SN_id_Gost28147_89_CryptoPro_B_ParamSet \ + "id-Gost28147-89-CryptoPro-B-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_B_ParamSet 825 +#define OBJ_id_Gost28147_89_CryptoPro_B_ParamSet OBJ_cryptopro, 31L, 2L + +#define SN_id_Gost28147_89_CryptoPro_C_ParamSet \ + "id-Gost28147-89-CryptoPro-C-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_C_ParamSet 826 +#define OBJ_id_Gost28147_89_CryptoPro_C_ParamSet OBJ_cryptopro, 31L, 3L + +#define SN_id_Gost28147_89_CryptoPro_D_ParamSet \ + "id-Gost28147-89-CryptoPro-D-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_D_ParamSet 827 +#define OBJ_id_Gost28147_89_CryptoPro_D_ParamSet OBJ_cryptopro, 31L, 4L + +#define SN_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet \ + "id-Gost28147-89-CryptoPro-Oscar-1-1-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet 828 +#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet OBJ_cryptopro, 31L, 5L + +#define SN_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet \ + "id-Gost28147-89-CryptoPro-Oscar-1-0-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet 829 +#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet OBJ_cryptopro, 31L, 6L + +#define SN_id_Gost28147_89_CryptoPro_RIC_1_ParamSet \ + "id-Gost28147-89-CryptoPro-RIC-1-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_RIC_1_ParamSet 830 +#define OBJ_id_Gost28147_89_CryptoPro_RIC_1_ParamSet OBJ_cryptopro, 31L, 7L + +#define SN_id_GostR3410_94_TestParamSet "id-GostR3410-94-TestParamSet" +#define NID_id_GostR3410_94_TestParamSet 831 +#define OBJ_id_GostR3410_94_TestParamSet OBJ_cryptopro, 32L, 0L + +#define SN_id_GostR3410_94_CryptoPro_A_ParamSet \ + "id-GostR3410-94-CryptoPro-A-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_A_ParamSet 832 +#define OBJ_id_GostR3410_94_CryptoPro_A_ParamSet OBJ_cryptopro, 32L, 2L + +#define SN_id_GostR3410_94_CryptoPro_B_ParamSet \ + "id-GostR3410-94-CryptoPro-B-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_B_ParamSet 833 +#define OBJ_id_GostR3410_94_CryptoPro_B_ParamSet OBJ_cryptopro, 32L, 3L + +#define SN_id_GostR3410_94_CryptoPro_C_ParamSet \ + "id-GostR3410-94-CryptoPro-C-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_C_ParamSet 834 +#define OBJ_id_GostR3410_94_CryptoPro_C_ParamSet OBJ_cryptopro, 32L, 4L + +#define SN_id_GostR3410_94_CryptoPro_D_ParamSet \ + "id-GostR3410-94-CryptoPro-D-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_D_ParamSet 835 +#define OBJ_id_GostR3410_94_CryptoPro_D_ParamSet OBJ_cryptopro, 32L, 5L + +#define SN_id_GostR3410_94_CryptoPro_XchA_ParamSet \ + "id-GostR3410-94-CryptoPro-XchA-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_XchA_ParamSet 836 +#define OBJ_id_GostR3410_94_CryptoPro_XchA_ParamSet OBJ_cryptopro, 33L, 1L + +#define SN_id_GostR3410_94_CryptoPro_XchB_ParamSet \ + "id-GostR3410-94-CryptoPro-XchB-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_XchB_ParamSet 837 +#define OBJ_id_GostR3410_94_CryptoPro_XchB_ParamSet OBJ_cryptopro, 33L, 2L + +#define SN_id_GostR3410_94_CryptoPro_XchC_ParamSet \ + "id-GostR3410-94-CryptoPro-XchC-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_XchC_ParamSet 838 +#define OBJ_id_GostR3410_94_CryptoPro_XchC_ParamSet OBJ_cryptopro, 33L, 3L + +#define SN_id_GostR3410_2001_TestParamSet "id-GostR3410-2001-TestParamSet" +#define NID_id_GostR3410_2001_TestParamSet 839 +#define OBJ_id_GostR3410_2001_TestParamSet OBJ_cryptopro, 35L, 0L + +#define SN_id_GostR3410_2001_CryptoPro_A_ParamSet \ + "id-GostR3410-2001-CryptoPro-A-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_A_ParamSet 840 +#define OBJ_id_GostR3410_2001_CryptoPro_A_ParamSet OBJ_cryptopro, 35L, 1L + +#define SN_id_GostR3410_2001_CryptoPro_B_ParamSet \ + "id-GostR3410-2001-CryptoPro-B-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_B_ParamSet 841 +#define OBJ_id_GostR3410_2001_CryptoPro_B_ParamSet OBJ_cryptopro, 35L, 2L + +#define SN_id_GostR3410_2001_CryptoPro_C_ParamSet \ + "id-GostR3410-2001-CryptoPro-C-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_C_ParamSet 842 +#define OBJ_id_GostR3410_2001_CryptoPro_C_ParamSet OBJ_cryptopro, 35L, 3L + +#define SN_id_GostR3410_2001_CryptoPro_XchA_ParamSet \ + "id-GostR3410-2001-CryptoPro-XchA-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet 843 +#define OBJ_id_GostR3410_2001_CryptoPro_XchA_ParamSet OBJ_cryptopro, 36L, 0L + +#define SN_id_GostR3410_2001_CryptoPro_XchB_ParamSet \ + "id-GostR3410-2001-CryptoPro-XchB-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_XchB_ParamSet 844 +#define OBJ_id_GostR3410_2001_CryptoPro_XchB_ParamSet OBJ_cryptopro, 36L, 1L + +#define SN_id_GostR3410_94_a "id-GostR3410-94-a" +#define NID_id_GostR3410_94_a 845 +#define OBJ_id_GostR3410_94_a OBJ_id_GostR3410_94, 1L + +#define SN_id_GostR3410_94_aBis "id-GostR3410-94-aBis" +#define NID_id_GostR3410_94_aBis 846 +#define OBJ_id_GostR3410_94_aBis OBJ_id_GostR3410_94, 2L + +#define SN_id_GostR3410_94_b "id-GostR3410-94-b" +#define NID_id_GostR3410_94_b 847 +#define OBJ_id_GostR3410_94_b OBJ_id_GostR3410_94, 3L + +#define SN_id_GostR3410_94_bBis "id-GostR3410-94-bBis" +#define NID_id_GostR3410_94_bBis 848 +#define OBJ_id_GostR3410_94_bBis OBJ_id_GostR3410_94, 4L + +#define SN_id_Gost28147_89_cc "id-Gost28147-89-cc" +#define LN_id_Gost28147_89_cc "GOST 28147-89 Cryptocom ParamSet" +#define NID_id_Gost28147_89_cc 849 +#define OBJ_id_Gost28147_89_cc OBJ_cryptocom, 1L, 6L, 1L + +#define SN_id_GostR3410_94_cc "gost94cc" +#define LN_id_GostR3410_94_cc "GOST 34.10-94 Cryptocom" +#define NID_id_GostR3410_94_cc 850 +#define OBJ_id_GostR3410_94_cc OBJ_cryptocom, 1L, 5L, 3L + +#define SN_id_GostR3410_2001_cc "gost2001cc" +#define LN_id_GostR3410_2001_cc "GOST 34.10-2001 Cryptocom" +#define NID_id_GostR3410_2001_cc 851 +#define OBJ_id_GostR3410_2001_cc OBJ_cryptocom, 1L, 5L, 4L + +#define SN_id_GostR3411_94_with_GostR3410_94_cc \ + "id-GostR3411-94-with-GostR3410-94-cc" +#define LN_id_GostR3411_94_with_GostR3410_94_cc \ + "GOST R 34.11-94 with GOST R 34.10-94 Cryptocom" +#define NID_id_GostR3411_94_with_GostR3410_94_cc 852 +#define OBJ_id_GostR3411_94_with_GostR3410_94_cc OBJ_cryptocom, 1L, 3L, 3L + +#define SN_id_GostR3411_94_with_GostR3410_2001_cc \ + "id-GostR3411-94-with-GostR3410-2001-cc" +#define LN_id_GostR3411_94_with_GostR3410_2001_cc \ + "GOST R 34.11-94 with GOST R 34.10-2001 Cryptocom" +#define NID_id_GostR3411_94_with_GostR3410_2001_cc 853 +#define OBJ_id_GostR3411_94_with_GostR3410_2001_cc OBJ_cryptocom, 1L, 3L, 4L + +#define SN_id_GostR3410_2001_ParamSet_cc "id-GostR3410-2001-ParamSet-cc" +#define LN_id_GostR3410_2001_ParamSet_cc \ + "GOST R 3410-2001 Parameter Set Cryptocom" +#define NID_id_GostR3410_2001_ParamSet_cc 854 +#define OBJ_id_GostR3410_2001_ParamSet_cc OBJ_cryptocom, 1L, 8L, 1L + +#define SN_camellia_128_cbc "CAMELLIA-128-CBC" +#define LN_camellia_128_cbc "camellia-128-cbc" +#define NID_camellia_128_cbc 751 +#define OBJ_camellia_128_cbc 1L, 2L, 392L, 200011L, 61L, 1L, 1L, 1L, 2L + +#define SN_camellia_192_cbc "CAMELLIA-192-CBC" +#define LN_camellia_192_cbc "camellia-192-cbc" +#define NID_camellia_192_cbc 752 +#define OBJ_camellia_192_cbc 1L, 2L, 392L, 200011L, 61L, 1L, 1L, 1L, 3L + +#define SN_camellia_256_cbc "CAMELLIA-256-CBC" +#define LN_camellia_256_cbc "camellia-256-cbc" +#define NID_camellia_256_cbc 753 +#define OBJ_camellia_256_cbc 1L, 2L, 392L, 200011L, 61L, 1L, 1L, 1L, 4L + +#define SN_id_camellia128_wrap "id-camellia128-wrap" +#define NID_id_camellia128_wrap 907 +#define OBJ_id_camellia128_wrap 1L, 2L, 392L, 200011L, 61L, 1L, 1L, 3L, 2L + +#define SN_id_camellia192_wrap "id-camellia192-wrap" +#define NID_id_camellia192_wrap 908 +#define OBJ_id_camellia192_wrap 1L, 2L, 392L, 200011L, 61L, 1L, 1L, 3L, 3L + +#define SN_id_camellia256_wrap "id-camellia256-wrap" +#define NID_id_camellia256_wrap 909 +#define OBJ_id_camellia256_wrap 1L, 2L, 392L, 200011L, 61L, 1L, 1L, 3L, 4L + +#define OBJ_ntt_ds 0L, 3L, 4401L, 5L + +#define OBJ_camellia OBJ_ntt_ds, 3L, 1L, 9L + +#define SN_camellia_128_ecb "CAMELLIA-128-ECB" +#define LN_camellia_128_ecb "camellia-128-ecb" +#define NID_camellia_128_ecb 754 +#define OBJ_camellia_128_ecb OBJ_camellia, 1L + +#define SN_camellia_128_ofb128 "CAMELLIA-128-OFB" +#define LN_camellia_128_ofb128 "camellia-128-ofb" +#define NID_camellia_128_ofb128 766 +#define OBJ_camellia_128_ofb128 OBJ_camellia, 3L + +#define SN_camellia_128_cfb128 "CAMELLIA-128-CFB" +#define LN_camellia_128_cfb128 "camellia-128-cfb" +#define NID_camellia_128_cfb128 757 +#define OBJ_camellia_128_cfb128 OBJ_camellia, 4L + +#define SN_camellia_192_ecb "CAMELLIA-192-ECB" +#define LN_camellia_192_ecb "camellia-192-ecb" +#define NID_camellia_192_ecb 755 +#define OBJ_camellia_192_ecb OBJ_camellia, 21L + +#define SN_camellia_192_ofb128 "CAMELLIA-192-OFB" +#define LN_camellia_192_ofb128 "camellia-192-ofb" +#define NID_camellia_192_ofb128 767 +#define OBJ_camellia_192_ofb128 OBJ_camellia, 23L + +#define SN_camellia_192_cfb128 "CAMELLIA-192-CFB" +#define LN_camellia_192_cfb128 "camellia-192-cfb" +#define NID_camellia_192_cfb128 758 +#define OBJ_camellia_192_cfb128 OBJ_camellia, 24L + +#define SN_camellia_256_ecb "CAMELLIA-256-ECB" +#define LN_camellia_256_ecb "camellia-256-ecb" +#define NID_camellia_256_ecb 756 +#define OBJ_camellia_256_ecb OBJ_camellia, 41L + +#define SN_camellia_256_ofb128 "CAMELLIA-256-OFB" +#define LN_camellia_256_ofb128 "camellia-256-ofb" +#define NID_camellia_256_ofb128 768 +#define OBJ_camellia_256_ofb128 OBJ_camellia, 43L + +#define SN_camellia_256_cfb128 "CAMELLIA-256-CFB" +#define LN_camellia_256_cfb128 "camellia-256-cfb" +#define NID_camellia_256_cfb128 759 +#define OBJ_camellia_256_cfb128 OBJ_camellia, 44L + +#define SN_camellia_128_cfb1 "CAMELLIA-128-CFB1" +#define LN_camellia_128_cfb1 "camellia-128-cfb1" +#define NID_camellia_128_cfb1 760 + +#define SN_camellia_192_cfb1 "CAMELLIA-192-CFB1" +#define LN_camellia_192_cfb1 "camellia-192-cfb1" +#define NID_camellia_192_cfb1 761 + +#define SN_camellia_256_cfb1 "CAMELLIA-256-CFB1" +#define LN_camellia_256_cfb1 "camellia-256-cfb1" +#define NID_camellia_256_cfb1 762 + +#define SN_camellia_128_cfb8 "CAMELLIA-128-CFB8" +#define LN_camellia_128_cfb8 "camellia-128-cfb8" +#define NID_camellia_128_cfb8 763 + +#define SN_camellia_192_cfb8 "CAMELLIA-192-CFB8" +#define LN_camellia_192_cfb8 "camellia-192-cfb8" +#define NID_camellia_192_cfb8 764 + +#define SN_camellia_256_cfb8 "CAMELLIA-256-CFB8" +#define LN_camellia_256_cfb8 "camellia-256-cfb8" +#define NID_camellia_256_cfb8 765 + +#define SN_kisa "KISA" +#define LN_kisa "kisa" +#define NID_kisa 773 +#define OBJ_kisa OBJ_member_body, 410L, 200004L + +#define SN_seed_ecb "SEED-ECB" +#define LN_seed_ecb "seed-ecb" +#define NID_seed_ecb 776 +#define OBJ_seed_ecb OBJ_kisa, 1L, 3L + +#define SN_seed_cbc "SEED-CBC" +#define LN_seed_cbc "seed-cbc" +#define NID_seed_cbc 777 +#define OBJ_seed_cbc OBJ_kisa, 1L, 4L + +#define SN_seed_cfb128 "SEED-CFB" +#define LN_seed_cfb128 "seed-cfb" +#define NID_seed_cfb128 779 +#define OBJ_seed_cfb128 OBJ_kisa, 1L, 5L + +#define SN_seed_ofb128 "SEED-OFB" +#define LN_seed_ofb128 "seed-ofb" +#define NID_seed_ofb128 778 +#define OBJ_seed_ofb128 OBJ_kisa, 1L, 6L + +#define SN_hmac "HMAC" +#define LN_hmac "hmac" +#define NID_hmac 855 + +#define SN_cmac "CMAC" +#define LN_cmac "cmac" +#define NID_cmac 894 + +#define SN_rc4_hmac_md5 "RC4-HMAC-MD5" +#define LN_rc4_hmac_md5 "rc4-hmac-md5" +#define NID_rc4_hmac_md5 915 + +#define SN_aes_128_cbc_hmac_sha1 "AES-128-CBC-HMAC-SHA1" +#define LN_aes_128_cbc_hmac_sha1 "aes-128-cbc-hmac-sha1" +#define NID_aes_128_cbc_hmac_sha1 916 + +#define SN_aes_192_cbc_hmac_sha1 "AES-192-CBC-HMAC-SHA1" +#define LN_aes_192_cbc_hmac_sha1 "aes-192-cbc-hmac-sha1" +#define NID_aes_192_cbc_hmac_sha1 917 + +#define SN_aes_256_cbc_hmac_sha1 "AES-256-CBC-HMAC-SHA1" +#define LN_aes_256_cbc_hmac_sha1 "aes-256-cbc-hmac-sha1" +#define NID_aes_256_cbc_hmac_sha1 918 + +#define SN_aes_128_cbc_hmac_sha256 "AES-128-CBC-HMAC-SHA256" +#define LN_aes_128_cbc_hmac_sha256 "aes-128-cbc-hmac-sha256" +#define NID_aes_128_cbc_hmac_sha256 948 + +#define SN_aes_192_cbc_hmac_sha256 "AES-192-CBC-HMAC-SHA256" +#define LN_aes_192_cbc_hmac_sha256 "aes-192-cbc-hmac-sha256" +#define NID_aes_192_cbc_hmac_sha256 949 + +#define SN_aes_256_cbc_hmac_sha256 "AES-256-CBC-HMAC-SHA256" +#define LN_aes_256_cbc_hmac_sha256 "aes-256-cbc-hmac-sha256" +#define NID_aes_256_cbc_hmac_sha256 950 + +#define SN_dhpublicnumber "dhpublicnumber" +#define LN_dhpublicnumber "X9.42 DH" +#define NID_dhpublicnumber 920 +#define OBJ_dhpublicnumber OBJ_ISO_US, 10046L, 2L, 1L + +#define SN_brainpoolP160r1 "brainpoolP160r1" +#define NID_brainpoolP160r1 921 +#define OBJ_brainpoolP160r1 1L, 3L, 36L, 3L, 3L, 2L, 8L, 1L, 1L, 1L + +#define SN_brainpoolP160t1 "brainpoolP160t1" +#define NID_brainpoolP160t1 922 +#define OBJ_brainpoolP160t1 1L, 3L, 36L, 3L, 3L, 2L, 8L, 1L, 1L, 2L + +#define SN_brainpoolP192r1 "brainpoolP192r1" +#define NID_brainpoolP192r1 923 +#define OBJ_brainpoolP192r1 1L, 3L, 36L, 3L, 3L, 2L, 8L, 1L, 1L, 3L + +#define SN_brainpoolP192t1 "brainpoolP192t1" +#define NID_brainpoolP192t1 924 +#define OBJ_brainpoolP192t1 1L, 3L, 36L, 3L, 3L, 2L, 8L, 1L, 1L, 4L + +#define SN_brainpoolP224r1 "brainpoolP224r1" +#define NID_brainpoolP224r1 925 +#define OBJ_brainpoolP224r1 1L, 3L, 36L, 3L, 3L, 2L, 8L, 1L, 1L, 5L + +#define SN_brainpoolP224t1 "brainpoolP224t1" +#define NID_brainpoolP224t1 926 +#define OBJ_brainpoolP224t1 1L, 3L, 36L, 3L, 3L, 2L, 8L, 1L, 1L, 6L + +#define SN_brainpoolP256r1 "brainpoolP256r1" +#define NID_brainpoolP256r1 927 +#define OBJ_brainpoolP256r1 1L, 3L, 36L, 3L, 3L, 2L, 8L, 1L, 1L, 7L + +#define SN_brainpoolP256t1 "brainpoolP256t1" +#define NID_brainpoolP256t1 928 +#define OBJ_brainpoolP256t1 1L, 3L, 36L, 3L, 3L, 2L, 8L, 1L, 1L, 8L + +#define SN_brainpoolP320r1 "brainpoolP320r1" +#define NID_brainpoolP320r1 929 +#define OBJ_brainpoolP320r1 1L, 3L, 36L, 3L, 3L, 2L, 8L, 1L, 1L, 9L + +#define SN_brainpoolP320t1 "brainpoolP320t1" +#define NID_brainpoolP320t1 930 +#define OBJ_brainpoolP320t1 1L, 3L, 36L, 3L, 3L, 2L, 8L, 1L, 1L, 10L + +#define SN_brainpoolP384r1 "brainpoolP384r1" +#define NID_brainpoolP384r1 931 +#define OBJ_brainpoolP384r1 1L, 3L, 36L, 3L, 3L, 2L, 8L, 1L, 1L, 11L + +#define SN_brainpoolP384t1 "brainpoolP384t1" +#define NID_brainpoolP384t1 932 +#define OBJ_brainpoolP384t1 1L, 3L, 36L, 3L, 3L, 2L, 8L, 1L, 1L, 12L + +#define SN_brainpoolP512r1 "brainpoolP512r1" +#define NID_brainpoolP512r1 933 +#define OBJ_brainpoolP512r1 1L, 3L, 36L, 3L, 3L, 2L, 8L, 1L, 1L, 13L + +#define SN_brainpoolP512t1 "brainpoolP512t1" +#define NID_brainpoolP512t1 934 +#define OBJ_brainpoolP512t1 1L, 3L, 36L, 3L, 3L, 2L, 8L, 1L, 1L, 14L + +#define OBJ_x9_63_scheme 1L, 3L, 133L, 16L, 840L, 63L, 0L + +#define OBJ_secg_scheme OBJ_certicom_arc, 1L + +#define SN_dhSinglePass_stdDH_sha1kdf_scheme "dhSinglePass-stdDH-sha1kdf-scheme" +#define NID_dhSinglePass_stdDH_sha1kdf_scheme 936 +#define OBJ_dhSinglePass_stdDH_sha1kdf_scheme OBJ_x9_63_scheme, 2L + +#define SN_dhSinglePass_stdDH_sha224kdf_scheme \ + "dhSinglePass-stdDH-sha224kdf-scheme" +#define NID_dhSinglePass_stdDH_sha224kdf_scheme 937 +#define OBJ_dhSinglePass_stdDH_sha224kdf_scheme OBJ_secg_scheme, 11L, 0L + +#define SN_dhSinglePass_stdDH_sha256kdf_scheme \ + "dhSinglePass-stdDH-sha256kdf-scheme" +#define NID_dhSinglePass_stdDH_sha256kdf_scheme 938 +#define OBJ_dhSinglePass_stdDH_sha256kdf_scheme OBJ_secg_scheme, 11L, 1L + +#define SN_dhSinglePass_stdDH_sha384kdf_scheme \ + "dhSinglePass-stdDH-sha384kdf-scheme" +#define NID_dhSinglePass_stdDH_sha384kdf_scheme 939 +#define OBJ_dhSinglePass_stdDH_sha384kdf_scheme OBJ_secg_scheme, 11L, 2L + +#define SN_dhSinglePass_stdDH_sha512kdf_scheme \ + "dhSinglePass-stdDH-sha512kdf-scheme" +#define NID_dhSinglePass_stdDH_sha512kdf_scheme 940 +#define OBJ_dhSinglePass_stdDH_sha512kdf_scheme OBJ_secg_scheme, 11L, 3L + +#define SN_dhSinglePass_cofactorDH_sha1kdf_scheme \ + "dhSinglePass-cofactorDH-sha1kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha1kdf_scheme 941 +#define OBJ_dhSinglePass_cofactorDH_sha1kdf_scheme OBJ_x9_63_scheme, 3L + +#define SN_dhSinglePass_cofactorDH_sha224kdf_scheme \ + "dhSinglePass-cofactorDH-sha224kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha224kdf_scheme 942 +#define OBJ_dhSinglePass_cofactorDH_sha224kdf_scheme OBJ_secg_scheme, 14L, 0L + +#define SN_dhSinglePass_cofactorDH_sha256kdf_scheme \ + "dhSinglePass-cofactorDH-sha256kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha256kdf_scheme 943 +#define OBJ_dhSinglePass_cofactorDH_sha256kdf_scheme OBJ_secg_scheme, 14L, 1L + +#define SN_dhSinglePass_cofactorDH_sha384kdf_scheme \ + "dhSinglePass-cofactorDH-sha384kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha384kdf_scheme 944 +#define OBJ_dhSinglePass_cofactorDH_sha384kdf_scheme OBJ_secg_scheme, 14L, 2L + +#define SN_dhSinglePass_cofactorDH_sha512kdf_scheme \ + "dhSinglePass-cofactorDH-sha512kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha512kdf_scheme 945 +#define OBJ_dhSinglePass_cofactorDH_sha512kdf_scheme OBJ_secg_scheme, 14L, 3L + +#define SN_dh_std_kdf "dh-std-kdf" +#define NID_dh_std_kdf 946 + +#define SN_dh_cofactor_kdf "dh-cofactor-kdf" +#define NID_dh_cofactor_kdf 947 + +#define SN_ct_precert_scts "ct_precert_scts" +#define LN_ct_precert_scts "CT Precertificate SCTs" +#define NID_ct_precert_scts 951 +#define OBJ_ct_precert_scts 1L, 3L, 6L, 1L, 4L, 1L, 11129L, 2L, 4L, 2L + +#define SN_ct_precert_poison "ct_precert_poison" +#define LN_ct_precert_poison "CT Precertificate Poison" +#define NID_ct_precert_poison 952 +#define OBJ_ct_precert_poison 1L, 3L, 6L, 1L, 4L, 1L, 11129L, 2L, 4L, 3L + +#define SN_ct_precert_signer "ct_precert_signer" +#define LN_ct_precert_signer "CT Precertificate Signer" +#define NID_ct_precert_signer 953 +#define OBJ_ct_precert_signer 1L, 3L, 6L, 1L, 4L, 1L, 11129L, 2L, 4L, 4L + +#define SN_ct_cert_scts "ct_cert_scts" +#define LN_ct_cert_scts "CT Certificate SCTs" +#define NID_ct_cert_scts 954 +#define OBJ_ct_cert_scts 1L, 3L, 6L, 1L, 4L, 1L, 11129L, 2L, 4L, 5L + +#define SN_jurisdictionLocalityName "jurisdictionL" +#define LN_jurisdictionLocalityName "jurisdictionLocalityName" +#define NID_jurisdictionLocalityName 955 +#define OBJ_jurisdictionLocalityName \ + 1L, 3L, 6L, 1L, 4L, 1L, 311L, 60L, 2L, 1L, 1L + +#define SN_jurisdictionStateOrProvinceName "jurisdictionST" +#define LN_jurisdictionStateOrProvinceName "jurisdictionStateOrProvinceName" +#define NID_jurisdictionStateOrProvinceName 956 +#define OBJ_jurisdictionStateOrProvinceName \ + 1L, 3L, 6L, 1L, 4L, 1L, 311L, 60L, 2L, 1L, 2L + +#define SN_jurisdictionCountryName "jurisdictionC" +#define LN_jurisdictionCountryName "jurisdictionCountryName" +#define NID_jurisdictionCountryName 957 +#define OBJ_jurisdictionCountryName \ + 1L, 3L, 6L, 1L, 4L, 1L, 311L, 60L, 2L, 1L, 3L diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/objects.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/objects.h new file mode 100644 index 0000000..6901224 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/objects.h @@ -0,0 +1,1156 @@ +/* crypto/objects/objects.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_OBJECTS_H +#define HEADER_OBJECTS_H + +#define USE_OBJ_MAC + +#ifdef USE_OBJ_MAC +#include +#else +#define SN_undef "UNDEF" +#define LN_undef "undefined" +#define NID_undef 0 +#define OBJ_undef 0L + +#define SN_Algorithm "Algorithm" +#define LN_algorithm "algorithm" +#define NID_algorithm 38 +#define OBJ_algorithm 1L, 3L, 14L, 3L, 2L + +#define LN_rsadsi "rsadsi" +#define NID_rsadsi 1 +#define OBJ_rsadsi 1L, 2L, 840L, 113549L + +#define LN_pkcs "pkcs" +#define NID_pkcs 2 +#define OBJ_pkcs OBJ_rsadsi, 1L + +#define SN_md2 "MD2" +#define LN_md2 "md2" +#define NID_md2 3 +#define OBJ_md2 OBJ_rsadsi, 2L, 2L + +#define SN_md5 "MD5" +#define LN_md5 "md5" +#define NID_md5 4 +#define OBJ_md5 OBJ_rsadsi, 2L, 5L + +#define SN_rc4 "RC4" +#define LN_rc4 "rc4" +#define NID_rc4 5 +#define OBJ_rc4 OBJ_rsadsi, 3L, 4L + +#define LN_rsaEncryption "rsaEncryption" +#define NID_rsaEncryption 6 +#define OBJ_rsaEncryption OBJ_pkcs, 1L, 1L + +#define SN_md2WithRSAEncryption "RSA-MD2" +#define LN_md2WithRSAEncryption "md2WithRSAEncryption" +#define NID_md2WithRSAEncryption 7 +#define OBJ_md2WithRSAEncryption OBJ_pkcs, 1L, 2L + +#define SN_md5WithRSAEncryption "RSA-MD5" +#define LN_md5WithRSAEncryption "md5WithRSAEncryption" +#define NID_md5WithRSAEncryption 8 +#define OBJ_md5WithRSAEncryption OBJ_pkcs, 1L, 4L + +#define SN_pbeWithMD2AndDES_CBC "PBE-MD2-DES" +#define LN_pbeWithMD2AndDES_CBC "pbeWithMD2AndDES-CBC" +#define NID_pbeWithMD2AndDES_CBC 9 +#define OBJ_pbeWithMD2AndDES_CBC OBJ_pkcs, 5L, 1L + +#define SN_pbeWithMD5AndDES_CBC "PBE-MD5-DES" +#define LN_pbeWithMD5AndDES_CBC "pbeWithMD5AndDES-CBC" +#define NID_pbeWithMD5AndDES_CBC 10 +#define OBJ_pbeWithMD5AndDES_CBC OBJ_pkcs, 5L, 3L + +#define LN_X500 "X500" +#define NID_X500 11 +#define OBJ_X500 2L, 5L + +#define LN_X509 "X509" +#define NID_X509 12 +#define OBJ_X509 OBJ_X500, 4L + +#define SN_commonName "CN" +#define LN_commonName "commonName" +#define NID_commonName 13 +#define OBJ_commonName OBJ_X509, 3L + +#define SN_countryName "C" +#define LN_countryName "countryName" +#define NID_countryName 14 +#define OBJ_countryName OBJ_X509, 6L + +#define SN_localityName "L" +#define LN_localityName "localityName" +#define NID_localityName 15 +#define OBJ_localityName OBJ_X509, 7L + +/* Postal Address? PA */ + +/* should be "ST" (rfc1327) but MS uses 'S' */ +#define SN_stateOrProvinceName "ST" +#define LN_stateOrProvinceName "stateOrProvinceName" +#define NID_stateOrProvinceName 16 +#define OBJ_stateOrProvinceName OBJ_X509, 8L + +#define SN_organizationName "O" +#define LN_organizationName "organizationName" +#define NID_organizationName 17 +#define OBJ_organizationName OBJ_X509, 10L + +#define SN_organizationalUnitName "OU" +#define LN_organizationalUnitName "organizationalUnitName" +#define NID_organizationalUnitName 18 +#define OBJ_organizationalUnitName OBJ_X509, 11L + +#define SN_rsa "RSA" +#define LN_rsa "rsa" +#define NID_rsa 19 +#define OBJ_rsa OBJ_X500, 8L, 1L, 1L + +#define LN_pkcs7 "pkcs7" +#define NID_pkcs7 20 +#define OBJ_pkcs7 OBJ_pkcs, 7L + +#define LN_pkcs7_data "pkcs7-data" +#define NID_pkcs7_data 21 +#define OBJ_pkcs7_data OBJ_pkcs7, 1L + +#define LN_pkcs7_signed "pkcs7-signedData" +#define NID_pkcs7_signed 22 +#define OBJ_pkcs7_signed OBJ_pkcs7, 2L + +#define LN_pkcs7_enveloped "pkcs7-envelopedData" +#define NID_pkcs7_enveloped 23 +#define OBJ_pkcs7_enveloped OBJ_pkcs7, 3L + +#define LN_pkcs7_signedAndEnveloped "pkcs7-signedAndEnvelopedData" +#define NID_pkcs7_signedAndEnveloped 24 +#define OBJ_pkcs7_signedAndEnveloped OBJ_pkcs7, 4L + +#define LN_pkcs7_digest "pkcs7-digestData" +#define NID_pkcs7_digest 25 +#define OBJ_pkcs7_digest OBJ_pkcs7, 5L + +#define LN_pkcs7_encrypted "pkcs7-encryptedData" +#define NID_pkcs7_encrypted 26 +#define OBJ_pkcs7_encrypted OBJ_pkcs7, 6L + +#define LN_pkcs3 "pkcs3" +#define NID_pkcs3 27 +#define OBJ_pkcs3 OBJ_pkcs, 3L + +#define LN_dhKeyAgreement "dhKeyAgreement" +#define NID_dhKeyAgreement 28 +#define OBJ_dhKeyAgreement OBJ_pkcs3, 1L + +#define SN_des_ecb "DES-ECB" +#define LN_des_ecb "des-ecb" +#define NID_des_ecb 29 +#define OBJ_des_ecb OBJ_algorithm, 6L + +#define SN_des_cfb64 "DES-CFB" +#define LN_des_cfb64 "des-cfb" +#define NID_des_cfb64 30 +/* IV + num */ +#define OBJ_des_cfb64 OBJ_algorithm, 9L + +#define SN_des_cbc "DES-CBC" +#define LN_des_cbc "des-cbc" +#define NID_des_cbc 31 +/* IV */ +#define OBJ_des_cbc OBJ_algorithm, 7L + +#define SN_des_ede "DES-EDE" +#define LN_des_ede "des-ede" +#define NID_des_ede 32 +/* ?? */ +#define OBJ_des_ede OBJ_algorithm, 17L + +#define SN_des_ede3 "DES-EDE3" +#define LN_des_ede3 "des-ede3" +#define NID_des_ede3 33 + +#define SN_idea_cbc "IDEA-CBC" +#define LN_idea_cbc "idea-cbc" +#define NID_idea_cbc 34 +#define OBJ_idea_cbc 1L, 3L, 6L, 1L, 4L, 1L, 188L, 7L, 1L, 1L, 2L + +#define SN_idea_cfb64 "IDEA-CFB" +#define LN_idea_cfb64 "idea-cfb" +#define NID_idea_cfb64 35 + +#define SN_idea_ecb "IDEA-ECB" +#define LN_idea_ecb "idea-ecb" +#define NID_idea_ecb 36 + +#define SN_rc2_cbc "RC2-CBC" +#define LN_rc2_cbc "rc2-cbc" +#define NID_rc2_cbc 37 +#define OBJ_rc2_cbc OBJ_rsadsi, 3L, 2L + +#define SN_rc2_ecb "RC2-ECB" +#define LN_rc2_ecb "rc2-ecb" +#define NID_rc2_ecb 38 + +#define SN_rc2_cfb64 "RC2-CFB" +#define LN_rc2_cfb64 "rc2-cfb" +#define NID_rc2_cfb64 39 + +#define SN_rc2_ofb64 "RC2-OFB" +#define LN_rc2_ofb64 "rc2-ofb" +#define NID_rc2_ofb64 40 + +#define SN_sha "SHA" +#define LN_sha "sha" +#define NID_sha 41 +#define OBJ_sha OBJ_algorithm, 18L + +#define SN_shaWithRSAEncryption "RSA-SHA" +#define LN_shaWithRSAEncryption "shaWithRSAEncryption" +#define NID_shaWithRSAEncryption 42 +#define OBJ_shaWithRSAEncryption OBJ_algorithm, 15L + +#define SN_des_ede_cbc "DES-EDE-CBC" +#define LN_des_ede_cbc "des-ede-cbc" +#define NID_des_ede_cbc 43 + +#define SN_des_ede3_cbc "DES-EDE3-CBC" +#define LN_des_ede3_cbc "des-ede3-cbc" +#define NID_des_ede3_cbc 44 +#define OBJ_des_ede3_cbc OBJ_rsadsi, 3L, 7L + +#define SN_des_ofb64 "DES-OFB" +#define LN_des_ofb64 "des-ofb" +#define NID_des_ofb64 45 +#define OBJ_des_ofb64 OBJ_algorithm, 8L + +#define SN_idea_ofb64 "IDEA-OFB" +#define LN_idea_ofb64 "idea-ofb" +#define NID_idea_ofb64 46 + +#define LN_pkcs9 "pkcs9" +#define NID_pkcs9 47 +#define OBJ_pkcs9 OBJ_pkcs, 9L + +#define SN_pkcs9_emailAddress "Email" +#define LN_pkcs9_emailAddress "emailAddress" +#define NID_pkcs9_emailAddress 48 +#define OBJ_pkcs9_emailAddress OBJ_pkcs9, 1L + +#define LN_pkcs9_unstructuredName "unstructuredName" +#define NID_pkcs9_unstructuredName 49 +#define OBJ_pkcs9_unstructuredName OBJ_pkcs9, 2L + +#define LN_pkcs9_contentType "contentType" +#define NID_pkcs9_contentType 50 +#define OBJ_pkcs9_contentType OBJ_pkcs9, 3L + +#define LN_pkcs9_messageDigest "messageDigest" +#define NID_pkcs9_messageDigest 51 +#define OBJ_pkcs9_messageDigest OBJ_pkcs9, 4L + +#define LN_pkcs9_signingTime "signingTime" +#define NID_pkcs9_signingTime 52 +#define OBJ_pkcs9_signingTime OBJ_pkcs9, 5L + +#define LN_pkcs9_countersignature "countersignature" +#define NID_pkcs9_countersignature 53 +#define OBJ_pkcs9_countersignature OBJ_pkcs9, 6L + +#define LN_pkcs9_challengePassword "challengePassword" +#define NID_pkcs9_challengePassword 54 +#define OBJ_pkcs9_challengePassword OBJ_pkcs9, 7L + +#define LN_pkcs9_unstructuredAddress "unstructuredAddress" +#define NID_pkcs9_unstructuredAddress 55 +#define OBJ_pkcs9_unstructuredAddress OBJ_pkcs9, 8L + +#define LN_pkcs9_extCertAttributes "extendedCertificateAttributes" +#define NID_pkcs9_extCertAttributes 56 +#define OBJ_pkcs9_extCertAttributes OBJ_pkcs9, 9L + +#define SN_netscape "Netscape" +#define LN_netscape "Netscape Communications Corp." +#define NID_netscape 57 +#define OBJ_netscape 2L, 16L, 840L, 1L, 113730L + +#define SN_netscape_cert_extension "nsCertExt" +#define LN_netscape_cert_extension "Netscape Certificate Extension" +#define NID_netscape_cert_extension 58 +#define OBJ_netscape_cert_extension OBJ_netscape, 1L + +#define SN_netscape_data_type "nsDataType" +#define LN_netscape_data_type "Netscape Data Type" +#define NID_netscape_data_type 59 +#define OBJ_netscape_data_type OBJ_netscape, 2L + +#define SN_des_ede_cfb64 "DES-EDE-CFB" +#define LN_des_ede_cfb64 "des-ede-cfb" +#define NID_des_ede_cfb64 60 + +#define SN_des_ede3_cfb64 "DES-EDE3-CFB" +#define LN_des_ede3_cfb64 "des-ede3-cfb" +#define NID_des_ede3_cfb64 61 + +#define SN_des_ede_ofb64 "DES-EDE-OFB" +#define LN_des_ede_ofb64 "des-ede-ofb" +#define NID_des_ede_ofb64 62 + +#define SN_des_ede3_ofb64 "DES-EDE3-OFB" +#define LN_des_ede3_ofb64 "des-ede3-ofb" +#define NID_des_ede3_ofb64 63 + +/* I'm not sure about the object ID */ +#define SN_sha1 "SHA1" +#define LN_sha1 "sha1" +#define NID_sha1 64 +#define OBJ_sha1 OBJ_algorithm, 26L +/* 28 Jun 1996 - eay */ +/* #define OBJ_sha1 1L,3L,14L,2L,26L,05L <- wrong */ + +#define SN_sha1WithRSAEncryption "RSA-SHA1" +#define LN_sha1WithRSAEncryption "sha1WithRSAEncryption" +#define NID_sha1WithRSAEncryption 65 +#define OBJ_sha1WithRSAEncryption OBJ_pkcs, 1L, 5L + +#define SN_dsaWithSHA "DSA-SHA" +#define LN_dsaWithSHA "dsaWithSHA" +#define NID_dsaWithSHA 66 +#define OBJ_dsaWithSHA OBJ_algorithm, 13L + +#define SN_dsa_2 "DSA-old" +#define LN_dsa_2 "dsaEncryption-old" +#define NID_dsa_2 67 +#define OBJ_dsa_2 OBJ_algorithm, 12L + +/* proposed by microsoft to RSA */ +#define SN_pbeWithSHA1AndRC2_CBC "PBE-SHA1-RC2-64" +#define LN_pbeWithSHA1AndRC2_CBC "pbeWithSHA1AndRC2-CBC" +#define NID_pbeWithSHA1AndRC2_CBC 68 +#define OBJ_pbeWithSHA1AndRC2_CBC OBJ_pkcs, 5L, 11L + +/* + * proposed by microsoft to RSA as pbeWithSHA1AndRC4: it is now defined + * explicitly in PKCS#5 v2.0 as id-PBKDF2 which is something completely + * different. + */ +#define LN_id_pbkdf2 "PBKDF2" +#define NID_id_pbkdf2 69 +#define OBJ_id_pbkdf2 OBJ_pkcs, 5L, 12L + +#define SN_dsaWithSHA1_2 "DSA-SHA1-old" +#define LN_dsaWithSHA1_2 "dsaWithSHA1-old" +#define NID_dsaWithSHA1_2 70 +/* Got this one from 'sdn706r20.pdf' which is actually an NSA document :-) */ +#define OBJ_dsaWithSHA1_2 OBJ_algorithm, 27L + +#define SN_netscape_cert_type "nsCertType" +#define LN_netscape_cert_type "Netscape Cert Type" +#define NID_netscape_cert_type 71 +#define OBJ_netscape_cert_type OBJ_netscape_cert_extension, 1L + +#define SN_netscape_base_url "nsBaseUrl" +#define LN_netscape_base_url "Netscape Base Url" +#define NID_netscape_base_url 72 +#define OBJ_netscape_base_url OBJ_netscape_cert_extension, 2L + +#define SN_netscape_revocation_url "nsRevocationUrl" +#define LN_netscape_revocation_url "Netscape Revocation Url" +#define NID_netscape_revocation_url 73 +#define OBJ_netscape_revocation_url OBJ_netscape_cert_extension, 3L + +#define SN_netscape_ca_revocation_url "nsCaRevocationUrl" +#define LN_netscape_ca_revocation_url "Netscape CA Revocation Url" +#define NID_netscape_ca_revocation_url 74 +#define OBJ_netscape_ca_revocation_url OBJ_netscape_cert_extension, 4L + +#define SN_netscape_renewal_url "nsRenewalUrl" +#define LN_netscape_renewal_url "Netscape Renewal Url" +#define NID_netscape_renewal_url 75 +#define OBJ_netscape_renewal_url OBJ_netscape_cert_extension, 7L + +#define SN_netscape_ca_policy_url "nsCaPolicyUrl" +#define LN_netscape_ca_policy_url "Netscape CA Policy Url" +#define NID_netscape_ca_policy_url 76 +#define OBJ_netscape_ca_policy_url OBJ_netscape_cert_extension, 8L + +#define SN_netscape_ssl_server_name "nsSslServerName" +#define LN_netscape_ssl_server_name "Netscape SSL Server Name" +#define NID_netscape_ssl_server_name 77 +#define OBJ_netscape_ssl_server_name OBJ_netscape_cert_extension, 12L + +#define SN_netscape_comment "nsComment" +#define LN_netscape_comment "Netscape Comment" +#define NID_netscape_comment 78 +#define OBJ_netscape_comment OBJ_netscape_cert_extension, 13L + +#define SN_netscape_cert_sequence "nsCertSequence" +#define LN_netscape_cert_sequence "Netscape Certificate Sequence" +#define NID_netscape_cert_sequence 79 +#define OBJ_netscape_cert_sequence OBJ_netscape_data_type, 5L + +#define SN_desx_cbc "DESX-CBC" +#define LN_desx_cbc "desx-cbc" +#define NID_desx_cbc 80 + +#define SN_id_ce "id-ce" +#define NID_id_ce 81 +#define OBJ_id_ce 2L, 5L, 29L + +#define SN_subject_key_identifier "subjectKeyIdentifier" +#define LN_subject_key_identifier "X509v3 Subject Key Identifier" +#define NID_subject_key_identifier 82 +#define OBJ_subject_key_identifier OBJ_id_ce, 14L + +#define SN_key_usage "keyUsage" +#define LN_key_usage "X509v3 Key Usage" +#define NID_key_usage 83 +#define OBJ_key_usage OBJ_id_ce, 15L + +#define SN_private_key_usage_period "privateKeyUsagePeriod" +#define LN_private_key_usage_period "X509v3 Private Key Usage Period" +#define NID_private_key_usage_period 84 +#define OBJ_private_key_usage_period OBJ_id_ce, 16L + +#define SN_subject_alt_name "subjectAltName" +#define LN_subject_alt_name "X509v3 Subject Alternative Name" +#define NID_subject_alt_name 85 +#define OBJ_subject_alt_name OBJ_id_ce, 17L + +#define SN_issuer_alt_name "issuerAltName" +#define LN_issuer_alt_name "X509v3 Issuer Alternative Name" +#define NID_issuer_alt_name 86 +#define OBJ_issuer_alt_name OBJ_id_ce, 18L + +#define SN_basic_constraints "basicConstraints" +#define LN_basic_constraints "X509v3 Basic Constraints" +#define NID_basic_constraints 87 +#define OBJ_basic_constraints OBJ_id_ce, 19L + +#define SN_crl_number "crlNumber" +#define LN_crl_number "X509v3 CRL Number" +#define NID_crl_number 88 +#define OBJ_crl_number OBJ_id_ce, 20L + +#define SN_certificate_policies "certificatePolicies" +#define LN_certificate_policies "X509v3 Certificate Policies" +#define NID_certificate_policies 89 +#define OBJ_certificate_policies OBJ_id_ce, 32L + +#define SN_authority_key_identifier "authorityKeyIdentifier" +#define LN_authority_key_identifier "X509v3 Authority Key Identifier" +#define NID_authority_key_identifier 90 +#define OBJ_authority_key_identifier OBJ_id_ce, 35L + +#define SN_bf_cbc "BF-CBC" +#define LN_bf_cbc "bf-cbc" +#define NID_bf_cbc 91 +#define OBJ_bf_cbc 1L, 3L, 6L, 1L, 4L, 1L, 3029L, 1L, 2L + +#define SN_bf_ecb "BF-ECB" +#define LN_bf_ecb "bf-ecb" +#define NID_bf_ecb 92 + +#define SN_bf_cfb64 "BF-CFB" +#define LN_bf_cfb64 "bf-cfb" +#define NID_bf_cfb64 93 + +#define SN_bf_ofb64 "BF-OFB" +#define LN_bf_ofb64 "bf-ofb" +#define NID_bf_ofb64 94 + +#define SN_mdc2 "MDC2" +#define LN_mdc2 "mdc2" +#define NID_mdc2 95 +#define OBJ_mdc2 2L, 5L, 8L, 3L, 101L +/* An alternative? 1L,3L,14L,3L,2L,19L */ + +#define SN_mdc2WithRSA "RSA-MDC2" +#define LN_mdc2WithRSA "mdc2withRSA" +#define NID_mdc2WithRSA 96 +#define OBJ_mdc2WithRSA 2L, 5L, 8L, 3L, 100L + +#define SN_rc4_40 "RC4-40" +#define LN_rc4_40 "rc4-40" +#define NID_rc4_40 97 + +#define SN_rc2_40_cbc "RC2-40-CBC" +#define LN_rc2_40_cbc "rc2-40-cbc" +#define NID_rc2_40_cbc 98 + +#define SN_givenName "G" +#define LN_givenName "givenName" +#define NID_givenName 99 +#define OBJ_givenName OBJ_X509, 42L + +#define SN_surname "S" +#define LN_surname "surname" +#define NID_surname 100 +#define OBJ_surname OBJ_X509, 4L + +#define SN_initials "I" +#define LN_initials "initials" +#define NID_initials 101 +#define OBJ_initials OBJ_X509, 43L + +#define SN_uniqueIdentifier "UID" +#define LN_uniqueIdentifier "uniqueIdentifier" +#define NID_uniqueIdentifier 102 +#define OBJ_uniqueIdentifier OBJ_X509, 45L + +#define SN_crl_distribution_points "crlDistributionPoints" +#define LN_crl_distribution_points "X509v3 CRL Distribution Points" +#define NID_crl_distribution_points 103 +#define OBJ_crl_distribution_points OBJ_id_ce, 31L + +#define SN_md5WithRSA "RSA-NP-MD5" +#define LN_md5WithRSA "md5WithRSA" +#define NID_md5WithRSA 104 +#define OBJ_md5WithRSA OBJ_algorithm, 3L + +#define SN_serialNumber "SN" +#define LN_serialNumber "serialNumber" +#define NID_serialNumber 105 +#define OBJ_serialNumber OBJ_X509, 5L + +#define SN_title "T" +#define LN_title "title" +#define NID_title 106 +#define OBJ_title OBJ_X509, 12L + +#define SN_description "D" +#define LN_description "description" +#define NID_description 107 +#define OBJ_description OBJ_X509, 13L + +/* CAST5 is CAST-128, I'm just sticking with the documentation */ +#define SN_cast5_cbc "CAST5-CBC" +#define LN_cast5_cbc "cast5-cbc" +#define NID_cast5_cbc 108 +#define OBJ_cast5_cbc 1L, 2L, 840L, 113533L, 7L, 66L, 10L + +#define SN_cast5_ecb "CAST5-ECB" +#define LN_cast5_ecb "cast5-ecb" +#define NID_cast5_ecb 109 + +#define SN_cast5_cfb64 "CAST5-CFB" +#define LN_cast5_cfb64 "cast5-cfb" +#define NID_cast5_cfb64 110 + +#define SN_cast5_ofb64 "CAST5-OFB" +#define LN_cast5_ofb64 "cast5-ofb" +#define NID_cast5_ofb64 111 + +#define LN_pbeWithMD5AndCast5_CBC "pbeWithMD5AndCast5CBC" +#define NID_pbeWithMD5AndCast5_CBC 112 +#define OBJ_pbeWithMD5AndCast5_CBC 1L, 2L, 840L, 113533L, 7L, 66L, 12L + +/*- + * This is one sun will soon be using :-( + * id-dsa-with-sha1 ID ::= { + * iso(1) member-body(2) us(840) x9-57 (10040) x9cm(4) 3 } + */ +#define SN_dsaWithSHA1 "DSA-SHA1" +#define LN_dsaWithSHA1 "dsaWithSHA1" +#define NID_dsaWithSHA1 113 +#define OBJ_dsaWithSHA1 1L, 2L, 840L, 10040L, 4L, 3L + +#define NID_md5_sha1 114 +#define SN_md5_sha1 "MD5-SHA1" +#define LN_md5_sha1 "md5-sha1" + +#define SN_sha1WithRSA "RSA-SHA1-2" +#define LN_sha1WithRSA "sha1WithRSA" +#define NID_sha1WithRSA 115 +#define OBJ_sha1WithRSA OBJ_algorithm, 29L + +#define SN_dsa "DSA" +#define LN_dsa "dsaEncryption" +#define NID_dsa 116 +#define OBJ_dsa 1L, 2L, 840L, 10040L, 4L, 1L + +#define SN_ripemd160 "RIPEMD160" +#define LN_ripemd160 "ripemd160" +#define NID_ripemd160 117 +#define OBJ_ripemd160 1L, 3L, 36L, 3L, 2L, 1L + +/* + * The name should actually be rsaSignatureWithripemd160, but I'm going to + * continue using the convention I'm using with the other ciphers + */ +#define SN_ripemd160WithRSA "RSA-RIPEMD160" +#define LN_ripemd160WithRSA "ripemd160WithRSA" +#define NID_ripemd160WithRSA 119 +#define OBJ_ripemd160WithRSA 1L, 3L, 36L, 3L, 3L, 1L, 2L + +/*- + * Taken from rfc2040 + * RC5_CBC_Parameters ::= SEQUENCE { + * version INTEGER (v1_0(16)), + * rounds INTEGER (8..127), + * blockSizeInBits INTEGER (64, 128), + * iv OCTET STRING OPTIONAL + * } + */ +#define SN_rc5_cbc "RC5-CBC" +#define LN_rc5_cbc "rc5-cbc" +#define NID_rc5_cbc 120 +#define OBJ_rc5_cbc OBJ_rsadsi, 3L, 8L + +#define SN_rc5_ecb "RC5-ECB" +#define LN_rc5_ecb "rc5-ecb" +#define NID_rc5_ecb 121 + +#define SN_rc5_cfb64 "RC5-CFB" +#define LN_rc5_cfb64 "rc5-cfb" +#define NID_rc5_cfb64 122 + +#define SN_rc5_ofb64 "RC5-OFB" +#define LN_rc5_ofb64 "rc5-ofb" +#define NID_rc5_ofb64 123 + +#define SN_rle_compression "RLE" +#define LN_rle_compression "run length compression" +#define NID_rle_compression 124 +#define OBJ_rle_compression 1L, 1L, 1L, 1L, 666L, 1L + +#define SN_zlib_compression "ZLIB" +#define LN_zlib_compression "zlib compression" +#define NID_zlib_compression 125 +#define OBJ_zlib_compression 1L, 1L, 1L, 1L, 666L, 2L + +#define SN_ext_key_usage "extendedKeyUsage" +#define LN_ext_key_usage "X509v3 Extended Key Usage" +#define NID_ext_key_usage 126 +#define OBJ_ext_key_usage OBJ_id_ce, 37 + +#define SN_id_pkix "PKIX" +#define NID_id_pkix 127 +#define OBJ_id_pkix 1L, 3L, 6L, 1L, 5L, 5L, 7L + +#define SN_id_kp "id-kp" +#define NID_id_kp 128 +#define OBJ_id_kp OBJ_id_pkix, 3L + +/* PKIX extended key usage OIDs */ + +#define SN_server_auth "serverAuth" +#define LN_server_auth "TLS Web Server Authentication" +#define NID_server_auth 129 +#define OBJ_server_auth OBJ_id_kp, 1L + +#define SN_client_auth "clientAuth" +#define LN_client_auth "TLS Web Client Authentication" +#define NID_client_auth 130 +#define OBJ_client_auth OBJ_id_kp, 2L + +#define SN_code_sign "codeSigning" +#define LN_code_sign "Code Signing" +#define NID_code_sign 131 +#define OBJ_code_sign OBJ_id_kp, 3L + +#define SN_email_protect "emailProtection" +#define LN_email_protect "E-mail Protection" +#define NID_email_protect 132 +#define OBJ_email_protect OBJ_id_kp, 4L + +#define SN_time_stamp "timeStamping" +#define LN_time_stamp "Time Stamping" +#define NID_time_stamp 133 +#define OBJ_time_stamp OBJ_id_kp, 8L + +/* Additional extended key usage OIDs: Microsoft */ + +#define SN_ms_code_ind "msCodeInd" +#define LN_ms_code_ind "Microsoft Individual Code Signing" +#define NID_ms_code_ind 134 +#define OBJ_ms_code_ind 1L, 3L, 6L, 1L, 4L, 1L, 311L, 2L, 1L, 21L + +#define SN_ms_code_com "msCodeCom" +#define LN_ms_code_com "Microsoft Commercial Code Signing" +#define NID_ms_code_com 135 +#define OBJ_ms_code_com 1L, 3L, 6L, 1L, 4L, 1L, 311L, 2L, 1L, 22L + +#define SN_ms_ctl_sign "msCTLSign" +#define LN_ms_ctl_sign "Microsoft Trust List Signing" +#define NID_ms_ctl_sign 136 +#define OBJ_ms_ctl_sign 1L, 3L, 6L, 1L, 4L, 1L, 311L, 10L, 3L, 1L + +#define SN_ms_sgc "msSGC" +#define LN_ms_sgc "Microsoft Server Gated Crypto" +#define NID_ms_sgc 137 +#define OBJ_ms_sgc 1L, 3L, 6L, 1L, 4L, 1L, 311L, 10L, 3L, 3L + +#define SN_ms_efs "msEFS" +#define LN_ms_efs "Microsoft Encrypted File System" +#define NID_ms_efs 138 +#define OBJ_ms_efs 1L, 3L, 6L, 1L, 4L, 1L, 311L, 10L, 3L, 4L + +/* Additional usage: Netscape */ + +#define SN_ns_sgc "nsSGC" +#define LN_ns_sgc "Netscape Server Gated Crypto" +#define NID_ns_sgc 139 +#define OBJ_ns_sgc OBJ_netscape, 4L, 1L + +#define SN_delta_crl "deltaCRL" +#define LN_delta_crl "X509v3 Delta CRL Indicator" +#define NID_delta_crl 140 +#define OBJ_delta_crl OBJ_id_ce, 27L + +#define SN_crl_reason "CRLReason" +#define LN_crl_reason "CRL Reason Code" +#define NID_crl_reason 141 +#define OBJ_crl_reason OBJ_id_ce, 21L + +#define SN_invalidity_date "invalidityDate" +#define LN_invalidity_date "Invalidity Date" +#define NID_invalidity_date 142 +#define OBJ_invalidity_date OBJ_id_ce, 24L + +#define SN_sxnet "SXNetID" +#define LN_sxnet "Strong Extranet ID" +#define NID_sxnet 143 +#define OBJ_sxnet 1L, 3L, 101L, 1L, 4L, 1L + +/* PKCS12 and related OBJECT IDENTIFIERS */ + +#define OBJ_pkcs12 OBJ_pkcs, 12L +#define OBJ_pkcs12_pbeids OBJ_pkcs12, 1 + +#define SN_pbe_WithSHA1And128BitRC4 "PBE-SHA1-RC4-128" +#define LN_pbe_WithSHA1And128BitRC4 "pbeWithSHA1And128BitRC4" +#define NID_pbe_WithSHA1And128BitRC4 144 +#define OBJ_pbe_WithSHA1And128BitRC4 OBJ_pkcs12_pbeids, 1L + +#define SN_pbe_WithSHA1And40BitRC4 "PBE-SHA1-RC4-40" +#define LN_pbe_WithSHA1And40BitRC4 "pbeWithSHA1And40BitRC4" +#define NID_pbe_WithSHA1And40BitRC4 145 +#define OBJ_pbe_WithSHA1And40BitRC4 OBJ_pkcs12_pbeids, 2L + +#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC "PBE-SHA1-3DES" +#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC "pbeWithSHA1And3-KeyTripleDES-CBC" +#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC 146 +#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC OBJ_pkcs12_pbeids, 3L + +#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC "PBE-SHA1-2DES" +#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC "pbeWithSHA1And2-KeyTripleDES-CBC" +#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC 147 +#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC OBJ_pkcs12_pbeids, 4L + +#define SN_pbe_WithSHA1And128BitRC2_CBC "PBE-SHA1-RC2-128" +#define LN_pbe_WithSHA1And128BitRC2_CBC "pbeWithSHA1And128BitRC2-CBC" +#define NID_pbe_WithSHA1And128BitRC2_CBC 148 +#define OBJ_pbe_WithSHA1And128BitRC2_CBC OBJ_pkcs12_pbeids, 5L + +#define SN_pbe_WithSHA1And40BitRC2_CBC "PBE-SHA1-RC2-40" +#define LN_pbe_WithSHA1And40BitRC2_CBC "pbeWithSHA1And40BitRC2-CBC" +#define NID_pbe_WithSHA1And40BitRC2_CBC 149 +#define OBJ_pbe_WithSHA1And40BitRC2_CBC OBJ_pkcs12_pbeids, 6L + +#define OBJ_pkcs12_Version1 OBJ_pkcs12, 10L + +#define OBJ_pkcs12_BagIds OBJ_pkcs12_Version1, 1L + +#define LN_keyBag "keyBag" +#define NID_keyBag 150 +#define OBJ_keyBag OBJ_pkcs12_BagIds, 1L + +#define LN_pkcs8ShroudedKeyBag "pkcs8ShroudedKeyBag" +#define NID_pkcs8ShroudedKeyBag 151 +#define OBJ_pkcs8ShroudedKeyBag OBJ_pkcs12_BagIds, 2L + +#define LN_certBag "certBag" +#define NID_certBag 152 +#define OBJ_certBag OBJ_pkcs12_BagIds, 3L + +#define LN_crlBag "crlBag" +#define NID_crlBag 153 +#define OBJ_crlBag OBJ_pkcs12_BagIds, 4L + +#define LN_secretBag "secretBag" +#define NID_secretBag 154 +#define OBJ_secretBag OBJ_pkcs12_BagIds, 5L + +#define LN_safeContentsBag "safeContentsBag" +#define NID_safeContentsBag 155 +#define OBJ_safeContentsBag OBJ_pkcs12_BagIds, 6L + +#define LN_friendlyName "friendlyName" +#define NID_friendlyName 156 +#define OBJ_friendlyName OBJ_pkcs9, 20L + +#define LN_localKeyID "localKeyID" +#define NID_localKeyID 157 +#define OBJ_localKeyID OBJ_pkcs9, 21L + +#define OBJ_certTypes OBJ_pkcs9, 22L + +#define LN_x509Certificate "x509Certificate" +#define NID_x509Certificate 158 +#define OBJ_x509Certificate OBJ_certTypes, 1L + +#define LN_sdsiCertificate "sdsiCertificate" +#define NID_sdsiCertificate 159 +#define OBJ_sdsiCertificate OBJ_certTypes, 2L + +#define OBJ_crlTypes OBJ_pkcs9, 23L + +#define LN_x509Crl "x509Crl" +#define NID_x509Crl 160 +#define OBJ_x509Crl OBJ_crlTypes, 1L + +/* PKCS#5 v2 OIDs */ + +#define LN_pbes2 "PBES2" +#define NID_pbes2 161 +#define OBJ_pbes2 OBJ_pkcs, 5L, 13L + +#define LN_pbmac1 "PBMAC1" +#define NID_pbmac1 162 +#define OBJ_pbmac1 OBJ_pkcs, 5L, 14L + +#define LN_hmacWithSHA1 "hmacWithSHA1" +#define NID_hmacWithSHA1 163 +#define OBJ_hmacWithSHA1 OBJ_rsadsi, 2L, 7L + +/* Policy Qualifier Ids */ + +#define LN_id_qt_cps "Policy Qualifier CPS" +#define SN_id_qt_cps "id-qt-cps" +#define NID_id_qt_cps 164 +#define OBJ_id_qt_cps OBJ_id_pkix, 2L, 1L + +#define LN_id_qt_unotice "Policy Qualifier User Notice" +#define SN_id_qt_unotice "id-qt-unotice" +#define NID_id_qt_unotice 165 +#define OBJ_id_qt_unotice OBJ_id_pkix, 2L, 2L + +#define SN_rc2_64_cbc "RC2-64-CBC" +#define LN_rc2_64_cbc "rc2-64-cbc" +#define NID_rc2_64_cbc 166 + +#define SN_SMIMECapabilities "SMIME-CAPS" +#define LN_SMIMECapabilities "S/MIME Capabilities" +#define NID_SMIMECapabilities 167 +#define OBJ_SMIMECapabilities OBJ_pkcs9, 15L + +#define SN_pbeWithMD2AndRC2_CBC "PBE-MD2-RC2-64" +#define LN_pbeWithMD2AndRC2_CBC "pbeWithMD2AndRC2-CBC" +#define NID_pbeWithMD2AndRC2_CBC 168 +#define OBJ_pbeWithMD2AndRC2_CBC OBJ_pkcs, 5L, 4L + +#define SN_pbeWithMD5AndRC2_CBC "PBE-MD5-RC2-64" +#define LN_pbeWithMD5AndRC2_CBC "pbeWithMD5AndRC2-CBC" +#define NID_pbeWithMD5AndRC2_CBC 169 +#define OBJ_pbeWithMD5AndRC2_CBC OBJ_pkcs, 5L, 6L + +#define SN_pbeWithSHA1AndDES_CBC "PBE-SHA1-DES" +#define LN_pbeWithSHA1AndDES_CBC "pbeWithSHA1AndDES-CBC" +#define NID_pbeWithSHA1AndDES_CBC 170 +#define OBJ_pbeWithSHA1AndDES_CBC OBJ_pkcs, 5L, 10L + +/* Extension request OIDs */ + +#define LN_ms_ext_req "Microsoft Extension Request" +#define SN_ms_ext_req "msExtReq" +#define NID_ms_ext_req 171 +#define OBJ_ms_ext_req 1L, 3L, 6L, 1L, 4L, 1L, 311L, 2L, 1L, 14L + +#define LN_ext_req "Extension Request" +#define SN_ext_req "extReq" +#define NID_ext_req 172 +#define OBJ_ext_req OBJ_pkcs9, 14L + +#define SN_name "name" +#define LN_name "name" +#define NID_name 173 +#define OBJ_name OBJ_X509, 41L + +#define SN_dnQualifier "dnQualifier" +#define LN_dnQualifier "dnQualifier" +#define NID_dnQualifier 174 +#define OBJ_dnQualifier OBJ_X509, 46L + +#define SN_id_pe "id-pe" +#define NID_id_pe 175 +#define OBJ_id_pe OBJ_id_pkix, 1L + +#define SN_id_ad "id-ad" +#define NID_id_ad 176 +#define OBJ_id_ad OBJ_id_pkix, 48L + +#define SN_info_access "authorityInfoAccess" +#define LN_info_access "Authority Information Access" +#define NID_info_access 177 +#define OBJ_info_access OBJ_id_pe, 1L + +#define SN_ad_OCSP "OCSP" +#define LN_ad_OCSP "OCSP" +#define NID_ad_OCSP 178 +#define OBJ_ad_OCSP OBJ_id_ad, 1L + +#define SN_ad_ca_issuers "caIssuers" +#define LN_ad_ca_issuers "CA Issuers" +#define NID_ad_ca_issuers 179 +#define OBJ_ad_ca_issuers OBJ_id_ad, 2L + +#define SN_OCSP_sign "OCSPSigning" +#define LN_OCSP_sign "OCSP Signing" +#define NID_OCSP_sign 180 +#define OBJ_OCSP_sign OBJ_id_kp, 9L +#endif /* USE_OBJ_MAC */ + +#include +#include + +#define OBJ_NAME_TYPE_UNDEF 0x00 +#define OBJ_NAME_TYPE_MD_METH 0x01 +#define OBJ_NAME_TYPE_CIPHER_METH 0x02 +#define OBJ_NAME_TYPE_PKEY_METH 0x03 +#define OBJ_NAME_TYPE_COMP_METH 0x04 +#define OBJ_NAME_TYPE_NUM 0x05 + +#define OBJ_NAME_ALIAS 0x8000 + +#define OBJ_BSEARCH_VALUE_ON_NOMATCH 0x01 +#define OBJ_BSEARCH_FIRST_VALUE_ON_MATCH 0x02 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct obj_name_st { + int type; + int alias; + const char* name; + const char* data; +} OBJ_NAME; + +#define OBJ_create_and_add_object(a, b, c) OBJ_create(a, b, c) + +int OBJ_NAME_init(void); +int OBJ_NAME_new_index( + unsigned long (*hash_func)(const char*), + int (*cmp_func)(const char*, const char*), + void (*free_func)(const char*, int, const char*)); +const char* OBJ_NAME_get(const char* name, int type); +int OBJ_NAME_add(const char* name, int type, const char* data); +int OBJ_NAME_remove(const char* name, int type); +void OBJ_NAME_cleanup(int type); /* -1 for everything */ +void OBJ_NAME_do_all( + int type, + void (*fn)(const OBJ_NAME*, void* arg), + void* arg); +void OBJ_NAME_do_all_sorted( + int type, + void (*fn)(const OBJ_NAME*, void* arg), + void* arg); + +ASN1_OBJECT* OBJ_dup(const ASN1_OBJECT* o); +ASN1_OBJECT* OBJ_nid2obj(int n); +const char* OBJ_nid2ln(int n); +const char* OBJ_nid2sn(int n); +int OBJ_obj2nid(const ASN1_OBJECT* o); +ASN1_OBJECT* OBJ_txt2obj(const char* s, int no_name); +int OBJ_obj2txt(char* buf, int buf_len, const ASN1_OBJECT* a, int no_name); +int OBJ_txt2nid(const char* s); +int OBJ_ln2nid(const char* s); +int OBJ_sn2nid(const char* s); +int OBJ_cmp(const ASN1_OBJECT* a, const ASN1_OBJECT* b); +const void* OBJ_bsearch_( + const void* key, + const void* base, + int num, + int size, + int (*cmp)(const void*, const void*)); +const void* OBJ_bsearch_ex_( + const void* key, + const void* base, + int num, + int size, + int (*cmp)(const void*, const void*), + int flags); + +#define _DECLARE_OBJ_BSEARCH_CMP_FN(scope, type1, type2, nm) \ + static int nm##_cmp_BSEARCH_CMP_FN(const void*, const void*); \ + static int nm##_cmp(type1 const*, type2 const*); \ + scope type2* OBJ_bsearch_##nm(type1* key, type2 const* base, int num) + +#define DECLARE_OBJ_BSEARCH_CMP_FN(type1, type2, cmp) \ + _DECLARE_OBJ_BSEARCH_CMP_FN(static, type1, type2, cmp) +#define DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ + type2* OBJ_bsearch_##nm(type1* key, type2 const* base, int num) + +/*- + * Unsolved problem: if a type is actually a pointer type, like + * nid_triple is, then its impossible to get a const where you need + * it. Consider: + * + * typedef int nid_triple[3]; + * const void *a_; + * const nid_triple const *a = a_; + * + * The assignement discards a const because what you really want is: + * + * const int const * const *a = a_; + * + * But if you do that, you lose the fact that a is an array of 3 ints, + * which breaks comparison functions. + * + * Thus we end up having to cast, sadly, or unpack the + * declarations. Or, as I finally did in this case, delcare nid_triple + * to be a struct, which it should have been in the first place. + * + * Ben, August 2008. + * + * Also, strictly speaking not all types need be const, but handling + * the non-constness means a lot of complication, and in practice + * comparison routines do always not touch their arguments. + */ + +#define IMPLEMENT_OBJ_BSEARCH_CMP_FN(type1, type2, nm) \ + static int nm##_cmp_BSEARCH_CMP_FN(const void* a_, const void* b_) { \ + type1 const* a = a_; \ + type2 const* b = b_; \ + return nm##_cmp(a, b); \ + } \ + static type2* OBJ_bsearch_##nm(type1* key, type2 const* base, int num) { \ + return (type2*)OBJ_bsearch_( \ + key, base, num, sizeof(type2), nm##_cmp_BSEARCH_CMP_FN); \ + } \ + extern void dummy_prototype(void) + +#define IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ + static int nm##_cmp_BSEARCH_CMP_FN(const void* a_, const void* b_) { \ + type1 const* a = a_; \ + type2 const* b = b_; \ + return nm##_cmp(a, b); \ + } \ + type2* OBJ_bsearch_##nm(type1* key, type2 const* base, int num) { \ + return (type2*)OBJ_bsearch_( \ + key, base, num, sizeof(type2), nm##_cmp_BSEARCH_CMP_FN); \ + } \ + extern void dummy_prototype(void) + +#define OBJ_bsearch(type1, key, type2, base, num, cmp) \ + ((type2*)OBJ_bsearch_( \ + CHECKED_PTR_OF(type1, key), \ + CHECKED_PTR_OF(type2, base), \ + num, \ + sizeof(type2), \ + ((void)CHECKED_PTR_OF(type1, cmp##_type_1), \ + (void)CHECKED_PTR_OF(type2, cmp##_type_2), \ + cmp##_BSEARCH_CMP_FN))) + +#define OBJ_bsearch_ex(type1, key, type2, base, num, cmp, flags) \ + ((type2*)OBJ_bsearch_ex_( \ + CHECKED_PTR_OF(type1, key), \ + CHECKED_PTR_OF(type2, base), \ + num, \ + sizeof(type2), \ + ((void)CHECKED_PTR_OF(type1, cmp##_type_1), \ + (void)type_2 = CHECKED_PTR_OF(type2, cmp##_type_2), \ + cmp##_BSEARCH_CMP_FN)), \ + flags) + +int OBJ_new_nid(int num); +int OBJ_add_object(const ASN1_OBJECT* obj); +int OBJ_create(const char* oid, const char* sn, const char* ln); +void OBJ_cleanup(void); +int OBJ_create_objects(BIO* in); + +int OBJ_find_sigid_algs(int signid, int* pdig_nid, int* ppkey_nid); +int OBJ_find_sigid_by_algs(int* psignid, int dig_nid, int pkey_nid); +int OBJ_add_sigid(int signid, int dig_id, int pkey_id); +void OBJ_sigid_free(void); + +extern int obj_cleanup_defer; +void check_defer(int nid); + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_OBJ_strings(void); + +/* Error codes for the OBJ functions. */ + +/* Function codes. */ +#define OBJ_F_OBJ_ADD_OBJECT 105 +#define OBJ_F_OBJ_CREATE 100 +#define OBJ_F_OBJ_DUP 101 +#define OBJ_F_OBJ_NAME_NEW_INDEX 106 +#define OBJ_F_OBJ_NID2LN 102 +#define OBJ_F_OBJ_NID2OBJ 103 +#define OBJ_F_OBJ_NID2SN 104 + +/* Reason codes. */ +#define OBJ_R_MALLOC_FAILURE 100 +#define OBJ_R_UNKNOWN_NID 101 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ocsp.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ocsp.h new file mode 100644 index 0000000..4804c6d --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ocsp.h @@ -0,0 +1,752 @@ +/* ocsp.h */ +/* + * Written by Tom Titchener for the OpenSSL + * project. + */ + +/* + * History: This file was transfered to Richard Levitte from CertCo by Kathy + * Weinhold in mid-spring 2000 to be included in OpenSSL or released as a + * patch kit. + */ + +/* ==================================================================== + * Copyright (c) 1998-2000 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_OCSP_H +#define HEADER_OCSP_H + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Various flags and values */ + +#define OCSP_DEFAULT_NONCE_LENGTH 16 + +#define OCSP_NOCERTS 0x1 +#define OCSP_NOINTERN 0x2 +#define OCSP_NOSIGS 0x4 +#define OCSP_NOCHAIN 0x8 +#define OCSP_NOVERIFY 0x10 +#define OCSP_NOEXPLICIT 0x20 +#define OCSP_NOCASIGN 0x40 +#define OCSP_NODELEGATED 0x80 +#define OCSP_NOCHECKS 0x100 +#define OCSP_TRUSTOTHER 0x200 +#define OCSP_RESPID_KEY 0x400 +#define OCSP_NOTIME 0x800 + +/*- CertID ::= SEQUENCE { + * hashAlgorithm AlgorithmIdentifier, + * issuerNameHash OCTET STRING, -- Hash of Issuer's DN + * issuerKeyHash OCTET STRING, -- Hash of Issuers public key + * (excluding the tag & length fields) + * serialNumber CertificateSerialNumber } + */ +typedef struct ocsp_cert_id_st { + X509_ALGOR* hashAlgorithm; + ASN1_OCTET_STRING* issuerNameHash; + ASN1_OCTET_STRING* issuerKeyHash; + ASN1_INTEGER* serialNumber; +} OCSP_CERTID; + +DECLARE_STACK_OF(OCSP_CERTID) + +/*- Request ::= SEQUENCE { + * reqCert CertID, + * singleRequestExtensions [0] EXPLICIT Extensions OPTIONAL } + */ +typedef struct ocsp_one_request_st { + OCSP_CERTID* reqCert; + STACK_OF(X509_EXTENSION) * singleRequestExtensions; +} OCSP_ONEREQ; + +DECLARE_STACK_OF(OCSP_ONEREQ) +DECLARE_ASN1_SET_OF(OCSP_ONEREQ) + +/*- TBSRequest ::= SEQUENCE { + * version [0] EXPLICIT Version DEFAULT v1, + * requestorName [1] EXPLICIT GeneralName OPTIONAL, + * requestList SEQUENCE OF Request, + * requestExtensions [2] EXPLICIT Extensions OPTIONAL } + */ +typedef struct ocsp_req_info_st { + ASN1_INTEGER* version; + GENERAL_NAME* requestorName; + STACK_OF(OCSP_ONEREQ) * requestList; + STACK_OF(X509_EXTENSION) * requestExtensions; +} OCSP_REQINFO; + +/*- Signature ::= SEQUENCE { + * signatureAlgorithm AlgorithmIdentifier, + * signature BIT STRING, + * certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL } + */ +typedef struct ocsp_signature_st { + X509_ALGOR* signatureAlgorithm; + ASN1_BIT_STRING* signature; + STACK_OF(X509) * certs; +} OCSP_SIGNATURE; + +/*- OCSPRequest ::= SEQUENCE { + * tbsRequest TBSRequest, + * optionalSignature [0] EXPLICIT Signature OPTIONAL } + */ +typedef struct ocsp_request_st { + OCSP_REQINFO* tbsRequest; + OCSP_SIGNATURE* optionalSignature; /* OPTIONAL */ +} OCSP_REQUEST; + +/*- OCSPResponseStatus ::= ENUMERATED { + * successful (0), --Response has valid confirmations + * malformedRequest (1), --Illegal confirmation request + * internalError (2), --Internal error in issuer + * tryLater (3), --Try again later + * --(4) is not used + * sigRequired (5), --Must sign the request + * unauthorized (6) --Request unauthorized + * } + */ +#define OCSP_RESPONSE_STATUS_SUCCESSFUL 0 +#define OCSP_RESPONSE_STATUS_MALFORMEDREQUEST 1 +#define OCSP_RESPONSE_STATUS_INTERNALERROR 2 +#define OCSP_RESPONSE_STATUS_TRYLATER 3 +#define OCSP_RESPONSE_STATUS_SIGREQUIRED 5 +#define OCSP_RESPONSE_STATUS_UNAUTHORIZED 6 + +/*- ResponseBytes ::= SEQUENCE { + * responseType OBJECT IDENTIFIER, + * response OCTET STRING } + */ +typedef struct ocsp_resp_bytes_st { + ASN1_OBJECT* responseType; + ASN1_OCTET_STRING* response; +} OCSP_RESPBYTES; + +/*- OCSPResponse ::= SEQUENCE { + * responseStatus OCSPResponseStatus, + * responseBytes [0] EXPLICIT ResponseBytes OPTIONAL } + */ +struct ocsp_response_st { + ASN1_ENUMERATED* responseStatus; + OCSP_RESPBYTES* responseBytes; +}; + +/*- ResponderID ::= CHOICE { + * byName [1] Name, + * byKey [2] KeyHash } + */ +#define V_OCSP_RESPID_NAME 0 +#define V_OCSP_RESPID_KEY 1 +struct ocsp_responder_id_st { + int type; + union { + X509_NAME* byName; + ASN1_OCTET_STRING* byKey; + } value; +}; + +DECLARE_STACK_OF(OCSP_RESPID) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPID) + +/*- KeyHash ::= OCTET STRING --SHA-1 hash of responder's public key + * --(excluding the tag and length fields) + */ + +/*- RevokedInfo ::= SEQUENCE { + * revocationTime GeneralizedTime, + * revocationReason [0] EXPLICIT CRLReason OPTIONAL } + */ +typedef struct ocsp_revoked_info_st { + ASN1_GENERALIZEDTIME* revocationTime; + ASN1_ENUMERATED* revocationReason; +} OCSP_REVOKEDINFO; + +/*- CertStatus ::= CHOICE { + * good [0] IMPLICIT NULL, + * revoked [1] IMPLICIT RevokedInfo, + * unknown [2] IMPLICIT UnknownInfo } + */ +#define V_OCSP_CERTSTATUS_GOOD 0 +#define V_OCSP_CERTSTATUS_REVOKED 1 +#define V_OCSP_CERTSTATUS_UNKNOWN 2 +typedef struct ocsp_cert_status_st { + int type; + union { + ASN1_NULL* good; + OCSP_REVOKEDINFO* revoked; + ASN1_NULL* unknown; + } value; +} OCSP_CERTSTATUS; + +/*- SingleResponse ::= SEQUENCE { + * certID CertID, + * certStatus CertStatus, + * thisUpdate GeneralizedTime, + * nextUpdate [0] EXPLICIT GeneralizedTime OPTIONAL, + * singleExtensions [1] EXPLICIT Extensions OPTIONAL } + */ +typedef struct ocsp_single_response_st { + OCSP_CERTID* certId; + OCSP_CERTSTATUS* certStatus; + ASN1_GENERALIZEDTIME* thisUpdate; + ASN1_GENERALIZEDTIME* nextUpdate; + STACK_OF(X509_EXTENSION) * singleExtensions; +} OCSP_SINGLERESP; + +DECLARE_STACK_OF(OCSP_SINGLERESP) +DECLARE_ASN1_SET_OF(OCSP_SINGLERESP) + +/*- ResponseData ::= SEQUENCE { + * version [0] EXPLICIT Version DEFAULT v1, + * responderID ResponderID, + * producedAt GeneralizedTime, + * responses SEQUENCE OF SingleResponse, + * responseExtensions [1] EXPLICIT Extensions OPTIONAL } + */ +typedef struct ocsp_response_data_st { + ASN1_INTEGER* version; + OCSP_RESPID* responderId; + ASN1_GENERALIZEDTIME* producedAt; + STACK_OF(OCSP_SINGLERESP) * responses; + STACK_OF(X509_EXTENSION) * responseExtensions; +} OCSP_RESPDATA; + +/*- BasicOCSPResponse ::= SEQUENCE { + * tbsResponseData ResponseData, + * signatureAlgorithm AlgorithmIdentifier, + * signature BIT STRING, + * certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL } + */ +/* + * Note 1: The value for "signature" is specified in the OCSP rfc2560 as + * follows: "The value for the signature SHALL be computed on the hash of + * the DER encoding ResponseData." This means that you must hash the + * DER-encoded tbsResponseData, and then run it through a crypto-signing + * function, which will (at least w/RSA) do a hash-'n'-private-encrypt + * operation. This seems a bit odd, but that's the spec. Also note that + * the data structures do not leave anywhere to independently specify the + * algorithm used for the initial hash. So, we look at the + * signature-specification algorithm, and try to do something intelligent. + * -- Kathy Weinhold, CertCo + */ +/* + * Note 2: It seems that the mentioned passage from RFC 2560 (section + * 4.2.1) is open for interpretation. I've done tests against another + * responder, and found that it doesn't do the double hashing that the RFC + * seems to say one should. Therefore, all relevant functions take a flag + * saying which variant should be used. -- Richard Levitte, OpenSSL team + * and CeloCom + */ +typedef struct ocsp_basic_response_st { + OCSP_RESPDATA* tbsResponseData; + X509_ALGOR* signatureAlgorithm; + ASN1_BIT_STRING* signature; + STACK_OF(X509) * certs; +} OCSP_BASICRESP; + +/*- + * CRLReason ::= ENUMERATED { + * unspecified (0), + * keyCompromise (1), + * cACompromise (2), + * affiliationChanged (3), + * superseded (4), + * cessationOfOperation (5), + * certificateHold (6), + * removeFromCRL (8) } + */ +#define OCSP_REVOKED_STATUS_NOSTATUS -1 +#define OCSP_REVOKED_STATUS_UNSPECIFIED 0 +#define OCSP_REVOKED_STATUS_KEYCOMPROMISE 1 +#define OCSP_REVOKED_STATUS_CACOMPROMISE 2 +#define OCSP_REVOKED_STATUS_AFFILIATIONCHANGED 3 +#define OCSP_REVOKED_STATUS_SUPERSEDED 4 +#define OCSP_REVOKED_STATUS_CESSATIONOFOPERATION 5 +#define OCSP_REVOKED_STATUS_CERTIFICATEHOLD 6 +#define OCSP_REVOKED_STATUS_REMOVEFROMCRL 8 + +/*- + * CrlID ::= SEQUENCE { + * crlUrl [0] EXPLICIT IA5String OPTIONAL, + * crlNum [1] EXPLICIT INTEGER OPTIONAL, + * crlTime [2] EXPLICIT GeneralizedTime OPTIONAL } + */ +typedef struct ocsp_crl_id_st { + ASN1_IA5STRING* crlUrl; + ASN1_INTEGER* crlNum; + ASN1_GENERALIZEDTIME* crlTime; +} OCSP_CRLID; + +/*- + * ServiceLocator ::= SEQUENCE { + * issuer Name, + * locator AuthorityInfoAccessSyntax OPTIONAL } + */ +typedef struct ocsp_service_locator_st { + X509_NAME* issuer; + STACK_OF(ACCESS_DESCRIPTION) * locator; +} OCSP_SERVICELOC; + +#define PEM_STRING_OCSP_REQUEST "OCSP REQUEST" +#define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE" + +#define d2i_OCSP_REQUEST_bio(bp, p) \ + ASN1_d2i_bio_of(OCSP_REQUEST, OCSP_REQUEST_new, d2i_OCSP_REQUEST, bp, p) + +#define d2i_OCSP_RESPONSE_bio(bp, p) \ + ASN1_d2i_bio_of(OCSP_RESPONSE, OCSP_RESPONSE_new, d2i_OCSP_RESPONSE, bp, p) + +#define PEM_read_bio_OCSP_REQUEST(bp, x, cb) \ + (OCSP_REQUEST*)PEM_ASN1_read_bio( \ + (char* (*)())d2i_OCSP_REQUEST, \ + PEM_STRING_OCSP_REQUEST, \ + bp, \ + (char**)x, \ + cb, \ + NULL) + +#define PEM_read_bio_OCSP_RESPONSE(bp, x, cb) \ + (OCSP_RESPONSE*)PEM_ASN1_read_bio( \ + (char* (*)())d2i_OCSP_RESPONSE, \ + PEM_STRING_OCSP_RESPONSE, \ + bp, \ + (char**)x, \ + cb, \ + NULL) + +#define PEM_write_bio_OCSP_REQUEST(bp, o) \ + PEM_ASN1_write_bio( \ + (int (*)())i2d_OCSP_REQUEST, \ + PEM_STRING_OCSP_REQUEST, \ + bp, \ + (char*)o, \ + NULL, \ + NULL, \ + 0, \ + NULL, \ + NULL) + +#define PEM_write_bio_OCSP_RESPONSE(bp, o) \ + PEM_ASN1_write_bio( \ + (int (*)())i2d_OCSP_RESPONSE, \ + PEM_STRING_OCSP_RESPONSE, \ + bp, \ + (char*)o, \ + NULL, \ + NULL, \ + 0, \ + NULL, \ + NULL) + +#define i2d_OCSP_RESPONSE_bio(bp, o) \ + ASN1_i2d_bio_of(OCSP_RESPONSE, i2d_OCSP_RESPONSE, bp, o) + +#define i2d_OCSP_REQUEST_bio(bp, o) \ + ASN1_i2d_bio_of(OCSP_REQUEST, i2d_OCSP_REQUEST, bp, o) + +#define OCSP_REQUEST_sign(o, pkey, md) \ + ASN1_item_sign( \ + ASN1_ITEM_rptr(OCSP_REQINFO), \ + o->optionalSignature->signatureAlgorithm, \ + NULL, \ + o->optionalSignature->signature, \ + o->tbsRequest, \ + pkey, \ + md) + +#define OCSP_BASICRESP_sign(o, pkey, md, d) \ + ASN1_item_sign( \ + ASN1_ITEM_rptr(OCSP_RESPDATA), \ + o->signatureAlgorithm, \ + NULL, \ + o->signature, \ + o->tbsResponseData, \ + pkey, \ + md) + +#define OCSP_REQUEST_verify(a, r) \ + ASN1_item_verify( \ + ASN1_ITEM_rptr(OCSP_REQINFO), \ + a->optionalSignature->signatureAlgorithm, \ + a->optionalSignature->signature, \ + a->tbsRequest, \ + r) + +#define OCSP_BASICRESP_verify(a, r, d) \ + ASN1_item_verify( \ + ASN1_ITEM_rptr(OCSP_RESPDATA), \ + a->signatureAlgorithm, \ + a->signature, \ + a->tbsResponseData, \ + r) + +#define ASN1_BIT_STRING_digest(data, type, md, len) \ + ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING), type, data, md, len) + +#define OCSP_CERTSTATUS_dup(cs) \ + (OCSP_CERTSTATUS*)ASN1_dup( \ + (int (*)())i2d_OCSP_CERTSTATUS, \ + (char* (*)())d2i_OCSP_CERTSTATUS, \ + (char*)(cs)) + +OCSP_CERTID* OCSP_CERTID_dup(OCSP_CERTID* id); + +OCSP_RESPONSE* OCSP_sendreq_bio(BIO* b, const char* path, OCSP_REQUEST* req); +OCSP_REQ_CTX* +OCSP_sendreq_new(BIO* io, const char* path, OCSP_REQUEST* req, int maxline); +int OCSP_REQ_CTX_nbio(OCSP_REQ_CTX* rctx); +int OCSP_sendreq_nbio(OCSP_RESPONSE** presp, OCSP_REQ_CTX* rctx); +OCSP_REQ_CTX* OCSP_REQ_CTX_new(BIO* io, int maxline); +void OCSP_REQ_CTX_free(OCSP_REQ_CTX* rctx); +void OCSP_set_max_response_length(OCSP_REQ_CTX* rctx, unsigned long len); +int OCSP_REQ_CTX_i2d(OCSP_REQ_CTX* rctx, const ASN1_ITEM* it, ASN1_VALUE* val); +int OCSP_REQ_CTX_nbio_d2i( + OCSP_REQ_CTX* rctx, + ASN1_VALUE** pval, + const ASN1_ITEM* it); +BIO* OCSP_REQ_CTX_get0_mem_bio(OCSP_REQ_CTX* rctx); +int OCSP_REQ_CTX_i2d(OCSP_REQ_CTX* rctx, const ASN1_ITEM* it, ASN1_VALUE* val); +int OCSP_REQ_CTX_http(OCSP_REQ_CTX* rctx, const char* op, const char* path); +int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX* rctx, OCSP_REQUEST* req); +int OCSP_REQ_CTX_add1_header( + OCSP_REQ_CTX* rctx, + const char* name, + const char* value); + +OCSP_CERTID* OCSP_cert_to_id(const EVP_MD* dgst, X509* subject, X509* issuer); + +OCSP_CERTID* OCSP_cert_id_new( + const EVP_MD* dgst, + X509_NAME* issuerName, + ASN1_BIT_STRING* issuerKey, + ASN1_INTEGER* serialNumber); + +OCSP_ONEREQ* OCSP_request_add0_id(OCSP_REQUEST* req, OCSP_CERTID* cid); + +int OCSP_request_add1_nonce(OCSP_REQUEST* req, unsigned char* val, int len); +int OCSP_basic_add1_nonce(OCSP_BASICRESP* resp, unsigned char* val, int len); +int OCSP_check_nonce(OCSP_REQUEST* req, OCSP_BASICRESP* bs); +int OCSP_copy_nonce(OCSP_BASICRESP* resp, OCSP_REQUEST* req); + +int OCSP_request_set1_name(OCSP_REQUEST* req, X509_NAME* nm); +int OCSP_request_add1_cert(OCSP_REQUEST* req, X509* cert); + +int OCSP_request_sign( + OCSP_REQUEST* req, + X509* signer, + EVP_PKEY* key, + const EVP_MD* dgst, + STACK_OF(X509) * certs, + unsigned long flags); + +int OCSP_response_status(OCSP_RESPONSE* resp); +OCSP_BASICRESP* OCSP_response_get1_basic(OCSP_RESPONSE* resp); + +int OCSP_resp_count(OCSP_BASICRESP* bs); +OCSP_SINGLERESP* OCSP_resp_get0(OCSP_BASICRESP* bs, int idx); +int OCSP_resp_find(OCSP_BASICRESP* bs, OCSP_CERTID* id, int last); +int OCSP_single_get0_status( + OCSP_SINGLERESP* single, + int* reason, + ASN1_GENERALIZEDTIME** revtime, + ASN1_GENERALIZEDTIME** thisupd, + ASN1_GENERALIZEDTIME** nextupd); +int OCSP_resp_find_status( + OCSP_BASICRESP* bs, + OCSP_CERTID* id, + int* status, + int* reason, + ASN1_GENERALIZEDTIME** revtime, + ASN1_GENERALIZEDTIME** thisupd, + ASN1_GENERALIZEDTIME** nextupd); +int OCSP_check_validity( + ASN1_GENERALIZEDTIME* thisupd, + ASN1_GENERALIZEDTIME* nextupd, + long sec, + long maxsec); + +int OCSP_request_verify( + OCSP_REQUEST* req, + STACK_OF(X509) * certs, + X509_STORE* store, + unsigned long flags); + +int OCSP_parse_url( + const char* url, + char** phost, + char** pport, + char** ppath, + int* pssl); + +int OCSP_id_issuer_cmp(OCSP_CERTID* a, OCSP_CERTID* b); +int OCSP_id_cmp(OCSP_CERTID* a, OCSP_CERTID* b); + +int OCSP_request_onereq_count(OCSP_REQUEST* req); +OCSP_ONEREQ* OCSP_request_onereq_get0(OCSP_REQUEST* req, int i); +OCSP_CERTID* OCSP_onereq_get0_id(OCSP_ONEREQ* one); +int OCSP_id_get0_info( + ASN1_OCTET_STRING** piNameHash, + ASN1_OBJECT** pmd, + ASN1_OCTET_STRING** pikeyHash, + ASN1_INTEGER** pserial, + OCSP_CERTID* cid); +int OCSP_request_is_signed(OCSP_REQUEST* req); +OCSP_RESPONSE* OCSP_response_create(int status, OCSP_BASICRESP* bs); +OCSP_SINGLERESP* OCSP_basic_add1_status( + OCSP_BASICRESP* rsp, + OCSP_CERTID* cid, + int status, + int reason, + ASN1_TIME* revtime, + ASN1_TIME* thisupd, + ASN1_TIME* nextupd); +int OCSP_basic_add1_cert(OCSP_BASICRESP* resp, X509* cert); +int OCSP_basic_sign( + OCSP_BASICRESP* brsp, + X509* signer, + EVP_PKEY* key, + const EVP_MD* dgst, + STACK_OF(X509) * certs, + unsigned long flags); + +X509_EXTENSION* OCSP_crlID_new(char* url, long* n, char* tim); + +X509_EXTENSION* OCSP_accept_responses_new(char** oids); + +X509_EXTENSION* OCSP_archive_cutoff_new(char* tim); + +X509_EXTENSION* OCSP_url_svcloc_new(X509_NAME* issuer, char** urls); + +int OCSP_REQUEST_get_ext_count(OCSP_REQUEST* x); +int OCSP_REQUEST_get_ext_by_NID(OCSP_REQUEST* x, int nid, int lastpos); +int OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST* x, ASN1_OBJECT* obj, int lastpos); +int OCSP_REQUEST_get_ext_by_critical(OCSP_REQUEST* x, int crit, int lastpos); +X509_EXTENSION* OCSP_REQUEST_get_ext(OCSP_REQUEST* x, int loc); +X509_EXTENSION* OCSP_REQUEST_delete_ext(OCSP_REQUEST* x, int loc); +void* OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST* x, int nid, int* crit, int* idx); +int OCSP_REQUEST_add1_ext_i2d( + OCSP_REQUEST* x, + int nid, + void* value, + int crit, + unsigned long flags); +int OCSP_REQUEST_add_ext(OCSP_REQUEST* x, X509_EXTENSION* ex, int loc); + +int OCSP_ONEREQ_get_ext_count(OCSP_ONEREQ* x); +int OCSP_ONEREQ_get_ext_by_NID(OCSP_ONEREQ* x, int nid, int lastpos); +int OCSP_ONEREQ_get_ext_by_OBJ(OCSP_ONEREQ* x, ASN1_OBJECT* obj, int lastpos); +int OCSP_ONEREQ_get_ext_by_critical(OCSP_ONEREQ* x, int crit, int lastpos); +X509_EXTENSION* OCSP_ONEREQ_get_ext(OCSP_ONEREQ* x, int loc); +X509_EXTENSION* OCSP_ONEREQ_delete_ext(OCSP_ONEREQ* x, int loc); +void* OCSP_ONEREQ_get1_ext_d2i(OCSP_ONEREQ* x, int nid, int* crit, int* idx); +int OCSP_ONEREQ_add1_ext_i2d( + OCSP_ONEREQ* x, + int nid, + void* value, + int crit, + unsigned long flags); +int OCSP_ONEREQ_add_ext(OCSP_ONEREQ* x, X509_EXTENSION* ex, int loc); + +int OCSP_BASICRESP_get_ext_count(OCSP_BASICRESP* x); +int OCSP_BASICRESP_get_ext_by_NID(OCSP_BASICRESP* x, int nid, int lastpos); +int OCSP_BASICRESP_get_ext_by_OBJ( + OCSP_BASICRESP* x, + ASN1_OBJECT* obj, + int lastpos); +int OCSP_BASICRESP_get_ext_by_critical( + OCSP_BASICRESP* x, + int crit, + int lastpos); +X509_EXTENSION* OCSP_BASICRESP_get_ext(OCSP_BASICRESP* x, int loc); +X509_EXTENSION* OCSP_BASICRESP_delete_ext(OCSP_BASICRESP* x, int loc); +void* OCSP_BASICRESP_get1_ext_d2i( + OCSP_BASICRESP* x, + int nid, + int* crit, + int* idx); +int OCSP_BASICRESP_add1_ext_i2d( + OCSP_BASICRESP* x, + int nid, + void* value, + int crit, + unsigned long flags); +int OCSP_BASICRESP_add_ext(OCSP_BASICRESP* x, X509_EXTENSION* ex, int loc); + +int OCSP_SINGLERESP_get_ext_count(OCSP_SINGLERESP* x); +int OCSP_SINGLERESP_get_ext_by_NID(OCSP_SINGLERESP* x, int nid, int lastpos); +int OCSP_SINGLERESP_get_ext_by_OBJ( + OCSP_SINGLERESP* x, + ASN1_OBJECT* obj, + int lastpos); +int OCSP_SINGLERESP_get_ext_by_critical( + OCSP_SINGLERESP* x, + int crit, + int lastpos); +X509_EXTENSION* OCSP_SINGLERESP_get_ext(OCSP_SINGLERESP* x, int loc); +X509_EXTENSION* OCSP_SINGLERESP_delete_ext(OCSP_SINGLERESP* x, int loc); +void* OCSP_SINGLERESP_get1_ext_d2i( + OCSP_SINGLERESP* x, + int nid, + int* crit, + int* idx); +int OCSP_SINGLERESP_add1_ext_i2d( + OCSP_SINGLERESP* x, + int nid, + void* value, + int crit, + unsigned long flags); +int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP* x, X509_EXTENSION* ex, int loc); + +DECLARE_ASN1_FUNCTIONS(OCSP_SINGLERESP) +DECLARE_ASN1_FUNCTIONS(OCSP_CERTSTATUS) +DECLARE_ASN1_FUNCTIONS(OCSP_REVOKEDINFO) +DECLARE_ASN1_FUNCTIONS(OCSP_BASICRESP) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPDATA) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPID) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPONSE) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPBYTES) +DECLARE_ASN1_FUNCTIONS(OCSP_ONEREQ) +DECLARE_ASN1_FUNCTIONS(OCSP_CERTID) +DECLARE_ASN1_FUNCTIONS(OCSP_REQUEST) +DECLARE_ASN1_FUNCTIONS(OCSP_SIGNATURE) +DECLARE_ASN1_FUNCTIONS(OCSP_REQINFO) +DECLARE_ASN1_FUNCTIONS(OCSP_CRLID) +DECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC) + +const char* OCSP_response_status_str(long s); +const char* OCSP_cert_status_str(long s); +const char* OCSP_crl_reason_str(long s); + +int OCSP_REQUEST_print(BIO* bp, OCSP_REQUEST* a, unsigned long flags); +int OCSP_RESPONSE_print(BIO* bp, OCSP_RESPONSE* o, unsigned long flags); + +int OCSP_basic_verify( + OCSP_BASICRESP* bs, + STACK_OF(X509) * certs, + X509_STORE* st, + unsigned long flags); + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_OCSP_strings(void); + +/* Error codes for the OCSP functions. */ + +/* Function codes. */ +#define OCSP_F_ASN1_STRING_ENCODE 100 +#define OCSP_F_D2I_OCSP_NONCE 102 +#define OCSP_F_OCSP_BASIC_ADD1_STATUS 103 +#define OCSP_F_OCSP_BASIC_SIGN 104 +#define OCSP_F_OCSP_BASIC_VERIFY 105 +#define OCSP_F_OCSP_CERT_ID_NEW 101 +#define OCSP_F_OCSP_CHECK_DELEGATED 106 +#define OCSP_F_OCSP_CHECK_IDS 107 +#define OCSP_F_OCSP_CHECK_ISSUER 108 +#define OCSP_F_OCSP_CHECK_VALIDITY 115 +#define OCSP_F_OCSP_MATCH_ISSUERID 109 +#define OCSP_F_OCSP_PARSE_URL 114 +#define OCSP_F_OCSP_REQUEST_SIGN 110 +#define OCSP_F_OCSP_REQUEST_VERIFY 116 +#define OCSP_F_OCSP_RESPONSE_GET1_BASIC 111 +#define OCSP_F_OCSP_SENDREQ_BIO 112 +#define OCSP_F_OCSP_SENDREQ_NBIO 117 +#define OCSP_F_PARSE_HTTP_LINE1 118 +#define OCSP_F_REQUEST_VERIFY 113 + +/* Reason codes. */ +#define OCSP_R_BAD_DATA 100 +#define OCSP_R_CERTIFICATE_VERIFY_ERROR 101 +#define OCSP_R_DIGEST_ERR 102 +#define OCSP_R_ERROR_IN_NEXTUPDATE_FIELD 122 +#define OCSP_R_ERROR_IN_THISUPDATE_FIELD 123 +#define OCSP_R_ERROR_PARSING_URL 121 +#define OCSP_R_MISSING_OCSPSIGNING_USAGE 103 +#define OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE 124 +#define OCSP_R_NOT_BASIC_RESPONSE 104 +#define OCSP_R_NO_CERTIFICATES_IN_CHAIN 105 +#define OCSP_R_NO_CONTENT 106 +#define OCSP_R_NO_PUBLIC_KEY 107 +#define OCSP_R_NO_RESPONSE_DATA 108 +#define OCSP_R_NO_REVOKED_TIME 109 +#define OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 110 +#define OCSP_R_REQUEST_NOT_SIGNED 128 +#define OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA 111 +#define OCSP_R_ROOT_CA_NOT_TRUSTED 112 +#define OCSP_R_SERVER_READ_ERROR 113 +#define OCSP_R_SERVER_RESPONSE_ERROR 114 +#define OCSP_R_SERVER_RESPONSE_PARSE_ERROR 115 +#define OCSP_R_SERVER_WRITE_ERROR 116 +#define OCSP_R_SIGNATURE_FAILURE 117 +#define OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND 118 +#define OCSP_R_STATUS_EXPIRED 125 +#define OCSP_R_STATUS_NOT_YET_VALID 126 +#define OCSP_R_STATUS_TOO_OLD 127 +#define OCSP_R_UNKNOWN_MESSAGE_DIGEST 119 +#define OCSP_R_UNKNOWN_NID 120 +#define OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE 129 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/opensslconf.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/opensslconf.h new file mode 100644 index 0000000..6d14738 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/opensslconf.h @@ -0,0 +1,267 @@ +/* opensslconf.h */ +/* WARNING: Generated automatically from opensslconf.h.in by Configure. */ + +#ifdef __cplusplus +extern "C" { +#endif +/* OpenSSL was configured with the following options: */ +#ifndef OPENSSL_DOING_MAKEDEPEND + +#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 +#define OPENSSL_NO_EC_NISTP_64_GCC_128 +#endif +#ifndef OPENSSL_NO_GMP +#define OPENSSL_NO_GMP +#endif +#ifndef OPENSSL_NO_JPAKE +#define OPENSSL_NO_JPAKE +#endif +#ifndef OPENSSL_NO_KRB5 +#define OPENSSL_NO_KRB5 +#endif +#ifndef OPENSSL_NO_LIBUNBOUND +#define OPENSSL_NO_LIBUNBOUND +#endif +#ifndef OPENSSL_NO_MD2 +#define OPENSSL_NO_MD2 +#endif +#ifndef OPENSSL_NO_RC5 +#define OPENSSL_NO_RC5 +#endif +#ifndef OPENSSL_NO_RFC3779 +#define OPENSSL_NO_RFC3779 +#endif +#ifndef OPENSSL_NO_SCTP +#define OPENSSL_NO_SCTP +#endif +#ifndef OPENSSL_NO_SSL_TRACE +#define OPENSSL_NO_SSL_TRACE +#endif +#ifndef OPENSSL_NO_STORE +#define OPENSSL_NO_STORE +#endif +#ifndef OPENSSL_NO_UNIT_TEST +#define OPENSSL_NO_UNIT_TEST +#endif +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +#define OPENSSL_NO_WEAK_SSL_CIPHERS +#endif + +#endif /* OPENSSL_DOING_MAKEDEPEND */ + +#ifndef OPENSSL_THREADS +#define OPENSSL_THREADS +#endif +#ifndef OPENSSL_NO_STATIC_ENGINE +#define OPENSSL_NO_STATIC_ENGINE +#endif + +/* The OPENSSL_NO_* macros are also defined as NO_* if the application + asks for it. This is a transient feature that is provided for those + who haven't had the time to do the appropriate changes in their + applications. */ +#ifdef OPENSSL_ALGORITHM_DEFINES +#if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128) +#define NO_EC_NISTP_64_GCC_128 +#endif +#if defined(OPENSSL_NO_GMP) && !defined(NO_GMP) +#define NO_GMP +#endif +#if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE) +#define NO_JPAKE +#endif +#if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5) +#define NO_KRB5 +#endif +#if defined(OPENSSL_NO_LIBUNBOUND) && !defined(NO_LIBUNBOUND) +#define NO_LIBUNBOUND +#endif +#if defined(OPENSSL_NO_MD2) && !defined(NO_MD2) +#define NO_MD2 +#endif +#if defined(OPENSSL_NO_RC5) && !defined(NO_RC5) +#define NO_RC5 +#endif +#if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779) +#define NO_RFC3779 +#endif +#if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP) +#define NO_SCTP +#endif +#if defined(OPENSSL_NO_SSL_TRACE) && !defined(NO_SSL_TRACE) +#define NO_SSL_TRACE +#endif +#if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) +#define NO_STORE +#endif +#if defined(OPENSSL_NO_UNIT_TEST) && !defined(NO_UNIT_TEST) +#define NO_UNIT_TEST +#endif +#if defined(OPENSSL_NO_WEAK_SSL_CIPHERS) && !defined(NO_WEAK_SSL_CIPHERS) +#define NO_WEAK_SSL_CIPHERS +#endif +#endif + +#define OPENSSL_CPUID_OBJ + +/* crypto/opensslconf.h.in */ + +/* Generate 80386 code? */ +#undef I386_ONLY + +#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ +#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) +#define ENGINESDIR \ + "/private/home/oteytaud/newtasks/src_cpp/elfgames/tasks/elf2codingenv/lib/" \ + "engines" +#define OPENSSLDIR \ + "/private/home/oteytaud/newtasks/src_cpp/elfgames/tasks/elf2codingenv/ssl" +#endif +#endif + +#undef OPENSSL_UNISTD +#define OPENSSL_UNISTD + +#undef OPENSSL_EXPORT_VAR_AS_FUNCTION + +#if defined(HEADER_IDEA_H) && !defined(IDEA_INT) +#define IDEA_INT unsigned int +#endif + +#if defined(HEADER_MD2_H) && !defined(MD2_INT) +#define MD2_INT unsigned int +#endif + +#if defined(HEADER_RC2_H) && !defined(RC2_INT) +/* I need to put in a mod for the alpha - eay */ +#define RC2_INT unsigned int +#endif + +#if defined(HEADER_RC4_H) +#if !defined(RC4_INT) +/* using int types make the structure larger but make the code faster + * on most boxes I have tested - up to %20 faster. */ +/* + * I don't know what does "most" mean, but declaring "int" is a must on: + * - Intel P6 because partial register stalls are very expensive; + * - elder Alpha because it lacks byte load/store instructions; + */ +#define RC4_INT unsigned int +#endif +#if !defined(RC4_CHUNK) +/* + * This enables code handling data aligned at natural CPU word + * boundary. See crypto/rc4/rc4_enc.c for further details. + */ +#define RC4_CHUNK unsigned long +#endif +#endif + +#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) +/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a + * %20 speed up (longs are 8 bytes, int's are 4). */ +#ifndef DES_LONG +#define DES_LONG unsigned int +#endif +#endif + +#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) +#define CONFIG_HEADER_BN_H +#undef BN_LLONG + +/* Should we define BN_DIV2W here? */ + +/* Only one for the following should be defined */ +#define SIXTY_FOUR_BIT_LONG +#undef SIXTY_FOUR_BIT +#undef THIRTY_TWO_BIT +#endif + +#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) +#define CONFIG_HEADER_RC4_LOCL_H +/* if this is defined data[i] is used instead of *data, this is a %20 + * speedup on x86 */ +#undef RC4_INDEX +#endif + +#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) +#define CONFIG_HEADER_BF_LOCL_H +#undef BF_PTR +#endif /* HEADER_BF_LOCL_H */ + +#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) +#define CONFIG_HEADER_DES_LOCL_H +#ifndef DES_DEFAULT_OPTIONS +/* the following is tweaked from a config script, that is why it is a + * protected undef/define */ +#ifndef DES_PTR +#undef DES_PTR +#endif + +/* This helps C compiler generate the correct code for multiple functional + * units. It reduces register dependancies at the expense of 2 more + * registers */ +#ifndef DES_RISC1 +#undef DES_RISC1 +#endif + +#ifndef DES_RISC2 +#undef DES_RISC2 +#endif + +#if defined(DES_RISC1) && defined(DES_RISC2) +#error YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! +#endif + +/* Unroll the inner loop, this sometimes helps, sometimes hinders. + * Very mucy CPU dependant */ +#ifndef DES_UNROLL +#define DES_UNROLL +#endif + +/* These default values were supplied by + * Peter Gutman + * They are only used if nothing else has been defined */ +#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && \ + !defined(DES_UNROLL) +/* Special defines which change the way the code is built depending on the + CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find + even newer MIPS CPU's, but at the moment one size fits all for + optimization options. Older Sparc's work better with only UNROLL, but + there's no way to tell at compile time what it is you're running on */ + +#if defined(__sun) || defined(sun) /* Newer Sparc's */ +#define DES_PTR +#define DES_RISC1 +#define DES_UNROLL +#elif defined(__ultrix) /* Older MIPS */ +#define DES_PTR +#define DES_RISC2 +#define DES_UNROLL +#elif defined(__osf1__) /* Alpha */ +#define DES_PTR +#define DES_RISC2 +#elif defined(_AIX) /* RS6000 */ +/* Unknown */ +#elif defined(__hpux) /* HP-PA */ +/* Unknown */ +#elif defined(__aux) /* 68K */ +/* Unknown */ +#elif defined(__dgux) /* 88K (but P6 in latest boxes) */ +#define DES_UNROLL +#elif defined(__sgi) /* Newer MIPS */ +#define DES_PTR +#define DES_RISC2 +#define DES_UNROLL +#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ +#define DES_PTR +#define DES_RISC1 +#define DES_UNROLL +#endif /* Systems-specific speed defines */ +#endif + +#endif /* DES_DEFAULT_OPTIONS */ +#endif /* HEADER_DES_LOCL_H */ +#ifdef __cplusplus +} +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/opensslv.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/opensslv.h new file mode 100644 index 0000000..248e342 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/opensslv.h @@ -0,0 +1,96 @@ +#ifndef HEADER_OPENSSLV_H +#define HEADER_OPENSSLV_H + +#ifdef __cplusplus +extern "C" { +#endif + +/*- + * Numeric release version identifier: + * MNNFFPPS: major minor fix patch status + * The status nibble has one of the values 0 for development, 1 to e for betas + * 1 to 14, and f for release. The patch level is exactly that. + * For example: + * 0.9.3-dev 0x00903000 + * 0.9.3-beta1 0x00903001 + * 0.9.3-beta2-dev 0x00903002 + * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) + * 0.9.3 0x0090300f + * 0.9.3a 0x0090301f + * 0.9.4 0x0090400f + * 1.2.3z 0x102031af + * + * For continuity reasons (because 0.9.5 is already out, and is coded + * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level + * part is slightly different, by setting the highest bit. This means + * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start + * with 0x0090600S... + * + * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) + * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for + * major minor fix final patch/beta) + */ +#define OPENSSL_VERSION_NUMBER 0x100020ffL +#ifdef OPENSSL_FIPS +#define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2o-fips 27 Mar 2018" +#else +#define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2o 27 Mar 2018" +#endif +#define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT + +/*- + * The macros below are to be used for shared library (.so, .dll, ...) + * versioning. That kind of versioning works a bit differently between + * operating systems. The most usual scheme is to set a major and a minor + * number, and have the runtime loader check that the major number is equal + * to what it was at application link time, while the minor number has to + * be greater or equal to what it was at application link time. With this + * scheme, the version number is usually part of the file name, like this: + * + * libcrypto.so.0.9 + * + * Some unixen also make a softlink with the major verson number only: + * + * libcrypto.so.0 + * + * On Tru64 and IRIX 6.x it works a little bit differently. There, the + * shared library version is stored in the file, and is actually a series + * of versions, separated by colons. The rightmost version present in the + * library when linking an application is stored in the application to be + * matched at run time. When the application is run, a check is done to + * see if the library version stored in the application matches any of the + * versions in the version string of the library itself. + * This version string can be constructed in any way, depending on what + * kind of matching is desired. However, to implement the same scheme as + * the one used in the other unixen, all compatible versions, from lowest + * to highest, should be part of the string. Consecutive builds would + * give the following versions strings: + * + * 3.0 + * 3.0:3.1 + * 3.0:3.1:3.2 + * 4.0 + * 4.0:4.1 + * + * Notice how version 4 is completely incompatible with version, and + * therefore give the breach you can see. + * + * There may be other schemes as well that I haven't yet discovered. + * + * So, here's the way it works here: first of all, the library version + * number doesn't need at all to match the overall OpenSSL version. + * However, it's nice and more understandable if it actually does. + * The current library version is stored in the macro SHLIB_VERSION_NUMBER, + * which is just a piece of text in the format "M.m.e" (Major, minor, edit). + * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways, + * we need to keep a history of version numbers, which is done in the + * macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and + * should only keep the versions that are binary compatible with the current. + */ +#define SHLIB_VERSION_HISTORY "" +#define SHLIB_VERSION_NUMBER "1.0.0" + +#ifdef __cplusplus +} +#endif +#endif /* HEADER_OPENSSLV_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ossl_typ.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ossl_typ.h new file mode 100644 index 0000000..8f75545 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ossl_typ.h @@ -0,0 +1,228 @@ +/* ==================================================================== + * Copyright (c) 1998-2001 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_OPENSSL_TYPES_H +#define HEADER_OPENSSL_TYPES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef NO_ASN1_TYPEDEFS +#define ASN1_INTEGER ASN1_STRING +#define ASN1_ENUMERATED ASN1_STRING +#define ASN1_BIT_STRING ASN1_STRING +#define ASN1_OCTET_STRING ASN1_STRING +#define ASN1_PRINTABLESTRING ASN1_STRING +#define ASN1_T61STRING ASN1_STRING +#define ASN1_IA5STRING ASN1_STRING +#define ASN1_UTCTIME ASN1_STRING +#define ASN1_GENERALIZEDTIME ASN1_STRING +#define ASN1_TIME ASN1_STRING +#define ASN1_GENERALSTRING ASN1_STRING +#define ASN1_UNIVERSALSTRING ASN1_STRING +#define ASN1_BMPSTRING ASN1_STRING +#define ASN1_VISIBLESTRING ASN1_STRING +#define ASN1_UTF8STRING ASN1_STRING +#define ASN1_BOOLEAN int +#define ASN1_NULL int +#else +typedef struct asn1_string_st ASN1_INTEGER; +typedef struct asn1_string_st ASN1_ENUMERATED; +typedef struct asn1_string_st ASN1_BIT_STRING; +typedef struct asn1_string_st ASN1_OCTET_STRING; +typedef struct asn1_string_st ASN1_PRINTABLESTRING; +typedef struct asn1_string_st ASN1_T61STRING; +typedef struct asn1_string_st ASN1_IA5STRING; +typedef struct asn1_string_st ASN1_GENERALSTRING; +typedef struct asn1_string_st ASN1_UNIVERSALSTRING; +typedef struct asn1_string_st ASN1_BMPSTRING; +typedef struct asn1_string_st ASN1_UTCTIME; +typedef struct asn1_string_st ASN1_TIME; +typedef struct asn1_string_st ASN1_GENERALIZEDTIME; +typedef struct asn1_string_st ASN1_VISIBLESTRING; +typedef struct asn1_string_st ASN1_UTF8STRING; +typedef struct asn1_string_st ASN1_STRING; +typedef int ASN1_BOOLEAN; +typedef int ASN1_NULL; +#endif + +typedef struct asn1_object_st ASN1_OBJECT; + +typedef struct ASN1_ITEM_st ASN1_ITEM; +typedef struct asn1_pctx_st ASN1_PCTX; + +#ifdef OPENSSL_SYS_WIN32 +#undef X509_NAME +#undef X509_EXTENSIONS +#undef X509_CERT_PAIR +#undef PKCS7_ISSUER_AND_SERIAL +#undef OCSP_REQUEST +#undef OCSP_RESPONSE +#endif + +#ifdef BIGNUM +#undef BIGNUM +#endif +typedef struct bignum_st BIGNUM; +typedef struct bignum_ctx BN_CTX; +typedef struct bn_blinding_st BN_BLINDING; +typedef struct bn_mont_ctx_st BN_MONT_CTX; +typedef struct bn_recp_ctx_st BN_RECP_CTX; +typedef struct bn_gencb_st BN_GENCB; + +typedef struct buf_mem_st BUF_MEM; + +typedef struct evp_cipher_st EVP_CIPHER; +typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX; +typedef struct env_md_st EVP_MD; +typedef struct env_md_ctx_st EVP_MD_CTX; +typedef struct evp_pkey_st EVP_PKEY; + +typedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD; + +typedef struct evp_pkey_method_st EVP_PKEY_METHOD; +typedef struct evp_pkey_ctx_st EVP_PKEY_CTX; + +typedef struct dh_st DH; +typedef struct dh_method DH_METHOD; + +typedef struct dsa_st DSA; +typedef struct dsa_method DSA_METHOD; + +typedef struct rsa_st RSA; +typedef struct rsa_meth_st RSA_METHOD; + +typedef struct rand_meth_st RAND_METHOD; + +typedef struct ecdh_method ECDH_METHOD; +typedef struct ecdsa_method ECDSA_METHOD; + +typedef struct x509_st X509; +typedef struct X509_algor_st X509_ALGOR; +typedef struct X509_crl_st X509_CRL; +typedef struct x509_crl_method_st X509_CRL_METHOD; +typedef struct x509_revoked_st X509_REVOKED; +typedef struct X509_name_st X509_NAME; +typedef struct X509_pubkey_st X509_PUBKEY; +typedef struct x509_store_st X509_STORE; +typedef struct x509_store_ctx_st X509_STORE_CTX; + +typedef struct pkcs8_priv_key_info_st PKCS8_PRIV_KEY_INFO; + +typedef struct v3_ext_ctx X509V3_CTX; +typedef struct conf_st CONF; + +typedef struct store_st STORE; +typedef struct store_method_st STORE_METHOD; + +typedef struct ui_st UI; +typedef struct ui_method_st UI_METHOD; + +typedef struct st_ERR_FNS ERR_FNS; + +typedef struct engine_st ENGINE; +typedef struct ssl_st SSL; +typedef struct ssl_ctx_st SSL_CTX; + +typedef struct comp_method_st COMP_METHOD; + +typedef struct X509_POLICY_NODE_st X509_POLICY_NODE; +typedef struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL; +typedef struct X509_POLICY_TREE_st X509_POLICY_TREE; +typedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE; + +typedef struct AUTHORITY_KEYID_st AUTHORITY_KEYID; +typedef struct DIST_POINT_st DIST_POINT; +typedef struct ISSUING_DIST_POINT_st ISSUING_DIST_POINT; +typedef struct NAME_CONSTRAINTS_st NAME_CONSTRAINTS; + +/* If placed in pkcs12.h, we end up with a circular depency with pkcs7.h */ +#define DECLARE_PKCS12_STACK_OF(type) /* Nothing */ +#define IMPLEMENT_PKCS12_STACK_OF(type) /* Nothing */ + +typedef struct crypto_ex_data_st CRYPTO_EX_DATA; +/* Callback types for crypto.h */ +typedef int CRYPTO_EX_new( + void* parent, + void* ptr, + CRYPTO_EX_DATA* ad, + int idx, + long argl, + void* argp); +typedef void CRYPTO_EX_free( + void* parent, + void* ptr, + CRYPTO_EX_DATA* ad, + int idx, + long argl, + void* argp); +typedef int CRYPTO_EX_dup( + CRYPTO_EX_DATA* to, + CRYPTO_EX_DATA* from, + void* from_d, + int idx, + long argl, + void* argp); + +typedef struct ocsp_req_ctx_st OCSP_REQ_CTX; +typedef struct ocsp_response_st OCSP_RESPONSE; +typedef struct ocsp_responder_id_st OCSP_RESPID; + +#ifdef __cplusplus +} +#endif +#endif /* def HEADER_OPENSSL_TYPES_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/pem.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/pem.h new file mode 100644 index 0000000..b0fd856 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/pem.h @@ -0,0 +1,782 @@ +/* crypto/pem/pem.h */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_PEM_H +#define HEADER_PEM_H + +#include +#ifndef OPENSSL_NO_BIO +#include +#endif +#ifndef OPENSSL_NO_STACK +#include +#endif +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define PEM_BUFSIZE 1024 + +#define PEM_OBJ_UNDEF 0 +#define PEM_OBJ_X509 1 +#define PEM_OBJ_X509_REQ 2 +#define PEM_OBJ_CRL 3 +#define PEM_OBJ_SSL_SESSION 4 +#define PEM_OBJ_PRIV_KEY 10 +#define PEM_OBJ_PRIV_RSA 11 +#define PEM_OBJ_PRIV_DSA 12 +#define PEM_OBJ_PRIV_DH 13 +#define PEM_OBJ_PUB_RSA 14 +#define PEM_OBJ_PUB_DSA 15 +#define PEM_OBJ_PUB_DH 16 +#define PEM_OBJ_DHPARAMS 17 +#define PEM_OBJ_DSAPARAMS 18 +#define PEM_OBJ_PRIV_RSA_PUBLIC 19 +#define PEM_OBJ_PRIV_ECDSA 20 +#define PEM_OBJ_PUB_ECDSA 21 +#define PEM_OBJ_ECPARAMETERS 22 + +#define PEM_ERROR 30 +#define PEM_DEK_DES_CBC 40 +#define PEM_DEK_IDEA_CBC 45 +#define PEM_DEK_DES_EDE 50 +#define PEM_DEK_DES_ECB 60 +#define PEM_DEK_RSA 70 +#define PEM_DEK_RSA_MD2 80 +#define PEM_DEK_RSA_MD5 90 + +#define PEM_MD_MD2 NID_md2 +#define PEM_MD_MD5 NID_md5 +#define PEM_MD_SHA NID_sha +#define PEM_MD_MD2_RSA NID_md2WithRSAEncryption +#define PEM_MD_MD5_RSA NID_md5WithRSAEncryption +#define PEM_MD_SHA_RSA NID_sha1WithRSAEncryption + +#define PEM_STRING_X509_OLD "X509 CERTIFICATE" +#define PEM_STRING_X509 "CERTIFICATE" +#define PEM_STRING_X509_PAIR "CERTIFICATE PAIR" +#define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE" +#define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" +#define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" +#define PEM_STRING_X509_CRL "X509 CRL" +#define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY" +#define PEM_STRING_PUBLIC "PUBLIC KEY" +#define PEM_STRING_RSA "RSA PRIVATE KEY" +#define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY" +#define PEM_STRING_DSA "DSA PRIVATE KEY" +#define PEM_STRING_DSA_PUBLIC "DSA PUBLIC KEY" +#define PEM_STRING_PKCS7 "PKCS7" +#define PEM_STRING_PKCS7_SIGNED "PKCS #7 SIGNED DATA" +#define PEM_STRING_PKCS8 "ENCRYPTED PRIVATE KEY" +#define PEM_STRING_PKCS8INF "PRIVATE KEY" +#define PEM_STRING_DHPARAMS "DH PARAMETERS" +#define PEM_STRING_DHXPARAMS "X9.42 DH PARAMETERS" +#define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS" +#define PEM_STRING_DSAPARAMS "DSA PARAMETERS" +#define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY" +#define PEM_STRING_ECPARAMETERS "EC PARAMETERS" +#define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY" +#define PEM_STRING_PARAMETERS "PARAMETERS" +#define PEM_STRING_CMS "CMS" + +/* + * Note that this structure is initialised by PEM_SealInit and cleaned up + * by PEM_SealFinal (at least for now) + */ +typedef struct PEM_Encode_Seal_st { + EVP_ENCODE_CTX encode; + EVP_MD_CTX md; + EVP_CIPHER_CTX cipher; +} PEM_ENCODE_SEAL_CTX; + +/* enc_type is one off */ +#define PEM_TYPE_ENCRYPTED 10 +#define PEM_TYPE_MIC_ONLY 20 +#define PEM_TYPE_MIC_CLEAR 30 +#define PEM_TYPE_CLEAR 40 + +typedef struct pem_recip_st { + char* name; + X509_NAME* dn; + int cipher; + int key_enc; + /* char iv[8]; unused and wrong size */ +} PEM_USER; + +typedef struct pem_ctx_st { + int type; /* what type of object */ + struct { + int version; + int mode; + } proc_type; + + char* domain; + + struct { + int cipher; + /*- + unused, and wrong size + unsigned char iv[8]; */ + } DEK_info; + + PEM_USER* originator; + + int num_recipient; + PEM_USER** recipient; + /*- + XXX(ben): don#t think this is used! + STACK *x509_chain; / * certificate chain */ + EVP_MD* md; /* signature type */ + + int md_enc; /* is the md encrypted or not? */ + int md_len; /* length of md_data */ + char* md_data; /* message digest, could be pkey encrypted */ + + EVP_CIPHER* dec; /* date encryption cipher */ + int key_len; /* key length */ + unsigned char* key; /* key */ + /*- + unused, and wrong size + unsigned char iv[8]; */ + + int data_enc; /* is the data encrypted */ + int data_len; + unsigned char* data; +} PEM_CTX; + +/* + * These macros make the PEM_read/PEM_write functions easier to maintain and + * write. Now they are all implemented with either: IMPLEMENT_PEM_rw(...) or + * IMPLEMENT_PEM_rw_cb(...) + */ + +#ifdef OPENSSL_NO_FP_API + +#define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/ +#define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/ +#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) /**/ +#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/ +#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) /**/ +#else + +#define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \ + type* PEM_read_##name(FILE* fp, type** x, pem_password_cb* cb, void* u) { \ + return PEM_ASN1_read((d2i_of_void*)d2i_##asn1, str, fp, (void**)x, cb, u); \ + } + +#define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \ + int PEM_write_##name(FILE* fp, type* x) { \ + return PEM_ASN1_write( \ + (i2d_of_void*)i2d_##asn1, str, fp, x, NULL, NULL, 0, NULL, NULL); \ + } + +#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \ + int PEM_write_##name(FILE* fp, const type* x) { \ + return PEM_ASN1_write( \ + (i2d_of_void*)i2d_##asn1, \ + str, \ + fp, \ + (void*)x, \ + NULL, \ + NULL, \ + 0, \ + NULL, \ + NULL); \ + } + +#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \ + int PEM_write_##name( \ + FILE* fp, \ + type* x, \ + const EVP_CIPHER* enc, \ + unsigned char* kstr, \ + int klen, \ + pem_password_cb* cb, \ + void* u) { \ + return PEM_ASN1_write( \ + (i2d_of_void*)i2d_##asn1, str, fp, x, enc, kstr, klen, cb, u); \ + } + +#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \ + int PEM_write_##name( \ + FILE* fp, \ + type* x, \ + const EVP_CIPHER* enc, \ + unsigned char* kstr, \ + int klen, \ + pem_password_cb* cb, \ + void* u) { \ + return PEM_ASN1_write( \ + (i2d_of_void*)i2d_##asn1, str, fp, x, enc, kstr, klen, cb, u); \ + } + +#endif + +#define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ + type* PEM_read_bio_##name(BIO* bp, type** x, pem_password_cb* cb, void* u) { \ + return PEM_ASN1_read_bio( \ + (d2i_of_void*)d2i_##asn1, str, bp, (void**)x, cb, u); \ + } + +#define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ + int PEM_write_bio_##name(BIO* bp, type* x) { \ + return PEM_ASN1_write_bio( \ + (i2d_of_void*)i2d_##asn1, str, bp, x, NULL, NULL, 0, NULL, NULL); \ + } + +#define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ + int PEM_write_bio_##name(BIO* bp, const type* x) { \ + return PEM_ASN1_write_bio( \ + (i2d_of_void*)i2d_##asn1, \ + str, \ + bp, \ + (void*)x, \ + NULL, \ + NULL, \ + 0, \ + NULL, \ + NULL); \ + } + +#define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ + int PEM_write_bio_##name( \ + BIO* bp, \ + type* x, \ + const EVP_CIPHER* enc, \ + unsigned char* kstr, \ + int klen, \ + pem_password_cb* cb, \ + void* u) { \ + return PEM_ASN1_write_bio( \ + (i2d_of_void*)i2d_##asn1, str, bp, x, enc, kstr, klen, cb, u); \ + } + +#define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ + int PEM_write_bio_##name( \ + BIO* bp, \ + type* x, \ + const EVP_CIPHER* enc, \ + unsigned char* kstr, \ + int klen, \ + pem_password_cb* cb, \ + void* u) { \ + return PEM_ASN1_write_bio( \ + (i2d_of_void*)i2d_##asn1, str, bp, (void*)x, enc, kstr, klen, cb, u); \ + } + +#define IMPLEMENT_PEM_write(name, type, str, asn1) \ + IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ + IMPLEMENT_PEM_write_fp(name, type, str, asn1) + +#define IMPLEMENT_PEM_write_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) + +#define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) + +#define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) + +#define IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ + IMPLEMENT_PEM_read_fp(name, type, str, asn1) + +#define IMPLEMENT_PEM_rw(name, type, str, asn1) \ + IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_write(name, type, str, asn1) + +#define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \ + IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_write_const(name, type, str, asn1) + +#define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \ + IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb(name, type, str, asn1) + +/* These are the same except they are for the declarations */ + +#if defined(OPENSSL_NO_FP_API) + +#define DECLARE_PEM_read_fp(name, type) /**/ +#define DECLARE_PEM_write_fp(name, type) /**/ +#define DECLARE_PEM_write_cb_fp(name, type) /**/ +#else + +#define DECLARE_PEM_read_fp(name, type) \ + type* PEM_read_##name(FILE* fp, type** x, pem_password_cb* cb, void* u); + +#define DECLARE_PEM_write_fp(name, type) \ + int PEM_write_##name(FILE* fp, type* x); + +#define DECLARE_PEM_write_fp_const(name, type) \ + int PEM_write_##name(FILE* fp, const type* x); + +#define DECLARE_PEM_write_cb_fp(name, type) \ + int PEM_write_##name( \ + FILE* fp, \ + type* x, \ + const EVP_CIPHER* enc, \ + unsigned char* kstr, \ + int klen, \ + pem_password_cb* cb, \ + void* u); + +#endif + +#ifndef OPENSSL_NO_BIO +#define DECLARE_PEM_read_bio(name, type) \ + type* PEM_read_bio_##name(BIO* bp, type** x, pem_password_cb* cb, void* u); + +#define DECLARE_PEM_write_bio(name, type) \ + int PEM_write_bio_##name(BIO* bp, type* x); + +#define DECLARE_PEM_write_bio_const(name, type) \ + int PEM_write_bio_##name(BIO* bp, const type* x); + +#define DECLARE_PEM_write_cb_bio(name, type) \ + int PEM_write_bio_##name( \ + BIO* bp, \ + type* x, \ + const EVP_CIPHER* enc, \ + unsigned char* kstr, \ + int klen, \ + pem_password_cb* cb, \ + void* u); + +#else + +#define DECLARE_PEM_read_bio(name, type) /**/ +#define DECLARE_PEM_write_bio(name, type) /**/ +#define DECLARE_PEM_write_bio_const(name, type) /**/ +#define DECLARE_PEM_write_cb_bio(name, type) /**/ +#endif +#define DECLARE_PEM_write(name, type) \ + DECLARE_PEM_write_bio(name, type) DECLARE_PEM_write_fp(name, type) +#define DECLARE_PEM_write_const(name, type) \ + DECLARE_PEM_write_bio_const(name, type) DECLARE_PEM_write_fp_const(name, type) +#define DECLARE_PEM_write_cb(name, type) \ + DECLARE_PEM_write_cb_bio(name, type) DECLARE_PEM_write_cb_fp(name, type) +#define DECLARE_PEM_read(name, type) \ + DECLARE_PEM_read_bio(name, type) DECLARE_PEM_read_fp(name, type) +#define DECLARE_PEM_rw(name, type) \ + DECLARE_PEM_read(name, type) DECLARE_PEM_write(name, type) +#define DECLARE_PEM_rw_const(name, type) \ + DECLARE_PEM_read(name, type) DECLARE_PEM_write_const(name, type) +#define DECLARE_PEM_rw_cb(name, type) \ + DECLARE_PEM_read(name, type) DECLARE_PEM_write_cb(name, type) +#if 1 +/* "userdata": new with OpenSSL 0.9.4 */ +typedef int pem_password_cb(char* buf, int size, int rwflag, void* userdata); +#else +/* OpenSSL 0.9.3, 0.9.3a */ +typedef int pem_password_cb(char* buf, int size, int rwflag); +#endif + +int PEM_get_EVP_CIPHER_INFO(char* header, EVP_CIPHER_INFO* cipher); +int PEM_do_header( + EVP_CIPHER_INFO* cipher, + unsigned char* data, + long* len, + pem_password_cb* callback, + void* u); + +#ifndef OPENSSL_NO_BIO +int PEM_read_bio( + BIO* bp, + char** name, + char** header, + unsigned char** data, + long* len); +int PEM_write_bio( + BIO* bp, + const char* name, + const char* hdr, + const unsigned char* data, + long len); +int PEM_bytes_read_bio( + unsigned char** pdata, + long* plen, + char** pnm, + const char* name, + BIO* bp, + pem_password_cb* cb, + void* u); +void* PEM_ASN1_read_bio( + d2i_of_void* d2i, + const char* name, + BIO* bp, + void** x, + pem_password_cb* cb, + void* u); +int PEM_ASN1_write_bio( + i2d_of_void* i2d, + const char* name, + BIO* bp, + void* x, + const EVP_CIPHER* enc, + unsigned char* kstr, + int klen, + pem_password_cb* cb, + void* u); + +STACK_OF(X509_INFO) * PEM_X509_INFO_read_bio( + BIO* bp, + STACK_OF(X509_INFO) * sk, + pem_password_cb* cb, + void* u); +int PEM_X509_INFO_write_bio( + BIO* bp, + X509_INFO* xi, + EVP_CIPHER* enc, + unsigned char* kstr, + int klen, + pem_password_cb* cd, + void* u); +#endif + +int PEM_read( + FILE* fp, + char** name, + char** header, + unsigned char** data, + long* len); +int PEM_write( + FILE* fp, + const char* name, + const char* hdr, + const unsigned char* data, + long len); +void* PEM_ASN1_read( + d2i_of_void* d2i, + const char* name, + FILE* fp, + void** x, + pem_password_cb* cb, + void* u); +int PEM_ASN1_write( + i2d_of_void* i2d, + const char* name, + FILE* fp, + void* x, + const EVP_CIPHER* enc, + unsigned char* kstr, + int klen, + pem_password_cb* callback, + void* u); +STACK_OF(X509_INFO) * PEM_X509_INFO_read( + FILE* fp, + STACK_OF(X509_INFO) * sk, + pem_password_cb* cb, + void* u); + +int PEM_SealInit( + PEM_ENCODE_SEAL_CTX* ctx, + EVP_CIPHER* type, + EVP_MD* md_type, + unsigned char** ek, + int* ekl, + unsigned char* iv, + EVP_PKEY** pubk, + int npubk); +void PEM_SealUpdate( + PEM_ENCODE_SEAL_CTX* ctx, + unsigned char* out, + int* outl, + unsigned char* in, + int inl); +int PEM_SealFinal( + PEM_ENCODE_SEAL_CTX* ctx, + unsigned char* sig, + int* sigl, + unsigned char* out, + int* outl, + EVP_PKEY* priv); + +void PEM_SignInit(EVP_MD_CTX* ctx, EVP_MD* type); +void PEM_SignUpdate(EVP_MD_CTX* ctx, unsigned char* d, unsigned int cnt); +int PEM_SignFinal( + EVP_MD_CTX* ctx, + unsigned char* sigret, + unsigned int* siglen, + EVP_PKEY* pkey); + +int PEM_def_callback(char* buf, int num, int w, void* key); +void PEM_proc_type(char* buf, int type); +void PEM_dek_info(char* buf, const char* type, int len, char* str); + +#include + +DECLARE_PEM_rw(X509, X509) DECLARE_PEM_rw(X509_AUX, X509) DECLARE_PEM_rw( + X509_CERT_PAIR, + X509_CERT_PAIR) DECLARE_PEM_rw(X509_REQ, X509_REQ) + DECLARE_PEM_write(X509_REQ_NEW, X509_REQ) DECLARE_PEM_rw(X509_CRL, X509_CRL) + DECLARE_PEM_rw(PKCS7, PKCS7) DECLARE_PEM_rw( + NETSCAPE_CERT_SEQUENCE, + NETSCAPE_CERT_SEQUENCE) DECLARE_PEM_rw(PKCS8, X509_SIG) + DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) +#ifndef OPENSSL_NO_RSA + DECLARE_PEM_rw_cb(RSAPrivateKey, RSA) DECLARE_PEM_rw_const( + RSAPublicKey, + RSA) DECLARE_PEM_rw(RSA_PUBKEY, RSA) +#endif +#ifndef OPENSSL_NO_DSA + DECLARE_PEM_rw_cb(DSAPrivateKey, DSA) DECLARE_PEM_rw( + DSA_PUBKEY, + DSA) DECLARE_PEM_rw_const(DSAparams, DSA) +#endif +#ifndef OPENSSL_NO_EC + DECLARE_PEM_rw_const( + ECPKParameters, + EC_GROUP) DECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY) + DECLARE_PEM_rw(EC_PUBKEY, EC_KEY) +#endif +#ifndef OPENSSL_NO_DH + DECLARE_PEM_rw_const( + DHparams, + DH) DECLARE_PEM_write_const(DHxparams, DH) +#endif + DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY) + DECLARE_PEM_rw(PUBKEY, EVP_PKEY) + + int PEM_write_bio_PKCS8PrivateKey_nid( + BIO* bp, + EVP_PKEY* x, + int nid, + char* kstr, + int klen, + pem_password_cb* cb, + void* u); +int PEM_write_bio_PKCS8PrivateKey( + BIO*, + EVP_PKEY*, + const EVP_CIPHER*, + char*, + int, + pem_password_cb*, + void*); +int i2d_PKCS8PrivateKey_bio( + BIO* bp, + EVP_PKEY* x, + const EVP_CIPHER* enc, + char* kstr, + int klen, + pem_password_cb* cb, + void* u); +int i2d_PKCS8PrivateKey_nid_bio( + BIO* bp, + EVP_PKEY* x, + int nid, + char* kstr, + int klen, + pem_password_cb* cb, + void* u); +EVP_PKEY* +d2i_PKCS8PrivateKey_bio(BIO* bp, EVP_PKEY** x, pem_password_cb* cb, void* u); + +int i2d_PKCS8PrivateKey_fp( + FILE* fp, + EVP_PKEY* x, + const EVP_CIPHER* enc, + char* kstr, + int klen, + pem_password_cb* cb, + void* u); +int i2d_PKCS8PrivateKey_nid_fp( + FILE* fp, + EVP_PKEY* x, + int nid, + char* kstr, + int klen, + pem_password_cb* cb, + void* u); +int PEM_write_PKCS8PrivateKey_nid( + FILE* fp, + EVP_PKEY* x, + int nid, + char* kstr, + int klen, + pem_password_cb* cb, + void* u); + +EVP_PKEY* +d2i_PKCS8PrivateKey_fp(FILE* fp, EVP_PKEY** x, pem_password_cb* cb, void* u); + +int PEM_write_PKCS8PrivateKey( + FILE* fp, + EVP_PKEY* x, + const EVP_CIPHER* enc, + char* kstr, + int klen, + pem_password_cb* cd, + void* u); + +EVP_PKEY* PEM_read_bio_Parameters(BIO* bp, EVP_PKEY** x); +int PEM_write_bio_Parameters(BIO* bp, EVP_PKEY* x); + +EVP_PKEY* b2i_PrivateKey(const unsigned char** in, long length); +EVP_PKEY* b2i_PublicKey(const unsigned char** in, long length); +EVP_PKEY* b2i_PrivateKey_bio(BIO* in); +EVP_PKEY* b2i_PublicKey_bio(BIO* in); +int i2b_PrivateKey_bio(BIO* out, EVP_PKEY* pk); +int i2b_PublicKey_bio(BIO* out, EVP_PKEY* pk); +#ifndef OPENSSL_NO_RC4 +EVP_PKEY* b2i_PVK_bio(BIO* in, pem_password_cb* cb, void* u); +int i2b_PVK_bio( + BIO* out, + EVP_PKEY* pk, + int enclevel, + pem_password_cb* cb, + void* u); +#endif + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ + +void ERR_load_PEM_strings(void); + +/* Error codes for the PEM functions. */ + +/* Function codes. */ +#define PEM_F_B2I_DSS 127 +#define PEM_F_B2I_PVK_BIO 128 +#define PEM_F_B2I_RSA 129 +#define PEM_F_CHECK_BITLEN_DSA 130 +#define PEM_F_CHECK_BITLEN_RSA 131 +#define PEM_F_D2I_PKCS8PRIVATEKEY_BIO 120 +#define PEM_F_D2I_PKCS8PRIVATEKEY_FP 121 +#define PEM_F_DO_B2I 132 +#define PEM_F_DO_B2I_BIO 133 +#define PEM_F_DO_BLOB_HEADER 134 +#define PEM_F_DO_PK8PKEY 126 +#define PEM_F_DO_PK8PKEY_FP 125 +#define PEM_F_DO_PVK_BODY 135 +#define PEM_F_DO_PVK_HEADER 136 +#define PEM_F_I2B_PVK 137 +#define PEM_F_I2B_PVK_BIO 138 +#define PEM_F_LOAD_IV 101 +#define PEM_F_PEM_ASN1_READ 102 +#define PEM_F_PEM_ASN1_READ_BIO 103 +#define PEM_F_PEM_ASN1_WRITE 104 +#define PEM_F_PEM_ASN1_WRITE_BIO 105 +#define PEM_F_PEM_DEF_CALLBACK 100 +#define PEM_F_PEM_DO_HEADER 106 +#define PEM_F_PEM_F_PEM_WRITE_PKCS8PRIVATEKEY 118 +#define PEM_F_PEM_GET_EVP_CIPHER_INFO 107 +#define PEM_F_PEM_PK8PKEY 119 +#define PEM_F_PEM_READ 108 +#define PEM_F_PEM_READ_BIO 109 +#define PEM_F_PEM_READ_BIO_DHPARAMS 141 +#define PEM_F_PEM_READ_BIO_PARAMETERS 140 +#define PEM_F_PEM_READ_BIO_PRIVATEKEY 123 +#define PEM_F_PEM_READ_DHPARAMS 142 +#define PEM_F_PEM_READ_PRIVATEKEY 124 +#define PEM_F_PEM_SEALFINAL 110 +#define PEM_F_PEM_SEALINIT 111 +#define PEM_F_PEM_SIGNFINAL 112 +#define PEM_F_PEM_WRITE 113 +#define PEM_F_PEM_WRITE_BIO 114 +#define PEM_F_PEM_WRITE_PRIVATEKEY 139 +#define PEM_F_PEM_X509_INFO_READ 115 +#define PEM_F_PEM_X509_INFO_READ_BIO 116 +#define PEM_F_PEM_X509_INFO_WRITE_BIO 117 + +/* Reason codes. */ +#define PEM_R_BAD_BASE64_DECODE 100 +#define PEM_R_BAD_DECRYPT 101 +#define PEM_R_BAD_END_LINE 102 +#define PEM_R_BAD_IV_CHARS 103 +#define PEM_R_BAD_MAGIC_NUMBER 116 +#define PEM_R_BAD_PASSWORD_READ 104 +#define PEM_R_BAD_VERSION_NUMBER 117 +#define PEM_R_BIO_WRITE_FAILURE 118 +#define PEM_R_CIPHER_IS_NULL 127 +#define PEM_R_ERROR_CONVERTING_PRIVATE_KEY 115 +#define PEM_R_EXPECTING_PRIVATE_KEY_BLOB 119 +#define PEM_R_EXPECTING_PUBLIC_KEY_BLOB 120 +#define PEM_R_HEADER_TOO_LONG 128 +#define PEM_R_INCONSISTENT_HEADER 121 +#define PEM_R_KEYBLOB_HEADER_PARSE_ERROR 122 +#define PEM_R_KEYBLOB_TOO_SHORT 123 +#define PEM_R_NOT_DEK_INFO 105 +#define PEM_R_NOT_ENCRYPTED 106 +#define PEM_R_NOT_PROC_TYPE 107 +#define PEM_R_NO_START_LINE 108 +#define PEM_R_PROBLEMS_GETTING_PASSWORD 109 +#define PEM_R_PUBLIC_KEY_NO_RSA 110 +#define PEM_R_PVK_DATA_TOO_SHORT 124 +#define PEM_R_PVK_TOO_SHORT 125 +#define PEM_R_READ_KEY 111 +#define PEM_R_SHORT_HEADER 112 +#define PEM_R_UNSUPPORTED_CIPHER 113 +#define PEM_R_UNSUPPORTED_ENCRYPTION 114 +#define PEM_R_UNSUPPORTED_KEY_COMPONENTS 126 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/pem2.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/pem2.h new file mode 100644 index 0000000..84897d5 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/pem2.h @@ -0,0 +1,70 @@ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +/* + * This header only exists to break a circular dependency between pem and err + * Ben 30 Jan 1999. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef HEADER_PEM_H +void ERR_load_PEM_strings(void); +#endif + +#ifdef __cplusplus +} +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/pkcs12.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/pkcs12.h new file mode 100644 index 0000000..13c2df3 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/pkcs12.h @@ -0,0 +1,425 @@ +/* pkcs12.h */ +/* + * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project + * 1999. + */ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_PKCS12_H +#define HEADER_PKCS12_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define PKCS12_KEY_ID 1 +#define PKCS12_IV_ID 2 +#define PKCS12_MAC_ID 3 + +/* Default iteration count */ +#ifndef PKCS12_DEFAULT_ITER +#define PKCS12_DEFAULT_ITER PKCS5_DEFAULT_ITER +#endif + +#define PKCS12_MAC_KEY_LENGTH 20 + +#define PKCS12_SALT_LEN 8 + +/* Uncomment out next line for unicode password and names, otherwise ASCII */ + +/* + * #define PBE_UNICODE + */ + +#ifdef PBE_UNICODE +#define PKCS12_key_gen PKCS12_key_gen_uni +#define PKCS12_add_friendlyname PKCS12_add_friendlyname_uni +#else +#define PKCS12_key_gen PKCS12_key_gen_asc +#define PKCS12_add_friendlyname PKCS12_add_friendlyname_asc +#endif + +/* MS key usage constants */ + +#define KEY_EX 0x10 +#define KEY_SIG 0x80 + +typedef struct { + X509_SIG* dinfo; + ASN1_OCTET_STRING* salt; + ASN1_INTEGER* iter; /* defaults to 1 */ +} PKCS12_MAC_DATA; + +typedef struct { + ASN1_INTEGER* version; + PKCS12_MAC_DATA* mac; + PKCS7* authsafes; +} PKCS12; + +typedef struct { + ASN1_OBJECT* type; + union { + struct pkcs12_bag_st* bag; /* secret, crl and certbag */ + struct pkcs8_priv_key_info_st* keybag; /* keybag */ + X509_SIG* shkeybag; /* shrouded key bag */ + STACK_OF(PKCS12_SAFEBAG) * safes; + ASN1_TYPE* other; + } value; + STACK_OF(X509_ATTRIBUTE) * attrib; +} PKCS12_SAFEBAG; + +DECLARE_STACK_OF(PKCS12_SAFEBAG) +DECLARE_ASN1_SET_OF(PKCS12_SAFEBAG) +DECLARE_PKCS12_STACK_OF(PKCS12_SAFEBAG) + +typedef struct pkcs12_bag_st { + ASN1_OBJECT* type; + union { + ASN1_OCTET_STRING* x509cert; + ASN1_OCTET_STRING* x509crl; + ASN1_OCTET_STRING* octet; + ASN1_IA5STRING* sdsicert; + ASN1_TYPE* other; /* Secret or other bag */ + } value; +} PKCS12_BAGS; + +#define PKCS12_ERROR 0 +#define PKCS12_OK 1 + +/* Compatibility macros */ + +#define M_PKCS12_x5092certbag PKCS12_x5092certbag +#define M_PKCS12_x509crl2certbag PKCS12_x509crl2certbag + +#define M_PKCS12_certbag2x509 PKCS12_certbag2x509 +#define M_PKCS12_certbag2x509crl PKCS12_certbag2x509crl + +#define M_PKCS12_unpack_p7data PKCS12_unpack_p7data +#define M_PKCS12_pack_authsafes PKCS12_pack_authsafes +#define M_PKCS12_unpack_authsafes PKCS12_unpack_authsafes +#define M_PKCS12_unpack_p7encdata PKCS12_unpack_p7encdata + +#define M_PKCS12_decrypt_skey PKCS12_decrypt_skey +#define M_PKCS8_decrypt PKCS8_decrypt + +#define M_PKCS12_bag_type(bg) OBJ_obj2nid((bg)->type) +#define M_PKCS12_cert_bag_type(bg) OBJ_obj2nid((bg)->value.bag->type) +#define M_PKCS12_crl_bag_type M_PKCS12_cert_bag_type + +#define PKCS12_get_attr(bag, attr_nid) \ + PKCS12_get_attr_gen(bag->attrib, attr_nid) + +#define PKCS8_get_attr(p8, attr_nid) \ + PKCS12_get_attr_gen(p8->attributes, attr_nid) + +#define PKCS12_mac_present(p12) ((p12)->mac ? 1 : 0) + +PKCS12_SAFEBAG* PKCS12_x5092certbag(X509* x509); +PKCS12_SAFEBAG* PKCS12_x509crl2certbag(X509_CRL* crl); +X509* PKCS12_certbag2x509(PKCS12_SAFEBAG* bag); +X509_CRL* PKCS12_certbag2x509crl(PKCS12_SAFEBAG* bag); + +PKCS12_SAFEBAG* +PKCS12_item_pack_safebag(void* obj, const ASN1_ITEM* it, int nid1, int nid2); +PKCS12_SAFEBAG* PKCS12_MAKE_KEYBAG(PKCS8_PRIV_KEY_INFO* p8); +PKCS8_PRIV_KEY_INFO* PKCS8_decrypt(X509_SIG* p8, const char* pass, int passlen); +PKCS8_PRIV_KEY_INFO* +PKCS12_decrypt_skey(PKCS12_SAFEBAG* bag, const char* pass, int passlen); +X509_SIG* PKCS8_encrypt( + int pbe_nid, + const EVP_CIPHER* cipher, + const char* pass, + int passlen, + unsigned char* salt, + int saltlen, + int iter, + PKCS8_PRIV_KEY_INFO* p8); +PKCS12_SAFEBAG* PKCS12_MAKE_SHKEYBAG( + int pbe_nid, + const char* pass, + int passlen, + unsigned char* salt, + int saltlen, + int iter, + PKCS8_PRIV_KEY_INFO* p8); +PKCS7* PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) * sk); +STACK_OF(PKCS12_SAFEBAG) * PKCS12_unpack_p7data(PKCS7* p7); +PKCS7* PKCS12_pack_p7encdata( + int pbe_nid, + const char* pass, + int passlen, + unsigned char* salt, + int saltlen, + int iter, + STACK_OF(PKCS12_SAFEBAG) * bags); +STACK_OF(PKCS12_SAFEBAG) * + PKCS12_unpack_p7encdata(PKCS7* p7, const char* pass, int passlen); + +int PKCS12_pack_authsafes(PKCS12* p12, STACK_OF(PKCS7) * safes); +STACK_OF(PKCS7) * PKCS12_unpack_authsafes(PKCS12* p12); + +int PKCS12_add_localkeyid( + PKCS12_SAFEBAG* bag, + unsigned char* name, + int namelen); +int PKCS12_add_friendlyname_asc( + PKCS12_SAFEBAG* bag, + const char* name, + int namelen); +int PKCS12_add_CSPName_asc(PKCS12_SAFEBAG* bag, const char* name, int namelen); +int PKCS12_add_friendlyname_uni( + PKCS12_SAFEBAG* bag, + const unsigned char* name, + int namelen); +int PKCS8_add_keyusage(PKCS8_PRIV_KEY_INFO* p8, int usage); +ASN1_TYPE* PKCS12_get_attr_gen(STACK_OF(X509_ATTRIBUTE) * attrs, int attr_nid); +char* PKCS12_get_friendlyname(PKCS12_SAFEBAG* bag); +unsigned char* PKCS12_pbe_crypt( + X509_ALGOR* algor, + const char* pass, + int passlen, + unsigned char* in, + int inlen, + unsigned char** data, + int* datalen, + int en_de); +void* PKCS12_item_decrypt_d2i( + X509_ALGOR* algor, + const ASN1_ITEM* it, + const char* pass, + int passlen, + ASN1_OCTET_STRING* oct, + int zbuf); +ASN1_OCTET_STRING* PKCS12_item_i2d_encrypt( + X509_ALGOR* algor, + const ASN1_ITEM* it, + const char* pass, + int passlen, + void* obj, + int zbuf); +PKCS12* PKCS12_init(int mode); +int PKCS12_key_gen_asc( + const char* pass, + int passlen, + unsigned char* salt, + int saltlen, + int id, + int iter, + int n, + unsigned char* out, + const EVP_MD* md_type); +int PKCS12_key_gen_uni( + unsigned char* pass, + int passlen, + unsigned char* salt, + int saltlen, + int id, + int iter, + int n, + unsigned char* out, + const EVP_MD* md_type); +int PKCS12_PBE_keyivgen( + EVP_CIPHER_CTX* ctx, + const char* pass, + int passlen, + ASN1_TYPE* param, + const EVP_CIPHER* cipher, + const EVP_MD* md_type, + int en_de); +int PKCS12_gen_mac( + PKCS12* p12, + const char* pass, + int passlen, + unsigned char* mac, + unsigned int* maclen); +int PKCS12_verify_mac(PKCS12* p12, const char* pass, int passlen); +int PKCS12_set_mac( + PKCS12* p12, + const char* pass, + int passlen, + unsigned char* salt, + int saltlen, + int iter, + const EVP_MD* md_type); +int PKCS12_setup_mac( + PKCS12* p12, + int iter, + unsigned char* salt, + int saltlen, + const EVP_MD* md_type); +unsigned char* +OPENSSL_asc2uni(const char* asc, int asclen, unsigned char** uni, int* unilen); +char* OPENSSL_uni2asc(unsigned char* uni, int unilen); + +DECLARE_ASN1_FUNCTIONS(PKCS12) +DECLARE_ASN1_FUNCTIONS(PKCS12_MAC_DATA) +DECLARE_ASN1_FUNCTIONS(PKCS12_SAFEBAG) +DECLARE_ASN1_FUNCTIONS(PKCS12_BAGS) + +DECLARE_ASN1_ITEM(PKCS12_SAFEBAGS) +DECLARE_ASN1_ITEM(PKCS12_AUTHSAFES) + +void PKCS12_PBE_add(void); +int PKCS12_parse( + PKCS12* p12, + const char* pass, + EVP_PKEY** pkey, + X509** cert, + STACK_OF(X509) * *ca); +PKCS12* PKCS12_create( + char* pass, + char* name, + EVP_PKEY* pkey, + X509* cert, + STACK_OF(X509) * ca, + int nid_key, + int nid_cert, + int iter, + int mac_iter, + int keytype); + +PKCS12_SAFEBAG* PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) * *pbags, X509* cert); +PKCS12_SAFEBAG* PKCS12_add_key( + STACK_OF(PKCS12_SAFEBAG) * *pbags, + EVP_PKEY* key, + int key_usage, + int iter, + int key_nid, + char* pass); +int PKCS12_add_safe( + STACK_OF(PKCS7) * *psafes, + STACK_OF(PKCS12_SAFEBAG) * bags, + int safe_nid, + int iter, + char* pass); +PKCS12* PKCS12_add_safes(STACK_OF(PKCS7) * safes, int p7_nid); + +int i2d_PKCS12_bio(BIO* bp, PKCS12* p12); +int i2d_PKCS12_fp(FILE* fp, PKCS12* p12); +PKCS12* d2i_PKCS12_bio(BIO* bp, PKCS12** p12); +PKCS12* d2i_PKCS12_fp(FILE* fp, PKCS12** p12); +int PKCS12_newpass(PKCS12* p12, const char* oldpass, const char* newpass); + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_PKCS12_strings(void); + +/* Error codes for the PKCS12 functions. */ + +/* Function codes. */ +#define PKCS12_F_PARSE_BAG 129 +#define PKCS12_F_PARSE_BAGS 103 +#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME 100 +#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_ASC 127 +#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI 102 +#define PKCS12_F_PKCS12_ADD_LOCALKEYID 104 +#define PKCS12_F_PKCS12_CREATE 105 +#define PKCS12_F_PKCS12_GEN_MAC 107 +#define PKCS12_F_PKCS12_INIT 109 +#define PKCS12_F_PKCS12_ITEM_DECRYPT_D2I 106 +#define PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT 108 +#define PKCS12_F_PKCS12_ITEM_PACK_SAFEBAG 117 +#define PKCS12_F_PKCS12_KEY_GEN_ASC 110 +#define PKCS12_F_PKCS12_KEY_GEN_UNI 111 +#define PKCS12_F_PKCS12_MAKE_KEYBAG 112 +#define PKCS12_F_PKCS12_MAKE_SHKEYBAG 113 +#define PKCS12_F_PKCS12_NEWPASS 128 +#define PKCS12_F_PKCS12_PACK_P7DATA 114 +#define PKCS12_F_PKCS12_PACK_P7ENCDATA 115 +#define PKCS12_F_PKCS12_PARSE 118 +#define PKCS12_F_PKCS12_PBE_CRYPT 119 +#define PKCS12_F_PKCS12_PBE_KEYIVGEN 120 +#define PKCS12_F_PKCS12_SETUP_MAC 122 +#define PKCS12_F_PKCS12_SET_MAC 123 +#define PKCS12_F_PKCS12_UNPACK_AUTHSAFES 130 +#define PKCS12_F_PKCS12_UNPACK_P7DATA 131 +#define PKCS12_F_PKCS12_VERIFY_MAC 126 +#define PKCS12_F_PKCS8_ADD_KEYUSAGE 124 +#define PKCS12_F_PKCS8_ENCRYPT 125 + +/* Reason codes. */ +#define PKCS12_R_CANT_PACK_STRUCTURE 100 +#define PKCS12_R_CONTENT_TYPE_NOT_DATA 121 +#define PKCS12_R_DECODE_ERROR 101 +#define PKCS12_R_ENCODE_ERROR 102 +#define PKCS12_R_ENCRYPT_ERROR 103 +#define PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE 120 +#define PKCS12_R_INVALID_NULL_ARGUMENT 104 +#define PKCS12_R_INVALID_NULL_PKCS12_POINTER 105 +#define PKCS12_R_IV_GEN_ERROR 106 +#define PKCS12_R_KEY_GEN_ERROR 107 +#define PKCS12_R_MAC_ABSENT 108 +#define PKCS12_R_MAC_GENERATION_ERROR 109 +#define PKCS12_R_MAC_SETUP_ERROR 110 +#define PKCS12_R_MAC_STRING_SET_ERROR 111 +#define PKCS12_R_MAC_VERIFY_ERROR 112 +#define PKCS12_R_MAC_VERIFY_FAILURE 113 +#define PKCS12_R_PARSE_ERROR 114 +#define PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR 115 +#define PKCS12_R_PKCS12_CIPHERFINAL_ERROR 116 +#define PKCS12_R_PKCS12_PBE_CRYPT_ERROR 117 +#define PKCS12_R_UNKNOWN_DIGEST_ALGORITHM 118 +#define PKCS12_R_UNSUPPORTED_PKCS12_MODE 119 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/pkcs7.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/pkcs7.h new file mode 100644 index 0000000..d96c1f6 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/pkcs7.h @@ -0,0 +1,524 @@ +/* crypto/pkcs7/pkcs7.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_PKCS7_H +#define HEADER_PKCS7_H + +#include +#include +#include + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSSL_SYS_WIN32 +/* Under Win32 thes are defined in wincrypt.h */ +#undef PKCS7_ISSUER_AND_SERIAL +#undef PKCS7_SIGNER_INFO +#endif + +/*- +Encryption_ID DES-CBC +Digest_ID MD5 +Digest_Encryption_ID rsaEncryption +Key_Encryption_ID rsaEncryption +*/ + +typedef struct pkcs7_issuer_and_serial_st { + X509_NAME* issuer; + ASN1_INTEGER* serial; +} PKCS7_ISSUER_AND_SERIAL; + +typedef struct pkcs7_signer_info_st { + ASN1_INTEGER* version; /* version 1 */ + PKCS7_ISSUER_AND_SERIAL* issuer_and_serial; + X509_ALGOR* digest_alg; + STACK_OF(X509_ATTRIBUTE) * auth_attr; /* [ 0 ] */ + X509_ALGOR* digest_enc_alg; + ASN1_OCTET_STRING* enc_digest; + STACK_OF(X509_ATTRIBUTE) * unauth_attr; /* [ 1 ] */ + /* The private key to sign with */ + EVP_PKEY* pkey; +} PKCS7_SIGNER_INFO; + +DECLARE_STACK_OF(PKCS7_SIGNER_INFO) +DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO) + +typedef struct pkcs7_recip_info_st { + ASN1_INTEGER* version; /* version 0 */ + PKCS7_ISSUER_AND_SERIAL* issuer_and_serial; + X509_ALGOR* key_enc_algor; + ASN1_OCTET_STRING* enc_key; + X509* cert; /* get the pub-key from this */ +} PKCS7_RECIP_INFO; + +DECLARE_STACK_OF(PKCS7_RECIP_INFO) +DECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO) + +typedef struct pkcs7_signed_st { + ASN1_INTEGER* version; /* version 1 */ + STACK_OF(X509_ALGOR) * md_algs; /* md used */ + STACK_OF(X509) * cert; /* [ 0 ] */ + STACK_OF(X509_CRL) * crl; /* [ 1 ] */ + STACK_OF(PKCS7_SIGNER_INFO) * signer_info; + struct pkcs7_st* contents; +} PKCS7_SIGNED; +/* + * The above structure is very very similar to PKCS7_SIGN_ENVELOPE. How about + * merging the two + */ + +typedef struct pkcs7_enc_content_st { + ASN1_OBJECT* content_type; + X509_ALGOR* algorithm; + ASN1_OCTET_STRING* enc_data; /* [ 0 ] */ + const EVP_CIPHER* cipher; +} PKCS7_ENC_CONTENT; + +typedef struct pkcs7_enveloped_st { + ASN1_INTEGER* version; /* version 0 */ + STACK_OF(PKCS7_RECIP_INFO) * recipientinfo; + PKCS7_ENC_CONTENT* enc_data; +} PKCS7_ENVELOPE; + +typedef struct pkcs7_signedandenveloped_st { + ASN1_INTEGER* version; /* version 1 */ + STACK_OF(X509_ALGOR) * md_algs; /* md used */ + STACK_OF(X509) * cert; /* [ 0 ] */ + STACK_OF(X509_CRL) * crl; /* [ 1 ] */ + STACK_OF(PKCS7_SIGNER_INFO) * signer_info; + PKCS7_ENC_CONTENT* enc_data; + STACK_OF(PKCS7_RECIP_INFO) * recipientinfo; +} PKCS7_SIGN_ENVELOPE; + +typedef struct pkcs7_digest_st { + ASN1_INTEGER* version; /* version 0 */ + X509_ALGOR* md; /* md used */ + struct pkcs7_st* contents; + ASN1_OCTET_STRING* digest; +} PKCS7_DIGEST; + +typedef struct pkcs7_encrypted_st { + ASN1_INTEGER* version; /* version 0 */ + PKCS7_ENC_CONTENT* enc_data; +} PKCS7_ENCRYPT; + +typedef struct pkcs7_st { + /* + * The following is non NULL if it contains ASN1 encoding of this + * structure + */ + unsigned char* asn1; + long length; +#define PKCS7_S_HEADER 0 +#define PKCS7_S_BODY 1 +#define PKCS7_S_TAIL 2 + int state; /* used during processing */ + int detached; + ASN1_OBJECT* type; + /* content as defined by the type */ + /* + * all encryption/message digests are applied to the 'contents', leaving + * out the 'type' field. + */ + union { + char* ptr; + /* NID_pkcs7_data */ + ASN1_OCTET_STRING* data; + /* NID_pkcs7_signed */ + PKCS7_SIGNED* sign; + /* NID_pkcs7_enveloped */ + PKCS7_ENVELOPE* enveloped; + /* NID_pkcs7_signedAndEnveloped */ + PKCS7_SIGN_ENVELOPE* signed_and_enveloped; + /* NID_pkcs7_digest */ + PKCS7_DIGEST* digest; + /* NID_pkcs7_encrypted */ + PKCS7_ENCRYPT* encrypted; + /* Anything else */ + ASN1_TYPE* other; + } d; +} PKCS7; + +DECLARE_STACK_OF(PKCS7) +DECLARE_ASN1_SET_OF(PKCS7) +DECLARE_PKCS12_STACK_OF(PKCS7) + +#define PKCS7_OP_SET_DETACHED_SIGNATURE 1 +#define PKCS7_OP_GET_DETACHED_SIGNATURE 2 + +#define PKCS7_get_signed_attributes(si) ((si)->auth_attr) +#define PKCS7_get_attributes(si) ((si)->unauth_attr) + +#define PKCS7_type_is_signed(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_signed) +#define PKCS7_type_is_encrypted(a) \ + (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted) +#define PKCS7_type_is_enveloped(a) \ + (OBJ_obj2nid((a)->type) == NID_pkcs7_enveloped) +#define PKCS7_type_is_signedAndEnveloped(a) \ + (OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped) +#define PKCS7_type_is_data(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_data) +#define PKCS7_type_is_digest(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_digest) + +#define PKCS7_set_detached(p, v) \ + PKCS7_ctrl(p, PKCS7_OP_SET_DETACHED_SIGNATURE, v, NULL) +#define PKCS7_get_detached(p) \ + PKCS7_ctrl(p, PKCS7_OP_GET_DETACHED_SIGNATURE, 0, NULL) + +#define PKCS7_is_detached(p7) \ + (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7)) + +/* S/MIME related flags */ + +#define PKCS7_TEXT 0x1 +#define PKCS7_NOCERTS 0x2 +#define PKCS7_NOSIGS 0x4 +#define PKCS7_NOCHAIN 0x8 +#define PKCS7_NOINTERN 0x10 +#define PKCS7_NOVERIFY 0x20 +#define PKCS7_DETACHED 0x40 +#define PKCS7_BINARY 0x80 +#define PKCS7_NOATTR 0x100 +#define PKCS7_NOSMIMECAP 0x200 +#define PKCS7_NOOLDMIMETYPE 0x400 +#define PKCS7_CRLFEOL 0x800 +#define PKCS7_STREAM 0x1000 +#define PKCS7_NOCRL 0x2000 +#define PKCS7_PARTIAL 0x4000 +#define PKCS7_REUSE_DIGEST 0x8000 + +/* Flags: for compatibility with older code */ + +#define SMIME_TEXT PKCS7_TEXT +#define SMIME_NOCERTS PKCS7_NOCERTS +#define SMIME_NOSIGS PKCS7_NOSIGS +#define SMIME_NOCHAIN PKCS7_NOCHAIN +#define SMIME_NOINTERN PKCS7_NOINTERN +#define SMIME_NOVERIFY PKCS7_NOVERIFY +#define SMIME_DETACHED PKCS7_DETACHED +#define SMIME_BINARY PKCS7_BINARY +#define SMIME_NOATTR PKCS7_NOATTR + +DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL) + +int PKCS7_ISSUER_AND_SERIAL_digest( + PKCS7_ISSUER_AND_SERIAL* data, + const EVP_MD* type, + unsigned char* md, + unsigned int* len); +#ifndef OPENSSL_NO_FP_API +PKCS7* d2i_PKCS7_fp(FILE* fp, PKCS7** p7); +int i2d_PKCS7_fp(FILE* fp, PKCS7* p7); +#endif +PKCS7* PKCS7_dup(PKCS7* p7); +PKCS7* d2i_PKCS7_bio(BIO* bp, PKCS7** p7); +int i2d_PKCS7_bio(BIO* bp, PKCS7* p7); +int i2d_PKCS7_bio_stream(BIO* out, PKCS7* p7, BIO* in, int flags); +int PEM_write_bio_PKCS7_stream(BIO* out, PKCS7* p7, BIO* in, int flags); + +DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO) +DECLARE_ASN1_FUNCTIONS(PKCS7_RECIP_INFO) +DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNED) +DECLARE_ASN1_FUNCTIONS(PKCS7_ENC_CONTENT) +DECLARE_ASN1_FUNCTIONS(PKCS7_ENVELOPE) +DECLARE_ASN1_FUNCTIONS(PKCS7_SIGN_ENVELOPE) +DECLARE_ASN1_FUNCTIONS(PKCS7_DIGEST) +DECLARE_ASN1_FUNCTIONS(PKCS7_ENCRYPT) +DECLARE_ASN1_FUNCTIONS(PKCS7) + +DECLARE_ASN1_ITEM(PKCS7_ATTR_SIGN) +DECLARE_ASN1_ITEM(PKCS7_ATTR_VERIFY) + +DECLARE_ASN1_NDEF_FUNCTION(PKCS7) +DECLARE_ASN1_PRINT_FUNCTION(PKCS7) + +long PKCS7_ctrl(PKCS7* p7, int cmd, long larg, char* parg); + +int PKCS7_set_type(PKCS7* p7, int type); +int PKCS7_set0_type_other(PKCS7* p7, int type, ASN1_TYPE* other); +int PKCS7_set_content(PKCS7* p7, PKCS7* p7_data); +int PKCS7_SIGNER_INFO_set( + PKCS7_SIGNER_INFO* p7i, + X509* x509, + EVP_PKEY* pkey, + const EVP_MD* dgst); +int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO* si); +int PKCS7_add_signer(PKCS7* p7, PKCS7_SIGNER_INFO* p7i); +int PKCS7_add_certificate(PKCS7* p7, X509* x509); +int PKCS7_add_crl(PKCS7* p7, X509_CRL* x509); +int PKCS7_content_new(PKCS7* p7, int nid); +int PKCS7_dataVerify( + X509_STORE* cert_store, + X509_STORE_CTX* ctx, + BIO* bio, + PKCS7* p7, + PKCS7_SIGNER_INFO* si); +int PKCS7_signatureVerify( + BIO* bio, + PKCS7* p7, + PKCS7_SIGNER_INFO* si, + X509* x509); + +BIO* PKCS7_dataInit(PKCS7* p7, BIO* bio); +int PKCS7_dataFinal(PKCS7* p7, BIO* bio); +BIO* PKCS7_dataDecode(PKCS7* p7, EVP_PKEY* pkey, BIO* in_bio, X509* pcert); + +PKCS7_SIGNER_INFO* +PKCS7_add_signature(PKCS7* p7, X509* x509, EVP_PKEY* pkey, const EVP_MD* dgst); +X509* PKCS7_cert_from_signer_info(PKCS7* p7, PKCS7_SIGNER_INFO* si); +int PKCS7_set_digest(PKCS7* p7, const EVP_MD* md); +STACK_OF(PKCS7_SIGNER_INFO) * PKCS7_get_signer_info(PKCS7* p7); + +PKCS7_RECIP_INFO* PKCS7_add_recipient(PKCS7* p7, X509* x509); +void PKCS7_SIGNER_INFO_get0_algs( + PKCS7_SIGNER_INFO* si, + EVP_PKEY** pk, + X509_ALGOR** pdig, + X509_ALGOR** psig); +void PKCS7_RECIP_INFO_get0_alg(PKCS7_RECIP_INFO* ri, X509_ALGOR** penc); +int PKCS7_add_recipient_info(PKCS7* p7, PKCS7_RECIP_INFO* ri); +int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO* p7i, X509* x509); +int PKCS7_set_cipher(PKCS7* p7, const EVP_CIPHER* cipher); +int PKCS7_stream(unsigned char*** boundary, PKCS7* p7); + +PKCS7_ISSUER_AND_SERIAL* PKCS7_get_issuer_and_serial(PKCS7* p7, int idx); +ASN1_OCTET_STRING* PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) * sk); +int PKCS7_add_signed_attribute( + PKCS7_SIGNER_INFO* p7si, + int nid, + int type, + void* data); +int PKCS7_add_attribute( + PKCS7_SIGNER_INFO* p7si, + int nid, + int atrtype, + void* value); +ASN1_TYPE* PKCS7_get_attribute(PKCS7_SIGNER_INFO* si, int nid); +ASN1_TYPE* PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO* si, int nid); +int PKCS7_set_signed_attributes( + PKCS7_SIGNER_INFO* p7si, + STACK_OF(X509_ATTRIBUTE) * sk); +int PKCS7_set_attributes( + PKCS7_SIGNER_INFO* p7si, + STACK_OF(X509_ATTRIBUTE) * sk); + +PKCS7* PKCS7_sign( + X509* signcert, + EVP_PKEY* pkey, + STACK_OF(X509) * certs, + BIO* data, + int flags); + +PKCS7_SIGNER_INFO* PKCS7_sign_add_signer( + PKCS7* p7, + X509* signcert, + EVP_PKEY* pkey, + const EVP_MD* md, + int flags); + +int PKCS7_final(PKCS7* p7, BIO* data, int flags); +int PKCS7_verify( + PKCS7* p7, + STACK_OF(X509) * certs, + X509_STORE* store, + BIO* indata, + BIO* out, + int flags); +STACK_OF(X509) * + PKCS7_get0_signers(PKCS7* p7, STACK_OF(X509) * certs, int flags); +PKCS7* PKCS7_encrypt( + STACK_OF(X509) * certs, + BIO* in, + const EVP_CIPHER* cipher, + int flags); +int PKCS7_decrypt(PKCS7* p7, EVP_PKEY* pkey, X509* cert, BIO* data, int flags); + +int PKCS7_add_attrib_smimecap( + PKCS7_SIGNER_INFO* si, + STACK_OF(X509_ALGOR) * cap); +STACK_OF(X509_ALGOR) * PKCS7_get_smimecap(PKCS7_SIGNER_INFO* si); +int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) * sk, int nid, int arg); + +int PKCS7_add_attrib_content_type(PKCS7_SIGNER_INFO* si, ASN1_OBJECT* coid); +int PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO* si, ASN1_TIME* t); +int PKCS7_add1_attrib_digest( + PKCS7_SIGNER_INFO* si, + const unsigned char* md, + int mdlen); + +int SMIME_write_PKCS7(BIO* bio, PKCS7* p7, BIO* data, int flags); +PKCS7* SMIME_read_PKCS7(BIO* bio, BIO** bcont); + +BIO* BIO_new_PKCS7(BIO* out, PKCS7* p7); + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_PKCS7_strings(void); + +/* Error codes for the PKCS7 functions. */ + +/* Function codes. */ +#define PKCS7_F_B64_READ_PKCS7 120 +#define PKCS7_F_B64_WRITE_PKCS7 121 +#define PKCS7_F_DO_PKCS7_SIGNED_ATTRIB 136 +#define PKCS7_F_I2D_PKCS7_BIO_STREAM 140 +#define PKCS7_F_PKCS7_ADD0_ATTRIB_SIGNING_TIME 135 +#define PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP 118 +#define PKCS7_F_PKCS7_ADD_CERTIFICATE 100 +#define PKCS7_F_PKCS7_ADD_CRL 101 +#define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO 102 +#define PKCS7_F_PKCS7_ADD_SIGNATURE 131 +#define PKCS7_F_PKCS7_ADD_SIGNER 103 +#define PKCS7_F_PKCS7_BIO_ADD_DIGEST 125 +#define PKCS7_F_PKCS7_COPY_EXISTING_DIGEST 138 +#define PKCS7_F_PKCS7_CTRL 104 +#define PKCS7_F_PKCS7_DATADECODE 112 +#define PKCS7_F_PKCS7_DATAFINAL 128 +#define PKCS7_F_PKCS7_DATAINIT 105 +#define PKCS7_F_PKCS7_DATASIGN 106 +#define PKCS7_F_PKCS7_DATAVERIFY 107 +#define PKCS7_F_PKCS7_DECRYPT 114 +#define PKCS7_F_PKCS7_DECRYPT_RINFO 133 +#define PKCS7_F_PKCS7_ENCODE_RINFO 132 +#define PKCS7_F_PKCS7_ENCRYPT 115 +#define PKCS7_F_PKCS7_FINAL 134 +#define PKCS7_F_PKCS7_FIND_DIGEST 127 +#define PKCS7_F_PKCS7_GET0_SIGNERS 124 +#define PKCS7_F_PKCS7_RECIP_INFO_SET 130 +#define PKCS7_F_PKCS7_SET_CIPHER 108 +#define PKCS7_F_PKCS7_SET_CONTENT 109 +#define PKCS7_F_PKCS7_SET_DIGEST 126 +#define PKCS7_F_PKCS7_SET_TYPE 110 +#define PKCS7_F_PKCS7_SIGN 116 +#define PKCS7_F_PKCS7_SIGNATUREVERIFY 113 +#define PKCS7_F_PKCS7_SIGNER_INFO_SET 129 +#define PKCS7_F_PKCS7_SIGNER_INFO_SIGN 139 +#define PKCS7_F_PKCS7_SIGN_ADD_SIGNER 137 +#define PKCS7_F_PKCS7_SIMPLE_SMIMECAP 119 +#define PKCS7_F_PKCS7_VERIFY 117 +#define PKCS7_F_SMIME_READ_PKCS7 122 +#define PKCS7_F_SMIME_TEXT 123 + +/* Reason codes. */ +#define PKCS7_R_CERTIFICATE_VERIFY_ERROR 117 +#define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 144 +#define PKCS7_R_CIPHER_NOT_INITIALIZED 116 +#define PKCS7_R_CONTENT_AND_DATA_PRESENT 118 +#define PKCS7_R_CTRL_ERROR 152 +#define PKCS7_R_DECODE_ERROR 130 +#define PKCS7_R_DECRYPTED_KEY_IS_WRONG_LENGTH 100 +#define PKCS7_R_DECRYPT_ERROR 119 +#define PKCS7_R_DIGEST_FAILURE 101 +#define PKCS7_R_ENCRYPTION_CTRL_FAILURE 149 +#define PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 150 +#define PKCS7_R_ERROR_ADDING_RECIPIENT 120 +#define PKCS7_R_ERROR_SETTING_CIPHER 121 +#define PKCS7_R_INVALID_MIME_TYPE 131 +#define PKCS7_R_INVALID_NULL_POINTER 143 +#define PKCS7_R_INVALID_SIGNED_DATA_TYPE 155 +#define PKCS7_R_MIME_NO_CONTENT_TYPE 132 +#define PKCS7_R_MIME_PARSE_ERROR 133 +#define PKCS7_R_MIME_SIG_PARSE_ERROR 134 +#define PKCS7_R_MISSING_CERIPEND_INFO 103 +#define PKCS7_R_NO_CONTENT 122 +#define PKCS7_R_NO_CONTENT_TYPE 135 +#define PKCS7_R_NO_DEFAULT_DIGEST 151 +#define PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND 154 +#define PKCS7_R_NO_MULTIPART_BODY_FAILURE 136 +#define PKCS7_R_NO_MULTIPART_BOUNDARY 137 +#define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE 115 +#define PKCS7_R_NO_RECIPIENT_MATCHES_KEY 146 +#define PKCS7_R_NO_SIGNATURES_ON_DATA 123 +#define PKCS7_R_NO_SIGNERS 142 +#define PKCS7_R_NO_SIG_CONTENT_TYPE 138 +#define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE 104 +#define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR 124 +#define PKCS7_R_PKCS7_ADD_SIGNER_ERROR 153 +#define PKCS7_R_PKCS7_DATAFINAL 126 +#define PKCS7_R_PKCS7_DATAFINAL_ERROR 125 +#define PKCS7_R_PKCS7_DATASIGN 145 +#define PKCS7_R_PKCS7_PARSE_ERROR 139 +#define PKCS7_R_PKCS7_SIG_PARSE_ERROR 140 +#define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 127 +#define PKCS7_R_SIGNATURE_FAILURE 105 +#define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND 128 +#define PKCS7_R_SIGNING_CTRL_FAILURE 147 +#define PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 148 +#define PKCS7_R_SIG_INVALID_MIME_TYPE 141 +#define PKCS7_R_SMIME_TEXT_ERROR 129 +#define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE 106 +#define PKCS7_R_UNABLE_TO_FIND_MEM_BIO 107 +#define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST 108 +#define PKCS7_R_UNKNOWN_DIGEST_TYPE 109 +#define PKCS7_R_UNKNOWN_OPERATION 110 +#define PKCS7_R_UNSUPPORTED_CIPHER_TYPE 111 +#define PKCS7_R_UNSUPPORTED_CONTENT_TYPE 112 +#define PKCS7_R_WRONG_CONTENT_TYPE 113 +#define PKCS7_R_WRONG_PKCS7_TYPE 114 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/pqueue.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/pqueue.h new file mode 100644 index 0000000..dd5fb23 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/pqueue.h @@ -0,0 +1,99 @@ +/* crypto/pqueue/pqueue.h */ +/* + * DTLS implementation written by Nagendra Modadugu + * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. + */ +/* ==================================================================== + * Copyright (c) 1999-2005 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_PQUEUE_H +#define HEADER_PQUEUE_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif +typedef struct _pqueue* pqueue; + +typedef struct _pitem { + unsigned char priority[8]; /* 64-bit value in big-endian encoding */ + void* data; + struct _pitem* next; +} pitem; + +typedef struct _pitem* piterator; + +pitem* pitem_new(unsigned char* prio64be, void* data); +void pitem_free(pitem* item); + +pqueue pqueue_new(void); +void pqueue_free(pqueue pq); + +pitem* pqueue_insert(pqueue pq, pitem* item); +pitem* pqueue_peek(pqueue pq); +pitem* pqueue_pop(pqueue pq); +pitem* pqueue_find(pqueue pq, unsigned char* prio64be); +pitem* pqueue_iterator(pqueue pq); +pitem* pqueue_next(piterator* iter); + +void pqueue_print(pqueue pq); +int pqueue_size(pqueue pq); + +#ifdef __cplusplus +} +#endif +#endif /* ! HEADER_PQUEUE_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/rand.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/rand.h new file mode 100644 index 0000000..ccc76b4 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/rand.h @@ -0,0 +1,150 @@ +/* crypto/rand/rand.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_RAND_H +#define HEADER_RAND_H + +#include +#include +#include + +#if defined(OPENSSL_SYS_WINDOWS) +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(OPENSSL_FIPS) +#define FIPS_RAND_SIZE_T size_t +#endif + +/* Already defined in ossl_typ.h */ +/* typedef struct rand_meth_st RAND_METHOD; */ + +struct rand_meth_st { + void (*seed)(const void* buf, int num); + int (*bytes)(unsigned char* buf, int num); + void (*cleanup)(void); + void (*add)(const void* buf, int num, double entropy); + int (*pseudorand)(unsigned char* buf, int num); + int (*status)(void); +}; + +#ifdef BN_DEBUG +extern int rand_predictable; +#endif + +int RAND_set_rand_method(const RAND_METHOD* meth); +const RAND_METHOD* RAND_get_rand_method(void); +#ifndef OPENSSL_NO_ENGINE +int RAND_set_rand_engine(ENGINE* engine); +#endif +RAND_METHOD* RAND_SSLeay(void); +void RAND_cleanup(void); +int RAND_bytes(unsigned char* buf, int num); +int RAND_pseudo_bytes(unsigned char* buf, int num); +void RAND_seed(const void* buf, int num); +void RAND_add(const void* buf, int num, double entropy); +int RAND_load_file(const char* file, long max_bytes); +int RAND_write_file(const char* file); +const char* RAND_file_name(char* file, size_t num); +int RAND_status(void); +int RAND_query_egd_bytes(const char* path, unsigned char* buf, int bytes); +int RAND_egd(const char* path); +int RAND_egd_bytes(const char* path, int bytes); +int RAND_poll(void); + +#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) + +void RAND_screen(void); +int RAND_event(UINT, WPARAM, LPARAM); + +#endif + +#ifdef OPENSSL_FIPS +void RAND_set_fips_drbg_type(int type, int flags); +int RAND_init_fips(void); +#endif + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_RAND_strings(void); + +/* Error codes for the RAND functions. */ + +/* Function codes. */ +#define RAND_F_RAND_GET_RAND_METHOD 101 +#define RAND_F_RAND_INIT_FIPS 102 +#define RAND_F_SSLEAY_RAND_BYTES 100 + +/* Reason codes. */ +#define RAND_R_DUAL_EC_DRBG_DISABLED 104 +#define RAND_R_ERROR_INITIALISING_DRBG 102 +#define RAND_R_ERROR_INSTANTIATING_DRBG 103 +#define RAND_R_NO_FIPS_RANDOM_METHOD_SET 101 +#define RAND_R_PRNG_NOT_SEEDED 100 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/rc2.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/rc2.h new file mode 100644 index 0000000..1c3f7c1 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/rc2.h @@ -0,0 +1,121 @@ +/* crypto/rc2/rc2.h */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_RC2_H +#define HEADER_RC2_H + +#include /* OPENSSL_NO_RC2, RC2_INT */ +#ifdef OPENSSL_NO_RC2 +#error RC2 is disabled. +#endif + +#define RC2_ENCRYPT 1 +#define RC2_DECRYPT 0 + +#define RC2_BLOCK 8 +#define RC2_KEY_LENGTH 16 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct rc2_key_st { RC2_INT data[64]; } RC2_KEY; + +#ifdef OPENSSL_FIPS +void private_RC2_set_key( + RC2_KEY* key, + int len, + const unsigned char* data, + int bits); +#endif +void RC2_set_key(RC2_KEY* key, int len, const unsigned char* data, int bits); +void RC2_ecb_encrypt( + const unsigned char* in, + unsigned char* out, + RC2_KEY* key, + int enc); +void RC2_encrypt(unsigned long* data, RC2_KEY* key); +void RC2_decrypt(unsigned long* data, RC2_KEY* key); +void RC2_cbc_encrypt( + const unsigned char* in, + unsigned char* out, + long length, + RC2_KEY* ks, + unsigned char* iv, + int enc); +void RC2_cfb64_encrypt( + const unsigned char* in, + unsigned char* out, + long length, + RC2_KEY* schedule, + unsigned char* ivec, + int* num, + int enc); +void RC2_ofb64_encrypt( + const unsigned char* in, + unsigned char* out, + long length, + RC2_KEY* schedule, + unsigned char* ivec, + int* num); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/rc4.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/rc4.h new file mode 100644 index 0000000..4a0fc57 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/rc4.h @@ -0,0 +1,91 @@ +/* crypto/rc4/rc4.h */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_RC4_H +#define HEADER_RC4_H + +#include /* OPENSSL_NO_RC4, RC4_INT */ +#ifdef OPENSSL_NO_RC4 +#error RC4 is disabled. +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct rc4_key_st { + RC4_INT x, y; + RC4_INT data[256]; +} RC4_KEY; + +const char* RC4_options(void); +void RC4_set_key(RC4_KEY* key, int len, const unsigned char* data); +void private_RC4_set_key(RC4_KEY* key, int len, const unsigned char* data); +void RC4( + RC4_KEY* key, + size_t len, + const unsigned char* indata, + unsigned char* outdata); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ripemd.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ripemd.h new file mode 100644 index 0000000..b3f839c --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ripemd.h @@ -0,0 +1,105 @@ +/* crypto/ripemd/ripemd.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_RIPEMD_H +#define HEADER_RIPEMD_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSSL_NO_RIPEMD +#error RIPEMD is disabled. +#endif + +#if defined(__LP32__) +#define RIPEMD160_LONG unsigned long +#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) +#define RIPEMD160_LONG unsigned long +#define RIPEMD160_LONG_LOG2 3 +#else +#define RIPEMD160_LONG unsigned int +#endif + +#define RIPEMD160_CBLOCK 64 +#define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK / 4) +#define RIPEMD160_DIGEST_LENGTH 20 + +typedef struct RIPEMD160state_st { + RIPEMD160_LONG A, B, C, D, E; + RIPEMD160_LONG Nl, Nh; + RIPEMD160_LONG data[RIPEMD160_LBLOCK]; + unsigned int num; +} RIPEMD160_CTX; + +#ifdef OPENSSL_FIPS +int private_RIPEMD160_Init(RIPEMD160_CTX* c); +#endif +int RIPEMD160_Init(RIPEMD160_CTX* c); +int RIPEMD160_Update(RIPEMD160_CTX* c, const void* data, size_t len); +int RIPEMD160_Final(unsigned char* md, RIPEMD160_CTX* c); +unsigned char* RIPEMD160(const unsigned char* d, size_t n, unsigned char* md); +void RIPEMD160_Transform(RIPEMD160_CTX* c, const unsigned char* b); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/rsa.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/rsa.h new file mode 100644 index 0000000..2aaa2b0 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/rsa.h @@ -0,0 +1,853 @@ +/* crypto/rsa/rsa.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_RSA_H +#define HEADER_RSA_H + +#include + +#ifndef OPENSSL_NO_BIO +#include +#endif +#include +#include +#ifndef OPENSSL_NO_DEPRECATED +#include +#endif + +#ifdef OPENSSL_NO_RSA +#error RSA is disabled. +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Declared already in ossl_typ.h */ +/* typedef struct rsa_st RSA; */ +/* typedef struct rsa_meth_st RSA_METHOD; */ + +struct rsa_meth_st { + const char* name; + int (*rsa_pub_enc)( + int flen, + const unsigned char* from, + unsigned char* to, + RSA* rsa, + int padding); + int (*rsa_pub_dec)( + int flen, + const unsigned char* from, + unsigned char* to, + RSA* rsa, + int padding); + int (*rsa_priv_enc)( + int flen, + const unsigned char* from, + unsigned char* to, + RSA* rsa, + int padding); + int (*rsa_priv_dec)( + int flen, + const unsigned char* from, + unsigned char* to, + RSA* rsa, + int padding); + /* Can be null */ + int (*rsa_mod_exp)(BIGNUM* r0, const BIGNUM* I, RSA* rsa, BN_CTX* ctx); + /* Can be null */ + int (*bn_mod_exp)( + BIGNUM* r, + const BIGNUM* a, + const BIGNUM* p, + const BIGNUM* m, + BN_CTX* ctx, + BN_MONT_CTX* m_ctx); + /* called at new */ + int (*init)(RSA* rsa); + /* called at free */ + int (*finish)(RSA* rsa); + /* RSA_METHOD_FLAG_* things */ + int flags; + /* may be needed! */ + char* app_data; + /* + * New sign and verify functions: some libraries don't allow arbitrary + * data to be signed/verified: this allows them to be used. Note: for + * this to work the RSA_public_decrypt() and RSA_private_encrypt() should + * *NOT* be used RSA_sign(), RSA_verify() should be used instead. Note: + * for backwards compatibility this functionality is only enabled if the + * RSA_FLAG_SIGN_VER option is set in 'flags'. + */ + int (*rsa_sign)( + int type, + const unsigned char* m, + unsigned int m_length, + unsigned char* sigret, + unsigned int* siglen, + const RSA* rsa); + int (*rsa_verify)( + int dtype, + const unsigned char* m, + unsigned int m_length, + const unsigned char* sigbuf, + unsigned int siglen, + const RSA* rsa); + /* + * If this callback is NULL, the builtin software RSA key-gen will be + * used. This is for behavioural compatibility whilst the code gets + * rewired, but one day it would be nice to assume there are no such + * things as "builtin software" implementations. + */ + int (*rsa_keygen)(RSA* rsa, int bits, BIGNUM* e, BN_GENCB* cb); +}; + +struct rsa_st { + /* + * The first parameter is used to pickup errors where this is passed + * instead of aEVP_PKEY, it is set to 0 + */ + int pad; + long version; + const RSA_METHOD* meth; + /* functional reference if 'meth' is ENGINE-provided */ + ENGINE* engine; + BIGNUM* n; + BIGNUM* e; + BIGNUM* d; + BIGNUM* p; + BIGNUM* q; + BIGNUM* dmp1; + BIGNUM* dmq1; + BIGNUM* iqmp; + /* be careful using this if the RSA structure is shared */ + CRYPTO_EX_DATA ex_data; + int references; + int flags; + /* Used to cache montgomery values */ + BN_MONT_CTX* _method_mod_n; + BN_MONT_CTX* _method_mod_p; + BN_MONT_CTX* _method_mod_q; + /* + * all BIGNUM values are actually in the following data, if it is not + * NULL + */ + char* bignum_data; + BN_BLINDING* blinding; + BN_BLINDING* mt_blinding; +}; + +#ifndef OPENSSL_RSA_MAX_MODULUS_BITS +#define OPENSSL_RSA_MAX_MODULUS_BITS 16384 +#endif + +#ifndef OPENSSL_RSA_SMALL_MODULUS_BITS +#define OPENSSL_RSA_SMALL_MODULUS_BITS 3072 +#endif +#ifndef OPENSSL_RSA_MAX_PUBEXP_BITS + +/* exponent limit enforced for "large" modulus only */ +#define OPENSSL_RSA_MAX_PUBEXP_BITS 64 +#endif + +#define RSA_3 0x3L +#define RSA_F4 0x10001L + +#define RSA_METHOD_FLAG_NO_CHECK \ + 0x0001 /* don't check pub/private \ + * match */ + +#define RSA_FLAG_CACHE_PUBLIC 0x0002 +#define RSA_FLAG_CACHE_PRIVATE 0x0004 +#define RSA_FLAG_BLINDING 0x0008 +#define RSA_FLAG_THREAD_SAFE 0x0010 +/* + * This flag means the private key operations will be handled by rsa_mod_exp + * and that they do not depend on the private key components being present: + * for example a key stored in external hardware. Without this flag + * bn_mod_exp gets called when private key components are absent. + */ +#define RSA_FLAG_EXT_PKEY 0x0020 + +/* + * This flag in the RSA_METHOD enables the new rsa_sign, rsa_verify + * functions. + */ +#define RSA_FLAG_SIGN_VER 0x0040 + +/* + * new with 0.9.6j and 0.9.7b; the built-in + * RSA implementation now uses blinding by + * default (ignoring RSA_FLAG_BLINDING), + * but other engines might not need it + */ +#define RSA_FLAG_NO_BLINDING 0x0080 +/* + * new with 0.9.8f; the built-in RSA + * implementation now uses constant time + * operations by default in private key operations, + * e.g., constant time modular exponentiation, + * modular inverse without leaking branches, + * division without leaking branches. This + * flag disables these constant time + * operations and results in faster RSA + * private key operations. + */ +#define RSA_FLAG_NO_CONSTTIME 0x0100 +#ifdef OPENSSL_USE_DEPRECATED +/* deprecated name for the flag*/ +/* + * new with 0.9.7h; the built-in RSA + * implementation now uses constant time + * modular exponentiation for secret exponents + * by default. This flag causes the + * faster variable sliding window method to + * be used for all exponents. + */ +#define RSA_FLAG_NO_EXP_CONSTTIME RSA_FLAG_NO_CONSTTIME +#endif + +#define EVP_PKEY_CTX_set_rsa_padding(ctx, pad) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, -1, EVP_PKEY_CTRL_RSA_PADDING, pad, NULL) + +#define EVP_PKEY_CTX_get_rsa_padding(ctx, ppad) \ + EVP_PKEY_CTX_ctrl( \ + ctx, EVP_PKEY_RSA, -1, EVP_PKEY_CTRL_GET_RSA_PADDING, 0, ppad) + +#define EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx, len) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_RSA, \ + (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY), \ + EVP_PKEY_CTRL_RSA_PSS_SALTLEN, \ + len, \ + NULL) + +#define EVP_PKEY_CTX_get_rsa_pss_saltlen(ctx, plen) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_RSA, \ + (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY), \ + EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN, \ + 0, \ + plen) + +#define EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, bits) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_RSA, \ + EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_RSA_KEYGEN_BITS, \ + bits, \ + NULL) + +#define EVP_PKEY_CTX_set_rsa_keygen_pubexp(ctx, pubexp) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_RSA, \ + EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP, \ + 0, \ + pubexp) + +#define EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, md) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_RSA, \ + EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT, \ + EVP_PKEY_CTRL_RSA_MGF1_MD, \ + 0, \ + (void*)md) + +#define EVP_PKEY_CTX_set_rsa_oaep_md(ctx, md) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_RSA, \ + EVP_PKEY_OP_TYPE_CRYPT, \ + EVP_PKEY_CTRL_RSA_OAEP_MD, \ + 0, \ + (void*)md) + +#define EVP_PKEY_CTX_get_rsa_mgf1_md(ctx, pmd) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_RSA, \ + EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT, \ + EVP_PKEY_CTRL_GET_RSA_MGF1_MD, \ + 0, \ + (void*)pmd) + +#define EVP_PKEY_CTX_get_rsa_oaep_md(ctx, pmd) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_RSA, \ + EVP_PKEY_OP_TYPE_CRYPT, \ + EVP_PKEY_CTRL_GET_RSA_OAEP_MD, \ + 0, \ + (void*)pmd) + +#define EVP_PKEY_CTX_set0_rsa_oaep_label(ctx, l, llen) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_RSA, \ + EVP_PKEY_OP_TYPE_CRYPT, \ + EVP_PKEY_CTRL_RSA_OAEP_LABEL, \ + llen, \ + (void*)l) + +#define EVP_PKEY_CTX_get0_rsa_oaep_label(ctx, l) \ + EVP_PKEY_CTX_ctrl( \ + ctx, \ + EVP_PKEY_RSA, \ + EVP_PKEY_OP_TYPE_CRYPT, \ + EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL, \ + 0, \ + (void*)l) + +#define EVP_PKEY_CTRL_RSA_PADDING (EVP_PKEY_ALG_CTRL + 1) +#define EVP_PKEY_CTRL_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 2) + +#define EVP_PKEY_CTRL_RSA_KEYGEN_BITS (EVP_PKEY_ALG_CTRL + 3) +#define EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP (EVP_PKEY_ALG_CTRL + 4) +#define EVP_PKEY_CTRL_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 5) + +#define EVP_PKEY_CTRL_GET_RSA_PADDING (EVP_PKEY_ALG_CTRL + 6) +#define EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 7) +#define EVP_PKEY_CTRL_GET_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 8) + +#define EVP_PKEY_CTRL_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 9) +#define EVP_PKEY_CTRL_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 10) + +#define EVP_PKEY_CTRL_GET_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 11) +#define EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 12) + +#define RSA_PKCS1_PADDING 1 +#define RSA_SSLV23_PADDING 2 +#define RSA_NO_PADDING 3 +#define RSA_PKCS1_OAEP_PADDING 4 +#define RSA_X931_PADDING 5 +/* EVP_PKEY_ only */ +#define RSA_PKCS1_PSS_PADDING 6 + +#define RSA_PKCS1_PADDING_SIZE 11 + +#define RSA_set_app_data(s, arg) RSA_set_ex_data(s, 0, arg) +#define RSA_get_app_data(s) RSA_get_ex_data(s, 0) + +RSA* RSA_new(void); +RSA* RSA_new_method(ENGINE* engine); +int RSA_size(const RSA* rsa); + +/* Deprecated version */ +#ifndef OPENSSL_NO_DEPRECATED +RSA* RSA_generate_key( + int bits, + unsigned long e, + void (*callback)(int, int, void*), + void* cb_arg); +#endif /* !defined(OPENSSL_NO_DEPRECATED) */ + +/* New version */ +int RSA_generate_key_ex(RSA* rsa, int bits, BIGNUM* e, BN_GENCB* cb); + +int RSA_check_key(const RSA*); +/* next 4 return -1 on error */ +int RSA_public_encrypt( + int flen, + const unsigned char* from, + unsigned char* to, + RSA* rsa, + int padding); +int RSA_private_encrypt( + int flen, + const unsigned char* from, + unsigned char* to, + RSA* rsa, + int padding); +int RSA_public_decrypt( + int flen, + const unsigned char* from, + unsigned char* to, + RSA* rsa, + int padding); +int RSA_private_decrypt( + int flen, + const unsigned char* from, + unsigned char* to, + RSA* rsa, + int padding); +void RSA_free(RSA* r); +/* "up" the RSA object's reference count */ +int RSA_up_ref(RSA* r); + +int RSA_flags(const RSA* r); + +void RSA_set_default_method(const RSA_METHOD* meth); +const RSA_METHOD* RSA_get_default_method(void); +const RSA_METHOD* RSA_get_method(const RSA* rsa); +int RSA_set_method(RSA* rsa, const RSA_METHOD* meth); + +/* This function needs the memory locking malloc callbacks to be installed */ +int RSA_memory_lock(RSA* r); + +/* these are the actual SSLeay RSA functions */ +const RSA_METHOD* RSA_PKCS1_SSLeay(void); + +const RSA_METHOD* RSA_null_method(void); + +DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPublicKey) + DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPrivateKey) + + typedef struct rsa_pss_params_st { + X509_ALGOR* hashAlgorithm; + X509_ALGOR* maskGenAlgorithm; + ASN1_INTEGER* saltLength; + ASN1_INTEGER* trailerField; +} RSA_PSS_PARAMS; + +DECLARE_ASN1_FUNCTIONS(RSA_PSS_PARAMS) + +typedef struct rsa_oaep_params_st { + X509_ALGOR* hashFunc; + X509_ALGOR* maskGenFunc; + X509_ALGOR* pSourceFunc; +} RSA_OAEP_PARAMS; + +DECLARE_ASN1_FUNCTIONS(RSA_OAEP_PARAMS) + +#ifndef OPENSSL_NO_FP_API +int RSA_print_fp(FILE* fp, const RSA* r, int offset); +#endif + +#ifndef OPENSSL_NO_BIO +int RSA_print(BIO* bp, const RSA* r, int offset); +#endif + +#ifndef OPENSSL_NO_RC4 +int i2d_RSA_NET( + const RSA* a, + unsigned char** pp, + int (*cb)(char* buf, int len, const char* prompt, int verify), + int sgckey); +RSA* d2i_RSA_NET( + RSA** a, + const unsigned char** pp, + long length, + int (*cb)(char* buf, int len, const char* prompt, int verify), + int sgckey); + +int i2d_Netscape_RSA( + const RSA* a, + unsigned char** pp, + int (*cb)(char* buf, int len, const char* prompt, int verify)); +RSA* d2i_Netscape_RSA( + RSA** a, + const unsigned char** pp, + long length, + int (*cb)(char* buf, int len, const char* prompt, int verify)); +#endif + +/* + * The following 2 functions sign and verify a X509_SIG ASN1 object inside + * PKCS#1 padded RSA encryption + */ +int RSA_sign( + int type, + const unsigned char* m, + unsigned int m_length, + unsigned char* sigret, + unsigned int* siglen, + RSA* rsa); +int RSA_verify( + int type, + const unsigned char* m, + unsigned int m_length, + const unsigned char* sigbuf, + unsigned int siglen, + RSA* rsa); + +/* + * The following 2 function sign and verify a ASN1_OCTET_STRING object inside + * PKCS#1 padded RSA encryption + */ +int RSA_sign_ASN1_OCTET_STRING( + int type, + const unsigned char* m, + unsigned int m_length, + unsigned char* sigret, + unsigned int* siglen, + RSA* rsa); +int RSA_verify_ASN1_OCTET_STRING( + int type, + const unsigned char* m, + unsigned int m_length, + unsigned char* sigbuf, + unsigned int siglen, + RSA* rsa); + +int RSA_blinding_on(RSA* rsa, BN_CTX* ctx); +void RSA_blinding_off(RSA* rsa); +BN_BLINDING* RSA_setup_blinding(RSA* rsa, BN_CTX* ctx); + +int RSA_padding_add_PKCS1_type_1( + unsigned char* to, + int tlen, + const unsigned char* f, + int fl); +int RSA_padding_check_PKCS1_type_1( + unsigned char* to, + int tlen, + const unsigned char* f, + int fl, + int rsa_len); +int RSA_padding_add_PKCS1_type_2( + unsigned char* to, + int tlen, + const unsigned char* f, + int fl); +int RSA_padding_check_PKCS1_type_2( + unsigned char* to, + int tlen, + const unsigned char* f, + int fl, + int rsa_len); +int PKCS1_MGF1( + unsigned char* mask, + long len, + const unsigned char* seed, + long seedlen, + const EVP_MD* dgst); +int RSA_padding_add_PKCS1_OAEP( + unsigned char* to, + int tlen, + const unsigned char* f, + int fl, + const unsigned char* p, + int pl); +int RSA_padding_check_PKCS1_OAEP( + unsigned char* to, + int tlen, + const unsigned char* f, + int fl, + int rsa_len, + const unsigned char* p, + int pl); +int RSA_padding_add_PKCS1_OAEP_mgf1( + unsigned char* to, + int tlen, + const unsigned char* from, + int flen, + const unsigned char* param, + int plen, + const EVP_MD* md, + const EVP_MD* mgf1md); +int RSA_padding_check_PKCS1_OAEP_mgf1( + unsigned char* to, + int tlen, + const unsigned char* from, + int flen, + int num, + const unsigned char* param, + int plen, + const EVP_MD* md, + const EVP_MD* mgf1md); +int RSA_padding_add_SSLv23( + unsigned char* to, + int tlen, + const unsigned char* f, + int fl); +int RSA_padding_check_SSLv23( + unsigned char* to, + int tlen, + const unsigned char* f, + int fl, + int rsa_len); +int RSA_padding_add_none( + unsigned char* to, + int tlen, + const unsigned char* f, + int fl); +int RSA_padding_check_none( + unsigned char* to, + int tlen, + const unsigned char* f, + int fl, + int rsa_len); +int RSA_padding_add_X931( + unsigned char* to, + int tlen, + const unsigned char* f, + int fl); +int RSA_padding_check_X931( + unsigned char* to, + int tlen, + const unsigned char* f, + int fl, + int rsa_len); +int RSA_X931_hash_id(int nid); + +int RSA_verify_PKCS1_PSS( + RSA* rsa, + const unsigned char* mHash, + const EVP_MD* Hash, + const unsigned char* EM, + int sLen); +int RSA_padding_add_PKCS1_PSS( + RSA* rsa, + unsigned char* EM, + const unsigned char* mHash, + const EVP_MD* Hash, + int sLen); + +int RSA_verify_PKCS1_PSS_mgf1( + RSA* rsa, + const unsigned char* mHash, + const EVP_MD* Hash, + const EVP_MD* mgf1Hash, + const unsigned char* EM, + int sLen); + +int RSA_padding_add_PKCS1_PSS_mgf1( + RSA* rsa, + unsigned char* EM, + const unsigned char* mHash, + const EVP_MD* Hash, + const EVP_MD* mgf1Hash, + int sLen); + +int RSA_get_ex_new_index( + long argl, + void* argp, + CRYPTO_EX_new* new_func, + CRYPTO_EX_dup* dup_func, + CRYPTO_EX_free* free_func); +int RSA_set_ex_data(RSA* r, int idx, void* arg); +void* RSA_get_ex_data(const RSA* r, int idx); + +RSA* RSAPublicKey_dup(RSA* rsa); +RSA* RSAPrivateKey_dup(RSA* rsa); + +/* + * If this flag is set the RSA method is FIPS compliant and can be used in + * FIPS mode. This is set in the validated module method. If an application + * sets this flag in its own methods it is its responsibility to ensure the + * result is compliant. + */ + +#define RSA_FLAG_FIPS_METHOD 0x0400 + +/* + * If this flag is set the operations normally disabled in FIPS mode are + * permitted it is then the applications responsibility to ensure that the + * usage is compliant. + */ + +#define RSA_FLAG_NON_FIPS_ALLOW 0x0400 +/* + * Application has decided PRNG is good enough to generate a key: don't + * check. + */ +#define RSA_FLAG_CHECKED 0x0800 + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_RSA_strings(void); + +/* Error codes for the RSA functions. */ + +/* Function codes. */ +#define RSA_F_CHECK_PADDING_MD 140 +#define RSA_F_DO_RSA_PRINT 146 +#define RSA_F_INT_RSA_VERIFY 145 +#define RSA_F_MEMORY_LOCK 100 +#define RSA_F_OLD_RSA_PRIV_DECODE 147 +#define RSA_F_PKEY_RSA_CTRL 143 +#define RSA_F_PKEY_RSA_CTRL_STR 144 +#define RSA_F_PKEY_RSA_SIGN 142 +#define RSA_F_PKEY_RSA_VERIFY 154 +#define RSA_F_PKEY_RSA_VERIFYRECOVER 141 +#define RSA_F_RSA_ALGOR_TO_MD 157 +#define RSA_F_RSA_BUILTIN_KEYGEN 129 +#define RSA_F_RSA_CHECK_KEY 123 +#define RSA_F_RSA_CMS_DECRYPT 158 +#define RSA_F_RSA_EAY_PRIVATE_DECRYPT 101 +#define RSA_F_RSA_EAY_PRIVATE_ENCRYPT 102 +#define RSA_F_RSA_EAY_PUBLIC_DECRYPT 103 +#define RSA_F_RSA_EAY_PUBLIC_ENCRYPT 104 +#define RSA_F_RSA_GENERATE_KEY 105 +#define RSA_F_RSA_GENERATE_KEY_EX 155 +#define RSA_F_RSA_ITEM_VERIFY 156 +#define RSA_F_RSA_MEMORY_LOCK 130 +#define RSA_F_RSA_MGF1_TO_MD 159 +#define RSA_F_RSA_NEW_METHOD 106 +#define RSA_F_RSA_NULL 124 +#define RSA_F_RSA_NULL_MOD_EXP 131 +#define RSA_F_RSA_NULL_PRIVATE_DECRYPT 132 +#define RSA_F_RSA_NULL_PRIVATE_ENCRYPT 133 +#define RSA_F_RSA_NULL_PUBLIC_DECRYPT 134 +#define RSA_F_RSA_NULL_PUBLIC_ENCRYPT 135 +#define RSA_F_RSA_PADDING_ADD_NONE 107 +#define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP 121 +#define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP_MGF1 160 +#define RSA_F_RSA_PADDING_ADD_PKCS1_PSS 125 +#define RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1 148 +#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 108 +#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 109 +#define RSA_F_RSA_PADDING_ADD_SSLV23 110 +#define RSA_F_RSA_PADDING_ADD_X931 127 +#define RSA_F_RSA_PADDING_CHECK_NONE 111 +#define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP 122 +#define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP_MGF1 161 +#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1 112 +#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2 113 +#define RSA_F_RSA_PADDING_CHECK_SSLV23 114 +#define RSA_F_RSA_PADDING_CHECK_X931 128 +#define RSA_F_RSA_PRINT 115 +#define RSA_F_RSA_PRINT_FP 116 +#define RSA_F_RSA_PRIVATE_DECRYPT 150 +#define RSA_F_RSA_PRIVATE_ENCRYPT 151 +#define RSA_F_RSA_PRIV_DECODE 137 +#define RSA_F_RSA_PRIV_ENCODE 138 +#define RSA_F_RSA_PSS_TO_CTX 162 +#define RSA_F_RSA_PUBLIC_DECRYPT 152 +#define RSA_F_RSA_PUBLIC_ENCRYPT 153 +#define RSA_F_RSA_PUB_DECODE 139 +#define RSA_F_RSA_SETUP_BLINDING 136 +#define RSA_F_RSA_SIGN 117 +#define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 118 +#define RSA_F_RSA_VERIFY 119 +#define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING 120 +#define RSA_F_RSA_VERIFY_PKCS1_PSS 126 +#define RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1 149 + +/* Reason codes. */ +#define RSA_R_ALGORITHM_MISMATCH 100 +#define RSA_R_BAD_E_VALUE 101 +#define RSA_R_BAD_FIXED_HEADER_DECRYPT 102 +#define RSA_R_BAD_PAD_BYTE_COUNT 103 +#define RSA_R_BAD_SIGNATURE 104 +#define RSA_R_BLOCK_TYPE_IS_NOT_01 106 +#define RSA_R_BLOCK_TYPE_IS_NOT_02 107 +#define RSA_R_DATA_GREATER_THAN_MOD_LEN 108 +#define RSA_R_DATA_TOO_LARGE 109 +#define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 110 +#define RSA_R_DATA_TOO_LARGE_FOR_MODULUS 132 +#define RSA_R_DATA_TOO_SMALL 111 +#define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE 122 +#define RSA_R_DIGEST_DOES_NOT_MATCH 166 +#define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY 112 +#define RSA_R_DMP1_NOT_CONGRUENT_TO_D 124 +#define RSA_R_DMQ1_NOT_CONGRUENT_TO_D 125 +#define RSA_R_D_E_NOT_CONGRUENT_TO_1 123 +#define RSA_R_FIRST_OCTET_INVALID 133 +#define RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE 144 +#define RSA_R_INVALID_DIGEST 160 +#define RSA_R_INVALID_DIGEST_LENGTH 143 +#define RSA_R_INVALID_HEADER 137 +#define RSA_R_INVALID_KEYBITS 145 +#define RSA_R_INVALID_LABEL 161 +#define RSA_R_INVALID_MESSAGE_LENGTH 131 +#define RSA_R_INVALID_MGF1_MD 156 +#define RSA_R_INVALID_OAEP_PARAMETERS 162 +#define RSA_R_INVALID_PADDING 138 +#define RSA_R_INVALID_PADDING_MODE 141 +#define RSA_R_INVALID_PSS_PARAMETERS 149 +#define RSA_R_INVALID_PSS_SALTLEN 146 +#define RSA_R_INVALID_SALT_LENGTH 150 +#define RSA_R_INVALID_TRAILER 139 +#define RSA_R_INVALID_X931_DIGEST 142 +#define RSA_R_IQMP_NOT_INVERSE_OF_Q 126 +#define RSA_R_KEY_SIZE_TOO_SMALL 120 +#define RSA_R_LAST_OCTET_INVALID 134 +#define RSA_R_MODULUS_TOO_LARGE 105 +#define RSA_R_NON_FIPS_RSA_METHOD 157 +#define RSA_R_NO_PUBLIC_EXPONENT 140 +#define RSA_R_NULL_BEFORE_BLOCK_MISSING 113 +#define RSA_R_N_DOES_NOT_EQUAL_P_Q 127 +#define RSA_R_OAEP_DECODING_ERROR 121 +#define RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE 158 +#define RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 148 +#define RSA_R_PADDING_CHECK_FAILED 114 +#define RSA_R_PKCS_DECODING_ERROR 159 +#define RSA_R_P_NOT_PRIME 128 +#define RSA_R_Q_NOT_PRIME 129 +#define RSA_R_RSA_OPERATIONS_NOT_SUPPORTED 130 +#define RSA_R_SLEN_CHECK_FAILED 136 +#define RSA_R_SLEN_RECOVERY_FAILED 135 +#define RSA_R_SSLV3_ROLLBACK_ATTACK 115 +#define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116 +#define RSA_R_UNKNOWN_ALGORITHM_TYPE 117 +#define RSA_R_UNKNOWN_DIGEST 163 +#define RSA_R_UNKNOWN_MASK_DIGEST 151 +#define RSA_R_UNKNOWN_PADDING_TYPE 118 +#define RSA_R_UNKNOWN_PSS_DIGEST 152 +#define RSA_R_UNSUPPORTED_ENCRYPTION_TYPE 164 +#define RSA_R_UNSUPPORTED_LABEL_SOURCE 165 +#define RSA_R_UNSUPPORTED_MASK_ALGORITHM 153 +#define RSA_R_UNSUPPORTED_MASK_PARAMETER 154 +#define RSA_R_UNSUPPORTED_SIGNATURE_TYPE 155 +#define RSA_R_VALUE_MISSING 147 +#define RSA_R_WRONG_SIGNATURE_LENGTH 119 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/safestack.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/safestack.h new file mode 100644 index 0000000..ad3c444 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/safestack.h @@ -0,0 +1,3793 @@ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_SAFESTACK_H +#define HEADER_SAFESTACK_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CHECKED_PTR_OF +#define CHECKED_PTR_OF(type, p) ((void*)(1 ? p : (type*)0)) +#endif + +/* + * In C++ we get problems because an explicit cast is needed from (void *) we + * use CHECKED_STACK_OF to ensure the correct type is passed in the macros + * below. + */ + +#define CHECKED_STACK_OF(type, p) ((_STACK*)(1 ? p : (STACK_OF(type)*)0)) + +#define CHECKED_SK_COPY_FUNC(type, p) \ + ((void* (*)(void*))((1 ? p : (type * (*)(const type*))0))) + +#define CHECKED_SK_FREE_FUNC(type, p) \ + ((void (*)(void*))((1 ? p : (void (*)(type*))0))) + +#define CHECKED_SK_CMP_FUNC(type, p) \ + ((int (*)(const void*, const void*))( \ + (1 ? p : (int (*)(const type* const*, const type* const*))0))) + +#define STACK_OF(type) struct stack_st_##type +#define PREDECLARE_STACK_OF(type) STACK_OF(type); + +#define DECLARE_STACK_OF(type) \ + STACK_OF(type) { \ + _STACK stack; \ + }; +#define DECLARE_SPECIAL_STACK_OF(type, type2) \ + STACK_OF(type) { \ + _STACK stack; \ + }; + +/* nada (obsolete in new safestack approach)*/ +#define IMPLEMENT_STACK_OF(type) + +/*- + * Strings are special: normally an lhash entry will point to a single + * (somewhat) mutable object. In the case of strings: + * + * a) Instead of a single char, there is an array of chars, NUL-terminated. + * b) The string may have be immutable. + * + * So, they need their own declarations. Especially important for + * type-checking tools, such as Deputy. + * + * In practice, however, it appears to be hard to have a const + * string. For now, I'm settling for dealing with the fact it is a + * string at all. + */ +typedef char* OPENSSL_STRING; + +typedef const char* OPENSSL_CSTRING; + +/* + * Confusingly, LHASH_OF(STRING) deals with char ** throughout, but + * STACK_OF(STRING) is really more like STACK_OF(char), only, as mentioned + * above, instead of a single char each entry is a NUL-terminated array of + * chars. So, we have to implement STRING specially for STACK_OF. This is + * dealt with in the autogenerated macros below. + */ + +DECLARE_SPECIAL_STACK_OF(OPENSSL_STRING, char) + +/* + * Similarly, we sometimes use a block of characters, NOT nul-terminated. + * These should also be distinguished from "normal" stacks. + */ +typedef void* OPENSSL_BLOCK; +DECLARE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void) + +/* + * SKM_sk_... stack macros are internal to safestack.h: never use them + * directly, use sk__... instead + */ +#define SKM_sk_new(type, cmp) \ + ((STACK_OF(type)*)sk_new(CHECKED_SK_CMP_FUNC(type, cmp))) +#define SKM_sk_new_null(type) ((STACK_OF(type)*)sk_new_null()) +#define SKM_sk_free(type, st) sk_free(CHECKED_STACK_OF(type, st)) +#define SKM_sk_num(type, st) sk_num(CHECKED_STACK_OF(type, st)) +#define SKM_sk_value(type, st, i) \ + ((type*)sk_value(CHECKED_STACK_OF(type, st), i)) +#define SKM_sk_set(type, st, i, val) \ + sk_set(CHECKED_STACK_OF(type, st), i, CHECKED_PTR_OF(type, val)) +#define SKM_sk_zero(type, st) sk_zero(CHECKED_STACK_OF(type, st)) +#define SKM_sk_push(type, st, val) \ + sk_push(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val)) +#define SKM_sk_unshift(type, st, val) \ + sk_unshift(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val)) +#define SKM_sk_find(type, st, val) \ + sk_find(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val)) +#define SKM_sk_find_ex(type, st, val) \ + sk_find_ex(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val)) +#define SKM_sk_delete(type, st, i) \ + (type*)sk_delete(CHECKED_STACK_OF(type, st), i) +#define SKM_sk_delete_ptr(type, st, ptr) \ + (type*)sk_delete_ptr(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, ptr)) +#define SKM_sk_insert(type, st, val, i) \ + sk_insert(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val), i) +#define SKM_sk_set_cmp_func(type, st, cmp) \ + ((int (*)(const type* const*, const type* const*))sk_set_cmp_func( \ + CHECKED_STACK_OF(type, st), CHECKED_SK_CMP_FUNC(type, cmp))) +#define SKM_sk_dup(type, st) (STACK_OF(type)*)sk_dup(CHECKED_STACK_OF(type, st)) +#define SKM_sk_pop_free(type, st, free_func) \ + sk_pop_free(CHECKED_STACK_OF(type, st), CHECKED_SK_FREE_FUNC(type, free_func)) +#define SKM_sk_deep_copy(type, st, copy_func, free_func) \ + (STACK_OF(type)*)sk_deep_copy( \ + CHECKED_STACK_OF(type, st), \ + CHECKED_SK_COPY_FUNC(type, copy_func), \ + CHECKED_SK_FREE_FUNC(type, free_func)) +#define SKM_sk_shift(type, st) (type*)sk_shift(CHECKED_STACK_OF(type, st)) +#define SKM_sk_pop(type, st) (type*)sk_pop(CHECKED_STACK_OF(type, st)) +#define SKM_sk_sort(type, st) sk_sort(CHECKED_STACK_OF(type, st)) +#define SKM_sk_is_sorted(type, st) sk_is_sorted(CHECKED_STACK_OF(type, st)) +#define SKM_ASN1_SET_OF_d2i( \ + type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + (STACK_OF(type)*)d2i_ASN1_SET( \ + (STACK_OF(OPENSSL_BLOCK)**)CHECKED_PTR_OF(STACK_OF(type)*, st), \ + pp, \ + length, \ + CHECKED_D2I_OF(type, d2i_func), \ + CHECKED_SK_FREE_FUNC(type, free_func), \ + ex_tag, \ + ex_class) +#define SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \ + i2d_ASN1_SET( \ + (STACK_OF(OPENSSL_BLOCK)*)CHECKED_STACK_OF(type, st), \ + pp, \ + CHECKED_I2D_OF(type, i2d_func), \ + ex_tag, \ + ex_class, \ + is_set) +#define SKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \ + ASN1_seq_pack( \ + CHECKED_PTR_OF(STACK_OF(type), st), \ + CHECKED_I2D_OF(type, i2d_func), \ + buf, \ + len) +#define SKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \ + (STACK_OF(type)*)ASN1_seq_unpack( \ + buf, \ + len, \ + CHECKED_D2I_OF(type, d2i_func), \ + CHECKED_SK_FREE_FUNC(type, free_func)) +#define SKM_PKCS12_decrypt_d2i( \ + type, algor, d2i_func, free_func, pass, passlen, oct, seq) \ + (STACK_OF(type)*)PKCS12_decrypt_d2i( \ + algor, \ + CHECKED_D2I_OF(type, d2i_func), \ + CHECKED_SK_FREE_FUNC(type, free_func), \ + pass, \ + passlen, \ + oct, \ + seq) +/* + * This block of defines is updated by util/mkstack.pl, please do not touch! + */ +#define sk_ACCESS_DESCRIPTION_new(cmp) SKM_sk_new(ACCESS_DESCRIPTION, (cmp)) +#define sk_ACCESS_DESCRIPTION_new_null() SKM_sk_new_null(ACCESS_DESCRIPTION) +#define sk_ACCESS_DESCRIPTION_free(st) SKM_sk_free(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_num(st) SKM_sk_num(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_value(st, i) \ + SKM_sk_value(ACCESS_DESCRIPTION, (st), (i)) +#define sk_ACCESS_DESCRIPTION_set(st, i, val) \ + SKM_sk_set(ACCESS_DESCRIPTION, (st), (i), (val)) +#define sk_ACCESS_DESCRIPTION_zero(st) SKM_sk_zero(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_push(st, val) \ + SKM_sk_push(ACCESS_DESCRIPTION, (st), (val)) +#define sk_ACCESS_DESCRIPTION_unshift(st, val) \ + SKM_sk_unshift(ACCESS_DESCRIPTION, (st), (val)) +#define sk_ACCESS_DESCRIPTION_find(st, val) \ + SKM_sk_find(ACCESS_DESCRIPTION, (st), (val)) +#define sk_ACCESS_DESCRIPTION_find_ex(st, val) \ + SKM_sk_find_ex(ACCESS_DESCRIPTION, (st), (val)) +#define sk_ACCESS_DESCRIPTION_delete(st, i) \ + SKM_sk_delete(ACCESS_DESCRIPTION, (st), (i)) +#define sk_ACCESS_DESCRIPTION_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(ACCESS_DESCRIPTION, (st), (ptr)) +#define sk_ACCESS_DESCRIPTION_insert(st, val, i) \ + SKM_sk_insert(ACCESS_DESCRIPTION, (st), (val), (i)) +#define sk_ACCESS_DESCRIPTION_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(ACCESS_DESCRIPTION, (st), (cmp)) +#define sk_ACCESS_DESCRIPTION_dup(st) SKM_sk_dup(ACCESS_DESCRIPTION, st) +#define sk_ACCESS_DESCRIPTION_pop_free(st, free_func) \ + SKM_sk_pop_free(ACCESS_DESCRIPTION, (st), (free_func)) +#define sk_ACCESS_DESCRIPTION_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(ACCESS_DESCRIPTION, (st), (copy_func), (free_func)) +#define sk_ACCESS_DESCRIPTION_shift(st) SKM_sk_shift(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_pop(st) SKM_sk_pop(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_sort(st) SKM_sk_sort(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_is_sorted(st) \ + SKM_sk_is_sorted(ACCESS_DESCRIPTION, (st)) +#define sk_ASIdOrRange_new(cmp) SKM_sk_new(ASIdOrRange, (cmp)) +#define sk_ASIdOrRange_new_null() SKM_sk_new_null(ASIdOrRange) +#define sk_ASIdOrRange_free(st) SKM_sk_free(ASIdOrRange, (st)) +#define sk_ASIdOrRange_num(st) SKM_sk_num(ASIdOrRange, (st)) +#define sk_ASIdOrRange_value(st, i) SKM_sk_value(ASIdOrRange, (st), (i)) +#define sk_ASIdOrRange_set(st, i, val) SKM_sk_set(ASIdOrRange, (st), (i), (val)) +#define sk_ASIdOrRange_zero(st) SKM_sk_zero(ASIdOrRange, (st)) +#define sk_ASIdOrRange_push(st, val) SKM_sk_push(ASIdOrRange, (st), (val)) +#define sk_ASIdOrRange_unshift(st, val) SKM_sk_unshift(ASIdOrRange, (st), (val)) +#define sk_ASIdOrRange_find(st, val) SKM_sk_find(ASIdOrRange, (st), (val)) +#define sk_ASIdOrRange_find_ex(st, val) SKM_sk_find_ex(ASIdOrRange, (st), (val)) +#define sk_ASIdOrRange_delete(st, i) SKM_sk_delete(ASIdOrRange, (st), (i)) +#define sk_ASIdOrRange_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(ASIdOrRange, (st), (ptr)) +#define sk_ASIdOrRange_insert(st, val, i) \ + SKM_sk_insert(ASIdOrRange, (st), (val), (i)) +#define sk_ASIdOrRange_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(ASIdOrRange, (st), (cmp)) +#define sk_ASIdOrRange_dup(st) SKM_sk_dup(ASIdOrRange, st) +#define sk_ASIdOrRange_pop_free(st, free_func) \ + SKM_sk_pop_free(ASIdOrRange, (st), (free_func)) +#define sk_ASIdOrRange_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(ASIdOrRange, (st), (copy_func), (free_func)) +#define sk_ASIdOrRange_shift(st) SKM_sk_shift(ASIdOrRange, (st)) +#define sk_ASIdOrRange_pop(st) SKM_sk_pop(ASIdOrRange, (st)) +#define sk_ASIdOrRange_sort(st) SKM_sk_sort(ASIdOrRange, (st)) +#define sk_ASIdOrRange_is_sorted(st) SKM_sk_is_sorted(ASIdOrRange, (st)) +#define sk_ASN1_GENERALSTRING_new(cmp) SKM_sk_new(ASN1_GENERALSTRING, (cmp)) +#define sk_ASN1_GENERALSTRING_new_null() SKM_sk_new_null(ASN1_GENERALSTRING) +#define sk_ASN1_GENERALSTRING_free(st) SKM_sk_free(ASN1_GENERALSTRING, (st)) +#define sk_ASN1_GENERALSTRING_num(st) SKM_sk_num(ASN1_GENERALSTRING, (st)) +#define sk_ASN1_GENERALSTRING_value(st, i) \ + SKM_sk_value(ASN1_GENERALSTRING, (st), (i)) +#define sk_ASN1_GENERALSTRING_set(st, i, val) \ + SKM_sk_set(ASN1_GENERALSTRING, (st), (i), (val)) +#define sk_ASN1_GENERALSTRING_zero(st) SKM_sk_zero(ASN1_GENERALSTRING, (st)) +#define sk_ASN1_GENERALSTRING_push(st, val) \ + SKM_sk_push(ASN1_GENERALSTRING, (st), (val)) +#define sk_ASN1_GENERALSTRING_unshift(st, val) \ + SKM_sk_unshift(ASN1_GENERALSTRING, (st), (val)) +#define sk_ASN1_GENERALSTRING_find(st, val) \ + SKM_sk_find(ASN1_GENERALSTRING, (st), (val)) +#define sk_ASN1_GENERALSTRING_find_ex(st, val) \ + SKM_sk_find_ex(ASN1_GENERALSTRING, (st), (val)) +#define sk_ASN1_GENERALSTRING_delete(st, i) \ + SKM_sk_delete(ASN1_GENERALSTRING, (st), (i)) +#define sk_ASN1_GENERALSTRING_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(ASN1_GENERALSTRING, (st), (ptr)) +#define sk_ASN1_GENERALSTRING_insert(st, val, i) \ + SKM_sk_insert(ASN1_GENERALSTRING, (st), (val), (i)) +#define sk_ASN1_GENERALSTRING_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(ASN1_GENERALSTRING, (st), (cmp)) +#define sk_ASN1_GENERALSTRING_dup(st) SKM_sk_dup(ASN1_GENERALSTRING, st) +#define sk_ASN1_GENERALSTRING_pop_free(st, free_func) \ + SKM_sk_pop_free(ASN1_GENERALSTRING, (st), (free_func)) +#define sk_ASN1_GENERALSTRING_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(ASN1_GENERALSTRING, (st), (copy_func), (free_func)) +#define sk_ASN1_GENERALSTRING_shift(st) SKM_sk_shift(ASN1_GENERALSTRING, (st)) +#define sk_ASN1_GENERALSTRING_pop(st) SKM_sk_pop(ASN1_GENERALSTRING, (st)) +#define sk_ASN1_GENERALSTRING_sort(st) SKM_sk_sort(ASN1_GENERALSTRING, (st)) +#define sk_ASN1_GENERALSTRING_is_sorted(st) \ + SKM_sk_is_sorted(ASN1_GENERALSTRING, (st)) +#define sk_ASN1_INTEGER_new(cmp) SKM_sk_new(ASN1_INTEGER, (cmp)) +#define sk_ASN1_INTEGER_new_null() SKM_sk_new_null(ASN1_INTEGER) +#define sk_ASN1_INTEGER_free(st) SKM_sk_free(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_num(st) SKM_sk_num(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_value(st, i) SKM_sk_value(ASN1_INTEGER, (st), (i)) +#define sk_ASN1_INTEGER_set(st, i, val) \ + SKM_sk_set(ASN1_INTEGER, (st), (i), (val)) +#define sk_ASN1_INTEGER_zero(st) SKM_sk_zero(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_push(st, val) SKM_sk_push(ASN1_INTEGER, (st), (val)) +#define sk_ASN1_INTEGER_unshift(st, val) \ + SKM_sk_unshift(ASN1_INTEGER, (st), (val)) +#define sk_ASN1_INTEGER_find(st, val) SKM_sk_find(ASN1_INTEGER, (st), (val)) +#define sk_ASN1_INTEGER_find_ex(st, val) \ + SKM_sk_find_ex(ASN1_INTEGER, (st), (val)) +#define sk_ASN1_INTEGER_delete(st, i) SKM_sk_delete(ASN1_INTEGER, (st), (i)) +#define sk_ASN1_INTEGER_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(ASN1_INTEGER, (st), (ptr)) +#define sk_ASN1_INTEGER_insert(st, val, i) \ + SKM_sk_insert(ASN1_INTEGER, (st), (val), (i)) +#define sk_ASN1_INTEGER_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(ASN1_INTEGER, (st), (cmp)) +#define sk_ASN1_INTEGER_dup(st) SKM_sk_dup(ASN1_INTEGER, st) +#define sk_ASN1_INTEGER_pop_free(st, free_func) \ + SKM_sk_pop_free(ASN1_INTEGER, (st), (free_func)) +#define sk_ASN1_INTEGER_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(ASN1_INTEGER, (st), (copy_func), (free_func)) +#define sk_ASN1_INTEGER_shift(st) SKM_sk_shift(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_pop(st) SKM_sk_pop(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_sort(st) SKM_sk_sort(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_is_sorted(st) SKM_sk_is_sorted(ASN1_INTEGER, (st)) +#define sk_ASN1_OBJECT_new(cmp) SKM_sk_new(ASN1_OBJECT, (cmp)) +#define sk_ASN1_OBJECT_new_null() SKM_sk_new_null(ASN1_OBJECT) +#define sk_ASN1_OBJECT_free(st) SKM_sk_free(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_num(st) SKM_sk_num(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_value(st, i) SKM_sk_value(ASN1_OBJECT, (st), (i)) +#define sk_ASN1_OBJECT_set(st, i, val) SKM_sk_set(ASN1_OBJECT, (st), (i), (val)) +#define sk_ASN1_OBJECT_zero(st) SKM_sk_zero(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_push(st, val) SKM_sk_push(ASN1_OBJECT, (st), (val)) +#define sk_ASN1_OBJECT_unshift(st, val) SKM_sk_unshift(ASN1_OBJECT, (st), (val)) +#define sk_ASN1_OBJECT_find(st, val) SKM_sk_find(ASN1_OBJECT, (st), (val)) +#define sk_ASN1_OBJECT_find_ex(st, val) SKM_sk_find_ex(ASN1_OBJECT, (st), (val)) +#define sk_ASN1_OBJECT_delete(st, i) SKM_sk_delete(ASN1_OBJECT, (st), (i)) +#define sk_ASN1_OBJECT_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(ASN1_OBJECT, (st), (ptr)) +#define sk_ASN1_OBJECT_insert(st, val, i) \ + SKM_sk_insert(ASN1_OBJECT, (st), (val), (i)) +#define sk_ASN1_OBJECT_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(ASN1_OBJECT, (st), (cmp)) +#define sk_ASN1_OBJECT_dup(st) SKM_sk_dup(ASN1_OBJECT, st) +#define sk_ASN1_OBJECT_pop_free(st, free_func) \ + SKM_sk_pop_free(ASN1_OBJECT, (st), (free_func)) +#define sk_ASN1_OBJECT_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(ASN1_OBJECT, (st), (copy_func), (free_func)) +#define sk_ASN1_OBJECT_shift(st) SKM_sk_shift(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_pop(st) SKM_sk_pop(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_sort(st) SKM_sk_sort(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_is_sorted(st) SKM_sk_is_sorted(ASN1_OBJECT, (st)) +#define sk_ASN1_STRING_TABLE_new(cmp) SKM_sk_new(ASN1_STRING_TABLE, (cmp)) +#define sk_ASN1_STRING_TABLE_new_null() SKM_sk_new_null(ASN1_STRING_TABLE) +#define sk_ASN1_STRING_TABLE_free(st) SKM_sk_free(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_num(st) SKM_sk_num(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_value(st, i) \ + SKM_sk_value(ASN1_STRING_TABLE, (st), (i)) +#define sk_ASN1_STRING_TABLE_set(st, i, val) \ + SKM_sk_set(ASN1_STRING_TABLE, (st), (i), (val)) +#define sk_ASN1_STRING_TABLE_zero(st) SKM_sk_zero(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_push(st, val) \ + SKM_sk_push(ASN1_STRING_TABLE, (st), (val)) +#define sk_ASN1_STRING_TABLE_unshift(st, val) \ + SKM_sk_unshift(ASN1_STRING_TABLE, (st), (val)) +#define sk_ASN1_STRING_TABLE_find(st, val) \ + SKM_sk_find(ASN1_STRING_TABLE, (st), (val)) +#define sk_ASN1_STRING_TABLE_find_ex(st, val) \ + SKM_sk_find_ex(ASN1_STRING_TABLE, (st), (val)) +#define sk_ASN1_STRING_TABLE_delete(st, i) \ + SKM_sk_delete(ASN1_STRING_TABLE, (st), (i)) +#define sk_ASN1_STRING_TABLE_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(ASN1_STRING_TABLE, (st), (ptr)) +#define sk_ASN1_STRING_TABLE_insert(st, val, i) \ + SKM_sk_insert(ASN1_STRING_TABLE, (st), (val), (i)) +#define sk_ASN1_STRING_TABLE_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(ASN1_STRING_TABLE, (st), (cmp)) +#define sk_ASN1_STRING_TABLE_dup(st) SKM_sk_dup(ASN1_STRING_TABLE, st) +#define sk_ASN1_STRING_TABLE_pop_free(st, free_func) \ + SKM_sk_pop_free(ASN1_STRING_TABLE, (st), (free_func)) +#define sk_ASN1_STRING_TABLE_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(ASN1_STRING_TABLE, (st), (copy_func), (free_func)) +#define sk_ASN1_STRING_TABLE_shift(st) SKM_sk_shift(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_pop(st) SKM_sk_pop(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_sort(st) SKM_sk_sort(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_is_sorted(st) \ + SKM_sk_is_sorted(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_TYPE_new(cmp) SKM_sk_new(ASN1_TYPE, (cmp)) +#define sk_ASN1_TYPE_new_null() SKM_sk_new_null(ASN1_TYPE) +#define sk_ASN1_TYPE_free(st) SKM_sk_free(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_num(st) SKM_sk_num(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_value(st, i) SKM_sk_value(ASN1_TYPE, (st), (i)) +#define sk_ASN1_TYPE_set(st, i, val) SKM_sk_set(ASN1_TYPE, (st), (i), (val)) +#define sk_ASN1_TYPE_zero(st) SKM_sk_zero(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_push(st, val) SKM_sk_push(ASN1_TYPE, (st), (val)) +#define sk_ASN1_TYPE_unshift(st, val) SKM_sk_unshift(ASN1_TYPE, (st), (val)) +#define sk_ASN1_TYPE_find(st, val) SKM_sk_find(ASN1_TYPE, (st), (val)) +#define sk_ASN1_TYPE_find_ex(st, val) SKM_sk_find_ex(ASN1_TYPE, (st), (val)) +#define sk_ASN1_TYPE_delete(st, i) SKM_sk_delete(ASN1_TYPE, (st), (i)) +#define sk_ASN1_TYPE_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(ASN1_TYPE, (st), (ptr)) +#define sk_ASN1_TYPE_insert(st, val, i) \ + SKM_sk_insert(ASN1_TYPE, (st), (val), (i)) +#define sk_ASN1_TYPE_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(ASN1_TYPE, (st), (cmp)) +#define sk_ASN1_TYPE_dup(st) SKM_sk_dup(ASN1_TYPE, st) +#define sk_ASN1_TYPE_pop_free(st, free_func) \ + SKM_sk_pop_free(ASN1_TYPE, (st), (free_func)) +#define sk_ASN1_TYPE_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(ASN1_TYPE, (st), (copy_func), (free_func)) +#define sk_ASN1_TYPE_shift(st) SKM_sk_shift(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_pop(st) SKM_sk_pop(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_sort(st) SKM_sk_sort(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_is_sorted(st) SKM_sk_is_sorted(ASN1_TYPE, (st)) +#define sk_ASN1_UTF8STRING_new(cmp) SKM_sk_new(ASN1_UTF8STRING, (cmp)) +#define sk_ASN1_UTF8STRING_new_null() SKM_sk_new_null(ASN1_UTF8STRING) +#define sk_ASN1_UTF8STRING_free(st) SKM_sk_free(ASN1_UTF8STRING, (st)) +#define sk_ASN1_UTF8STRING_num(st) SKM_sk_num(ASN1_UTF8STRING, (st)) +#define sk_ASN1_UTF8STRING_value(st, i) SKM_sk_value(ASN1_UTF8STRING, (st), (i)) +#define sk_ASN1_UTF8STRING_set(st, i, val) \ + SKM_sk_set(ASN1_UTF8STRING, (st), (i), (val)) +#define sk_ASN1_UTF8STRING_zero(st) SKM_sk_zero(ASN1_UTF8STRING, (st)) +#define sk_ASN1_UTF8STRING_push(st, val) \ + SKM_sk_push(ASN1_UTF8STRING, (st), (val)) +#define sk_ASN1_UTF8STRING_unshift(st, val) \ + SKM_sk_unshift(ASN1_UTF8STRING, (st), (val)) +#define sk_ASN1_UTF8STRING_find(st, val) \ + SKM_sk_find(ASN1_UTF8STRING, (st), (val)) +#define sk_ASN1_UTF8STRING_find_ex(st, val) \ + SKM_sk_find_ex(ASN1_UTF8STRING, (st), (val)) +#define sk_ASN1_UTF8STRING_delete(st, i) \ + SKM_sk_delete(ASN1_UTF8STRING, (st), (i)) +#define sk_ASN1_UTF8STRING_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(ASN1_UTF8STRING, (st), (ptr)) +#define sk_ASN1_UTF8STRING_insert(st, val, i) \ + SKM_sk_insert(ASN1_UTF8STRING, (st), (val), (i)) +#define sk_ASN1_UTF8STRING_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(ASN1_UTF8STRING, (st), (cmp)) +#define sk_ASN1_UTF8STRING_dup(st) SKM_sk_dup(ASN1_UTF8STRING, st) +#define sk_ASN1_UTF8STRING_pop_free(st, free_func) \ + SKM_sk_pop_free(ASN1_UTF8STRING, (st), (free_func)) +#define sk_ASN1_UTF8STRING_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(ASN1_UTF8STRING, (st), (copy_func), (free_func)) +#define sk_ASN1_UTF8STRING_shift(st) SKM_sk_shift(ASN1_UTF8STRING, (st)) +#define sk_ASN1_UTF8STRING_pop(st) SKM_sk_pop(ASN1_UTF8STRING, (st)) +#define sk_ASN1_UTF8STRING_sort(st) SKM_sk_sort(ASN1_UTF8STRING, (st)) +#define sk_ASN1_UTF8STRING_is_sorted(st) SKM_sk_is_sorted(ASN1_UTF8STRING, (st)) +#define sk_ASN1_VALUE_new(cmp) SKM_sk_new(ASN1_VALUE, (cmp)) +#define sk_ASN1_VALUE_new_null() SKM_sk_new_null(ASN1_VALUE) +#define sk_ASN1_VALUE_free(st) SKM_sk_free(ASN1_VALUE, (st)) +#define sk_ASN1_VALUE_num(st) SKM_sk_num(ASN1_VALUE, (st)) +#define sk_ASN1_VALUE_value(st, i) SKM_sk_value(ASN1_VALUE, (st), (i)) +#define sk_ASN1_VALUE_set(st, i, val) SKM_sk_set(ASN1_VALUE, (st), (i), (val)) +#define sk_ASN1_VALUE_zero(st) SKM_sk_zero(ASN1_VALUE, (st)) +#define sk_ASN1_VALUE_push(st, val) SKM_sk_push(ASN1_VALUE, (st), (val)) +#define sk_ASN1_VALUE_unshift(st, val) SKM_sk_unshift(ASN1_VALUE, (st), (val)) +#define sk_ASN1_VALUE_find(st, val) SKM_sk_find(ASN1_VALUE, (st), (val)) +#define sk_ASN1_VALUE_find_ex(st, val) SKM_sk_find_ex(ASN1_VALUE, (st), (val)) +#define sk_ASN1_VALUE_delete(st, i) SKM_sk_delete(ASN1_VALUE, (st), (i)) +#define sk_ASN1_VALUE_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(ASN1_VALUE, (st), (ptr)) +#define sk_ASN1_VALUE_insert(st, val, i) \ + SKM_sk_insert(ASN1_VALUE, (st), (val), (i)) +#define sk_ASN1_VALUE_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(ASN1_VALUE, (st), (cmp)) +#define sk_ASN1_VALUE_dup(st) SKM_sk_dup(ASN1_VALUE, st) +#define sk_ASN1_VALUE_pop_free(st, free_func) \ + SKM_sk_pop_free(ASN1_VALUE, (st), (free_func)) +#define sk_ASN1_VALUE_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(ASN1_VALUE, (st), (copy_func), (free_func)) +#define sk_ASN1_VALUE_shift(st) SKM_sk_shift(ASN1_VALUE, (st)) +#define sk_ASN1_VALUE_pop(st) SKM_sk_pop(ASN1_VALUE, (st)) +#define sk_ASN1_VALUE_sort(st) SKM_sk_sort(ASN1_VALUE, (st)) +#define sk_ASN1_VALUE_is_sorted(st) SKM_sk_is_sorted(ASN1_VALUE, (st)) +#define sk_BIO_new(cmp) SKM_sk_new(BIO, (cmp)) +#define sk_BIO_new_null() SKM_sk_new_null(BIO) +#define sk_BIO_free(st) SKM_sk_free(BIO, (st)) +#define sk_BIO_num(st) SKM_sk_num(BIO, (st)) +#define sk_BIO_value(st, i) SKM_sk_value(BIO, (st), (i)) +#define sk_BIO_set(st, i, val) SKM_sk_set(BIO, (st), (i), (val)) +#define sk_BIO_zero(st) SKM_sk_zero(BIO, (st)) +#define sk_BIO_push(st, val) SKM_sk_push(BIO, (st), (val)) +#define sk_BIO_unshift(st, val) SKM_sk_unshift(BIO, (st), (val)) +#define sk_BIO_find(st, val) SKM_sk_find(BIO, (st), (val)) +#define sk_BIO_find_ex(st, val) SKM_sk_find_ex(BIO, (st), (val)) +#define sk_BIO_delete(st, i) SKM_sk_delete(BIO, (st), (i)) +#define sk_BIO_delete_ptr(st, ptr) SKM_sk_delete_ptr(BIO, (st), (ptr)) +#define sk_BIO_insert(st, val, i) SKM_sk_insert(BIO, (st), (val), (i)) +#define sk_BIO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(BIO, (st), (cmp)) +#define sk_BIO_dup(st) SKM_sk_dup(BIO, st) +#define sk_BIO_pop_free(st, free_func) SKM_sk_pop_free(BIO, (st), (free_func)) +#define sk_BIO_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(BIO, (st), (copy_func), (free_func)) +#define sk_BIO_shift(st) SKM_sk_shift(BIO, (st)) +#define sk_BIO_pop(st) SKM_sk_pop(BIO, (st)) +#define sk_BIO_sort(st) SKM_sk_sort(BIO, (st)) +#define sk_BIO_is_sorted(st) SKM_sk_is_sorted(BIO, (st)) +#define sk_BY_DIR_ENTRY_new(cmp) SKM_sk_new(BY_DIR_ENTRY, (cmp)) +#define sk_BY_DIR_ENTRY_new_null() SKM_sk_new_null(BY_DIR_ENTRY) +#define sk_BY_DIR_ENTRY_free(st) SKM_sk_free(BY_DIR_ENTRY, (st)) +#define sk_BY_DIR_ENTRY_num(st) SKM_sk_num(BY_DIR_ENTRY, (st)) +#define sk_BY_DIR_ENTRY_value(st, i) SKM_sk_value(BY_DIR_ENTRY, (st), (i)) +#define sk_BY_DIR_ENTRY_set(st, i, val) \ + SKM_sk_set(BY_DIR_ENTRY, (st), (i), (val)) +#define sk_BY_DIR_ENTRY_zero(st) SKM_sk_zero(BY_DIR_ENTRY, (st)) +#define sk_BY_DIR_ENTRY_push(st, val) SKM_sk_push(BY_DIR_ENTRY, (st), (val)) +#define sk_BY_DIR_ENTRY_unshift(st, val) \ + SKM_sk_unshift(BY_DIR_ENTRY, (st), (val)) +#define sk_BY_DIR_ENTRY_find(st, val) SKM_sk_find(BY_DIR_ENTRY, (st), (val)) +#define sk_BY_DIR_ENTRY_find_ex(st, val) \ + SKM_sk_find_ex(BY_DIR_ENTRY, (st), (val)) +#define sk_BY_DIR_ENTRY_delete(st, i) SKM_sk_delete(BY_DIR_ENTRY, (st), (i)) +#define sk_BY_DIR_ENTRY_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(BY_DIR_ENTRY, (st), (ptr)) +#define sk_BY_DIR_ENTRY_insert(st, val, i) \ + SKM_sk_insert(BY_DIR_ENTRY, (st), (val), (i)) +#define sk_BY_DIR_ENTRY_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(BY_DIR_ENTRY, (st), (cmp)) +#define sk_BY_DIR_ENTRY_dup(st) SKM_sk_dup(BY_DIR_ENTRY, st) +#define sk_BY_DIR_ENTRY_pop_free(st, free_func) \ + SKM_sk_pop_free(BY_DIR_ENTRY, (st), (free_func)) +#define sk_BY_DIR_ENTRY_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(BY_DIR_ENTRY, (st), (copy_func), (free_func)) +#define sk_BY_DIR_ENTRY_shift(st) SKM_sk_shift(BY_DIR_ENTRY, (st)) +#define sk_BY_DIR_ENTRY_pop(st) SKM_sk_pop(BY_DIR_ENTRY, (st)) +#define sk_BY_DIR_ENTRY_sort(st) SKM_sk_sort(BY_DIR_ENTRY, (st)) +#define sk_BY_DIR_ENTRY_is_sorted(st) SKM_sk_is_sorted(BY_DIR_ENTRY, (st)) +#define sk_BY_DIR_HASH_new(cmp) SKM_sk_new(BY_DIR_HASH, (cmp)) +#define sk_BY_DIR_HASH_new_null() SKM_sk_new_null(BY_DIR_HASH) +#define sk_BY_DIR_HASH_free(st) SKM_sk_free(BY_DIR_HASH, (st)) +#define sk_BY_DIR_HASH_num(st) SKM_sk_num(BY_DIR_HASH, (st)) +#define sk_BY_DIR_HASH_value(st, i) SKM_sk_value(BY_DIR_HASH, (st), (i)) +#define sk_BY_DIR_HASH_set(st, i, val) SKM_sk_set(BY_DIR_HASH, (st), (i), (val)) +#define sk_BY_DIR_HASH_zero(st) SKM_sk_zero(BY_DIR_HASH, (st)) +#define sk_BY_DIR_HASH_push(st, val) SKM_sk_push(BY_DIR_HASH, (st), (val)) +#define sk_BY_DIR_HASH_unshift(st, val) SKM_sk_unshift(BY_DIR_HASH, (st), (val)) +#define sk_BY_DIR_HASH_find(st, val) SKM_sk_find(BY_DIR_HASH, (st), (val)) +#define sk_BY_DIR_HASH_find_ex(st, val) SKM_sk_find_ex(BY_DIR_HASH, (st), (val)) +#define sk_BY_DIR_HASH_delete(st, i) SKM_sk_delete(BY_DIR_HASH, (st), (i)) +#define sk_BY_DIR_HASH_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(BY_DIR_HASH, (st), (ptr)) +#define sk_BY_DIR_HASH_insert(st, val, i) \ + SKM_sk_insert(BY_DIR_HASH, (st), (val), (i)) +#define sk_BY_DIR_HASH_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(BY_DIR_HASH, (st), (cmp)) +#define sk_BY_DIR_HASH_dup(st) SKM_sk_dup(BY_DIR_HASH, st) +#define sk_BY_DIR_HASH_pop_free(st, free_func) \ + SKM_sk_pop_free(BY_DIR_HASH, (st), (free_func)) +#define sk_BY_DIR_HASH_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(BY_DIR_HASH, (st), (copy_func), (free_func)) +#define sk_BY_DIR_HASH_shift(st) SKM_sk_shift(BY_DIR_HASH, (st)) +#define sk_BY_DIR_HASH_pop(st) SKM_sk_pop(BY_DIR_HASH, (st)) +#define sk_BY_DIR_HASH_sort(st) SKM_sk_sort(BY_DIR_HASH, (st)) +#define sk_BY_DIR_HASH_is_sorted(st) SKM_sk_is_sorted(BY_DIR_HASH, (st)) +#define sk_CMS_CertificateChoices_new(cmp) \ + SKM_sk_new(CMS_CertificateChoices, (cmp)) +#define sk_CMS_CertificateChoices_new_null() \ + SKM_sk_new_null(CMS_CertificateChoices) +#define sk_CMS_CertificateChoices_free(st) \ + SKM_sk_free(CMS_CertificateChoices, (st)) +#define sk_CMS_CertificateChoices_num(st) \ + SKM_sk_num(CMS_CertificateChoices, (st)) +#define sk_CMS_CertificateChoices_value(st, i) \ + SKM_sk_value(CMS_CertificateChoices, (st), (i)) +#define sk_CMS_CertificateChoices_set(st, i, val) \ + SKM_sk_set(CMS_CertificateChoices, (st), (i), (val)) +#define sk_CMS_CertificateChoices_zero(st) \ + SKM_sk_zero(CMS_CertificateChoices, (st)) +#define sk_CMS_CertificateChoices_push(st, val) \ + SKM_sk_push(CMS_CertificateChoices, (st), (val)) +#define sk_CMS_CertificateChoices_unshift(st, val) \ + SKM_sk_unshift(CMS_CertificateChoices, (st), (val)) +#define sk_CMS_CertificateChoices_find(st, val) \ + SKM_sk_find(CMS_CertificateChoices, (st), (val)) +#define sk_CMS_CertificateChoices_find_ex(st, val) \ + SKM_sk_find_ex(CMS_CertificateChoices, (st), (val)) +#define sk_CMS_CertificateChoices_delete(st, i) \ + SKM_sk_delete(CMS_CertificateChoices, (st), (i)) +#define sk_CMS_CertificateChoices_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(CMS_CertificateChoices, (st), (ptr)) +#define sk_CMS_CertificateChoices_insert(st, val, i) \ + SKM_sk_insert(CMS_CertificateChoices, (st), (val), (i)) +#define sk_CMS_CertificateChoices_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(CMS_CertificateChoices, (st), (cmp)) +#define sk_CMS_CertificateChoices_dup(st) SKM_sk_dup(CMS_CertificateChoices, st) +#define sk_CMS_CertificateChoices_pop_free(st, free_func) \ + SKM_sk_pop_free(CMS_CertificateChoices, (st), (free_func)) +#define sk_CMS_CertificateChoices_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(CMS_CertificateChoices, (st), (copy_func), (free_func)) +#define sk_CMS_CertificateChoices_shift(st) \ + SKM_sk_shift(CMS_CertificateChoices, (st)) +#define sk_CMS_CertificateChoices_pop(st) \ + SKM_sk_pop(CMS_CertificateChoices, (st)) +#define sk_CMS_CertificateChoices_sort(st) \ + SKM_sk_sort(CMS_CertificateChoices, (st)) +#define sk_CMS_CertificateChoices_is_sorted(st) \ + SKM_sk_is_sorted(CMS_CertificateChoices, (st)) +#define sk_CMS_RecipientEncryptedKey_new(cmp) \ + SKM_sk_new(CMS_RecipientEncryptedKey, (cmp)) +#define sk_CMS_RecipientEncryptedKey_new_null() \ + SKM_sk_new_null(CMS_RecipientEncryptedKey) +#define sk_CMS_RecipientEncryptedKey_free(st) \ + SKM_sk_free(CMS_RecipientEncryptedKey, (st)) +#define sk_CMS_RecipientEncryptedKey_num(st) \ + SKM_sk_num(CMS_RecipientEncryptedKey, (st)) +#define sk_CMS_RecipientEncryptedKey_value(st, i) \ + SKM_sk_value(CMS_RecipientEncryptedKey, (st), (i)) +#define sk_CMS_RecipientEncryptedKey_set(st, i, val) \ + SKM_sk_set(CMS_RecipientEncryptedKey, (st), (i), (val)) +#define sk_CMS_RecipientEncryptedKey_zero(st) \ + SKM_sk_zero(CMS_RecipientEncryptedKey, (st)) +#define sk_CMS_RecipientEncryptedKey_push(st, val) \ + SKM_sk_push(CMS_RecipientEncryptedKey, (st), (val)) +#define sk_CMS_RecipientEncryptedKey_unshift(st, val) \ + SKM_sk_unshift(CMS_RecipientEncryptedKey, (st), (val)) +#define sk_CMS_RecipientEncryptedKey_find(st, val) \ + SKM_sk_find(CMS_RecipientEncryptedKey, (st), (val)) +#define sk_CMS_RecipientEncryptedKey_find_ex(st, val) \ + SKM_sk_find_ex(CMS_RecipientEncryptedKey, (st), (val)) +#define sk_CMS_RecipientEncryptedKey_delete(st, i) \ + SKM_sk_delete(CMS_RecipientEncryptedKey, (st), (i)) +#define sk_CMS_RecipientEncryptedKey_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(CMS_RecipientEncryptedKey, (st), (ptr)) +#define sk_CMS_RecipientEncryptedKey_insert(st, val, i) \ + SKM_sk_insert(CMS_RecipientEncryptedKey, (st), (val), (i)) +#define sk_CMS_RecipientEncryptedKey_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(CMS_RecipientEncryptedKey, (st), (cmp)) +#define sk_CMS_RecipientEncryptedKey_dup(st) \ + SKM_sk_dup(CMS_RecipientEncryptedKey, st) +#define sk_CMS_RecipientEncryptedKey_pop_free(st, free_func) \ + SKM_sk_pop_free(CMS_RecipientEncryptedKey, (st), (free_func)) +#define sk_CMS_RecipientEncryptedKey_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(CMS_RecipientEncryptedKey, (st), (copy_func), (free_func)) +#define sk_CMS_RecipientEncryptedKey_shift(st) \ + SKM_sk_shift(CMS_RecipientEncryptedKey, (st)) +#define sk_CMS_RecipientEncryptedKey_pop(st) \ + SKM_sk_pop(CMS_RecipientEncryptedKey, (st)) +#define sk_CMS_RecipientEncryptedKey_sort(st) \ + SKM_sk_sort(CMS_RecipientEncryptedKey, (st)) +#define sk_CMS_RecipientEncryptedKey_is_sorted(st) \ + SKM_sk_is_sorted(CMS_RecipientEncryptedKey, (st)) +#define sk_CMS_RecipientInfo_new(cmp) SKM_sk_new(CMS_RecipientInfo, (cmp)) +#define sk_CMS_RecipientInfo_new_null() SKM_sk_new_null(CMS_RecipientInfo) +#define sk_CMS_RecipientInfo_free(st) SKM_sk_free(CMS_RecipientInfo, (st)) +#define sk_CMS_RecipientInfo_num(st) SKM_sk_num(CMS_RecipientInfo, (st)) +#define sk_CMS_RecipientInfo_value(st, i) \ + SKM_sk_value(CMS_RecipientInfo, (st), (i)) +#define sk_CMS_RecipientInfo_set(st, i, val) \ + SKM_sk_set(CMS_RecipientInfo, (st), (i), (val)) +#define sk_CMS_RecipientInfo_zero(st) SKM_sk_zero(CMS_RecipientInfo, (st)) +#define sk_CMS_RecipientInfo_push(st, val) \ + SKM_sk_push(CMS_RecipientInfo, (st), (val)) +#define sk_CMS_RecipientInfo_unshift(st, val) \ + SKM_sk_unshift(CMS_RecipientInfo, (st), (val)) +#define sk_CMS_RecipientInfo_find(st, val) \ + SKM_sk_find(CMS_RecipientInfo, (st), (val)) +#define sk_CMS_RecipientInfo_find_ex(st, val) \ + SKM_sk_find_ex(CMS_RecipientInfo, (st), (val)) +#define sk_CMS_RecipientInfo_delete(st, i) \ + SKM_sk_delete(CMS_RecipientInfo, (st), (i)) +#define sk_CMS_RecipientInfo_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(CMS_RecipientInfo, (st), (ptr)) +#define sk_CMS_RecipientInfo_insert(st, val, i) \ + SKM_sk_insert(CMS_RecipientInfo, (st), (val), (i)) +#define sk_CMS_RecipientInfo_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(CMS_RecipientInfo, (st), (cmp)) +#define sk_CMS_RecipientInfo_dup(st) SKM_sk_dup(CMS_RecipientInfo, st) +#define sk_CMS_RecipientInfo_pop_free(st, free_func) \ + SKM_sk_pop_free(CMS_RecipientInfo, (st), (free_func)) +#define sk_CMS_RecipientInfo_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(CMS_RecipientInfo, (st), (copy_func), (free_func)) +#define sk_CMS_RecipientInfo_shift(st) SKM_sk_shift(CMS_RecipientInfo, (st)) +#define sk_CMS_RecipientInfo_pop(st) SKM_sk_pop(CMS_RecipientInfo, (st)) +#define sk_CMS_RecipientInfo_sort(st) SKM_sk_sort(CMS_RecipientInfo, (st)) +#define sk_CMS_RecipientInfo_is_sorted(st) \ + SKM_sk_is_sorted(CMS_RecipientInfo, (st)) +#define sk_CMS_RevocationInfoChoice_new(cmp) \ + SKM_sk_new(CMS_RevocationInfoChoice, (cmp)) +#define sk_CMS_RevocationInfoChoice_new_null() \ + SKM_sk_new_null(CMS_RevocationInfoChoice) +#define sk_CMS_RevocationInfoChoice_free(st) \ + SKM_sk_free(CMS_RevocationInfoChoice, (st)) +#define sk_CMS_RevocationInfoChoice_num(st) \ + SKM_sk_num(CMS_RevocationInfoChoice, (st)) +#define sk_CMS_RevocationInfoChoice_value(st, i) \ + SKM_sk_value(CMS_RevocationInfoChoice, (st), (i)) +#define sk_CMS_RevocationInfoChoice_set(st, i, val) \ + SKM_sk_set(CMS_RevocationInfoChoice, (st), (i), (val)) +#define sk_CMS_RevocationInfoChoice_zero(st) \ + SKM_sk_zero(CMS_RevocationInfoChoice, (st)) +#define sk_CMS_RevocationInfoChoice_push(st, val) \ + SKM_sk_push(CMS_RevocationInfoChoice, (st), (val)) +#define sk_CMS_RevocationInfoChoice_unshift(st, val) \ + SKM_sk_unshift(CMS_RevocationInfoChoice, (st), (val)) +#define sk_CMS_RevocationInfoChoice_find(st, val) \ + SKM_sk_find(CMS_RevocationInfoChoice, (st), (val)) +#define sk_CMS_RevocationInfoChoice_find_ex(st, val) \ + SKM_sk_find_ex(CMS_RevocationInfoChoice, (st), (val)) +#define sk_CMS_RevocationInfoChoice_delete(st, i) \ + SKM_sk_delete(CMS_RevocationInfoChoice, (st), (i)) +#define sk_CMS_RevocationInfoChoice_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(CMS_RevocationInfoChoice, (st), (ptr)) +#define sk_CMS_RevocationInfoChoice_insert(st, val, i) \ + SKM_sk_insert(CMS_RevocationInfoChoice, (st), (val), (i)) +#define sk_CMS_RevocationInfoChoice_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(CMS_RevocationInfoChoice, (st), (cmp)) +#define sk_CMS_RevocationInfoChoice_dup(st) \ + SKM_sk_dup(CMS_RevocationInfoChoice, st) +#define sk_CMS_RevocationInfoChoice_pop_free(st, free_func) \ + SKM_sk_pop_free(CMS_RevocationInfoChoice, (st), (free_func)) +#define sk_CMS_RevocationInfoChoice_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(CMS_RevocationInfoChoice, (st), (copy_func), (free_func)) +#define sk_CMS_RevocationInfoChoice_shift(st) \ + SKM_sk_shift(CMS_RevocationInfoChoice, (st)) +#define sk_CMS_RevocationInfoChoice_pop(st) \ + SKM_sk_pop(CMS_RevocationInfoChoice, (st)) +#define sk_CMS_RevocationInfoChoice_sort(st) \ + SKM_sk_sort(CMS_RevocationInfoChoice, (st)) +#define sk_CMS_RevocationInfoChoice_is_sorted(st) \ + SKM_sk_is_sorted(CMS_RevocationInfoChoice, (st)) +#define sk_CMS_SignerInfo_new(cmp) SKM_sk_new(CMS_SignerInfo, (cmp)) +#define sk_CMS_SignerInfo_new_null() SKM_sk_new_null(CMS_SignerInfo) +#define sk_CMS_SignerInfo_free(st) SKM_sk_free(CMS_SignerInfo, (st)) +#define sk_CMS_SignerInfo_num(st) SKM_sk_num(CMS_SignerInfo, (st)) +#define sk_CMS_SignerInfo_value(st, i) SKM_sk_value(CMS_SignerInfo, (st), (i)) +#define sk_CMS_SignerInfo_set(st, i, val) \ + SKM_sk_set(CMS_SignerInfo, (st), (i), (val)) +#define sk_CMS_SignerInfo_zero(st) SKM_sk_zero(CMS_SignerInfo, (st)) +#define sk_CMS_SignerInfo_push(st, val) SKM_sk_push(CMS_SignerInfo, (st), (val)) +#define sk_CMS_SignerInfo_unshift(st, val) \ + SKM_sk_unshift(CMS_SignerInfo, (st), (val)) +#define sk_CMS_SignerInfo_find(st, val) SKM_sk_find(CMS_SignerInfo, (st), (val)) +#define sk_CMS_SignerInfo_find_ex(st, val) \ + SKM_sk_find_ex(CMS_SignerInfo, (st), (val)) +#define sk_CMS_SignerInfo_delete(st, i) SKM_sk_delete(CMS_SignerInfo, (st), (i)) +#define sk_CMS_SignerInfo_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(CMS_SignerInfo, (st), (ptr)) +#define sk_CMS_SignerInfo_insert(st, val, i) \ + SKM_sk_insert(CMS_SignerInfo, (st), (val), (i)) +#define sk_CMS_SignerInfo_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(CMS_SignerInfo, (st), (cmp)) +#define sk_CMS_SignerInfo_dup(st) SKM_sk_dup(CMS_SignerInfo, st) +#define sk_CMS_SignerInfo_pop_free(st, free_func) \ + SKM_sk_pop_free(CMS_SignerInfo, (st), (free_func)) +#define sk_CMS_SignerInfo_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(CMS_SignerInfo, (st), (copy_func), (free_func)) +#define sk_CMS_SignerInfo_shift(st) SKM_sk_shift(CMS_SignerInfo, (st)) +#define sk_CMS_SignerInfo_pop(st) SKM_sk_pop(CMS_SignerInfo, (st)) +#define sk_CMS_SignerInfo_sort(st) SKM_sk_sort(CMS_SignerInfo, (st)) +#define sk_CMS_SignerInfo_is_sorted(st) SKM_sk_is_sorted(CMS_SignerInfo, (st)) +#define sk_CONF_IMODULE_new(cmp) SKM_sk_new(CONF_IMODULE, (cmp)) +#define sk_CONF_IMODULE_new_null() SKM_sk_new_null(CONF_IMODULE) +#define sk_CONF_IMODULE_free(st) SKM_sk_free(CONF_IMODULE, (st)) +#define sk_CONF_IMODULE_num(st) SKM_sk_num(CONF_IMODULE, (st)) +#define sk_CONF_IMODULE_value(st, i) SKM_sk_value(CONF_IMODULE, (st), (i)) +#define sk_CONF_IMODULE_set(st, i, val) \ + SKM_sk_set(CONF_IMODULE, (st), (i), (val)) +#define sk_CONF_IMODULE_zero(st) SKM_sk_zero(CONF_IMODULE, (st)) +#define sk_CONF_IMODULE_push(st, val) SKM_sk_push(CONF_IMODULE, (st), (val)) +#define sk_CONF_IMODULE_unshift(st, val) \ + SKM_sk_unshift(CONF_IMODULE, (st), (val)) +#define sk_CONF_IMODULE_find(st, val) SKM_sk_find(CONF_IMODULE, (st), (val)) +#define sk_CONF_IMODULE_find_ex(st, val) \ + SKM_sk_find_ex(CONF_IMODULE, (st), (val)) +#define sk_CONF_IMODULE_delete(st, i) SKM_sk_delete(CONF_IMODULE, (st), (i)) +#define sk_CONF_IMODULE_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(CONF_IMODULE, (st), (ptr)) +#define sk_CONF_IMODULE_insert(st, val, i) \ + SKM_sk_insert(CONF_IMODULE, (st), (val), (i)) +#define sk_CONF_IMODULE_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(CONF_IMODULE, (st), (cmp)) +#define sk_CONF_IMODULE_dup(st) SKM_sk_dup(CONF_IMODULE, st) +#define sk_CONF_IMODULE_pop_free(st, free_func) \ + SKM_sk_pop_free(CONF_IMODULE, (st), (free_func)) +#define sk_CONF_IMODULE_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(CONF_IMODULE, (st), (copy_func), (free_func)) +#define sk_CONF_IMODULE_shift(st) SKM_sk_shift(CONF_IMODULE, (st)) +#define sk_CONF_IMODULE_pop(st) SKM_sk_pop(CONF_IMODULE, (st)) +#define sk_CONF_IMODULE_sort(st) SKM_sk_sort(CONF_IMODULE, (st)) +#define sk_CONF_IMODULE_is_sorted(st) SKM_sk_is_sorted(CONF_IMODULE, (st)) +#define sk_CONF_MODULE_new(cmp) SKM_sk_new(CONF_MODULE, (cmp)) +#define sk_CONF_MODULE_new_null() SKM_sk_new_null(CONF_MODULE) +#define sk_CONF_MODULE_free(st) SKM_sk_free(CONF_MODULE, (st)) +#define sk_CONF_MODULE_num(st) SKM_sk_num(CONF_MODULE, (st)) +#define sk_CONF_MODULE_value(st, i) SKM_sk_value(CONF_MODULE, (st), (i)) +#define sk_CONF_MODULE_set(st, i, val) SKM_sk_set(CONF_MODULE, (st), (i), (val)) +#define sk_CONF_MODULE_zero(st) SKM_sk_zero(CONF_MODULE, (st)) +#define sk_CONF_MODULE_push(st, val) SKM_sk_push(CONF_MODULE, (st), (val)) +#define sk_CONF_MODULE_unshift(st, val) SKM_sk_unshift(CONF_MODULE, (st), (val)) +#define sk_CONF_MODULE_find(st, val) SKM_sk_find(CONF_MODULE, (st), (val)) +#define sk_CONF_MODULE_find_ex(st, val) SKM_sk_find_ex(CONF_MODULE, (st), (val)) +#define sk_CONF_MODULE_delete(st, i) SKM_sk_delete(CONF_MODULE, (st), (i)) +#define sk_CONF_MODULE_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(CONF_MODULE, (st), (ptr)) +#define sk_CONF_MODULE_insert(st, val, i) \ + SKM_sk_insert(CONF_MODULE, (st), (val), (i)) +#define sk_CONF_MODULE_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(CONF_MODULE, (st), (cmp)) +#define sk_CONF_MODULE_dup(st) SKM_sk_dup(CONF_MODULE, st) +#define sk_CONF_MODULE_pop_free(st, free_func) \ + SKM_sk_pop_free(CONF_MODULE, (st), (free_func)) +#define sk_CONF_MODULE_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(CONF_MODULE, (st), (copy_func), (free_func)) +#define sk_CONF_MODULE_shift(st) SKM_sk_shift(CONF_MODULE, (st)) +#define sk_CONF_MODULE_pop(st) SKM_sk_pop(CONF_MODULE, (st)) +#define sk_CONF_MODULE_sort(st) SKM_sk_sort(CONF_MODULE, (st)) +#define sk_CONF_MODULE_is_sorted(st) SKM_sk_is_sorted(CONF_MODULE, (st)) +#define sk_CONF_VALUE_new(cmp) SKM_sk_new(CONF_VALUE, (cmp)) +#define sk_CONF_VALUE_new_null() SKM_sk_new_null(CONF_VALUE) +#define sk_CONF_VALUE_free(st) SKM_sk_free(CONF_VALUE, (st)) +#define sk_CONF_VALUE_num(st) SKM_sk_num(CONF_VALUE, (st)) +#define sk_CONF_VALUE_value(st, i) SKM_sk_value(CONF_VALUE, (st), (i)) +#define sk_CONF_VALUE_set(st, i, val) SKM_sk_set(CONF_VALUE, (st), (i), (val)) +#define sk_CONF_VALUE_zero(st) SKM_sk_zero(CONF_VALUE, (st)) +#define sk_CONF_VALUE_push(st, val) SKM_sk_push(CONF_VALUE, (st), (val)) +#define sk_CONF_VALUE_unshift(st, val) SKM_sk_unshift(CONF_VALUE, (st), (val)) +#define sk_CONF_VALUE_find(st, val) SKM_sk_find(CONF_VALUE, (st), (val)) +#define sk_CONF_VALUE_find_ex(st, val) SKM_sk_find_ex(CONF_VALUE, (st), (val)) +#define sk_CONF_VALUE_delete(st, i) SKM_sk_delete(CONF_VALUE, (st), (i)) +#define sk_CONF_VALUE_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(CONF_VALUE, (st), (ptr)) +#define sk_CONF_VALUE_insert(st, val, i) \ + SKM_sk_insert(CONF_VALUE, (st), (val), (i)) +#define sk_CONF_VALUE_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(CONF_VALUE, (st), (cmp)) +#define sk_CONF_VALUE_dup(st) SKM_sk_dup(CONF_VALUE, st) +#define sk_CONF_VALUE_pop_free(st, free_func) \ + SKM_sk_pop_free(CONF_VALUE, (st), (free_func)) +#define sk_CONF_VALUE_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(CONF_VALUE, (st), (copy_func), (free_func)) +#define sk_CONF_VALUE_shift(st) SKM_sk_shift(CONF_VALUE, (st)) +#define sk_CONF_VALUE_pop(st) SKM_sk_pop(CONF_VALUE, (st)) +#define sk_CONF_VALUE_sort(st) SKM_sk_sort(CONF_VALUE, (st)) +#define sk_CONF_VALUE_is_sorted(st) SKM_sk_is_sorted(CONF_VALUE, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_new(cmp) SKM_sk_new(CRYPTO_EX_DATA_FUNCS, (cmp)) +#define sk_CRYPTO_EX_DATA_FUNCS_new_null() SKM_sk_new_null(CRYPTO_EX_DATA_FUNCS) +#define sk_CRYPTO_EX_DATA_FUNCS_free(st) SKM_sk_free(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_num(st) SKM_sk_num(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_value(st, i) \ + SKM_sk_value(CRYPTO_EX_DATA_FUNCS, (st), (i)) +#define sk_CRYPTO_EX_DATA_FUNCS_set(st, i, val) \ + SKM_sk_set(CRYPTO_EX_DATA_FUNCS, (st), (i), (val)) +#define sk_CRYPTO_EX_DATA_FUNCS_zero(st) SKM_sk_zero(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_push(st, val) \ + SKM_sk_push(CRYPTO_EX_DATA_FUNCS, (st), (val)) +#define sk_CRYPTO_EX_DATA_FUNCS_unshift(st, val) \ + SKM_sk_unshift(CRYPTO_EX_DATA_FUNCS, (st), (val)) +#define sk_CRYPTO_EX_DATA_FUNCS_find(st, val) \ + SKM_sk_find(CRYPTO_EX_DATA_FUNCS, (st), (val)) +#define sk_CRYPTO_EX_DATA_FUNCS_find_ex(st, val) \ + SKM_sk_find_ex(CRYPTO_EX_DATA_FUNCS, (st), (val)) +#define sk_CRYPTO_EX_DATA_FUNCS_delete(st, i) \ + SKM_sk_delete(CRYPTO_EX_DATA_FUNCS, (st), (i)) +#define sk_CRYPTO_EX_DATA_FUNCS_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(CRYPTO_EX_DATA_FUNCS, (st), (ptr)) +#define sk_CRYPTO_EX_DATA_FUNCS_insert(st, val, i) \ + SKM_sk_insert(CRYPTO_EX_DATA_FUNCS, (st), (val), (i)) +#define sk_CRYPTO_EX_DATA_FUNCS_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(CRYPTO_EX_DATA_FUNCS, (st), (cmp)) +#define sk_CRYPTO_EX_DATA_FUNCS_dup(st) SKM_sk_dup(CRYPTO_EX_DATA_FUNCS, st) +#define sk_CRYPTO_EX_DATA_FUNCS_pop_free(st, free_func) \ + SKM_sk_pop_free(CRYPTO_EX_DATA_FUNCS, (st), (free_func)) +#define sk_CRYPTO_EX_DATA_FUNCS_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(CRYPTO_EX_DATA_FUNCS, (st), (copy_func), (free_func)) +#define sk_CRYPTO_EX_DATA_FUNCS_shift(st) \ + SKM_sk_shift(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_pop(st) SKM_sk_pop(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_sort(st) SKM_sk_sort(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_is_sorted(st) \ + SKM_sk_is_sorted(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_dynlock_new(cmp) SKM_sk_new(CRYPTO_dynlock, (cmp)) +#define sk_CRYPTO_dynlock_new_null() SKM_sk_new_null(CRYPTO_dynlock) +#define sk_CRYPTO_dynlock_free(st) SKM_sk_free(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_num(st) SKM_sk_num(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_value(st, i) SKM_sk_value(CRYPTO_dynlock, (st), (i)) +#define sk_CRYPTO_dynlock_set(st, i, val) \ + SKM_sk_set(CRYPTO_dynlock, (st), (i), (val)) +#define sk_CRYPTO_dynlock_zero(st) SKM_sk_zero(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_push(st, val) SKM_sk_push(CRYPTO_dynlock, (st), (val)) +#define sk_CRYPTO_dynlock_unshift(st, val) \ + SKM_sk_unshift(CRYPTO_dynlock, (st), (val)) +#define sk_CRYPTO_dynlock_find(st, val) SKM_sk_find(CRYPTO_dynlock, (st), (val)) +#define sk_CRYPTO_dynlock_find_ex(st, val) \ + SKM_sk_find_ex(CRYPTO_dynlock, (st), (val)) +#define sk_CRYPTO_dynlock_delete(st, i) SKM_sk_delete(CRYPTO_dynlock, (st), (i)) +#define sk_CRYPTO_dynlock_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(CRYPTO_dynlock, (st), (ptr)) +#define sk_CRYPTO_dynlock_insert(st, val, i) \ + SKM_sk_insert(CRYPTO_dynlock, (st), (val), (i)) +#define sk_CRYPTO_dynlock_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(CRYPTO_dynlock, (st), (cmp)) +#define sk_CRYPTO_dynlock_dup(st) SKM_sk_dup(CRYPTO_dynlock, st) +#define sk_CRYPTO_dynlock_pop_free(st, free_func) \ + SKM_sk_pop_free(CRYPTO_dynlock, (st), (free_func)) +#define sk_CRYPTO_dynlock_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(CRYPTO_dynlock, (st), (copy_func), (free_func)) +#define sk_CRYPTO_dynlock_shift(st) SKM_sk_shift(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_pop(st) SKM_sk_pop(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_sort(st) SKM_sk_sort(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_is_sorted(st) SKM_sk_is_sorted(CRYPTO_dynlock, (st)) +#define sk_DIST_POINT_new(cmp) SKM_sk_new(DIST_POINT, (cmp)) +#define sk_DIST_POINT_new_null() SKM_sk_new_null(DIST_POINT) +#define sk_DIST_POINT_free(st) SKM_sk_free(DIST_POINT, (st)) +#define sk_DIST_POINT_num(st) SKM_sk_num(DIST_POINT, (st)) +#define sk_DIST_POINT_value(st, i) SKM_sk_value(DIST_POINT, (st), (i)) +#define sk_DIST_POINT_set(st, i, val) SKM_sk_set(DIST_POINT, (st), (i), (val)) +#define sk_DIST_POINT_zero(st) SKM_sk_zero(DIST_POINT, (st)) +#define sk_DIST_POINT_push(st, val) SKM_sk_push(DIST_POINT, (st), (val)) +#define sk_DIST_POINT_unshift(st, val) SKM_sk_unshift(DIST_POINT, (st), (val)) +#define sk_DIST_POINT_find(st, val) SKM_sk_find(DIST_POINT, (st), (val)) +#define sk_DIST_POINT_find_ex(st, val) SKM_sk_find_ex(DIST_POINT, (st), (val)) +#define sk_DIST_POINT_delete(st, i) SKM_sk_delete(DIST_POINT, (st), (i)) +#define sk_DIST_POINT_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(DIST_POINT, (st), (ptr)) +#define sk_DIST_POINT_insert(st, val, i) \ + SKM_sk_insert(DIST_POINT, (st), (val), (i)) +#define sk_DIST_POINT_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(DIST_POINT, (st), (cmp)) +#define sk_DIST_POINT_dup(st) SKM_sk_dup(DIST_POINT, st) +#define sk_DIST_POINT_pop_free(st, free_func) \ + SKM_sk_pop_free(DIST_POINT, (st), (free_func)) +#define sk_DIST_POINT_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(DIST_POINT, (st), (copy_func), (free_func)) +#define sk_DIST_POINT_shift(st) SKM_sk_shift(DIST_POINT, (st)) +#define sk_DIST_POINT_pop(st) SKM_sk_pop(DIST_POINT, (st)) +#define sk_DIST_POINT_sort(st) SKM_sk_sort(DIST_POINT, (st)) +#define sk_DIST_POINT_is_sorted(st) SKM_sk_is_sorted(DIST_POINT, (st)) +#define sk_ENGINE_new(cmp) SKM_sk_new(ENGINE, (cmp)) +#define sk_ENGINE_new_null() SKM_sk_new_null(ENGINE) +#define sk_ENGINE_free(st) SKM_sk_free(ENGINE, (st)) +#define sk_ENGINE_num(st) SKM_sk_num(ENGINE, (st)) +#define sk_ENGINE_value(st, i) SKM_sk_value(ENGINE, (st), (i)) +#define sk_ENGINE_set(st, i, val) SKM_sk_set(ENGINE, (st), (i), (val)) +#define sk_ENGINE_zero(st) SKM_sk_zero(ENGINE, (st)) +#define sk_ENGINE_push(st, val) SKM_sk_push(ENGINE, (st), (val)) +#define sk_ENGINE_unshift(st, val) SKM_sk_unshift(ENGINE, (st), (val)) +#define sk_ENGINE_find(st, val) SKM_sk_find(ENGINE, (st), (val)) +#define sk_ENGINE_find_ex(st, val) SKM_sk_find_ex(ENGINE, (st), (val)) +#define sk_ENGINE_delete(st, i) SKM_sk_delete(ENGINE, (st), (i)) +#define sk_ENGINE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ENGINE, (st), (ptr)) +#define sk_ENGINE_insert(st, val, i) SKM_sk_insert(ENGINE, (st), (val), (i)) +#define sk_ENGINE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ENGINE, (st), (cmp)) +#define sk_ENGINE_dup(st) SKM_sk_dup(ENGINE, st) +#define sk_ENGINE_pop_free(st, free_func) \ + SKM_sk_pop_free(ENGINE, (st), (free_func)) +#define sk_ENGINE_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(ENGINE, (st), (copy_func), (free_func)) +#define sk_ENGINE_shift(st) SKM_sk_shift(ENGINE, (st)) +#define sk_ENGINE_pop(st) SKM_sk_pop(ENGINE, (st)) +#define sk_ENGINE_sort(st) SKM_sk_sort(ENGINE, (st)) +#define sk_ENGINE_is_sorted(st) SKM_sk_is_sorted(ENGINE, (st)) +#define sk_ENGINE_CLEANUP_ITEM_new(cmp) SKM_sk_new(ENGINE_CLEANUP_ITEM, (cmp)) +#define sk_ENGINE_CLEANUP_ITEM_new_null() SKM_sk_new_null(ENGINE_CLEANUP_ITEM) +#define sk_ENGINE_CLEANUP_ITEM_free(st) SKM_sk_free(ENGINE_CLEANUP_ITEM, (st)) +#define sk_ENGINE_CLEANUP_ITEM_num(st) SKM_sk_num(ENGINE_CLEANUP_ITEM, (st)) +#define sk_ENGINE_CLEANUP_ITEM_value(st, i) \ + SKM_sk_value(ENGINE_CLEANUP_ITEM, (st), (i)) +#define sk_ENGINE_CLEANUP_ITEM_set(st, i, val) \ + SKM_sk_set(ENGINE_CLEANUP_ITEM, (st), (i), (val)) +#define sk_ENGINE_CLEANUP_ITEM_zero(st) SKM_sk_zero(ENGINE_CLEANUP_ITEM, (st)) +#define sk_ENGINE_CLEANUP_ITEM_push(st, val) \ + SKM_sk_push(ENGINE_CLEANUP_ITEM, (st), (val)) +#define sk_ENGINE_CLEANUP_ITEM_unshift(st, val) \ + SKM_sk_unshift(ENGINE_CLEANUP_ITEM, (st), (val)) +#define sk_ENGINE_CLEANUP_ITEM_find(st, val) \ + SKM_sk_find(ENGINE_CLEANUP_ITEM, (st), (val)) +#define sk_ENGINE_CLEANUP_ITEM_find_ex(st, val) \ + SKM_sk_find_ex(ENGINE_CLEANUP_ITEM, (st), (val)) +#define sk_ENGINE_CLEANUP_ITEM_delete(st, i) \ + SKM_sk_delete(ENGINE_CLEANUP_ITEM, (st), (i)) +#define sk_ENGINE_CLEANUP_ITEM_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(ENGINE_CLEANUP_ITEM, (st), (ptr)) +#define sk_ENGINE_CLEANUP_ITEM_insert(st, val, i) \ + SKM_sk_insert(ENGINE_CLEANUP_ITEM, (st), (val), (i)) +#define sk_ENGINE_CLEANUP_ITEM_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(ENGINE_CLEANUP_ITEM, (st), (cmp)) +#define sk_ENGINE_CLEANUP_ITEM_dup(st) SKM_sk_dup(ENGINE_CLEANUP_ITEM, st) +#define sk_ENGINE_CLEANUP_ITEM_pop_free(st, free_func) \ + SKM_sk_pop_free(ENGINE_CLEANUP_ITEM, (st), (free_func)) +#define sk_ENGINE_CLEANUP_ITEM_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(ENGINE_CLEANUP_ITEM, (st), (copy_func), (free_func)) +#define sk_ENGINE_CLEANUP_ITEM_shift(st) SKM_sk_shift(ENGINE_CLEANUP_ITEM, (st)) +#define sk_ENGINE_CLEANUP_ITEM_pop(st) SKM_sk_pop(ENGINE_CLEANUP_ITEM, (st)) +#define sk_ENGINE_CLEANUP_ITEM_sort(st) SKM_sk_sort(ENGINE_CLEANUP_ITEM, (st)) +#define sk_ENGINE_CLEANUP_ITEM_is_sorted(st) \ + SKM_sk_is_sorted(ENGINE_CLEANUP_ITEM, (st)) +#define sk_ESS_CERT_ID_new(cmp) SKM_sk_new(ESS_CERT_ID, (cmp)) +#define sk_ESS_CERT_ID_new_null() SKM_sk_new_null(ESS_CERT_ID) +#define sk_ESS_CERT_ID_free(st) SKM_sk_free(ESS_CERT_ID, (st)) +#define sk_ESS_CERT_ID_num(st) SKM_sk_num(ESS_CERT_ID, (st)) +#define sk_ESS_CERT_ID_value(st, i) SKM_sk_value(ESS_CERT_ID, (st), (i)) +#define sk_ESS_CERT_ID_set(st, i, val) SKM_sk_set(ESS_CERT_ID, (st), (i), (val)) +#define sk_ESS_CERT_ID_zero(st) SKM_sk_zero(ESS_CERT_ID, (st)) +#define sk_ESS_CERT_ID_push(st, val) SKM_sk_push(ESS_CERT_ID, (st), (val)) +#define sk_ESS_CERT_ID_unshift(st, val) SKM_sk_unshift(ESS_CERT_ID, (st), (val)) +#define sk_ESS_CERT_ID_find(st, val) SKM_sk_find(ESS_CERT_ID, (st), (val)) +#define sk_ESS_CERT_ID_find_ex(st, val) SKM_sk_find_ex(ESS_CERT_ID, (st), (val)) +#define sk_ESS_CERT_ID_delete(st, i) SKM_sk_delete(ESS_CERT_ID, (st), (i)) +#define sk_ESS_CERT_ID_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(ESS_CERT_ID, (st), (ptr)) +#define sk_ESS_CERT_ID_insert(st, val, i) \ + SKM_sk_insert(ESS_CERT_ID, (st), (val), (i)) +#define sk_ESS_CERT_ID_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(ESS_CERT_ID, (st), (cmp)) +#define sk_ESS_CERT_ID_dup(st) SKM_sk_dup(ESS_CERT_ID, st) +#define sk_ESS_CERT_ID_pop_free(st, free_func) \ + SKM_sk_pop_free(ESS_CERT_ID, (st), (free_func)) +#define sk_ESS_CERT_ID_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(ESS_CERT_ID, (st), (copy_func), (free_func)) +#define sk_ESS_CERT_ID_shift(st) SKM_sk_shift(ESS_CERT_ID, (st)) +#define sk_ESS_CERT_ID_pop(st) SKM_sk_pop(ESS_CERT_ID, (st)) +#define sk_ESS_CERT_ID_sort(st) SKM_sk_sort(ESS_CERT_ID, (st)) +#define sk_ESS_CERT_ID_is_sorted(st) SKM_sk_is_sorted(ESS_CERT_ID, (st)) +#define sk_EVP_MD_new(cmp) SKM_sk_new(EVP_MD, (cmp)) +#define sk_EVP_MD_new_null() SKM_sk_new_null(EVP_MD) +#define sk_EVP_MD_free(st) SKM_sk_free(EVP_MD, (st)) +#define sk_EVP_MD_num(st) SKM_sk_num(EVP_MD, (st)) +#define sk_EVP_MD_value(st, i) SKM_sk_value(EVP_MD, (st), (i)) +#define sk_EVP_MD_set(st, i, val) SKM_sk_set(EVP_MD, (st), (i), (val)) +#define sk_EVP_MD_zero(st) SKM_sk_zero(EVP_MD, (st)) +#define sk_EVP_MD_push(st, val) SKM_sk_push(EVP_MD, (st), (val)) +#define sk_EVP_MD_unshift(st, val) SKM_sk_unshift(EVP_MD, (st), (val)) +#define sk_EVP_MD_find(st, val) SKM_sk_find(EVP_MD, (st), (val)) +#define sk_EVP_MD_find_ex(st, val) SKM_sk_find_ex(EVP_MD, (st), (val)) +#define sk_EVP_MD_delete(st, i) SKM_sk_delete(EVP_MD, (st), (i)) +#define sk_EVP_MD_delete_ptr(st, ptr) SKM_sk_delete_ptr(EVP_MD, (st), (ptr)) +#define sk_EVP_MD_insert(st, val, i) SKM_sk_insert(EVP_MD, (st), (val), (i)) +#define sk_EVP_MD_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(EVP_MD, (st), (cmp)) +#define sk_EVP_MD_dup(st) SKM_sk_dup(EVP_MD, st) +#define sk_EVP_MD_pop_free(st, free_func) \ + SKM_sk_pop_free(EVP_MD, (st), (free_func)) +#define sk_EVP_MD_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(EVP_MD, (st), (copy_func), (free_func)) +#define sk_EVP_MD_shift(st) SKM_sk_shift(EVP_MD, (st)) +#define sk_EVP_MD_pop(st) SKM_sk_pop(EVP_MD, (st)) +#define sk_EVP_MD_sort(st) SKM_sk_sort(EVP_MD, (st)) +#define sk_EVP_MD_is_sorted(st) SKM_sk_is_sorted(EVP_MD, (st)) +#define sk_EVP_PBE_CTL_new(cmp) SKM_sk_new(EVP_PBE_CTL, (cmp)) +#define sk_EVP_PBE_CTL_new_null() SKM_sk_new_null(EVP_PBE_CTL) +#define sk_EVP_PBE_CTL_free(st) SKM_sk_free(EVP_PBE_CTL, (st)) +#define sk_EVP_PBE_CTL_num(st) SKM_sk_num(EVP_PBE_CTL, (st)) +#define sk_EVP_PBE_CTL_value(st, i) SKM_sk_value(EVP_PBE_CTL, (st), (i)) +#define sk_EVP_PBE_CTL_set(st, i, val) SKM_sk_set(EVP_PBE_CTL, (st), (i), (val)) +#define sk_EVP_PBE_CTL_zero(st) SKM_sk_zero(EVP_PBE_CTL, (st)) +#define sk_EVP_PBE_CTL_push(st, val) SKM_sk_push(EVP_PBE_CTL, (st), (val)) +#define sk_EVP_PBE_CTL_unshift(st, val) SKM_sk_unshift(EVP_PBE_CTL, (st), (val)) +#define sk_EVP_PBE_CTL_find(st, val) SKM_sk_find(EVP_PBE_CTL, (st), (val)) +#define sk_EVP_PBE_CTL_find_ex(st, val) SKM_sk_find_ex(EVP_PBE_CTL, (st), (val)) +#define sk_EVP_PBE_CTL_delete(st, i) SKM_sk_delete(EVP_PBE_CTL, (st), (i)) +#define sk_EVP_PBE_CTL_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(EVP_PBE_CTL, (st), (ptr)) +#define sk_EVP_PBE_CTL_insert(st, val, i) \ + SKM_sk_insert(EVP_PBE_CTL, (st), (val), (i)) +#define sk_EVP_PBE_CTL_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(EVP_PBE_CTL, (st), (cmp)) +#define sk_EVP_PBE_CTL_dup(st) SKM_sk_dup(EVP_PBE_CTL, st) +#define sk_EVP_PBE_CTL_pop_free(st, free_func) \ + SKM_sk_pop_free(EVP_PBE_CTL, (st), (free_func)) +#define sk_EVP_PBE_CTL_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(EVP_PBE_CTL, (st), (copy_func), (free_func)) +#define sk_EVP_PBE_CTL_shift(st) SKM_sk_shift(EVP_PBE_CTL, (st)) +#define sk_EVP_PBE_CTL_pop(st) SKM_sk_pop(EVP_PBE_CTL, (st)) +#define sk_EVP_PBE_CTL_sort(st) SKM_sk_sort(EVP_PBE_CTL, (st)) +#define sk_EVP_PBE_CTL_is_sorted(st) SKM_sk_is_sorted(EVP_PBE_CTL, (st)) +#define sk_EVP_PKEY_ASN1_METHOD_new(cmp) SKM_sk_new(EVP_PKEY_ASN1_METHOD, (cmp)) +#define sk_EVP_PKEY_ASN1_METHOD_new_null() SKM_sk_new_null(EVP_PKEY_ASN1_METHOD) +#define sk_EVP_PKEY_ASN1_METHOD_free(st) SKM_sk_free(EVP_PKEY_ASN1_METHOD, (st)) +#define sk_EVP_PKEY_ASN1_METHOD_num(st) SKM_sk_num(EVP_PKEY_ASN1_METHOD, (st)) +#define sk_EVP_PKEY_ASN1_METHOD_value(st, i) \ + SKM_sk_value(EVP_PKEY_ASN1_METHOD, (st), (i)) +#define sk_EVP_PKEY_ASN1_METHOD_set(st, i, val) \ + SKM_sk_set(EVP_PKEY_ASN1_METHOD, (st), (i), (val)) +#define sk_EVP_PKEY_ASN1_METHOD_zero(st) SKM_sk_zero(EVP_PKEY_ASN1_METHOD, (st)) +#define sk_EVP_PKEY_ASN1_METHOD_push(st, val) \ + SKM_sk_push(EVP_PKEY_ASN1_METHOD, (st), (val)) +#define sk_EVP_PKEY_ASN1_METHOD_unshift(st, val) \ + SKM_sk_unshift(EVP_PKEY_ASN1_METHOD, (st), (val)) +#define sk_EVP_PKEY_ASN1_METHOD_find(st, val) \ + SKM_sk_find(EVP_PKEY_ASN1_METHOD, (st), (val)) +#define sk_EVP_PKEY_ASN1_METHOD_find_ex(st, val) \ + SKM_sk_find_ex(EVP_PKEY_ASN1_METHOD, (st), (val)) +#define sk_EVP_PKEY_ASN1_METHOD_delete(st, i) \ + SKM_sk_delete(EVP_PKEY_ASN1_METHOD, (st), (i)) +#define sk_EVP_PKEY_ASN1_METHOD_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(EVP_PKEY_ASN1_METHOD, (st), (ptr)) +#define sk_EVP_PKEY_ASN1_METHOD_insert(st, val, i) \ + SKM_sk_insert(EVP_PKEY_ASN1_METHOD, (st), (val), (i)) +#define sk_EVP_PKEY_ASN1_METHOD_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(EVP_PKEY_ASN1_METHOD, (st), (cmp)) +#define sk_EVP_PKEY_ASN1_METHOD_dup(st) SKM_sk_dup(EVP_PKEY_ASN1_METHOD, st) +#define sk_EVP_PKEY_ASN1_METHOD_pop_free(st, free_func) \ + SKM_sk_pop_free(EVP_PKEY_ASN1_METHOD, (st), (free_func)) +#define sk_EVP_PKEY_ASN1_METHOD_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(EVP_PKEY_ASN1_METHOD, (st), (copy_func), (free_func)) +#define sk_EVP_PKEY_ASN1_METHOD_shift(st) \ + SKM_sk_shift(EVP_PKEY_ASN1_METHOD, (st)) +#define sk_EVP_PKEY_ASN1_METHOD_pop(st) SKM_sk_pop(EVP_PKEY_ASN1_METHOD, (st)) +#define sk_EVP_PKEY_ASN1_METHOD_sort(st) SKM_sk_sort(EVP_PKEY_ASN1_METHOD, (st)) +#define sk_EVP_PKEY_ASN1_METHOD_is_sorted(st) \ + SKM_sk_is_sorted(EVP_PKEY_ASN1_METHOD, (st)) +#define sk_EVP_PKEY_METHOD_new(cmp) SKM_sk_new(EVP_PKEY_METHOD, (cmp)) +#define sk_EVP_PKEY_METHOD_new_null() SKM_sk_new_null(EVP_PKEY_METHOD) +#define sk_EVP_PKEY_METHOD_free(st) SKM_sk_free(EVP_PKEY_METHOD, (st)) +#define sk_EVP_PKEY_METHOD_num(st) SKM_sk_num(EVP_PKEY_METHOD, (st)) +#define sk_EVP_PKEY_METHOD_value(st, i) SKM_sk_value(EVP_PKEY_METHOD, (st), (i)) +#define sk_EVP_PKEY_METHOD_set(st, i, val) \ + SKM_sk_set(EVP_PKEY_METHOD, (st), (i), (val)) +#define sk_EVP_PKEY_METHOD_zero(st) SKM_sk_zero(EVP_PKEY_METHOD, (st)) +#define sk_EVP_PKEY_METHOD_push(st, val) \ + SKM_sk_push(EVP_PKEY_METHOD, (st), (val)) +#define sk_EVP_PKEY_METHOD_unshift(st, val) \ + SKM_sk_unshift(EVP_PKEY_METHOD, (st), (val)) +#define sk_EVP_PKEY_METHOD_find(st, val) \ + SKM_sk_find(EVP_PKEY_METHOD, (st), (val)) +#define sk_EVP_PKEY_METHOD_find_ex(st, val) \ + SKM_sk_find_ex(EVP_PKEY_METHOD, (st), (val)) +#define sk_EVP_PKEY_METHOD_delete(st, i) \ + SKM_sk_delete(EVP_PKEY_METHOD, (st), (i)) +#define sk_EVP_PKEY_METHOD_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(EVP_PKEY_METHOD, (st), (ptr)) +#define sk_EVP_PKEY_METHOD_insert(st, val, i) \ + SKM_sk_insert(EVP_PKEY_METHOD, (st), (val), (i)) +#define sk_EVP_PKEY_METHOD_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(EVP_PKEY_METHOD, (st), (cmp)) +#define sk_EVP_PKEY_METHOD_dup(st) SKM_sk_dup(EVP_PKEY_METHOD, st) +#define sk_EVP_PKEY_METHOD_pop_free(st, free_func) \ + SKM_sk_pop_free(EVP_PKEY_METHOD, (st), (free_func)) +#define sk_EVP_PKEY_METHOD_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(EVP_PKEY_METHOD, (st), (copy_func), (free_func)) +#define sk_EVP_PKEY_METHOD_shift(st) SKM_sk_shift(EVP_PKEY_METHOD, (st)) +#define sk_EVP_PKEY_METHOD_pop(st) SKM_sk_pop(EVP_PKEY_METHOD, (st)) +#define sk_EVP_PKEY_METHOD_sort(st) SKM_sk_sort(EVP_PKEY_METHOD, (st)) +#define sk_EVP_PKEY_METHOD_is_sorted(st) SKM_sk_is_sorted(EVP_PKEY_METHOD, (st)) +#define sk_GENERAL_NAME_new(cmp) SKM_sk_new(GENERAL_NAME, (cmp)) +#define sk_GENERAL_NAME_new_null() SKM_sk_new_null(GENERAL_NAME) +#define sk_GENERAL_NAME_free(st) SKM_sk_free(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_num(st) SKM_sk_num(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_value(st, i) SKM_sk_value(GENERAL_NAME, (st), (i)) +#define sk_GENERAL_NAME_set(st, i, val) \ + SKM_sk_set(GENERAL_NAME, (st), (i), (val)) +#define sk_GENERAL_NAME_zero(st) SKM_sk_zero(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_push(st, val) SKM_sk_push(GENERAL_NAME, (st), (val)) +#define sk_GENERAL_NAME_unshift(st, val) \ + SKM_sk_unshift(GENERAL_NAME, (st), (val)) +#define sk_GENERAL_NAME_find(st, val) SKM_sk_find(GENERAL_NAME, (st), (val)) +#define sk_GENERAL_NAME_find_ex(st, val) \ + SKM_sk_find_ex(GENERAL_NAME, (st), (val)) +#define sk_GENERAL_NAME_delete(st, i) SKM_sk_delete(GENERAL_NAME, (st), (i)) +#define sk_GENERAL_NAME_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(GENERAL_NAME, (st), (ptr)) +#define sk_GENERAL_NAME_insert(st, val, i) \ + SKM_sk_insert(GENERAL_NAME, (st), (val), (i)) +#define sk_GENERAL_NAME_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(GENERAL_NAME, (st), (cmp)) +#define sk_GENERAL_NAME_dup(st) SKM_sk_dup(GENERAL_NAME, st) +#define sk_GENERAL_NAME_pop_free(st, free_func) \ + SKM_sk_pop_free(GENERAL_NAME, (st), (free_func)) +#define sk_GENERAL_NAME_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(GENERAL_NAME, (st), (copy_func), (free_func)) +#define sk_GENERAL_NAME_shift(st) SKM_sk_shift(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_pop(st) SKM_sk_pop(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_sort(st) SKM_sk_sort(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_is_sorted(st) SKM_sk_is_sorted(GENERAL_NAME, (st)) +#define sk_GENERAL_NAMES_new(cmp) SKM_sk_new(GENERAL_NAMES, (cmp)) +#define sk_GENERAL_NAMES_new_null() SKM_sk_new_null(GENERAL_NAMES) +#define sk_GENERAL_NAMES_free(st) SKM_sk_free(GENERAL_NAMES, (st)) +#define sk_GENERAL_NAMES_num(st) SKM_sk_num(GENERAL_NAMES, (st)) +#define sk_GENERAL_NAMES_value(st, i) SKM_sk_value(GENERAL_NAMES, (st), (i)) +#define sk_GENERAL_NAMES_set(st, i, val) \ + SKM_sk_set(GENERAL_NAMES, (st), (i), (val)) +#define sk_GENERAL_NAMES_zero(st) SKM_sk_zero(GENERAL_NAMES, (st)) +#define sk_GENERAL_NAMES_push(st, val) SKM_sk_push(GENERAL_NAMES, (st), (val)) +#define sk_GENERAL_NAMES_unshift(st, val) \ + SKM_sk_unshift(GENERAL_NAMES, (st), (val)) +#define sk_GENERAL_NAMES_find(st, val) SKM_sk_find(GENERAL_NAMES, (st), (val)) +#define sk_GENERAL_NAMES_find_ex(st, val) \ + SKM_sk_find_ex(GENERAL_NAMES, (st), (val)) +#define sk_GENERAL_NAMES_delete(st, i) SKM_sk_delete(GENERAL_NAMES, (st), (i)) +#define sk_GENERAL_NAMES_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(GENERAL_NAMES, (st), (ptr)) +#define sk_GENERAL_NAMES_insert(st, val, i) \ + SKM_sk_insert(GENERAL_NAMES, (st), (val), (i)) +#define sk_GENERAL_NAMES_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(GENERAL_NAMES, (st), (cmp)) +#define sk_GENERAL_NAMES_dup(st) SKM_sk_dup(GENERAL_NAMES, st) +#define sk_GENERAL_NAMES_pop_free(st, free_func) \ + SKM_sk_pop_free(GENERAL_NAMES, (st), (free_func)) +#define sk_GENERAL_NAMES_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(GENERAL_NAMES, (st), (copy_func), (free_func)) +#define sk_GENERAL_NAMES_shift(st) SKM_sk_shift(GENERAL_NAMES, (st)) +#define sk_GENERAL_NAMES_pop(st) SKM_sk_pop(GENERAL_NAMES, (st)) +#define sk_GENERAL_NAMES_sort(st) SKM_sk_sort(GENERAL_NAMES, (st)) +#define sk_GENERAL_NAMES_is_sorted(st) SKM_sk_is_sorted(GENERAL_NAMES, (st)) +#define sk_GENERAL_SUBTREE_new(cmp) SKM_sk_new(GENERAL_SUBTREE, (cmp)) +#define sk_GENERAL_SUBTREE_new_null() SKM_sk_new_null(GENERAL_SUBTREE) +#define sk_GENERAL_SUBTREE_free(st) SKM_sk_free(GENERAL_SUBTREE, (st)) +#define sk_GENERAL_SUBTREE_num(st) SKM_sk_num(GENERAL_SUBTREE, (st)) +#define sk_GENERAL_SUBTREE_value(st, i) SKM_sk_value(GENERAL_SUBTREE, (st), (i)) +#define sk_GENERAL_SUBTREE_set(st, i, val) \ + SKM_sk_set(GENERAL_SUBTREE, (st), (i), (val)) +#define sk_GENERAL_SUBTREE_zero(st) SKM_sk_zero(GENERAL_SUBTREE, (st)) +#define sk_GENERAL_SUBTREE_push(st, val) \ + SKM_sk_push(GENERAL_SUBTREE, (st), (val)) +#define sk_GENERAL_SUBTREE_unshift(st, val) \ + SKM_sk_unshift(GENERAL_SUBTREE, (st), (val)) +#define sk_GENERAL_SUBTREE_find(st, val) \ + SKM_sk_find(GENERAL_SUBTREE, (st), (val)) +#define sk_GENERAL_SUBTREE_find_ex(st, val) \ + SKM_sk_find_ex(GENERAL_SUBTREE, (st), (val)) +#define sk_GENERAL_SUBTREE_delete(st, i) \ + SKM_sk_delete(GENERAL_SUBTREE, (st), (i)) +#define sk_GENERAL_SUBTREE_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(GENERAL_SUBTREE, (st), (ptr)) +#define sk_GENERAL_SUBTREE_insert(st, val, i) \ + SKM_sk_insert(GENERAL_SUBTREE, (st), (val), (i)) +#define sk_GENERAL_SUBTREE_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(GENERAL_SUBTREE, (st), (cmp)) +#define sk_GENERAL_SUBTREE_dup(st) SKM_sk_dup(GENERAL_SUBTREE, st) +#define sk_GENERAL_SUBTREE_pop_free(st, free_func) \ + SKM_sk_pop_free(GENERAL_SUBTREE, (st), (free_func)) +#define sk_GENERAL_SUBTREE_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(GENERAL_SUBTREE, (st), (copy_func), (free_func)) +#define sk_GENERAL_SUBTREE_shift(st) SKM_sk_shift(GENERAL_SUBTREE, (st)) +#define sk_GENERAL_SUBTREE_pop(st) SKM_sk_pop(GENERAL_SUBTREE, (st)) +#define sk_GENERAL_SUBTREE_sort(st) SKM_sk_sort(GENERAL_SUBTREE, (st)) +#define sk_GENERAL_SUBTREE_is_sorted(st) SKM_sk_is_sorted(GENERAL_SUBTREE, (st)) +#define sk_IPAddressFamily_new(cmp) SKM_sk_new(IPAddressFamily, (cmp)) +#define sk_IPAddressFamily_new_null() SKM_sk_new_null(IPAddressFamily) +#define sk_IPAddressFamily_free(st) SKM_sk_free(IPAddressFamily, (st)) +#define sk_IPAddressFamily_num(st) SKM_sk_num(IPAddressFamily, (st)) +#define sk_IPAddressFamily_value(st, i) SKM_sk_value(IPAddressFamily, (st), (i)) +#define sk_IPAddressFamily_set(st, i, val) \ + SKM_sk_set(IPAddressFamily, (st), (i), (val)) +#define sk_IPAddressFamily_zero(st) SKM_sk_zero(IPAddressFamily, (st)) +#define sk_IPAddressFamily_push(st, val) \ + SKM_sk_push(IPAddressFamily, (st), (val)) +#define sk_IPAddressFamily_unshift(st, val) \ + SKM_sk_unshift(IPAddressFamily, (st), (val)) +#define sk_IPAddressFamily_find(st, val) \ + SKM_sk_find(IPAddressFamily, (st), (val)) +#define sk_IPAddressFamily_find_ex(st, val) \ + SKM_sk_find_ex(IPAddressFamily, (st), (val)) +#define sk_IPAddressFamily_delete(st, i) \ + SKM_sk_delete(IPAddressFamily, (st), (i)) +#define sk_IPAddressFamily_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(IPAddressFamily, (st), (ptr)) +#define sk_IPAddressFamily_insert(st, val, i) \ + SKM_sk_insert(IPAddressFamily, (st), (val), (i)) +#define sk_IPAddressFamily_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(IPAddressFamily, (st), (cmp)) +#define sk_IPAddressFamily_dup(st) SKM_sk_dup(IPAddressFamily, st) +#define sk_IPAddressFamily_pop_free(st, free_func) \ + SKM_sk_pop_free(IPAddressFamily, (st), (free_func)) +#define sk_IPAddressFamily_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(IPAddressFamily, (st), (copy_func), (free_func)) +#define sk_IPAddressFamily_shift(st) SKM_sk_shift(IPAddressFamily, (st)) +#define sk_IPAddressFamily_pop(st) SKM_sk_pop(IPAddressFamily, (st)) +#define sk_IPAddressFamily_sort(st) SKM_sk_sort(IPAddressFamily, (st)) +#define sk_IPAddressFamily_is_sorted(st) SKM_sk_is_sorted(IPAddressFamily, (st)) +#define sk_IPAddressOrRange_new(cmp) SKM_sk_new(IPAddressOrRange, (cmp)) +#define sk_IPAddressOrRange_new_null() SKM_sk_new_null(IPAddressOrRange) +#define sk_IPAddressOrRange_free(st) SKM_sk_free(IPAddressOrRange, (st)) +#define sk_IPAddressOrRange_num(st) SKM_sk_num(IPAddressOrRange, (st)) +#define sk_IPAddressOrRange_value(st, i) \ + SKM_sk_value(IPAddressOrRange, (st), (i)) +#define sk_IPAddressOrRange_set(st, i, val) \ + SKM_sk_set(IPAddressOrRange, (st), (i), (val)) +#define sk_IPAddressOrRange_zero(st) SKM_sk_zero(IPAddressOrRange, (st)) +#define sk_IPAddressOrRange_push(st, val) \ + SKM_sk_push(IPAddressOrRange, (st), (val)) +#define sk_IPAddressOrRange_unshift(st, val) \ + SKM_sk_unshift(IPAddressOrRange, (st), (val)) +#define sk_IPAddressOrRange_find(st, val) \ + SKM_sk_find(IPAddressOrRange, (st), (val)) +#define sk_IPAddressOrRange_find_ex(st, val) \ + SKM_sk_find_ex(IPAddressOrRange, (st), (val)) +#define sk_IPAddressOrRange_delete(st, i) \ + SKM_sk_delete(IPAddressOrRange, (st), (i)) +#define sk_IPAddressOrRange_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(IPAddressOrRange, (st), (ptr)) +#define sk_IPAddressOrRange_insert(st, val, i) \ + SKM_sk_insert(IPAddressOrRange, (st), (val), (i)) +#define sk_IPAddressOrRange_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(IPAddressOrRange, (st), (cmp)) +#define sk_IPAddressOrRange_dup(st) SKM_sk_dup(IPAddressOrRange, st) +#define sk_IPAddressOrRange_pop_free(st, free_func) \ + SKM_sk_pop_free(IPAddressOrRange, (st), (free_func)) +#define sk_IPAddressOrRange_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(IPAddressOrRange, (st), (copy_func), (free_func)) +#define sk_IPAddressOrRange_shift(st) SKM_sk_shift(IPAddressOrRange, (st)) +#define sk_IPAddressOrRange_pop(st) SKM_sk_pop(IPAddressOrRange, (st)) +#define sk_IPAddressOrRange_sort(st) SKM_sk_sort(IPAddressOrRange, (st)) +#define sk_IPAddressOrRange_is_sorted(st) \ + SKM_sk_is_sorted(IPAddressOrRange, (st)) +#define sk_KRB5_APREQBODY_new(cmp) SKM_sk_new(KRB5_APREQBODY, (cmp)) +#define sk_KRB5_APREQBODY_new_null() SKM_sk_new_null(KRB5_APREQBODY) +#define sk_KRB5_APREQBODY_free(st) SKM_sk_free(KRB5_APREQBODY, (st)) +#define sk_KRB5_APREQBODY_num(st) SKM_sk_num(KRB5_APREQBODY, (st)) +#define sk_KRB5_APREQBODY_value(st, i) SKM_sk_value(KRB5_APREQBODY, (st), (i)) +#define sk_KRB5_APREQBODY_set(st, i, val) \ + SKM_sk_set(KRB5_APREQBODY, (st), (i), (val)) +#define sk_KRB5_APREQBODY_zero(st) SKM_sk_zero(KRB5_APREQBODY, (st)) +#define sk_KRB5_APREQBODY_push(st, val) SKM_sk_push(KRB5_APREQBODY, (st), (val)) +#define sk_KRB5_APREQBODY_unshift(st, val) \ + SKM_sk_unshift(KRB5_APREQBODY, (st), (val)) +#define sk_KRB5_APREQBODY_find(st, val) SKM_sk_find(KRB5_APREQBODY, (st), (val)) +#define sk_KRB5_APREQBODY_find_ex(st, val) \ + SKM_sk_find_ex(KRB5_APREQBODY, (st), (val)) +#define sk_KRB5_APREQBODY_delete(st, i) SKM_sk_delete(KRB5_APREQBODY, (st), (i)) +#define sk_KRB5_APREQBODY_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(KRB5_APREQBODY, (st), (ptr)) +#define sk_KRB5_APREQBODY_insert(st, val, i) \ + SKM_sk_insert(KRB5_APREQBODY, (st), (val), (i)) +#define sk_KRB5_APREQBODY_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(KRB5_APREQBODY, (st), (cmp)) +#define sk_KRB5_APREQBODY_dup(st) SKM_sk_dup(KRB5_APREQBODY, st) +#define sk_KRB5_APREQBODY_pop_free(st, free_func) \ + SKM_sk_pop_free(KRB5_APREQBODY, (st), (free_func)) +#define sk_KRB5_APREQBODY_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(KRB5_APREQBODY, (st), (copy_func), (free_func)) +#define sk_KRB5_APREQBODY_shift(st) SKM_sk_shift(KRB5_APREQBODY, (st)) +#define sk_KRB5_APREQBODY_pop(st) SKM_sk_pop(KRB5_APREQBODY, (st)) +#define sk_KRB5_APREQBODY_sort(st) SKM_sk_sort(KRB5_APREQBODY, (st)) +#define sk_KRB5_APREQBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_APREQBODY, (st)) +#define sk_KRB5_AUTHDATA_new(cmp) SKM_sk_new(KRB5_AUTHDATA, (cmp)) +#define sk_KRB5_AUTHDATA_new_null() SKM_sk_new_null(KRB5_AUTHDATA) +#define sk_KRB5_AUTHDATA_free(st) SKM_sk_free(KRB5_AUTHDATA, (st)) +#define sk_KRB5_AUTHDATA_num(st) SKM_sk_num(KRB5_AUTHDATA, (st)) +#define sk_KRB5_AUTHDATA_value(st, i) SKM_sk_value(KRB5_AUTHDATA, (st), (i)) +#define sk_KRB5_AUTHDATA_set(st, i, val) \ + SKM_sk_set(KRB5_AUTHDATA, (st), (i), (val)) +#define sk_KRB5_AUTHDATA_zero(st) SKM_sk_zero(KRB5_AUTHDATA, (st)) +#define sk_KRB5_AUTHDATA_push(st, val) SKM_sk_push(KRB5_AUTHDATA, (st), (val)) +#define sk_KRB5_AUTHDATA_unshift(st, val) \ + SKM_sk_unshift(KRB5_AUTHDATA, (st), (val)) +#define sk_KRB5_AUTHDATA_find(st, val) SKM_sk_find(KRB5_AUTHDATA, (st), (val)) +#define sk_KRB5_AUTHDATA_find_ex(st, val) \ + SKM_sk_find_ex(KRB5_AUTHDATA, (st), (val)) +#define sk_KRB5_AUTHDATA_delete(st, i) SKM_sk_delete(KRB5_AUTHDATA, (st), (i)) +#define sk_KRB5_AUTHDATA_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(KRB5_AUTHDATA, (st), (ptr)) +#define sk_KRB5_AUTHDATA_insert(st, val, i) \ + SKM_sk_insert(KRB5_AUTHDATA, (st), (val), (i)) +#define sk_KRB5_AUTHDATA_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(KRB5_AUTHDATA, (st), (cmp)) +#define sk_KRB5_AUTHDATA_dup(st) SKM_sk_dup(KRB5_AUTHDATA, st) +#define sk_KRB5_AUTHDATA_pop_free(st, free_func) \ + SKM_sk_pop_free(KRB5_AUTHDATA, (st), (free_func)) +#define sk_KRB5_AUTHDATA_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(KRB5_AUTHDATA, (st), (copy_func), (free_func)) +#define sk_KRB5_AUTHDATA_shift(st) SKM_sk_shift(KRB5_AUTHDATA, (st)) +#define sk_KRB5_AUTHDATA_pop(st) SKM_sk_pop(KRB5_AUTHDATA, (st)) +#define sk_KRB5_AUTHDATA_sort(st) SKM_sk_sort(KRB5_AUTHDATA, (st)) +#define sk_KRB5_AUTHDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHDATA, (st)) +#define sk_KRB5_AUTHENTBODY_new(cmp) SKM_sk_new(KRB5_AUTHENTBODY, (cmp)) +#define sk_KRB5_AUTHENTBODY_new_null() SKM_sk_new_null(KRB5_AUTHENTBODY) +#define sk_KRB5_AUTHENTBODY_free(st) SKM_sk_free(KRB5_AUTHENTBODY, (st)) +#define sk_KRB5_AUTHENTBODY_num(st) SKM_sk_num(KRB5_AUTHENTBODY, (st)) +#define sk_KRB5_AUTHENTBODY_value(st, i) \ + SKM_sk_value(KRB5_AUTHENTBODY, (st), (i)) +#define sk_KRB5_AUTHENTBODY_set(st, i, val) \ + SKM_sk_set(KRB5_AUTHENTBODY, (st), (i), (val)) +#define sk_KRB5_AUTHENTBODY_zero(st) SKM_sk_zero(KRB5_AUTHENTBODY, (st)) +#define sk_KRB5_AUTHENTBODY_push(st, val) \ + SKM_sk_push(KRB5_AUTHENTBODY, (st), (val)) +#define sk_KRB5_AUTHENTBODY_unshift(st, val) \ + SKM_sk_unshift(KRB5_AUTHENTBODY, (st), (val)) +#define sk_KRB5_AUTHENTBODY_find(st, val) \ + SKM_sk_find(KRB5_AUTHENTBODY, (st), (val)) +#define sk_KRB5_AUTHENTBODY_find_ex(st, val) \ + SKM_sk_find_ex(KRB5_AUTHENTBODY, (st), (val)) +#define sk_KRB5_AUTHENTBODY_delete(st, i) \ + SKM_sk_delete(KRB5_AUTHENTBODY, (st), (i)) +#define sk_KRB5_AUTHENTBODY_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(KRB5_AUTHENTBODY, (st), (ptr)) +#define sk_KRB5_AUTHENTBODY_insert(st, val, i) \ + SKM_sk_insert(KRB5_AUTHENTBODY, (st), (val), (i)) +#define sk_KRB5_AUTHENTBODY_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(KRB5_AUTHENTBODY, (st), (cmp)) +#define sk_KRB5_AUTHENTBODY_dup(st) SKM_sk_dup(KRB5_AUTHENTBODY, st) +#define sk_KRB5_AUTHENTBODY_pop_free(st, free_func) \ + SKM_sk_pop_free(KRB5_AUTHENTBODY, (st), (free_func)) +#define sk_KRB5_AUTHENTBODY_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(KRB5_AUTHENTBODY, (st), (copy_func), (free_func)) +#define sk_KRB5_AUTHENTBODY_shift(st) SKM_sk_shift(KRB5_AUTHENTBODY, (st)) +#define sk_KRB5_AUTHENTBODY_pop(st) SKM_sk_pop(KRB5_AUTHENTBODY, (st)) +#define sk_KRB5_AUTHENTBODY_sort(st) SKM_sk_sort(KRB5_AUTHENTBODY, (st)) +#define sk_KRB5_AUTHENTBODY_is_sorted(st) \ + SKM_sk_is_sorted(KRB5_AUTHENTBODY, (st)) +#define sk_KRB5_CHECKSUM_new(cmp) SKM_sk_new(KRB5_CHECKSUM, (cmp)) +#define sk_KRB5_CHECKSUM_new_null() SKM_sk_new_null(KRB5_CHECKSUM) +#define sk_KRB5_CHECKSUM_free(st) SKM_sk_free(KRB5_CHECKSUM, (st)) +#define sk_KRB5_CHECKSUM_num(st) SKM_sk_num(KRB5_CHECKSUM, (st)) +#define sk_KRB5_CHECKSUM_value(st, i) SKM_sk_value(KRB5_CHECKSUM, (st), (i)) +#define sk_KRB5_CHECKSUM_set(st, i, val) \ + SKM_sk_set(KRB5_CHECKSUM, (st), (i), (val)) +#define sk_KRB5_CHECKSUM_zero(st) SKM_sk_zero(KRB5_CHECKSUM, (st)) +#define sk_KRB5_CHECKSUM_push(st, val) SKM_sk_push(KRB5_CHECKSUM, (st), (val)) +#define sk_KRB5_CHECKSUM_unshift(st, val) \ + SKM_sk_unshift(KRB5_CHECKSUM, (st), (val)) +#define sk_KRB5_CHECKSUM_find(st, val) SKM_sk_find(KRB5_CHECKSUM, (st), (val)) +#define sk_KRB5_CHECKSUM_find_ex(st, val) \ + SKM_sk_find_ex(KRB5_CHECKSUM, (st), (val)) +#define sk_KRB5_CHECKSUM_delete(st, i) SKM_sk_delete(KRB5_CHECKSUM, (st), (i)) +#define sk_KRB5_CHECKSUM_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(KRB5_CHECKSUM, (st), (ptr)) +#define sk_KRB5_CHECKSUM_insert(st, val, i) \ + SKM_sk_insert(KRB5_CHECKSUM, (st), (val), (i)) +#define sk_KRB5_CHECKSUM_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(KRB5_CHECKSUM, (st), (cmp)) +#define sk_KRB5_CHECKSUM_dup(st) SKM_sk_dup(KRB5_CHECKSUM, st) +#define sk_KRB5_CHECKSUM_pop_free(st, free_func) \ + SKM_sk_pop_free(KRB5_CHECKSUM, (st), (free_func)) +#define sk_KRB5_CHECKSUM_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(KRB5_CHECKSUM, (st), (copy_func), (free_func)) +#define sk_KRB5_CHECKSUM_shift(st) SKM_sk_shift(KRB5_CHECKSUM, (st)) +#define sk_KRB5_CHECKSUM_pop(st) SKM_sk_pop(KRB5_CHECKSUM, (st)) +#define sk_KRB5_CHECKSUM_sort(st) SKM_sk_sort(KRB5_CHECKSUM, (st)) +#define sk_KRB5_CHECKSUM_is_sorted(st) SKM_sk_is_sorted(KRB5_CHECKSUM, (st)) +#define sk_KRB5_ENCDATA_new(cmp) SKM_sk_new(KRB5_ENCDATA, (cmp)) +#define sk_KRB5_ENCDATA_new_null() SKM_sk_new_null(KRB5_ENCDATA) +#define sk_KRB5_ENCDATA_free(st) SKM_sk_free(KRB5_ENCDATA, (st)) +#define sk_KRB5_ENCDATA_num(st) SKM_sk_num(KRB5_ENCDATA, (st)) +#define sk_KRB5_ENCDATA_value(st, i) SKM_sk_value(KRB5_ENCDATA, (st), (i)) +#define sk_KRB5_ENCDATA_set(st, i, val) \ + SKM_sk_set(KRB5_ENCDATA, (st), (i), (val)) +#define sk_KRB5_ENCDATA_zero(st) SKM_sk_zero(KRB5_ENCDATA, (st)) +#define sk_KRB5_ENCDATA_push(st, val) SKM_sk_push(KRB5_ENCDATA, (st), (val)) +#define sk_KRB5_ENCDATA_unshift(st, val) \ + SKM_sk_unshift(KRB5_ENCDATA, (st), (val)) +#define sk_KRB5_ENCDATA_find(st, val) SKM_sk_find(KRB5_ENCDATA, (st), (val)) +#define sk_KRB5_ENCDATA_find_ex(st, val) \ + SKM_sk_find_ex(KRB5_ENCDATA, (st), (val)) +#define sk_KRB5_ENCDATA_delete(st, i) SKM_sk_delete(KRB5_ENCDATA, (st), (i)) +#define sk_KRB5_ENCDATA_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(KRB5_ENCDATA, (st), (ptr)) +#define sk_KRB5_ENCDATA_insert(st, val, i) \ + SKM_sk_insert(KRB5_ENCDATA, (st), (val), (i)) +#define sk_KRB5_ENCDATA_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(KRB5_ENCDATA, (st), (cmp)) +#define sk_KRB5_ENCDATA_dup(st) SKM_sk_dup(KRB5_ENCDATA, st) +#define sk_KRB5_ENCDATA_pop_free(st, free_func) \ + SKM_sk_pop_free(KRB5_ENCDATA, (st), (free_func)) +#define sk_KRB5_ENCDATA_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(KRB5_ENCDATA, (st), (copy_func), (free_func)) +#define sk_KRB5_ENCDATA_shift(st) SKM_sk_shift(KRB5_ENCDATA, (st)) +#define sk_KRB5_ENCDATA_pop(st) SKM_sk_pop(KRB5_ENCDATA, (st)) +#define sk_KRB5_ENCDATA_sort(st) SKM_sk_sort(KRB5_ENCDATA, (st)) +#define sk_KRB5_ENCDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCDATA, (st)) +#define sk_KRB5_ENCKEY_new(cmp) SKM_sk_new(KRB5_ENCKEY, (cmp)) +#define sk_KRB5_ENCKEY_new_null() SKM_sk_new_null(KRB5_ENCKEY) +#define sk_KRB5_ENCKEY_free(st) SKM_sk_free(KRB5_ENCKEY, (st)) +#define sk_KRB5_ENCKEY_num(st) SKM_sk_num(KRB5_ENCKEY, (st)) +#define sk_KRB5_ENCKEY_value(st, i) SKM_sk_value(KRB5_ENCKEY, (st), (i)) +#define sk_KRB5_ENCKEY_set(st, i, val) SKM_sk_set(KRB5_ENCKEY, (st), (i), (val)) +#define sk_KRB5_ENCKEY_zero(st) SKM_sk_zero(KRB5_ENCKEY, (st)) +#define sk_KRB5_ENCKEY_push(st, val) SKM_sk_push(KRB5_ENCKEY, (st), (val)) +#define sk_KRB5_ENCKEY_unshift(st, val) SKM_sk_unshift(KRB5_ENCKEY, (st), (val)) +#define sk_KRB5_ENCKEY_find(st, val) SKM_sk_find(KRB5_ENCKEY, (st), (val)) +#define sk_KRB5_ENCKEY_find_ex(st, val) SKM_sk_find_ex(KRB5_ENCKEY, (st), (val)) +#define sk_KRB5_ENCKEY_delete(st, i) SKM_sk_delete(KRB5_ENCKEY, (st), (i)) +#define sk_KRB5_ENCKEY_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(KRB5_ENCKEY, (st), (ptr)) +#define sk_KRB5_ENCKEY_insert(st, val, i) \ + SKM_sk_insert(KRB5_ENCKEY, (st), (val), (i)) +#define sk_KRB5_ENCKEY_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(KRB5_ENCKEY, (st), (cmp)) +#define sk_KRB5_ENCKEY_dup(st) SKM_sk_dup(KRB5_ENCKEY, st) +#define sk_KRB5_ENCKEY_pop_free(st, free_func) \ + SKM_sk_pop_free(KRB5_ENCKEY, (st), (free_func)) +#define sk_KRB5_ENCKEY_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(KRB5_ENCKEY, (st), (copy_func), (free_func)) +#define sk_KRB5_ENCKEY_shift(st) SKM_sk_shift(KRB5_ENCKEY, (st)) +#define sk_KRB5_ENCKEY_pop(st) SKM_sk_pop(KRB5_ENCKEY, (st)) +#define sk_KRB5_ENCKEY_sort(st) SKM_sk_sort(KRB5_ENCKEY, (st)) +#define sk_KRB5_ENCKEY_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCKEY, (st)) +#define sk_KRB5_PRINCNAME_new(cmp) SKM_sk_new(KRB5_PRINCNAME, (cmp)) +#define sk_KRB5_PRINCNAME_new_null() SKM_sk_new_null(KRB5_PRINCNAME) +#define sk_KRB5_PRINCNAME_free(st) SKM_sk_free(KRB5_PRINCNAME, (st)) +#define sk_KRB5_PRINCNAME_num(st) SKM_sk_num(KRB5_PRINCNAME, (st)) +#define sk_KRB5_PRINCNAME_value(st, i) SKM_sk_value(KRB5_PRINCNAME, (st), (i)) +#define sk_KRB5_PRINCNAME_set(st, i, val) \ + SKM_sk_set(KRB5_PRINCNAME, (st), (i), (val)) +#define sk_KRB5_PRINCNAME_zero(st) SKM_sk_zero(KRB5_PRINCNAME, (st)) +#define sk_KRB5_PRINCNAME_push(st, val) SKM_sk_push(KRB5_PRINCNAME, (st), (val)) +#define sk_KRB5_PRINCNAME_unshift(st, val) \ + SKM_sk_unshift(KRB5_PRINCNAME, (st), (val)) +#define sk_KRB5_PRINCNAME_find(st, val) SKM_sk_find(KRB5_PRINCNAME, (st), (val)) +#define sk_KRB5_PRINCNAME_find_ex(st, val) \ + SKM_sk_find_ex(KRB5_PRINCNAME, (st), (val)) +#define sk_KRB5_PRINCNAME_delete(st, i) SKM_sk_delete(KRB5_PRINCNAME, (st), (i)) +#define sk_KRB5_PRINCNAME_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(KRB5_PRINCNAME, (st), (ptr)) +#define sk_KRB5_PRINCNAME_insert(st, val, i) \ + SKM_sk_insert(KRB5_PRINCNAME, (st), (val), (i)) +#define sk_KRB5_PRINCNAME_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(KRB5_PRINCNAME, (st), (cmp)) +#define sk_KRB5_PRINCNAME_dup(st) SKM_sk_dup(KRB5_PRINCNAME, st) +#define sk_KRB5_PRINCNAME_pop_free(st, free_func) \ + SKM_sk_pop_free(KRB5_PRINCNAME, (st), (free_func)) +#define sk_KRB5_PRINCNAME_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(KRB5_PRINCNAME, (st), (copy_func), (free_func)) +#define sk_KRB5_PRINCNAME_shift(st) SKM_sk_shift(KRB5_PRINCNAME, (st)) +#define sk_KRB5_PRINCNAME_pop(st) SKM_sk_pop(KRB5_PRINCNAME, (st)) +#define sk_KRB5_PRINCNAME_sort(st) SKM_sk_sort(KRB5_PRINCNAME, (st)) +#define sk_KRB5_PRINCNAME_is_sorted(st) SKM_sk_is_sorted(KRB5_PRINCNAME, (st)) +#define sk_KRB5_TKTBODY_new(cmp) SKM_sk_new(KRB5_TKTBODY, (cmp)) +#define sk_KRB5_TKTBODY_new_null() SKM_sk_new_null(KRB5_TKTBODY) +#define sk_KRB5_TKTBODY_free(st) SKM_sk_free(KRB5_TKTBODY, (st)) +#define sk_KRB5_TKTBODY_num(st) SKM_sk_num(KRB5_TKTBODY, (st)) +#define sk_KRB5_TKTBODY_value(st, i) SKM_sk_value(KRB5_TKTBODY, (st), (i)) +#define sk_KRB5_TKTBODY_set(st, i, val) \ + SKM_sk_set(KRB5_TKTBODY, (st), (i), (val)) +#define sk_KRB5_TKTBODY_zero(st) SKM_sk_zero(KRB5_TKTBODY, (st)) +#define sk_KRB5_TKTBODY_push(st, val) SKM_sk_push(KRB5_TKTBODY, (st), (val)) +#define sk_KRB5_TKTBODY_unshift(st, val) \ + SKM_sk_unshift(KRB5_TKTBODY, (st), (val)) +#define sk_KRB5_TKTBODY_find(st, val) SKM_sk_find(KRB5_TKTBODY, (st), (val)) +#define sk_KRB5_TKTBODY_find_ex(st, val) \ + SKM_sk_find_ex(KRB5_TKTBODY, (st), (val)) +#define sk_KRB5_TKTBODY_delete(st, i) SKM_sk_delete(KRB5_TKTBODY, (st), (i)) +#define sk_KRB5_TKTBODY_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(KRB5_TKTBODY, (st), (ptr)) +#define sk_KRB5_TKTBODY_insert(st, val, i) \ + SKM_sk_insert(KRB5_TKTBODY, (st), (val), (i)) +#define sk_KRB5_TKTBODY_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(KRB5_TKTBODY, (st), (cmp)) +#define sk_KRB5_TKTBODY_dup(st) SKM_sk_dup(KRB5_TKTBODY, st) +#define sk_KRB5_TKTBODY_pop_free(st, free_func) \ + SKM_sk_pop_free(KRB5_TKTBODY, (st), (free_func)) +#define sk_KRB5_TKTBODY_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(KRB5_TKTBODY, (st), (copy_func), (free_func)) +#define sk_KRB5_TKTBODY_shift(st) SKM_sk_shift(KRB5_TKTBODY, (st)) +#define sk_KRB5_TKTBODY_pop(st) SKM_sk_pop(KRB5_TKTBODY, (st)) +#define sk_KRB5_TKTBODY_sort(st) SKM_sk_sort(KRB5_TKTBODY, (st)) +#define sk_KRB5_TKTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_TKTBODY, (st)) +#define sk_MEM_OBJECT_DATA_new(cmp) SKM_sk_new(MEM_OBJECT_DATA, (cmp)) +#define sk_MEM_OBJECT_DATA_new_null() SKM_sk_new_null(MEM_OBJECT_DATA) +#define sk_MEM_OBJECT_DATA_free(st) SKM_sk_free(MEM_OBJECT_DATA, (st)) +#define sk_MEM_OBJECT_DATA_num(st) SKM_sk_num(MEM_OBJECT_DATA, (st)) +#define sk_MEM_OBJECT_DATA_value(st, i) SKM_sk_value(MEM_OBJECT_DATA, (st), (i)) +#define sk_MEM_OBJECT_DATA_set(st, i, val) \ + SKM_sk_set(MEM_OBJECT_DATA, (st), (i), (val)) +#define sk_MEM_OBJECT_DATA_zero(st) SKM_sk_zero(MEM_OBJECT_DATA, (st)) +#define sk_MEM_OBJECT_DATA_push(st, val) \ + SKM_sk_push(MEM_OBJECT_DATA, (st), (val)) +#define sk_MEM_OBJECT_DATA_unshift(st, val) \ + SKM_sk_unshift(MEM_OBJECT_DATA, (st), (val)) +#define sk_MEM_OBJECT_DATA_find(st, val) \ + SKM_sk_find(MEM_OBJECT_DATA, (st), (val)) +#define sk_MEM_OBJECT_DATA_find_ex(st, val) \ + SKM_sk_find_ex(MEM_OBJECT_DATA, (st), (val)) +#define sk_MEM_OBJECT_DATA_delete(st, i) \ + SKM_sk_delete(MEM_OBJECT_DATA, (st), (i)) +#define sk_MEM_OBJECT_DATA_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(MEM_OBJECT_DATA, (st), (ptr)) +#define sk_MEM_OBJECT_DATA_insert(st, val, i) \ + SKM_sk_insert(MEM_OBJECT_DATA, (st), (val), (i)) +#define sk_MEM_OBJECT_DATA_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(MEM_OBJECT_DATA, (st), (cmp)) +#define sk_MEM_OBJECT_DATA_dup(st) SKM_sk_dup(MEM_OBJECT_DATA, st) +#define sk_MEM_OBJECT_DATA_pop_free(st, free_func) \ + SKM_sk_pop_free(MEM_OBJECT_DATA, (st), (free_func)) +#define sk_MEM_OBJECT_DATA_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(MEM_OBJECT_DATA, (st), (copy_func), (free_func)) +#define sk_MEM_OBJECT_DATA_shift(st) SKM_sk_shift(MEM_OBJECT_DATA, (st)) +#define sk_MEM_OBJECT_DATA_pop(st) SKM_sk_pop(MEM_OBJECT_DATA, (st)) +#define sk_MEM_OBJECT_DATA_sort(st) SKM_sk_sort(MEM_OBJECT_DATA, (st)) +#define sk_MEM_OBJECT_DATA_is_sorted(st) SKM_sk_is_sorted(MEM_OBJECT_DATA, (st)) +#define sk_MIME_HEADER_new(cmp) SKM_sk_new(MIME_HEADER, (cmp)) +#define sk_MIME_HEADER_new_null() SKM_sk_new_null(MIME_HEADER) +#define sk_MIME_HEADER_free(st) SKM_sk_free(MIME_HEADER, (st)) +#define sk_MIME_HEADER_num(st) SKM_sk_num(MIME_HEADER, (st)) +#define sk_MIME_HEADER_value(st, i) SKM_sk_value(MIME_HEADER, (st), (i)) +#define sk_MIME_HEADER_set(st, i, val) SKM_sk_set(MIME_HEADER, (st), (i), (val)) +#define sk_MIME_HEADER_zero(st) SKM_sk_zero(MIME_HEADER, (st)) +#define sk_MIME_HEADER_push(st, val) SKM_sk_push(MIME_HEADER, (st), (val)) +#define sk_MIME_HEADER_unshift(st, val) SKM_sk_unshift(MIME_HEADER, (st), (val)) +#define sk_MIME_HEADER_find(st, val) SKM_sk_find(MIME_HEADER, (st), (val)) +#define sk_MIME_HEADER_find_ex(st, val) SKM_sk_find_ex(MIME_HEADER, (st), (val)) +#define sk_MIME_HEADER_delete(st, i) SKM_sk_delete(MIME_HEADER, (st), (i)) +#define sk_MIME_HEADER_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(MIME_HEADER, (st), (ptr)) +#define sk_MIME_HEADER_insert(st, val, i) \ + SKM_sk_insert(MIME_HEADER, (st), (val), (i)) +#define sk_MIME_HEADER_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(MIME_HEADER, (st), (cmp)) +#define sk_MIME_HEADER_dup(st) SKM_sk_dup(MIME_HEADER, st) +#define sk_MIME_HEADER_pop_free(st, free_func) \ + SKM_sk_pop_free(MIME_HEADER, (st), (free_func)) +#define sk_MIME_HEADER_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(MIME_HEADER, (st), (copy_func), (free_func)) +#define sk_MIME_HEADER_shift(st) SKM_sk_shift(MIME_HEADER, (st)) +#define sk_MIME_HEADER_pop(st) SKM_sk_pop(MIME_HEADER, (st)) +#define sk_MIME_HEADER_sort(st) SKM_sk_sort(MIME_HEADER, (st)) +#define sk_MIME_HEADER_is_sorted(st) SKM_sk_is_sorted(MIME_HEADER, (st)) +#define sk_MIME_PARAM_new(cmp) SKM_sk_new(MIME_PARAM, (cmp)) +#define sk_MIME_PARAM_new_null() SKM_sk_new_null(MIME_PARAM) +#define sk_MIME_PARAM_free(st) SKM_sk_free(MIME_PARAM, (st)) +#define sk_MIME_PARAM_num(st) SKM_sk_num(MIME_PARAM, (st)) +#define sk_MIME_PARAM_value(st, i) SKM_sk_value(MIME_PARAM, (st), (i)) +#define sk_MIME_PARAM_set(st, i, val) SKM_sk_set(MIME_PARAM, (st), (i), (val)) +#define sk_MIME_PARAM_zero(st) SKM_sk_zero(MIME_PARAM, (st)) +#define sk_MIME_PARAM_push(st, val) SKM_sk_push(MIME_PARAM, (st), (val)) +#define sk_MIME_PARAM_unshift(st, val) SKM_sk_unshift(MIME_PARAM, (st), (val)) +#define sk_MIME_PARAM_find(st, val) SKM_sk_find(MIME_PARAM, (st), (val)) +#define sk_MIME_PARAM_find_ex(st, val) SKM_sk_find_ex(MIME_PARAM, (st), (val)) +#define sk_MIME_PARAM_delete(st, i) SKM_sk_delete(MIME_PARAM, (st), (i)) +#define sk_MIME_PARAM_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(MIME_PARAM, (st), (ptr)) +#define sk_MIME_PARAM_insert(st, val, i) \ + SKM_sk_insert(MIME_PARAM, (st), (val), (i)) +#define sk_MIME_PARAM_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(MIME_PARAM, (st), (cmp)) +#define sk_MIME_PARAM_dup(st) SKM_sk_dup(MIME_PARAM, st) +#define sk_MIME_PARAM_pop_free(st, free_func) \ + SKM_sk_pop_free(MIME_PARAM, (st), (free_func)) +#define sk_MIME_PARAM_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(MIME_PARAM, (st), (copy_func), (free_func)) +#define sk_MIME_PARAM_shift(st) SKM_sk_shift(MIME_PARAM, (st)) +#define sk_MIME_PARAM_pop(st) SKM_sk_pop(MIME_PARAM, (st)) +#define sk_MIME_PARAM_sort(st) SKM_sk_sort(MIME_PARAM, (st)) +#define sk_MIME_PARAM_is_sorted(st) SKM_sk_is_sorted(MIME_PARAM, (st)) +#define sk_NAME_FUNCS_new(cmp) SKM_sk_new(NAME_FUNCS, (cmp)) +#define sk_NAME_FUNCS_new_null() SKM_sk_new_null(NAME_FUNCS) +#define sk_NAME_FUNCS_free(st) SKM_sk_free(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_num(st) SKM_sk_num(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_value(st, i) SKM_sk_value(NAME_FUNCS, (st), (i)) +#define sk_NAME_FUNCS_set(st, i, val) SKM_sk_set(NAME_FUNCS, (st), (i), (val)) +#define sk_NAME_FUNCS_zero(st) SKM_sk_zero(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_push(st, val) SKM_sk_push(NAME_FUNCS, (st), (val)) +#define sk_NAME_FUNCS_unshift(st, val) SKM_sk_unshift(NAME_FUNCS, (st), (val)) +#define sk_NAME_FUNCS_find(st, val) SKM_sk_find(NAME_FUNCS, (st), (val)) +#define sk_NAME_FUNCS_find_ex(st, val) SKM_sk_find_ex(NAME_FUNCS, (st), (val)) +#define sk_NAME_FUNCS_delete(st, i) SKM_sk_delete(NAME_FUNCS, (st), (i)) +#define sk_NAME_FUNCS_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(NAME_FUNCS, (st), (ptr)) +#define sk_NAME_FUNCS_insert(st, val, i) \ + SKM_sk_insert(NAME_FUNCS, (st), (val), (i)) +#define sk_NAME_FUNCS_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(NAME_FUNCS, (st), (cmp)) +#define sk_NAME_FUNCS_dup(st) SKM_sk_dup(NAME_FUNCS, st) +#define sk_NAME_FUNCS_pop_free(st, free_func) \ + SKM_sk_pop_free(NAME_FUNCS, (st), (free_func)) +#define sk_NAME_FUNCS_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(NAME_FUNCS, (st), (copy_func), (free_func)) +#define sk_NAME_FUNCS_shift(st) SKM_sk_shift(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_pop(st) SKM_sk_pop(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_sort(st) SKM_sk_sort(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_is_sorted(st) SKM_sk_is_sorted(NAME_FUNCS, (st)) +#define sk_OCSP_CERTID_new(cmp) SKM_sk_new(OCSP_CERTID, (cmp)) +#define sk_OCSP_CERTID_new_null() SKM_sk_new_null(OCSP_CERTID) +#define sk_OCSP_CERTID_free(st) SKM_sk_free(OCSP_CERTID, (st)) +#define sk_OCSP_CERTID_num(st) SKM_sk_num(OCSP_CERTID, (st)) +#define sk_OCSP_CERTID_value(st, i) SKM_sk_value(OCSP_CERTID, (st), (i)) +#define sk_OCSP_CERTID_set(st, i, val) SKM_sk_set(OCSP_CERTID, (st), (i), (val)) +#define sk_OCSP_CERTID_zero(st) SKM_sk_zero(OCSP_CERTID, (st)) +#define sk_OCSP_CERTID_push(st, val) SKM_sk_push(OCSP_CERTID, (st), (val)) +#define sk_OCSP_CERTID_unshift(st, val) SKM_sk_unshift(OCSP_CERTID, (st), (val)) +#define sk_OCSP_CERTID_find(st, val) SKM_sk_find(OCSP_CERTID, (st), (val)) +#define sk_OCSP_CERTID_find_ex(st, val) SKM_sk_find_ex(OCSP_CERTID, (st), (val)) +#define sk_OCSP_CERTID_delete(st, i) SKM_sk_delete(OCSP_CERTID, (st), (i)) +#define sk_OCSP_CERTID_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(OCSP_CERTID, (st), (ptr)) +#define sk_OCSP_CERTID_insert(st, val, i) \ + SKM_sk_insert(OCSP_CERTID, (st), (val), (i)) +#define sk_OCSP_CERTID_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(OCSP_CERTID, (st), (cmp)) +#define sk_OCSP_CERTID_dup(st) SKM_sk_dup(OCSP_CERTID, st) +#define sk_OCSP_CERTID_pop_free(st, free_func) \ + SKM_sk_pop_free(OCSP_CERTID, (st), (free_func)) +#define sk_OCSP_CERTID_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(OCSP_CERTID, (st), (copy_func), (free_func)) +#define sk_OCSP_CERTID_shift(st) SKM_sk_shift(OCSP_CERTID, (st)) +#define sk_OCSP_CERTID_pop(st) SKM_sk_pop(OCSP_CERTID, (st)) +#define sk_OCSP_CERTID_sort(st) SKM_sk_sort(OCSP_CERTID, (st)) +#define sk_OCSP_CERTID_is_sorted(st) SKM_sk_is_sorted(OCSP_CERTID, (st)) +#define sk_OCSP_ONEREQ_new(cmp) SKM_sk_new(OCSP_ONEREQ, (cmp)) +#define sk_OCSP_ONEREQ_new_null() SKM_sk_new_null(OCSP_ONEREQ) +#define sk_OCSP_ONEREQ_free(st) SKM_sk_free(OCSP_ONEREQ, (st)) +#define sk_OCSP_ONEREQ_num(st) SKM_sk_num(OCSP_ONEREQ, (st)) +#define sk_OCSP_ONEREQ_value(st, i) SKM_sk_value(OCSP_ONEREQ, (st), (i)) +#define sk_OCSP_ONEREQ_set(st, i, val) SKM_sk_set(OCSP_ONEREQ, (st), (i), (val)) +#define sk_OCSP_ONEREQ_zero(st) SKM_sk_zero(OCSP_ONEREQ, (st)) +#define sk_OCSP_ONEREQ_push(st, val) SKM_sk_push(OCSP_ONEREQ, (st), (val)) +#define sk_OCSP_ONEREQ_unshift(st, val) SKM_sk_unshift(OCSP_ONEREQ, (st), (val)) +#define sk_OCSP_ONEREQ_find(st, val) SKM_sk_find(OCSP_ONEREQ, (st), (val)) +#define sk_OCSP_ONEREQ_find_ex(st, val) SKM_sk_find_ex(OCSP_ONEREQ, (st), (val)) +#define sk_OCSP_ONEREQ_delete(st, i) SKM_sk_delete(OCSP_ONEREQ, (st), (i)) +#define sk_OCSP_ONEREQ_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(OCSP_ONEREQ, (st), (ptr)) +#define sk_OCSP_ONEREQ_insert(st, val, i) \ + SKM_sk_insert(OCSP_ONEREQ, (st), (val), (i)) +#define sk_OCSP_ONEREQ_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(OCSP_ONEREQ, (st), (cmp)) +#define sk_OCSP_ONEREQ_dup(st) SKM_sk_dup(OCSP_ONEREQ, st) +#define sk_OCSP_ONEREQ_pop_free(st, free_func) \ + SKM_sk_pop_free(OCSP_ONEREQ, (st), (free_func)) +#define sk_OCSP_ONEREQ_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(OCSP_ONEREQ, (st), (copy_func), (free_func)) +#define sk_OCSP_ONEREQ_shift(st) SKM_sk_shift(OCSP_ONEREQ, (st)) +#define sk_OCSP_ONEREQ_pop(st) SKM_sk_pop(OCSP_ONEREQ, (st)) +#define sk_OCSP_ONEREQ_sort(st) SKM_sk_sort(OCSP_ONEREQ, (st)) +#define sk_OCSP_ONEREQ_is_sorted(st) SKM_sk_is_sorted(OCSP_ONEREQ, (st)) +#define sk_OCSP_RESPID_new(cmp) SKM_sk_new(OCSP_RESPID, (cmp)) +#define sk_OCSP_RESPID_new_null() SKM_sk_new_null(OCSP_RESPID) +#define sk_OCSP_RESPID_free(st) SKM_sk_free(OCSP_RESPID, (st)) +#define sk_OCSP_RESPID_num(st) SKM_sk_num(OCSP_RESPID, (st)) +#define sk_OCSP_RESPID_value(st, i) SKM_sk_value(OCSP_RESPID, (st), (i)) +#define sk_OCSP_RESPID_set(st, i, val) SKM_sk_set(OCSP_RESPID, (st), (i), (val)) +#define sk_OCSP_RESPID_zero(st) SKM_sk_zero(OCSP_RESPID, (st)) +#define sk_OCSP_RESPID_push(st, val) SKM_sk_push(OCSP_RESPID, (st), (val)) +#define sk_OCSP_RESPID_unshift(st, val) SKM_sk_unshift(OCSP_RESPID, (st), (val)) +#define sk_OCSP_RESPID_find(st, val) SKM_sk_find(OCSP_RESPID, (st), (val)) +#define sk_OCSP_RESPID_find_ex(st, val) SKM_sk_find_ex(OCSP_RESPID, (st), (val)) +#define sk_OCSP_RESPID_delete(st, i) SKM_sk_delete(OCSP_RESPID, (st), (i)) +#define sk_OCSP_RESPID_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(OCSP_RESPID, (st), (ptr)) +#define sk_OCSP_RESPID_insert(st, val, i) \ + SKM_sk_insert(OCSP_RESPID, (st), (val), (i)) +#define sk_OCSP_RESPID_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(OCSP_RESPID, (st), (cmp)) +#define sk_OCSP_RESPID_dup(st) SKM_sk_dup(OCSP_RESPID, st) +#define sk_OCSP_RESPID_pop_free(st, free_func) \ + SKM_sk_pop_free(OCSP_RESPID, (st), (free_func)) +#define sk_OCSP_RESPID_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(OCSP_RESPID, (st), (copy_func), (free_func)) +#define sk_OCSP_RESPID_shift(st) SKM_sk_shift(OCSP_RESPID, (st)) +#define sk_OCSP_RESPID_pop(st) SKM_sk_pop(OCSP_RESPID, (st)) +#define sk_OCSP_RESPID_sort(st) SKM_sk_sort(OCSP_RESPID, (st)) +#define sk_OCSP_RESPID_is_sorted(st) SKM_sk_is_sorted(OCSP_RESPID, (st)) +#define sk_OCSP_SINGLERESP_new(cmp) SKM_sk_new(OCSP_SINGLERESP, (cmp)) +#define sk_OCSP_SINGLERESP_new_null() SKM_sk_new_null(OCSP_SINGLERESP) +#define sk_OCSP_SINGLERESP_free(st) SKM_sk_free(OCSP_SINGLERESP, (st)) +#define sk_OCSP_SINGLERESP_num(st) SKM_sk_num(OCSP_SINGLERESP, (st)) +#define sk_OCSP_SINGLERESP_value(st, i) SKM_sk_value(OCSP_SINGLERESP, (st), (i)) +#define sk_OCSP_SINGLERESP_set(st, i, val) \ + SKM_sk_set(OCSP_SINGLERESP, (st), (i), (val)) +#define sk_OCSP_SINGLERESP_zero(st) SKM_sk_zero(OCSP_SINGLERESP, (st)) +#define sk_OCSP_SINGLERESP_push(st, val) \ + SKM_sk_push(OCSP_SINGLERESP, (st), (val)) +#define sk_OCSP_SINGLERESP_unshift(st, val) \ + SKM_sk_unshift(OCSP_SINGLERESP, (st), (val)) +#define sk_OCSP_SINGLERESP_find(st, val) \ + SKM_sk_find(OCSP_SINGLERESP, (st), (val)) +#define sk_OCSP_SINGLERESP_find_ex(st, val) \ + SKM_sk_find_ex(OCSP_SINGLERESP, (st), (val)) +#define sk_OCSP_SINGLERESP_delete(st, i) \ + SKM_sk_delete(OCSP_SINGLERESP, (st), (i)) +#define sk_OCSP_SINGLERESP_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(OCSP_SINGLERESP, (st), (ptr)) +#define sk_OCSP_SINGLERESP_insert(st, val, i) \ + SKM_sk_insert(OCSP_SINGLERESP, (st), (val), (i)) +#define sk_OCSP_SINGLERESP_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(OCSP_SINGLERESP, (st), (cmp)) +#define sk_OCSP_SINGLERESP_dup(st) SKM_sk_dup(OCSP_SINGLERESP, st) +#define sk_OCSP_SINGLERESP_pop_free(st, free_func) \ + SKM_sk_pop_free(OCSP_SINGLERESP, (st), (free_func)) +#define sk_OCSP_SINGLERESP_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(OCSP_SINGLERESP, (st), (copy_func), (free_func)) +#define sk_OCSP_SINGLERESP_shift(st) SKM_sk_shift(OCSP_SINGLERESP, (st)) +#define sk_OCSP_SINGLERESP_pop(st) SKM_sk_pop(OCSP_SINGLERESP, (st)) +#define sk_OCSP_SINGLERESP_sort(st) SKM_sk_sort(OCSP_SINGLERESP, (st)) +#define sk_OCSP_SINGLERESP_is_sorted(st) SKM_sk_is_sorted(OCSP_SINGLERESP, (st)) +#define sk_PKCS12_SAFEBAG_new(cmp) SKM_sk_new(PKCS12_SAFEBAG, (cmp)) +#define sk_PKCS12_SAFEBAG_new_null() SKM_sk_new_null(PKCS12_SAFEBAG) +#define sk_PKCS12_SAFEBAG_free(st) SKM_sk_free(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_num(st) SKM_sk_num(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_value(st, i) SKM_sk_value(PKCS12_SAFEBAG, (st), (i)) +#define sk_PKCS12_SAFEBAG_set(st, i, val) \ + SKM_sk_set(PKCS12_SAFEBAG, (st), (i), (val)) +#define sk_PKCS12_SAFEBAG_zero(st) SKM_sk_zero(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_push(st, val) SKM_sk_push(PKCS12_SAFEBAG, (st), (val)) +#define sk_PKCS12_SAFEBAG_unshift(st, val) \ + SKM_sk_unshift(PKCS12_SAFEBAG, (st), (val)) +#define sk_PKCS12_SAFEBAG_find(st, val) SKM_sk_find(PKCS12_SAFEBAG, (st), (val)) +#define sk_PKCS12_SAFEBAG_find_ex(st, val) \ + SKM_sk_find_ex(PKCS12_SAFEBAG, (st), (val)) +#define sk_PKCS12_SAFEBAG_delete(st, i) SKM_sk_delete(PKCS12_SAFEBAG, (st), (i)) +#define sk_PKCS12_SAFEBAG_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(PKCS12_SAFEBAG, (st), (ptr)) +#define sk_PKCS12_SAFEBAG_insert(st, val, i) \ + SKM_sk_insert(PKCS12_SAFEBAG, (st), (val), (i)) +#define sk_PKCS12_SAFEBAG_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(PKCS12_SAFEBAG, (st), (cmp)) +#define sk_PKCS12_SAFEBAG_dup(st) SKM_sk_dup(PKCS12_SAFEBAG, st) +#define sk_PKCS12_SAFEBAG_pop_free(st, free_func) \ + SKM_sk_pop_free(PKCS12_SAFEBAG, (st), (free_func)) +#define sk_PKCS12_SAFEBAG_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(PKCS12_SAFEBAG, (st), (copy_func), (free_func)) +#define sk_PKCS12_SAFEBAG_shift(st) SKM_sk_shift(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_pop(st) SKM_sk_pop(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_sort(st) SKM_sk_sort(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_is_sorted(st) SKM_sk_is_sorted(PKCS12_SAFEBAG, (st)) +#define sk_PKCS7_new(cmp) SKM_sk_new(PKCS7, (cmp)) +#define sk_PKCS7_new_null() SKM_sk_new_null(PKCS7) +#define sk_PKCS7_free(st) SKM_sk_free(PKCS7, (st)) +#define sk_PKCS7_num(st) SKM_sk_num(PKCS7, (st)) +#define sk_PKCS7_value(st, i) SKM_sk_value(PKCS7, (st), (i)) +#define sk_PKCS7_set(st, i, val) SKM_sk_set(PKCS7, (st), (i), (val)) +#define sk_PKCS7_zero(st) SKM_sk_zero(PKCS7, (st)) +#define sk_PKCS7_push(st, val) SKM_sk_push(PKCS7, (st), (val)) +#define sk_PKCS7_unshift(st, val) SKM_sk_unshift(PKCS7, (st), (val)) +#define sk_PKCS7_find(st, val) SKM_sk_find(PKCS7, (st), (val)) +#define sk_PKCS7_find_ex(st, val) SKM_sk_find_ex(PKCS7, (st), (val)) +#define sk_PKCS7_delete(st, i) SKM_sk_delete(PKCS7, (st), (i)) +#define sk_PKCS7_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7, (st), (ptr)) +#define sk_PKCS7_insert(st, val, i) SKM_sk_insert(PKCS7, (st), (val), (i)) +#define sk_PKCS7_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS7, (st), (cmp)) +#define sk_PKCS7_dup(st) SKM_sk_dup(PKCS7, st) +#define sk_PKCS7_pop_free(st, free_func) \ + SKM_sk_pop_free(PKCS7, (st), (free_func)) +#define sk_PKCS7_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(PKCS7, (st), (copy_func), (free_func)) +#define sk_PKCS7_shift(st) SKM_sk_shift(PKCS7, (st)) +#define sk_PKCS7_pop(st) SKM_sk_pop(PKCS7, (st)) +#define sk_PKCS7_sort(st) SKM_sk_sort(PKCS7, (st)) +#define sk_PKCS7_is_sorted(st) SKM_sk_is_sorted(PKCS7, (st)) +#define sk_PKCS7_RECIP_INFO_new(cmp) SKM_sk_new(PKCS7_RECIP_INFO, (cmp)) +#define sk_PKCS7_RECIP_INFO_new_null() SKM_sk_new_null(PKCS7_RECIP_INFO) +#define sk_PKCS7_RECIP_INFO_free(st) SKM_sk_free(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_num(st) SKM_sk_num(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_value(st, i) \ + SKM_sk_value(PKCS7_RECIP_INFO, (st), (i)) +#define sk_PKCS7_RECIP_INFO_set(st, i, val) \ + SKM_sk_set(PKCS7_RECIP_INFO, (st), (i), (val)) +#define sk_PKCS7_RECIP_INFO_zero(st) SKM_sk_zero(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_push(st, val) \ + SKM_sk_push(PKCS7_RECIP_INFO, (st), (val)) +#define sk_PKCS7_RECIP_INFO_unshift(st, val) \ + SKM_sk_unshift(PKCS7_RECIP_INFO, (st), (val)) +#define sk_PKCS7_RECIP_INFO_find(st, val) \ + SKM_sk_find(PKCS7_RECIP_INFO, (st), (val)) +#define sk_PKCS7_RECIP_INFO_find_ex(st, val) \ + SKM_sk_find_ex(PKCS7_RECIP_INFO, (st), (val)) +#define sk_PKCS7_RECIP_INFO_delete(st, i) \ + SKM_sk_delete(PKCS7_RECIP_INFO, (st), (i)) +#define sk_PKCS7_RECIP_INFO_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(PKCS7_RECIP_INFO, (st), (ptr)) +#define sk_PKCS7_RECIP_INFO_insert(st, val, i) \ + SKM_sk_insert(PKCS7_RECIP_INFO, (st), (val), (i)) +#define sk_PKCS7_RECIP_INFO_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(PKCS7_RECIP_INFO, (st), (cmp)) +#define sk_PKCS7_RECIP_INFO_dup(st) SKM_sk_dup(PKCS7_RECIP_INFO, st) +#define sk_PKCS7_RECIP_INFO_pop_free(st, free_func) \ + SKM_sk_pop_free(PKCS7_RECIP_INFO, (st), (free_func)) +#define sk_PKCS7_RECIP_INFO_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(PKCS7_RECIP_INFO, (st), (copy_func), (free_func)) +#define sk_PKCS7_RECIP_INFO_shift(st) SKM_sk_shift(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_pop(st) SKM_sk_pop(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_sort(st) SKM_sk_sort(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_is_sorted(st) \ + SKM_sk_is_sorted(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_new(cmp) SKM_sk_new(PKCS7_SIGNER_INFO, (cmp)) +#define sk_PKCS7_SIGNER_INFO_new_null() SKM_sk_new_null(PKCS7_SIGNER_INFO) +#define sk_PKCS7_SIGNER_INFO_free(st) SKM_sk_free(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_num(st) SKM_sk_num(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_value(st, i) \ + SKM_sk_value(PKCS7_SIGNER_INFO, (st), (i)) +#define sk_PKCS7_SIGNER_INFO_set(st, i, val) \ + SKM_sk_set(PKCS7_SIGNER_INFO, (st), (i), (val)) +#define sk_PKCS7_SIGNER_INFO_zero(st) SKM_sk_zero(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_push(st, val) \ + SKM_sk_push(PKCS7_SIGNER_INFO, (st), (val)) +#define sk_PKCS7_SIGNER_INFO_unshift(st, val) \ + SKM_sk_unshift(PKCS7_SIGNER_INFO, (st), (val)) +#define sk_PKCS7_SIGNER_INFO_find(st, val) \ + SKM_sk_find(PKCS7_SIGNER_INFO, (st), (val)) +#define sk_PKCS7_SIGNER_INFO_find_ex(st, val) \ + SKM_sk_find_ex(PKCS7_SIGNER_INFO, (st), (val)) +#define sk_PKCS7_SIGNER_INFO_delete(st, i) \ + SKM_sk_delete(PKCS7_SIGNER_INFO, (st), (i)) +#define sk_PKCS7_SIGNER_INFO_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(PKCS7_SIGNER_INFO, (st), (ptr)) +#define sk_PKCS7_SIGNER_INFO_insert(st, val, i) \ + SKM_sk_insert(PKCS7_SIGNER_INFO, (st), (val), (i)) +#define sk_PKCS7_SIGNER_INFO_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(PKCS7_SIGNER_INFO, (st), (cmp)) +#define sk_PKCS7_SIGNER_INFO_dup(st) SKM_sk_dup(PKCS7_SIGNER_INFO, st) +#define sk_PKCS7_SIGNER_INFO_pop_free(st, free_func) \ + SKM_sk_pop_free(PKCS7_SIGNER_INFO, (st), (free_func)) +#define sk_PKCS7_SIGNER_INFO_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(PKCS7_SIGNER_INFO, (st), (copy_func), (free_func)) +#define sk_PKCS7_SIGNER_INFO_shift(st) SKM_sk_shift(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_pop(st) SKM_sk_pop(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_sort(st) SKM_sk_sort(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_is_sorted(st) \ + SKM_sk_is_sorted(PKCS7_SIGNER_INFO, (st)) +#define sk_POLICYINFO_new(cmp) SKM_sk_new(POLICYINFO, (cmp)) +#define sk_POLICYINFO_new_null() SKM_sk_new_null(POLICYINFO) +#define sk_POLICYINFO_free(st) SKM_sk_free(POLICYINFO, (st)) +#define sk_POLICYINFO_num(st) SKM_sk_num(POLICYINFO, (st)) +#define sk_POLICYINFO_value(st, i) SKM_sk_value(POLICYINFO, (st), (i)) +#define sk_POLICYINFO_set(st, i, val) SKM_sk_set(POLICYINFO, (st), (i), (val)) +#define sk_POLICYINFO_zero(st) SKM_sk_zero(POLICYINFO, (st)) +#define sk_POLICYINFO_push(st, val) SKM_sk_push(POLICYINFO, (st), (val)) +#define sk_POLICYINFO_unshift(st, val) SKM_sk_unshift(POLICYINFO, (st), (val)) +#define sk_POLICYINFO_find(st, val) SKM_sk_find(POLICYINFO, (st), (val)) +#define sk_POLICYINFO_find_ex(st, val) SKM_sk_find_ex(POLICYINFO, (st), (val)) +#define sk_POLICYINFO_delete(st, i) SKM_sk_delete(POLICYINFO, (st), (i)) +#define sk_POLICYINFO_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(POLICYINFO, (st), (ptr)) +#define sk_POLICYINFO_insert(st, val, i) \ + SKM_sk_insert(POLICYINFO, (st), (val), (i)) +#define sk_POLICYINFO_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(POLICYINFO, (st), (cmp)) +#define sk_POLICYINFO_dup(st) SKM_sk_dup(POLICYINFO, st) +#define sk_POLICYINFO_pop_free(st, free_func) \ + SKM_sk_pop_free(POLICYINFO, (st), (free_func)) +#define sk_POLICYINFO_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(POLICYINFO, (st), (copy_func), (free_func)) +#define sk_POLICYINFO_shift(st) SKM_sk_shift(POLICYINFO, (st)) +#define sk_POLICYINFO_pop(st) SKM_sk_pop(POLICYINFO, (st)) +#define sk_POLICYINFO_sort(st) SKM_sk_sort(POLICYINFO, (st)) +#define sk_POLICYINFO_is_sorted(st) SKM_sk_is_sorted(POLICYINFO, (st)) +#define sk_POLICYQUALINFO_new(cmp) SKM_sk_new(POLICYQUALINFO, (cmp)) +#define sk_POLICYQUALINFO_new_null() SKM_sk_new_null(POLICYQUALINFO) +#define sk_POLICYQUALINFO_free(st) SKM_sk_free(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_num(st) SKM_sk_num(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_value(st, i) SKM_sk_value(POLICYQUALINFO, (st), (i)) +#define sk_POLICYQUALINFO_set(st, i, val) \ + SKM_sk_set(POLICYQUALINFO, (st), (i), (val)) +#define sk_POLICYQUALINFO_zero(st) SKM_sk_zero(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_push(st, val) SKM_sk_push(POLICYQUALINFO, (st), (val)) +#define sk_POLICYQUALINFO_unshift(st, val) \ + SKM_sk_unshift(POLICYQUALINFO, (st), (val)) +#define sk_POLICYQUALINFO_find(st, val) SKM_sk_find(POLICYQUALINFO, (st), (val)) +#define sk_POLICYQUALINFO_find_ex(st, val) \ + SKM_sk_find_ex(POLICYQUALINFO, (st), (val)) +#define sk_POLICYQUALINFO_delete(st, i) SKM_sk_delete(POLICYQUALINFO, (st), (i)) +#define sk_POLICYQUALINFO_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(POLICYQUALINFO, (st), (ptr)) +#define sk_POLICYQUALINFO_insert(st, val, i) \ + SKM_sk_insert(POLICYQUALINFO, (st), (val), (i)) +#define sk_POLICYQUALINFO_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(POLICYQUALINFO, (st), (cmp)) +#define sk_POLICYQUALINFO_dup(st) SKM_sk_dup(POLICYQUALINFO, st) +#define sk_POLICYQUALINFO_pop_free(st, free_func) \ + SKM_sk_pop_free(POLICYQUALINFO, (st), (free_func)) +#define sk_POLICYQUALINFO_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(POLICYQUALINFO, (st), (copy_func), (free_func)) +#define sk_POLICYQUALINFO_shift(st) SKM_sk_shift(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_pop(st) SKM_sk_pop(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_sort(st) SKM_sk_sort(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_is_sorted(st) SKM_sk_is_sorted(POLICYQUALINFO, (st)) +#define sk_POLICY_MAPPING_new(cmp) SKM_sk_new(POLICY_MAPPING, (cmp)) +#define sk_POLICY_MAPPING_new_null() SKM_sk_new_null(POLICY_MAPPING) +#define sk_POLICY_MAPPING_free(st) SKM_sk_free(POLICY_MAPPING, (st)) +#define sk_POLICY_MAPPING_num(st) SKM_sk_num(POLICY_MAPPING, (st)) +#define sk_POLICY_MAPPING_value(st, i) SKM_sk_value(POLICY_MAPPING, (st), (i)) +#define sk_POLICY_MAPPING_set(st, i, val) \ + SKM_sk_set(POLICY_MAPPING, (st), (i), (val)) +#define sk_POLICY_MAPPING_zero(st) SKM_sk_zero(POLICY_MAPPING, (st)) +#define sk_POLICY_MAPPING_push(st, val) SKM_sk_push(POLICY_MAPPING, (st), (val)) +#define sk_POLICY_MAPPING_unshift(st, val) \ + SKM_sk_unshift(POLICY_MAPPING, (st), (val)) +#define sk_POLICY_MAPPING_find(st, val) SKM_sk_find(POLICY_MAPPING, (st), (val)) +#define sk_POLICY_MAPPING_find_ex(st, val) \ + SKM_sk_find_ex(POLICY_MAPPING, (st), (val)) +#define sk_POLICY_MAPPING_delete(st, i) SKM_sk_delete(POLICY_MAPPING, (st), (i)) +#define sk_POLICY_MAPPING_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(POLICY_MAPPING, (st), (ptr)) +#define sk_POLICY_MAPPING_insert(st, val, i) \ + SKM_sk_insert(POLICY_MAPPING, (st), (val), (i)) +#define sk_POLICY_MAPPING_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(POLICY_MAPPING, (st), (cmp)) +#define sk_POLICY_MAPPING_dup(st) SKM_sk_dup(POLICY_MAPPING, st) +#define sk_POLICY_MAPPING_pop_free(st, free_func) \ + SKM_sk_pop_free(POLICY_MAPPING, (st), (free_func)) +#define sk_POLICY_MAPPING_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(POLICY_MAPPING, (st), (copy_func), (free_func)) +#define sk_POLICY_MAPPING_shift(st) SKM_sk_shift(POLICY_MAPPING, (st)) +#define sk_POLICY_MAPPING_pop(st) SKM_sk_pop(POLICY_MAPPING, (st)) +#define sk_POLICY_MAPPING_sort(st) SKM_sk_sort(POLICY_MAPPING, (st)) +#define sk_POLICY_MAPPING_is_sorted(st) SKM_sk_is_sorted(POLICY_MAPPING, (st)) +#define sk_SCT_new(cmp) SKM_sk_new(SCT, (cmp)) +#define sk_SCT_new_null() SKM_sk_new_null(SCT) +#define sk_SCT_free(st) SKM_sk_free(SCT, (st)) +#define sk_SCT_num(st) SKM_sk_num(SCT, (st)) +#define sk_SCT_value(st, i) SKM_sk_value(SCT, (st), (i)) +#define sk_SCT_set(st, i, val) SKM_sk_set(SCT, (st), (i), (val)) +#define sk_SCT_zero(st) SKM_sk_zero(SCT, (st)) +#define sk_SCT_push(st, val) SKM_sk_push(SCT, (st), (val)) +#define sk_SCT_unshift(st, val) SKM_sk_unshift(SCT, (st), (val)) +#define sk_SCT_find(st, val) SKM_sk_find(SCT, (st), (val)) +#define sk_SCT_find_ex(st, val) SKM_sk_find_ex(SCT, (st), (val)) +#define sk_SCT_delete(st, i) SKM_sk_delete(SCT, (st), (i)) +#define sk_SCT_delete_ptr(st, ptr) SKM_sk_delete_ptr(SCT, (st), (ptr)) +#define sk_SCT_insert(st, val, i) SKM_sk_insert(SCT, (st), (val), (i)) +#define sk_SCT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SCT, (st), (cmp)) +#define sk_SCT_dup(st) SKM_sk_dup(SCT, st) +#define sk_SCT_pop_free(st, free_func) SKM_sk_pop_free(SCT, (st), (free_func)) +#define sk_SCT_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(SCT, (st), (copy_func), (free_func)) +#define sk_SCT_shift(st) SKM_sk_shift(SCT, (st)) +#define sk_SCT_pop(st) SKM_sk_pop(SCT, (st)) +#define sk_SCT_sort(st) SKM_sk_sort(SCT, (st)) +#define sk_SCT_is_sorted(st) SKM_sk_is_sorted(SCT, (st)) +#define sk_SRP_gN_new(cmp) SKM_sk_new(SRP_gN, (cmp)) +#define sk_SRP_gN_new_null() SKM_sk_new_null(SRP_gN) +#define sk_SRP_gN_free(st) SKM_sk_free(SRP_gN, (st)) +#define sk_SRP_gN_num(st) SKM_sk_num(SRP_gN, (st)) +#define sk_SRP_gN_value(st, i) SKM_sk_value(SRP_gN, (st), (i)) +#define sk_SRP_gN_set(st, i, val) SKM_sk_set(SRP_gN, (st), (i), (val)) +#define sk_SRP_gN_zero(st) SKM_sk_zero(SRP_gN, (st)) +#define sk_SRP_gN_push(st, val) SKM_sk_push(SRP_gN, (st), (val)) +#define sk_SRP_gN_unshift(st, val) SKM_sk_unshift(SRP_gN, (st), (val)) +#define sk_SRP_gN_find(st, val) SKM_sk_find(SRP_gN, (st), (val)) +#define sk_SRP_gN_find_ex(st, val) SKM_sk_find_ex(SRP_gN, (st), (val)) +#define sk_SRP_gN_delete(st, i) SKM_sk_delete(SRP_gN, (st), (i)) +#define sk_SRP_gN_delete_ptr(st, ptr) SKM_sk_delete_ptr(SRP_gN, (st), (ptr)) +#define sk_SRP_gN_insert(st, val, i) SKM_sk_insert(SRP_gN, (st), (val), (i)) +#define sk_SRP_gN_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SRP_gN, (st), (cmp)) +#define sk_SRP_gN_dup(st) SKM_sk_dup(SRP_gN, st) +#define sk_SRP_gN_pop_free(st, free_func) \ + SKM_sk_pop_free(SRP_gN, (st), (free_func)) +#define sk_SRP_gN_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(SRP_gN, (st), (copy_func), (free_func)) +#define sk_SRP_gN_shift(st) SKM_sk_shift(SRP_gN, (st)) +#define sk_SRP_gN_pop(st) SKM_sk_pop(SRP_gN, (st)) +#define sk_SRP_gN_sort(st) SKM_sk_sort(SRP_gN, (st)) +#define sk_SRP_gN_is_sorted(st) SKM_sk_is_sorted(SRP_gN, (st)) +#define sk_SRP_gN_cache_new(cmp) SKM_sk_new(SRP_gN_cache, (cmp)) +#define sk_SRP_gN_cache_new_null() SKM_sk_new_null(SRP_gN_cache) +#define sk_SRP_gN_cache_free(st) SKM_sk_free(SRP_gN_cache, (st)) +#define sk_SRP_gN_cache_num(st) SKM_sk_num(SRP_gN_cache, (st)) +#define sk_SRP_gN_cache_value(st, i) SKM_sk_value(SRP_gN_cache, (st), (i)) +#define sk_SRP_gN_cache_set(st, i, val) \ + SKM_sk_set(SRP_gN_cache, (st), (i), (val)) +#define sk_SRP_gN_cache_zero(st) SKM_sk_zero(SRP_gN_cache, (st)) +#define sk_SRP_gN_cache_push(st, val) SKM_sk_push(SRP_gN_cache, (st), (val)) +#define sk_SRP_gN_cache_unshift(st, val) \ + SKM_sk_unshift(SRP_gN_cache, (st), (val)) +#define sk_SRP_gN_cache_find(st, val) SKM_sk_find(SRP_gN_cache, (st), (val)) +#define sk_SRP_gN_cache_find_ex(st, val) \ + SKM_sk_find_ex(SRP_gN_cache, (st), (val)) +#define sk_SRP_gN_cache_delete(st, i) SKM_sk_delete(SRP_gN_cache, (st), (i)) +#define sk_SRP_gN_cache_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(SRP_gN_cache, (st), (ptr)) +#define sk_SRP_gN_cache_insert(st, val, i) \ + SKM_sk_insert(SRP_gN_cache, (st), (val), (i)) +#define sk_SRP_gN_cache_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(SRP_gN_cache, (st), (cmp)) +#define sk_SRP_gN_cache_dup(st) SKM_sk_dup(SRP_gN_cache, st) +#define sk_SRP_gN_cache_pop_free(st, free_func) \ + SKM_sk_pop_free(SRP_gN_cache, (st), (free_func)) +#define sk_SRP_gN_cache_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(SRP_gN_cache, (st), (copy_func), (free_func)) +#define sk_SRP_gN_cache_shift(st) SKM_sk_shift(SRP_gN_cache, (st)) +#define sk_SRP_gN_cache_pop(st) SKM_sk_pop(SRP_gN_cache, (st)) +#define sk_SRP_gN_cache_sort(st) SKM_sk_sort(SRP_gN_cache, (st)) +#define sk_SRP_gN_cache_is_sorted(st) SKM_sk_is_sorted(SRP_gN_cache, (st)) +#define sk_SRP_user_pwd_new(cmp) SKM_sk_new(SRP_user_pwd, (cmp)) +#define sk_SRP_user_pwd_new_null() SKM_sk_new_null(SRP_user_pwd) +#define sk_SRP_user_pwd_free(st) SKM_sk_free(SRP_user_pwd, (st)) +#define sk_SRP_user_pwd_num(st) SKM_sk_num(SRP_user_pwd, (st)) +#define sk_SRP_user_pwd_value(st, i) SKM_sk_value(SRP_user_pwd, (st), (i)) +#define sk_SRP_user_pwd_set(st, i, val) \ + SKM_sk_set(SRP_user_pwd, (st), (i), (val)) +#define sk_SRP_user_pwd_zero(st) SKM_sk_zero(SRP_user_pwd, (st)) +#define sk_SRP_user_pwd_push(st, val) SKM_sk_push(SRP_user_pwd, (st), (val)) +#define sk_SRP_user_pwd_unshift(st, val) \ + SKM_sk_unshift(SRP_user_pwd, (st), (val)) +#define sk_SRP_user_pwd_find(st, val) SKM_sk_find(SRP_user_pwd, (st), (val)) +#define sk_SRP_user_pwd_find_ex(st, val) \ + SKM_sk_find_ex(SRP_user_pwd, (st), (val)) +#define sk_SRP_user_pwd_delete(st, i) SKM_sk_delete(SRP_user_pwd, (st), (i)) +#define sk_SRP_user_pwd_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(SRP_user_pwd, (st), (ptr)) +#define sk_SRP_user_pwd_insert(st, val, i) \ + SKM_sk_insert(SRP_user_pwd, (st), (val), (i)) +#define sk_SRP_user_pwd_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(SRP_user_pwd, (st), (cmp)) +#define sk_SRP_user_pwd_dup(st) SKM_sk_dup(SRP_user_pwd, st) +#define sk_SRP_user_pwd_pop_free(st, free_func) \ + SKM_sk_pop_free(SRP_user_pwd, (st), (free_func)) +#define sk_SRP_user_pwd_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(SRP_user_pwd, (st), (copy_func), (free_func)) +#define sk_SRP_user_pwd_shift(st) SKM_sk_shift(SRP_user_pwd, (st)) +#define sk_SRP_user_pwd_pop(st) SKM_sk_pop(SRP_user_pwd, (st)) +#define sk_SRP_user_pwd_sort(st) SKM_sk_sort(SRP_user_pwd, (st)) +#define sk_SRP_user_pwd_is_sorted(st) SKM_sk_is_sorted(SRP_user_pwd, (st)) +#define sk_SRTP_PROTECTION_PROFILE_new(cmp) \ + SKM_sk_new(SRTP_PROTECTION_PROFILE, (cmp)) +#define sk_SRTP_PROTECTION_PROFILE_new_null() \ + SKM_sk_new_null(SRTP_PROTECTION_PROFILE) +#define sk_SRTP_PROTECTION_PROFILE_free(st) \ + SKM_sk_free(SRTP_PROTECTION_PROFILE, (st)) +#define sk_SRTP_PROTECTION_PROFILE_num(st) \ + SKM_sk_num(SRTP_PROTECTION_PROFILE, (st)) +#define sk_SRTP_PROTECTION_PROFILE_value(st, i) \ + SKM_sk_value(SRTP_PROTECTION_PROFILE, (st), (i)) +#define sk_SRTP_PROTECTION_PROFILE_set(st, i, val) \ + SKM_sk_set(SRTP_PROTECTION_PROFILE, (st), (i), (val)) +#define sk_SRTP_PROTECTION_PROFILE_zero(st) \ + SKM_sk_zero(SRTP_PROTECTION_PROFILE, (st)) +#define sk_SRTP_PROTECTION_PROFILE_push(st, val) \ + SKM_sk_push(SRTP_PROTECTION_PROFILE, (st), (val)) +#define sk_SRTP_PROTECTION_PROFILE_unshift(st, val) \ + SKM_sk_unshift(SRTP_PROTECTION_PROFILE, (st), (val)) +#define sk_SRTP_PROTECTION_PROFILE_find(st, val) \ + SKM_sk_find(SRTP_PROTECTION_PROFILE, (st), (val)) +#define sk_SRTP_PROTECTION_PROFILE_find_ex(st, val) \ + SKM_sk_find_ex(SRTP_PROTECTION_PROFILE, (st), (val)) +#define sk_SRTP_PROTECTION_PROFILE_delete(st, i) \ + SKM_sk_delete(SRTP_PROTECTION_PROFILE, (st), (i)) +#define sk_SRTP_PROTECTION_PROFILE_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(SRTP_PROTECTION_PROFILE, (st), (ptr)) +#define sk_SRTP_PROTECTION_PROFILE_insert(st, val, i) \ + SKM_sk_insert(SRTP_PROTECTION_PROFILE, (st), (val), (i)) +#define sk_SRTP_PROTECTION_PROFILE_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(SRTP_PROTECTION_PROFILE, (st), (cmp)) +#define sk_SRTP_PROTECTION_PROFILE_dup(st) \ + SKM_sk_dup(SRTP_PROTECTION_PROFILE, st) +#define sk_SRTP_PROTECTION_PROFILE_pop_free(st, free_func) \ + SKM_sk_pop_free(SRTP_PROTECTION_PROFILE, (st), (free_func)) +#define sk_SRTP_PROTECTION_PROFILE_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(SRTP_PROTECTION_PROFILE, (st), (copy_func), (free_func)) +#define sk_SRTP_PROTECTION_PROFILE_shift(st) \ + SKM_sk_shift(SRTP_PROTECTION_PROFILE, (st)) +#define sk_SRTP_PROTECTION_PROFILE_pop(st) \ + SKM_sk_pop(SRTP_PROTECTION_PROFILE, (st)) +#define sk_SRTP_PROTECTION_PROFILE_sort(st) \ + SKM_sk_sort(SRTP_PROTECTION_PROFILE, (st)) +#define sk_SRTP_PROTECTION_PROFILE_is_sorted(st) \ + SKM_sk_is_sorted(SRTP_PROTECTION_PROFILE, (st)) +#define sk_SSL_CIPHER_new(cmp) SKM_sk_new(SSL_CIPHER, (cmp)) +#define sk_SSL_CIPHER_new_null() SKM_sk_new_null(SSL_CIPHER) +#define sk_SSL_CIPHER_free(st) SKM_sk_free(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_num(st) SKM_sk_num(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_value(st, i) SKM_sk_value(SSL_CIPHER, (st), (i)) +#define sk_SSL_CIPHER_set(st, i, val) SKM_sk_set(SSL_CIPHER, (st), (i), (val)) +#define sk_SSL_CIPHER_zero(st) SKM_sk_zero(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_push(st, val) SKM_sk_push(SSL_CIPHER, (st), (val)) +#define sk_SSL_CIPHER_unshift(st, val) SKM_sk_unshift(SSL_CIPHER, (st), (val)) +#define sk_SSL_CIPHER_find(st, val) SKM_sk_find(SSL_CIPHER, (st), (val)) +#define sk_SSL_CIPHER_find_ex(st, val) SKM_sk_find_ex(SSL_CIPHER, (st), (val)) +#define sk_SSL_CIPHER_delete(st, i) SKM_sk_delete(SSL_CIPHER, (st), (i)) +#define sk_SSL_CIPHER_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(SSL_CIPHER, (st), (ptr)) +#define sk_SSL_CIPHER_insert(st, val, i) \ + SKM_sk_insert(SSL_CIPHER, (st), (val), (i)) +#define sk_SSL_CIPHER_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(SSL_CIPHER, (st), (cmp)) +#define sk_SSL_CIPHER_dup(st) SKM_sk_dup(SSL_CIPHER, st) +#define sk_SSL_CIPHER_pop_free(st, free_func) \ + SKM_sk_pop_free(SSL_CIPHER, (st), (free_func)) +#define sk_SSL_CIPHER_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(SSL_CIPHER, (st), (copy_func), (free_func)) +#define sk_SSL_CIPHER_shift(st) SKM_sk_shift(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_pop(st) SKM_sk_pop(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_sort(st) SKM_sk_sort(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_is_sorted(st) SKM_sk_is_sorted(SSL_CIPHER, (st)) +#define sk_SSL_COMP_new(cmp) SKM_sk_new(SSL_COMP, (cmp)) +#define sk_SSL_COMP_new_null() SKM_sk_new_null(SSL_COMP) +#define sk_SSL_COMP_free(st) SKM_sk_free(SSL_COMP, (st)) +#define sk_SSL_COMP_num(st) SKM_sk_num(SSL_COMP, (st)) +#define sk_SSL_COMP_value(st, i) SKM_sk_value(SSL_COMP, (st), (i)) +#define sk_SSL_COMP_set(st, i, val) SKM_sk_set(SSL_COMP, (st), (i), (val)) +#define sk_SSL_COMP_zero(st) SKM_sk_zero(SSL_COMP, (st)) +#define sk_SSL_COMP_push(st, val) SKM_sk_push(SSL_COMP, (st), (val)) +#define sk_SSL_COMP_unshift(st, val) SKM_sk_unshift(SSL_COMP, (st), (val)) +#define sk_SSL_COMP_find(st, val) SKM_sk_find(SSL_COMP, (st), (val)) +#define sk_SSL_COMP_find_ex(st, val) SKM_sk_find_ex(SSL_COMP, (st), (val)) +#define sk_SSL_COMP_delete(st, i) SKM_sk_delete(SSL_COMP, (st), (i)) +#define sk_SSL_COMP_delete_ptr(st, ptr) SKM_sk_delete_ptr(SSL_COMP, (st), (ptr)) +#define sk_SSL_COMP_insert(st, val, i) SKM_sk_insert(SSL_COMP, (st), (val), (i)) +#define sk_SSL_COMP_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(SSL_COMP, (st), (cmp)) +#define sk_SSL_COMP_dup(st) SKM_sk_dup(SSL_COMP, st) +#define sk_SSL_COMP_pop_free(st, free_func) \ + SKM_sk_pop_free(SSL_COMP, (st), (free_func)) +#define sk_SSL_COMP_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(SSL_COMP, (st), (copy_func), (free_func)) +#define sk_SSL_COMP_shift(st) SKM_sk_shift(SSL_COMP, (st)) +#define sk_SSL_COMP_pop(st) SKM_sk_pop(SSL_COMP, (st)) +#define sk_SSL_COMP_sort(st) SKM_sk_sort(SSL_COMP, (st)) +#define sk_SSL_COMP_is_sorted(st) SKM_sk_is_sorted(SSL_COMP, (st)) +#define sk_STACK_OF_X509_NAME_ENTRY_new(cmp) \ + SKM_sk_new(STACK_OF_X509_NAME_ENTRY, (cmp)) +#define sk_STACK_OF_X509_NAME_ENTRY_new_null() \ + SKM_sk_new_null(STACK_OF_X509_NAME_ENTRY) +#define sk_STACK_OF_X509_NAME_ENTRY_free(st) \ + SKM_sk_free(STACK_OF_X509_NAME_ENTRY, (st)) +#define sk_STACK_OF_X509_NAME_ENTRY_num(st) \ + SKM_sk_num(STACK_OF_X509_NAME_ENTRY, (st)) +#define sk_STACK_OF_X509_NAME_ENTRY_value(st, i) \ + SKM_sk_value(STACK_OF_X509_NAME_ENTRY, (st), (i)) +#define sk_STACK_OF_X509_NAME_ENTRY_set(st, i, val) \ + SKM_sk_set(STACK_OF_X509_NAME_ENTRY, (st), (i), (val)) +#define sk_STACK_OF_X509_NAME_ENTRY_zero(st) \ + SKM_sk_zero(STACK_OF_X509_NAME_ENTRY, (st)) +#define sk_STACK_OF_X509_NAME_ENTRY_push(st, val) \ + SKM_sk_push(STACK_OF_X509_NAME_ENTRY, (st), (val)) +#define sk_STACK_OF_X509_NAME_ENTRY_unshift(st, val) \ + SKM_sk_unshift(STACK_OF_X509_NAME_ENTRY, (st), (val)) +#define sk_STACK_OF_X509_NAME_ENTRY_find(st, val) \ + SKM_sk_find(STACK_OF_X509_NAME_ENTRY, (st), (val)) +#define sk_STACK_OF_X509_NAME_ENTRY_find_ex(st, val) \ + SKM_sk_find_ex(STACK_OF_X509_NAME_ENTRY, (st), (val)) +#define sk_STACK_OF_X509_NAME_ENTRY_delete(st, i) \ + SKM_sk_delete(STACK_OF_X509_NAME_ENTRY, (st), (i)) +#define sk_STACK_OF_X509_NAME_ENTRY_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(STACK_OF_X509_NAME_ENTRY, (st), (ptr)) +#define sk_STACK_OF_X509_NAME_ENTRY_insert(st, val, i) \ + SKM_sk_insert(STACK_OF_X509_NAME_ENTRY, (st), (val), (i)) +#define sk_STACK_OF_X509_NAME_ENTRY_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(STACK_OF_X509_NAME_ENTRY, (st), (cmp)) +#define sk_STACK_OF_X509_NAME_ENTRY_dup(st) \ + SKM_sk_dup(STACK_OF_X509_NAME_ENTRY, st) +#define sk_STACK_OF_X509_NAME_ENTRY_pop_free(st, free_func) \ + SKM_sk_pop_free(STACK_OF_X509_NAME_ENTRY, (st), (free_func)) +#define sk_STACK_OF_X509_NAME_ENTRY_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(STACK_OF_X509_NAME_ENTRY, (st), (copy_func), (free_func)) +#define sk_STACK_OF_X509_NAME_ENTRY_shift(st) \ + SKM_sk_shift(STACK_OF_X509_NAME_ENTRY, (st)) +#define sk_STACK_OF_X509_NAME_ENTRY_pop(st) \ + SKM_sk_pop(STACK_OF_X509_NAME_ENTRY, (st)) +#define sk_STACK_OF_X509_NAME_ENTRY_sort(st) \ + SKM_sk_sort(STACK_OF_X509_NAME_ENTRY, (st)) +#define sk_STACK_OF_X509_NAME_ENTRY_is_sorted(st) \ + SKM_sk_is_sorted(STACK_OF_X509_NAME_ENTRY, (st)) +#define sk_STORE_ATTR_INFO_new(cmp) SKM_sk_new(STORE_ATTR_INFO, (cmp)) +#define sk_STORE_ATTR_INFO_new_null() SKM_sk_new_null(STORE_ATTR_INFO) +#define sk_STORE_ATTR_INFO_free(st) SKM_sk_free(STORE_ATTR_INFO, (st)) +#define sk_STORE_ATTR_INFO_num(st) SKM_sk_num(STORE_ATTR_INFO, (st)) +#define sk_STORE_ATTR_INFO_value(st, i) SKM_sk_value(STORE_ATTR_INFO, (st), (i)) +#define sk_STORE_ATTR_INFO_set(st, i, val) \ + SKM_sk_set(STORE_ATTR_INFO, (st), (i), (val)) +#define sk_STORE_ATTR_INFO_zero(st) SKM_sk_zero(STORE_ATTR_INFO, (st)) +#define sk_STORE_ATTR_INFO_push(st, val) \ + SKM_sk_push(STORE_ATTR_INFO, (st), (val)) +#define sk_STORE_ATTR_INFO_unshift(st, val) \ + SKM_sk_unshift(STORE_ATTR_INFO, (st), (val)) +#define sk_STORE_ATTR_INFO_find(st, val) \ + SKM_sk_find(STORE_ATTR_INFO, (st), (val)) +#define sk_STORE_ATTR_INFO_find_ex(st, val) \ + SKM_sk_find_ex(STORE_ATTR_INFO, (st), (val)) +#define sk_STORE_ATTR_INFO_delete(st, i) \ + SKM_sk_delete(STORE_ATTR_INFO, (st), (i)) +#define sk_STORE_ATTR_INFO_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(STORE_ATTR_INFO, (st), (ptr)) +#define sk_STORE_ATTR_INFO_insert(st, val, i) \ + SKM_sk_insert(STORE_ATTR_INFO, (st), (val), (i)) +#define sk_STORE_ATTR_INFO_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(STORE_ATTR_INFO, (st), (cmp)) +#define sk_STORE_ATTR_INFO_dup(st) SKM_sk_dup(STORE_ATTR_INFO, st) +#define sk_STORE_ATTR_INFO_pop_free(st, free_func) \ + SKM_sk_pop_free(STORE_ATTR_INFO, (st), (free_func)) +#define sk_STORE_ATTR_INFO_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(STORE_ATTR_INFO, (st), (copy_func), (free_func)) +#define sk_STORE_ATTR_INFO_shift(st) SKM_sk_shift(STORE_ATTR_INFO, (st)) +#define sk_STORE_ATTR_INFO_pop(st) SKM_sk_pop(STORE_ATTR_INFO, (st)) +#define sk_STORE_ATTR_INFO_sort(st) SKM_sk_sort(STORE_ATTR_INFO, (st)) +#define sk_STORE_ATTR_INFO_is_sorted(st) SKM_sk_is_sorted(STORE_ATTR_INFO, (st)) +#define sk_STORE_OBJECT_new(cmp) SKM_sk_new(STORE_OBJECT, (cmp)) +#define sk_STORE_OBJECT_new_null() SKM_sk_new_null(STORE_OBJECT) +#define sk_STORE_OBJECT_free(st) SKM_sk_free(STORE_OBJECT, (st)) +#define sk_STORE_OBJECT_num(st) SKM_sk_num(STORE_OBJECT, (st)) +#define sk_STORE_OBJECT_value(st, i) SKM_sk_value(STORE_OBJECT, (st), (i)) +#define sk_STORE_OBJECT_set(st, i, val) \ + SKM_sk_set(STORE_OBJECT, (st), (i), (val)) +#define sk_STORE_OBJECT_zero(st) SKM_sk_zero(STORE_OBJECT, (st)) +#define sk_STORE_OBJECT_push(st, val) SKM_sk_push(STORE_OBJECT, (st), (val)) +#define sk_STORE_OBJECT_unshift(st, val) \ + SKM_sk_unshift(STORE_OBJECT, (st), (val)) +#define sk_STORE_OBJECT_find(st, val) SKM_sk_find(STORE_OBJECT, (st), (val)) +#define sk_STORE_OBJECT_find_ex(st, val) \ + SKM_sk_find_ex(STORE_OBJECT, (st), (val)) +#define sk_STORE_OBJECT_delete(st, i) SKM_sk_delete(STORE_OBJECT, (st), (i)) +#define sk_STORE_OBJECT_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(STORE_OBJECT, (st), (ptr)) +#define sk_STORE_OBJECT_insert(st, val, i) \ + SKM_sk_insert(STORE_OBJECT, (st), (val), (i)) +#define sk_STORE_OBJECT_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(STORE_OBJECT, (st), (cmp)) +#define sk_STORE_OBJECT_dup(st) SKM_sk_dup(STORE_OBJECT, st) +#define sk_STORE_OBJECT_pop_free(st, free_func) \ + SKM_sk_pop_free(STORE_OBJECT, (st), (free_func)) +#define sk_STORE_OBJECT_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(STORE_OBJECT, (st), (copy_func), (free_func)) +#define sk_STORE_OBJECT_shift(st) SKM_sk_shift(STORE_OBJECT, (st)) +#define sk_STORE_OBJECT_pop(st) SKM_sk_pop(STORE_OBJECT, (st)) +#define sk_STORE_OBJECT_sort(st) SKM_sk_sort(STORE_OBJECT, (st)) +#define sk_STORE_OBJECT_is_sorted(st) SKM_sk_is_sorted(STORE_OBJECT, (st)) +#define sk_SXNETID_new(cmp) SKM_sk_new(SXNETID, (cmp)) +#define sk_SXNETID_new_null() SKM_sk_new_null(SXNETID) +#define sk_SXNETID_free(st) SKM_sk_free(SXNETID, (st)) +#define sk_SXNETID_num(st) SKM_sk_num(SXNETID, (st)) +#define sk_SXNETID_value(st, i) SKM_sk_value(SXNETID, (st), (i)) +#define sk_SXNETID_set(st, i, val) SKM_sk_set(SXNETID, (st), (i), (val)) +#define sk_SXNETID_zero(st) SKM_sk_zero(SXNETID, (st)) +#define sk_SXNETID_push(st, val) SKM_sk_push(SXNETID, (st), (val)) +#define sk_SXNETID_unshift(st, val) SKM_sk_unshift(SXNETID, (st), (val)) +#define sk_SXNETID_find(st, val) SKM_sk_find(SXNETID, (st), (val)) +#define sk_SXNETID_find_ex(st, val) SKM_sk_find_ex(SXNETID, (st), (val)) +#define sk_SXNETID_delete(st, i) SKM_sk_delete(SXNETID, (st), (i)) +#define sk_SXNETID_delete_ptr(st, ptr) SKM_sk_delete_ptr(SXNETID, (st), (ptr)) +#define sk_SXNETID_insert(st, val, i) SKM_sk_insert(SXNETID, (st), (val), (i)) +#define sk_SXNETID_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(SXNETID, (st), (cmp)) +#define sk_SXNETID_dup(st) SKM_sk_dup(SXNETID, st) +#define sk_SXNETID_pop_free(st, free_func) \ + SKM_sk_pop_free(SXNETID, (st), (free_func)) +#define sk_SXNETID_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(SXNETID, (st), (copy_func), (free_func)) +#define sk_SXNETID_shift(st) SKM_sk_shift(SXNETID, (st)) +#define sk_SXNETID_pop(st) SKM_sk_pop(SXNETID, (st)) +#define sk_SXNETID_sort(st) SKM_sk_sort(SXNETID, (st)) +#define sk_SXNETID_is_sorted(st) SKM_sk_is_sorted(SXNETID, (st)) +#define sk_UI_STRING_new(cmp) SKM_sk_new(UI_STRING, (cmp)) +#define sk_UI_STRING_new_null() SKM_sk_new_null(UI_STRING) +#define sk_UI_STRING_free(st) SKM_sk_free(UI_STRING, (st)) +#define sk_UI_STRING_num(st) SKM_sk_num(UI_STRING, (st)) +#define sk_UI_STRING_value(st, i) SKM_sk_value(UI_STRING, (st), (i)) +#define sk_UI_STRING_set(st, i, val) SKM_sk_set(UI_STRING, (st), (i), (val)) +#define sk_UI_STRING_zero(st) SKM_sk_zero(UI_STRING, (st)) +#define sk_UI_STRING_push(st, val) SKM_sk_push(UI_STRING, (st), (val)) +#define sk_UI_STRING_unshift(st, val) SKM_sk_unshift(UI_STRING, (st), (val)) +#define sk_UI_STRING_find(st, val) SKM_sk_find(UI_STRING, (st), (val)) +#define sk_UI_STRING_find_ex(st, val) SKM_sk_find_ex(UI_STRING, (st), (val)) +#define sk_UI_STRING_delete(st, i) SKM_sk_delete(UI_STRING, (st), (i)) +#define sk_UI_STRING_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(UI_STRING, (st), (ptr)) +#define sk_UI_STRING_insert(st, val, i) \ + SKM_sk_insert(UI_STRING, (st), (val), (i)) +#define sk_UI_STRING_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(UI_STRING, (st), (cmp)) +#define sk_UI_STRING_dup(st) SKM_sk_dup(UI_STRING, st) +#define sk_UI_STRING_pop_free(st, free_func) \ + SKM_sk_pop_free(UI_STRING, (st), (free_func)) +#define sk_UI_STRING_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(UI_STRING, (st), (copy_func), (free_func)) +#define sk_UI_STRING_shift(st) SKM_sk_shift(UI_STRING, (st)) +#define sk_UI_STRING_pop(st) SKM_sk_pop(UI_STRING, (st)) +#define sk_UI_STRING_sort(st) SKM_sk_sort(UI_STRING, (st)) +#define sk_UI_STRING_is_sorted(st) SKM_sk_is_sorted(UI_STRING, (st)) +#define sk_X509_new(cmp) SKM_sk_new(X509, (cmp)) +#define sk_X509_new_null() SKM_sk_new_null(X509) +#define sk_X509_free(st) SKM_sk_free(X509, (st)) +#define sk_X509_num(st) SKM_sk_num(X509, (st)) +#define sk_X509_value(st, i) SKM_sk_value(X509, (st), (i)) +#define sk_X509_set(st, i, val) SKM_sk_set(X509, (st), (i), (val)) +#define sk_X509_zero(st) SKM_sk_zero(X509, (st)) +#define sk_X509_push(st, val) SKM_sk_push(X509, (st), (val)) +#define sk_X509_unshift(st, val) SKM_sk_unshift(X509, (st), (val)) +#define sk_X509_find(st, val) SKM_sk_find(X509, (st), (val)) +#define sk_X509_find_ex(st, val) SKM_sk_find_ex(X509, (st), (val)) +#define sk_X509_delete(st, i) SKM_sk_delete(X509, (st), (i)) +#define sk_X509_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509, (st), (ptr)) +#define sk_X509_insert(st, val, i) SKM_sk_insert(X509, (st), (val), (i)) +#define sk_X509_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509, (st), (cmp)) +#define sk_X509_dup(st) SKM_sk_dup(X509, st) +#define sk_X509_pop_free(st, free_func) SKM_sk_pop_free(X509, (st), (free_func)) +#define sk_X509_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(X509, (st), (copy_func), (free_func)) +#define sk_X509_shift(st) SKM_sk_shift(X509, (st)) +#define sk_X509_pop(st) SKM_sk_pop(X509, (st)) +#define sk_X509_sort(st) SKM_sk_sort(X509, (st)) +#define sk_X509_is_sorted(st) SKM_sk_is_sorted(X509, (st)) +#define sk_X509V3_EXT_METHOD_new(cmp) SKM_sk_new(X509V3_EXT_METHOD, (cmp)) +#define sk_X509V3_EXT_METHOD_new_null() SKM_sk_new_null(X509V3_EXT_METHOD) +#define sk_X509V3_EXT_METHOD_free(st) SKM_sk_free(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_num(st) SKM_sk_num(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_value(st, i) \ + SKM_sk_value(X509V3_EXT_METHOD, (st), (i)) +#define sk_X509V3_EXT_METHOD_set(st, i, val) \ + SKM_sk_set(X509V3_EXT_METHOD, (st), (i), (val)) +#define sk_X509V3_EXT_METHOD_zero(st) SKM_sk_zero(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_push(st, val) \ + SKM_sk_push(X509V3_EXT_METHOD, (st), (val)) +#define sk_X509V3_EXT_METHOD_unshift(st, val) \ + SKM_sk_unshift(X509V3_EXT_METHOD, (st), (val)) +#define sk_X509V3_EXT_METHOD_find(st, val) \ + SKM_sk_find(X509V3_EXT_METHOD, (st), (val)) +#define sk_X509V3_EXT_METHOD_find_ex(st, val) \ + SKM_sk_find_ex(X509V3_EXT_METHOD, (st), (val)) +#define sk_X509V3_EXT_METHOD_delete(st, i) \ + SKM_sk_delete(X509V3_EXT_METHOD, (st), (i)) +#define sk_X509V3_EXT_METHOD_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(X509V3_EXT_METHOD, (st), (ptr)) +#define sk_X509V3_EXT_METHOD_insert(st, val, i) \ + SKM_sk_insert(X509V3_EXT_METHOD, (st), (val), (i)) +#define sk_X509V3_EXT_METHOD_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(X509V3_EXT_METHOD, (st), (cmp)) +#define sk_X509V3_EXT_METHOD_dup(st) SKM_sk_dup(X509V3_EXT_METHOD, st) +#define sk_X509V3_EXT_METHOD_pop_free(st, free_func) \ + SKM_sk_pop_free(X509V3_EXT_METHOD, (st), (free_func)) +#define sk_X509V3_EXT_METHOD_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(X509V3_EXT_METHOD, (st), (copy_func), (free_func)) +#define sk_X509V3_EXT_METHOD_shift(st) SKM_sk_shift(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_pop(st) SKM_sk_pop(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_sort(st) SKM_sk_sort(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_is_sorted(st) \ + SKM_sk_is_sorted(X509V3_EXT_METHOD, (st)) +#define sk_X509_ALGOR_new(cmp) SKM_sk_new(X509_ALGOR, (cmp)) +#define sk_X509_ALGOR_new_null() SKM_sk_new_null(X509_ALGOR) +#define sk_X509_ALGOR_free(st) SKM_sk_free(X509_ALGOR, (st)) +#define sk_X509_ALGOR_num(st) SKM_sk_num(X509_ALGOR, (st)) +#define sk_X509_ALGOR_value(st, i) SKM_sk_value(X509_ALGOR, (st), (i)) +#define sk_X509_ALGOR_set(st, i, val) SKM_sk_set(X509_ALGOR, (st), (i), (val)) +#define sk_X509_ALGOR_zero(st) SKM_sk_zero(X509_ALGOR, (st)) +#define sk_X509_ALGOR_push(st, val) SKM_sk_push(X509_ALGOR, (st), (val)) +#define sk_X509_ALGOR_unshift(st, val) SKM_sk_unshift(X509_ALGOR, (st), (val)) +#define sk_X509_ALGOR_find(st, val) SKM_sk_find(X509_ALGOR, (st), (val)) +#define sk_X509_ALGOR_find_ex(st, val) SKM_sk_find_ex(X509_ALGOR, (st), (val)) +#define sk_X509_ALGOR_delete(st, i) SKM_sk_delete(X509_ALGOR, (st), (i)) +#define sk_X509_ALGOR_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(X509_ALGOR, (st), (ptr)) +#define sk_X509_ALGOR_insert(st, val, i) \ + SKM_sk_insert(X509_ALGOR, (st), (val), (i)) +#define sk_X509_ALGOR_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(X509_ALGOR, (st), (cmp)) +#define sk_X509_ALGOR_dup(st) SKM_sk_dup(X509_ALGOR, st) +#define sk_X509_ALGOR_pop_free(st, free_func) \ + SKM_sk_pop_free(X509_ALGOR, (st), (free_func)) +#define sk_X509_ALGOR_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(X509_ALGOR, (st), (copy_func), (free_func)) +#define sk_X509_ALGOR_shift(st) SKM_sk_shift(X509_ALGOR, (st)) +#define sk_X509_ALGOR_pop(st) SKM_sk_pop(X509_ALGOR, (st)) +#define sk_X509_ALGOR_sort(st) SKM_sk_sort(X509_ALGOR, (st)) +#define sk_X509_ALGOR_is_sorted(st) SKM_sk_is_sorted(X509_ALGOR, (st)) +#define sk_X509_ATTRIBUTE_new(cmp) SKM_sk_new(X509_ATTRIBUTE, (cmp)) +#define sk_X509_ATTRIBUTE_new_null() SKM_sk_new_null(X509_ATTRIBUTE) +#define sk_X509_ATTRIBUTE_free(st) SKM_sk_free(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_num(st) SKM_sk_num(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_value(st, i) SKM_sk_value(X509_ATTRIBUTE, (st), (i)) +#define sk_X509_ATTRIBUTE_set(st, i, val) \ + SKM_sk_set(X509_ATTRIBUTE, (st), (i), (val)) +#define sk_X509_ATTRIBUTE_zero(st) SKM_sk_zero(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_push(st, val) SKM_sk_push(X509_ATTRIBUTE, (st), (val)) +#define sk_X509_ATTRIBUTE_unshift(st, val) \ + SKM_sk_unshift(X509_ATTRIBUTE, (st), (val)) +#define sk_X509_ATTRIBUTE_find(st, val) SKM_sk_find(X509_ATTRIBUTE, (st), (val)) +#define sk_X509_ATTRIBUTE_find_ex(st, val) \ + SKM_sk_find_ex(X509_ATTRIBUTE, (st), (val)) +#define sk_X509_ATTRIBUTE_delete(st, i) SKM_sk_delete(X509_ATTRIBUTE, (st), (i)) +#define sk_X509_ATTRIBUTE_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(X509_ATTRIBUTE, (st), (ptr)) +#define sk_X509_ATTRIBUTE_insert(st, val, i) \ + SKM_sk_insert(X509_ATTRIBUTE, (st), (val), (i)) +#define sk_X509_ATTRIBUTE_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(X509_ATTRIBUTE, (st), (cmp)) +#define sk_X509_ATTRIBUTE_dup(st) SKM_sk_dup(X509_ATTRIBUTE, st) +#define sk_X509_ATTRIBUTE_pop_free(st, free_func) \ + SKM_sk_pop_free(X509_ATTRIBUTE, (st), (free_func)) +#define sk_X509_ATTRIBUTE_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(X509_ATTRIBUTE, (st), (copy_func), (free_func)) +#define sk_X509_ATTRIBUTE_shift(st) SKM_sk_shift(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_pop(st) SKM_sk_pop(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_sort(st) SKM_sk_sort(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_is_sorted(st) SKM_sk_is_sorted(X509_ATTRIBUTE, (st)) +#define sk_X509_CRL_new(cmp) SKM_sk_new(X509_CRL, (cmp)) +#define sk_X509_CRL_new_null() SKM_sk_new_null(X509_CRL) +#define sk_X509_CRL_free(st) SKM_sk_free(X509_CRL, (st)) +#define sk_X509_CRL_num(st) SKM_sk_num(X509_CRL, (st)) +#define sk_X509_CRL_value(st, i) SKM_sk_value(X509_CRL, (st), (i)) +#define sk_X509_CRL_set(st, i, val) SKM_sk_set(X509_CRL, (st), (i), (val)) +#define sk_X509_CRL_zero(st) SKM_sk_zero(X509_CRL, (st)) +#define sk_X509_CRL_push(st, val) SKM_sk_push(X509_CRL, (st), (val)) +#define sk_X509_CRL_unshift(st, val) SKM_sk_unshift(X509_CRL, (st), (val)) +#define sk_X509_CRL_find(st, val) SKM_sk_find(X509_CRL, (st), (val)) +#define sk_X509_CRL_find_ex(st, val) SKM_sk_find_ex(X509_CRL, (st), (val)) +#define sk_X509_CRL_delete(st, i) SKM_sk_delete(X509_CRL, (st), (i)) +#define sk_X509_CRL_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_CRL, (st), (ptr)) +#define sk_X509_CRL_insert(st, val, i) SKM_sk_insert(X509_CRL, (st), (val), (i)) +#define sk_X509_CRL_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(X509_CRL, (st), (cmp)) +#define sk_X509_CRL_dup(st) SKM_sk_dup(X509_CRL, st) +#define sk_X509_CRL_pop_free(st, free_func) \ + SKM_sk_pop_free(X509_CRL, (st), (free_func)) +#define sk_X509_CRL_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(X509_CRL, (st), (copy_func), (free_func)) +#define sk_X509_CRL_shift(st) SKM_sk_shift(X509_CRL, (st)) +#define sk_X509_CRL_pop(st) SKM_sk_pop(X509_CRL, (st)) +#define sk_X509_CRL_sort(st) SKM_sk_sort(X509_CRL, (st)) +#define sk_X509_CRL_is_sorted(st) SKM_sk_is_sorted(X509_CRL, (st)) +#define sk_X509_EXTENSION_new(cmp) SKM_sk_new(X509_EXTENSION, (cmp)) +#define sk_X509_EXTENSION_new_null() SKM_sk_new_null(X509_EXTENSION) +#define sk_X509_EXTENSION_free(st) SKM_sk_free(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_num(st) SKM_sk_num(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_value(st, i) SKM_sk_value(X509_EXTENSION, (st), (i)) +#define sk_X509_EXTENSION_set(st, i, val) \ + SKM_sk_set(X509_EXTENSION, (st), (i), (val)) +#define sk_X509_EXTENSION_zero(st) SKM_sk_zero(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_push(st, val) SKM_sk_push(X509_EXTENSION, (st), (val)) +#define sk_X509_EXTENSION_unshift(st, val) \ + SKM_sk_unshift(X509_EXTENSION, (st), (val)) +#define sk_X509_EXTENSION_find(st, val) SKM_sk_find(X509_EXTENSION, (st), (val)) +#define sk_X509_EXTENSION_find_ex(st, val) \ + SKM_sk_find_ex(X509_EXTENSION, (st), (val)) +#define sk_X509_EXTENSION_delete(st, i) SKM_sk_delete(X509_EXTENSION, (st), (i)) +#define sk_X509_EXTENSION_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(X509_EXTENSION, (st), (ptr)) +#define sk_X509_EXTENSION_insert(st, val, i) \ + SKM_sk_insert(X509_EXTENSION, (st), (val), (i)) +#define sk_X509_EXTENSION_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(X509_EXTENSION, (st), (cmp)) +#define sk_X509_EXTENSION_dup(st) SKM_sk_dup(X509_EXTENSION, st) +#define sk_X509_EXTENSION_pop_free(st, free_func) \ + SKM_sk_pop_free(X509_EXTENSION, (st), (free_func)) +#define sk_X509_EXTENSION_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(X509_EXTENSION, (st), (copy_func), (free_func)) +#define sk_X509_EXTENSION_shift(st) SKM_sk_shift(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_pop(st) SKM_sk_pop(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_sort(st) SKM_sk_sort(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_is_sorted(st) SKM_sk_is_sorted(X509_EXTENSION, (st)) +#define sk_X509_INFO_new(cmp) SKM_sk_new(X509_INFO, (cmp)) +#define sk_X509_INFO_new_null() SKM_sk_new_null(X509_INFO) +#define sk_X509_INFO_free(st) SKM_sk_free(X509_INFO, (st)) +#define sk_X509_INFO_num(st) SKM_sk_num(X509_INFO, (st)) +#define sk_X509_INFO_value(st, i) SKM_sk_value(X509_INFO, (st), (i)) +#define sk_X509_INFO_set(st, i, val) SKM_sk_set(X509_INFO, (st), (i), (val)) +#define sk_X509_INFO_zero(st) SKM_sk_zero(X509_INFO, (st)) +#define sk_X509_INFO_push(st, val) SKM_sk_push(X509_INFO, (st), (val)) +#define sk_X509_INFO_unshift(st, val) SKM_sk_unshift(X509_INFO, (st), (val)) +#define sk_X509_INFO_find(st, val) SKM_sk_find(X509_INFO, (st), (val)) +#define sk_X509_INFO_find_ex(st, val) SKM_sk_find_ex(X509_INFO, (st), (val)) +#define sk_X509_INFO_delete(st, i) SKM_sk_delete(X509_INFO, (st), (i)) +#define sk_X509_INFO_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(X509_INFO, (st), (ptr)) +#define sk_X509_INFO_insert(st, val, i) \ + SKM_sk_insert(X509_INFO, (st), (val), (i)) +#define sk_X509_INFO_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(X509_INFO, (st), (cmp)) +#define sk_X509_INFO_dup(st) SKM_sk_dup(X509_INFO, st) +#define sk_X509_INFO_pop_free(st, free_func) \ + SKM_sk_pop_free(X509_INFO, (st), (free_func)) +#define sk_X509_INFO_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(X509_INFO, (st), (copy_func), (free_func)) +#define sk_X509_INFO_shift(st) SKM_sk_shift(X509_INFO, (st)) +#define sk_X509_INFO_pop(st) SKM_sk_pop(X509_INFO, (st)) +#define sk_X509_INFO_sort(st) SKM_sk_sort(X509_INFO, (st)) +#define sk_X509_INFO_is_sorted(st) SKM_sk_is_sorted(X509_INFO, (st)) +#define sk_X509_LOOKUP_new(cmp) SKM_sk_new(X509_LOOKUP, (cmp)) +#define sk_X509_LOOKUP_new_null() SKM_sk_new_null(X509_LOOKUP) +#define sk_X509_LOOKUP_free(st) SKM_sk_free(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_num(st) SKM_sk_num(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_value(st, i) SKM_sk_value(X509_LOOKUP, (st), (i)) +#define sk_X509_LOOKUP_set(st, i, val) SKM_sk_set(X509_LOOKUP, (st), (i), (val)) +#define sk_X509_LOOKUP_zero(st) SKM_sk_zero(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_push(st, val) SKM_sk_push(X509_LOOKUP, (st), (val)) +#define sk_X509_LOOKUP_unshift(st, val) SKM_sk_unshift(X509_LOOKUP, (st), (val)) +#define sk_X509_LOOKUP_find(st, val) SKM_sk_find(X509_LOOKUP, (st), (val)) +#define sk_X509_LOOKUP_find_ex(st, val) SKM_sk_find_ex(X509_LOOKUP, (st), (val)) +#define sk_X509_LOOKUP_delete(st, i) SKM_sk_delete(X509_LOOKUP, (st), (i)) +#define sk_X509_LOOKUP_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(X509_LOOKUP, (st), (ptr)) +#define sk_X509_LOOKUP_insert(st, val, i) \ + SKM_sk_insert(X509_LOOKUP, (st), (val), (i)) +#define sk_X509_LOOKUP_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(X509_LOOKUP, (st), (cmp)) +#define sk_X509_LOOKUP_dup(st) SKM_sk_dup(X509_LOOKUP, st) +#define sk_X509_LOOKUP_pop_free(st, free_func) \ + SKM_sk_pop_free(X509_LOOKUP, (st), (free_func)) +#define sk_X509_LOOKUP_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(X509_LOOKUP, (st), (copy_func), (free_func)) +#define sk_X509_LOOKUP_shift(st) SKM_sk_shift(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_pop(st) SKM_sk_pop(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_sort(st) SKM_sk_sort(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_is_sorted(st) SKM_sk_is_sorted(X509_LOOKUP, (st)) +#define sk_X509_NAME_new(cmp) SKM_sk_new(X509_NAME, (cmp)) +#define sk_X509_NAME_new_null() SKM_sk_new_null(X509_NAME) +#define sk_X509_NAME_free(st) SKM_sk_free(X509_NAME, (st)) +#define sk_X509_NAME_num(st) SKM_sk_num(X509_NAME, (st)) +#define sk_X509_NAME_value(st, i) SKM_sk_value(X509_NAME, (st), (i)) +#define sk_X509_NAME_set(st, i, val) SKM_sk_set(X509_NAME, (st), (i), (val)) +#define sk_X509_NAME_zero(st) SKM_sk_zero(X509_NAME, (st)) +#define sk_X509_NAME_push(st, val) SKM_sk_push(X509_NAME, (st), (val)) +#define sk_X509_NAME_unshift(st, val) SKM_sk_unshift(X509_NAME, (st), (val)) +#define sk_X509_NAME_find(st, val) SKM_sk_find(X509_NAME, (st), (val)) +#define sk_X509_NAME_find_ex(st, val) SKM_sk_find_ex(X509_NAME, (st), (val)) +#define sk_X509_NAME_delete(st, i) SKM_sk_delete(X509_NAME, (st), (i)) +#define sk_X509_NAME_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(X509_NAME, (st), (ptr)) +#define sk_X509_NAME_insert(st, val, i) \ + SKM_sk_insert(X509_NAME, (st), (val), (i)) +#define sk_X509_NAME_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(X509_NAME, (st), (cmp)) +#define sk_X509_NAME_dup(st) SKM_sk_dup(X509_NAME, st) +#define sk_X509_NAME_pop_free(st, free_func) \ + SKM_sk_pop_free(X509_NAME, (st), (free_func)) +#define sk_X509_NAME_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(X509_NAME, (st), (copy_func), (free_func)) +#define sk_X509_NAME_shift(st) SKM_sk_shift(X509_NAME, (st)) +#define sk_X509_NAME_pop(st) SKM_sk_pop(X509_NAME, (st)) +#define sk_X509_NAME_sort(st) SKM_sk_sort(X509_NAME, (st)) +#define sk_X509_NAME_is_sorted(st) SKM_sk_is_sorted(X509_NAME, (st)) +#define sk_X509_NAME_ENTRY_new(cmp) SKM_sk_new(X509_NAME_ENTRY, (cmp)) +#define sk_X509_NAME_ENTRY_new_null() SKM_sk_new_null(X509_NAME_ENTRY) +#define sk_X509_NAME_ENTRY_free(st) SKM_sk_free(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_num(st) SKM_sk_num(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_value(st, i) SKM_sk_value(X509_NAME_ENTRY, (st), (i)) +#define sk_X509_NAME_ENTRY_set(st, i, val) \ + SKM_sk_set(X509_NAME_ENTRY, (st), (i), (val)) +#define sk_X509_NAME_ENTRY_zero(st) SKM_sk_zero(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_push(st, val) \ + SKM_sk_push(X509_NAME_ENTRY, (st), (val)) +#define sk_X509_NAME_ENTRY_unshift(st, val) \ + SKM_sk_unshift(X509_NAME_ENTRY, (st), (val)) +#define sk_X509_NAME_ENTRY_find(st, val) \ + SKM_sk_find(X509_NAME_ENTRY, (st), (val)) +#define sk_X509_NAME_ENTRY_find_ex(st, val) \ + SKM_sk_find_ex(X509_NAME_ENTRY, (st), (val)) +#define sk_X509_NAME_ENTRY_delete(st, i) \ + SKM_sk_delete(X509_NAME_ENTRY, (st), (i)) +#define sk_X509_NAME_ENTRY_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(X509_NAME_ENTRY, (st), (ptr)) +#define sk_X509_NAME_ENTRY_insert(st, val, i) \ + SKM_sk_insert(X509_NAME_ENTRY, (st), (val), (i)) +#define sk_X509_NAME_ENTRY_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(X509_NAME_ENTRY, (st), (cmp)) +#define sk_X509_NAME_ENTRY_dup(st) SKM_sk_dup(X509_NAME_ENTRY, st) +#define sk_X509_NAME_ENTRY_pop_free(st, free_func) \ + SKM_sk_pop_free(X509_NAME_ENTRY, (st), (free_func)) +#define sk_X509_NAME_ENTRY_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(X509_NAME_ENTRY, (st), (copy_func), (free_func)) +#define sk_X509_NAME_ENTRY_shift(st) SKM_sk_shift(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_pop(st) SKM_sk_pop(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_sort(st) SKM_sk_sort(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_is_sorted(st) SKM_sk_is_sorted(X509_NAME_ENTRY, (st)) +#define sk_X509_OBJECT_new(cmp) SKM_sk_new(X509_OBJECT, (cmp)) +#define sk_X509_OBJECT_new_null() SKM_sk_new_null(X509_OBJECT) +#define sk_X509_OBJECT_free(st) SKM_sk_free(X509_OBJECT, (st)) +#define sk_X509_OBJECT_num(st) SKM_sk_num(X509_OBJECT, (st)) +#define sk_X509_OBJECT_value(st, i) SKM_sk_value(X509_OBJECT, (st), (i)) +#define sk_X509_OBJECT_set(st, i, val) SKM_sk_set(X509_OBJECT, (st), (i), (val)) +#define sk_X509_OBJECT_zero(st) SKM_sk_zero(X509_OBJECT, (st)) +#define sk_X509_OBJECT_push(st, val) SKM_sk_push(X509_OBJECT, (st), (val)) +#define sk_X509_OBJECT_unshift(st, val) SKM_sk_unshift(X509_OBJECT, (st), (val)) +#define sk_X509_OBJECT_find(st, val) SKM_sk_find(X509_OBJECT, (st), (val)) +#define sk_X509_OBJECT_find_ex(st, val) SKM_sk_find_ex(X509_OBJECT, (st), (val)) +#define sk_X509_OBJECT_delete(st, i) SKM_sk_delete(X509_OBJECT, (st), (i)) +#define sk_X509_OBJECT_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(X509_OBJECT, (st), (ptr)) +#define sk_X509_OBJECT_insert(st, val, i) \ + SKM_sk_insert(X509_OBJECT, (st), (val), (i)) +#define sk_X509_OBJECT_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(X509_OBJECT, (st), (cmp)) +#define sk_X509_OBJECT_dup(st) SKM_sk_dup(X509_OBJECT, st) +#define sk_X509_OBJECT_pop_free(st, free_func) \ + SKM_sk_pop_free(X509_OBJECT, (st), (free_func)) +#define sk_X509_OBJECT_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(X509_OBJECT, (st), (copy_func), (free_func)) +#define sk_X509_OBJECT_shift(st) SKM_sk_shift(X509_OBJECT, (st)) +#define sk_X509_OBJECT_pop(st) SKM_sk_pop(X509_OBJECT, (st)) +#define sk_X509_OBJECT_sort(st) SKM_sk_sort(X509_OBJECT, (st)) +#define sk_X509_OBJECT_is_sorted(st) SKM_sk_is_sorted(X509_OBJECT, (st)) +#define sk_X509_POLICY_DATA_new(cmp) SKM_sk_new(X509_POLICY_DATA, (cmp)) +#define sk_X509_POLICY_DATA_new_null() SKM_sk_new_null(X509_POLICY_DATA) +#define sk_X509_POLICY_DATA_free(st) SKM_sk_free(X509_POLICY_DATA, (st)) +#define sk_X509_POLICY_DATA_num(st) SKM_sk_num(X509_POLICY_DATA, (st)) +#define sk_X509_POLICY_DATA_value(st, i) \ + SKM_sk_value(X509_POLICY_DATA, (st), (i)) +#define sk_X509_POLICY_DATA_set(st, i, val) \ + SKM_sk_set(X509_POLICY_DATA, (st), (i), (val)) +#define sk_X509_POLICY_DATA_zero(st) SKM_sk_zero(X509_POLICY_DATA, (st)) +#define sk_X509_POLICY_DATA_push(st, val) \ + SKM_sk_push(X509_POLICY_DATA, (st), (val)) +#define sk_X509_POLICY_DATA_unshift(st, val) \ + SKM_sk_unshift(X509_POLICY_DATA, (st), (val)) +#define sk_X509_POLICY_DATA_find(st, val) \ + SKM_sk_find(X509_POLICY_DATA, (st), (val)) +#define sk_X509_POLICY_DATA_find_ex(st, val) \ + SKM_sk_find_ex(X509_POLICY_DATA, (st), (val)) +#define sk_X509_POLICY_DATA_delete(st, i) \ + SKM_sk_delete(X509_POLICY_DATA, (st), (i)) +#define sk_X509_POLICY_DATA_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(X509_POLICY_DATA, (st), (ptr)) +#define sk_X509_POLICY_DATA_insert(st, val, i) \ + SKM_sk_insert(X509_POLICY_DATA, (st), (val), (i)) +#define sk_X509_POLICY_DATA_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(X509_POLICY_DATA, (st), (cmp)) +#define sk_X509_POLICY_DATA_dup(st) SKM_sk_dup(X509_POLICY_DATA, st) +#define sk_X509_POLICY_DATA_pop_free(st, free_func) \ + SKM_sk_pop_free(X509_POLICY_DATA, (st), (free_func)) +#define sk_X509_POLICY_DATA_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(X509_POLICY_DATA, (st), (copy_func), (free_func)) +#define sk_X509_POLICY_DATA_shift(st) SKM_sk_shift(X509_POLICY_DATA, (st)) +#define sk_X509_POLICY_DATA_pop(st) SKM_sk_pop(X509_POLICY_DATA, (st)) +#define sk_X509_POLICY_DATA_sort(st) SKM_sk_sort(X509_POLICY_DATA, (st)) +#define sk_X509_POLICY_DATA_is_sorted(st) \ + SKM_sk_is_sorted(X509_POLICY_DATA, (st)) +#define sk_X509_POLICY_NODE_new(cmp) SKM_sk_new(X509_POLICY_NODE, (cmp)) +#define sk_X509_POLICY_NODE_new_null() SKM_sk_new_null(X509_POLICY_NODE) +#define sk_X509_POLICY_NODE_free(st) SKM_sk_free(X509_POLICY_NODE, (st)) +#define sk_X509_POLICY_NODE_num(st) SKM_sk_num(X509_POLICY_NODE, (st)) +#define sk_X509_POLICY_NODE_value(st, i) \ + SKM_sk_value(X509_POLICY_NODE, (st), (i)) +#define sk_X509_POLICY_NODE_set(st, i, val) \ + SKM_sk_set(X509_POLICY_NODE, (st), (i), (val)) +#define sk_X509_POLICY_NODE_zero(st) SKM_sk_zero(X509_POLICY_NODE, (st)) +#define sk_X509_POLICY_NODE_push(st, val) \ + SKM_sk_push(X509_POLICY_NODE, (st), (val)) +#define sk_X509_POLICY_NODE_unshift(st, val) \ + SKM_sk_unshift(X509_POLICY_NODE, (st), (val)) +#define sk_X509_POLICY_NODE_find(st, val) \ + SKM_sk_find(X509_POLICY_NODE, (st), (val)) +#define sk_X509_POLICY_NODE_find_ex(st, val) \ + SKM_sk_find_ex(X509_POLICY_NODE, (st), (val)) +#define sk_X509_POLICY_NODE_delete(st, i) \ + SKM_sk_delete(X509_POLICY_NODE, (st), (i)) +#define sk_X509_POLICY_NODE_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(X509_POLICY_NODE, (st), (ptr)) +#define sk_X509_POLICY_NODE_insert(st, val, i) \ + SKM_sk_insert(X509_POLICY_NODE, (st), (val), (i)) +#define sk_X509_POLICY_NODE_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(X509_POLICY_NODE, (st), (cmp)) +#define sk_X509_POLICY_NODE_dup(st) SKM_sk_dup(X509_POLICY_NODE, st) +#define sk_X509_POLICY_NODE_pop_free(st, free_func) \ + SKM_sk_pop_free(X509_POLICY_NODE, (st), (free_func)) +#define sk_X509_POLICY_NODE_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(X509_POLICY_NODE, (st), (copy_func), (free_func)) +#define sk_X509_POLICY_NODE_shift(st) SKM_sk_shift(X509_POLICY_NODE, (st)) +#define sk_X509_POLICY_NODE_pop(st) SKM_sk_pop(X509_POLICY_NODE, (st)) +#define sk_X509_POLICY_NODE_sort(st) SKM_sk_sort(X509_POLICY_NODE, (st)) +#define sk_X509_POLICY_NODE_is_sorted(st) \ + SKM_sk_is_sorted(X509_POLICY_NODE, (st)) +#define sk_X509_PURPOSE_new(cmp) SKM_sk_new(X509_PURPOSE, (cmp)) +#define sk_X509_PURPOSE_new_null() SKM_sk_new_null(X509_PURPOSE) +#define sk_X509_PURPOSE_free(st) SKM_sk_free(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_num(st) SKM_sk_num(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_value(st, i) SKM_sk_value(X509_PURPOSE, (st), (i)) +#define sk_X509_PURPOSE_set(st, i, val) \ + SKM_sk_set(X509_PURPOSE, (st), (i), (val)) +#define sk_X509_PURPOSE_zero(st) SKM_sk_zero(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_push(st, val) SKM_sk_push(X509_PURPOSE, (st), (val)) +#define sk_X509_PURPOSE_unshift(st, val) \ + SKM_sk_unshift(X509_PURPOSE, (st), (val)) +#define sk_X509_PURPOSE_find(st, val) SKM_sk_find(X509_PURPOSE, (st), (val)) +#define sk_X509_PURPOSE_find_ex(st, val) \ + SKM_sk_find_ex(X509_PURPOSE, (st), (val)) +#define sk_X509_PURPOSE_delete(st, i) SKM_sk_delete(X509_PURPOSE, (st), (i)) +#define sk_X509_PURPOSE_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(X509_PURPOSE, (st), (ptr)) +#define sk_X509_PURPOSE_insert(st, val, i) \ + SKM_sk_insert(X509_PURPOSE, (st), (val), (i)) +#define sk_X509_PURPOSE_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(X509_PURPOSE, (st), (cmp)) +#define sk_X509_PURPOSE_dup(st) SKM_sk_dup(X509_PURPOSE, st) +#define sk_X509_PURPOSE_pop_free(st, free_func) \ + SKM_sk_pop_free(X509_PURPOSE, (st), (free_func)) +#define sk_X509_PURPOSE_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(X509_PURPOSE, (st), (copy_func), (free_func)) +#define sk_X509_PURPOSE_shift(st) SKM_sk_shift(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_pop(st) SKM_sk_pop(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_sort(st) SKM_sk_sort(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_is_sorted(st) SKM_sk_is_sorted(X509_PURPOSE, (st)) +#define sk_X509_REVOKED_new(cmp) SKM_sk_new(X509_REVOKED, (cmp)) +#define sk_X509_REVOKED_new_null() SKM_sk_new_null(X509_REVOKED) +#define sk_X509_REVOKED_free(st) SKM_sk_free(X509_REVOKED, (st)) +#define sk_X509_REVOKED_num(st) SKM_sk_num(X509_REVOKED, (st)) +#define sk_X509_REVOKED_value(st, i) SKM_sk_value(X509_REVOKED, (st), (i)) +#define sk_X509_REVOKED_set(st, i, val) \ + SKM_sk_set(X509_REVOKED, (st), (i), (val)) +#define sk_X509_REVOKED_zero(st) SKM_sk_zero(X509_REVOKED, (st)) +#define sk_X509_REVOKED_push(st, val) SKM_sk_push(X509_REVOKED, (st), (val)) +#define sk_X509_REVOKED_unshift(st, val) \ + SKM_sk_unshift(X509_REVOKED, (st), (val)) +#define sk_X509_REVOKED_find(st, val) SKM_sk_find(X509_REVOKED, (st), (val)) +#define sk_X509_REVOKED_find_ex(st, val) \ + SKM_sk_find_ex(X509_REVOKED, (st), (val)) +#define sk_X509_REVOKED_delete(st, i) SKM_sk_delete(X509_REVOKED, (st), (i)) +#define sk_X509_REVOKED_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(X509_REVOKED, (st), (ptr)) +#define sk_X509_REVOKED_insert(st, val, i) \ + SKM_sk_insert(X509_REVOKED, (st), (val), (i)) +#define sk_X509_REVOKED_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(X509_REVOKED, (st), (cmp)) +#define sk_X509_REVOKED_dup(st) SKM_sk_dup(X509_REVOKED, st) +#define sk_X509_REVOKED_pop_free(st, free_func) \ + SKM_sk_pop_free(X509_REVOKED, (st), (free_func)) +#define sk_X509_REVOKED_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(X509_REVOKED, (st), (copy_func), (free_func)) +#define sk_X509_REVOKED_shift(st) SKM_sk_shift(X509_REVOKED, (st)) +#define sk_X509_REVOKED_pop(st) SKM_sk_pop(X509_REVOKED, (st)) +#define sk_X509_REVOKED_sort(st) SKM_sk_sort(X509_REVOKED, (st)) +#define sk_X509_REVOKED_is_sorted(st) SKM_sk_is_sorted(X509_REVOKED, (st)) +#define sk_X509_TRUST_new(cmp) SKM_sk_new(X509_TRUST, (cmp)) +#define sk_X509_TRUST_new_null() SKM_sk_new_null(X509_TRUST) +#define sk_X509_TRUST_free(st) SKM_sk_free(X509_TRUST, (st)) +#define sk_X509_TRUST_num(st) SKM_sk_num(X509_TRUST, (st)) +#define sk_X509_TRUST_value(st, i) SKM_sk_value(X509_TRUST, (st), (i)) +#define sk_X509_TRUST_set(st, i, val) SKM_sk_set(X509_TRUST, (st), (i), (val)) +#define sk_X509_TRUST_zero(st) SKM_sk_zero(X509_TRUST, (st)) +#define sk_X509_TRUST_push(st, val) SKM_sk_push(X509_TRUST, (st), (val)) +#define sk_X509_TRUST_unshift(st, val) SKM_sk_unshift(X509_TRUST, (st), (val)) +#define sk_X509_TRUST_find(st, val) SKM_sk_find(X509_TRUST, (st), (val)) +#define sk_X509_TRUST_find_ex(st, val) SKM_sk_find_ex(X509_TRUST, (st), (val)) +#define sk_X509_TRUST_delete(st, i) SKM_sk_delete(X509_TRUST, (st), (i)) +#define sk_X509_TRUST_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(X509_TRUST, (st), (ptr)) +#define sk_X509_TRUST_insert(st, val, i) \ + SKM_sk_insert(X509_TRUST, (st), (val), (i)) +#define sk_X509_TRUST_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(X509_TRUST, (st), (cmp)) +#define sk_X509_TRUST_dup(st) SKM_sk_dup(X509_TRUST, st) +#define sk_X509_TRUST_pop_free(st, free_func) \ + SKM_sk_pop_free(X509_TRUST, (st), (free_func)) +#define sk_X509_TRUST_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(X509_TRUST, (st), (copy_func), (free_func)) +#define sk_X509_TRUST_shift(st) SKM_sk_shift(X509_TRUST, (st)) +#define sk_X509_TRUST_pop(st) SKM_sk_pop(X509_TRUST, (st)) +#define sk_X509_TRUST_sort(st) SKM_sk_sort(X509_TRUST, (st)) +#define sk_X509_TRUST_is_sorted(st) SKM_sk_is_sorted(X509_TRUST, (st)) +#define sk_X509_VERIFY_PARAM_new(cmp) SKM_sk_new(X509_VERIFY_PARAM, (cmp)) +#define sk_X509_VERIFY_PARAM_new_null() SKM_sk_new_null(X509_VERIFY_PARAM) +#define sk_X509_VERIFY_PARAM_free(st) SKM_sk_free(X509_VERIFY_PARAM, (st)) +#define sk_X509_VERIFY_PARAM_num(st) SKM_sk_num(X509_VERIFY_PARAM, (st)) +#define sk_X509_VERIFY_PARAM_value(st, i) \ + SKM_sk_value(X509_VERIFY_PARAM, (st), (i)) +#define sk_X509_VERIFY_PARAM_set(st, i, val) \ + SKM_sk_set(X509_VERIFY_PARAM, (st), (i), (val)) +#define sk_X509_VERIFY_PARAM_zero(st) SKM_sk_zero(X509_VERIFY_PARAM, (st)) +#define sk_X509_VERIFY_PARAM_push(st, val) \ + SKM_sk_push(X509_VERIFY_PARAM, (st), (val)) +#define sk_X509_VERIFY_PARAM_unshift(st, val) \ + SKM_sk_unshift(X509_VERIFY_PARAM, (st), (val)) +#define sk_X509_VERIFY_PARAM_find(st, val) \ + SKM_sk_find(X509_VERIFY_PARAM, (st), (val)) +#define sk_X509_VERIFY_PARAM_find_ex(st, val) \ + SKM_sk_find_ex(X509_VERIFY_PARAM, (st), (val)) +#define sk_X509_VERIFY_PARAM_delete(st, i) \ + SKM_sk_delete(X509_VERIFY_PARAM, (st), (i)) +#define sk_X509_VERIFY_PARAM_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(X509_VERIFY_PARAM, (st), (ptr)) +#define sk_X509_VERIFY_PARAM_insert(st, val, i) \ + SKM_sk_insert(X509_VERIFY_PARAM, (st), (val), (i)) +#define sk_X509_VERIFY_PARAM_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(X509_VERIFY_PARAM, (st), (cmp)) +#define sk_X509_VERIFY_PARAM_dup(st) SKM_sk_dup(X509_VERIFY_PARAM, st) +#define sk_X509_VERIFY_PARAM_pop_free(st, free_func) \ + SKM_sk_pop_free(X509_VERIFY_PARAM, (st), (free_func)) +#define sk_X509_VERIFY_PARAM_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(X509_VERIFY_PARAM, (st), (copy_func), (free_func)) +#define sk_X509_VERIFY_PARAM_shift(st) SKM_sk_shift(X509_VERIFY_PARAM, (st)) +#define sk_X509_VERIFY_PARAM_pop(st) SKM_sk_pop(X509_VERIFY_PARAM, (st)) +#define sk_X509_VERIFY_PARAM_sort(st) SKM_sk_sort(X509_VERIFY_PARAM, (st)) +#define sk_X509_VERIFY_PARAM_is_sorted(st) \ + SKM_sk_is_sorted(X509_VERIFY_PARAM, (st)) +#define sk_nid_triple_new(cmp) SKM_sk_new(nid_triple, (cmp)) +#define sk_nid_triple_new_null() SKM_sk_new_null(nid_triple) +#define sk_nid_triple_free(st) SKM_sk_free(nid_triple, (st)) +#define sk_nid_triple_num(st) SKM_sk_num(nid_triple, (st)) +#define sk_nid_triple_value(st, i) SKM_sk_value(nid_triple, (st), (i)) +#define sk_nid_triple_set(st, i, val) SKM_sk_set(nid_triple, (st), (i), (val)) +#define sk_nid_triple_zero(st) SKM_sk_zero(nid_triple, (st)) +#define sk_nid_triple_push(st, val) SKM_sk_push(nid_triple, (st), (val)) +#define sk_nid_triple_unshift(st, val) SKM_sk_unshift(nid_triple, (st), (val)) +#define sk_nid_triple_find(st, val) SKM_sk_find(nid_triple, (st), (val)) +#define sk_nid_triple_find_ex(st, val) SKM_sk_find_ex(nid_triple, (st), (val)) +#define sk_nid_triple_delete(st, i) SKM_sk_delete(nid_triple, (st), (i)) +#define sk_nid_triple_delete_ptr(st, ptr) \ + SKM_sk_delete_ptr(nid_triple, (st), (ptr)) +#define sk_nid_triple_insert(st, val, i) \ + SKM_sk_insert(nid_triple, (st), (val), (i)) +#define sk_nid_triple_set_cmp_func(st, cmp) \ + SKM_sk_set_cmp_func(nid_triple, (st), (cmp)) +#define sk_nid_triple_dup(st) SKM_sk_dup(nid_triple, st) +#define sk_nid_triple_pop_free(st, free_func) \ + SKM_sk_pop_free(nid_triple, (st), (free_func)) +#define sk_nid_triple_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(nid_triple, (st), (copy_func), (free_func)) +#define sk_nid_triple_shift(st) SKM_sk_shift(nid_triple, (st)) +#define sk_nid_triple_pop(st) SKM_sk_pop(nid_triple, (st)) +#define sk_nid_triple_sort(st) SKM_sk_sort(nid_triple, (st)) +#define sk_nid_triple_is_sorted(st) SKM_sk_is_sorted(nid_triple, (st)) +#define sk_void_new(cmp) SKM_sk_new(void, (cmp)) +#define sk_void_new_null() SKM_sk_new_null(void) +#define sk_void_free(st) SKM_sk_free(void, (st)) +#define sk_void_num(st) SKM_sk_num(void, (st)) +#define sk_void_value(st, i) SKM_sk_value(void, (st), (i)) +#define sk_void_set(st, i, val) SKM_sk_set(void, (st), (i), (val)) +#define sk_void_zero(st) SKM_sk_zero(void, (st)) +#define sk_void_push(st, val) SKM_sk_push(void, (st), (val)) +#define sk_void_unshift(st, val) SKM_sk_unshift(void, (st), (val)) +#define sk_void_find(st, val) SKM_sk_find(void, (st), (val)) +#define sk_void_find_ex(st, val) SKM_sk_find_ex(void, (st), (val)) +#define sk_void_delete(st, i) SKM_sk_delete(void, (st), (i)) +#define sk_void_delete_ptr(st, ptr) SKM_sk_delete_ptr(void, (st), (ptr)) +#define sk_void_insert(st, val, i) SKM_sk_insert(void, (st), (val), (i)) +#define sk_void_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(void, (st), (cmp)) +#define sk_void_dup(st) SKM_sk_dup(void, st) +#define sk_void_pop_free(st, free_func) SKM_sk_pop_free(void, (st), (free_func)) +#define sk_void_deep_copy(st, copy_func, free_func) \ + SKM_sk_deep_copy(void, (st), (copy_func), (free_func)) +#define sk_void_shift(st) SKM_sk_shift(void, (st)) +#define sk_void_pop(st) SKM_sk_pop(void, (st)) +#define sk_void_sort(st) SKM_sk_sort(void, (st)) +#define sk_void_is_sorted(st) SKM_sk_is_sorted(void, (st)) +#define sk_OPENSSL_STRING_new(cmp) \ + ((STACK_OF(OPENSSL_STRING)*)sk_new(CHECKED_SK_CMP_FUNC(char, cmp))) +#define sk_OPENSSL_STRING_new_null() ((STACK_OF(OPENSSL_STRING)*)sk_new_null()) +#define sk_OPENSSL_STRING_push(st, val) \ + sk_push(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, val)) +#define sk_OPENSSL_STRING_find(st, val) \ + sk_find(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, val)) +#define sk_OPENSSL_STRING_value(st, i) \ + ((OPENSSL_STRING)sk_value(CHECKED_STACK_OF(OPENSSL_STRING, st), i)) +#define sk_OPENSSL_STRING_num(st) SKM_sk_num(OPENSSL_STRING, st) +#define sk_OPENSSL_STRING_pop_free(st, free_func) \ + sk_pop_free( \ + CHECKED_STACK_OF(OPENSSL_STRING, st), \ + CHECKED_SK_FREE_FUNC(char, free_func)) +#define sk_OPENSSL_STRING_deep_copy(st, copy_func, free_func) \ + ((STACK_OF(OPENSSL_STRING)*)sk_deep_copy( \ + CHECKED_STACK_OF(OPENSSL_STRING, st), \ + CHECKED_SK_COPY_FUNC(char, copy_func), \ + CHECKED_SK_FREE_FUNC(char, free_func))) +#define sk_OPENSSL_STRING_insert(st, val, i) \ + sk_insert(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, val), i) +#define sk_OPENSSL_STRING_free(st) SKM_sk_free(OPENSSL_STRING, st) +#define sk_OPENSSL_STRING_set(st, i, val) \ + sk_set(CHECKED_STACK_OF(OPENSSL_STRING, st), i, CHECKED_PTR_OF(char, val)) +#define sk_OPENSSL_STRING_zero(st) SKM_sk_zero(OPENSSL_STRING, (st)) +#define sk_OPENSSL_STRING_unshift(st, val) \ + sk_unshift(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, val)) +#define sk_OPENSSL_STRING_find_ex(st, val) \ + sk_find_ex( \ + (_STACK*)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_STRING), st), \ + CHECKED_CONST_PTR_OF(char, val)) +#define sk_OPENSSL_STRING_delete(st, i) SKM_sk_delete(OPENSSL_STRING, (st), (i)) +#define sk_OPENSSL_STRING_delete_ptr(st, ptr) \ + (OPENSSL_STRING*)sk_delete_ptr( \ + CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, ptr)) +#define sk_OPENSSL_STRING_set_cmp_func(st, cmp) \ + ((int (*)(const char* const*, const char* const*))sk_set_cmp_func( \ + CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_SK_CMP_FUNC(char, cmp))) +#define sk_OPENSSL_STRING_dup(st) SKM_sk_dup(OPENSSL_STRING, st) +#define sk_OPENSSL_STRING_shift(st) SKM_sk_shift(OPENSSL_STRING, (st)) +#define sk_OPENSSL_STRING_pop(st) \ + (char*)sk_pop(CHECKED_STACK_OF(OPENSSL_STRING, st)) +#define sk_OPENSSL_STRING_sort(st) SKM_sk_sort(OPENSSL_STRING, (st)) +#define sk_OPENSSL_STRING_is_sorted(st) SKM_sk_is_sorted(OPENSSL_STRING, (st)) +#define sk_OPENSSL_BLOCK_new(cmp) \ + ((STACK_OF(OPENSSL_BLOCK)*)sk_new(CHECKED_SK_CMP_FUNC(void, cmp))) +#define sk_OPENSSL_BLOCK_new_null() ((STACK_OF(OPENSSL_BLOCK)*)sk_new_null()) +#define sk_OPENSSL_BLOCK_push(st, val) \ + sk_push(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val)) +#define sk_OPENSSL_BLOCK_find(st, val) \ + sk_find(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val)) +#define sk_OPENSSL_BLOCK_value(st, i) \ + ((OPENSSL_BLOCK)sk_value(CHECKED_STACK_OF(OPENSSL_BLOCK, st), i)) +#define sk_OPENSSL_BLOCK_num(st) SKM_sk_num(OPENSSL_BLOCK, st) +#define sk_OPENSSL_BLOCK_pop_free(st, free_func) \ + sk_pop_free( \ + CHECKED_STACK_OF(OPENSSL_BLOCK, st), \ + CHECKED_SK_FREE_FUNC(void, free_func)) +#define sk_OPENSSL_BLOCK_deep_copy(st, copy_func, free_func) \ + ((STACK_OF(OPENSSL_BLOCK)*)sk_deep_copy( \ + CHECKED_STACK_OF(OPENSSL_BLOCK, st), \ + CHECKED_SK_COPY_FUNC(void, copy_func), \ + CHECKED_SK_FREE_FUNC(void, free_func))) +#define sk_OPENSSL_BLOCK_insert(st, val, i) \ + sk_insert(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val), i) +#define sk_OPENSSL_BLOCK_free(st) SKM_sk_free(OPENSSL_BLOCK, st) +#define sk_OPENSSL_BLOCK_set(st, i, val) \ + sk_set(CHECKED_STACK_OF(OPENSSL_BLOCK, st), i, CHECKED_PTR_OF(void, val)) +#define sk_OPENSSL_BLOCK_zero(st) SKM_sk_zero(OPENSSL_BLOCK, (st)) +#define sk_OPENSSL_BLOCK_unshift(st, val) \ + sk_unshift(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val)) +#define sk_OPENSSL_BLOCK_find_ex(st, val) \ + sk_find_ex( \ + (_STACK*)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), \ + CHECKED_CONST_PTR_OF(void, val)) +#define sk_OPENSSL_BLOCK_delete(st, i) SKM_sk_delete(OPENSSL_BLOCK, (st), (i)) +#define sk_OPENSSL_BLOCK_delete_ptr(st, ptr) \ + (OPENSSL_BLOCK*)sk_delete_ptr( \ + CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, ptr)) +#define sk_OPENSSL_BLOCK_set_cmp_func(st, cmp) \ + ((int (*)(const void* const*, const void* const*))sk_set_cmp_func( \ + CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_SK_CMP_FUNC(void, cmp))) +#define sk_OPENSSL_BLOCK_dup(st) SKM_sk_dup(OPENSSL_BLOCK, st) +#define sk_OPENSSL_BLOCK_shift(st) SKM_sk_shift(OPENSSL_BLOCK, (st)) +#define sk_OPENSSL_BLOCK_pop(st) \ + (void*)sk_pop(CHECKED_STACK_OF(OPENSSL_BLOCK, st)) +#define sk_OPENSSL_BLOCK_sort(st) SKM_sk_sort(OPENSSL_BLOCK, (st)) +#define sk_OPENSSL_BLOCK_is_sorted(st) SKM_sk_is_sorted(OPENSSL_BLOCK, (st)) +#define sk_OPENSSL_PSTRING_new(cmp) \ + ((STACK_OF(OPENSSL_PSTRING)*)sk_new(CHECKED_SK_CMP_FUNC(OPENSSL_STRING, cmp))) +#define sk_OPENSSL_PSTRING_new_null() \ + ((STACK_OF(OPENSSL_PSTRING)*)sk_new_null()) +#define sk_OPENSSL_PSTRING_push(st, val) \ + sk_push( \ + CHECKED_STACK_OF(OPENSSL_PSTRING, st), \ + CHECKED_PTR_OF(OPENSSL_STRING, val)) +#define sk_OPENSSL_PSTRING_find(st, val) \ + sk_find( \ + CHECKED_STACK_OF(OPENSSL_PSTRING, st), \ + CHECKED_PTR_OF(OPENSSL_STRING, val)) +#define sk_OPENSSL_PSTRING_value(st, i) \ + ((OPENSSL_PSTRING)sk_value(CHECKED_STACK_OF(OPENSSL_PSTRING, st), i)) +#define sk_OPENSSL_PSTRING_num(st) SKM_sk_num(OPENSSL_PSTRING, st) +#define sk_OPENSSL_PSTRING_pop_free(st, free_func) \ + sk_pop_free( \ + CHECKED_STACK_OF(OPENSSL_PSTRING, st), \ + CHECKED_SK_FREE_FUNC(OPENSSL_STRING, free_func)) +#define sk_OPENSSL_PSTRING_deep_copy(st, copy_func, free_func) \ + ((STACK_OF(OPENSSL_PSTRING)*)sk_deep_copy( \ + CHECKED_STACK_OF(OPENSSL_PSTRING, st), \ + CHECKED_SK_COPY_FUNC(OPENSSL_STRING, copy_func), \ + CHECKED_SK_FREE_FUNC(OPENSSL_STRING, free_func))) +#define sk_OPENSSL_PSTRING_insert(st, val, i) \ + sk_insert( \ + CHECKED_STACK_OF(OPENSSL_PSTRING, st), \ + CHECKED_PTR_OF(OPENSSL_STRING, val), \ + i) +#define sk_OPENSSL_PSTRING_free(st) SKM_sk_free(OPENSSL_PSTRING, st) +#define sk_OPENSSL_PSTRING_set(st, i, val) \ + sk_set( \ + CHECKED_STACK_OF(OPENSSL_PSTRING, st), \ + i, \ + CHECKED_PTR_OF(OPENSSL_STRING, val)) +#define sk_OPENSSL_PSTRING_zero(st) SKM_sk_zero(OPENSSL_PSTRING, (st)) +#define sk_OPENSSL_PSTRING_unshift(st, val) \ + sk_unshift( \ + CHECKED_STACK_OF(OPENSSL_PSTRING, st), \ + CHECKED_PTR_OF(OPENSSL_STRING, val)) +#define sk_OPENSSL_PSTRING_find_ex(st, val) \ + sk_find_ex( \ + (_STACK*)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), \ + CHECKED_CONST_PTR_OF(OPENSSL_STRING, val)) +#define sk_OPENSSL_PSTRING_delete(st, i) \ + SKM_sk_delete(OPENSSL_PSTRING, (st), (i)) +#define sk_OPENSSL_PSTRING_delete_ptr(st, ptr) \ + (OPENSSL_PSTRING*)sk_delete_ptr( \ + CHECKED_STACK_OF(OPENSSL_PSTRING, st), \ + CHECKED_PTR_OF(OPENSSL_STRING, ptr)) +#define sk_OPENSSL_PSTRING_set_cmp_func(st, cmp) \ + ((int (*)(const OPENSSL_STRING* const*, const OPENSSL_STRING* const*)) \ + sk_set_cmp_func( \ + CHECKED_STACK_OF(OPENSSL_PSTRING, st), \ + CHECKED_SK_CMP_FUNC(OPENSSL_STRING, cmp))) +#define sk_OPENSSL_PSTRING_dup(st) SKM_sk_dup(OPENSSL_PSTRING, st) +#define sk_OPENSSL_PSTRING_shift(st) SKM_sk_shift(OPENSSL_PSTRING, (st)) +#define sk_OPENSSL_PSTRING_pop(st) \ + (OPENSSL_STRING*)sk_pop(CHECKED_STACK_OF(OPENSSL_PSTRING, st)) +#define sk_OPENSSL_PSTRING_sort(st) SKM_sk_sort(OPENSSL_PSTRING, (st)) +#define sk_OPENSSL_PSTRING_is_sorted(st) SKM_sk_is_sorted(OPENSSL_PSTRING, (st)) +#define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + ACCESS_DESCRIPTION, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION( \ + st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + ACCESS_DESCRIPTION, \ + (st), \ + (pp), \ + (i2d_func), \ + (ex_tag), \ + (ex_class), \ + (is_set)) +#define ASN1_seq_pack_ACCESS_DESCRIPTION(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(ACCESS_DESCRIPTION, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_ACCESS_DESCRIPTION(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(ACCESS_DESCRIPTION, (buf), (len), (d2i_func), (free_func)) +#define d2i_ASN1_SET_OF_ASN1_INTEGER( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + ASN1_INTEGER, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_ASN1_INTEGER( \ + st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + ASN1_INTEGER, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_ASN1_INTEGER(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(ASN1_INTEGER, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_ASN1_INTEGER(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(ASN1_INTEGER, (buf), (len), (d2i_func), (free_func)) +#define d2i_ASN1_SET_OF_ASN1_OBJECT( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + ASN1_OBJECT, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_ASN1_OBJECT( \ + st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + ASN1_OBJECT, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_ASN1_OBJECT(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(ASN1_OBJECT, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_ASN1_OBJECT(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(ASN1_OBJECT, (buf), (len), (d2i_func), (free_func)) +#define d2i_ASN1_SET_OF_ASN1_TYPE( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + ASN1_TYPE, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_ASN1_TYPE(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + ASN1_TYPE, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_ASN1_TYPE(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(ASN1_TYPE, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_ASN1_TYPE(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(ASN1_TYPE, (buf), (len), (d2i_func), (free_func)) +#define d2i_ASN1_SET_OF_ASN1_UTF8STRING( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + ASN1_UTF8STRING, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_ASN1_UTF8STRING( \ + st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + ASN1_UTF8STRING, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_ASN1_UTF8STRING(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(ASN1_UTF8STRING, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_ASN1_UTF8STRING(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(ASN1_UTF8STRING, (buf), (len), (d2i_func), (free_func)) +#define d2i_ASN1_SET_OF_DIST_POINT( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + DIST_POINT, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_DIST_POINT(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + DIST_POINT, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_DIST_POINT(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(DIST_POINT, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_DIST_POINT(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(DIST_POINT, (buf), (len), (d2i_func), (free_func)) +#define d2i_ASN1_SET_OF_ESS_CERT_ID( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + ESS_CERT_ID, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_ESS_CERT_ID( \ + st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + ESS_CERT_ID, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_ESS_CERT_ID(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(ESS_CERT_ID, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_ESS_CERT_ID(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(ESS_CERT_ID, (buf), (len), (d2i_func), (free_func)) +#define d2i_ASN1_SET_OF_EVP_MD( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + EVP_MD, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_EVP_MD(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + EVP_MD, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_EVP_MD(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(EVP_MD, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_EVP_MD(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(EVP_MD, (buf), (len), (d2i_func), (free_func)) +#define d2i_ASN1_SET_OF_GENERAL_NAME( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + GENERAL_NAME, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_GENERAL_NAME( \ + st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + GENERAL_NAME, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_GENERAL_NAME(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(GENERAL_NAME, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_GENERAL_NAME(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(GENERAL_NAME, (buf), (len), (d2i_func), (free_func)) +#define d2i_ASN1_SET_OF_OCSP_ONEREQ( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + OCSP_ONEREQ, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_OCSP_ONEREQ( \ + st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + OCSP_ONEREQ, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_OCSP_ONEREQ(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(OCSP_ONEREQ, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_OCSP_ONEREQ(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(OCSP_ONEREQ, (buf), (len), (d2i_func), (free_func)) +#define d2i_ASN1_SET_OF_OCSP_SINGLERESP( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + OCSP_SINGLERESP, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_OCSP_SINGLERESP( \ + st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + OCSP_SINGLERESP, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_OCSP_SINGLERESP(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(OCSP_SINGLERESP, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_OCSP_SINGLERESP(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(OCSP_SINGLERESP, (buf), (len), (d2i_func), (free_func)) +#define d2i_ASN1_SET_OF_PKCS12_SAFEBAG( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + PKCS12_SAFEBAG, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_PKCS12_SAFEBAG( \ + st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + PKCS12_SAFEBAG, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_PKCS12_SAFEBAG(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(PKCS12_SAFEBAG, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_PKCS12_SAFEBAG(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(PKCS12_SAFEBAG, (buf), (len), (d2i_func), (free_func)) +#define d2i_ASN1_SET_OF_PKCS7( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + PKCS7, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_PKCS7(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + PKCS7, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_PKCS7(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(PKCS7, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_PKCS7(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(PKCS7, (buf), (len), (d2i_func), (free_func)) +#define d2i_ASN1_SET_OF_PKCS7_RECIP_INFO( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + PKCS7_RECIP_INFO, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_PKCS7_RECIP_INFO( \ + st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + PKCS7_RECIP_INFO, \ + (st), \ + (pp), \ + (i2d_func), \ + (ex_tag), \ + (ex_class), \ + (is_set)) +#define ASN1_seq_pack_PKCS7_RECIP_INFO(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(PKCS7_RECIP_INFO, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_PKCS7_RECIP_INFO(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(PKCS7_RECIP_INFO, (buf), (len), (d2i_func), (free_func)) +#define d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + PKCS7_SIGNER_INFO, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO( \ + st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + PKCS7_SIGNER_INFO, \ + (st), \ + (pp), \ + (i2d_func), \ + (ex_tag), \ + (ex_class), \ + (is_set)) +#define ASN1_seq_pack_PKCS7_SIGNER_INFO(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(PKCS7_SIGNER_INFO, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_PKCS7_SIGNER_INFO(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(PKCS7_SIGNER_INFO, (buf), (len), (d2i_func), (free_func)) +#define d2i_ASN1_SET_OF_POLICYINFO( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + POLICYINFO, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_POLICYINFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + POLICYINFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_POLICYINFO(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(POLICYINFO, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_POLICYINFO(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(POLICYINFO, (buf), (len), (d2i_func), (free_func)) +#define d2i_ASN1_SET_OF_POLICYQUALINFO( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + POLICYQUALINFO, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_POLICYQUALINFO( \ + st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + POLICYQUALINFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_POLICYQUALINFO(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(POLICYQUALINFO, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_POLICYQUALINFO(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(POLICYQUALINFO, (buf), (len), (d2i_func), (free_func)) +#define d2i_ASN1_SET_OF_SXNETID( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + SXNETID, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_SXNETID(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + SXNETID, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_SXNETID(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(SXNETID, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_SXNETID(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(SXNETID, (buf), (len), (d2i_func), (free_func)) +#define d2i_ASN1_SET_OF_X509( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + X509, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_X509(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + X509, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_X509(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(X509, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_X509(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(X509, (buf), (len), (d2i_func), (free_func)) +#define d2i_ASN1_SET_OF_X509_ALGOR( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + X509_ALGOR, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_X509_ALGOR(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + X509_ALGOR, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_X509_ALGOR(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(X509_ALGOR, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_X509_ALGOR(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(X509_ALGOR, (buf), (len), (d2i_func), (free_func)) +#define d2i_ASN1_SET_OF_X509_ATTRIBUTE( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + X509_ATTRIBUTE, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_X509_ATTRIBUTE( \ + st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + X509_ATTRIBUTE, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_X509_ATTRIBUTE(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(X509_ATTRIBUTE, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_X509_ATTRIBUTE(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(X509_ATTRIBUTE, (buf), (len), (d2i_func), (free_func)) +#define d2i_ASN1_SET_OF_X509_CRL( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + X509_CRL, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_X509_CRL(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + X509_CRL, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_X509_CRL(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(X509_CRL, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_X509_CRL(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(X509_CRL, (buf), (len), (d2i_func), (free_func)) +#define d2i_ASN1_SET_OF_X509_EXTENSION( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + X509_EXTENSION, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_X509_EXTENSION( \ + st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + X509_EXTENSION, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_X509_EXTENSION(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(X509_EXTENSION, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_X509_EXTENSION(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(X509_EXTENSION, (buf), (len), (d2i_func), (free_func)) +#define d2i_ASN1_SET_OF_X509_NAME_ENTRY( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + X509_NAME_ENTRY, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_X509_NAME_ENTRY( \ + st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + X509_NAME_ENTRY, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_X509_NAME_ENTRY(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(X509_NAME_ENTRY, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_X509_NAME_ENTRY(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(X509_NAME_ENTRY, (buf), (len), (d2i_func), (free_func)) +#define d2i_ASN1_SET_OF_X509_REVOKED( \ + st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i( \ + X509_REVOKED, \ + (st), \ + (pp), \ + (length), \ + (d2i_func), \ + (free_func), \ + (ex_tag), \ + (ex_class)) +#define i2d_ASN1_SET_OF_X509_REVOKED( \ + st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d( \ + X509_REVOKED, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_X509_REVOKED(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(X509_REVOKED, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_X509_REVOKED(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(X509_REVOKED, (buf), (len), (d2i_func), (free_func)) +#define PKCS12_decrypt_d2i_PKCS12_SAFEBAG( \ + algor, d2i_func, free_func, pass, passlen, oct, seq) \ + SKM_PKCS12_decrypt_d2i( \ + PKCS12_SAFEBAG, \ + (algor), \ + (d2i_func), \ + (free_func), \ + (pass), \ + (passlen), \ + (oct), \ + (seq)) +#define PKCS12_decrypt_d2i_PKCS7( \ + algor, d2i_func, free_func, pass, passlen, oct, seq) \ + SKM_PKCS12_decrypt_d2i( \ + PKCS7, \ + (algor), \ + (d2i_func), \ + (free_func), \ + (pass), \ + (passlen), \ + (oct), \ + (seq)) +#define lh_ADDED_OBJ_new() LHM_lh_new(ADDED_OBJ, added_obj) +#define lh_ADDED_OBJ_insert(lh, inst) LHM_lh_insert(ADDED_OBJ, lh, inst) +#define lh_ADDED_OBJ_retrieve(lh, inst) LHM_lh_retrieve(ADDED_OBJ, lh, inst) +#define lh_ADDED_OBJ_delete(lh, inst) LHM_lh_delete(ADDED_OBJ, lh, inst) +#define lh_ADDED_OBJ_doall(lh, fn) LHM_lh_doall(ADDED_OBJ, lh, fn) +#define lh_ADDED_OBJ_doall_arg(lh, fn, arg_type, arg) \ + LHM_lh_doall_arg(ADDED_OBJ, lh, fn, arg_type, arg) +#define lh_ADDED_OBJ_error(lh) LHM_lh_error(ADDED_OBJ, lh) +#define lh_ADDED_OBJ_num_items(lh) LHM_lh_num_items(ADDED_OBJ, lh) +#define lh_ADDED_OBJ_down_load(lh) LHM_lh_down_load(ADDED_OBJ, lh) +#define lh_ADDED_OBJ_node_stats_bio(lh, out) \ + LHM_lh_node_stats_bio(ADDED_OBJ, lh, out) +#define lh_ADDED_OBJ_node_usage_stats_bio(lh, out) \ + LHM_lh_node_usage_stats_bio(ADDED_OBJ, lh, out) +#define lh_ADDED_OBJ_stats_bio(lh, out) LHM_lh_stats_bio(ADDED_OBJ, lh, out) +#define lh_ADDED_OBJ_free(lh) LHM_lh_free(ADDED_OBJ, lh) +#define lh_APP_INFO_new() LHM_lh_new(APP_INFO, app_info) +#define lh_APP_INFO_insert(lh, inst) LHM_lh_insert(APP_INFO, lh, inst) +#define lh_APP_INFO_retrieve(lh, inst) LHM_lh_retrieve(APP_INFO, lh, inst) +#define lh_APP_INFO_delete(lh, inst) LHM_lh_delete(APP_INFO, lh, inst) +#define lh_APP_INFO_doall(lh, fn) LHM_lh_doall(APP_INFO, lh, fn) +#define lh_APP_INFO_doall_arg(lh, fn, arg_type, arg) \ + LHM_lh_doall_arg(APP_INFO, lh, fn, arg_type, arg) +#define lh_APP_INFO_error(lh) LHM_lh_error(APP_INFO, lh) +#define lh_APP_INFO_num_items(lh) LHM_lh_num_items(APP_INFO, lh) +#define lh_APP_INFO_down_load(lh) LHM_lh_down_load(APP_INFO, lh) +#define lh_APP_INFO_node_stats_bio(lh, out) \ + LHM_lh_node_stats_bio(APP_INFO, lh, out) +#define lh_APP_INFO_node_usage_stats_bio(lh, out) \ + LHM_lh_node_usage_stats_bio(APP_INFO, lh, out) +#define lh_APP_INFO_stats_bio(lh, out) LHM_lh_stats_bio(APP_INFO, lh, out) +#define lh_APP_INFO_free(lh) LHM_lh_free(APP_INFO, lh) +#define lh_CONF_VALUE_new() LHM_lh_new(CONF_VALUE, conf_value) +#define lh_CONF_VALUE_insert(lh, inst) LHM_lh_insert(CONF_VALUE, lh, inst) +#define lh_CONF_VALUE_retrieve(lh, inst) LHM_lh_retrieve(CONF_VALUE, lh, inst) +#define lh_CONF_VALUE_delete(lh, inst) LHM_lh_delete(CONF_VALUE, lh, inst) +#define lh_CONF_VALUE_doall(lh, fn) LHM_lh_doall(CONF_VALUE, lh, fn) +#define lh_CONF_VALUE_doall_arg(lh, fn, arg_type, arg) \ + LHM_lh_doall_arg(CONF_VALUE, lh, fn, arg_type, arg) +#define lh_CONF_VALUE_error(lh) LHM_lh_error(CONF_VALUE, lh) +#define lh_CONF_VALUE_num_items(lh) LHM_lh_num_items(CONF_VALUE, lh) +#define lh_CONF_VALUE_down_load(lh) LHM_lh_down_load(CONF_VALUE, lh) +#define lh_CONF_VALUE_node_stats_bio(lh, out) \ + LHM_lh_node_stats_bio(CONF_VALUE, lh, out) +#define lh_CONF_VALUE_node_usage_stats_bio(lh, out) \ + LHM_lh_node_usage_stats_bio(CONF_VALUE, lh, out) +#define lh_CONF_VALUE_stats_bio(lh, out) LHM_lh_stats_bio(CONF_VALUE, lh, out) +#define lh_CONF_VALUE_free(lh) LHM_lh_free(CONF_VALUE, lh) +#define lh_ENGINE_PILE_new() LHM_lh_new(ENGINE_PILE, engine_pile) +#define lh_ENGINE_PILE_insert(lh, inst) LHM_lh_insert(ENGINE_PILE, lh, inst) +#define lh_ENGINE_PILE_retrieve(lh, inst) LHM_lh_retrieve(ENGINE_PILE, lh, inst) +#define lh_ENGINE_PILE_delete(lh, inst) LHM_lh_delete(ENGINE_PILE, lh, inst) +#define lh_ENGINE_PILE_doall(lh, fn) LHM_lh_doall(ENGINE_PILE, lh, fn) +#define lh_ENGINE_PILE_doall_arg(lh, fn, arg_type, arg) \ + LHM_lh_doall_arg(ENGINE_PILE, lh, fn, arg_type, arg) +#define lh_ENGINE_PILE_error(lh) LHM_lh_error(ENGINE_PILE, lh) +#define lh_ENGINE_PILE_num_items(lh) LHM_lh_num_items(ENGINE_PILE, lh) +#define lh_ENGINE_PILE_down_load(lh) LHM_lh_down_load(ENGINE_PILE, lh) +#define lh_ENGINE_PILE_node_stats_bio(lh, out) \ + LHM_lh_node_stats_bio(ENGINE_PILE, lh, out) +#define lh_ENGINE_PILE_node_usage_stats_bio(lh, out) \ + LHM_lh_node_usage_stats_bio(ENGINE_PILE, lh, out) +#define lh_ENGINE_PILE_stats_bio(lh, out) LHM_lh_stats_bio(ENGINE_PILE, lh, out) +#define lh_ENGINE_PILE_free(lh) LHM_lh_free(ENGINE_PILE, lh) +#define lh_ERR_STATE_new() LHM_lh_new(ERR_STATE, err_state) +#define lh_ERR_STATE_insert(lh, inst) LHM_lh_insert(ERR_STATE, lh, inst) +#define lh_ERR_STATE_retrieve(lh, inst) LHM_lh_retrieve(ERR_STATE, lh, inst) +#define lh_ERR_STATE_delete(lh, inst) LHM_lh_delete(ERR_STATE, lh, inst) +#define lh_ERR_STATE_doall(lh, fn) LHM_lh_doall(ERR_STATE, lh, fn) +#define lh_ERR_STATE_doall_arg(lh, fn, arg_type, arg) \ + LHM_lh_doall_arg(ERR_STATE, lh, fn, arg_type, arg) +#define lh_ERR_STATE_error(lh) LHM_lh_error(ERR_STATE, lh) +#define lh_ERR_STATE_num_items(lh) LHM_lh_num_items(ERR_STATE, lh) +#define lh_ERR_STATE_down_load(lh) LHM_lh_down_load(ERR_STATE, lh) +#define lh_ERR_STATE_node_stats_bio(lh, out) \ + LHM_lh_node_stats_bio(ERR_STATE, lh, out) +#define lh_ERR_STATE_node_usage_stats_bio(lh, out) \ + LHM_lh_node_usage_stats_bio(ERR_STATE, lh, out) +#define lh_ERR_STATE_stats_bio(lh, out) LHM_lh_stats_bio(ERR_STATE, lh, out) +#define lh_ERR_STATE_free(lh) LHM_lh_free(ERR_STATE, lh) +#define lh_ERR_STRING_DATA_new() LHM_lh_new(ERR_STRING_DATA, err_string_data) +#define lh_ERR_STRING_DATA_insert(lh, inst) \ + LHM_lh_insert(ERR_STRING_DATA, lh, inst) +#define lh_ERR_STRING_DATA_retrieve(lh, inst) \ + LHM_lh_retrieve(ERR_STRING_DATA, lh, inst) +#define lh_ERR_STRING_DATA_delete(lh, inst) \ + LHM_lh_delete(ERR_STRING_DATA, lh, inst) +#define lh_ERR_STRING_DATA_doall(lh, fn) LHM_lh_doall(ERR_STRING_DATA, lh, fn) +#define lh_ERR_STRING_DATA_doall_arg(lh, fn, arg_type, arg) \ + LHM_lh_doall_arg(ERR_STRING_DATA, lh, fn, arg_type, arg) +#define lh_ERR_STRING_DATA_error(lh) LHM_lh_error(ERR_STRING_DATA, lh) +#define lh_ERR_STRING_DATA_num_items(lh) LHM_lh_num_items(ERR_STRING_DATA, lh) +#define lh_ERR_STRING_DATA_down_load(lh) LHM_lh_down_load(ERR_STRING_DATA, lh) +#define lh_ERR_STRING_DATA_node_stats_bio(lh, out) \ + LHM_lh_node_stats_bio(ERR_STRING_DATA, lh, out) +#define lh_ERR_STRING_DATA_node_usage_stats_bio(lh, out) \ + LHM_lh_node_usage_stats_bio(ERR_STRING_DATA, lh, out) +#define lh_ERR_STRING_DATA_stats_bio(lh, out) \ + LHM_lh_stats_bio(ERR_STRING_DATA, lh, out) +#define lh_ERR_STRING_DATA_free(lh) LHM_lh_free(ERR_STRING_DATA, lh) +#define lh_EX_CLASS_ITEM_new() LHM_lh_new(EX_CLASS_ITEM, ex_class_item) +#define lh_EX_CLASS_ITEM_insert(lh, inst) LHM_lh_insert(EX_CLASS_ITEM, lh, inst) +#define lh_EX_CLASS_ITEM_retrieve(lh, inst) \ + LHM_lh_retrieve(EX_CLASS_ITEM, lh, inst) +#define lh_EX_CLASS_ITEM_delete(lh, inst) LHM_lh_delete(EX_CLASS_ITEM, lh, inst) +#define lh_EX_CLASS_ITEM_doall(lh, fn) LHM_lh_doall(EX_CLASS_ITEM, lh, fn) +#define lh_EX_CLASS_ITEM_doall_arg(lh, fn, arg_type, arg) \ + LHM_lh_doall_arg(EX_CLASS_ITEM, lh, fn, arg_type, arg) +#define lh_EX_CLASS_ITEM_error(lh) LHM_lh_error(EX_CLASS_ITEM, lh) +#define lh_EX_CLASS_ITEM_num_items(lh) LHM_lh_num_items(EX_CLASS_ITEM, lh) +#define lh_EX_CLASS_ITEM_down_load(lh) LHM_lh_down_load(EX_CLASS_ITEM, lh) +#define lh_EX_CLASS_ITEM_node_stats_bio(lh, out) \ + LHM_lh_node_stats_bio(EX_CLASS_ITEM, lh, out) +#define lh_EX_CLASS_ITEM_node_usage_stats_bio(lh, out) \ + LHM_lh_node_usage_stats_bio(EX_CLASS_ITEM, lh, out) +#define lh_EX_CLASS_ITEM_stats_bio(lh, out) \ + LHM_lh_stats_bio(EX_CLASS_ITEM, lh, out) +#define lh_EX_CLASS_ITEM_free(lh) LHM_lh_free(EX_CLASS_ITEM, lh) +#define lh_FUNCTION_new() LHM_lh_new(FUNCTION, function) +#define lh_FUNCTION_insert(lh, inst) LHM_lh_insert(FUNCTION, lh, inst) +#define lh_FUNCTION_retrieve(lh, inst) LHM_lh_retrieve(FUNCTION, lh, inst) +#define lh_FUNCTION_delete(lh, inst) LHM_lh_delete(FUNCTION, lh, inst) +#define lh_FUNCTION_doall(lh, fn) LHM_lh_doall(FUNCTION, lh, fn) +#define lh_FUNCTION_doall_arg(lh, fn, arg_type, arg) \ + LHM_lh_doall_arg(FUNCTION, lh, fn, arg_type, arg) +#define lh_FUNCTION_error(lh) LHM_lh_error(FUNCTION, lh) +#define lh_FUNCTION_num_items(lh) LHM_lh_num_items(FUNCTION, lh) +#define lh_FUNCTION_down_load(lh) LHM_lh_down_load(FUNCTION, lh) +#define lh_FUNCTION_node_stats_bio(lh, out) \ + LHM_lh_node_stats_bio(FUNCTION, lh, out) +#define lh_FUNCTION_node_usage_stats_bio(lh, out) \ + LHM_lh_node_usage_stats_bio(FUNCTION, lh, out) +#define lh_FUNCTION_stats_bio(lh, out) LHM_lh_stats_bio(FUNCTION, lh, out) +#define lh_FUNCTION_free(lh) LHM_lh_free(FUNCTION, lh) +#define lh_MEM_new() LHM_lh_new(MEM, mem) +#define lh_MEM_insert(lh, inst) LHM_lh_insert(MEM, lh, inst) +#define lh_MEM_retrieve(lh, inst) LHM_lh_retrieve(MEM, lh, inst) +#define lh_MEM_delete(lh, inst) LHM_lh_delete(MEM, lh, inst) +#define lh_MEM_doall(lh, fn) LHM_lh_doall(MEM, lh, fn) +#define lh_MEM_doall_arg(lh, fn, arg_type, arg) \ + LHM_lh_doall_arg(MEM, lh, fn, arg_type, arg) +#define lh_MEM_error(lh) LHM_lh_error(MEM, lh) +#define lh_MEM_num_items(lh) LHM_lh_num_items(MEM, lh) +#define lh_MEM_down_load(lh) LHM_lh_down_load(MEM, lh) +#define lh_MEM_node_stats_bio(lh, out) LHM_lh_node_stats_bio(MEM, lh, out) +#define lh_MEM_node_usage_stats_bio(lh, out) \ + LHM_lh_node_usage_stats_bio(MEM, lh, out) +#define lh_MEM_stats_bio(lh, out) LHM_lh_stats_bio(MEM, lh, out) +#define lh_MEM_free(lh) LHM_lh_free(MEM, lh) +#define lh_OBJ_NAME_new() LHM_lh_new(OBJ_NAME, obj_name) +#define lh_OBJ_NAME_insert(lh, inst) LHM_lh_insert(OBJ_NAME, lh, inst) +#define lh_OBJ_NAME_retrieve(lh, inst) LHM_lh_retrieve(OBJ_NAME, lh, inst) +#define lh_OBJ_NAME_delete(lh, inst) LHM_lh_delete(OBJ_NAME, lh, inst) +#define lh_OBJ_NAME_doall(lh, fn) LHM_lh_doall(OBJ_NAME, lh, fn) +#define lh_OBJ_NAME_doall_arg(lh, fn, arg_type, arg) \ + LHM_lh_doall_arg(OBJ_NAME, lh, fn, arg_type, arg) +#define lh_OBJ_NAME_error(lh) LHM_lh_error(OBJ_NAME, lh) +#define lh_OBJ_NAME_num_items(lh) LHM_lh_num_items(OBJ_NAME, lh) +#define lh_OBJ_NAME_down_load(lh) LHM_lh_down_load(OBJ_NAME, lh) +#define lh_OBJ_NAME_node_stats_bio(lh, out) \ + LHM_lh_node_stats_bio(OBJ_NAME, lh, out) +#define lh_OBJ_NAME_node_usage_stats_bio(lh, out) \ + LHM_lh_node_usage_stats_bio(OBJ_NAME, lh, out) +#define lh_OBJ_NAME_stats_bio(lh, out) LHM_lh_stats_bio(OBJ_NAME, lh, out) +#define lh_OBJ_NAME_free(lh) LHM_lh_free(OBJ_NAME, lh) +#define lh_OPENSSL_CSTRING_new() LHM_lh_new(OPENSSL_CSTRING, openssl_cstring) +#define lh_OPENSSL_CSTRING_insert(lh, inst) \ + LHM_lh_insert(OPENSSL_CSTRING, lh, inst) +#define lh_OPENSSL_CSTRING_retrieve(lh, inst) \ + LHM_lh_retrieve(OPENSSL_CSTRING, lh, inst) +#define lh_OPENSSL_CSTRING_delete(lh, inst) \ + LHM_lh_delete(OPENSSL_CSTRING, lh, inst) +#define lh_OPENSSL_CSTRING_doall(lh, fn) LHM_lh_doall(OPENSSL_CSTRING, lh, fn) +#define lh_OPENSSL_CSTRING_doall_arg(lh, fn, arg_type, arg) \ + LHM_lh_doall_arg(OPENSSL_CSTRING, lh, fn, arg_type, arg) +#define lh_OPENSSL_CSTRING_error(lh) LHM_lh_error(OPENSSL_CSTRING, lh) +#define lh_OPENSSL_CSTRING_num_items(lh) LHM_lh_num_items(OPENSSL_CSTRING, lh) +#define lh_OPENSSL_CSTRING_down_load(lh) LHM_lh_down_load(OPENSSL_CSTRING, lh) +#define lh_OPENSSL_CSTRING_node_stats_bio(lh, out) \ + LHM_lh_node_stats_bio(OPENSSL_CSTRING, lh, out) +#define lh_OPENSSL_CSTRING_node_usage_stats_bio(lh, out) \ + LHM_lh_node_usage_stats_bio(OPENSSL_CSTRING, lh, out) +#define lh_OPENSSL_CSTRING_stats_bio(lh, out) \ + LHM_lh_stats_bio(OPENSSL_CSTRING, lh, out) +#define lh_OPENSSL_CSTRING_free(lh) LHM_lh_free(OPENSSL_CSTRING, lh) +#define lh_OPENSSL_STRING_new() LHM_lh_new(OPENSSL_STRING, openssl_string) +#define lh_OPENSSL_STRING_insert(lh, inst) \ + LHM_lh_insert(OPENSSL_STRING, lh, inst) +#define lh_OPENSSL_STRING_retrieve(lh, inst) \ + LHM_lh_retrieve(OPENSSL_STRING, lh, inst) +#define lh_OPENSSL_STRING_delete(lh, inst) \ + LHM_lh_delete(OPENSSL_STRING, lh, inst) +#define lh_OPENSSL_STRING_doall(lh, fn) LHM_lh_doall(OPENSSL_STRING, lh, fn) +#define lh_OPENSSL_STRING_doall_arg(lh, fn, arg_type, arg) \ + LHM_lh_doall_arg(OPENSSL_STRING, lh, fn, arg_type, arg) +#define lh_OPENSSL_STRING_error(lh) LHM_lh_error(OPENSSL_STRING, lh) +#define lh_OPENSSL_STRING_num_items(lh) LHM_lh_num_items(OPENSSL_STRING, lh) +#define lh_OPENSSL_STRING_down_load(lh) LHM_lh_down_load(OPENSSL_STRING, lh) +#define lh_OPENSSL_STRING_node_stats_bio(lh, out) \ + LHM_lh_node_stats_bio(OPENSSL_STRING, lh, out) +#define lh_OPENSSL_STRING_node_usage_stats_bio(lh, out) \ + LHM_lh_node_usage_stats_bio(OPENSSL_STRING, lh, out) +#define lh_OPENSSL_STRING_stats_bio(lh, out) \ + LHM_lh_stats_bio(OPENSSL_STRING, lh, out) +#define lh_OPENSSL_STRING_free(lh) LHM_lh_free(OPENSSL_STRING, lh) +#define lh_SSL_SESSION_new() LHM_lh_new(SSL_SESSION, ssl_session) +#define lh_SSL_SESSION_insert(lh, inst) LHM_lh_insert(SSL_SESSION, lh, inst) +#define lh_SSL_SESSION_retrieve(lh, inst) LHM_lh_retrieve(SSL_SESSION, lh, inst) +#define lh_SSL_SESSION_delete(lh, inst) LHM_lh_delete(SSL_SESSION, lh, inst) +#define lh_SSL_SESSION_doall(lh, fn) LHM_lh_doall(SSL_SESSION, lh, fn) +#define lh_SSL_SESSION_doall_arg(lh, fn, arg_type, arg) \ + LHM_lh_doall_arg(SSL_SESSION, lh, fn, arg_type, arg) +#define lh_SSL_SESSION_error(lh) LHM_lh_error(SSL_SESSION, lh) +#define lh_SSL_SESSION_num_items(lh) LHM_lh_num_items(SSL_SESSION, lh) +#define lh_SSL_SESSION_down_load(lh) LHM_lh_down_load(SSL_SESSION, lh) +#define lh_SSL_SESSION_node_stats_bio(lh, out) \ + LHM_lh_node_stats_bio(SSL_SESSION, lh, out) +#define lh_SSL_SESSION_node_usage_stats_bio(lh, out) \ + LHM_lh_node_usage_stats_bio(SSL_SESSION, lh, out) +#define lh_SSL_SESSION_stats_bio(lh, out) LHM_lh_stats_bio(SSL_SESSION, lh, out) +#define lh_SSL_SESSION_free(lh) LHM_lh_free(SSL_SESSION, lh) +#ifdef __cplusplus +} +#endif +#endif /* !defined HEADER_SAFESTACK_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/seed.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/seed.h new file mode 100644 index 0000000..959ad06 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/seed.h @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2007 KISA(Korea Information Security Agency). 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. Neither the name of author nor the names of its contributors may + * be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY 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 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. + * + */ +/* ==================================================================== + * Copyright (c) 1998-2007 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_SEED_H +#define HEADER_SEED_H + +#include +#include +#include + +#ifdef OPENSSL_NO_SEED +#error SEED is disabled. +#endif + +/* look whether we need 'long' to get 32 bits */ +#ifdef AES_LONG +#ifndef SEED_LONG +#define SEED_LONG 1 +#endif +#endif + +#if !defined(NO_SYS_TYPES_H) +#include +#endif + +#define SEED_BLOCK_SIZE 16 +#define SEED_KEY_LENGTH 16 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct seed_key_st { +#ifdef SEED_LONG + unsigned long data[32]; +#else + unsigned int data[32]; +#endif +} SEED_KEY_SCHEDULE; + +#ifdef OPENSSL_FIPS +void private_SEED_set_key( + const unsigned char rawkey[SEED_KEY_LENGTH], + SEED_KEY_SCHEDULE* ks); +#endif +void SEED_set_key( + const unsigned char rawkey[SEED_KEY_LENGTH], + SEED_KEY_SCHEDULE* ks); + +void SEED_encrypt( + const unsigned char s[SEED_BLOCK_SIZE], + unsigned char d[SEED_BLOCK_SIZE], + const SEED_KEY_SCHEDULE* ks); +void SEED_decrypt( + const unsigned char s[SEED_BLOCK_SIZE], + unsigned char d[SEED_BLOCK_SIZE], + const SEED_KEY_SCHEDULE* ks); + +void SEED_ecb_encrypt( + const unsigned char* in, + unsigned char* out, + const SEED_KEY_SCHEDULE* ks, + int enc); +void SEED_cbc_encrypt( + const unsigned char* in, + unsigned char* out, + size_t len, + const SEED_KEY_SCHEDULE* ks, + unsigned char ivec[SEED_BLOCK_SIZE], + int enc); +void SEED_cfb128_encrypt( + const unsigned char* in, + unsigned char* out, + size_t len, + const SEED_KEY_SCHEDULE* ks, + unsigned char ivec[SEED_BLOCK_SIZE], + int* num, + int enc); +void SEED_ofb128_encrypt( + const unsigned char* in, + unsigned char* out, + size_t len, + const SEED_KEY_SCHEDULE* ks, + unsigned char ivec[SEED_BLOCK_SIZE], + int* num); + +#ifdef __cplusplus +} +#endif + +#endif /* HEADER_SEED_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/sha.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/sha.h new file mode 100644 index 0000000..c0f367f --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/sha.h @@ -0,0 +1,217 @@ +/* crypto/sha/sha.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_SHA_H +#define HEADER_SHA_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(OPENSSL_NO_SHA) || \ + (defined(OPENSSL_NO_SHA0) && defined(OPENSSL_NO_SHA1)) +#error SHA is disabled. +#endif + +#if defined(OPENSSL_FIPS) +#define FIPS_SHA_SIZE_T size_t +#endif + +/*- + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! SHA_LONG has to be at least 32 bits wide. If it's wider, then ! + * ! SHA_LONG_LOG2 has to be defined along. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ + +#if defined(__LP32__) +#define SHA_LONG unsigned long +#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) +#define SHA_LONG unsigned long +#define SHA_LONG_LOG2 3 +#else +#define SHA_LONG unsigned int +#endif + +#define SHA_LBLOCK 16 +#define SHA_CBLOCK \ + (SHA_LBLOCK * 4) /* SHA treats input data as a \ + * contiguous array of 32 bit wide \ + * big-endian values. */ +#define SHA_LAST_BLOCK (SHA_CBLOCK - 8) +#define SHA_DIGEST_LENGTH 20 + +typedef struct SHAstate_st { + SHA_LONG h0, h1, h2, h3, h4; + SHA_LONG Nl, Nh; + SHA_LONG data[SHA_LBLOCK]; + unsigned int num; +} SHA_CTX; + +#ifndef OPENSSL_NO_SHA0 +#ifdef OPENSSL_FIPS +int private_SHA_Init(SHA_CTX* c); +#endif +int SHA_Init(SHA_CTX* c); +int SHA_Update(SHA_CTX* c, const void* data, size_t len); +int SHA_Final(unsigned char* md, SHA_CTX* c); +unsigned char* SHA(const unsigned char* d, size_t n, unsigned char* md); +void SHA_Transform(SHA_CTX* c, const unsigned char* data); +#endif +#ifndef OPENSSL_NO_SHA1 +#ifdef OPENSSL_FIPS +int private_SHA1_Init(SHA_CTX* c); +#endif +int SHA1_Init(SHA_CTX* c); +int SHA1_Update(SHA_CTX* c, const void* data, size_t len); +int SHA1_Final(unsigned char* md, SHA_CTX* c); +unsigned char* SHA1(const unsigned char* d, size_t n, unsigned char* md); +void SHA1_Transform(SHA_CTX* c, const unsigned char* data); +#endif + +#define SHA256_CBLOCK \ + (SHA_LBLOCK * 4) /* SHA-256 treats input data as a \ + * contiguous array of 32 bit wide \ + * big-endian values. */ +#define SHA224_DIGEST_LENGTH 28 +#define SHA256_DIGEST_LENGTH 32 + +typedef struct SHA256state_st { + SHA_LONG h[8]; + SHA_LONG Nl, Nh; + SHA_LONG data[SHA_LBLOCK]; + unsigned int num, md_len; +} SHA256_CTX; + +#ifndef OPENSSL_NO_SHA256 +#ifdef OPENSSL_FIPS +int private_SHA224_Init(SHA256_CTX* c); +int private_SHA256_Init(SHA256_CTX* c); +#endif +int SHA224_Init(SHA256_CTX* c); +int SHA224_Update(SHA256_CTX* c, const void* data, size_t len); +int SHA224_Final(unsigned char* md, SHA256_CTX* c); +unsigned char* SHA224(const unsigned char* d, size_t n, unsigned char* md); +int SHA256_Init(SHA256_CTX* c); +int SHA256_Update(SHA256_CTX* c, const void* data, size_t len); +int SHA256_Final(unsigned char* md, SHA256_CTX* c); +unsigned char* SHA256(const unsigned char* d, size_t n, unsigned char* md); +void SHA256_Transform(SHA256_CTX* c, const unsigned char* data); +#endif + +#define SHA384_DIGEST_LENGTH 48 +#define SHA512_DIGEST_LENGTH 64 + +#ifndef OPENSSL_NO_SHA512 +/* + * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64 + * being exactly 64-bit wide. See Implementation Notes in sha512.c + * for further details. + */ +/* + * SHA-512 treats input data as a + * contiguous array of 64 bit + * wide big-endian values. + */ +#define SHA512_CBLOCK (SHA_LBLOCK * 8) +#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) +#define SHA_LONG64 unsigned __int64 +#define U64(C) C##UI64 +#elif defined(__arch64__) +#define SHA_LONG64 unsigned long +#define U64(C) C##UL +#else +#define SHA_LONG64 unsigned long long +#define U64(C) C##ULL +#endif + +typedef struct SHA512state_st { + SHA_LONG64 h[8]; + SHA_LONG64 Nl, Nh; + union { + SHA_LONG64 d[SHA_LBLOCK]; + unsigned char p[SHA512_CBLOCK]; + } u; + unsigned int num, md_len; +} SHA512_CTX; +#endif + +#ifndef OPENSSL_NO_SHA512 +#ifdef OPENSSL_FIPS +int private_SHA384_Init(SHA512_CTX* c); +int private_SHA512_Init(SHA512_CTX* c); +#endif +int SHA384_Init(SHA512_CTX* c); +int SHA384_Update(SHA512_CTX* c, const void* data, size_t len); +int SHA384_Final(unsigned char* md, SHA512_CTX* c); +unsigned char* SHA384(const unsigned char* d, size_t n, unsigned char* md); +int SHA512_Init(SHA512_CTX* c); +int SHA512_Update(SHA512_CTX* c, const void* data, size_t len); +int SHA512_Final(unsigned char* md, SHA512_CTX* c); +unsigned char* SHA512(const unsigned char* d, size_t n, unsigned char* md); +void SHA512_Transform(SHA512_CTX* c, const unsigned char* data); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/srp.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/srp.h new file mode 100644 index 0000000..e84af18 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/srp.h @@ -0,0 +1,193 @@ +/* crypto/srp/srp.h */ +/* + * Written by Christophe Renou (christophe.renou@edelweb.fr) with the + * precious help of Peter Sylvester (peter.sylvester@edelweb.fr) for the + * EdelKey project and contributed to the OpenSSL project 2004. + */ +/* ==================================================================== + * Copyright (c) 2004 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +#ifndef __SRP_H__ +#define __SRP_H__ + +#ifndef OPENSSL_NO_SRP + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +typedef struct SRP_gN_cache_st { + char* b64_bn; + BIGNUM* bn; +} SRP_gN_cache; + +DECLARE_STACK_OF(SRP_gN_cache) + +typedef struct SRP_user_pwd_st { + /* Owned by us. */ + char* id; + BIGNUM* s; + BIGNUM* v; + /* Not owned by us. */ + const BIGNUM* g; + const BIGNUM* N; + /* Owned by us. */ + char* info; +} SRP_user_pwd; + +DECLARE_STACK_OF(SRP_user_pwd) + +void SRP_user_pwd_free(SRP_user_pwd* user_pwd); + +typedef struct SRP_VBASE_st { + STACK_OF(SRP_user_pwd) * users_pwd; + STACK_OF(SRP_gN_cache) * gN_cache; + /* to simulate a user */ + char* seed_key; + BIGNUM* default_g; + BIGNUM* default_N; +} SRP_VBASE; + +/* + * Structure interne pour retenir les couples N et g + */ +typedef struct SRP_gN_st { + char* id; + BIGNUM* g; + BIGNUM* N; +} SRP_gN; + +DECLARE_STACK_OF(SRP_gN) + +SRP_VBASE* SRP_VBASE_new(char* seed_key); +int SRP_VBASE_free(SRP_VBASE* vb); +int SRP_VBASE_init(SRP_VBASE* vb, char* verifier_file); + +/* This method ignores the configured seed and fails for an unknown user. */ +SRP_user_pwd* SRP_VBASE_get_by_user(SRP_VBASE* vb, char* username); +/* NOTE: unlike in SRP_VBASE_get_by_user, caller owns the returned pointer.*/ +SRP_user_pwd* SRP_VBASE_get1_by_user(SRP_VBASE* vb, char* username); + +char* SRP_create_verifier( + const char* user, + const char* pass, + char** salt, + char** verifier, + const char* N, + const char* g); +int SRP_create_verifier_BN( + const char* user, + const char* pass, + BIGNUM** salt, + BIGNUM** verifier, + BIGNUM* N, + BIGNUM* g); + +#define SRP_NO_ERROR 0 +#define SRP_ERR_VBASE_INCOMPLETE_FILE 1 +#define SRP_ERR_VBASE_BN_LIB 2 +#define SRP_ERR_OPEN_FILE 3 +#define SRP_ERR_MEMORY 4 + +#define DB_srptype 0 +#define DB_srpverifier 1 +#define DB_srpsalt 2 +#define DB_srpid 3 +#define DB_srpgN 4 +#define DB_srpinfo 5 +#undef DB_NUMBER +#define DB_NUMBER 6 + +#define DB_SRP_INDEX 'I' +#define DB_SRP_VALID 'V' +#define DB_SRP_REVOKED 'R' +#define DB_SRP_MODIF 'v' + +/* see srp.c */ +char* SRP_check_known_gN_param(BIGNUM* g, BIGNUM* N); +SRP_gN* SRP_get_default_gN(const char* id); + +/* server side .... */ +BIGNUM* +SRP_Calc_server_key(BIGNUM* A, BIGNUM* v, BIGNUM* u, BIGNUM* b, BIGNUM* N); +BIGNUM* SRP_Calc_B(BIGNUM* b, BIGNUM* N, BIGNUM* g, BIGNUM* v); +int SRP_Verify_A_mod_N(BIGNUM* A, BIGNUM* N); +BIGNUM* SRP_Calc_u(BIGNUM* A, BIGNUM* B, BIGNUM* N); + +/* client side .... */ +BIGNUM* SRP_Calc_x(BIGNUM* s, const char* user, const char* pass); +BIGNUM* SRP_Calc_A(BIGNUM* a, BIGNUM* N, BIGNUM* g); +BIGNUM* SRP_Calc_client_key( + BIGNUM* N, + BIGNUM* B, + BIGNUM* g, + BIGNUM* x, + BIGNUM* a, + BIGNUM* u); +int SRP_Verify_B_mod_N(BIGNUM* B, BIGNUM* N); + +#define SRP_MINIMAL_N 1024 + +#ifdef __cplusplus +} +#endif + +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/srtp.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/srtp.h new file mode 100644 index 0000000..1566cff --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/srtp.h @@ -0,0 +1,147 @@ +/* ssl/srtp.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright (c) 1998-2006 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* + * DTLS code by Eric Rescorla + * + * Copyright (C) 2006, Network Resonance, Inc. Copyright (C) 2011, RTFM, Inc. + */ + +#ifndef HEADER_D1_SRTP_H +#define HEADER_D1_SRTP_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define SRTP_AES128_CM_SHA1_80 0x0001 +#define SRTP_AES128_CM_SHA1_32 0x0002 +#define SRTP_AES128_F8_SHA1_80 0x0003 +#define SRTP_AES128_F8_SHA1_32 0x0004 +#define SRTP_NULL_SHA1_80 0x0005 +#define SRTP_NULL_SHA1_32 0x0006 + +#ifndef OPENSSL_NO_SRTP + +int SSL_CTX_set_tlsext_use_srtp(SSL_CTX* ctx, const char* profiles); +int SSL_set_tlsext_use_srtp(SSL* ctx, const char* profiles); + +STACK_OF(SRTP_PROTECTION_PROFILE) * SSL_get_srtp_profiles(SSL* ssl); +SRTP_PROTECTION_PROFILE* SSL_get_selected_srtp_profile(SSL* s); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ssl.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ssl.h new file mode 100644 index 0000000..ff2888d --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ssl.h @@ -0,0 +1,3282 @@ +/* ssl/ssl.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright (c) 1998-2007 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * ECC cipher suite support in OpenSSL originally developed by + * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. + */ +/* ==================================================================== + * Copyright 2005 Nokia. All rights reserved. + * + * The portions of the attached software ("Contribution") is developed by + * Nokia Corporation and is licensed pursuant to the OpenSSL open source + * license. + * + * The Contribution, originally written by Mika Kousa and Pasi Eronen of + * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites + * support (see RFC 4279) to OpenSSL. + * + * No patent licenses or other rights except those expressly stated in + * the OpenSSL open source license shall be deemed granted or received + * expressly, by implication, estoppel, or otherwise. + * + * No assurances are provided by Nokia that the Contribution does not + * infringe the patent or other intellectual property rights of any third + * party or that the license provides you with all the necessary rights + * to make use of the Contribution. + * + * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN + * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA + * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY + * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR + * OTHERWISE. + */ + +#ifndef HEADER_SSL_H +#define HEADER_SSL_H + +#include + +#ifndef OPENSSL_NO_COMP +#include +#endif +#ifndef OPENSSL_NO_BIO +#include +#endif +#ifndef OPENSSL_NO_DEPRECATED +#ifndef OPENSSL_NO_X509 +#include +#endif +#include +#include +#include +#endif +#include +#include + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* SSLeay version number for ASN.1 encoding of the session information */ +/*- + * Version 0 - initial version + * Version 1 - added the optional peer certificate + */ +#define SSL_SESSION_ASN1_VERSION 0x0001 + +/* text strings for the ciphers */ +#define SSL_TXT_NULL_WITH_MD5 SSL2_TXT_NULL_WITH_MD5 +#define SSL_TXT_RC4_128_WITH_MD5 SSL2_TXT_RC4_128_WITH_MD5 +#define SSL_TXT_RC4_128_EXPORT40_WITH_MD5 SSL2_TXT_RC4_128_EXPORT40_WITH_MD5 +#define SSL_TXT_RC2_128_CBC_WITH_MD5 SSL2_TXT_RC2_128_CBC_WITH_MD5 +#define SSL_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 \ + SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 +#define SSL_TXT_IDEA_128_CBC_WITH_MD5 SSL2_TXT_IDEA_128_CBC_WITH_MD5 +#define SSL_TXT_DES_64_CBC_WITH_MD5 SSL2_TXT_DES_64_CBC_WITH_MD5 +#define SSL_TXT_DES_64_CBC_WITH_SHA SSL2_TXT_DES_64_CBC_WITH_SHA +#define SSL_TXT_DES_192_EDE3_CBC_WITH_MD5 SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5 +#define SSL_TXT_DES_192_EDE3_CBC_WITH_SHA SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA + +/* + * VRS Additional Kerberos5 entries + */ +#define SSL_TXT_KRB5_DES_64_CBC_SHA SSL3_TXT_KRB5_DES_64_CBC_SHA +#define SSL_TXT_KRB5_DES_192_CBC3_SHA SSL3_TXT_KRB5_DES_192_CBC3_SHA +#define SSL_TXT_KRB5_RC4_128_SHA SSL3_TXT_KRB5_RC4_128_SHA +#define SSL_TXT_KRB5_IDEA_128_CBC_SHA SSL3_TXT_KRB5_IDEA_128_CBC_SHA +#define SSL_TXT_KRB5_DES_64_CBC_MD5 SSL3_TXT_KRB5_DES_64_CBC_MD5 +#define SSL_TXT_KRB5_DES_192_CBC3_MD5 SSL3_TXT_KRB5_DES_192_CBC3_MD5 +#define SSL_TXT_KRB5_RC4_128_MD5 SSL3_TXT_KRB5_RC4_128_MD5 +#define SSL_TXT_KRB5_IDEA_128_CBC_MD5 SSL3_TXT_KRB5_IDEA_128_CBC_MD5 + +#define SSL_TXT_KRB5_DES_40_CBC_SHA SSL3_TXT_KRB5_DES_40_CBC_SHA +#define SSL_TXT_KRB5_RC2_40_CBC_SHA SSL3_TXT_KRB5_RC2_40_CBC_SHA +#define SSL_TXT_KRB5_RC4_40_SHA SSL3_TXT_KRB5_RC4_40_SHA +#define SSL_TXT_KRB5_DES_40_CBC_MD5 SSL3_TXT_KRB5_DES_40_CBC_MD5 +#define SSL_TXT_KRB5_RC2_40_CBC_MD5 SSL3_TXT_KRB5_RC2_40_CBC_MD5 +#define SSL_TXT_KRB5_RC4_40_MD5 SSL3_TXT_KRB5_RC4_40_MD5 + +#define SSL_TXT_KRB5_DES_40_CBC_SHA SSL3_TXT_KRB5_DES_40_CBC_SHA +#define SSL_TXT_KRB5_DES_40_CBC_MD5 SSL3_TXT_KRB5_DES_40_CBC_MD5 +#define SSL_TXT_KRB5_DES_64_CBC_SHA SSL3_TXT_KRB5_DES_64_CBC_SHA +#define SSL_TXT_KRB5_DES_64_CBC_MD5 SSL3_TXT_KRB5_DES_64_CBC_MD5 +#define SSL_TXT_KRB5_DES_192_CBC3_SHA SSL3_TXT_KRB5_DES_192_CBC3_SHA +#define SSL_TXT_KRB5_DES_192_CBC3_MD5 SSL3_TXT_KRB5_DES_192_CBC3_MD5 +#define SSL_MAX_KRB5_PRINCIPAL_LENGTH 256 + +#define SSL_MAX_SSL_SESSION_ID_LENGTH 32 +#define SSL_MAX_SID_CTX_LENGTH 32 + +#define SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES (512 / 8) +#define SSL_MAX_KEY_ARG_LENGTH 8 +#define SSL_MAX_MASTER_KEY_LENGTH 48 + +/* These are used to specify which ciphers to use and not to use */ + +#define SSL_TXT_EXP40 "EXPORT40" +#define SSL_TXT_EXP56 "EXPORT56" +#define SSL_TXT_LOW "LOW" +#define SSL_TXT_MEDIUM "MEDIUM" +#define SSL_TXT_HIGH "HIGH" +#define SSL_TXT_FIPS "FIPS" + +#define SSL_TXT_kFZA "kFZA" /* unused! */ +#define SSL_TXT_aFZA "aFZA" /* unused! */ +#define SSL_TXT_eFZA "eFZA" /* unused! */ +#define SSL_TXT_FZA "FZA" /* unused! */ + +#define SSL_TXT_aNULL "aNULL" +#define SSL_TXT_eNULL "eNULL" +#define SSL_TXT_NULL "NULL" + +#define SSL_TXT_kRSA "kRSA" +#define SSL_TXT_kDHr "kDHr" +#define SSL_TXT_kDHd "kDHd" +#define SSL_TXT_kDH "kDH" +#define SSL_TXT_kEDH "kEDH" +#define SSL_TXT_kDHE "kDHE" /* alias for kEDH */ +#define SSL_TXT_kKRB5 "kKRB5" +#define SSL_TXT_kECDHr "kECDHr" +#define SSL_TXT_kECDHe "kECDHe" +#define SSL_TXT_kECDH "kECDH" +#define SSL_TXT_kEECDH "kEECDH" +#define SSL_TXT_kECDHE "kECDHE" /* alias for kEECDH */ +#define SSL_TXT_kPSK "kPSK" +#define SSL_TXT_kGOST "kGOST" +#define SSL_TXT_kSRP "kSRP" + +#define SSL_TXT_aRSA "aRSA" +#define SSL_TXT_aDSS "aDSS" +#define SSL_TXT_aDH "aDH" +#define SSL_TXT_aECDH "aECDH" +#define SSL_TXT_aKRB5 "aKRB5" +#define SSL_TXT_aECDSA "aECDSA" +#define SSL_TXT_aPSK "aPSK" +#define SSL_TXT_aGOST94 "aGOST94" +#define SSL_TXT_aGOST01 "aGOST01" +#define SSL_TXT_aGOST "aGOST" +#define SSL_TXT_aSRP "aSRP" + +#define SSL_TXT_DSS "DSS" +#define SSL_TXT_DH "DH" +#define SSL_TXT_EDH "EDH" /* same as "kEDH:-ADH" */ +#define SSL_TXT_DHE "DHE" /* alias for EDH */ +#define SSL_TXT_ADH "ADH" +#define SSL_TXT_RSA "RSA" +#define SSL_TXT_ECDH "ECDH" +#define SSL_TXT_EECDH "EECDH" /* same as "kEECDH:-AECDH" */ +#define SSL_TXT_ECDHE "ECDHE" /* alias for ECDHE" */ +#define SSL_TXT_AECDH "AECDH" +#define SSL_TXT_ECDSA "ECDSA" +#define SSL_TXT_KRB5 "KRB5" +#define SSL_TXT_PSK "PSK" +#define SSL_TXT_SRP "SRP" + +#define SSL_TXT_DES "DES" +#define SSL_TXT_3DES "3DES" +#define SSL_TXT_RC4 "RC4" +#define SSL_TXT_RC2 "RC2" +#define SSL_TXT_IDEA "IDEA" +#define SSL_TXT_SEED "SEED" +#define SSL_TXT_AES128 "AES128" +#define SSL_TXT_AES256 "AES256" +#define SSL_TXT_AES "AES" +#define SSL_TXT_AES_GCM "AESGCM" +#define SSL_TXT_CAMELLIA128 "CAMELLIA128" +#define SSL_TXT_CAMELLIA256 "CAMELLIA256" +#define SSL_TXT_CAMELLIA "CAMELLIA" + +#define SSL_TXT_MD5 "MD5" +#define SSL_TXT_SHA1 "SHA1" +#define SSL_TXT_SHA "SHA" /* same as "SHA1" */ +#define SSL_TXT_GOST94 "GOST94" +#define SSL_TXT_GOST89MAC "GOST89MAC" +#define SSL_TXT_SHA256 "SHA256" +#define SSL_TXT_SHA384 "SHA384" + +#define SSL_TXT_SSLV2 "SSLv2" +#define SSL_TXT_SSLV3 "SSLv3" +#define SSL_TXT_TLSV1 "TLSv1" +#define SSL_TXT_TLSV1_1 "TLSv1.1" +#define SSL_TXT_TLSV1_2 "TLSv1.2" + +#define SSL_TXT_EXP "EXP" +#define SSL_TXT_EXPORT "EXPORT" + +#define SSL_TXT_ALL "ALL" + +/*- + * COMPLEMENTOF* definitions. These identifiers are used to (de-select) + * ciphers normally not being used. + * Example: "RC4" will activate all ciphers using RC4 including ciphers + * without authentication, which would normally disabled by DEFAULT (due + * the "!ADH" being part of default). Therefore "RC4:!COMPLEMENTOFDEFAULT" + * will make sure that it is also disabled in the specific selection. + * COMPLEMENTOF* identifiers are portable between version, as adjustments + * to the default cipher setup will also be included here. + * + * COMPLEMENTOFDEFAULT does not experience the same special treatment that + * DEFAULT gets, as only selection is being done and no sorting as needed + * for DEFAULT. + */ +#define SSL_TXT_CMPALL "COMPLEMENTOFALL" +#define SSL_TXT_CMPDEF "COMPLEMENTOFDEFAULT" + +/* + * The following cipher list is used by default. It also is substituted when + * an application-defined cipher list string starts with 'DEFAULT'. + */ +#define SSL_DEFAULT_CIPHER_LIST "ALL:!EXPORT:!LOW:!aNULL:!eNULL:!SSLv2" +/* + * As of OpenSSL 1.0.0, ssl_create_cipher_list() in ssl/ssl_ciph.c always + * starts with a reasonable order, and all we have to do for DEFAULT is + * throwing out anonymous and unencrypted ciphersuites! (The latter are not + * actually enabled by ALL, but "ALL:RSA" would enable some of them.) + */ + +/* Used in SSL_set_shutdown()/SSL_get_shutdown(); */ +#define SSL_SENT_SHUTDOWN 1 +#define SSL_RECEIVED_SHUTDOWN 2 + +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if (defined(OPENSSL_NO_RSA) || defined(OPENSSL_NO_MD5)) && \ + !defined(OPENSSL_NO_SSL2) +#define OPENSSL_NO_SSL2 +#endif + +#define SSL_FILETYPE_ASN1 X509_FILETYPE_ASN1 +#define SSL_FILETYPE_PEM X509_FILETYPE_PEM + +/* + * This is needed to stop compilers complaining about the 'struct ssl_st *' + * function parameters used to prototype callbacks in SSL_CTX. + */ +typedef struct ssl_st* ssl_crock_st; +typedef struct tls_session_ticket_ext_st TLS_SESSION_TICKET_EXT; +typedef struct ssl_method_st SSL_METHOD; +typedef struct ssl_cipher_st SSL_CIPHER; +typedef struct ssl_session_st SSL_SESSION; +typedef struct tls_sigalgs_st TLS_SIGALGS; +typedef struct ssl_conf_ctx_st SSL_CONF_CTX; + +DECLARE_STACK_OF(SSL_CIPHER) + +/* SRTP protection profiles for use with the use_srtp extension (RFC 5764)*/ +typedef struct srtp_protection_profile_st { + const char* name; + unsigned long id; +} SRTP_PROTECTION_PROFILE; + +DECLARE_STACK_OF(SRTP_PROTECTION_PROFILE) + +typedef int (*tls_session_ticket_ext_cb_fn)( + SSL* s, + const unsigned char* data, + int len, + void* arg); +typedef int (*tls_session_secret_cb_fn)( + SSL* s, + void* secret, + int* secret_len, + STACK_OF(SSL_CIPHER) * peer_ciphers, + SSL_CIPHER** cipher, + void* arg); + +#ifndef OPENSSL_NO_TLSEXT + +/* Typedefs for handling custom extensions */ + +typedef int (*custom_ext_add_cb)( + SSL* s, + unsigned int ext_type, + const unsigned char** out, + size_t* outlen, + int* al, + void* add_arg); + +typedef void (*custom_ext_free_cb)( + SSL* s, + unsigned int ext_type, + const unsigned char* out, + void* add_arg); + +typedef int (*custom_ext_parse_cb)( + SSL* s, + unsigned int ext_type, + const unsigned char* in, + size_t inlen, + int* al, + void* parse_arg); + +#endif + +#ifndef OPENSSL_NO_SSL_INTERN + +/* used to hold info on the particular ciphers used */ +struct ssl_cipher_st { + int valid; + const char* name; /* text name */ + unsigned long id; /* id, 4 bytes, first is version */ + /* + * changed in 0.9.9: these four used to be portions of a single value + * 'algorithms' + */ + unsigned long algorithm_mkey; /* key exchange algorithm */ + unsigned long algorithm_auth; /* server authentication */ + unsigned long algorithm_enc; /* symmetric encryption */ + unsigned long algorithm_mac; /* symmetric authentication */ + unsigned long algorithm_ssl; /* (major) protocol version */ + unsigned long algo_strength; /* strength and export flags */ + unsigned long algorithm2; /* Extra flags */ + int strength_bits; /* Number of bits really used */ + int alg_bits; /* Number of bits for algorithm */ +}; + +/* Used to hold functions for SSLv2 or SSLv3/TLSv1 functions */ +struct ssl_method_st { + int version; + int (*ssl_new)(SSL* s); + void (*ssl_clear)(SSL* s); + void (*ssl_free)(SSL* s); + int (*ssl_accept)(SSL* s); + int (*ssl_connect)(SSL* s); + int (*ssl_read)(SSL* s, void* buf, int len); + int (*ssl_peek)(SSL* s, void* buf, int len); + int (*ssl_write)(SSL* s, const void* buf, int len); + int (*ssl_shutdown)(SSL* s); + int (*ssl_renegotiate)(SSL* s); + int (*ssl_renegotiate_check)(SSL* s); + long (*ssl_get_message)(SSL* s, int st1, int stn, int mt, long max, int* ok); + int ( + *ssl_read_bytes)(SSL* s, int type, unsigned char* buf, int len, int peek); + int (*ssl_write_bytes)(SSL* s, int type, const void* buf_, int len); + int (*ssl_dispatch_alert)(SSL* s); + long (*ssl_ctrl)(SSL* s, int cmd, long larg, void* parg); + long (*ssl_ctx_ctrl)(SSL_CTX* ctx, int cmd, long larg, void* parg); + const SSL_CIPHER* (*get_cipher_by_char)(const unsigned char* ptr); + int (*put_cipher_by_char)(const SSL_CIPHER* cipher, unsigned char* ptr); + int (*ssl_pending)(const SSL* s); + int (*num_ciphers)(void); + const SSL_CIPHER* (*get_cipher)(unsigned ncipher); + const struct ssl_method_st* (*get_ssl_method)(int version); + long (*get_timeout)(void); + struct ssl3_enc_method* ssl3_enc; /* Extra SSLv3/TLS stuff */ + int (*ssl_version)(void); + long (*ssl_callback_ctrl)(SSL* s, int cb_id, void (*fp)(void)); + long (*ssl_ctx_callback_ctrl)(SSL_CTX* s, int cb_id, void (*fp)(void)); +}; + +/*- + * Lets make this into an ASN.1 type structure as follows + * SSL_SESSION_ID ::= SEQUENCE { + * version INTEGER, -- structure version number + * SSLversion INTEGER, -- SSL version number + * Cipher OCTET STRING, -- the 3 byte cipher ID + * Session_ID OCTET STRING, -- the Session ID + * Master_key OCTET STRING, -- the master key + * KRB5_principal OCTET STRING -- optional Kerberos principal + * Key_Arg [ 0 ] IMPLICIT OCTET STRING, -- the optional Key argument + * Time [ 1 ] EXPLICIT INTEGER, -- optional Start Time + * Timeout [ 2 ] EXPLICIT INTEGER, -- optional Timeout ins seconds + * Peer [ 3 ] EXPLICIT X509, -- optional Peer Certificate + * Session_ID_context [ 4 ] EXPLICIT OCTET STRING, -- the Session ID + * context + * Verify_result [ 5 ] EXPLICIT INTEGER, -- X509_V_... code for `Peer' + * HostName [ 6 ] EXPLICIT OCTET STRING, -- optional HostName from + * servername TLS extension + * PSK_identity_hint [ 7 ] EXPLICIT OCTET STRING, -- optional PSK identity + * hint + * PSK_identity [ 8 ] EXPLICIT OCTET STRING, -- optional PSK identity + * Ticket_lifetime_hint [9] EXPLICIT INTEGER, -- server's lifetime hint for + * session ticket + * Ticket [10] EXPLICIT OCTET STRING, -- session ticket + * (clients only) + * Compression_meth [11] EXPLICIT OCTET STRING, -- optional compression + * method + * SRP_username [ 12 ] EXPLICIT OCTET STRING -- optional SRP username + * } + * Look in ssl/ssl_asn1.c for more details + * I'm using EXPLICIT tags so I can read the damn things using asn1parse :-). + */ +struct ssl_session_st { + int ssl_version; /* what ssl version session info is being + * kept in here? */ + /* only really used in SSLv2 */ + unsigned int key_arg_length; + unsigned char key_arg[SSL_MAX_KEY_ARG_LENGTH]; + int master_key_length; + unsigned char master_key[SSL_MAX_MASTER_KEY_LENGTH]; + /* session_id - valid? */ + unsigned int session_id_length; + unsigned char session_id[SSL_MAX_SSL_SESSION_ID_LENGTH]; + /* + * this is used to determine whether the session is being reused in the + * appropriate context. It is up to the application to set this, via + * SSL_new + */ + unsigned int sid_ctx_length; + unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH]; +#ifndef OPENSSL_NO_KRB5 + unsigned int krb5_client_princ_len; + unsigned char krb5_client_princ[SSL_MAX_KRB5_PRINCIPAL_LENGTH]; +#endif /* OPENSSL_NO_KRB5 */ +#ifndef OPENSSL_NO_PSK + char* psk_identity_hint; + char* psk_identity; +#endif + /* + * Used to indicate that session resumption is not allowed. Applications + * can also set this bit for a new session via not_resumable_session_cb + * to disable session caching and tickets. + */ + int not_resumable; + /* The cert is the certificate used to establish this connection */ + struct sess_cert_st /* SESS_CERT */* sess_cert; + /* + * This is the cert for the other end. On clients, it will be the same as + * sess_cert->peer_key->x509 (the latter is not enough as sess_cert is + * not retained in the external representation of sessions, see + * ssl_asn1.c). + */ + X509* peer; + /* + * when app_verify_callback accepts a session where the peer's + * certificate is not ok, we must remember the error for session reuse: + */ + long verify_result; /* only for servers */ + int references; + long timeout; + long time; + unsigned int compress_meth; /* Need to lookup the method */ + const SSL_CIPHER* cipher; + unsigned long cipher_id; /* when ASN.1 loaded, this needs to be used + * to load the 'cipher' structure */ + STACK_OF(SSL_CIPHER) * ciphers; /* shared ciphers? */ + CRYPTO_EX_DATA ex_data; /* application specific data */ + /* + * These are used to make removal of session-ids more efficient and to + * implement a maximum cache size. + */ + struct ssl_session_st *prev, *next; +#ifndef OPENSSL_NO_TLSEXT + char* tlsext_hostname; +#ifndef OPENSSL_NO_EC + size_t tlsext_ecpointformatlist_length; + unsigned char* tlsext_ecpointformatlist; /* peer's list */ + size_t tlsext_ellipticcurvelist_length; + unsigned char* tlsext_ellipticcurvelist; /* peer's list */ +#endif /* OPENSSL_NO_EC */ + /* RFC4507 info */ + unsigned char* tlsext_tick; /* Session ticket */ + size_t tlsext_ticklen; /* Session ticket length */ + long tlsext_tick_lifetime_hint; /* Session lifetime hint in seconds */ +#endif +#ifndef OPENSSL_NO_SRP + char* srp_username; +#endif +}; + +#endif + +#define SSL_OP_MICROSOFT_SESS_ID_BUG 0x00000001L +#define SSL_OP_NETSCAPE_CHALLENGE_BUG 0x00000002L +/* Allow initial connection to servers that don't support RI */ +#define SSL_OP_LEGACY_SERVER_CONNECT 0x00000004L +#define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 0x00000008L +#define SSL_OP_TLSEXT_PADDING 0x00000010L +#define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER 0x00000020L +#define SSL_OP_SAFARI_ECDHE_ECDSA_BUG 0x00000040L +#define SSL_OP_SSLEAY_080_CLIENT_DH_BUG 0x00000080L +#define SSL_OP_TLS_D5_BUG 0x00000100L +#define SSL_OP_TLS_BLOCK_PADDING_BUG 0x00000200L + +/* Hasn't done anything since OpenSSL 0.9.7h, retained for compatibility */ +#define SSL_OP_MSIE_SSLV2_RSA_PADDING 0x0 +/* Refers to ancient SSLREF and SSLv2, retained for compatibility */ +#define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0x0 + +/* + * Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added in + * OpenSSL 0.9.6d. Usually (depending on the application protocol) the + * workaround is not needed. Unfortunately some broken SSL/TLS + * implementations cannot handle it at all, which is why we include it in + * SSL_OP_ALL. + */ +/* added in 0.9.6e */ +#define SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS 0x00000800L + +/* + * SSL_OP_ALL: various bug workarounds that should be rather harmless. This + * used to be 0x000FFFFFL before 0.9.7. + */ +#define SSL_OP_ALL 0x80000BFFL + +/* DTLS options */ +#define SSL_OP_NO_QUERY_MTU 0x00001000L +/* Turn on Cookie Exchange (on relevant for servers) */ +#define SSL_OP_COOKIE_EXCHANGE 0x00002000L +/* Don't use RFC4507 ticket extension */ +#define SSL_OP_NO_TICKET 0x00004000L +/* Use Cisco's "speshul" version of DTLS_BAD_VER (as client) */ +#define SSL_OP_CISCO_ANYCONNECT 0x00008000L + +/* As server, disallow session resumption on renegotiation */ +#define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION 0x00010000L +/* Don't use compression even if supported */ +#define SSL_OP_NO_COMPRESSION 0x00020000L +/* Permit unsafe legacy renegotiation */ +#define SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION 0x00040000L +/* If set, always create a new key when using tmp_ecdh parameters */ +#define SSL_OP_SINGLE_ECDH_USE 0x00080000L +/* Does nothing: retained for compatibility */ +#define SSL_OP_SINGLE_DH_USE 0x00100000L +/* Does nothing: retained for compatibiity */ +#define SSL_OP_EPHEMERAL_RSA 0x0 +/* + * Set on servers to choose the cipher according to the server's preferences + */ +#define SSL_OP_CIPHER_SERVER_PREFERENCE 0x00400000L +/* + * If set, a server will allow a client to issue a SSLv3.0 version number as + * latest version supported in the premaster secret, even when TLSv1.0 + * (version 3.1) was announced in the client hello. Normally this is + * forbidden to prevent version rollback attacks. + */ +#define SSL_OP_TLS_ROLLBACK_BUG 0x00800000L + +#define SSL_OP_NO_SSLv2 0x01000000L +#define SSL_OP_NO_SSLv3 0x02000000L +#define SSL_OP_NO_TLSv1 0x04000000L +#define SSL_OP_NO_TLSv1_2 0x08000000L +#define SSL_OP_NO_TLSv1_1 0x10000000L + +#define SSL_OP_NO_DTLSv1 0x04000000L +#define SSL_OP_NO_DTLSv1_2 0x08000000L + +#define SSL_OP_NO_SSL_MASK \ + (SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1 | \ + SSL_OP_NO_TLSv1_2) + +/* + * These next two were never actually used for anything since SSLeay zap so + * we have some more flags. + */ +/* + * The next flag deliberately changes the ciphertest, this is a check for the + * PKCS#1 attack + */ +#define SSL_OP_PKCS1_CHECK_1 0x0 +#define SSL_OP_PKCS1_CHECK_2 0x0 + +#define SSL_OP_NETSCAPE_CA_DN_BUG 0x20000000L +#define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG 0x40000000L +/* + * Make server add server-hello extension from early version of cryptopro + * draft, when GOST ciphersuite is negotiated. Required for interoperability + * with CryptoPro CSP 3.x + */ +#define SSL_OP_CRYPTOPRO_TLSEXT_BUG 0x80000000L + +/* + * Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success + * when just a single record has been written): + */ +#define SSL_MODE_ENABLE_PARTIAL_WRITE 0x00000001L +/* + * Make it possible to retry SSL_write() with changed buffer location (buffer + * contents must stay the same!); this is not the default to avoid the + * misconception that non-blocking SSL_write() behaves like non-blocking + * write(): + */ +#define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER 0x00000002L +/* + * Never bother the application with retries if the transport is blocking: + */ +#define SSL_MODE_AUTO_RETRY 0x00000004L +/* Don't attempt to automatically build certificate chain */ +#define SSL_MODE_NO_AUTO_CHAIN 0x00000008L +/* + * Save RAM by releasing read and write buffers when they're empty. (SSL3 and + * TLS only.) "Released" buffers are put onto a free-list in the context or + * just freed (depending on the context's setting for freelist_max_len). + */ +#define SSL_MODE_RELEASE_BUFFERS 0x00000010L +/* + * Send the current time in the Random fields of the ClientHello and + * ServerHello records for compatibility with hypothetical implementations + * that require it. + */ +#define SSL_MODE_SEND_CLIENTHELLO_TIME 0x00000020L +#define SSL_MODE_SEND_SERVERHELLO_TIME 0x00000040L +/* + * Send TLS_FALLBACK_SCSV in the ClientHello. To be set only by applications + * that reconnect with a downgraded protocol version; see + * draft-ietf-tls-downgrade-scsv-00 for details. DO NOT ENABLE THIS if your + * application attempts a normal handshake. Only use this in explicit + * fallback retries, following the guidance in + * draft-ietf-tls-downgrade-scsv-00. + */ +#define SSL_MODE_SEND_FALLBACK_SCSV 0x00000080L + +/* Cert related flags */ +/* + * Many implementations ignore some aspects of the TLS standards such as + * enforcing certifcate chain algorithms. When this is set we enforce them. + */ +#define SSL_CERT_FLAG_TLS_STRICT 0x00000001L + +/* Suite B modes, takes same values as certificate verify flags */ +#define SSL_CERT_FLAG_SUITEB_128_LOS_ONLY 0x10000 +/* Suite B 192 bit only mode */ +#define SSL_CERT_FLAG_SUITEB_192_LOS 0x20000 +/* Suite B 128 bit mode allowing 192 bit algorithms */ +#define SSL_CERT_FLAG_SUITEB_128_LOS 0x30000 + +/* Perform all sorts of protocol violations for testing purposes */ +#define SSL_CERT_FLAG_BROKEN_PROTOCOL 0x10000000 + +/* Flags for building certificate chains */ +/* Treat any existing certificates as untrusted CAs */ +#define SSL_BUILD_CHAIN_FLAG_UNTRUSTED 0x1 +/* Don't include root CA in chain */ +#define SSL_BUILD_CHAIN_FLAG_NO_ROOT 0x2 +/* Just check certificates already there */ +#define SSL_BUILD_CHAIN_FLAG_CHECK 0x4 +/* Ignore verification errors */ +#define SSL_BUILD_CHAIN_FLAG_IGNORE_ERROR 0x8 +/* Clear verification errors from queue */ +#define SSL_BUILD_CHAIN_FLAG_CLEAR_ERROR 0x10 + +/* Flags returned by SSL_check_chain */ +/* Certificate can be used with this session */ +#define CERT_PKEY_VALID 0x1 +/* Certificate can also be used for signing */ +#define CERT_PKEY_SIGN 0x2 +/* EE certificate signing algorithm OK */ +#define CERT_PKEY_EE_SIGNATURE 0x10 +/* CA signature algorithms OK */ +#define CERT_PKEY_CA_SIGNATURE 0x20 +/* EE certificate parameters OK */ +#define CERT_PKEY_EE_PARAM 0x40 +/* CA certificate parameters OK */ +#define CERT_PKEY_CA_PARAM 0x80 +/* Signing explicitly allowed as opposed to SHA1 fallback */ +#define CERT_PKEY_EXPLICIT_SIGN 0x100 +/* Client CA issuer names match (always set for server cert) */ +#define CERT_PKEY_ISSUER_NAME 0x200 +/* Cert type matches client types (always set for server cert) */ +#define CERT_PKEY_CERT_TYPE 0x400 +/* Cert chain suitable to Suite B */ +#define CERT_PKEY_SUITEB 0x800 + +#define SSL_CONF_FLAG_CMDLINE 0x1 +#define SSL_CONF_FLAG_FILE 0x2 +#define SSL_CONF_FLAG_CLIENT 0x4 +#define SSL_CONF_FLAG_SERVER 0x8 +#define SSL_CONF_FLAG_SHOW_ERRORS 0x10 +#define SSL_CONF_FLAG_CERTIFICATE 0x20 +/* Configuration value types */ +#define SSL_CONF_TYPE_UNKNOWN 0x0 +#define SSL_CONF_TYPE_STRING 0x1 +#define SSL_CONF_TYPE_FILE 0x2 +#define SSL_CONF_TYPE_DIR 0x3 + +/* + * Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value, they + * cannot be used to clear bits. + */ + +#define SSL_CTX_set_options(ctx, op) \ + SSL_CTX_ctrl((ctx), SSL_CTRL_OPTIONS, (op), NULL) +#define SSL_CTX_clear_options(ctx, op) \ + SSL_CTX_ctrl((ctx), SSL_CTRL_CLEAR_OPTIONS, (op), NULL) +#define SSL_CTX_get_options(ctx) SSL_CTX_ctrl((ctx), SSL_CTRL_OPTIONS, 0, NULL) +#define SSL_set_options(ssl, op) SSL_ctrl((ssl), SSL_CTRL_OPTIONS, (op), NULL) +#define SSL_clear_options(ssl, op) \ + SSL_ctrl((ssl), SSL_CTRL_CLEAR_OPTIONS, (op), NULL) +#define SSL_get_options(ssl) SSL_ctrl((ssl), SSL_CTRL_OPTIONS, 0, NULL) + +#define SSL_CTX_set_mode(ctx, op) SSL_CTX_ctrl((ctx), SSL_CTRL_MODE, (op), NULL) +#define SSL_CTX_clear_mode(ctx, op) \ + SSL_CTX_ctrl((ctx), SSL_CTRL_CLEAR_MODE, (op), NULL) +#define SSL_CTX_get_mode(ctx) SSL_CTX_ctrl((ctx), SSL_CTRL_MODE, 0, NULL) +#define SSL_clear_mode(ssl, op) SSL_ctrl((ssl), SSL_CTRL_CLEAR_MODE, (op), NULL) +#define SSL_set_mode(ssl, op) SSL_ctrl((ssl), SSL_CTRL_MODE, (op), NULL) +#define SSL_get_mode(ssl) SSL_ctrl((ssl), SSL_CTRL_MODE, 0, NULL) +#define SSL_set_mtu(ssl, mtu) SSL_ctrl((ssl), SSL_CTRL_SET_MTU, (mtu), NULL) +#define DTLS_set_link_mtu(ssl, mtu) \ + SSL_ctrl((ssl), DTLS_CTRL_SET_LINK_MTU, (mtu), NULL) +#define DTLS_get_link_min_mtu(ssl) \ + SSL_ctrl((ssl), DTLS_CTRL_GET_LINK_MIN_MTU, 0, NULL) + +#define SSL_get_secure_renegotiation_support(ssl) \ + SSL_ctrl((ssl), SSL_CTRL_GET_RI_SUPPORT, 0, NULL) + +#ifndef OPENSSL_NO_HEARTBEATS +#define SSL_heartbeat(ssl) \ + SSL_ctrl((ssl), SSL_CTRL_TLS_EXT_SEND_HEARTBEAT, 0, NULL) +#endif + +#define SSL_CTX_set_cert_flags(ctx, op) \ + SSL_CTX_ctrl((ctx), SSL_CTRL_CERT_FLAGS, (op), NULL) +#define SSL_set_cert_flags(s, op) SSL_ctrl((s), SSL_CTRL_CERT_FLAGS, (op), NULL) +#define SSL_CTX_clear_cert_flags(ctx, op) \ + SSL_CTX_ctrl((ctx), SSL_CTRL_CLEAR_CERT_FLAGS, (op), NULL) +#define SSL_clear_cert_flags(s, op) \ + SSL_ctrl((s), SSL_CTRL_CLEAR_CERT_FLAGS, (op), NULL) + +void SSL_CTX_set_msg_callback( + SSL_CTX* ctx, + void (*cb)( + int write_p, + int version, + int content_type, + const void* buf, + size_t len, + SSL* ssl, + void* arg)); +void SSL_set_msg_callback( + SSL* ssl, + void (*cb)( + int write_p, + int version, + int content_type, + const void* buf, + size_t len, + SSL* ssl, + void* arg)); +#define SSL_CTX_set_msg_callback_arg(ctx, arg) \ + SSL_CTX_ctrl((ctx), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) +#define SSL_set_msg_callback_arg(ssl, arg) \ + SSL_ctrl((ssl), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) + +#ifndef OPENSSL_NO_SRP + +#ifndef OPENSSL_NO_SSL_INTERN + +typedef struct srp_ctx_st { + /* param for all the callbacks */ + void* SRP_cb_arg; + /* set client Hello login callback */ + int (*TLS_ext_srp_username_callback)(SSL*, int*, void*); + /* set SRP N/g param callback for verification */ + int (*SRP_verify_param_callback)(SSL*, void*); + /* set SRP client passwd callback */ + char* (*SRP_give_srp_client_pwd_callback)(SSL*, void*); + char* login; + BIGNUM *N, *g, *s, *B, *A; + BIGNUM *a, *b, *v; + char* info; + int strength; + unsigned long srp_Mask; +} SRP_CTX; + +#endif + +/* see tls_srp.c */ +int SSL_SRP_CTX_init(SSL* s); +int SSL_CTX_SRP_CTX_init(SSL_CTX* ctx); +int SSL_SRP_CTX_free(SSL* ctx); +int SSL_CTX_SRP_CTX_free(SSL_CTX* ctx); +int SSL_srp_server_param_with_username(SSL* s, int* ad); +int SRP_generate_server_master_secret(SSL* s, unsigned char* master_key); +int SRP_Calc_A_param(SSL* s); +int SRP_generate_client_master_secret(SSL* s, unsigned char* master_key); + +#endif + +#if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32) +#define SSL_MAX_CERT_LIST_DEFAULT 1024 * 30 +/* 30k max cert list :-) */ +#else +#define SSL_MAX_CERT_LIST_DEFAULT 1024 * 100 +/* 100k max cert list :-) */ +#endif + +#define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT (1024 * 20) + +/* + * This callback type is used inside SSL_CTX, SSL, and in the functions that + * set them. It is used to override the generation of SSL/TLS session IDs in + * a server. Return value should be zero on an error, non-zero to proceed. + * Also, callbacks should themselves check if the id they generate is unique + * otherwise the SSL handshake will fail with an error - callbacks can do + * this using the 'ssl' value they're passed by; + * SSL_has_matching_session_id(ssl, id, *id_len) The length value passed in + * is set at the maximum size the session ID can be. In SSLv2 this is 16 + * bytes, whereas SSLv3/TLSv1 it is 32 bytes. The callback can alter this + * length to be less if desired, but under SSLv2 session IDs are supposed to + * be fixed at 16 bytes so the id will be padded after the callback returns + * in this case. It is also an error for the callback to set the size to + * zero. + */ +typedef int ( + *GEN_SESSION_CB)(const SSL* ssl, unsigned char* id, unsigned int* id_len); + +typedef struct ssl_comp_st SSL_COMP; + +#ifndef OPENSSL_NO_SSL_INTERN + +struct ssl_comp_st { + int id; + const char* name; +#ifndef OPENSSL_NO_COMP + COMP_METHOD* method; +#else + char* method; +#endif +}; + +DECLARE_STACK_OF(SSL_COMP) +DECLARE_LHASH_OF(SSL_SESSION); + +struct ssl_ctx_st { + const SSL_METHOD* method; + STACK_OF(SSL_CIPHER) * cipher_list; + /* same as above but sorted for lookup */ + STACK_OF(SSL_CIPHER) * cipher_list_by_id; + struct x509_store_st /* X509_STORE */* cert_store; + LHASH_OF(SSL_SESSION) * sessions; + /* + * Most session-ids that will be cached, default is + * SSL_SESSION_CACHE_MAX_SIZE_DEFAULT. 0 is unlimited. + */ + unsigned long session_cache_size; + struct ssl_session_st* session_cache_head; + struct ssl_session_st* session_cache_tail; + /* + * This can have one of 2 values, ored together, SSL_SESS_CACHE_CLIENT, + * SSL_SESS_CACHE_SERVER, Default is SSL_SESSION_CACHE_SERVER, which + * means only SSL_accept which cache SSL_SESSIONS. + */ + int session_cache_mode; + /* + * If timeout is not 0, it is the default timeout value set when + * SSL_new() is called. This has been put in to make life easier to set + * things up + */ + long session_timeout; + /* + * If this callback is not null, it will be called each time a session id + * is added to the cache. If this function returns 1, it means that the + * callback will do a SSL_SESSION_free() when it has finished using it. + * Otherwise, on 0, it means the callback has finished with it. If + * remove_session_cb is not null, it will be called when a session-id is + * removed from the cache. After the call, OpenSSL will + * SSL_SESSION_free() it. + */ + int (*new_session_cb)(struct ssl_st* ssl, SSL_SESSION* sess); + void (*remove_session_cb)(struct ssl_ctx_st* ctx, SSL_SESSION* sess); + SSL_SESSION* (*get_session_cb)( + struct ssl_st* ssl, + unsigned char* data, + int len, + int* copy); + struct { + int sess_connect; /* SSL new conn - started */ + int sess_connect_renegotiate; /* SSL reneg - requested */ + int sess_connect_good; /* SSL new conne/reneg - finished */ + int sess_accept; /* SSL new accept - started */ + int sess_accept_renegotiate; /* SSL reneg - requested */ + int sess_accept_good; /* SSL accept/reneg - finished */ + int sess_miss; /* session lookup misses */ + int sess_timeout; /* reuse attempt on timeouted session */ + int sess_cache_full; /* session removed due to full cache */ + int sess_hit; /* session reuse actually done */ + int sess_cb_hit; /* session-id that was not in the cache was + * passed back via the callback. This + * indicates that the application is + * supplying session-id's from other + * processes - spooky :-) */ + } stats; + + int references; + + /* if defined, these override the X509_verify_cert() calls */ + int (*app_verify_callback)(X509_STORE_CTX*, void*); + void* app_verify_arg; + /* + * before OpenSSL 0.9.7, 'app_verify_arg' was ignored + * ('app_verify_callback' was called with just one argument) + */ + + /* Default password callback. */ + pem_password_cb* default_passwd_callback; + + /* Default password callback user data. */ + void* default_passwd_callback_userdata; + + /* get client cert callback */ + int (*client_cert_cb)(SSL* ssl, X509** x509, EVP_PKEY** pkey); + + /* cookie generate callback */ + int (*app_gen_cookie_cb)( + SSL* ssl, + unsigned char* cookie, + unsigned int* cookie_len); + + /* verify cookie callback */ + int (*app_verify_cookie_cb)( + SSL* ssl, + unsigned char* cookie, + unsigned int cookie_len); + + CRYPTO_EX_DATA ex_data; + + const EVP_MD* rsa_md5; /* For SSLv2 - name is 'ssl2-md5' */ + const EVP_MD* md5; /* For SSLv3/TLSv1 'ssl3-md5' */ + const EVP_MD* sha1; /* For SSLv3/TLSv1 'ssl3->sha1' */ + + STACK_OF(X509) * extra_certs; + STACK_OF(SSL_COMP) * comp_methods; /* stack of SSL_COMP, SSLv3/TLSv1 */ + + /* Default values used when no per-SSL value is defined follow */ + + /* used if SSL's info_callback is NULL */ + void (*info_callback)(const SSL* ssl, int type, int val); + + /* what we put in client cert requests */ + STACK_OF(X509_NAME) * client_CA; + + /* + * Default values to use in SSL structures follow (these are copied by + * SSL_new) + */ + + unsigned long options; + unsigned long mode; + long max_cert_list; + + struct cert_st /* CERT */* cert; + int read_ahead; + + /* callback that allows applications to peek at protocol messages */ + void (*msg_callback)( + int write_p, + int version, + int content_type, + const void* buf, + size_t len, + SSL* ssl, + void* arg); + void* msg_callback_arg; + + int verify_mode; + unsigned int sid_ctx_length; + unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH]; + /* called 'verify_callback' in the SSL */ + int (*default_verify_callback)(int ok, X509_STORE_CTX* ctx); + + /* Default generate session ID callback. */ + GEN_SESSION_CB generate_session_id; + + X509_VERIFY_PARAM* param; + +#if 0 + int purpose; /* Purpose setting */ + int trust; /* Trust setting */ +#endif + + int quiet_shutdown; + + /* + * Maximum amount of data to send in one fragment. actual record size can + * be more than this due to padding and MAC overheads. + */ + unsigned int max_send_fragment; + +#ifndef OPENSSL_NO_ENGINE + /* + * Engine to pass requests for client certs to + */ + ENGINE* client_cert_engine; +#endif + +#ifndef OPENSSL_NO_TLSEXT + /* TLS extensions servername callback */ + int (*tlsext_servername_callback)(SSL*, int*, void*); + void* tlsext_servername_arg; + /* RFC 4507 session ticket keys */ + unsigned char tlsext_tick_key_name[16]; + unsigned char tlsext_tick_hmac_key[16]; + unsigned char tlsext_tick_aes_key[16]; + /* Callback to support customisation of ticket key setting */ + int (*tlsext_ticket_key_cb)( + SSL* ssl, + unsigned char* name, + unsigned char* iv, + EVP_CIPHER_CTX* ectx, + HMAC_CTX* hctx, + int enc); + + /* certificate status request info */ + /* Callback for status request */ + int (*tlsext_status_cb)(SSL* ssl, void* arg); + void* tlsext_status_arg; + + /* draft-rescorla-tls-opaque-prf-input-00.txt information */ + int (*tlsext_opaque_prf_input_callback)( + SSL*, + void* peerinput, + size_t len, + void* arg); + void* tlsext_opaque_prf_input_callback_arg; +#endif + +#ifndef OPENSSL_NO_PSK + char* psk_identity_hint; + unsigned int (*psk_client_callback)( + SSL* ssl, + const char* hint, + char* identity, + unsigned int max_identity_len, + unsigned char* psk, + unsigned int max_psk_len); + unsigned int (*psk_server_callback)( + SSL* ssl, + const char* identity, + unsigned char* psk, + unsigned int max_psk_len); +#endif + +#ifndef OPENSSL_NO_BUF_FREELISTS +#define SSL_MAX_BUF_FREELIST_LEN_DEFAULT 32 + unsigned int freelist_max_len; + struct ssl3_buf_freelist_st* wbuf_freelist; + struct ssl3_buf_freelist_st* rbuf_freelist; +#endif +#ifndef OPENSSL_NO_SRP + SRP_CTX srp_ctx; /* ctx for SRP authentication */ +#endif + +#ifndef OPENSSL_NO_TLSEXT + +#ifndef OPENSSL_NO_NEXTPROTONEG + /* Next protocol negotiation information */ + /* (for experimental NPN extension). */ + + /* + * For a server, this contains a callback function by which the set of + * advertised protocols can be provided. + */ + int (*next_protos_advertised_cb)( + SSL* s, + const unsigned char** buf, + unsigned int* len, + void* arg); + void* next_protos_advertised_cb_arg; + /* + * For a client, this contains a callback function that selects the next + * protocol from the list provided by the server. + */ + int (*next_proto_select_cb)( + SSL* s, + unsigned char** out, + unsigned char* outlen, + const unsigned char* in, + unsigned int inlen, + void* arg); + void* next_proto_select_cb_arg; +#endif + /* SRTP profiles we are willing to do from RFC 5764 */ + STACK_OF(SRTP_PROTECTION_PROFILE) * srtp_profiles; + + /* + * ALPN information (we are in the process of transitioning from NPN to + * ALPN.) + */ + + /*- + * For a server, this contains a callback function that allows the + * server to select the protocol for the connection. + * out: on successful return, this must point to the raw protocol + * name (without the length prefix). + * outlen: on successful return, this contains the length of |*out|. + * in: points to the client's list of supported protocols in + * wire-format. + * inlen: the length of |in|. + */ + int (*alpn_select_cb)( + SSL* s, + const unsigned char** out, + unsigned char* outlen, + const unsigned char* in, + unsigned int inlen, + void* arg); + void* alpn_select_cb_arg; + + /* + * For a client, this contains the list of supported protocols in wire + * format. + */ + unsigned char* alpn_client_proto_list; + unsigned alpn_client_proto_list_len; + +#ifndef OPENSSL_NO_EC + /* EC extension values inherited by SSL structure */ + size_t tlsext_ecpointformatlist_length; + unsigned char* tlsext_ecpointformatlist; + size_t tlsext_ellipticcurvelist_length; + unsigned char* tlsext_ellipticcurvelist; +#endif /* OPENSSL_NO_EC */ +#endif +}; + +#endif + +#define SSL_SESS_CACHE_OFF 0x0000 +#define SSL_SESS_CACHE_CLIENT 0x0001 +#define SSL_SESS_CACHE_SERVER 0x0002 +#define SSL_SESS_CACHE_BOTH (SSL_SESS_CACHE_CLIENT | SSL_SESS_CACHE_SERVER) +#define SSL_SESS_CACHE_NO_AUTO_CLEAR 0x0080 +/* enough comments already ... see SSL_CTX_set_session_cache_mode(3) */ +#define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP 0x0100 +#define SSL_SESS_CACHE_NO_INTERNAL_STORE 0x0200 +#define SSL_SESS_CACHE_NO_INTERNAL \ + (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP | SSL_SESS_CACHE_NO_INTERNAL_STORE) + +LHASH_OF(SSL_SESSION) * SSL_CTX_sessions(SSL_CTX* ctx); +#define SSL_CTX_sess_number(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_NUMBER, 0, NULL) +#define SSL_CTX_sess_connect(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_CONNECT, 0, NULL) +#define SSL_CTX_sess_connect_good(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_CONNECT_GOOD, 0, NULL) +#define SSL_CTX_sess_connect_renegotiate(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_CONNECT_RENEGOTIATE, 0, NULL) +#define SSL_CTX_sess_accept(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_ACCEPT, 0, NULL) +#define SSL_CTX_sess_accept_renegotiate(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_ACCEPT_RENEGOTIATE, 0, NULL) +#define SSL_CTX_sess_accept_good(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_ACCEPT_GOOD, 0, NULL) +#define SSL_CTX_sess_hits(ctx) SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_HIT, 0, NULL) +#define SSL_CTX_sess_cb_hits(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_CB_HIT, 0, NULL) +#define SSL_CTX_sess_misses(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_MISSES, 0, NULL) +#define SSL_CTX_sess_timeouts(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_TIMEOUTS, 0, NULL) +#define SSL_CTX_sess_cache_full(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_CACHE_FULL, 0, NULL) + +void SSL_CTX_sess_set_new_cb( + SSL_CTX* ctx, + int (*new_session_cb)(struct ssl_st* ssl, SSL_SESSION* sess)); +int (*SSL_CTX_sess_get_new_cb(SSL_CTX* ctx))( + struct ssl_st* ssl, + SSL_SESSION* sess); +void SSL_CTX_sess_set_remove_cb( + SSL_CTX* ctx, + void (*remove_session_cb)(struct ssl_ctx_st* ctx, SSL_SESSION* sess)); +void (*SSL_CTX_sess_get_remove_cb(SSL_CTX* ctx))( + struct ssl_ctx_st* ctx, + SSL_SESSION* sess); +void SSL_CTX_sess_set_get_cb( + SSL_CTX* ctx, + SSL_SESSION* (*get_session_cb)( + struct ssl_st* ssl, + unsigned char* data, + int len, + int* copy)); +SSL_SESSION* (*SSL_CTX_sess_get_get_cb(SSL_CTX* ctx))( + struct ssl_st* ssl, + unsigned char* Data, + int len, + int* copy); +void SSL_CTX_set_info_callback( + SSL_CTX* ctx, + void (*cb)(const SSL* ssl, int type, int val)); +void (*SSL_CTX_get_info_callback(SSL_CTX* ctx))( + const SSL* ssl, + int type, + int val); +void SSL_CTX_set_client_cert_cb( + SSL_CTX* ctx, + int (*client_cert_cb)(SSL* ssl, X509** x509, EVP_PKEY** pkey)); +int (*SSL_CTX_get_client_cert_cb(SSL_CTX* ctx))( + SSL* ssl, + X509** x509, + EVP_PKEY** pkey); +#ifndef OPENSSL_NO_ENGINE +int SSL_CTX_set_client_cert_engine(SSL_CTX* ctx, ENGINE* e); +#endif +void SSL_CTX_set_cookie_generate_cb( + SSL_CTX* ctx, + int (*app_gen_cookie_cb)( + SSL* ssl, + unsigned char* cookie, + unsigned int* cookie_len)); +void SSL_CTX_set_cookie_verify_cb( + SSL_CTX* ctx, + int (*app_verify_cookie_cb)( + SSL* ssl, + unsigned char* cookie, + unsigned int cookie_len)); +#ifndef OPENSSL_NO_NEXTPROTONEG +void SSL_CTX_set_next_protos_advertised_cb( + SSL_CTX* s, + int (*cb)( + SSL* ssl, + const unsigned char** out, + unsigned int* outlen, + void* arg), + void* arg); +void SSL_CTX_set_next_proto_select_cb( + SSL_CTX* s, + int (*cb)( + SSL* ssl, + unsigned char** out, + unsigned char* outlen, + const unsigned char* in, + unsigned int inlen, + void* arg), + void* arg); +void SSL_get0_next_proto_negotiated( + const SSL* s, + const unsigned char** data, + unsigned* len); +#endif + +#ifndef OPENSSL_NO_TLSEXT +int SSL_select_next_proto( + unsigned char** out, + unsigned char* outlen, + const unsigned char* in, + unsigned int inlen, + const unsigned char* client, + unsigned int client_len); +#endif + +#define OPENSSL_NPN_UNSUPPORTED 0 +#define OPENSSL_NPN_NEGOTIATED 1 +#define OPENSSL_NPN_NO_OVERLAP 2 + +int SSL_CTX_set_alpn_protos( + SSL_CTX* ctx, + const unsigned char* protos, + unsigned protos_len); +int SSL_set_alpn_protos( + SSL* ssl, + const unsigned char* protos, + unsigned protos_len); +void SSL_CTX_set_alpn_select_cb( + SSL_CTX* ctx, + int (*cb)( + SSL* ssl, + const unsigned char** out, + unsigned char* outlen, + const unsigned char* in, + unsigned int inlen, + void* arg), + void* arg); +void SSL_get0_alpn_selected( + const SSL* ssl, + const unsigned char** data, + unsigned* len); + +#ifndef OPENSSL_NO_PSK +/* + * the maximum length of the buffer given to callbacks containing the + * resulting identity/psk + */ +#define PSK_MAX_IDENTITY_LEN 128 +#define PSK_MAX_PSK_LEN 256 +void SSL_CTX_set_psk_client_callback( + SSL_CTX* ctx, + unsigned int (*psk_client_callback)( + SSL* ssl, + const char* hint, + char* identity, + unsigned int max_identity_len, + unsigned char* psk, + unsigned int max_psk_len)); +void SSL_set_psk_client_callback( + SSL* ssl, + unsigned int (*psk_client_callback)( + SSL* ssl, + const char* hint, + char* identity, + unsigned int max_identity_len, + unsigned char* psk, + unsigned int max_psk_len)); +void SSL_CTX_set_psk_server_callback( + SSL_CTX* ctx, + unsigned int (*psk_server_callback)( + SSL* ssl, + const char* identity, + unsigned char* psk, + unsigned int max_psk_len)); +void SSL_set_psk_server_callback( + SSL* ssl, + unsigned int (*psk_server_callback)( + SSL* ssl, + const char* identity, + unsigned char* psk, + unsigned int max_psk_len)); +int SSL_CTX_use_psk_identity_hint(SSL_CTX* ctx, const char* identity_hint); +int SSL_use_psk_identity_hint(SSL* s, const char* identity_hint); +const char* SSL_get_psk_identity_hint(const SSL* s); +const char* SSL_get_psk_identity(const SSL* s); +#endif + +#ifndef OPENSSL_NO_TLSEXT +/* Register callbacks to handle custom TLS Extensions for client or server. */ + +int SSL_CTX_add_client_custom_ext( + SSL_CTX* ctx, + unsigned int ext_type, + custom_ext_add_cb add_cb, + custom_ext_free_cb free_cb, + void* add_arg, + custom_ext_parse_cb parse_cb, + void* parse_arg); + +int SSL_CTX_add_server_custom_ext( + SSL_CTX* ctx, + unsigned int ext_type, + custom_ext_add_cb add_cb, + custom_ext_free_cb free_cb, + void* add_arg, + custom_ext_parse_cb parse_cb, + void* parse_arg); + +int SSL_extension_supported(unsigned int ext_type); + +#endif + +#define SSL_NOTHING 1 +#define SSL_WRITING 2 +#define SSL_READING 3 +#define SSL_X509_LOOKUP 4 + +/* These will only be used when doing non-blocking IO */ +#define SSL_want_nothing(s) (SSL_want(s) == SSL_NOTHING) +#define SSL_want_read(s) (SSL_want(s) == SSL_READING) +#define SSL_want_write(s) (SSL_want(s) == SSL_WRITING) +#define SSL_want_x509_lookup(s) (SSL_want(s) == SSL_X509_LOOKUP) + +#define SSL_MAC_FLAG_READ_MAC_STREAM 1 +#define SSL_MAC_FLAG_WRITE_MAC_STREAM 2 + +#ifndef OPENSSL_NO_SSL_INTERN + +struct ssl_st { + /* + * protocol version (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION, + * DTLS1_VERSION) + */ + int version; + /* SSL_ST_CONNECT or SSL_ST_ACCEPT */ + int type; + /* SSLv3 */ + const SSL_METHOD* method; +/* + * There are 2 BIO's even though they are normally both the same. This + * is so data can be read and written to different handlers + */ +#ifndef OPENSSL_NO_BIO + /* used by SSL_read */ + BIO* rbio; + /* used by SSL_write */ + BIO* wbio; + /* used during session-id reuse to concatenate messages */ + BIO* bbio; +#else + /* used by SSL_read */ + char* rbio; + /* used by SSL_write */ + char* wbio; + char* bbio; +#endif + /* + * This holds a variable that indicates what we were doing when a 0 or -1 + * is returned. This is needed for non-blocking IO so we know what + * request needs re-doing when in SSL_accept or SSL_connect + */ + int rwstate; + /* true when we are actually in SSL_accept() or SSL_connect() */ + int in_handshake; + int (*handshake_func)(SSL*); + /* + * Imagine that here's a boolean member "init" that is switched as soon + * as SSL_set_{accept/connect}_state is called for the first time, so + * that "state" and "handshake_func" are properly initialized. But as + * handshake_func is == 0 until then, we use this test instead of an + * "init" member. + */ + /* are we the server side? - mostly used by SSL_clear */ + int server; + /* + * Generate a new session or reuse an old one. + * NB: For servers, the 'new' session may actually be a previously + * cached session or even the previous session unless + * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION is set + */ + int new_session; + /* don't send shutdown packets */ + int quiet_shutdown; + /* we have shut things down, 0x01 sent, 0x02 for received */ + int shutdown; + /* where we are */ + int state; + /* where we are when reading */ + int rstate; + BUF_MEM* init_buf; /* buffer used during init */ + void* init_msg; /* pointer to handshake message body, set by + * ssl3_get_message() */ + int init_num; /* amount read/written */ + int init_off; /* amount read/written */ + /* used internally to point at a raw packet */ + unsigned char* packet; + unsigned int packet_length; + struct ssl2_state_st* s2; /* SSLv2 variables */ + struct ssl3_state_st* s3; /* SSLv3 variables */ + struct dtls1_state_st* d1; /* DTLSv1 variables */ + int read_ahead; /* Read as many input bytes as possible (for + * non-blocking reads) */ + /* callback that allows applications to peek at protocol messages */ + void (*msg_callback)( + int write_p, + int version, + int content_type, + const void* buf, + size_t len, + SSL* ssl, + void* arg); + void* msg_callback_arg; + int hit; /* reusing a previous session */ + X509_VERIFY_PARAM* param; +#if 0 + int purpose; /* Purpose setting */ + int trust; /* Trust setting */ +#endif + /* crypto */ + STACK_OF(SSL_CIPHER) * cipher_list; + STACK_OF(SSL_CIPHER) * cipher_list_by_id; + /* + * These are the ones being used, the ones in SSL_SESSION are the ones to + * be 'copied' into these ones + */ + int mac_flags; + EVP_CIPHER_CTX* enc_read_ctx; /* cryptographic state */ + EVP_MD_CTX* read_hash; /* used for mac generation */ +#ifndef OPENSSL_NO_COMP + COMP_CTX* expand; /* uncompress */ +#else + char* expand; +#endif + EVP_CIPHER_CTX* enc_write_ctx; /* cryptographic state */ + EVP_MD_CTX* write_hash; /* used for mac generation */ +#ifndef OPENSSL_NO_COMP + COMP_CTX* compress; /* compression */ +#else + char* compress; +#endif + /* session info */ + /* client cert? */ + /* This is used to hold the server certificate used */ + struct cert_st /* CERT */* cert; + /* + * the session_id_context is used to ensure sessions are only reused in + * the appropriate context + */ + unsigned int sid_ctx_length; + unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH]; + /* This can also be in the session once a session is established */ + SSL_SESSION* session; + /* Default generate session ID callback. */ + GEN_SESSION_CB generate_session_id; + /* Used in SSL2 and SSL3 */ + /* + * 0 don't care about verify failure. + * 1 fail if verify fails + */ + int verify_mode; + /* fail if callback returns 0 */ + int (*verify_callback)(int ok, X509_STORE_CTX* ctx); + /* optional informational callback */ + void (*info_callback)(const SSL* ssl, int type, int val); + /* error bytes to be written */ + int error; + /* actual code */ + int error_code; +#ifndef OPENSSL_NO_KRB5 + /* Kerberos 5 context */ + KSSL_CTX* kssl_ctx; +#endif /* OPENSSL_NO_KRB5 */ +#ifndef OPENSSL_NO_PSK + unsigned int (*psk_client_callback)( + SSL* ssl, + const char* hint, + char* identity, + unsigned int max_identity_len, + unsigned char* psk, + unsigned int max_psk_len); + unsigned int (*psk_server_callback)( + SSL* ssl, + const char* identity, + unsigned char* psk, + unsigned int max_psk_len); +#endif + SSL_CTX* ctx; + /* + * set this flag to 1 and a sleep(1) is put into all SSL_read() and + * SSL_write() calls, good for nbio debuging :-) + */ + int debug; + /* extra application data */ + long verify_result; + CRYPTO_EX_DATA ex_data; + /* for server side, keep the list of CA_dn we can use */ + STACK_OF(X509_NAME) * client_CA; + int references; + /* protocol behaviour */ + unsigned long options; + /* API behaviour */ + unsigned long mode; + long max_cert_list; + int first_packet; + /* what was passed, used for SSLv3/TLS rollback check */ + int client_version; + unsigned int max_send_fragment; +#ifndef OPENSSL_NO_TLSEXT + /* TLS extension debug callback */ + void (*tlsext_debug_cb)( + SSL* s, + int client_server, + int type, + unsigned char* data, + int len, + void* arg); + void* tlsext_debug_arg; + char* tlsext_hostname; + /*- + * no further mod of servername + * 0 : call the servername extension callback. + * 1 : prepare 2, allow last ack just after in server callback. + * 2 : don't call servername callback, no ack in server hello + */ + int servername_done; + /* certificate status request info */ + /* Status type or -1 if no status type */ + int tlsext_status_type; + /* Expect OCSP CertificateStatus message */ + int tlsext_status_expected; + /* OCSP status request only */ + STACK_OF(OCSP_RESPID) * tlsext_ocsp_ids; + X509_EXTENSIONS* tlsext_ocsp_exts; + /* OCSP response received or to be sent */ + unsigned char* tlsext_ocsp_resp; + int tlsext_ocsp_resplen; + /* RFC4507 session ticket expected to be received or sent */ + int tlsext_ticket_expected; +#ifndef OPENSSL_NO_EC + size_t tlsext_ecpointformatlist_length; + /* our list */ + unsigned char* tlsext_ecpointformatlist; + size_t tlsext_ellipticcurvelist_length; + /* our list */ + unsigned char* tlsext_ellipticcurvelist; +#endif /* OPENSSL_NO_EC */ + /* + * draft-rescorla-tls-opaque-prf-input-00.txt information to be used for + * handshakes + */ + void* tlsext_opaque_prf_input; + size_t tlsext_opaque_prf_input_len; + /* TLS Session Ticket extension override */ + TLS_SESSION_TICKET_EXT* tlsext_session_ticket; + /* TLS Session Ticket extension callback */ + tls_session_ticket_ext_cb_fn tls_session_ticket_ext_cb; + void* tls_session_ticket_ext_cb_arg; + /* TLS pre-shared secret session resumption */ + tls_session_secret_cb_fn tls_session_secret_cb; + void* tls_session_secret_cb_arg; + SSL_CTX* initial_ctx; /* initial ctx, used to store sessions */ +#ifndef OPENSSL_NO_NEXTPROTONEG + /* + * Next protocol negotiation. For the client, this is the protocol that + * we sent in NextProtocol and is set when handling ServerHello + * extensions. For a server, this is the client's selected_protocol from + * NextProtocol and is set when handling the NextProtocol message, before + * the Finished message. + */ + unsigned char* next_proto_negotiated; + unsigned char next_proto_negotiated_len; +#endif +#define session_ctx initial_ctx + /* What we'll do */ + STACK_OF(SRTP_PROTECTION_PROFILE) * srtp_profiles; + /* What's been chosen */ + SRTP_PROTECTION_PROFILE* srtp_profile; + /*- + * Is use of the Heartbeat extension negotiated? + * 0: disabled + * 1: enabled + * 2: enabled, but not allowed to send Requests + */ + unsigned int tlsext_heartbeat; + /* Indicates if a HeartbeatRequest is in flight */ + unsigned int tlsext_hb_pending; + /* HeartbeatRequest sequence number */ + unsigned int tlsext_hb_seq; +#else +#define session_ctx ctx +#endif /* OPENSSL_NO_TLSEXT */ + /*- + * 1 if we are renegotiating. + * 2 if we are a server and are inside a handshake + * (i.e. not just sending a HelloRequest) + */ + int renegotiate; +#ifndef OPENSSL_NO_SRP + /* ctx for SRP authentication */ + SRP_CTX srp_ctx; +#endif +#ifndef OPENSSL_NO_TLSEXT + /* + * For a client, this contains the list of supported protocols in wire + * format. + */ + unsigned char* alpn_client_proto_list; + unsigned alpn_client_proto_list_len; +#endif /* OPENSSL_NO_TLSEXT */ +}; + +#endif + +#ifdef __cplusplus +} +#endif + +#include /* Datagram TLS */ +#include /* Support for the use_srtp extension */ +#include +#include +#include +#include /* This is mostly sslv3 with a few tweaks */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* compatibility */ +#define SSL_set_app_data(s, arg) (SSL_set_ex_data(s, 0, (char*)arg)) +#define SSL_get_app_data(s) (SSL_get_ex_data(s, 0)) +#define SSL_SESSION_set_app_data(s, a) (SSL_SESSION_set_ex_data(s, 0, (char*)a)) +#define SSL_SESSION_get_app_data(s) (SSL_SESSION_get_ex_data(s, 0)) +#define SSL_CTX_get_app_data(ctx) (SSL_CTX_get_ex_data(ctx, 0)) +#define SSL_CTX_set_app_data(ctx, arg) (SSL_CTX_set_ex_data(ctx, 0, (char*)arg)) + +/* + * The following are the possible values for ssl->state are are used to + * indicate where we are up to in the SSL connection establishment. The + * macros that follow are about the only things you should need to use and + * even then, only when using non-blocking IO. It can also be useful to work + * out where you were when the connection failed + */ + +#define SSL_ST_CONNECT 0x1000 +#define SSL_ST_ACCEPT 0x2000 +#define SSL_ST_MASK 0x0FFF +#define SSL_ST_INIT (SSL_ST_CONNECT | SSL_ST_ACCEPT) +#define SSL_ST_BEFORE 0x4000 +#define SSL_ST_OK 0x03 +#define SSL_ST_RENEGOTIATE (0x04 | SSL_ST_INIT) +#define SSL_ST_ERR (0x05 | SSL_ST_INIT) + +#define SSL_CB_LOOP 0x01 +#define SSL_CB_EXIT 0x02 +#define SSL_CB_READ 0x04 +#define SSL_CB_WRITE 0x08 +#define SSL_CB_ALERT 0x4000 /* used in callback */ +#define SSL_CB_READ_ALERT (SSL_CB_ALERT | SSL_CB_READ) +#define SSL_CB_WRITE_ALERT (SSL_CB_ALERT | SSL_CB_WRITE) +#define SSL_CB_ACCEPT_LOOP (SSL_ST_ACCEPT | SSL_CB_LOOP) +#define SSL_CB_ACCEPT_EXIT (SSL_ST_ACCEPT | SSL_CB_EXIT) +#define SSL_CB_CONNECT_LOOP (SSL_ST_CONNECT | SSL_CB_LOOP) +#define SSL_CB_CONNECT_EXIT (SSL_ST_CONNECT | SSL_CB_EXIT) +#define SSL_CB_HANDSHAKE_START 0x10 +#define SSL_CB_HANDSHAKE_DONE 0x20 + +/* Is the SSL_connection established? */ +#define SSL_get_state(a) SSL_state(a) +#define SSL_is_init_finished(a) (SSL_state(a) == SSL_ST_OK) +#define SSL_in_init(a) (SSL_state(a) & SSL_ST_INIT) +#define SSL_in_before(a) (SSL_state(a) & SSL_ST_BEFORE) +#define SSL_in_connect_init(a) (SSL_state(a) & SSL_ST_CONNECT) +#define SSL_in_accept_init(a) (SSL_state(a) & SSL_ST_ACCEPT) + +/* + * The following 2 states are kept in ssl->rstate when reads fail, you should + * not need these + */ +#define SSL_ST_READ_HEADER 0xF0 +#define SSL_ST_READ_BODY 0xF1 +#define SSL_ST_READ_DONE 0xF2 + +/*- + * Obtain latest Finished message + * -- that we sent (SSL_get_finished) + * -- that we expected from peer (SSL_get_peer_finished). + * Returns length (0 == no Finished so far), copies up to 'count' bytes. + */ +size_t SSL_get_finished(const SSL* s, void* buf, size_t count); +size_t SSL_get_peer_finished(const SSL* s, void* buf, size_t count); + +/* + * use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 2 options are + * 'ored' with SSL_VERIFY_PEER if they are desired + */ +#define SSL_VERIFY_NONE 0x00 +#define SSL_VERIFY_PEER 0x01 +#define SSL_VERIFY_FAIL_IF_NO_PEER_CERT 0x02 +#define SSL_VERIFY_CLIENT_ONCE 0x04 + +#define OpenSSL_add_ssl_algorithms() SSL_library_init() +#define SSLeay_add_ssl_algorithms() SSL_library_init() + +/* this is for backward compatibility */ +#if 0 /* NEW_SSLEAY */ +#define SSL_CTX_set_default_verify(a, b, c) SSL_CTX_set_verify(a, b, c) +#define SSL_set_pref_cipher(c, n) SSL_set_cipher_list(c, n) +#define SSL_add_session(a, b) SSL_CTX_add_session((a), (b)) +#define SSL_remove_session(a, b) SSL_CTX_remove_session((a), (b)) +#define SSL_flush_sessions(a, b) SSL_CTX_flush_sessions((a), (b)) +#endif +/* More backward compatibility */ +#define SSL_get_cipher(s) SSL_CIPHER_get_name(SSL_get_current_cipher(s)) +#define SSL_get_cipher_bits(s, np) \ + SSL_CIPHER_get_bits(SSL_get_current_cipher(s), np) +#define SSL_get_cipher_version(s) \ + SSL_CIPHER_get_version(SSL_get_current_cipher(s)) +#define SSL_get_cipher_name(s) SSL_CIPHER_get_name(SSL_get_current_cipher(s)) +#define SSL_get_time(a) SSL_SESSION_get_time(a) +#define SSL_set_time(a, b) SSL_SESSION_set_time((a), (b)) +#define SSL_get_timeout(a) SSL_SESSION_get_timeout(a) +#define SSL_set_timeout(a, b) SSL_SESSION_set_timeout((a), (b)) + +#define d2i_SSL_SESSION_bio(bp, s_id) \ + ASN1_d2i_bio_of(SSL_SESSION, SSL_SESSION_new, d2i_SSL_SESSION, bp, s_id) +#define i2d_SSL_SESSION_bio(bp, s_id) \ + ASN1_i2d_bio_of(SSL_SESSION, i2d_SSL_SESSION, bp, s_id) + +DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION) +#define SSL_AD_REASON_OFFSET \ + 1000 /* offset to get SSL_R_... value \ + * from SSL_AD_... */ +/* These alert types are for SSLv3 and TLSv1 */ +#define SSL_AD_CLOSE_NOTIFY SSL3_AD_CLOSE_NOTIFY +/* fatal */ +#define SSL_AD_UNEXPECTED_MESSAGE SSL3_AD_UNEXPECTED_MESSAGE +/* fatal */ +#define SSL_AD_BAD_RECORD_MAC SSL3_AD_BAD_RECORD_MAC +#define SSL_AD_DECRYPTION_FAILED TLS1_AD_DECRYPTION_FAILED +#define SSL_AD_RECORD_OVERFLOW TLS1_AD_RECORD_OVERFLOW +/* fatal */ +#define SSL_AD_DECOMPRESSION_FAILURE SSL3_AD_DECOMPRESSION_FAILURE +/* fatal */ +#define SSL_AD_HANDSHAKE_FAILURE SSL3_AD_HANDSHAKE_FAILURE +/* Not for TLS */ +#define SSL_AD_NO_CERTIFICATE SSL3_AD_NO_CERTIFICATE +#define SSL_AD_BAD_CERTIFICATE SSL3_AD_BAD_CERTIFICATE +#define SSL_AD_UNSUPPORTED_CERTIFICATE SSL3_AD_UNSUPPORTED_CERTIFICATE +#define SSL_AD_CERTIFICATE_REVOKED SSL3_AD_CERTIFICATE_REVOKED +#define SSL_AD_CERTIFICATE_EXPIRED SSL3_AD_CERTIFICATE_EXPIRED +#define SSL_AD_CERTIFICATE_UNKNOWN SSL3_AD_CERTIFICATE_UNKNOWN +/* fatal */ +#define SSL_AD_ILLEGAL_PARAMETER SSL3_AD_ILLEGAL_PARAMETER +/* fatal */ +#define SSL_AD_UNKNOWN_CA TLS1_AD_UNKNOWN_CA +/* fatal */ +#define SSL_AD_ACCESS_DENIED TLS1_AD_ACCESS_DENIED +/* fatal */ +#define SSL_AD_DECODE_ERROR TLS1_AD_DECODE_ERROR +#define SSL_AD_DECRYPT_ERROR TLS1_AD_DECRYPT_ERROR +/* fatal */ +#define SSL_AD_EXPORT_RESTRICTION TLS1_AD_EXPORT_RESTRICTION +/* fatal */ +#define SSL_AD_PROTOCOL_VERSION TLS1_AD_PROTOCOL_VERSION +/* fatal */ +#define SSL_AD_INSUFFICIENT_SECURITY TLS1_AD_INSUFFICIENT_SECURITY +/* fatal */ +#define SSL_AD_INTERNAL_ERROR TLS1_AD_INTERNAL_ERROR +#define SSL_AD_USER_CANCELLED TLS1_AD_USER_CANCELLED +#define SSL_AD_NO_RENEGOTIATION TLS1_AD_NO_RENEGOTIATION +#define SSL_AD_UNSUPPORTED_EXTENSION TLS1_AD_UNSUPPORTED_EXTENSION +#define SSL_AD_CERTIFICATE_UNOBTAINABLE TLS1_AD_CERTIFICATE_UNOBTAINABLE +#define SSL_AD_UNRECOGNIZED_NAME TLS1_AD_UNRECOGNIZED_NAME +#define SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE \ + TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE +#define SSL_AD_BAD_CERTIFICATE_HASH_VALUE TLS1_AD_BAD_CERTIFICATE_HASH_VALUE +/* fatal */ +#define SSL_AD_UNKNOWN_PSK_IDENTITY TLS1_AD_UNKNOWN_PSK_IDENTITY +/* fatal */ +#define SSL_AD_INAPPROPRIATE_FALLBACK TLS1_AD_INAPPROPRIATE_FALLBACK +#define SSL_ERROR_NONE 0 +#define SSL_ERROR_SSL 1 +#define SSL_ERROR_WANT_READ 2 +#define SSL_ERROR_WANT_WRITE 3 +#define SSL_ERROR_WANT_X509_LOOKUP 4 +#define SSL_ERROR_SYSCALL \ + 5 /* look at error stack/return \ + * value/errno */ +#define SSL_ERROR_ZERO_RETURN 6 +#define SSL_ERROR_WANT_CONNECT 7 +#define SSL_ERROR_WANT_ACCEPT 8 +#define SSL_CTRL_NEED_TMP_RSA 1 +#define SSL_CTRL_SET_TMP_RSA 2 +#define SSL_CTRL_SET_TMP_DH 3 +#define SSL_CTRL_SET_TMP_ECDH 4 +#define SSL_CTRL_SET_TMP_RSA_CB 5 +#define SSL_CTRL_SET_TMP_DH_CB 6 +#define SSL_CTRL_SET_TMP_ECDH_CB 7 +#define SSL_CTRL_GET_SESSION_REUSED 8 +#define SSL_CTRL_GET_CLIENT_CERT_REQUEST 9 +#define SSL_CTRL_GET_NUM_RENEGOTIATIONS 10 +#define SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS 11 +#define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS 12 +#define SSL_CTRL_GET_FLAGS 13 +#define SSL_CTRL_EXTRA_CHAIN_CERT 14 +#define SSL_CTRL_SET_MSG_CALLBACK 15 +#define SSL_CTRL_SET_MSG_CALLBACK_ARG 16 +/* only applies to datagram connections */ +#define SSL_CTRL_SET_MTU 17 +/* Stats */ +#define SSL_CTRL_SESS_NUMBER 20 +#define SSL_CTRL_SESS_CONNECT 21 +#define SSL_CTRL_SESS_CONNECT_GOOD 22 +#define SSL_CTRL_SESS_CONNECT_RENEGOTIATE 23 +#define SSL_CTRL_SESS_ACCEPT 24 +#define SSL_CTRL_SESS_ACCEPT_GOOD 25 +#define SSL_CTRL_SESS_ACCEPT_RENEGOTIATE 26 +#define SSL_CTRL_SESS_HIT 27 +#define SSL_CTRL_SESS_CB_HIT 28 +#define SSL_CTRL_SESS_MISSES 29 +#define SSL_CTRL_SESS_TIMEOUTS 30 +#define SSL_CTRL_SESS_CACHE_FULL 31 +#define SSL_CTRL_OPTIONS 32 +#define SSL_CTRL_MODE 33 +#define SSL_CTRL_GET_READ_AHEAD 40 +#define SSL_CTRL_SET_READ_AHEAD 41 +#define SSL_CTRL_SET_SESS_CACHE_SIZE 42 +#define SSL_CTRL_GET_SESS_CACHE_SIZE 43 +#define SSL_CTRL_SET_SESS_CACHE_MODE 44 +#define SSL_CTRL_GET_SESS_CACHE_MODE 45 +#define SSL_CTRL_GET_MAX_CERT_LIST 50 +#define SSL_CTRL_SET_MAX_CERT_LIST 51 +#define SSL_CTRL_SET_MAX_SEND_FRAGMENT 52 +/* see tls1.h for macros based on these */ +#ifndef OPENSSL_NO_TLSEXT +#define SSL_CTRL_SET_TLSEXT_SERVERNAME_CB 53 +#define SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG 54 +#define SSL_CTRL_SET_TLSEXT_HOSTNAME 55 +#define SSL_CTRL_SET_TLSEXT_DEBUG_CB 56 +#define SSL_CTRL_SET_TLSEXT_DEBUG_ARG 57 +#define SSL_CTRL_GET_TLSEXT_TICKET_KEYS 58 +#define SSL_CTRL_SET_TLSEXT_TICKET_KEYS 59 +#define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT 60 +#define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB 61 +#define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG 62 +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB 63 +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG 64 +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE 65 +#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS 66 +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS 67 +#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS 68 +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS 69 +#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP 70 +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP 71 +#define SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB 72 +#define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB 75 +#define SSL_CTRL_SET_SRP_VERIFY_PARAM_CB 76 +#define SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB 77 +#define SSL_CTRL_SET_SRP_ARG 78 +#define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME 79 +#define SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH 80 +#define SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD 81 +#ifndef OPENSSL_NO_HEARTBEATS +#define SSL_CTRL_TLS_EXT_SEND_HEARTBEAT 85 +#define SSL_CTRL_GET_TLS_EXT_HEARTBEAT_PENDING 86 +#define SSL_CTRL_SET_TLS_EXT_HEARTBEAT_NO_REQUESTS 87 +#endif +#endif /* OPENSSL_NO_TLSEXT */ +#define DTLS_CTRL_GET_TIMEOUT 73 +#define DTLS_CTRL_HANDLE_TIMEOUT 74 +#define DTLS_CTRL_LISTEN 75 +#define SSL_CTRL_GET_RI_SUPPORT 76 +#define SSL_CTRL_CLEAR_OPTIONS 77 +#define SSL_CTRL_CLEAR_MODE 78 +#define SSL_CTRL_GET_EXTRA_CHAIN_CERTS 82 +#define SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS 83 +#define SSL_CTRL_CHAIN 88 +#define SSL_CTRL_CHAIN_CERT 89 +#define SSL_CTRL_GET_CURVES 90 +#define SSL_CTRL_SET_CURVES 91 +#define SSL_CTRL_SET_CURVES_LIST 92 +#define SSL_CTRL_GET_SHARED_CURVE 93 +#define SSL_CTRL_SET_ECDH_AUTO 94 +#define SSL_CTRL_SET_SIGALGS 97 +#define SSL_CTRL_SET_SIGALGS_LIST 98 +#define SSL_CTRL_CERT_FLAGS 99 +#define SSL_CTRL_CLEAR_CERT_FLAGS 100 +#define SSL_CTRL_SET_CLIENT_SIGALGS 101 +#define SSL_CTRL_SET_CLIENT_SIGALGS_LIST 102 +#define SSL_CTRL_GET_CLIENT_CERT_TYPES 103 +#define SSL_CTRL_SET_CLIENT_CERT_TYPES 104 +#define SSL_CTRL_BUILD_CERT_CHAIN 105 +#define SSL_CTRL_SET_VERIFY_CERT_STORE 106 +#define SSL_CTRL_SET_CHAIN_CERT_STORE 107 +#define SSL_CTRL_GET_PEER_SIGNATURE_NID 108 +#define SSL_CTRL_GET_SERVER_TMP_KEY 109 +#define SSL_CTRL_GET_RAW_CIPHERLIST 110 +#define SSL_CTRL_GET_EC_POINT_FORMATS 111 +#define SSL_CTRL_GET_CHAIN_CERTS 115 +#define SSL_CTRL_SELECT_CURRENT_CERT 116 +#define SSL_CTRL_SET_CURRENT_CERT 117 +#define SSL_CTRL_CHECK_PROTO_VERSION 119 +#define DTLS_CTRL_SET_LINK_MTU 120 +#define DTLS_CTRL_GET_LINK_MIN_MTU 121 +#define SSL_CERT_SET_FIRST 1 +#define SSL_CERT_SET_NEXT 2 +#define SSL_CERT_SET_SERVER 3 +#define DTLSv1_get_timeout(ssl, arg) \ + SSL_ctrl(ssl, DTLS_CTRL_GET_TIMEOUT, 0, (void*)arg) +#define DTLSv1_handle_timeout(ssl) \ + SSL_ctrl(ssl, DTLS_CTRL_HANDLE_TIMEOUT, 0, NULL) +#define DTLSv1_listen(ssl, peer) SSL_ctrl(ssl, DTLS_CTRL_LISTEN, 0, (void*)peer) +#define SSL_session_reused(ssl) \ + SSL_ctrl((ssl), SSL_CTRL_GET_SESSION_REUSED, 0, NULL) +#define SSL_num_renegotiations(ssl) \ + SSL_ctrl((ssl), SSL_CTRL_GET_NUM_RENEGOTIATIONS, 0, NULL) +#define SSL_clear_num_renegotiations(ssl) \ + SSL_ctrl((ssl), SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS, 0, NULL) +#define SSL_total_renegotiations(ssl) \ + SSL_ctrl((ssl), SSL_CTRL_GET_TOTAL_RENEGOTIATIONS, 0, NULL) +#define SSL_CTX_need_tmp_RSA(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_NEED_TMP_RSA, 0, NULL) +#define SSL_CTX_set_tmp_rsa(ctx, rsa) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_TMP_RSA, 0, (char*)rsa) +#define SSL_CTX_set_tmp_dh(ctx, dh) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_TMP_DH, 0, (char*)dh) +#define SSL_CTX_set_tmp_ecdh(ctx, ecdh) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_TMP_ECDH, 0, (char*)ecdh) +#define SSL_need_tmp_RSA(ssl) SSL_ctrl(ssl, SSL_CTRL_NEED_TMP_RSA, 0, NULL) +#define SSL_set_tmp_rsa(ssl, rsa) \ + SSL_ctrl(ssl, SSL_CTRL_SET_TMP_RSA, 0, (char*)rsa) +#define SSL_set_tmp_dh(ssl, dh) SSL_ctrl(ssl, SSL_CTRL_SET_TMP_DH, 0, (char*)dh) +#define SSL_set_tmp_ecdh(ssl, ecdh) \ + SSL_ctrl(ssl, SSL_CTRL_SET_TMP_ECDH, 0, (char*)ecdh) +#define SSL_CTX_add_extra_chain_cert(ctx, x509) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_EXTRA_CHAIN_CERT, 0, (char*)x509) +#define SSL_CTX_get_extra_chain_certs(ctx, px509) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_EXTRA_CHAIN_CERTS, 0, px509) +#define SSL_CTX_get_extra_chain_certs_only(ctx, px509) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_EXTRA_CHAIN_CERTS, 1, px509) +#define SSL_CTX_clear_extra_chain_certs(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS, 0, NULL) +#define SSL_CTX_set0_chain(ctx, sk) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_CHAIN, 0, (char*)sk) +#define SSL_CTX_set1_chain(ctx, sk) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_CHAIN, 1, (char*)sk) +#define SSL_CTX_add0_chain_cert(ctx, x509) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_CHAIN_CERT, 0, (char*)x509) +#define SSL_CTX_add1_chain_cert(ctx, x509) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_CHAIN_CERT, 1, (char*)x509) +#define SSL_CTX_get0_chain_certs(ctx, px509) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_CHAIN_CERTS, 0, px509) +#define SSL_CTX_clear_chain_certs(ctx) SSL_CTX_set0_chain(ctx, NULL) +#define SSL_CTX_build_cert_chain(ctx, flags) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL) +#define SSL_CTX_select_current_cert(ctx, x509) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SELECT_CURRENT_CERT, 0, (char*)x509) +#define SSL_CTX_set_current_cert(ctx, op) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_CURRENT_CERT, op, NULL) +#define SSL_CTX_set0_verify_cert_store(ctx, st) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_VERIFY_CERT_STORE, 0, (char*)st) +#define SSL_CTX_set1_verify_cert_store(ctx, st) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_VERIFY_CERT_STORE, 1, (char*)st) +#define SSL_CTX_set0_chain_cert_store(ctx, st) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_CHAIN_CERT_STORE, 0, (char*)st) +#define SSL_CTX_set1_chain_cert_store(ctx, st) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_CHAIN_CERT_STORE, 1, (char*)st) +#define SSL_set0_chain(ctx, sk) SSL_ctrl(ctx, SSL_CTRL_CHAIN, 0, (char*)sk) +#define SSL_set1_chain(ctx, sk) SSL_ctrl(ctx, SSL_CTRL_CHAIN, 1, (char*)sk) +#define SSL_add0_chain_cert(ctx, x509) \ + SSL_ctrl(ctx, SSL_CTRL_CHAIN_CERT, 0, (char*)x509) +#define SSL_add1_chain_cert(ctx, x509) \ + SSL_ctrl(ctx, SSL_CTRL_CHAIN_CERT, 1, (char*)x509) +#define SSL_get0_chain_certs(ctx, px509) \ + SSL_ctrl(ctx, SSL_CTRL_GET_CHAIN_CERTS, 0, px509) +#define SSL_clear_chain_certs(ctx) SSL_set0_chain(ctx, NULL) +#define SSL_build_cert_chain(s, flags) \ + SSL_ctrl(s, SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL) +#define SSL_select_current_cert(ctx, x509) \ + SSL_ctrl(ctx, SSL_CTRL_SELECT_CURRENT_CERT, 0, (char*)x509) +#define SSL_set_current_cert(ctx, op) \ + SSL_ctrl(ctx, SSL_CTRL_SET_CURRENT_CERT, op, NULL) +#define SSL_set0_verify_cert_store(s, st) \ + SSL_ctrl(s, SSL_CTRL_SET_VERIFY_CERT_STORE, 0, (char*)st) +#define SSL_set1_verify_cert_store(s, st) \ + SSL_ctrl(s, SSL_CTRL_SET_VERIFY_CERT_STORE, 1, (char*)st) +#define SSL_set0_chain_cert_store(s, st) \ + SSL_ctrl(s, SSL_CTRL_SET_CHAIN_CERT_STORE, 0, (char*)st) +#define SSL_set1_chain_cert_store(s, st) \ + SSL_ctrl(s, SSL_CTRL_SET_CHAIN_CERT_STORE, 1, (char*)st) +#define SSL_get1_curves(ctx, s) SSL_ctrl(ctx, SSL_CTRL_GET_CURVES, 0, (char*)s) +#define SSL_CTX_set1_curves(ctx, clist, clistlen) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_CURVES, clistlen, (char*)clist) +#define SSL_CTX_set1_curves_list(ctx, s) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_CURVES_LIST, 0, (char*)s) +#define SSL_set1_curves(ctx, clist, clistlen) \ + SSL_ctrl(ctx, SSL_CTRL_SET_CURVES, clistlen, (char*)clist) +#define SSL_set1_curves_list(ctx, s) \ + SSL_ctrl(ctx, SSL_CTRL_SET_CURVES_LIST, 0, (char*)s) +#define SSL_get_shared_curve(s, n) \ + SSL_ctrl(s, SSL_CTRL_GET_SHARED_CURVE, n, NULL) +#define SSL_CTX_set_ecdh_auto(ctx, onoff) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_ECDH_AUTO, onoff, NULL) +#define SSL_set_ecdh_auto(s, onoff) \ + SSL_ctrl(s, SSL_CTRL_SET_ECDH_AUTO, onoff, NULL) +#define SSL_CTX_set1_sigalgs(ctx, slist, slistlen) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_SIGALGS, slistlen, (int*)slist) +#define SSL_CTX_set1_sigalgs_list(ctx, s) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_SIGALGS_LIST, 0, (char*)s) +#define SSL_set1_sigalgs(ctx, slist, slistlen) \ + SSL_ctrl(ctx, SSL_CTRL_SET_SIGALGS, slistlen, (int*)slist) +#define SSL_set1_sigalgs_list(ctx, s) \ + SSL_ctrl(ctx, SSL_CTRL_SET_SIGALGS_LIST, 0, (char*)s) +#define SSL_CTX_set1_client_sigalgs(ctx, slist, slistlen) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_CLIENT_SIGALGS, slistlen, (int*)slist) +#define SSL_CTX_set1_client_sigalgs_list(ctx, s) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_CLIENT_SIGALGS_LIST, 0, (char*)s) +#define SSL_set1_client_sigalgs(ctx, slist, slistlen) \ + SSL_ctrl(ctx, SSL_CTRL_SET_CLIENT_SIGALGS, clistlen, (int*)slist) +#define SSL_set1_client_sigalgs_list(ctx, s) \ + SSL_ctrl(ctx, SSL_CTRL_SET_CLIENT_SIGALGS_LIST, 0, (char*)s) +#define SSL_get0_certificate_types(s, clist) \ + SSL_ctrl(s, SSL_CTRL_GET_CLIENT_CERT_TYPES, 0, (char*)clist) +#define SSL_CTX_set1_client_certificate_types(ctx, clist, clistlen) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_CLIENT_CERT_TYPES, clistlen, (char*)clist) +#define SSL_set1_client_certificate_types(s, clist, clistlen) \ + SSL_ctrl(s, SSL_CTRL_SET_CLIENT_CERT_TYPES, clistlen, (char*)clist) +#define SSL_get_peer_signature_nid(s, pn) \ + SSL_ctrl(s, SSL_CTRL_GET_PEER_SIGNATURE_NID, 0, pn) +#define SSL_get_server_tmp_key(s, pk) \ + SSL_ctrl(s, SSL_CTRL_GET_SERVER_TMP_KEY, 0, pk) +#define SSL_get0_raw_cipherlist(s, plst) \ + SSL_ctrl(s, SSL_CTRL_GET_RAW_CIPHERLIST, 0, (char*)plst) +#define SSL_get0_ec_point_formats(s, plst) \ + SSL_ctrl(s, SSL_CTRL_GET_EC_POINT_FORMATS, 0, (char*)plst) +#ifndef OPENSSL_NO_BIO + BIO_METHOD* BIO_f_ssl(void); +BIO* BIO_new_ssl(SSL_CTX* ctx, int client); +BIO* BIO_new_ssl_connect(SSL_CTX* ctx); +BIO* BIO_new_buffer_ssl_connect(SSL_CTX* ctx); +int BIO_ssl_copy_session_id(BIO* to, BIO* from); +void BIO_ssl_shutdown(BIO* ssl_bio); + +#endif + +int SSL_CTX_set_cipher_list(SSL_CTX*, const char* str); +SSL_CTX* SSL_CTX_new(const SSL_METHOD* meth); +void SSL_CTX_free(SSL_CTX*); +long SSL_CTX_set_timeout(SSL_CTX* ctx, long t); +long SSL_CTX_get_timeout(const SSL_CTX* ctx); +X509_STORE* SSL_CTX_get_cert_store(const SSL_CTX*); +void SSL_CTX_set_cert_store(SSL_CTX*, X509_STORE*); +int SSL_want(const SSL* s); +int SSL_clear(SSL* s); + +void SSL_CTX_flush_sessions(SSL_CTX* ctx, long tm); + +const SSL_CIPHER* SSL_get_current_cipher(const SSL* s); +int SSL_CIPHER_get_bits(const SSL_CIPHER* c, int* alg_bits); +char* SSL_CIPHER_get_version(const SSL_CIPHER* c); +const char* SSL_CIPHER_get_name(const SSL_CIPHER* c); +unsigned long SSL_CIPHER_get_id(const SSL_CIPHER* c); + +int SSL_get_fd(const SSL* s); +int SSL_get_rfd(const SSL* s); +int SSL_get_wfd(const SSL* s); +const char* SSL_get_cipher_list(const SSL* s, int n); +char* SSL_get_shared_ciphers(const SSL* s, char* buf, int len); +int SSL_get_read_ahead(const SSL* s); +int SSL_pending(const SSL* s); +#ifndef OPENSSL_NO_SOCK +int SSL_set_fd(SSL* s, int fd); +int SSL_set_rfd(SSL* s, int fd); +int SSL_set_wfd(SSL* s, int fd); +#endif +#ifndef OPENSSL_NO_BIO +void SSL_set_bio(SSL* s, BIO* rbio, BIO* wbio); +BIO* SSL_get_rbio(const SSL* s); +BIO* SSL_get_wbio(const SSL* s); +#endif +int SSL_set_cipher_list(SSL* s, const char* str); +void SSL_set_read_ahead(SSL* s, int yes); +int SSL_get_verify_mode(const SSL* s); +int SSL_get_verify_depth(const SSL* s); +int (*SSL_get_verify_callback(const SSL* s))(int, X509_STORE_CTX*); +void SSL_set_verify( + SSL* s, + int mode, + int (*callback)(int ok, X509_STORE_CTX* ctx)); +void SSL_set_verify_depth(SSL* s, int depth); +void SSL_set_cert_cb(SSL* s, int (*cb)(SSL* ssl, void* arg), void* arg); +#ifndef OPENSSL_NO_RSA +int SSL_use_RSAPrivateKey(SSL* ssl, RSA* rsa); +#endif +int SSL_use_RSAPrivateKey_ASN1(SSL* ssl, unsigned char* d, long len); +int SSL_use_PrivateKey(SSL* ssl, EVP_PKEY* pkey); +int SSL_use_PrivateKey_ASN1(int pk, SSL* ssl, const unsigned char* d, long len); +int SSL_use_certificate(SSL* ssl, X509* x); +int SSL_use_certificate_ASN1(SSL* ssl, const unsigned char* d, int len); + +#ifndef OPENSSL_NO_TLSEXT +/* Set serverinfo data for the current active cert. */ +int SSL_CTX_use_serverinfo( + SSL_CTX* ctx, + const unsigned char* serverinfo, + size_t serverinfo_length); +#ifndef OPENSSL_NO_STDIO +int SSL_CTX_use_serverinfo_file(SSL_CTX* ctx, const char* file); +#endif /* NO_STDIO */ + +#endif + +#ifndef OPENSSL_NO_STDIO +int SSL_use_RSAPrivateKey_file(SSL* ssl, const char* file, int type); +int SSL_use_PrivateKey_file(SSL* ssl, const char* file, int type); +int SSL_use_certificate_file(SSL* ssl, const char* file, int type); +int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX* ctx, const char* file, int type); +int SSL_CTX_use_PrivateKey_file(SSL_CTX* ctx, const char* file, int type); +int SSL_CTX_use_certificate_file(SSL_CTX* ctx, const char* file, int type); +/* PEM type */ +int SSL_CTX_use_certificate_chain_file(SSL_CTX* ctx, const char* file); +STACK_OF(X509_NAME) * SSL_load_client_CA_file(const char* file); +int SSL_add_file_cert_subjects_to_stack( + STACK_OF(X509_NAME) * stackCAs, + const char* file); +#ifndef OPENSSL_SYS_VMS +/* XXXXX: Better scheme needed! [was: #ifndef MAC_OS_pre_X] */ +#ifndef OPENSSL_SYS_MACINTOSH_CLASSIC +int SSL_add_dir_cert_subjects_to_stack( + STACK_OF(X509_NAME) * stackCAs, + const char* dir); +#endif +#endif + +#endif + +void SSL_load_error_strings(void); +const char* SSL_state_string(const SSL* s); +const char* SSL_rstate_string(const SSL* s); +const char* SSL_state_string_long(const SSL* s); +const char* SSL_rstate_string_long(const SSL* s); +long SSL_SESSION_get_time(const SSL_SESSION* s); +long SSL_SESSION_set_time(SSL_SESSION* s, long t); +long SSL_SESSION_get_timeout(const SSL_SESSION* s); +long SSL_SESSION_set_timeout(SSL_SESSION* s, long t); +void SSL_copy_session_id(SSL* to, const SSL* from); +X509* SSL_SESSION_get0_peer(SSL_SESSION* s); +int SSL_SESSION_set1_id_context( + SSL_SESSION* s, + const unsigned char* sid_ctx, + unsigned int sid_ctx_len); + +SSL_SESSION* SSL_SESSION_new(void); +const unsigned char* SSL_SESSION_get_id( + const SSL_SESSION* s, + unsigned int* len); +unsigned int SSL_SESSION_get_compress_id(const SSL_SESSION* s); +#ifndef OPENSSL_NO_FP_API +int SSL_SESSION_print_fp(FILE* fp, const SSL_SESSION* ses); +#endif +#ifndef OPENSSL_NO_BIO +int SSL_SESSION_print(BIO* fp, const SSL_SESSION* ses); +#endif +void SSL_SESSION_free(SSL_SESSION* ses); +int i2d_SSL_SESSION(SSL_SESSION* in, unsigned char** pp); +int SSL_set_session(SSL* to, SSL_SESSION* session); +int SSL_CTX_add_session(SSL_CTX* s, SSL_SESSION* c); +int SSL_CTX_remove_session(SSL_CTX*, SSL_SESSION* c); +int SSL_CTX_set_generate_session_id(SSL_CTX*, GEN_SESSION_CB); +int SSL_set_generate_session_id(SSL*, GEN_SESSION_CB); +int SSL_has_matching_session_id( + const SSL* ssl, + const unsigned char* id, + unsigned int id_len); +SSL_SESSION* +d2i_SSL_SESSION(SSL_SESSION** a, const unsigned char** pp, long length); + +#ifdef HEADER_X509_H +X509* SSL_get_peer_certificate(const SSL* s); +#endif + +STACK_OF(X509) * SSL_get_peer_cert_chain(const SSL* s); + +int SSL_CTX_get_verify_mode(const SSL_CTX* ctx); +int SSL_CTX_get_verify_depth(const SSL_CTX* ctx); +int (*SSL_CTX_get_verify_callback(const SSL_CTX* ctx))(int, X509_STORE_CTX*); +void SSL_CTX_set_verify( + SSL_CTX* ctx, + int mode, + int (*callback)(int, X509_STORE_CTX*)); +void SSL_CTX_set_verify_depth(SSL_CTX* ctx, int depth); +void SSL_CTX_set_cert_verify_callback( + SSL_CTX* ctx, + int (*cb)(X509_STORE_CTX*, void*), + void* arg); +void SSL_CTX_set_cert_cb(SSL_CTX* c, int (*cb)(SSL* ssl, void* arg), void* arg); +#ifndef OPENSSL_NO_RSA +int SSL_CTX_use_RSAPrivateKey(SSL_CTX* ctx, RSA* rsa); +#endif +int SSL_CTX_use_RSAPrivateKey_ASN1( + SSL_CTX* ctx, + const unsigned char* d, + long len); +int SSL_CTX_use_PrivateKey(SSL_CTX* ctx, EVP_PKEY* pkey); +int SSL_CTX_use_PrivateKey_ASN1( + int pk, + SSL_CTX* ctx, + const unsigned char* d, + long len); +int SSL_CTX_use_certificate(SSL_CTX* ctx, X509* x); +int SSL_CTX_use_certificate_ASN1(SSL_CTX* ctx, int len, const unsigned char* d); + +void SSL_CTX_set_default_passwd_cb(SSL_CTX* ctx, pem_password_cb* cb); +void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX* ctx, void* u); + +int SSL_CTX_check_private_key(const SSL_CTX* ctx); +int SSL_check_private_key(const SSL* ctx); + +int SSL_CTX_set_session_id_context( + SSL_CTX* ctx, + const unsigned char* sid_ctx, + unsigned int sid_ctx_len); + +SSL* SSL_new(SSL_CTX* ctx); +int SSL_set_session_id_context( + SSL* ssl, + const unsigned char* sid_ctx, + unsigned int sid_ctx_len); + +int SSL_CTX_set_purpose(SSL_CTX* s, int purpose); +int SSL_set_purpose(SSL* s, int purpose); +int SSL_CTX_set_trust(SSL_CTX* s, int trust); +int SSL_set_trust(SSL* s, int trust); + +int SSL_CTX_set1_param(SSL_CTX* ctx, X509_VERIFY_PARAM* vpm); +int SSL_set1_param(SSL* ssl, X509_VERIFY_PARAM* vpm); + +X509_VERIFY_PARAM* SSL_CTX_get0_param(SSL_CTX* ctx); +X509_VERIFY_PARAM* SSL_get0_param(SSL* ssl); + +#ifndef OPENSSL_NO_SRP +int SSL_CTX_set_srp_username(SSL_CTX* ctx, char* name); +int SSL_CTX_set_srp_password(SSL_CTX* ctx, char* password); +int SSL_CTX_set_srp_strength(SSL_CTX* ctx, int strength); +int SSL_CTX_set_srp_client_pwd_callback(SSL_CTX* ctx, char* (*cb)(SSL*, void*)); +int SSL_CTX_set_srp_verify_param_callback(SSL_CTX* ctx, int (*cb)(SSL*, void*)); +int SSL_CTX_set_srp_username_callback( + SSL_CTX* ctx, + int (*cb)(SSL*, int*, void*)); +int SSL_CTX_set_srp_cb_arg(SSL_CTX* ctx, void* arg); + +int SSL_set_srp_server_param( + SSL* s, + const BIGNUM* N, + const BIGNUM* g, + BIGNUM* sa, + BIGNUM* v, + char* info); +int SSL_set_srp_server_param_pw( + SSL* s, + const char* user, + const char* pass, + const char* grp); + +BIGNUM* SSL_get_srp_g(SSL* s); +BIGNUM* SSL_get_srp_N(SSL* s); + +char* SSL_get_srp_username(SSL* s); +char* SSL_get_srp_userinfo(SSL* s); +#endif + +void SSL_certs_clear(SSL* s); +void SSL_free(SSL* ssl); +int SSL_accept(SSL* ssl); +int SSL_connect(SSL* ssl); +int SSL_read(SSL* ssl, void* buf, int num); +int SSL_peek(SSL* ssl, void* buf, int num); +int SSL_write(SSL* ssl, const void* buf, int num); +long SSL_ctrl(SSL* ssl, int cmd, long larg, void* parg); +long SSL_callback_ctrl(SSL*, int, void (*)(void)); +long SSL_CTX_ctrl(SSL_CTX* ctx, int cmd, long larg, void* parg); +long SSL_CTX_callback_ctrl(SSL_CTX*, int, void (*)(void)); + +int SSL_get_error(const SSL* s, int ret_code); +const char* SSL_get_version(const SSL* s); + +/* This sets the 'default' SSL version that SSL_new() will create */ +int SSL_CTX_set_ssl_version(SSL_CTX* ctx, const SSL_METHOD* meth); + +#ifndef OPENSSL_NO_SSL2_METHOD +const SSL_METHOD* SSLv2_method(void); /* SSLv2 */ +const SSL_METHOD* SSLv2_server_method(void); /* SSLv2 */ +const SSL_METHOD* SSLv2_client_method(void); /* SSLv2 */ +#endif + +#ifndef OPENSSL_NO_SSL3_METHOD +const SSL_METHOD* SSLv3_method(void); /* SSLv3 */ +const SSL_METHOD* SSLv3_server_method(void); /* SSLv3 */ +const SSL_METHOD* SSLv3_client_method(void); /* SSLv3 */ +#endif + +const SSL_METHOD* SSLv23_method(void); /* Negotiate highest available SSL/TLS + * version */ +const SSL_METHOD* SSLv23_server_method(void); /* Negotiate highest available + * SSL/TLS version */ +const SSL_METHOD* SSLv23_client_method(void); /* Negotiate highest available + * SSL/TLS version */ + +const SSL_METHOD* TLSv1_method(void); /* TLSv1.0 */ +const SSL_METHOD* TLSv1_server_method(void); /* TLSv1.0 */ +const SSL_METHOD* TLSv1_client_method(void); /* TLSv1.0 */ + +const SSL_METHOD* TLSv1_1_method(void); /* TLSv1.1 */ +const SSL_METHOD* TLSv1_1_server_method(void); /* TLSv1.1 */ +const SSL_METHOD* TLSv1_1_client_method(void); /* TLSv1.1 */ + +const SSL_METHOD* TLSv1_2_method(void); /* TLSv1.2 */ +const SSL_METHOD* TLSv1_2_server_method(void); /* TLSv1.2 */ +const SSL_METHOD* TLSv1_2_client_method(void); /* TLSv1.2 */ + +const SSL_METHOD* DTLSv1_method(void); /* DTLSv1.0 */ +const SSL_METHOD* DTLSv1_server_method(void); /* DTLSv1.0 */ +const SSL_METHOD* DTLSv1_client_method(void); /* DTLSv1.0 */ + +const SSL_METHOD* DTLSv1_2_method(void); /* DTLSv1.2 */ +const SSL_METHOD* DTLSv1_2_server_method(void); /* DTLSv1.2 */ +const SSL_METHOD* DTLSv1_2_client_method(void); /* DTLSv1.2 */ + +const SSL_METHOD* DTLS_method(void); /* DTLS 1.0 and 1.2 */ +const SSL_METHOD* DTLS_server_method(void); /* DTLS 1.0 and 1.2 */ +const SSL_METHOD* DTLS_client_method(void); /* DTLS 1.0 and 1.2 */ + +STACK_OF(SSL_CIPHER) * SSL_get_ciphers(const SSL* s); + +int SSL_do_handshake(SSL* s); +int SSL_renegotiate(SSL* s); +int SSL_renegotiate_abbreviated(SSL* s); +int SSL_renegotiate_pending(SSL* s); +int SSL_shutdown(SSL* s); + +const SSL_METHOD* SSL_CTX_get_ssl_method(SSL_CTX* ctx); +const SSL_METHOD* SSL_get_ssl_method(SSL* s); +int SSL_set_ssl_method(SSL* s, const SSL_METHOD* method); +const char* SSL_alert_type_string_long(int value); +const char* SSL_alert_type_string(int value); +const char* SSL_alert_desc_string_long(int value); +const char* SSL_alert_desc_string(int value); + +void SSL_set_client_CA_list(SSL* s, STACK_OF(X509_NAME) * name_list); +void SSL_CTX_set_client_CA_list(SSL_CTX* ctx, STACK_OF(X509_NAME) * name_list); +STACK_OF(X509_NAME) * SSL_get_client_CA_list(const SSL* s); +STACK_OF(X509_NAME) * SSL_CTX_get_client_CA_list(const SSL_CTX* s); +int SSL_add_client_CA(SSL* ssl, X509* x); +int SSL_CTX_add_client_CA(SSL_CTX* ctx, X509* x); + +void SSL_set_connect_state(SSL* s); +void SSL_set_accept_state(SSL* s); + +long SSL_get_default_timeout(const SSL* s); + +int SSL_library_init(void); + +char* SSL_CIPHER_description(const SSL_CIPHER*, char* buf, int size); +STACK_OF(X509_NAME) * SSL_dup_CA_list(STACK_OF(X509_NAME) * sk); + +SSL* SSL_dup(SSL* ssl); + +X509* SSL_get_certificate(const SSL* ssl); +/* + * EVP_PKEY + */ struct evp_pkey_st* SSL_get_privatekey(const SSL* ssl); + +X509* SSL_CTX_get0_certificate(const SSL_CTX* ctx); +EVP_PKEY* SSL_CTX_get0_privatekey(const SSL_CTX* ctx); + +void SSL_CTX_set_quiet_shutdown(SSL_CTX* ctx, int mode); +int SSL_CTX_get_quiet_shutdown(const SSL_CTX* ctx); +void SSL_set_quiet_shutdown(SSL* ssl, int mode); +int SSL_get_quiet_shutdown(const SSL* ssl); +void SSL_set_shutdown(SSL* ssl, int mode); +int SSL_get_shutdown(const SSL* ssl); +int SSL_version(const SSL* ssl); +int SSL_CTX_set_default_verify_paths(SSL_CTX* ctx); +int SSL_CTX_load_verify_locations( + SSL_CTX* ctx, + const char* CAfile, + const char* CApath); +#define SSL_get0_session SSL_get_session /* just peek at pointer */ +SSL_SESSION* SSL_get_session(const SSL* ssl); +SSL_SESSION* SSL_get1_session(SSL* ssl); /* obtain a reference count */ +SSL_CTX* SSL_get_SSL_CTX(const SSL* ssl); +SSL_CTX* SSL_set_SSL_CTX(SSL* ssl, SSL_CTX* ctx); +void SSL_set_info_callback( + SSL* ssl, + void (*cb)(const SSL* ssl, int type, int val)); +void ( + *SSL_get_info_callback(const SSL* ssl))(const SSL* ssl, int type, int val); +int SSL_state(const SSL* ssl); +void SSL_set_state(SSL* ssl, int state); + +void SSL_set_verify_result(SSL* ssl, long v); +long SSL_get_verify_result(const SSL* ssl); + +int SSL_set_ex_data(SSL* ssl, int idx, void* data); +void* SSL_get_ex_data(const SSL* ssl, int idx); +int SSL_get_ex_new_index( + long argl, + void* argp, + CRYPTO_EX_new* new_func, + CRYPTO_EX_dup* dup_func, + CRYPTO_EX_free* free_func); + +int SSL_SESSION_set_ex_data(SSL_SESSION* ss, int idx, void* data); +void* SSL_SESSION_get_ex_data(const SSL_SESSION* ss, int idx); +int SSL_SESSION_get_ex_new_index( + long argl, + void* argp, + CRYPTO_EX_new* new_func, + CRYPTO_EX_dup* dup_func, + CRYPTO_EX_free* free_func); + +int SSL_CTX_set_ex_data(SSL_CTX* ssl, int idx, void* data); +void* SSL_CTX_get_ex_data(const SSL_CTX* ssl, int idx); +int SSL_CTX_get_ex_new_index( + long argl, + void* argp, + CRYPTO_EX_new* new_func, + CRYPTO_EX_dup* dup_func, + CRYPTO_EX_free* free_func); + +int SSL_get_ex_data_X509_STORE_CTX_idx(void); + +#define SSL_CTX_sess_set_cache_size(ctx, t) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_SESS_CACHE_SIZE, t, NULL) +#define SSL_CTX_sess_get_cache_size(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_SESS_CACHE_SIZE, 0, NULL) +#define SSL_CTX_set_session_cache_mode(ctx, m) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_SESS_CACHE_MODE, m, NULL) +#define SSL_CTX_get_session_cache_mode(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_SESS_CACHE_MODE, 0, NULL) + +#define SSL_CTX_get_default_read_ahead(ctx) SSL_CTX_get_read_ahead(ctx) +#define SSL_CTX_set_default_read_ahead(ctx, m) SSL_CTX_set_read_ahead(ctx, m) +#define SSL_CTX_get_read_ahead(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_READ_AHEAD, 0, NULL) +#define SSL_CTX_set_read_ahead(ctx, m) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_READ_AHEAD, m, NULL) +#define SSL_CTX_get_max_cert_list(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_MAX_CERT_LIST, 0, NULL) +#define SSL_CTX_set_max_cert_list(ctx, m) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MAX_CERT_LIST, m, NULL) +#define SSL_get_max_cert_list(ssl) \ + SSL_ctrl(ssl, SSL_CTRL_GET_MAX_CERT_LIST, 0, NULL) +#define SSL_set_max_cert_list(ssl, m) \ + SSL_ctrl(ssl, SSL_CTRL_SET_MAX_CERT_LIST, m, NULL) + +#define SSL_CTX_set_max_send_fragment(ctx, m) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MAX_SEND_FRAGMENT, m, NULL) +#define SSL_set_max_send_fragment(ssl, m) \ + SSL_ctrl(ssl, SSL_CTRL_SET_MAX_SEND_FRAGMENT, m, NULL) + +/* NB: the keylength is only applicable when is_export is true */ +#ifndef OPENSSL_NO_RSA +void SSL_CTX_set_tmp_rsa_callback( + SSL_CTX* ctx, + RSA* (*cb)(SSL* ssl, int is_export, int keylength)); + +void SSL_set_tmp_rsa_callback( + SSL* ssl, + RSA* (*cb)(SSL* ssl, int is_export, int keylength)); +#endif +#ifndef OPENSSL_NO_DH +void SSL_CTX_set_tmp_dh_callback( + SSL_CTX* ctx, + DH* (*dh)(SSL* ssl, int is_export, int keylength)); +void SSL_set_tmp_dh_callback( + SSL* ssl, + DH* (*dh)(SSL* ssl, int is_export, int keylength)); +#endif +#ifndef OPENSSL_NO_ECDH +void SSL_CTX_set_tmp_ecdh_callback( + SSL_CTX* ctx, + EC_KEY* (*ecdh)(SSL* ssl, int is_export, int keylength)); +void SSL_set_tmp_ecdh_callback( + SSL* ssl, + EC_KEY* (*ecdh)(SSL* ssl, int is_export, int keylength)); +#endif + +const COMP_METHOD* SSL_get_current_compression(SSL* s); +const COMP_METHOD* SSL_get_current_expansion(SSL* s); +const char* SSL_COMP_get_name(const COMP_METHOD* comp); +STACK_OF(SSL_COMP) * SSL_COMP_get_compression_methods(void); +STACK_OF(SSL_COMP) * + SSL_COMP_set0_compression_methods(STACK_OF(SSL_COMP) * meths); +void SSL_COMP_free_compression_methods(void); +int SSL_COMP_add_compression_method(int id, COMP_METHOD* cm); + +const SSL_CIPHER* SSL_CIPHER_find(SSL* ssl, const unsigned char* ptr); + +/* TLS extensions functions */ +int SSL_set_session_ticket_ext(SSL* s, void* ext_data, int ext_len); + +int SSL_set_session_ticket_ext_cb( + SSL* s, + tls_session_ticket_ext_cb_fn cb, + void* arg); + +/* Pre-shared secret session resumption functions */ +int SSL_set_session_secret_cb( + SSL* s, + tls_session_secret_cb_fn tls_session_secret_cb, + void* arg); + +void SSL_set_debug(SSL* s, int debug); +int SSL_cache_hit(SSL* s); +int SSL_is_server(SSL* s); + +SSL_CONF_CTX* SSL_CONF_CTX_new(void); +int SSL_CONF_CTX_finish(SSL_CONF_CTX* cctx); +void SSL_CONF_CTX_free(SSL_CONF_CTX* cctx); +unsigned int SSL_CONF_CTX_set_flags(SSL_CONF_CTX* cctx, unsigned int flags); +unsigned int SSL_CONF_CTX_clear_flags(SSL_CONF_CTX* cctx, unsigned int flags); +int SSL_CONF_CTX_set1_prefix(SSL_CONF_CTX* cctx, const char* pre); + +void SSL_CONF_CTX_set_ssl(SSL_CONF_CTX* cctx, SSL* ssl); +void SSL_CONF_CTX_set_ssl_ctx(SSL_CONF_CTX* cctx, SSL_CTX* ctx); + +int SSL_CONF_cmd(SSL_CONF_CTX* cctx, const char* cmd, const char* value); +int SSL_CONF_cmd_argv(SSL_CONF_CTX* cctx, int* pargc, char*** pargv); +int SSL_CONF_cmd_value_type(SSL_CONF_CTX* cctx, const char* cmd); + +#ifndef OPENSSL_NO_SSL_TRACE +void SSL_trace( + int write_p, + int version, + int content_type, + const void* buf, + size_t len, + SSL* ssl, + void* arg); +const char* SSL_CIPHER_standard_name(const SSL_CIPHER* c); +#endif + +#ifndef OPENSSL_NO_UNIT_TEST +const struct openssl_ssl_test_functions* SSL_test_functions(void); +#endif + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_SSL_strings(void); + +/* Error codes for the SSL functions. */ + +/* Function codes. */ +#define SSL_F_CHECK_SUITEB_CIPHER_LIST 331 +#define SSL_F_CLIENT_CERTIFICATE 100 +#define SSL_F_CLIENT_FINISHED 167 +#define SSL_F_CLIENT_HELLO 101 +#define SSL_F_CLIENT_MASTER_KEY 102 +#define SSL_F_D2I_SSL_SESSION 103 +#define SSL_F_DO_DTLS1_WRITE 245 +#define SSL_F_DO_SSL3_WRITE 104 +#define SSL_F_DTLS1_ACCEPT 246 +#define SSL_F_DTLS1_ADD_CERT_TO_BUF 295 +#define SSL_F_DTLS1_BUFFER_RECORD 247 +#define SSL_F_DTLS1_CHECK_TIMEOUT_NUM 316 +#define SSL_F_DTLS1_CLIENT_HELLO 248 +#define SSL_F_DTLS1_CONNECT 249 +#define SSL_F_DTLS1_ENC 250 +#define SSL_F_DTLS1_GET_HELLO_VERIFY 251 +#define SSL_F_DTLS1_GET_MESSAGE 252 +#define SSL_F_DTLS1_GET_MESSAGE_FRAGMENT 253 +#define SSL_F_DTLS1_GET_RECORD 254 +#define SSL_F_DTLS1_HANDLE_TIMEOUT 297 +#define SSL_F_DTLS1_HEARTBEAT 305 +#define SSL_F_DTLS1_OUTPUT_CERT_CHAIN 255 +#define SSL_F_DTLS1_PREPROCESS_FRAGMENT 288 +#define SSL_F_DTLS1_PROCESS_BUFFERED_RECORDS 424 +#define SSL_F_DTLS1_PROCESS_OUT_OF_SEQ_MESSAGE 256 +#define SSL_F_DTLS1_PROCESS_RECORD 257 +#define SSL_F_DTLS1_READ_BYTES 258 +#define SSL_F_DTLS1_READ_FAILED 259 +#define SSL_F_DTLS1_SEND_CERTIFICATE_REQUEST 260 +#define SSL_F_DTLS1_SEND_CLIENT_CERTIFICATE 261 +#define SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE 262 +#define SSL_F_DTLS1_SEND_CLIENT_VERIFY 263 +#define SSL_F_DTLS1_SEND_HELLO_VERIFY_REQUEST 264 +#define SSL_F_DTLS1_SEND_SERVER_CERTIFICATE 265 +#define SSL_F_DTLS1_SEND_SERVER_HELLO 266 +#define SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE 267 +#define SSL_F_DTLS1_WRITE_APP_DATA_BYTES 268 +#define SSL_F_GET_CLIENT_FINISHED 105 +#define SSL_F_GET_CLIENT_HELLO 106 +#define SSL_F_GET_CLIENT_MASTER_KEY 107 +#define SSL_F_GET_SERVER_FINISHED 108 +#define SSL_F_GET_SERVER_HELLO 109 +#define SSL_F_GET_SERVER_STATIC_DH_KEY 340 +#define SSL_F_GET_SERVER_VERIFY 110 +#define SSL_F_I2D_SSL_SESSION 111 +#define SSL_F_READ_N 112 +#define SSL_F_REQUEST_CERTIFICATE 113 +#define SSL_F_SERVER_FINISH 239 +#define SSL_F_SERVER_HELLO 114 +#define SSL_F_SERVER_VERIFY 240 +#define SSL_F_SSL23_ACCEPT 115 +#define SSL_F_SSL23_CLIENT_HELLO 116 +#define SSL_F_SSL23_CONNECT 117 +#define SSL_F_SSL23_GET_CLIENT_HELLO 118 +#define SSL_F_SSL23_GET_SERVER_HELLO 119 +#define SSL_F_SSL23_PEEK 237 +#define SSL_F_SSL23_READ 120 +#define SSL_F_SSL23_WRITE 121 +#define SSL_F_SSL2_ACCEPT 122 +#define SSL_F_SSL2_CONNECT 123 +#define SSL_F_SSL2_ENC_INIT 124 +#define SSL_F_SSL2_GENERATE_KEY_MATERIAL 241 +#define SSL_F_SSL2_PEEK 234 +#define SSL_F_SSL2_READ 125 +#define SSL_F_SSL2_READ_INTERNAL 236 +#define SSL_F_SSL2_SET_CERTIFICATE 126 +#define SSL_F_SSL2_WRITE 127 +#define SSL_F_SSL3_ACCEPT 128 +#define SSL_F_SSL3_ADD_CERT_TO_BUF 296 +#define SSL_F_SSL3_CALLBACK_CTRL 233 +#define SSL_F_SSL3_CHANGE_CIPHER_STATE 129 +#define SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM 130 +#define SSL_F_SSL3_CHECK_CLIENT_HELLO 304 +#define SSL_F_SSL3_CHECK_FINISHED 339 +#define SSL_F_SSL3_CLIENT_HELLO 131 +#define SSL_F_SSL3_CONNECT 132 +#define SSL_F_SSL3_CTRL 213 +#define SSL_F_SSL3_CTX_CTRL 133 +#define SSL_F_SSL3_DIGEST_CACHED_RECORDS 293 +#define SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC 292 +#define SSL_F_SSL3_ENC 134 +#define SSL_F_SSL3_GENERATE_KEY_BLOCK 238 +#define SSL_F_SSL3_GENERATE_MASTER_SECRET 388 +#define SSL_F_SSL3_GET_CERTIFICATE_REQUEST 135 +#define SSL_F_SSL3_GET_CERT_STATUS 289 +#define SSL_F_SSL3_GET_CERT_VERIFY 136 +#define SSL_F_SSL3_GET_CLIENT_CERTIFICATE 137 +#define SSL_F_SSL3_GET_CLIENT_HELLO 138 +#define SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE 139 +#define SSL_F_SSL3_GET_FINISHED 140 +#define SSL_F_SSL3_GET_KEY_EXCHANGE 141 +#define SSL_F_SSL3_GET_MESSAGE 142 +#define SSL_F_SSL3_GET_NEW_SESSION_TICKET 283 +#define SSL_F_SSL3_GET_NEXT_PROTO 306 +#define SSL_F_SSL3_GET_RECORD 143 +#define SSL_F_SSL3_GET_SERVER_CERTIFICATE 144 +#define SSL_F_SSL3_GET_SERVER_DONE 145 +#define SSL_F_SSL3_GET_SERVER_HELLO 146 +#define SSL_F_SSL3_HANDSHAKE_MAC 285 +#define SSL_F_SSL3_NEW_SESSION_TICKET 287 +#define SSL_F_SSL3_OUTPUT_CERT_CHAIN 147 +#define SSL_F_SSL3_PEEK 235 +#define SSL_F_SSL3_READ_BYTES 148 +#define SSL_F_SSL3_READ_N 149 +#define SSL_F_SSL3_SEND_CERTIFICATE_REQUEST 150 +#define SSL_F_SSL3_SEND_CLIENT_CERTIFICATE 151 +#define SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE 152 +#define SSL_F_SSL3_SEND_CLIENT_VERIFY 153 +#define SSL_F_SSL3_SEND_SERVER_CERTIFICATE 154 +#define SSL_F_SSL3_SEND_SERVER_HELLO 242 +#define SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE 155 +#define SSL_F_SSL3_SETUP_KEY_BLOCK 157 +#define SSL_F_SSL3_SETUP_READ_BUFFER 156 +#define SSL_F_SSL3_SETUP_WRITE_BUFFER 291 +#define SSL_F_SSL3_WRITE_BYTES 158 +#define SSL_F_SSL3_WRITE_PENDING 159 +#define SSL_F_SSL_ADD_CERT_CHAIN 318 +#define SSL_F_SSL_ADD_CERT_TO_BUF 319 +#define SSL_F_SSL_ADD_CLIENTHELLO_RENEGOTIATE_EXT 298 +#define SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT 277 +#define SSL_F_SSL_ADD_CLIENTHELLO_USE_SRTP_EXT 307 +#define SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK 215 +#define SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK 216 +#define SSL_F_SSL_ADD_SERVERHELLO_RENEGOTIATE_EXT 299 +#define SSL_F_SSL_ADD_SERVERHELLO_TLSEXT 278 +#define SSL_F_SSL_ADD_SERVERHELLO_USE_SRTP_EXT 308 +#define SSL_F_SSL_BAD_METHOD 160 +#define SSL_F_SSL_BUILD_CERT_CHAIN 332 +#define SSL_F_SSL_BYTES_TO_CIPHER_LIST 161 +#define SSL_F_SSL_CERT_DUP 221 +#define SSL_F_SSL_CERT_INST 222 +#define SSL_F_SSL_CERT_INSTANTIATE 214 +#define SSL_F_SSL_CERT_NEW 162 +#define SSL_F_SSL_CHECK_PRIVATE_KEY 163 +#define SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT 280 +#define SSL_F_SSL_CHECK_SRVR_ECC_CERT_AND_ALG 279 +#define SSL_F_SSL_CIPHER_PROCESS_RULESTR 230 +#define SSL_F_SSL_CIPHER_STRENGTH_SORT 231 +#define SSL_F_SSL_CLEAR 164 +#define SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD 165 +#define SSL_F_SSL_CONF_CMD 334 +#define SSL_F_SSL_CREATE_CIPHER_LIST 166 +#define SSL_F_SSL_CTRL 232 +#define SSL_F_SSL_CTX_CHECK_PRIVATE_KEY 168 +#define SSL_F_SSL_CTX_MAKE_PROFILES 309 +#define SSL_F_SSL_CTX_NEW 169 +#define SSL_F_SSL_CTX_SET_CIPHER_LIST 269 +#define SSL_F_SSL_CTX_SET_CLIENT_CERT_ENGINE 290 +#define SSL_F_SSL_CTX_SET_PURPOSE 226 +#define SSL_F_SSL_CTX_SET_SESSION_ID_CONTEXT 219 +#define SSL_F_SSL_CTX_SET_SSL_VERSION 170 +#define SSL_F_SSL_CTX_SET_TRUST 229 +#define SSL_F_SSL_CTX_USE_CERTIFICATE 171 +#define SSL_F_SSL_CTX_USE_CERTIFICATE_ASN1 172 +#define SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE 220 +#define SSL_F_SSL_CTX_USE_CERTIFICATE_FILE 173 +#define SSL_F_SSL_CTX_USE_PRIVATEKEY 174 +#define SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1 175 +#define SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE 176 +#define SSL_F_SSL_CTX_USE_PSK_IDENTITY_HINT 272 +#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY 177 +#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_ASN1 178 +#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE 179 +#define SSL_F_SSL_CTX_USE_SERVERINFO 336 +#define SSL_F_SSL_CTX_USE_SERVERINFO_FILE 337 +#define SSL_F_SSL_DO_HANDSHAKE 180 +#define SSL_F_SSL_GET_NEW_SESSION 181 +#define SSL_F_SSL_GET_PREV_SESSION 217 +#define SSL_F_SSL_GET_SERVER_CERT_INDEX 322 +#define SSL_F_SSL_GET_SERVER_SEND_CERT 182 +#define SSL_F_SSL_GET_SERVER_SEND_PKEY 317 +#define SSL_F_SSL_GET_SIGN_PKEY 183 +#define SSL_F_SSL_INIT_WBIO_BUFFER 184 +#define SSL_F_SSL_LOAD_CLIENT_CA_FILE 185 +#define SSL_F_SSL_NEW 186 +#define SSL_F_SSL_PARSE_CLIENTHELLO_RENEGOTIATE_EXT 300 +#define SSL_F_SSL_PARSE_CLIENTHELLO_TLSEXT 302 +#define SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT 310 +#define SSL_F_SSL_PARSE_SERVERHELLO_RENEGOTIATE_EXT 301 +#define SSL_F_SSL_PARSE_SERVERHELLO_TLSEXT 303 +#define SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT 311 +#define SSL_F_SSL_PEEK 270 +#define SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT 281 +#define SSL_F_SSL_PREPARE_SERVERHELLO_TLSEXT 282 +#define SSL_F_SSL_READ 223 +#define SSL_F_SSL_RSA_PRIVATE_DECRYPT 187 +#define SSL_F_SSL_RSA_PUBLIC_ENCRYPT 188 +#define SSL_F_SSL_SCAN_CLIENTHELLO_TLSEXT 320 +#define SSL_F_SSL_SCAN_SERVERHELLO_TLSEXT 321 +#define SSL_F_SSL_SESSION_DUP 348 +#define SSL_F_SSL_SESSION_NEW 189 +#define SSL_F_SSL_SESSION_PRINT_FP 190 +#define SSL_F_SSL_SESSION_SET1_ID_CONTEXT 312 +#define SSL_F_SSL_SESS_CERT_NEW 225 +#define SSL_F_SSL_SET_CERT 191 +#define SSL_F_SSL_SET_CIPHER_LIST 271 +#define SSL_F_SSL_SET_FD 192 +#define SSL_F_SSL_SET_PKEY 193 +#define SSL_F_SSL_SET_PURPOSE 227 +#define SSL_F_SSL_SET_RFD 194 +#define SSL_F_SSL_SET_SESSION 195 +#define SSL_F_SSL_SET_SESSION_ID_CONTEXT 218 +#define SSL_F_SSL_SET_SESSION_TICKET_EXT 294 +#define SSL_F_SSL_SET_TRUST 228 +#define SSL_F_SSL_SET_WFD 196 +#define SSL_F_SSL_SHUTDOWN 224 +#define SSL_F_SSL_SRP_CTX_INIT 313 +#define SSL_F_SSL_UNDEFINED_CONST_FUNCTION 243 +#define SSL_F_SSL_UNDEFINED_FUNCTION 197 +#define SSL_F_SSL_UNDEFINED_VOID_FUNCTION 244 +#define SSL_F_SSL_USE_CERTIFICATE 198 +#define SSL_F_SSL_USE_CERTIFICATE_ASN1 199 +#define SSL_F_SSL_USE_CERTIFICATE_FILE 200 +#define SSL_F_SSL_USE_PRIVATEKEY 201 +#define SSL_F_SSL_USE_PRIVATEKEY_ASN1 202 +#define SSL_F_SSL_USE_PRIVATEKEY_FILE 203 +#define SSL_F_SSL_USE_PSK_IDENTITY_HINT 273 +#define SSL_F_SSL_USE_RSAPRIVATEKEY 204 +#define SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1 205 +#define SSL_F_SSL_USE_RSAPRIVATEKEY_FILE 206 +#define SSL_F_SSL_VERIFY_CERT_CHAIN 207 +#define SSL_F_SSL_WRITE 208 +#define SSL_F_TLS12_CHECK_PEER_SIGALG 333 +#define SSL_F_TLS1_CERT_VERIFY_MAC 286 +#define SSL_F_TLS1_CHANGE_CIPHER_STATE 209 +#define SSL_F_TLS1_CHECK_SERVERHELLO_TLSEXT 274 +#define SSL_F_TLS1_ENC 210 +#define SSL_F_TLS1_EXPORT_KEYING_MATERIAL 314 +#define SSL_F_TLS1_GET_CURVELIST 338 +#define SSL_F_TLS1_HEARTBEAT 315 +#define SSL_F_TLS1_PREPARE_CLIENTHELLO_TLSEXT 275 +#define SSL_F_TLS1_PREPARE_SERVERHELLO_TLSEXT 276 +#define SSL_F_TLS1_PRF 284 +#define SSL_F_TLS1_SETUP_KEY_BLOCK 211 +#define SSL_F_TLS1_SET_SERVER_SIGALGS 335 +#define SSL_F_WRITE_PENDING 212 + +/* Reason codes. */ +#define SSL_R_APP_DATA_IN_HANDSHAKE 100 +#define SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT 272 +#define SSL_R_BAD_ALERT_RECORD 101 +#define SSL_R_BAD_AUTHENTICATION_TYPE 102 +#define SSL_R_BAD_CHANGE_CIPHER_SPEC 103 +#define SSL_R_BAD_CHECKSUM 104 +#define SSL_R_BAD_DATA 390 +#define SSL_R_BAD_DATA_RETURNED_BY_CALLBACK 106 +#define SSL_R_BAD_DECOMPRESSION 107 +#define SSL_R_BAD_DH_G_LENGTH 108 +#define SSL_R_BAD_DH_G_VALUE 375 +#define SSL_R_BAD_DH_PUB_KEY_LENGTH 109 +#define SSL_R_BAD_DH_PUB_KEY_VALUE 393 +#define SSL_R_BAD_DH_P_LENGTH 110 +#define SSL_R_BAD_DH_P_VALUE 395 +#define SSL_R_BAD_DIGEST_LENGTH 111 +#define SSL_R_BAD_DSA_SIGNATURE 112 +#define SSL_R_BAD_ECC_CERT 304 +#define SSL_R_BAD_ECDSA_SIGNATURE 305 +#define SSL_R_BAD_ECPOINT 306 +#define SSL_R_BAD_HANDSHAKE_LENGTH 332 +#define SSL_R_BAD_HELLO_REQUEST 105 +#define SSL_R_BAD_LENGTH 271 +#define SSL_R_BAD_MAC_DECODE 113 +#define SSL_R_BAD_MAC_LENGTH 333 +#define SSL_R_BAD_MESSAGE_TYPE 114 +#define SSL_R_BAD_PACKET_LENGTH 115 +#define SSL_R_BAD_PROTOCOL_VERSION_NUMBER 116 +#define SSL_R_BAD_PSK_IDENTITY_HINT_LENGTH 316 +#define SSL_R_BAD_RESPONSE_ARGUMENT 117 +#define SSL_R_BAD_RSA_DECRYPT 118 +#define SSL_R_BAD_RSA_ENCRYPT 119 +#define SSL_R_BAD_RSA_E_LENGTH 120 +#define SSL_R_BAD_RSA_MODULUS_LENGTH 121 +#define SSL_R_BAD_RSA_SIGNATURE 122 +#define SSL_R_BAD_SIGNATURE 123 +#define SSL_R_BAD_SRP_A_LENGTH 347 +#define SSL_R_BAD_SRP_B_LENGTH 348 +#define SSL_R_BAD_SRP_G_LENGTH 349 +#define SSL_R_BAD_SRP_N_LENGTH 350 +#define SSL_R_BAD_SRP_PARAMETERS 371 +#define SSL_R_BAD_SRP_S_LENGTH 351 +#define SSL_R_BAD_SRTP_MKI_VALUE 352 +#define SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST 353 +#define SSL_R_BAD_SSL_FILETYPE 124 +#define SSL_R_BAD_SSL_SESSION_ID_LENGTH 125 +#define SSL_R_BAD_STATE 126 +#define SSL_R_BAD_VALUE 384 +#define SSL_R_BAD_WRITE_RETRY 127 +#define SSL_R_BIO_NOT_SET 128 +#define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG 129 +#define SSL_R_BN_LIB 130 +#define SSL_R_CA_DN_LENGTH_MISMATCH 131 +#define SSL_R_CA_DN_TOO_LONG 132 +#define SSL_R_CCS_RECEIVED_EARLY 133 +#define SSL_R_CERTIFICATE_VERIFY_FAILED 134 +#define SSL_R_CERT_CB_ERROR 377 +#define SSL_R_CERT_LENGTH_MISMATCH 135 +#define SSL_R_CHALLENGE_IS_DIFFERENT 136 +#define SSL_R_CIPHER_CODE_WRONG_LENGTH 137 +#define SSL_R_CIPHER_OR_HASH_UNAVAILABLE 138 +#define SSL_R_CIPHER_TABLE_SRC_ERROR 139 +#define SSL_R_CLIENTHELLO_TLSEXT 226 +#define SSL_R_COMPRESSED_LENGTH_TOO_LONG 140 +#define SSL_R_COMPRESSION_DISABLED 343 +#define SSL_R_COMPRESSION_FAILURE 141 +#define SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE 307 +#define SSL_R_COMPRESSION_LIBRARY_ERROR 142 +#define SSL_R_CONNECTION_ID_IS_DIFFERENT 143 +#define SSL_R_CONNECTION_TYPE_NOT_SET 144 +#define SSL_R_COOKIE_MISMATCH 308 +#define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED 145 +#define SSL_R_DATA_LENGTH_TOO_LONG 146 +#define SSL_R_DECRYPTION_FAILED 147 +#define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC 281 +#define SSL_R_DH_KEY_TOO_SMALL 372 +#define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG 148 +#define SSL_R_DIGEST_CHECK_FAILED 149 +#define SSL_R_DTLS_MESSAGE_TOO_BIG 334 +#define SSL_R_DUPLICATE_COMPRESSION_ID 309 +#define SSL_R_ECC_CERT_NOT_FOR_KEY_AGREEMENT 317 +#define SSL_R_ECC_CERT_NOT_FOR_SIGNING 318 +#define SSL_R_ECC_CERT_SHOULD_HAVE_RSA_SIGNATURE 322 +#define SSL_R_ECC_CERT_SHOULD_HAVE_SHA1_SIGNATURE 323 +#define SSL_R_ECDH_REQUIRED_FOR_SUITEB_MODE 374 +#define SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER 310 +#define SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST 354 +#define SSL_R_ENCRYPTED_LENGTH_TOO_LONG 150 +#define SSL_R_ERROR_GENERATING_TMP_RSA_KEY 282 +#define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST 151 +#define SSL_R_EXCESSIVE_MESSAGE_SIZE 152 +#define SSL_R_EXTRA_DATA_IN_MESSAGE 153 +#define SSL_R_GOT_A_FIN_BEFORE_A_CCS 154 +#define SSL_R_GOT_NEXT_PROTO_BEFORE_A_CCS 355 +#define SSL_R_GOT_NEXT_PROTO_WITHOUT_EXTENSION 356 +#define SSL_R_HTTPS_PROXY_REQUEST 155 +#define SSL_R_HTTP_REQUEST 156 +#define SSL_R_ILLEGAL_PADDING 283 +#define SSL_R_ILLEGAL_SUITEB_DIGEST 380 +#define SSL_R_INAPPROPRIATE_FALLBACK 373 +#define SSL_R_INCONSISTENT_COMPRESSION 340 +#define SSL_R_INVALID_CHALLENGE_LENGTH 158 +#define SSL_R_INVALID_COMMAND 280 +#define SSL_R_INVALID_COMPRESSION_ALGORITHM 341 +#define SSL_R_INVALID_NULL_CMD_NAME 385 +#define SSL_R_INVALID_PURPOSE 278 +#define SSL_R_INVALID_SERVERINFO_DATA 388 +#define SSL_R_INVALID_SRP_USERNAME 357 +#define SSL_R_INVALID_STATUS_RESPONSE 328 +#define SSL_R_INVALID_TICKET_KEYS_LENGTH 325 +#define SSL_R_INVALID_TRUST 279 +#define SSL_R_KEY_ARG_TOO_LONG 284 +#define SSL_R_KRB5 285 +#define SSL_R_KRB5_C_CC_PRINC 286 +#define SSL_R_KRB5_C_GET_CRED 287 +#define SSL_R_KRB5_C_INIT 288 +#define SSL_R_KRB5_C_MK_REQ 289 +#define SSL_R_KRB5_S_BAD_TICKET 290 +#define SSL_R_KRB5_S_INIT 291 +#define SSL_R_KRB5_S_RD_REQ 292 +#define SSL_R_KRB5_S_TKT_EXPIRED 293 +#define SSL_R_KRB5_S_TKT_NYV 294 +#define SSL_R_KRB5_S_TKT_SKEW 295 +#define SSL_R_LENGTH_MISMATCH 159 +#define SSL_R_LENGTH_TOO_SHORT 160 +#define SSL_R_LIBRARY_BUG 274 +#define SSL_R_LIBRARY_HAS_NO_CIPHERS 161 +#define SSL_R_MESSAGE_TOO_LONG 296 +#define SSL_R_MISSING_DH_DSA_CERT 162 +#define SSL_R_MISSING_DH_KEY 163 +#define SSL_R_MISSING_DH_RSA_CERT 164 +#define SSL_R_MISSING_DSA_SIGNING_CERT 165 +#define SSL_R_MISSING_ECDH_CERT 382 +#define SSL_R_MISSING_ECDSA_SIGNING_CERT 381 +#define SSL_R_MISSING_EXPORT_TMP_DH_KEY 166 +#define SSL_R_MISSING_EXPORT_TMP_RSA_KEY 167 +#define SSL_R_MISSING_RSA_CERTIFICATE 168 +#define SSL_R_MISSING_RSA_ENCRYPTING_CERT 169 +#define SSL_R_MISSING_RSA_SIGNING_CERT 170 +#define SSL_R_MISSING_SRP_PARAM 358 +#define SSL_R_MISSING_TMP_DH_KEY 171 +#define SSL_R_MISSING_TMP_ECDH_KEY 311 +#define SSL_R_MISSING_TMP_RSA_KEY 172 +#define SSL_R_MISSING_TMP_RSA_PKEY 173 +#define SSL_R_MISSING_VERIFY_MESSAGE 174 +#define SSL_R_MULTIPLE_SGC_RESTARTS 346 +#define SSL_R_NON_SSLV2_INITIAL_PACKET 175 +#define SSL_R_NO_CERTIFICATES_RETURNED 176 +#define SSL_R_NO_CERTIFICATE_ASSIGNED 177 +#define SSL_R_NO_CERTIFICATE_RETURNED 178 +#define SSL_R_NO_CERTIFICATE_SET 179 +#define SSL_R_NO_CERTIFICATE_SPECIFIED 180 +#define SSL_R_NO_CIPHERS_AVAILABLE 181 +#define SSL_R_NO_CIPHERS_PASSED 182 +#define SSL_R_NO_CIPHERS_SPECIFIED 183 +#define SSL_R_NO_CIPHER_LIST 184 +#define SSL_R_NO_CIPHER_MATCH 185 +#define SSL_R_NO_CLIENT_CERT_METHOD 331 +#define SSL_R_NO_CLIENT_CERT_RECEIVED 186 +#define SSL_R_NO_COMPRESSION_SPECIFIED 187 +#define SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER 330 +#define SSL_R_NO_METHOD_SPECIFIED 188 +#define SSL_R_NO_PEM_EXTENSIONS 389 +#define SSL_R_NO_PRIVATEKEY 189 +#define SSL_R_NO_PRIVATE_KEY_ASSIGNED 190 +#define SSL_R_NO_PROTOCOLS_AVAILABLE 191 +#define SSL_R_NO_PUBLICKEY 192 +#define SSL_R_NO_RENEGOTIATION 339 +#define SSL_R_NO_REQUIRED_DIGEST 324 +#define SSL_R_NO_SHARED_CIPHER 193 +#define SSL_R_NO_SHARED_SIGATURE_ALGORITHMS 376 +#define SSL_R_NO_SRTP_PROFILES 359 +#define SSL_R_NO_VERIFY_CALLBACK 194 +#define SSL_R_NULL_SSL_CTX 195 +#define SSL_R_NULL_SSL_METHOD_PASSED 196 +#define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED 197 +#define SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED 344 +#define SSL_R_ONLY_DTLS_1_2_ALLOWED_IN_SUITEB_MODE 387 +#define SSL_R_ONLY_TLS_1_2_ALLOWED_IN_SUITEB_MODE 379 +#define SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE 297 +#define SSL_R_OPAQUE_PRF_INPUT_TOO_LONG 327 +#define SSL_R_PACKET_LENGTH_TOO_LONG 198 +#define SSL_R_PARSE_TLSEXT 227 +#define SSL_R_PATH_TOO_LONG 270 +#define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE 199 +#define SSL_R_PEER_ERROR 200 +#define SSL_R_PEER_ERROR_CERTIFICATE 201 +#define SSL_R_PEER_ERROR_NO_CERTIFICATE 202 +#define SSL_R_PEER_ERROR_NO_CIPHER 203 +#define SSL_R_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE 204 +#define SSL_R_PEM_NAME_BAD_PREFIX 391 +#define SSL_R_PEM_NAME_TOO_SHORT 392 +#define SSL_R_PRE_MAC_LENGTH_TOO_LONG 205 +#define SSL_R_PROBLEMS_MAPPING_CIPHER_FUNCTIONS 206 +#define SSL_R_PROTOCOL_IS_SHUTDOWN 207 +#define SSL_R_PSK_IDENTITY_NOT_FOUND 223 +#define SSL_R_PSK_NO_CLIENT_CB 224 +#define SSL_R_PSK_NO_SERVER_CB 225 +#define SSL_R_PUBLIC_KEY_ENCRYPT_ERROR 208 +#define SSL_R_PUBLIC_KEY_IS_NOT_RSA 209 +#define SSL_R_PUBLIC_KEY_NOT_RSA 210 +#define SSL_R_READ_BIO_NOT_SET 211 +#define SSL_R_READ_TIMEOUT_EXPIRED 312 +#define SSL_R_READ_WRONG_PACKET_TYPE 212 +#define SSL_R_RECORD_LENGTH_MISMATCH 213 +#define SSL_R_RECORD_TOO_LARGE 214 +#define SSL_R_RECORD_TOO_SMALL 298 +#define SSL_R_RENEGOTIATE_EXT_TOO_LONG 335 +#define SSL_R_RENEGOTIATION_ENCODING_ERR 336 +#define SSL_R_RENEGOTIATION_MISMATCH 337 +#define SSL_R_REQUIRED_CIPHER_MISSING 215 +#define SSL_R_REQUIRED_COMPRESSSION_ALGORITHM_MISSING 342 +#define SSL_R_REUSE_CERT_LENGTH_NOT_ZERO 216 +#define SSL_R_REUSE_CERT_TYPE_NOT_ZERO 217 +#define SSL_R_REUSE_CIPHER_LIST_NOT_ZERO 218 +#define SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING 345 +#define SSL_R_SERVERHELLO_TLSEXT 275 +#define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED 277 +#define SSL_R_SHORT_READ 219 +#define SSL_R_SHUTDOWN_WHILE_IN_INIT 407 +#define SSL_R_SIGNATURE_ALGORITHMS_ERROR 360 +#define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE 220 +#define SSL_R_SRP_A_CALC 361 +#define SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES 362 +#define SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG 363 +#define SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE 364 +#define SSL_R_SSL23_DOING_SESSION_ID_REUSE 221 +#define SSL_R_SSL2_CONNECTION_ID_TOO_LONG 299 +#define SSL_R_SSL3_EXT_INVALID_ECPOINTFORMAT 321 +#define SSL_R_SSL3_EXT_INVALID_SERVERNAME 319 +#define SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE 320 +#define SSL_R_SSL3_SESSION_ID_TOO_LONG 300 +#define SSL_R_SSL3_SESSION_ID_TOO_SHORT 222 +#define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042 +#define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020 +#define SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED 1045 +#define SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED 1044 +#define SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN 1046 +#define SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE 1030 +#define SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE 1040 +#define SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER 1047 +#define SSL_R_SSLV3_ALERT_NO_CERTIFICATE 1041 +#define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010 +#define SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE 1043 +#define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION 228 +#define SSL_R_SSL_HANDSHAKE_FAILURE 229 +#define SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS 230 +#define SSL_R_SSL_SESSION_ID_CALLBACK_FAILED 301 +#define SSL_R_SSL_SESSION_ID_CONFLICT 302 +#define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG 273 +#define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH 303 +#define SSL_R_SSL_SESSION_ID_IS_DIFFERENT 231 +#define SSL_R_TLSV1_ALERT_ACCESS_DENIED 1049 +#define SSL_R_TLSV1_ALERT_DECODE_ERROR 1050 +#define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED 1021 +#define SSL_R_TLSV1_ALERT_DECRYPT_ERROR 1051 +#define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION 1060 +#define SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK 1086 +#define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071 +#define SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080 +#define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100 +#define SSL_R_TLSV1_ALERT_PROTOCOL_VERSION 1070 +#define SSL_R_TLSV1_ALERT_RECORD_OVERFLOW 1022 +#define SSL_R_TLSV1_ALERT_UNKNOWN_CA 1048 +#define SSL_R_TLSV1_ALERT_USER_CANCELLED 1090 +#define SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE 1114 +#define SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE 1113 +#define SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE 1111 +#define SSL_R_TLSV1_UNRECOGNIZED_NAME 1112 +#define SSL_R_TLSV1_UNSUPPORTED_EXTENSION 1110 +#define SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER 232 +#define SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT 365 +#define SSL_R_TLS_HEARTBEAT_PENDING 366 +#define SSL_R_TLS_ILLEGAL_EXPORTER_LABEL 367 +#define SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST 157 +#define SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST 233 +#define SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG 234 +#define SSL_R_TOO_MANY_WARN_ALERTS 409 +#define SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER 235 +#define SSL_R_UNABLE_TO_DECODE_DH_CERTS 236 +#define SSL_R_UNABLE_TO_DECODE_ECDH_CERTS 313 +#define SSL_R_UNABLE_TO_EXTRACT_PUBLIC_KEY 237 +#define SSL_R_UNABLE_TO_FIND_DH_PARAMETERS 238 +#define SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS 314 +#define SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS 239 +#define SSL_R_UNABLE_TO_FIND_SSL_METHOD 240 +#define SSL_R_UNABLE_TO_LOAD_SSL2_MD5_ROUTINES 241 +#define SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES 242 +#define SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES 243 +#define SSL_R_UNEXPECTED_MESSAGE 244 +#define SSL_R_UNEXPECTED_RECORD 245 +#define SSL_R_UNINITIALIZED 276 +#define SSL_R_UNKNOWN_ALERT_TYPE 246 +#define SSL_R_UNKNOWN_CERTIFICATE_TYPE 247 +#define SSL_R_UNKNOWN_CIPHER_RETURNED 248 +#define SSL_R_UNKNOWN_CIPHER_TYPE 249 +#define SSL_R_UNKNOWN_CMD_NAME 386 +#define SSL_R_UNKNOWN_DIGEST 368 +#define SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE 250 +#define SSL_R_UNKNOWN_PKEY_TYPE 251 +#define SSL_R_UNKNOWN_PROTOCOL 252 +#define SSL_R_UNKNOWN_REMOTE_ERROR_TYPE 253 +#define SSL_R_UNKNOWN_SSL_VERSION 254 +#define SSL_R_UNKNOWN_STATE 255 +#define SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED 338 +#define SSL_R_UNSUPPORTED_CIPHER 256 +#define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM 257 +#define SSL_R_UNSUPPORTED_DIGEST_TYPE 326 +#define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE 315 +#define SSL_R_UNSUPPORTED_PROTOCOL 258 +#define SSL_R_UNSUPPORTED_SSL_VERSION 259 +#define SSL_R_UNSUPPORTED_STATUS_TYPE 329 +#define SSL_R_USE_SRTP_NOT_NEGOTIATED 369 +#define SSL_R_WRITE_BIO_NOT_SET 260 +#define SSL_R_WRONG_CERTIFICATE_TYPE 383 +#define SSL_R_WRONG_CIPHER_RETURNED 261 +#define SSL_R_WRONG_CURVE 378 +#define SSL_R_WRONG_MESSAGE_TYPE 262 +#define SSL_R_WRONG_NUMBER_OF_KEY_BITS 263 +#define SSL_R_WRONG_SIGNATURE_LENGTH 264 +#define SSL_R_WRONG_SIGNATURE_SIZE 265 +#define SSL_R_WRONG_SIGNATURE_TYPE 370 +#define SSL_R_WRONG_SSL_VERSION 266 +#define SSL_R_WRONG_VERSION_NUMBER 267 +#define SSL_R_X509_LIB 268 +#define SSL_R_X509_VERIFICATION_SETUP_PROBLEMS 269 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ssl2.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ssl2.h new file mode 100644 index 0000000..dfe24c0 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ssl2.h @@ -0,0 +1,265 @@ +/* ssl/ssl2.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_SSL2_H +#define HEADER_SSL2_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Protocol Version Codes */ +#define SSL2_VERSION 0x0002 +#define SSL2_VERSION_MAJOR 0x00 +#define SSL2_VERSION_MINOR 0x02 +/* #define SSL2_CLIENT_VERSION 0x0002 */ +/* #define SSL2_SERVER_VERSION 0x0002 */ + +/* Protocol Message Codes */ +#define SSL2_MT_ERROR 0 +#define SSL2_MT_CLIENT_HELLO 1 +#define SSL2_MT_CLIENT_MASTER_KEY 2 +#define SSL2_MT_CLIENT_FINISHED 3 +#define SSL2_MT_SERVER_HELLO 4 +#define SSL2_MT_SERVER_VERIFY 5 +#define SSL2_MT_SERVER_FINISHED 6 +#define SSL2_MT_REQUEST_CERTIFICATE 7 +#define SSL2_MT_CLIENT_CERTIFICATE 8 + +/* Error Message Codes */ +#define SSL2_PE_UNDEFINED_ERROR 0x0000 +#define SSL2_PE_NO_CIPHER 0x0001 +#define SSL2_PE_NO_CERTIFICATE 0x0002 +#define SSL2_PE_BAD_CERTIFICATE 0x0004 +#define SSL2_PE_UNSUPPORTED_CERTIFICATE_TYPE 0x0006 + +/* Cipher Kind Values */ +#define SSL2_CK_NULL_WITH_MD5 0x02000000 /* v3 */ +#define SSL2_CK_RC4_128_WITH_MD5 0x02010080 +#define SSL2_CK_RC4_128_EXPORT40_WITH_MD5 0x02020080 +#define SSL2_CK_RC2_128_CBC_WITH_MD5 0x02030080 +#define SSL2_CK_RC2_128_CBC_EXPORT40_WITH_MD5 0x02040080 +#define SSL2_CK_IDEA_128_CBC_WITH_MD5 0x02050080 +#define SSL2_CK_DES_64_CBC_WITH_MD5 0x02060040 +#define SSL2_CK_DES_64_CBC_WITH_SHA 0x02060140 /* v3 */ +#define SSL2_CK_DES_192_EDE3_CBC_WITH_MD5 0x020700c0 +#define SSL2_CK_DES_192_EDE3_CBC_WITH_SHA 0x020701c0 /* v3 */ +#define SSL2_CK_RC4_64_WITH_MD5 0x02080080 /* MS hack */ + +#define SSL2_CK_DES_64_CFB64_WITH_MD5_1 0x02ff0800 /* SSLeay */ +#define SSL2_CK_NULL 0x02ff0810 /* SSLeay */ + +#define SSL2_TXT_DES_64_CFB64_WITH_MD5_1 "DES-CFB-M1" +#define SSL2_TXT_NULL_WITH_MD5 "NULL-MD5" +#define SSL2_TXT_RC4_128_WITH_MD5 "RC4-MD5" +#define SSL2_TXT_RC4_128_EXPORT40_WITH_MD5 "EXP-RC4-MD5" +#define SSL2_TXT_RC2_128_CBC_WITH_MD5 "RC2-CBC-MD5" +#define SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 "EXP-RC2-CBC-MD5" +#define SSL2_TXT_IDEA_128_CBC_WITH_MD5 "IDEA-CBC-MD5" +#define SSL2_TXT_DES_64_CBC_WITH_MD5 "DES-CBC-MD5" +#define SSL2_TXT_DES_64_CBC_WITH_SHA "DES-CBC-SHA" +#define SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5 "DES-CBC3-MD5" +#define SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA "DES-CBC3-SHA" +#define SSL2_TXT_RC4_64_WITH_MD5 "RC4-64-MD5" + +#define SSL2_TXT_NULL "NULL" + +/* Flags for the SSL_CIPHER.algorithm2 field */ +#define SSL2_CF_5_BYTE_ENC 0x01 +#define SSL2_CF_8_BYTE_ENC 0x02 + +/* Certificate Type Codes */ +#define SSL2_CT_X509_CERTIFICATE 0x01 + +/* Authentication Type Code */ +#define SSL2_AT_MD5_WITH_RSA_ENCRYPTION 0x01 + +#define SSL2_MAX_SSL_SESSION_ID_LENGTH 32 + +/* Upper/Lower Bounds */ +#define SSL2_MAX_MASTER_KEY_LENGTH_IN_BITS 256 +#ifdef OPENSSL_SYS_MPE +#define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER 29998u +#else +#define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER 32767u +/* 2^15-1 */ +#endif +#define SSL2_MAX_RECORD_LENGTH_3_BYTE_HEADER 16383 /* 2^14-1 */ + +#define SSL2_CHALLENGE_LENGTH 16 +/* + * #define SSL2_CHALLENGE_LENGTH 32 + */ +#define SSL2_MIN_CHALLENGE_LENGTH 16 +#define SSL2_MAX_CHALLENGE_LENGTH 32 +#define SSL2_CONNECTION_ID_LENGTH 16 +#define SSL2_MAX_CONNECTION_ID_LENGTH 16 +#define SSL2_SSL_SESSION_ID_LENGTH 16 +#define SSL2_MAX_CERT_CHALLENGE_LENGTH 32 +#define SSL2_MIN_CERT_CHALLENGE_LENGTH 16 +#define SSL2_MAX_KEY_MATERIAL_LENGTH 24 + +#ifndef HEADER_SSL_LOCL_H +#define CERT char +#endif + +#ifndef OPENSSL_NO_SSL_INTERN + +typedef struct ssl2_state_st { + int three_byte_header; + int clear_text; /* clear text */ + int escape; /* not used in SSLv2 */ + int ssl2_rollback; /* used if SSLv23 rolled back to SSLv2 */ + /* + * non-blocking io info, used to make sure the same args were passwd + */ + unsigned int wnum; /* number of bytes sent so far */ + int wpend_tot; + const unsigned char* wpend_buf; + int wpend_off; /* offset to data to write */ + int wpend_len; /* number of bytes passwd to write */ + int wpend_ret; /* number of bytes to return to caller */ + /* buffer raw data */ + int rbuf_left; + int rbuf_offs; + unsigned char* rbuf; + unsigned char* wbuf; + unsigned char* write_ptr; /* used to point to the start due to 2/3 byte + * header. */ + unsigned int padding; + unsigned int rlength; /* passed to ssl2_enc */ + int ract_data_length; /* Set when things are encrypted. */ + unsigned int wlength; /* passed to ssl2_enc */ + int wact_data_length; /* Set when things are decrypted. */ + unsigned char* ract_data; + unsigned char* wact_data; + unsigned char* mac_data; + unsigned char* read_key; + unsigned char* write_key; + /* Stuff specifically to do with this SSL session */ + unsigned int challenge_length; + unsigned char challenge[SSL2_MAX_CHALLENGE_LENGTH]; + unsigned int conn_id_length; + unsigned char conn_id[SSL2_MAX_CONNECTION_ID_LENGTH]; + unsigned int key_material_length; + unsigned char key_material[SSL2_MAX_KEY_MATERIAL_LENGTH * 2]; + unsigned long read_sequence; + unsigned long write_sequence; + struct { + unsigned int conn_id_length; + unsigned int cert_type; + unsigned int cert_length; + unsigned int csl; + unsigned int clear; + unsigned int enc; + unsigned char ccl[SSL2_MAX_CERT_CHALLENGE_LENGTH]; + unsigned int cipher_spec_length; + unsigned int session_id_length; + unsigned int clen; + unsigned int rlen; + } tmp; +} SSL2_STATE; + +#endif + +/* SSLv2 */ +/* client */ +#define SSL2_ST_SEND_CLIENT_HELLO_A (0x10 | SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_HELLO_B (0x11 | SSL_ST_CONNECT) +#define SSL2_ST_GET_SERVER_HELLO_A (0x20 | SSL_ST_CONNECT) +#define SSL2_ST_GET_SERVER_HELLO_B (0x21 | SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_MASTER_KEY_A (0x30 | SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_MASTER_KEY_B (0x31 | SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_FINISHED_A (0x40 | SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_FINISHED_B (0x41 | SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_CERTIFICATE_A (0x50 | SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_CERTIFICATE_B (0x51 | SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_CERTIFICATE_C (0x52 | SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_CERTIFICATE_D (0x53 | SSL_ST_CONNECT) +#define SSL2_ST_GET_SERVER_VERIFY_A (0x60 | SSL_ST_CONNECT) +#define SSL2_ST_GET_SERVER_VERIFY_B (0x61 | SSL_ST_CONNECT) +#define SSL2_ST_GET_SERVER_FINISHED_A (0x70 | SSL_ST_CONNECT) +#define SSL2_ST_GET_SERVER_FINISHED_B (0x71 | SSL_ST_CONNECT) +#define SSL2_ST_CLIENT_START_ENCRYPTION (0x80 | SSL_ST_CONNECT) +#define SSL2_ST_X509_GET_CLIENT_CERTIFICATE (0x90 | SSL_ST_CONNECT) +/* server */ +#define SSL2_ST_GET_CLIENT_HELLO_A (0x10 | SSL_ST_ACCEPT) +#define SSL2_ST_GET_CLIENT_HELLO_B (0x11 | SSL_ST_ACCEPT) +#define SSL2_ST_GET_CLIENT_HELLO_C (0x12 | SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_HELLO_A (0x20 | SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_HELLO_B (0x21 | SSL_ST_ACCEPT) +#define SSL2_ST_GET_CLIENT_MASTER_KEY_A (0x30 | SSL_ST_ACCEPT) +#define SSL2_ST_GET_CLIENT_MASTER_KEY_B (0x31 | SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_VERIFY_A (0x40 | SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_VERIFY_B (0x41 | SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_VERIFY_C (0x42 | SSL_ST_ACCEPT) +#define SSL2_ST_GET_CLIENT_FINISHED_A (0x50 | SSL_ST_ACCEPT) +#define SSL2_ST_GET_CLIENT_FINISHED_B (0x51 | SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_FINISHED_A (0x60 | SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_FINISHED_B (0x61 | SSL_ST_ACCEPT) +#define SSL2_ST_SEND_REQUEST_CERTIFICATE_A (0x70 | SSL_ST_ACCEPT) +#define SSL2_ST_SEND_REQUEST_CERTIFICATE_B (0x71 | SSL_ST_ACCEPT) +#define SSL2_ST_SEND_REQUEST_CERTIFICATE_C (0x72 | SSL_ST_ACCEPT) +#define SSL2_ST_SEND_REQUEST_CERTIFICATE_D (0x73 | SSL_ST_ACCEPT) +#define SSL2_ST_SERVER_START_ENCRYPTION (0x80 | SSL_ST_ACCEPT) +#define SSL2_ST_X509_GET_SERVER_CERTIFICATE (0x90 | SSL_ST_ACCEPT) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ssl23.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ssl23.h new file mode 100644 index 0000000..9cc5078 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ssl23.h @@ -0,0 +1,84 @@ +/* ssl/ssl23.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_SSL23_H +#define HEADER_SSL23_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * client + */ +/* write to server */ +#define SSL23_ST_CW_CLNT_HELLO_A (0x210 | SSL_ST_CONNECT) +#define SSL23_ST_CW_CLNT_HELLO_B (0x211 | SSL_ST_CONNECT) +/* read from server */ +#define SSL23_ST_CR_SRVR_HELLO_A (0x220 | SSL_ST_CONNECT) +#define SSL23_ST_CR_SRVR_HELLO_B (0x221 | SSL_ST_CONNECT) + +/* server */ +/* read from client */ +#define SSL23_ST_SR_CLNT_HELLO_A (0x210 | SSL_ST_ACCEPT) +#define SSL23_ST_SR_CLNT_HELLO_B (0x211 | SSL_ST_ACCEPT) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ssl3.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ssl3.h new file mode 100644 index 0000000..b2200f1 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ssl3.h @@ -0,0 +1,774 @@ +/* ssl/ssl3.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright (c) 1998-2002 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * ECC cipher suite support in OpenSSL originally developed by + * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. + */ + +#ifndef HEADER_SSL3_H +#define HEADER_SSL3_H + +#ifndef OPENSSL_NO_COMP +#include +#endif +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Signalling cipher suite value from RFC 5746 + * (TLS_EMPTY_RENEGOTIATION_INFO_SCSV) + */ +#define SSL3_CK_SCSV 0x030000FF + +/* + * Signalling cipher suite value from draft-ietf-tls-downgrade-scsv-00 + * (TLS_FALLBACK_SCSV) + */ +#define SSL3_CK_FALLBACK_SCSV 0x03005600 + +#define SSL3_CK_RSA_NULL_MD5 0x03000001 +#define SSL3_CK_RSA_NULL_SHA 0x03000002 +#define SSL3_CK_RSA_RC4_40_MD5 0x03000003 +#define SSL3_CK_RSA_RC4_128_MD5 0x03000004 +#define SSL3_CK_RSA_RC4_128_SHA 0x03000005 +#define SSL3_CK_RSA_RC2_40_MD5 0x03000006 +#define SSL3_CK_RSA_IDEA_128_SHA 0x03000007 +#define SSL3_CK_RSA_DES_40_CBC_SHA 0x03000008 +#define SSL3_CK_RSA_DES_64_CBC_SHA 0x03000009 +#define SSL3_CK_RSA_DES_192_CBC3_SHA 0x0300000A + +#define SSL3_CK_DH_DSS_DES_40_CBC_SHA 0x0300000B +#define SSL3_CK_DH_DSS_DES_64_CBC_SHA 0x0300000C +#define SSL3_CK_DH_DSS_DES_192_CBC3_SHA 0x0300000D +#define SSL3_CK_DH_RSA_DES_40_CBC_SHA 0x0300000E +#define SSL3_CK_DH_RSA_DES_64_CBC_SHA 0x0300000F +#define SSL3_CK_DH_RSA_DES_192_CBC3_SHA 0x03000010 + +#define SSL3_CK_EDH_DSS_DES_40_CBC_SHA 0x03000011 +#define SSL3_CK_DHE_DSS_DES_40_CBC_SHA SSL3_CK_EDH_DSS_DES_40_CBC_SHA +#define SSL3_CK_EDH_DSS_DES_64_CBC_SHA 0x03000012 +#define SSL3_CK_DHE_DSS_DES_64_CBC_SHA SSL3_CK_EDH_DSS_DES_64_CBC_SHA +#define SSL3_CK_EDH_DSS_DES_192_CBC3_SHA 0x03000013 +#define SSL3_CK_DHE_DSS_DES_192_CBC3_SHA SSL3_CK_EDH_DSS_DES_192_CBC3_SHA +#define SSL3_CK_EDH_RSA_DES_40_CBC_SHA 0x03000014 +#define SSL3_CK_DHE_RSA_DES_40_CBC_SHA SSL3_CK_EDH_RSA_DES_40_CBC_SHA +#define SSL3_CK_EDH_RSA_DES_64_CBC_SHA 0x03000015 +#define SSL3_CK_DHE_RSA_DES_64_CBC_SHA SSL3_CK_EDH_RSA_DES_64_CBC_SHA +#define SSL3_CK_EDH_RSA_DES_192_CBC3_SHA 0x03000016 +#define SSL3_CK_DHE_RSA_DES_192_CBC3_SHA SSL3_CK_EDH_RSA_DES_192_CBC3_SHA + +#define SSL3_CK_ADH_RC4_40_MD5 0x03000017 +#define SSL3_CK_ADH_RC4_128_MD5 0x03000018 +#define SSL3_CK_ADH_DES_40_CBC_SHA 0x03000019 +#define SSL3_CK_ADH_DES_64_CBC_SHA 0x0300001A +#define SSL3_CK_ADH_DES_192_CBC_SHA 0x0300001B + +#if 0 +#define SSL3_CK_FZA_DMS_NULL_SHA 0x0300001C +#define SSL3_CK_FZA_DMS_FZA_SHA 0x0300001D +#if 0 /* Because it clashes with KRB5, is never \ + * used any more, and is safe to remove \ + * according to David Hopwood \ + * of the \ + * ietf-tls list */ +#define SSL3_CK_FZA_DMS_RC4_SHA 0x0300001E +#endif +#endif + +/* + * VRS Additional Kerberos5 entries + */ +#define SSL3_CK_KRB5_DES_64_CBC_SHA 0x0300001E +#define SSL3_CK_KRB5_DES_192_CBC3_SHA 0x0300001F +#define SSL3_CK_KRB5_RC4_128_SHA 0x03000020 +#define SSL3_CK_KRB5_IDEA_128_CBC_SHA 0x03000021 +#define SSL3_CK_KRB5_DES_64_CBC_MD5 0x03000022 +#define SSL3_CK_KRB5_DES_192_CBC3_MD5 0x03000023 +#define SSL3_CK_KRB5_RC4_128_MD5 0x03000024 +#define SSL3_CK_KRB5_IDEA_128_CBC_MD5 0x03000025 + +#define SSL3_CK_KRB5_DES_40_CBC_SHA 0x03000026 +#define SSL3_CK_KRB5_RC2_40_CBC_SHA 0x03000027 +#define SSL3_CK_KRB5_RC4_40_SHA 0x03000028 +#define SSL3_CK_KRB5_DES_40_CBC_MD5 0x03000029 +#define SSL3_CK_KRB5_RC2_40_CBC_MD5 0x0300002A +#define SSL3_CK_KRB5_RC4_40_MD5 0x0300002B + +#define SSL3_TXT_RSA_NULL_MD5 "NULL-MD5" +#define SSL3_TXT_RSA_NULL_SHA "NULL-SHA" +#define SSL3_TXT_RSA_RC4_40_MD5 "EXP-RC4-MD5" +#define SSL3_TXT_RSA_RC4_128_MD5 "RC4-MD5" +#define SSL3_TXT_RSA_RC4_128_SHA "RC4-SHA" +#define SSL3_TXT_RSA_RC2_40_MD5 "EXP-RC2-CBC-MD5" +#define SSL3_TXT_RSA_IDEA_128_SHA "IDEA-CBC-SHA" +#define SSL3_TXT_RSA_DES_40_CBC_SHA "EXP-DES-CBC-SHA" +#define SSL3_TXT_RSA_DES_64_CBC_SHA "DES-CBC-SHA" +#define SSL3_TXT_RSA_DES_192_CBC3_SHA "DES-CBC3-SHA" + +#define SSL3_TXT_DH_DSS_DES_40_CBC_SHA "EXP-DH-DSS-DES-CBC-SHA" +#define SSL3_TXT_DH_DSS_DES_64_CBC_SHA "DH-DSS-DES-CBC-SHA" +#define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA "DH-DSS-DES-CBC3-SHA" +#define SSL3_TXT_DH_RSA_DES_40_CBC_SHA "EXP-DH-RSA-DES-CBC-SHA" +#define SSL3_TXT_DH_RSA_DES_64_CBC_SHA "DH-RSA-DES-CBC-SHA" +#define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA "DH-RSA-DES-CBC3-SHA" + +#define SSL3_TXT_DHE_DSS_DES_40_CBC_SHA "EXP-DHE-DSS-DES-CBC-SHA" +#define SSL3_TXT_DHE_DSS_DES_64_CBC_SHA "DHE-DSS-DES-CBC-SHA" +#define SSL3_TXT_DHE_DSS_DES_192_CBC3_SHA "DHE-DSS-DES-CBC3-SHA" +#define SSL3_TXT_DHE_RSA_DES_40_CBC_SHA "EXP-DHE-RSA-DES-CBC-SHA" +#define SSL3_TXT_DHE_RSA_DES_64_CBC_SHA "DHE-RSA-DES-CBC-SHA" +#define SSL3_TXT_DHE_RSA_DES_192_CBC3_SHA "DHE-RSA-DES-CBC3-SHA" + +/* + * This next block of six "EDH" labels is for backward compatibility with + * older versions of OpenSSL. New code should use the six "DHE" labels above + * instead: + */ +#define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA "EXP-EDH-DSS-DES-CBC-SHA" +#define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA "EDH-DSS-DES-CBC-SHA" +#define SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA "EDH-DSS-DES-CBC3-SHA" +#define SSL3_TXT_EDH_RSA_DES_40_CBC_SHA "EXP-EDH-RSA-DES-CBC-SHA" +#define SSL3_TXT_EDH_RSA_DES_64_CBC_SHA "EDH-RSA-DES-CBC-SHA" +#define SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA "EDH-RSA-DES-CBC3-SHA" + +#define SSL3_TXT_ADH_RC4_40_MD5 "EXP-ADH-RC4-MD5" +#define SSL3_TXT_ADH_RC4_128_MD5 "ADH-RC4-MD5" +#define SSL3_TXT_ADH_DES_40_CBC_SHA "EXP-ADH-DES-CBC-SHA" +#define SSL3_TXT_ADH_DES_64_CBC_SHA "ADH-DES-CBC-SHA" +#define SSL3_TXT_ADH_DES_192_CBC_SHA "ADH-DES-CBC3-SHA" + +#if 0 +#define SSL3_TXT_FZA_DMS_NULL_SHA "FZA-NULL-SHA" +#define SSL3_TXT_FZA_DMS_FZA_SHA "FZA-FZA-CBC-SHA" +#define SSL3_TXT_FZA_DMS_RC4_SHA "FZA-RC4-SHA" +#endif + +#define SSL3_TXT_KRB5_DES_64_CBC_SHA "KRB5-DES-CBC-SHA" +#define SSL3_TXT_KRB5_DES_192_CBC3_SHA "KRB5-DES-CBC3-SHA" +#define SSL3_TXT_KRB5_RC4_128_SHA "KRB5-RC4-SHA" +#define SSL3_TXT_KRB5_IDEA_128_CBC_SHA "KRB5-IDEA-CBC-SHA" +#define SSL3_TXT_KRB5_DES_64_CBC_MD5 "KRB5-DES-CBC-MD5" +#define SSL3_TXT_KRB5_DES_192_CBC3_MD5 "KRB5-DES-CBC3-MD5" +#define SSL3_TXT_KRB5_RC4_128_MD5 "KRB5-RC4-MD5" +#define SSL3_TXT_KRB5_IDEA_128_CBC_MD5 "KRB5-IDEA-CBC-MD5" + +#define SSL3_TXT_KRB5_DES_40_CBC_SHA "EXP-KRB5-DES-CBC-SHA" +#define SSL3_TXT_KRB5_RC2_40_CBC_SHA "EXP-KRB5-RC2-CBC-SHA" +#define SSL3_TXT_KRB5_RC4_40_SHA "EXP-KRB5-RC4-SHA" +#define SSL3_TXT_KRB5_DES_40_CBC_MD5 "EXP-KRB5-DES-CBC-MD5" +#define SSL3_TXT_KRB5_RC2_40_CBC_MD5 "EXP-KRB5-RC2-CBC-MD5" +#define SSL3_TXT_KRB5_RC4_40_MD5 "EXP-KRB5-RC4-MD5" + +#define SSL3_SSL_SESSION_ID_LENGTH 32 +#define SSL3_MAX_SSL_SESSION_ID_LENGTH 32 + +#define SSL3_MASTER_SECRET_SIZE 48 +#define SSL3_RANDOM_SIZE 32 +#define SSL3_SESSION_ID_SIZE 32 +#define SSL3_RT_HEADER_LENGTH 5 + +#define SSL3_HM_HEADER_LENGTH 4 + +#ifndef SSL3_ALIGN_PAYLOAD +/* + * Some will argue that this increases memory footprint, but it's not + * actually true. Point is that malloc has to return at least 64-bit aligned + * pointers, meaning that allocating 5 bytes wastes 3 bytes in either case. + * Suggested pre-gaping simply moves these wasted bytes from the end of + * allocated region to its front, but makes data payload aligned, which + * improves performance:-) + */ +#define SSL3_ALIGN_PAYLOAD 8 +#else +#if (SSL3_ALIGN_PAYLOAD & (SSL3_ALIGN_PAYLOAD - 1)) != 0 +#error "insane SSL3_ALIGN_PAYLOAD" +#undef SSL3_ALIGN_PAYLOAD +#endif +#endif + +/* + * This is the maximum MAC (digest) size used by the SSL library. Currently + * maximum of 20 is used by SHA1, but we reserve for future extension for + * 512-bit hashes. + */ + +#define SSL3_RT_MAX_MD_SIZE 64 + +/* + * Maximum block size used in all ciphersuites. Currently 16 for AES. + */ + +#define SSL_RT_MAX_CIPHER_BLOCK_SIZE 16 + +#define SSL3_RT_MAX_EXTRA (16384) + +/* Maximum plaintext length: defined by SSL/TLS standards */ +#define SSL3_RT_MAX_PLAIN_LENGTH 16384 +/* Maximum compression overhead: defined by SSL/TLS standards */ +#define SSL3_RT_MAX_COMPRESSED_OVERHEAD 1024 + +/* + * The standards give a maximum encryption overhead of 1024 bytes. In + * practice the value is lower than this. The overhead is the maximum number + * of padding bytes (256) plus the mac size. + */ +#define SSL3_RT_MAX_ENCRYPTED_OVERHEAD (256 + SSL3_RT_MAX_MD_SIZE) + +/* + * OpenSSL currently only uses a padding length of at most one block so the + * send overhead is smaller. + */ + +#define SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD \ + (SSL_RT_MAX_CIPHER_BLOCK_SIZE + SSL3_RT_MAX_MD_SIZE) + +/* If compression isn't used don't include the compression overhead */ + +#ifdef OPENSSL_NO_COMP +#define SSL3_RT_MAX_COMPRESSED_LENGTH SSL3_RT_MAX_PLAIN_LENGTH +#else +#define SSL3_RT_MAX_COMPRESSED_LENGTH \ + (SSL3_RT_MAX_PLAIN_LENGTH + SSL3_RT_MAX_COMPRESSED_OVERHEAD) +#endif +#define SSL3_RT_MAX_ENCRYPTED_LENGTH \ + (SSL3_RT_MAX_ENCRYPTED_OVERHEAD + SSL3_RT_MAX_COMPRESSED_LENGTH) +#define SSL3_RT_MAX_PACKET_SIZE \ + (SSL3_RT_MAX_ENCRYPTED_LENGTH + SSL3_RT_HEADER_LENGTH) + +#define SSL3_MD_CLIENT_FINISHED_CONST "\x43\x4C\x4E\x54" +#define SSL3_MD_SERVER_FINISHED_CONST "\x53\x52\x56\x52" + +#define SSL3_VERSION 0x0300 +#define SSL3_VERSION_MAJOR 0x03 +#define SSL3_VERSION_MINOR 0x00 + +#define SSL3_RT_CHANGE_CIPHER_SPEC 20 +#define SSL3_RT_ALERT 21 +#define SSL3_RT_HANDSHAKE 22 +#define SSL3_RT_APPLICATION_DATA 23 +#define TLS1_RT_HEARTBEAT 24 + +/* Pseudo content types to indicate additional parameters */ +#define TLS1_RT_CRYPTO 0x1000 +#define TLS1_RT_CRYPTO_PREMASTER (TLS1_RT_CRYPTO | 0x1) +#define TLS1_RT_CRYPTO_CLIENT_RANDOM (TLS1_RT_CRYPTO | 0x2) +#define TLS1_RT_CRYPTO_SERVER_RANDOM (TLS1_RT_CRYPTO | 0x3) +#define TLS1_RT_CRYPTO_MASTER (TLS1_RT_CRYPTO | 0x4) + +#define TLS1_RT_CRYPTO_READ 0x0000 +#define TLS1_RT_CRYPTO_WRITE 0x0100 +#define TLS1_RT_CRYPTO_MAC (TLS1_RT_CRYPTO | 0x5) +#define TLS1_RT_CRYPTO_KEY (TLS1_RT_CRYPTO | 0x6) +#define TLS1_RT_CRYPTO_IV (TLS1_RT_CRYPTO | 0x7) +#define TLS1_RT_CRYPTO_FIXED_IV (TLS1_RT_CRYPTO | 0x8) + +/* Pseudo content type for SSL/TLS header info */ +#define SSL3_RT_HEADER 0x100 + +#define SSL3_AL_WARNING 1 +#define SSL3_AL_FATAL 2 + +#define SSL3_AD_CLOSE_NOTIFY 0 +#define SSL3_AD_UNEXPECTED_MESSAGE 10 /* fatal */ +#define SSL3_AD_BAD_RECORD_MAC 20 /* fatal */ +#define SSL3_AD_DECOMPRESSION_FAILURE 30 /* fatal */ +#define SSL3_AD_HANDSHAKE_FAILURE 40 /* fatal */ +#define SSL3_AD_NO_CERTIFICATE 41 +#define SSL3_AD_BAD_CERTIFICATE 42 +#define SSL3_AD_UNSUPPORTED_CERTIFICATE 43 +#define SSL3_AD_CERTIFICATE_REVOKED 44 +#define SSL3_AD_CERTIFICATE_EXPIRED 45 +#define SSL3_AD_CERTIFICATE_UNKNOWN 46 +#define SSL3_AD_ILLEGAL_PARAMETER 47 /* fatal */ + +#define TLS1_HB_REQUEST 1 +#define TLS1_HB_RESPONSE 2 + +#ifndef OPENSSL_NO_SSL_INTERN + +typedef struct ssl3_record_st { + /* type of record */ + /* + * r + */ int type; + /* How many bytes available */ + /* + * rw + */ unsigned int length; + /* read/write offset into 'buf' */ + /* + * r + */ unsigned int off; + /* pointer to the record data */ + /* + * rw + */ unsigned char* data; + /* where the decode bytes are */ + /* + * rw + */ unsigned char* input; + /* only used with decompression - malloc()ed */ + /* + * r + */ unsigned char* comp; + /* epoch number, needed by DTLS1 */ + /* + * r + */ unsigned long epoch; + /* sequence number, needed by DTLS1 */ + /* + * r + */ unsigned char seq_num[8]; +} SSL3_RECORD; + +typedef struct ssl3_buffer_st { + /* at least SSL3_RT_MAX_PACKET_SIZE bytes, see ssl3_setup_buffers() */ + unsigned char* buf; + /* buffer size */ + size_t len; + /* where to 'copy from' */ + int offset; + /* how many bytes left */ + int left; +} SSL3_BUFFER; + +#endif + +#define SSL3_CT_RSA_SIGN 1 +#define SSL3_CT_DSS_SIGN 2 +#define SSL3_CT_RSA_FIXED_DH 3 +#define SSL3_CT_DSS_FIXED_DH 4 +#define SSL3_CT_RSA_EPHEMERAL_DH 5 +#define SSL3_CT_DSS_EPHEMERAL_DH 6 +#define SSL3_CT_FORTEZZA_DMS 20 +/* + * SSL3_CT_NUMBER is used to size arrays and it must be large enough to + * contain all of the cert types defined either for SSLv3 and TLSv1. + */ +#define SSL3_CT_NUMBER 9 + +#define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS 0x0001 +#define SSL3_FLAGS_DELAY_CLIENT_FINISHED 0x0002 +#define SSL3_FLAGS_POP_BUFFER 0x0004 +#define TLS1_FLAGS_TLS_PADDING_BUG 0x0008 +#define TLS1_FLAGS_SKIP_CERT_VERIFY 0x0010 +#define TLS1_FLAGS_KEEP_HANDSHAKE 0x0020 +/* + * Set when the handshake is ready to process peer's ChangeCipherSpec message. + * Cleared after the message has been processed. + */ +#define SSL3_FLAGS_CCS_OK 0x0080 + +/* SSL3_FLAGS_SGC_RESTART_DONE is no longer used */ +#define SSL3_FLAGS_SGC_RESTART_DONE 0x0040 + +#ifndef OPENSSL_NO_SSL_INTERN + +typedef struct ssl3_state_st { + long flags; + int delay_buf_pop_ret; + unsigned char read_sequence[8]; + int read_mac_secret_size; + unsigned char read_mac_secret[EVP_MAX_MD_SIZE]; + unsigned char write_sequence[8]; + int write_mac_secret_size; + unsigned char write_mac_secret[EVP_MAX_MD_SIZE]; + unsigned char server_random[SSL3_RANDOM_SIZE]; + unsigned char client_random[SSL3_RANDOM_SIZE]; + /* flags for countermeasure against known-IV weakness */ + int need_empty_fragments; + int empty_fragment_done; + /* The value of 'extra' when the buffers were initialized */ + int init_extra; + SSL3_BUFFER rbuf; /* read IO goes into here */ + SSL3_BUFFER wbuf; /* write IO goes into here */ + SSL3_RECORD rrec; /* each decoded record goes in here */ + SSL3_RECORD wrec; /* goes out from here */ + /* + * storage for Alert/Handshake protocol data received but not yet + * processed by ssl3_read_bytes: + */ + unsigned char alert_fragment[2]; + unsigned int alert_fragment_len; + unsigned char handshake_fragment[4]; + unsigned int handshake_fragment_len; + /* partial write - check the numbers match */ + unsigned int wnum; /* number of bytes sent so far */ + int wpend_tot; /* number bytes written */ + int wpend_type; + int wpend_ret; /* number of bytes submitted */ + const unsigned char* wpend_buf; + /* used during startup, digest all incoming/outgoing packets */ + BIO* handshake_buffer; + /* + * When set of handshake digests is determined, buffer is hashed and + * freed and MD_CTX-es for all required digests are stored in this array + */ + EVP_MD_CTX** handshake_dgst; + /* + * Set whenever an expected ChangeCipherSpec message is processed. + * Unset when the peer's Finished message is received. + * Unexpected ChangeCipherSpec messages trigger a fatal alert. + */ + int change_cipher_spec; + int warn_alert; + int fatal_alert; + /* + * we allow one fatal and one warning alert to be outstanding, send close + * alert via the warning alert + */ + int alert_dispatch; + unsigned char send_alert[2]; + /* + * This flag is set when we should renegotiate ASAP, basically when there + * is no more data in the read or write buffers + */ + int renegotiate; + int total_renegotiations; + int num_renegotiations; + int in_read_app_data; + /* + * Opaque PRF input as used for the current handshake. These fields are + * used only if TLSEXT_TYPE_opaque_prf_input is defined (otherwise, they + * are merely present to improve binary compatibility) + */ + void* client_opaque_prf_input; + size_t client_opaque_prf_input_len; + void* server_opaque_prf_input; + size_t server_opaque_prf_input_len; + struct { + /* actually only needs to be 16+20 */ + unsigned char cert_verify_md[EVP_MAX_MD_SIZE * 2]; + /* actually only need to be 16+20 for SSLv3 and 12 for TLS */ + unsigned char finish_md[EVP_MAX_MD_SIZE * 2]; + int finish_md_len; + unsigned char peer_finish_md[EVP_MAX_MD_SIZE * 2]; + int peer_finish_md_len; + unsigned long message_size; + int message_type; + /* used to hold the new cipher we are going to use */ + const SSL_CIPHER* new_cipher; +#ifndef OPENSSL_NO_DH + DH* dh; +#endif +#ifndef OPENSSL_NO_ECDH + EC_KEY* ecdh; /* holds short lived ECDH key */ +#endif + /* used when SSL_ST_FLUSH_DATA is entered */ + int next_state; + int reuse_message; + /* used for certificate requests */ + int cert_req; + int ctype_num; + char ctype[SSL3_CT_NUMBER]; + STACK_OF(X509_NAME) * ca_names; + int use_rsa_tmp; + int key_block_length; + unsigned char* key_block; + const EVP_CIPHER* new_sym_enc; + const EVP_MD* new_hash; + int new_mac_pkey_type; + int new_mac_secret_size; +#ifndef OPENSSL_NO_COMP + const SSL_COMP* new_compression; +#else + char* new_compression; +#endif + int cert_request; + } tmp; + + /* Connection binding to prevent renegotiation attacks */ + unsigned char previous_client_finished[EVP_MAX_MD_SIZE]; + unsigned char previous_client_finished_len; + unsigned char previous_server_finished[EVP_MAX_MD_SIZE]; + unsigned char previous_server_finished_len; + int send_connection_binding; /* TODOEKR */ + +#ifndef OPENSSL_NO_NEXTPROTONEG + /* + * Set if we saw the Next Protocol Negotiation extension from our peer. + */ + int next_proto_neg_seen; +#endif + +#ifndef OPENSSL_NO_TLSEXT +#ifndef OPENSSL_NO_EC + /* + * This is set to true if we believe that this is a version of Safari + * running on OS X 10.6 or newer. We wish to know this because Safari on + * 10.8 .. 10.8.3 has broken ECDHE-ECDSA support. + */ + char is_probably_safari; +#endif /* !OPENSSL_NO_EC */ + + /* + * ALPN information (we are in the process of transitioning from NPN to + * ALPN.) + */ + + /* + * In a server these point to the selected ALPN protocol after the + * ClientHello has been processed. In a client these contain the protocol + * that the server selected once the ServerHello has been processed. + */ + unsigned char* alpn_selected; + unsigned alpn_selected_len; +#endif /* OPENSSL_NO_TLSEXT */ +} SSL3_STATE; + +#endif + +/* SSLv3 */ +/* + * client + */ +/* extra state */ +#define SSL3_ST_CW_FLUSH (0x100 | SSL_ST_CONNECT) +#ifndef OPENSSL_NO_SCTP +#define DTLS1_SCTP_ST_CW_WRITE_SOCK (0x310 | SSL_ST_CONNECT) +#define DTLS1_SCTP_ST_CR_READ_SOCK (0x320 | SSL_ST_CONNECT) +#endif +/* write to server */ +#define SSL3_ST_CW_CLNT_HELLO_A (0x110 | SSL_ST_CONNECT) +#define SSL3_ST_CW_CLNT_HELLO_B (0x111 | SSL_ST_CONNECT) +/* read from server */ +#define SSL3_ST_CR_SRVR_HELLO_A (0x120 | SSL_ST_CONNECT) +#define SSL3_ST_CR_SRVR_HELLO_B (0x121 | SSL_ST_CONNECT) +#define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A (0x126 | SSL_ST_CONNECT) +#define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B (0x127 | SSL_ST_CONNECT) +#define SSL3_ST_CR_CERT_A (0x130 | SSL_ST_CONNECT) +#define SSL3_ST_CR_CERT_B (0x131 | SSL_ST_CONNECT) +#define SSL3_ST_CR_KEY_EXCH_A (0x140 | SSL_ST_CONNECT) +#define SSL3_ST_CR_KEY_EXCH_B (0x141 | SSL_ST_CONNECT) +#define SSL3_ST_CR_CERT_REQ_A (0x150 | SSL_ST_CONNECT) +#define SSL3_ST_CR_CERT_REQ_B (0x151 | SSL_ST_CONNECT) +#define SSL3_ST_CR_SRVR_DONE_A (0x160 | SSL_ST_CONNECT) +#define SSL3_ST_CR_SRVR_DONE_B (0x161 | SSL_ST_CONNECT) +/* write to server */ +#define SSL3_ST_CW_CERT_A (0x170 | SSL_ST_CONNECT) +#define SSL3_ST_CW_CERT_B (0x171 | SSL_ST_CONNECT) +#define SSL3_ST_CW_CERT_C (0x172 | SSL_ST_CONNECT) +#define SSL3_ST_CW_CERT_D (0x173 | SSL_ST_CONNECT) +#define SSL3_ST_CW_KEY_EXCH_A (0x180 | SSL_ST_CONNECT) +#define SSL3_ST_CW_KEY_EXCH_B (0x181 | SSL_ST_CONNECT) +#define SSL3_ST_CW_CERT_VRFY_A (0x190 | SSL_ST_CONNECT) +#define SSL3_ST_CW_CERT_VRFY_B (0x191 | SSL_ST_CONNECT) +#define SSL3_ST_CW_CHANGE_A (0x1A0 | SSL_ST_CONNECT) +#define SSL3_ST_CW_CHANGE_B (0x1A1 | SSL_ST_CONNECT) +#ifndef OPENSSL_NO_NEXTPROTONEG +#define SSL3_ST_CW_NEXT_PROTO_A (0x200 | SSL_ST_CONNECT) +#define SSL3_ST_CW_NEXT_PROTO_B (0x201 | SSL_ST_CONNECT) +#endif +#define SSL3_ST_CW_FINISHED_A (0x1B0 | SSL_ST_CONNECT) +#define SSL3_ST_CW_FINISHED_B (0x1B1 | SSL_ST_CONNECT) +/* read from server */ +#define SSL3_ST_CR_CHANGE_A (0x1C0 | SSL_ST_CONNECT) +#define SSL3_ST_CR_CHANGE_B (0x1C1 | SSL_ST_CONNECT) +#define SSL3_ST_CR_FINISHED_A (0x1D0 | SSL_ST_CONNECT) +#define SSL3_ST_CR_FINISHED_B (0x1D1 | SSL_ST_CONNECT) +#define SSL3_ST_CR_SESSION_TICKET_A (0x1E0 | SSL_ST_CONNECT) +#define SSL3_ST_CR_SESSION_TICKET_B (0x1E1 | SSL_ST_CONNECT) +#define SSL3_ST_CR_CERT_STATUS_A (0x1F0 | SSL_ST_CONNECT) +#define SSL3_ST_CR_CERT_STATUS_B (0x1F1 | SSL_ST_CONNECT) + +/* server */ +/* extra state */ +#define SSL3_ST_SW_FLUSH (0x100 | SSL_ST_ACCEPT) +#ifndef OPENSSL_NO_SCTP +#define DTLS1_SCTP_ST_SW_WRITE_SOCK (0x310 | SSL_ST_ACCEPT) +#define DTLS1_SCTP_ST_SR_READ_SOCK (0x320 | SSL_ST_ACCEPT) +#endif +/* read from client */ +/* Do not change the number values, they do matter */ +#define SSL3_ST_SR_CLNT_HELLO_A (0x110 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_CLNT_HELLO_B (0x111 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_CLNT_HELLO_C (0x112 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_CLNT_HELLO_D (0x115 | SSL_ST_ACCEPT) +/* write to client */ +#define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_A (0x113 | SSL_ST_ACCEPT) +#define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_B (0x114 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_HELLO_REQ_A (0x120 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_HELLO_REQ_B (0x121 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_HELLO_REQ_C (0x122 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_SRVR_HELLO_A (0x130 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_SRVR_HELLO_B (0x131 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_CERT_A (0x140 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_CERT_B (0x141 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_KEY_EXCH_A (0x150 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_KEY_EXCH_B (0x151 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_CERT_REQ_A (0x160 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_CERT_REQ_B (0x161 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_SRVR_DONE_A (0x170 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_SRVR_DONE_B (0x171 | SSL_ST_ACCEPT) +/* read from client */ +#define SSL3_ST_SR_CERT_A (0x180 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_CERT_B (0x181 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_KEY_EXCH_A (0x190 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_KEY_EXCH_B (0x191 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_CERT_VRFY_A (0x1A0 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_CERT_VRFY_B (0x1A1 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_CHANGE_A (0x1B0 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_CHANGE_B (0x1B1 | SSL_ST_ACCEPT) +#ifndef OPENSSL_NO_NEXTPROTONEG +#define SSL3_ST_SR_NEXT_PROTO_A (0x210 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_NEXT_PROTO_B (0x211 | SSL_ST_ACCEPT) +#endif +#define SSL3_ST_SR_FINISHED_A (0x1C0 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_FINISHED_B (0x1C1 | SSL_ST_ACCEPT) +/* write to client */ +#define SSL3_ST_SW_CHANGE_A (0x1D0 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_CHANGE_B (0x1D1 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_FINISHED_A (0x1E0 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_FINISHED_B (0x1E1 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_SESSION_TICKET_A (0x1F0 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_SESSION_TICKET_B (0x1F1 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_CERT_STATUS_A (0x200 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_CERT_STATUS_B (0x201 | SSL_ST_ACCEPT) + +#define SSL3_MT_HELLO_REQUEST 0 +#define SSL3_MT_CLIENT_HELLO 1 +#define SSL3_MT_SERVER_HELLO 2 +#define SSL3_MT_NEWSESSION_TICKET 4 +#define SSL3_MT_CERTIFICATE 11 +#define SSL3_MT_SERVER_KEY_EXCHANGE 12 +#define SSL3_MT_CERTIFICATE_REQUEST 13 +#define SSL3_MT_SERVER_DONE 14 +#define SSL3_MT_CERTIFICATE_VERIFY 15 +#define SSL3_MT_CLIENT_KEY_EXCHANGE 16 +#define SSL3_MT_FINISHED 20 +#define SSL3_MT_CERTIFICATE_STATUS 22 +#ifndef OPENSSL_NO_NEXTPROTONEG +#define SSL3_MT_NEXT_PROTO 67 +#endif +#define DTLS1_MT_HELLO_VERIFY_REQUEST 3 + +#define SSL3_MT_CCS 1 + +/* These are used when changing over to a new cipher */ +#define SSL3_CC_READ 0x01 +#define SSL3_CC_WRITE 0x02 +#define SSL3_CC_CLIENT 0x10 +#define SSL3_CC_SERVER 0x20 +#define SSL3_CHANGE_CIPHER_CLIENT_WRITE (SSL3_CC_CLIENT | SSL3_CC_WRITE) +#define SSL3_CHANGE_CIPHER_SERVER_READ (SSL3_CC_SERVER | SSL3_CC_READ) +#define SSL3_CHANGE_CIPHER_CLIENT_READ (SSL3_CC_CLIENT | SSL3_CC_READ) +#define SSL3_CHANGE_CIPHER_SERVER_WRITE (SSL3_CC_SERVER | SSL3_CC_WRITE) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/stack.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/stack.h new file mode 100644 index 0000000..62b6928 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/stack.h @@ -0,0 +1,108 @@ +/* crypto/stack/stack.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_STACK_H +#define HEADER_STACK_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct stack_st { + int num; + char** data; + int sorted; + int num_alloc; + int (*comp)(const void*, const void*); +} _STACK; /* Use STACK_OF(...) instead */ + +#define M_sk_num(sk) ((sk) ? (sk)->num : -1) +#define M_sk_value(sk, n) ((sk) ? (sk)->data[n] : NULL) + +int sk_num(const _STACK*); +void* sk_value(const _STACK*, int); + +void* sk_set(_STACK*, int, void*); + +_STACK* sk_new(int (*cmp)(const void*, const void*)); +_STACK* sk_new_null(void); +void sk_free(_STACK*); +void sk_pop_free(_STACK* st, void (*func)(void*)); +_STACK* sk_deep_copy(_STACK*, void* (*)(void*), void (*)(void*)); +int sk_insert(_STACK* sk, void* data, int where); +void* sk_delete(_STACK* st, int loc); +void* sk_delete_ptr(_STACK* st, void* p); +int sk_find(_STACK* st, void* data); +int sk_find_ex(_STACK* st, void* data); +int sk_push(_STACK* st, void* data); +int sk_unshift(_STACK* st, void* data); +void* sk_shift(_STACK* st); +void* sk_pop(_STACK* st); +void sk_zero(_STACK* st); +int (*sk_set_cmp_func(_STACK* sk, int (*c)(const void*, const void*)))( + const void*, + const void*); +_STACK* sk_dup(_STACK* st); +void sk_sort(_STACK* st); +int sk_is_sorted(const _STACK* st); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/symhacks.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/symhacks.h new file mode 100644 index 0000000..97629aa --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/symhacks.h @@ -0,0 +1,507 @@ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_SYMHACKS_H +#define HEADER_SYMHACKS_H + +#include + +/* + * Hacks to solve the problem with linkers incapable of handling very long + * symbol names. In the case of VMS, the limit is 31 characters on VMS for + * VAX. + */ +/* + * Note that this affects util/libeay.num and util/ssleay.num... you may + * change those manually, but that's not recommended, as those files are + * controlled centrally and updated on Unix, and the central definition may + * disagree with yours, which in turn may come with shareable library + * incompatibilities. + */ +#ifdef OPENSSL_SYS_VMS + +/* Hack a long name in crypto/ex_data.c */ +#undef CRYPTO_get_ex_data_implementation +#define CRYPTO_get_ex_data_implementation CRYPTO_get_ex_data_impl +#undef CRYPTO_set_ex_data_implementation +#define CRYPTO_set_ex_data_implementation CRYPTO_set_ex_data_impl + +/* Hack a long name in crypto/asn1/a_mbstr.c */ +#undef ASN1_STRING_set_default_mask_asc +#define ASN1_STRING_set_default_mask_asc ASN1_STRING_set_def_mask_asc + +#if 0 /* No longer needed, since safestack macro \ + * magic does the job */ +/* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO) */ +#undef i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO +#define i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO i2d_ASN1_SET_OF_PKCS7_SIGINF +#undef d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO +#define d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO d2i_ASN1_SET_OF_PKCS7_SIGINF +#endif + +#if 0 /* No longer needed, since safestack macro \ + * magic does the job */ +/* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO) */ +#undef i2d_ASN1_SET_OF_PKCS7_RECIP_INFO +#define i2d_ASN1_SET_OF_PKCS7_RECIP_INFO i2d_ASN1_SET_OF_PKCS7_RECINF +#undef d2i_ASN1_SET_OF_PKCS7_RECIP_INFO +#define d2i_ASN1_SET_OF_PKCS7_RECIP_INFO d2i_ASN1_SET_OF_PKCS7_RECINF +#endif + +#if 0 /* No longer needed, since safestack macro \ + * magic does the job */ +/* Hack the names created with DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION) */ +#undef i2d_ASN1_SET_OF_ACCESS_DESCRIPTION +#define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION i2d_ASN1_SET_OF_ACC_DESC +#undef d2i_ASN1_SET_OF_ACCESS_DESCRIPTION +#define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION d2i_ASN1_SET_OF_ACC_DESC +#endif + +/* Hack the names created with DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE) */ +#undef PEM_read_NETSCAPE_CERT_SEQUENCE +#define PEM_read_NETSCAPE_CERT_SEQUENCE PEM_read_NS_CERT_SEQ +#undef PEM_write_NETSCAPE_CERT_SEQUENCE +#define PEM_write_NETSCAPE_CERT_SEQUENCE PEM_write_NS_CERT_SEQ +#undef PEM_read_bio_NETSCAPE_CERT_SEQUENCE +#define PEM_read_bio_NETSCAPE_CERT_SEQUENCE PEM_read_bio_NS_CERT_SEQ +#undef PEM_write_bio_NETSCAPE_CERT_SEQUENCE +#define PEM_write_bio_NETSCAPE_CERT_SEQUENCE PEM_write_bio_NS_CERT_SEQ +#undef PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE +#define PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE PEM_write_cb_bio_NS_CERT_SEQ + +/* Hack the names created with DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO) */ +#undef PEM_read_PKCS8_PRIV_KEY_INFO +#define PEM_read_PKCS8_PRIV_KEY_INFO PEM_read_P8_PRIV_KEY_INFO +#undef PEM_write_PKCS8_PRIV_KEY_INFO +#define PEM_write_PKCS8_PRIV_KEY_INFO PEM_write_P8_PRIV_KEY_INFO +#undef PEM_read_bio_PKCS8_PRIV_KEY_INFO +#define PEM_read_bio_PKCS8_PRIV_KEY_INFO PEM_read_bio_P8_PRIV_KEY_INFO +#undef PEM_write_bio_PKCS8_PRIV_KEY_INFO +#define PEM_write_bio_PKCS8_PRIV_KEY_INFO PEM_write_bio_P8_PRIV_KEY_INFO +#undef PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO +#define PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO PEM_wrt_cb_bio_P8_PRIV_KEY_INFO + +/* Hack other PEM names */ +#undef PEM_write_bio_PKCS8PrivateKey_nid +#define PEM_write_bio_PKCS8PrivateKey_nid PEM_write_bio_PKCS8PrivKey_nid + +/* Hack some long X509 names */ +#undef X509_REVOKED_get_ext_by_critical +#define X509_REVOKED_get_ext_by_critical X509_REVOKED_get_ext_by_critic +#undef X509_policy_tree_get0_user_policies +#define X509_policy_tree_get0_user_policies X509_pcy_tree_get0_usr_policies +#undef X509_policy_node_get0_qualifiers +#define X509_policy_node_get0_qualifiers X509_pcy_node_get0_qualifiers +#undef X509_STORE_CTX_get_explicit_policy +#define X509_STORE_CTX_get_explicit_policy X509_STORE_CTX_get_expl_policy +#undef X509_STORE_CTX_get0_current_issuer +#define X509_STORE_CTX_get0_current_issuer X509_STORE_CTX_get0_cur_issuer + +/* Hack some long CRYPTO names */ +#undef CRYPTO_set_dynlock_destroy_callback +#define CRYPTO_set_dynlock_destroy_callback CRYPTO_set_dynlock_destroy_cb +#undef CRYPTO_set_dynlock_create_callback +#define CRYPTO_set_dynlock_create_callback CRYPTO_set_dynlock_create_cb +#undef CRYPTO_set_dynlock_lock_callback +#define CRYPTO_set_dynlock_lock_callback CRYPTO_set_dynlock_lock_cb +#undef CRYPTO_get_dynlock_lock_callback +#define CRYPTO_get_dynlock_lock_callback CRYPTO_get_dynlock_lock_cb +#undef CRYPTO_get_dynlock_destroy_callback +#define CRYPTO_get_dynlock_destroy_callback CRYPTO_get_dynlock_destroy_cb +#undef CRYPTO_get_dynlock_create_callback +#define CRYPTO_get_dynlock_create_callback CRYPTO_get_dynlock_create_cb +#undef CRYPTO_set_locked_mem_ex_functions +#define CRYPTO_set_locked_mem_ex_functions CRYPTO_set_locked_mem_ex_funcs +#undef CRYPTO_get_locked_mem_ex_functions +#define CRYPTO_get_locked_mem_ex_functions CRYPTO_get_locked_mem_ex_funcs + +/* Hack some long SSL/TLS names */ +#undef SSL_CTX_set_default_verify_paths +#define SSL_CTX_set_default_verify_paths SSL_CTX_set_def_verify_paths +#undef SSL_get_ex_data_X509_STORE_CTX_idx +#define SSL_get_ex_data_X509_STORE_CTX_idx SSL_get_ex_d_X509_STORE_CTX_idx +#undef SSL_add_file_cert_subjects_to_stack +#define SSL_add_file_cert_subjects_to_stack SSL_add_file_cert_subjs_to_stk +#undef SSL_add_dir_cert_subjects_to_stack +#define SSL_add_dir_cert_subjects_to_stack SSL_add_dir_cert_subjs_to_stk +#undef SSL_CTX_use_certificate_chain_file +#define SSL_CTX_use_certificate_chain_file SSL_CTX_use_cert_chain_file +#undef SSL_CTX_set_cert_verify_callback +#define SSL_CTX_set_cert_verify_callback SSL_CTX_set_cert_verify_cb +#undef SSL_CTX_set_default_passwd_cb_userdata +#define SSL_CTX_set_default_passwd_cb_userdata SSL_CTX_set_def_passwd_cb_ud +#undef SSL_COMP_get_compression_methods +#define SSL_COMP_get_compression_methods SSL_COMP_get_compress_methods +#undef SSL_COMP_set0_compression_methods +#define SSL_COMP_set0_compression_methods SSL_COMP_set0_compress_methods +#undef SSL_COMP_free_compression_methods +#define SSL_COMP_free_compression_methods SSL_COMP_free_compress_methods +#undef ssl_add_clienthello_renegotiate_ext +#define ssl_add_clienthello_renegotiate_ext ssl_add_clienthello_reneg_ext +#undef ssl_add_serverhello_renegotiate_ext +#define ssl_add_serverhello_renegotiate_ext ssl_add_serverhello_reneg_ext +#undef ssl_parse_clienthello_renegotiate_ext +#define ssl_parse_clienthello_renegotiate_ext ssl_parse_clienthello_reneg_ext +#undef ssl_parse_serverhello_renegotiate_ext +#define ssl_parse_serverhello_renegotiate_ext ssl_parse_serverhello_reneg_ext +#undef SSL_srp_server_param_with_username +#define SSL_srp_server_param_with_username SSL_srp_server_param_with_un +#undef SSL_CTX_set_srp_client_pwd_callback +#define SSL_CTX_set_srp_client_pwd_callback SSL_CTX_set_srp_client_pwd_cb +#undef SSL_CTX_set_srp_verify_param_callback +#define SSL_CTX_set_srp_verify_param_callback SSL_CTX_set_srp_vfy_param_cb +#undef SSL_CTX_set_srp_username_callback +#define SSL_CTX_set_srp_username_callback SSL_CTX_set_srp_un_cb +#undef ssl_add_clienthello_use_srtp_ext +#define ssl_add_clienthello_use_srtp_ext ssl_add_clihello_use_srtp_ext +#undef ssl_add_serverhello_use_srtp_ext +#define ssl_add_serverhello_use_srtp_ext ssl_add_serhello_use_srtp_ext +#undef ssl_parse_clienthello_use_srtp_ext +#define ssl_parse_clienthello_use_srtp_ext ssl_parse_clihello_use_srtp_ext +#undef ssl_parse_serverhello_use_srtp_ext +#define ssl_parse_serverhello_use_srtp_ext ssl_parse_serhello_use_srtp_ext +#undef SSL_CTX_set_next_protos_advertised_cb +#define SSL_CTX_set_next_protos_advertised_cb SSL_CTX_set_next_protos_adv_cb +#undef SSL_CTX_set_next_proto_select_cb +#define SSL_CTX_set_next_proto_select_cb SSL_CTX_set_next_proto_sel_cb + +#undef tls1_send_server_supplemental_data +#define tls1_send_server_supplemental_data tls1_send_server_suppl_data +#undef tls1_send_client_supplemental_data +#define tls1_send_client_supplemental_data tls1_send_client_suppl_data +#undef tls1_get_server_supplemental_data +#define tls1_get_server_supplemental_data tls1_get_server_suppl_data +#undef tls1_get_client_supplemental_data +#define tls1_get_client_supplemental_data tls1_get_client_suppl_data + +#undef ssl3_cbc_record_digest_supported +#define ssl3_cbc_record_digest_supported ssl3_cbc_record_digest_support +#undef ssl_check_clienthello_tlsext_late +#define ssl_check_clienthello_tlsext_late ssl_check_clihello_tlsext_late +#undef ssl_check_clienthello_tlsext_early +#define ssl_check_clienthello_tlsext_early ssl_check_clihello_tlsext_early + +/* Hack some RSA long names */ +#undef RSA_padding_check_PKCS1_OAEP_mgf1 +#define RSA_padding_check_PKCS1_OAEP_mgf1 RSA_pad_check_PKCS1_OAEP_mgf1 + +/* Hack some ENGINE long names */ +#undef ENGINE_get_default_BN_mod_exp_crt +#define ENGINE_get_default_BN_mod_exp_crt ENGINE_get_def_BN_mod_exp_crt +#undef ENGINE_set_default_BN_mod_exp_crt +#define ENGINE_set_default_BN_mod_exp_crt ENGINE_set_def_BN_mod_exp_crt +#undef ENGINE_set_load_privkey_function +#define ENGINE_set_load_privkey_function ENGINE_set_load_privkey_fn +#undef ENGINE_get_load_privkey_function +#define ENGINE_get_load_privkey_function ENGINE_get_load_privkey_fn +#undef ENGINE_unregister_pkey_asn1_meths +#define ENGINE_unregister_pkey_asn1_meths ENGINE_unreg_pkey_asn1_meths +#undef ENGINE_register_all_pkey_asn1_meths +#define ENGINE_register_all_pkey_asn1_meths ENGINE_reg_all_pkey_asn1_meths +#undef ENGINE_set_default_pkey_asn1_meths +#define ENGINE_set_default_pkey_asn1_meths ENGINE_set_def_pkey_asn1_meths +#undef ENGINE_get_pkey_asn1_meth_engine +#define ENGINE_get_pkey_asn1_meth_engine ENGINE_get_pkey_asn1_meth_eng +#undef ENGINE_set_load_ssl_client_cert_function +#define ENGINE_set_load_ssl_client_cert_function ENGINE_set_ld_ssl_clnt_cert_fn +#undef ENGINE_get_ssl_client_cert_function +#define ENGINE_get_ssl_client_cert_function ENGINE_get_ssl_client_cert_fn + +/* Hack some long OCSP names */ +#undef OCSP_REQUEST_get_ext_by_critical +#define OCSP_REQUEST_get_ext_by_critical OCSP_REQUEST_get_ext_by_crit +#undef OCSP_BASICRESP_get_ext_by_critical +#define OCSP_BASICRESP_get_ext_by_critical OCSP_BASICRESP_get_ext_by_crit +#undef OCSP_SINGLERESP_get_ext_by_critical +#define OCSP_SINGLERESP_get_ext_by_critical OCSP_SINGLERESP_get_ext_by_crit + +/* Hack some long DES names */ +#undef _ossl_old_des_ede3_cfb64_encrypt +#define _ossl_old_des_ede3_cfb64_encrypt _ossl_odes_ede3_cfb64_encrypt +#undef _ossl_old_des_ede3_ofb64_encrypt +#define _ossl_old_des_ede3_ofb64_encrypt _ossl_odes_ede3_ofb64_encrypt + +/* Hack some long EVP names */ +#undef OPENSSL_add_all_algorithms_noconf +#define OPENSSL_add_all_algorithms_noconf OPENSSL_add_all_algo_noconf +#undef OPENSSL_add_all_algorithms_conf +#define OPENSSL_add_all_algorithms_conf OPENSSL_add_all_algo_conf +#undef EVP_PKEY_meth_set_verify_recover +#define EVP_PKEY_meth_set_verify_recover EVP_PKEY_meth_set_vrfy_recover +#undef EVP_PKEY_meth_get_verify_recover +#define EVP_PKEY_meth_get_verify_recover EVP_PKEY_meth_get_vrfy_recover + +/* Hack some long EC names */ +#undef EC_GROUP_set_point_conversion_form +#define EC_GROUP_set_point_conversion_form EC_GROUP_set_point_conv_form +#undef EC_GROUP_get_point_conversion_form +#define EC_GROUP_get_point_conversion_form EC_GROUP_get_point_conv_form +#undef EC_GROUP_clear_free_all_extra_data +#define EC_GROUP_clear_free_all_extra_data EC_GROUP_clr_free_all_xtra_data +#undef EC_KEY_set_public_key_affine_coordinates +#define EC_KEY_set_public_key_affine_coordinates EC_KEY_set_pub_key_aff_coords +#undef EC_POINT_set_Jprojective_coordinates_GFp +#define EC_POINT_set_Jprojective_coordinates_GFp EC_POINT_set_Jproj_coords_GFp +#undef EC_POINT_get_Jprojective_coordinates_GFp +#define EC_POINT_get_Jprojective_coordinates_GFp EC_POINT_get_Jproj_coords_GFp +#undef EC_POINT_set_affine_coordinates_GFp +#define EC_POINT_set_affine_coordinates_GFp EC_POINT_set_affine_coords_GFp +#undef EC_POINT_get_affine_coordinates_GFp +#define EC_POINT_get_affine_coordinates_GFp EC_POINT_get_affine_coords_GFp +#undef EC_POINT_set_compressed_coordinates_GFp +#define EC_POINT_set_compressed_coordinates_GFp EC_POINT_set_compr_coords_GFp +#undef EC_POINT_set_affine_coordinates_GF2m +#define EC_POINT_set_affine_coordinates_GF2m EC_POINT_set_affine_coords_GF2m +#undef EC_POINT_get_affine_coordinates_GF2m +#define EC_POINT_get_affine_coordinates_GF2m EC_POINT_get_affine_coords_GF2m +#undef EC_POINT_set_compressed_coordinates_GF2m +#define EC_POINT_set_compressed_coordinates_GF2m EC_POINT_set_compr_coords_GF2m +#undef ec_GF2m_simple_group_clear_finish +#define ec_GF2m_simple_group_clear_finish ec_GF2m_simple_grp_clr_finish +#undef ec_GF2m_simple_group_check_discriminant +#define ec_GF2m_simple_group_check_discriminant ec_GF2m_simple_grp_chk_discrim +#undef ec_GF2m_simple_point_clear_finish +#define ec_GF2m_simple_point_clear_finish ec_GF2m_simple_pt_clr_finish +#undef ec_GF2m_simple_point_set_to_infinity +#define ec_GF2m_simple_point_set_to_infinity ec_GF2m_simple_pt_set_to_inf +#undef ec_GF2m_simple_points_make_affine +#define ec_GF2m_simple_points_make_affine ec_GF2m_simple_pts_make_affine +#undef ec_GF2m_simple_point_set_affine_coordinates +#define ec_GF2m_simple_point_set_affine_coordinates ec_GF2m_smp_pt_set_af_coords +#undef ec_GF2m_simple_point_get_affine_coordinates +#define ec_GF2m_simple_point_get_affine_coordinates ec_GF2m_smp_pt_get_af_coords +#undef ec_GF2m_simple_set_compressed_coordinates +#define ec_GF2m_simple_set_compressed_coordinates ec_GF2m_smp_set_compr_coords +#undef ec_GFp_simple_group_set_curve_GFp +#define ec_GFp_simple_group_set_curve_GFp ec_GFp_simple_grp_set_curve_GFp +#undef ec_GFp_simple_group_get_curve_GFp +#define ec_GFp_simple_group_get_curve_GFp ec_GFp_simple_grp_get_curve_GFp +#undef ec_GFp_simple_group_clear_finish +#define ec_GFp_simple_group_clear_finish ec_GFp_simple_grp_clear_finish +#undef ec_GFp_simple_group_set_generator +#define ec_GFp_simple_group_set_generator ec_GFp_simple_grp_set_generator +#undef ec_GFp_simple_group_get0_generator +#define ec_GFp_simple_group_get0_generator ec_GFp_simple_grp_gt0_generator +#undef ec_GFp_simple_group_get_cofactor +#define ec_GFp_simple_group_get_cofactor ec_GFp_simple_grp_get_cofactor +#undef ec_GFp_simple_point_clear_finish +#define ec_GFp_simple_point_clear_finish ec_GFp_simple_pt_clear_finish +#undef ec_GFp_simple_point_set_to_infinity +#define ec_GFp_simple_point_set_to_infinity ec_GFp_simple_pt_set_to_inf +#undef ec_GFp_simple_points_make_affine +#define ec_GFp_simple_points_make_affine ec_GFp_simple_pts_make_affine +#undef ec_GFp_simple_set_Jprojective_coordinates_GFp +#define ec_GFp_simple_set_Jprojective_coordinates_GFp \ + ec_GFp_smp_set_Jproj_coords_GFp +#undef ec_GFp_simple_get_Jprojective_coordinates_GFp +#define ec_GFp_simple_get_Jprojective_coordinates_GFp \ + ec_GFp_smp_get_Jproj_coords_GFp +#undef ec_GFp_simple_point_set_affine_coordinates_GFp +#define ec_GFp_simple_point_set_affine_coordinates_GFp \ + ec_GFp_smp_pt_set_af_coords_GFp +#undef ec_GFp_simple_point_get_affine_coordinates_GFp +#define ec_GFp_simple_point_get_affine_coordinates_GFp \ + ec_GFp_smp_pt_get_af_coords_GFp +#undef ec_GFp_simple_set_compressed_coordinates_GFp +#define ec_GFp_simple_set_compressed_coordinates_GFp \ + ec_GFp_smp_set_compr_coords_GFp +#undef ec_GFp_simple_point_set_affine_coordinates +#define ec_GFp_simple_point_set_affine_coordinates ec_GFp_smp_pt_set_af_coords +#undef ec_GFp_simple_point_get_affine_coordinates +#define ec_GFp_simple_point_get_affine_coordinates ec_GFp_smp_pt_get_af_coords +#undef ec_GFp_simple_set_compressed_coordinates +#define ec_GFp_simple_set_compressed_coordinates ec_GFp_smp_set_compr_coords +#undef ec_GFp_simple_group_check_discriminant +#define ec_GFp_simple_group_check_discriminant ec_GFp_simple_grp_chk_discrim + +/* Hack som long STORE names */ +#undef STORE_method_set_initialise_function +#define STORE_method_set_initialise_function STORE_meth_set_initialise_fn +#undef STORE_method_set_cleanup_function +#define STORE_method_set_cleanup_function STORE_meth_set_cleanup_fn +#undef STORE_method_set_generate_function +#define STORE_method_set_generate_function STORE_meth_set_generate_fn +#undef STORE_method_set_modify_function +#define STORE_method_set_modify_function STORE_meth_set_modify_fn +#undef STORE_method_set_revoke_function +#define STORE_method_set_revoke_function STORE_meth_set_revoke_fn +#undef STORE_method_set_delete_function +#define STORE_method_set_delete_function STORE_meth_set_delete_fn +#undef STORE_method_set_list_start_function +#define STORE_method_set_list_start_function STORE_meth_set_list_start_fn +#undef STORE_method_set_list_next_function +#define STORE_method_set_list_next_function STORE_meth_set_list_next_fn +#undef STORE_method_set_list_end_function +#define STORE_method_set_list_end_function STORE_meth_set_list_end_fn +#undef STORE_method_set_update_store_function +#define STORE_method_set_update_store_function STORE_meth_set_update_store_fn +#undef STORE_method_set_lock_store_function +#define STORE_method_set_lock_store_function STORE_meth_set_lock_store_fn +#undef STORE_method_set_unlock_store_function +#define STORE_method_set_unlock_store_function STORE_meth_set_unlock_store_fn +#undef STORE_method_get_initialise_function +#define STORE_method_get_initialise_function STORE_meth_get_initialise_fn +#undef STORE_method_get_cleanup_function +#define STORE_method_get_cleanup_function STORE_meth_get_cleanup_fn +#undef STORE_method_get_generate_function +#define STORE_method_get_generate_function STORE_meth_get_generate_fn +#undef STORE_method_get_modify_function +#define STORE_method_get_modify_function STORE_meth_get_modify_fn +#undef STORE_method_get_revoke_function +#define STORE_method_get_revoke_function STORE_meth_get_revoke_fn +#undef STORE_method_get_delete_function +#define STORE_method_get_delete_function STORE_meth_get_delete_fn +#undef STORE_method_get_list_start_function +#define STORE_method_get_list_start_function STORE_meth_get_list_start_fn +#undef STORE_method_get_list_next_function +#define STORE_method_get_list_next_function STORE_meth_get_list_next_fn +#undef STORE_method_get_list_end_function +#define STORE_method_get_list_end_function STORE_meth_get_list_end_fn +#undef STORE_method_get_update_store_function +#define STORE_method_get_update_store_function STORE_meth_get_update_store_fn +#undef STORE_method_get_lock_store_function +#define STORE_method_get_lock_store_function STORE_meth_get_lock_store_fn +#undef STORE_method_get_unlock_store_function +#define STORE_method_get_unlock_store_function STORE_meth_get_unlock_store_fn + +/* Hack some long TS names */ +#undef TS_RESP_CTX_set_status_info_cond +#define TS_RESP_CTX_set_status_info_cond TS_RESP_CTX_set_stat_info_cond +#undef TS_RESP_CTX_set_clock_precision_digits +#define TS_RESP_CTX_set_clock_precision_digits TS_RESP_CTX_set_clk_prec_digits +#undef TS_CONF_set_clock_precision_digits +#define TS_CONF_set_clock_precision_digits TS_CONF_set_clk_prec_digits + +/* Hack some long CMS names */ +#undef CMS_RecipientInfo_ktri_get0_algs +#define CMS_RecipientInfo_ktri_get0_algs CMS_RecipInfo_ktri_get0_algs +#undef CMS_RecipientInfo_ktri_get0_signer_id +#define CMS_RecipientInfo_ktri_get0_signer_id CMS_RecipInfo_ktri_get0_sigr_id +#undef CMS_OtherRevocationInfoFormat_it +#define CMS_OtherRevocationInfoFormat_it CMS_OtherRevocInfoFormat_it +#undef CMS_KeyAgreeRecipientIdentifier_it +#define CMS_KeyAgreeRecipientIdentifier_it CMS_KeyAgreeRecipIdentifier_it +#undef CMS_OriginatorIdentifierOrKey_it +#define CMS_OriginatorIdentifierOrKey_it CMS_OriginatorIdOrKey_it +#undef cms_SignerIdentifier_get0_signer_id +#define cms_SignerIdentifier_get0_signer_id cms_SignerId_get0_signer_id +#undef CMS_RecipientInfo_kari_get0_orig_id +#define CMS_RecipientInfo_kari_get0_orig_id CMS_RecipInfo_kari_get0_orig_id +#undef CMS_RecipientInfo_kari_get0_reks +#define CMS_RecipientInfo_kari_get0_reks CMS_RecipInfo_kari_get0_reks +#undef CMS_RecipientEncryptedKey_cert_cmp +#define CMS_RecipientEncryptedKey_cert_cmp CMS_RecipEncryptedKey_cert_cmp +#undef CMS_RecipientInfo_kari_set0_pkey +#define CMS_RecipientInfo_kari_set0_pkey CMS_RecipInfo_kari_set0_pkey +#undef CMS_RecipientEncryptedKey_get0_id +#define CMS_RecipientEncryptedKey_get0_id CMS_RecipEncryptedKey_get0_id +#undef CMS_RecipientInfo_kari_orig_id_cmp +#define CMS_RecipientInfo_kari_orig_id_cmp CMS_RecipInfo_kari_orig_id_cmp + +/* Hack some long DTLS1 names */ +#undef dtls1_retransmit_buffered_messages +#define dtls1_retransmit_buffered_messages dtls1_retransmit_buffered_msgs + +/* Hack some long SRP names */ +#undef SRP_generate_server_master_secret +#define SRP_generate_server_master_secret SRP_gen_server_master_secret +#undef SRP_generate_client_master_secret +#define SRP_generate_client_master_secret SRP_gen_client_master_secret + +/* Hack some long UI names */ +#undef UI_method_get_prompt_constructor +#define UI_method_get_prompt_constructor UI_method_get_prompt_constructr +#undef UI_method_set_prompt_constructor +#define UI_method_set_prompt_constructor UI_method_set_prompt_constructr + +#endif /* defined OPENSSL_SYS_VMS */ + +/* Case insensitive linking causes problems.... */ +#if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2) +#undef ERR_load_CRYPTO_strings +#define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings +#undef OCSP_crlID_new +#define OCSP_crlID_new OCSP_crlID2_new + +#undef d2i_ECPARAMETERS +#define d2i_ECPARAMETERS d2i_UC_ECPARAMETERS +#undef i2d_ECPARAMETERS +#define i2d_ECPARAMETERS i2d_UC_ECPARAMETERS +#undef d2i_ECPKPARAMETERS +#define d2i_ECPKPARAMETERS d2i_UC_ECPKPARAMETERS +#undef i2d_ECPKPARAMETERS +#define i2d_ECPKPARAMETERS i2d_UC_ECPKPARAMETERS + +/* + * These functions do not seem to exist! However, I'm paranoid... Original + * command in x509v3.h: These functions are being redefined in another + * directory, and clash when the linker is case-insensitive, so let's hide + * them a little, by giving them an extra 'o' at the beginning of the name... + */ +#undef X509v3_cleanup_extensions +#define X509v3_cleanup_extensions oX509v3_cleanup_extensions +#undef X509v3_add_extension +#define X509v3_add_extension oX509v3_add_extension +#undef X509v3_add_netscape_extensions +#define X509v3_add_netscape_extensions oX509v3_add_netscape_extensions +#undef X509v3_add_standard_extensions +#define X509v3_add_standard_extensions oX509v3_add_standard_extensions + +/* This one clashes with CMS_data_create */ +#undef cms_Data_create +#define cms_Data_create priv_cms_Data_create + +#endif + +#endif /* ! defined HEADER_VMS_IDHACKS_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/tls1.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/tls1.h new file mode 100644 index 0000000..288f89b --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/tls1.h @@ -0,0 +1,844 @@ +/* ssl/tls1.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright (c) 1998-2006 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * + * Portions of the attached software ("Contribution") are developed by + * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project. + * + * The Contribution is licensed pursuant to the OpenSSL open source + * license provided above. + * + * ECC cipher suite support in OpenSSL originally written by + * Vipul Gupta and Sumit Gupta of Sun Microsystems Laboratories. + * + */ +/* ==================================================================== + * Copyright 2005 Nokia. All rights reserved. + * + * The portions of the attached software ("Contribution") is developed by + * Nokia Corporation and is licensed pursuant to the OpenSSL open source + * license. + * + * The Contribution, originally written by Mika Kousa and Pasi Eronen of + * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites + * support (see RFC 4279) to OpenSSL. + * + * No patent licenses or other rights except those expressly stated in + * the OpenSSL open source license shall be deemed granted or received + * expressly, by implication, estoppel, or otherwise. + * + * No assurances are provided by Nokia that the Contribution does not + * infringe the patent or other intellectual property rights of any third + * party or that the license provides you with all the necessary rights + * to make use of the Contribution. + * + * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN + * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA + * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY + * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR + * OTHERWISE. + */ + +#ifndef HEADER_TLS1_H +#define HEADER_TLS1_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES 0 + +#define TLS1_VERSION 0x0301 +#define TLS1_1_VERSION 0x0302 +#define TLS1_2_VERSION 0x0303 +#define TLS_MAX_VERSION TLS1_2_VERSION + +#define TLS1_VERSION_MAJOR 0x03 +#define TLS1_VERSION_MINOR 0x01 + +#define TLS1_1_VERSION_MAJOR 0x03 +#define TLS1_1_VERSION_MINOR 0x02 + +#define TLS1_2_VERSION_MAJOR 0x03 +#define TLS1_2_VERSION_MINOR 0x03 + +#define TLS1_get_version(s) \ + ((s->version >> 8) == TLS1_VERSION_MAJOR ? s->version : 0) + +#define TLS1_get_client_version(s) \ + ((s->client_version >> 8) == TLS1_VERSION_MAJOR ? s->client_version : 0) + +#define TLS1_AD_DECRYPTION_FAILED 21 +#define TLS1_AD_RECORD_OVERFLOW 22 +#define TLS1_AD_UNKNOWN_CA 48 /* fatal */ +#define TLS1_AD_ACCESS_DENIED 49 /* fatal */ +#define TLS1_AD_DECODE_ERROR 50 /* fatal */ +#define TLS1_AD_DECRYPT_ERROR 51 +#define TLS1_AD_EXPORT_RESTRICTION 60 /* fatal */ +#define TLS1_AD_PROTOCOL_VERSION 70 /* fatal */ +#define TLS1_AD_INSUFFICIENT_SECURITY 71 /* fatal */ +#define TLS1_AD_INTERNAL_ERROR 80 /* fatal */ +#define TLS1_AD_INAPPROPRIATE_FALLBACK 86 /* fatal */ +#define TLS1_AD_USER_CANCELLED 90 +#define TLS1_AD_NO_RENEGOTIATION 100 +/* codes 110-114 are from RFC3546 */ +#define TLS1_AD_UNSUPPORTED_EXTENSION 110 +#define TLS1_AD_CERTIFICATE_UNOBTAINABLE 111 +#define TLS1_AD_UNRECOGNIZED_NAME 112 +#define TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE 113 +#define TLS1_AD_BAD_CERTIFICATE_HASH_VALUE 114 +#define TLS1_AD_UNKNOWN_PSK_IDENTITY 115 /* fatal */ + +/* ExtensionType values from RFC3546 / RFC4366 / RFC6066 */ +#define TLSEXT_TYPE_server_name 0 +#define TLSEXT_TYPE_max_fragment_length 1 +#define TLSEXT_TYPE_client_certificate_url 2 +#define TLSEXT_TYPE_trusted_ca_keys 3 +#define TLSEXT_TYPE_truncated_hmac 4 +#define TLSEXT_TYPE_status_request 5 +/* ExtensionType values from RFC4681 */ +#define TLSEXT_TYPE_user_mapping 6 +/* ExtensionType values from RFC5878 */ +#define TLSEXT_TYPE_client_authz 7 +#define TLSEXT_TYPE_server_authz 8 +/* ExtensionType values from RFC6091 */ +#define TLSEXT_TYPE_cert_type 9 + +/* ExtensionType values from RFC4492 */ +#define TLSEXT_TYPE_elliptic_curves 10 +#define TLSEXT_TYPE_ec_point_formats 11 + +/* ExtensionType value from RFC5054 */ +#define TLSEXT_TYPE_srp 12 + +/* ExtensionType values from RFC5246 */ +#define TLSEXT_TYPE_signature_algorithms 13 + +/* ExtensionType value from RFC5764 */ +#define TLSEXT_TYPE_use_srtp 14 + +/* ExtensionType value from RFC5620 */ +#define TLSEXT_TYPE_heartbeat 15 + +/* ExtensionType value from RFC7301 */ +#define TLSEXT_TYPE_application_layer_protocol_negotiation 16 + +/* + * ExtensionType value for TLS padding extension. + * http://tools.ietf.org/html/draft-agl-tls-padding + */ +#define TLSEXT_TYPE_padding 21 + +/* ExtensionType value from RFC4507 */ +#define TLSEXT_TYPE_session_ticket 35 + +/* ExtensionType value from draft-rescorla-tls-opaque-prf-input-00.txt */ +#if 0 +/* + * will have to be provided externally for now , + * i.e. build with -DTLSEXT_TYPE_opaque_prf_input=38183 + * using whatever extension number you'd like to try + */ +#define TLSEXT_TYPE_opaque_prf_input ? ? +#endif + +/* Temporary extension type */ +#define TLSEXT_TYPE_renegotiate 0xff01 + +#ifndef OPENSSL_NO_NEXTPROTONEG +/* This is not an IANA defined extension number */ +#define TLSEXT_TYPE_next_proto_neg 13172 +#endif + +/* NameType value from RFC3546 */ +#define TLSEXT_NAMETYPE_host_name 0 +/* status request value from RFC3546 */ +#define TLSEXT_STATUSTYPE_ocsp 1 + +/* ECPointFormat values from RFC4492 */ +#define TLSEXT_ECPOINTFORMAT_first 0 +#define TLSEXT_ECPOINTFORMAT_uncompressed 0 +#define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime 1 +#define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2 2 +#define TLSEXT_ECPOINTFORMAT_last 2 + +/* Signature and hash algorithms from RFC5246 */ +#define TLSEXT_signature_anonymous 0 +#define TLSEXT_signature_rsa 1 +#define TLSEXT_signature_dsa 2 +#define TLSEXT_signature_ecdsa 3 + +/* Total number of different signature algorithms */ +#define TLSEXT_signature_num 4 + +#define TLSEXT_hash_none 0 +#define TLSEXT_hash_md5 1 +#define TLSEXT_hash_sha1 2 +#define TLSEXT_hash_sha224 3 +#define TLSEXT_hash_sha256 4 +#define TLSEXT_hash_sha384 5 +#define TLSEXT_hash_sha512 6 + +/* Total number of different digest algorithms */ + +#define TLSEXT_hash_num 7 + +/* Flag set for unrecognised algorithms */ +#define TLSEXT_nid_unknown 0x1000000 + +/* ECC curves */ + +#define TLSEXT_curve_P_256 23 +#define TLSEXT_curve_P_384 24 + +#ifndef OPENSSL_NO_TLSEXT + +#define TLSEXT_MAXLEN_host_name 255 + +const char* SSL_get_servername(const SSL* s, const int type); +int SSL_get_servername_type(const SSL* s); +/* + * SSL_export_keying_material exports a value derived from the master secret, + * as specified in RFC 5705. It writes |olen| bytes to |out| given a label and + * optional context. (Since a zero length context is allowed, the |use_context| + * flag controls whether a context is included.) It returns 1 on success and + * zero otherwise. + */ +int SSL_export_keying_material( + SSL* s, + unsigned char* out, + size_t olen, + const char* label, + size_t llen, + const unsigned char* context, + size_t contextlen, + int use_context); + +int SSL_get_sigalgs( + SSL* s, + int idx, + int* psign, + int* phash, + int* psignandhash, + unsigned char* rsig, + unsigned char* rhash); + +int SSL_get_shared_sigalgs( + SSL* s, + int idx, + int* psign, + int* phash, + int* psignandhash, + unsigned char* rsig, + unsigned char* rhash); + +int SSL_check_chain(SSL* s, X509* x, EVP_PKEY* pk, STACK_OF(X509) * chain); + +#define SSL_set_tlsext_host_name(s, name) \ + SSL_ctrl( \ + s, SSL_CTRL_SET_TLSEXT_HOSTNAME, TLSEXT_NAMETYPE_host_name, (char*)name) + +#define SSL_set_tlsext_debug_callback(ssl, cb) \ + SSL_callback_ctrl(ssl, SSL_CTRL_SET_TLSEXT_DEBUG_CB, (void (*)(void))cb) + +#define SSL_set_tlsext_debug_arg(ssl, arg) \ + SSL_ctrl(ssl, SSL_CTRL_SET_TLSEXT_DEBUG_ARG, 0, (void*)arg) + +#define SSL_set_tlsext_status_type(ssl, type) \ + SSL_ctrl(ssl, SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE, type, NULL) + +#define SSL_get_tlsext_status_exts(ssl, arg) \ + SSL_ctrl(ssl, SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS, 0, (void*)arg) + +#define SSL_set_tlsext_status_exts(ssl, arg) \ + SSL_ctrl(ssl, SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS, 0, (void*)arg) + +#define SSL_get_tlsext_status_ids(ssl, arg) \ + SSL_ctrl(ssl, SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS, 0, (void*)arg) + +#define SSL_set_tlsext_status_ids(ssl, arg) \ + SSL_ctrl(ssl, SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS, 0, (void*)arg) + +#define SSL_get_tlsext_status_ocsp_resp(ssl, arg) \ + SSL_ctrl(ssl, SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP, 0, (void*)arg) + +#define SSL_set_tlsext_status_ocsp_resp(ssl, arg, arglen) \ + SSL_ctrl(ssl, SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP, arglen, (void*)arg) + +#define SSL_CTX_set_tlsext_servername_callback(ctx, cb) \ + SSL_CTX_callback_ctrl( \ + ctx, SSL_CTRL_SET_TLSEXT_SERVERNAME_CB, (void (*)(void))cb) + +#define SSL_TLSEXT_ERR_OK 0 +#define SSL_TLSEXT_ERR_ALERT_WARNING 1 +#define SSL_TLSEXT_ERR_ALERT_FATAL 2 +#define SSL_TLSEXT_ERR_NOACK 3 + +#define SSL_CTX_set_tlsext_servername_arg(ctx, arg) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG, 0, (void*)arg) + +#define SSL_CTX_get_tlsext_ticket_keys(ctx, keys, keylen) \ + SSL_CTX_ctrl((ctx), SSL_CTRL_GET_TLSEXT_TICKET_KEYS, (keylen), (keys)) +#define SSL_CTX_set_tlsext_ticket_keys(ctx, keys, keylen) \ + SSL_CTX_ctrl((ctx), SSL_CTRL_SET_TLSEXT_TICKET_KEYS, (keylen), (keys)) + +#define SSL_CTX_set_tlsext_status_cb(ssl, cb) \ + SSL_CTX_callback_ctrl( \ + ssl, SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB, (void (*)(void))cb) + +#define SSL_CTX_set_tlsext_status_arg(ssl, arg) \ + SSL_CTX_ctrl(ssl, SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG, 0, (void*)arg) + +#define SSL_set_tlsext_opaque_prf_input(s, src, len) \ + SSL_ctrl(s, SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT, len, src) +#define SSL_CTX_set_tlsext_opaque_prf_input_callback(ctx, cb) \ + SSL_CTX_callback_ctrl( \ + ctx, SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB, (void (*)(void))cb) +#define SSL_CTX_set_tlsext_opaque_prf_input_callback_arg(ctx, arg) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG, 0, arg) + +#define SSL_CTX_set_tlsext_ticket_key_cb(ssl, cb) \ + SSL_CTX_callback_ctrl( \ + ssl, SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB, (void (*)(void))cb) + +#ifndef OPENSSL_NO_HEARTBEATS +#define SSL_TLSEXT_HB_ENABLED 0x01 +#define SSL_TLSEXT_HB_DONT_SEND_REQUESTS 0x02 +#define SSL_TLSEXT_HB_DONT_RECV_REQUESTS 0x04 + +#define SSL_get_tlsext_heartbeat_pending(ssl) \ + SSL_ctrl((ssl), SSL_CTRL_GET_TLS_EXT_HEARTBEAT_PENDING, 0, NULL) +#define SSL_set_tlsext_heartbeat_no_requests(ssl, arg) \ + SSL_ctrl((ssl), SSL_CTRL_SET_TLS_EXT_HEARTBEAT_NO_REQUESTS, arg, NULL) +#endif +#endif + +/* PSK ciphersuites from 4279 */ +#define TLS1_CK_PSK_WITH_RC4_128_SHA 0x0300008A +#define TLS1_CK_PSK_WITH_3DES_EDE_CBC_SHA 0x0300008B +#define TLS1_CK_PSK_WITH_AES_128_CBC_SHA 0x0300008C +#define TLS1_CK_PSK_WITH_AES_256_CBC_SHA 0x0300008D + +/* + * Additional TLS ciphersuites from expired Internet Draft + * draft-ietf-tls-56-bit-ciphersuites-01.txt (available if + * TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES is defined, see s3_lib.c). We + * actually treat them like SSL 3.0 ciphers, which we probably shouldn't. + * Note that the first two are actually not in the IDs. + */ +#define TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_MD5 \ + 0x03000060 /* not in \ + * ID */ +#define TLS1_CK_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5 \ + 0x03000061 /* not in \ + * ID */ +#define TLS1_CK_RSA_EXPORT1024_WITH_DES_CBC_SHA 0x03000062 +#define TLS1_CK_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA 0x03000063 +#define TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_SHA 0x03000064 +#define TLS1_CK_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA 0x03000065 +#define TLS1_CK_DHE_DSS_WITH_RC4_128_SHA 0x03000066 + +/* AES ciphersuites from RFC3268 */ +#define TLS1_CK_RSA_WITH_AES_128_SHA 0x0300002F +#define TLS1_CK_DH_DSS_WITH_AES_128_SHA 0x03000030 +#define TLS1_CK_DH_RSA_WITH_AES_128_SHA 0x03000031 +#define TLS1_CK_DHE_DSS_WITH_AES_128_SHA 0x03000032 +#define TLS1_CK_DHE_RSA_WITH_AES_128_SHA 0x03000033 +#define TLS1_CK_ADH_WITH_AES_128_SHA 0x03000034 + +#define TLS1_CK_RSA_WITH_AES_256_SHA 0x03000035 +#define TLS1_CK_DH_DSS_WITH_AES_256_SHA 0x03000036 +#define TLS1_CK_DH_RSA_WITH_AES_256_SHA 0x03000037 +#define TLS1_CK_DHE_DSS_WITH_AES_256_SHA 0x03000038 +#define TLS1_CK_DHE_RSA_WITH_AES_256_SHA 0x03000039 +#define TLS1_CK_ADH_WITH_AES_256_SHA 0x0300003A + +/* TLS v1.2 ciphersuites */ +#define TLS1_CK_RSA_WITH_NULL_SHA256 0x0300003B +#define TLS1_CK_RSA_WITH_AES_128_SHA256 0x0300003C +#define TLS1_CK_RSA_WITH_AES_256_SHA256 0x0300003D +#define TLS1_CK_DH_DSS_WITH_AES_128_SHA256 0x0300003E +#define TLS1_CK_DH_RSA_WITH_AES_128_SHA256 0x0300003F +#define TLS1_CK_DHE_DSS_WITH_AES_128_SHA256 0x03000040 + +/* Camellia ciphersuites from RFC4132 */ +#define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000041 +#define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000042 +#define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000043 +#define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000044 +#define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000045 +#define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA 0x03000046 + +/* TLS v1.2 ciphersuites */ +#define TLS1_CK_DHE_RSA_WITH_AES_128_SHA256 0x03000067 +#define TLS1_CK_DH_DSS_WITH_AES_256_SHA256 0x03000068 +#define TLS1_CK_DH_RSA_WITH_AES_256_SHA256 0x03000069 +#define TLS1_CK_DHE_DSS_WITH_AES_256_SHA256 0x0300006A +#define TLS1_CK_DHE_RSA_WITH_AES_256_SHA256 0x0300006B +#define TLS1_CK_ADH_WITH_AES_128_SHA256 0x0300006C +#define TLS1_CK_ADH_WITH_AES_256_SHA256 0x0300006D + +/* Camellia ciphersuites from RFC4132 */ +#define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000084 +#define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000085 +#define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000086 +#define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000087 +#define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000088 +#define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA 0x03000089 + +/* SEED ciphersuites from RFC4162 */ +#define TLS1_CK_RSA_WITH_SEED_SHA 0x03000096 +#define TLS1_CK_DH_DSS_WITH_SEED_SHA 0x03000097 +#define TLS1_CK_DH_RSA_WITH_SEED_SHA 0x03000098 +#define TLS1_CK_DHE_DSS_WITH_SEED_SHA 0x03000099 +#define TLS1_CK_DHE_RSA_WITH_SEED_SHA 0x0300009A +#define TLS1_CK_ADH_WITH_SEED_SHA 0x0300009B + +/* TLS v1.2 GCM ciphersuites from RFC5288 */ +#define TLS1_CK_RSA_WITH_AES_128_GCM_SHA256 0x0300009C +#define TLS1_CK_RSA_WITH_AES_256_GCM_SHA384 0x0300009D +#define TLS1_CK_DHE_RSA_WITH_AES_128_GCM_SHA256 0x0300009E +#define TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384 0x0300009F +#define TLS1_CK_DH_RSA_WITH_AES_128_GCM_SHA256 0x030000A0 +#define TLS1_CK_DH_RSA_WITH_AES_256_GCM_SHA384 0x030000A1 +#define TLS1_CK_DHE_DSS_WITH_AES_128_GCM_SHA256 0x030000A2 +#define TLS1_CK_DHE_DSS_WITH_AES_256_GCM_SHA384 0x030000A3 +#define TLS1_CK_DH_DSS_WITH_AES_128_GCM_SHA256 0x030000A4 +#define TLS1_CK_DH_DSS_WITH_AES_256_GCM_SHA384 0x030000A5 +#define TLS1_CK_ADH_WITH_AES_128_GCM_SHA256 0x030000A6 +#define TLS1_CK_ADH_WITH_AES_256_GCM_SHA384 0x030000A7 + +/* + * ECC ciphersuites from draft-ietf-tls-ecc-12.txt with changes soon to be in + * draft 13 + */ +#define TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA 0x0300C001 +#define TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA 0x0300C002 +#define TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C003 +#define TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA 0x0300C004 +#define TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA 0x0300C005 + +#define TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA 0x0300C006 +#define TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA 0x0300C007 +#define TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C008 +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 0x0300C009 +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 0x0300C00A + +#define TLS1_CK_ECDH_RSA_WITH_NULL_SHA 0x0300C00B +#define TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA 0x0300C00C +#define TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA 0x0300C00D +#define TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA 0x0300C00E +#define TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA 0x0300C00F + +#define TLS1_CK_ECDHE_RSA_WITH_NULL_SHA 0x0300C010 +#define TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA 0x0300C011 +#define TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA 0x0300C012 +#define TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA 0x0300C013 +#define TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA 0x0300C014 + +#define TLS1_CK_ECDH_anon_WITH_NULL_SHA 0x0300C015 +#define TLS1_CK_ECDH_anon_WITH_RC4_128_SHA 0x0300C016 +#define TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA 0x0300C017 +#define TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA 0x0300C018 +#define TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA 0x0300C019 + +/* SRP ciphersuites from RFC 5054 */ +#define TLS1_CK_SRP_SHA_WITH_3DES_EDE_CBC_SHA 0x0300C01A +#define TLS1_CK_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA 0x0300C01B +#define TLS1_CK_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA 0x0300C01C +#define TLS1_CK_SRP_SHA_WITH_AES_128_CBC_SHA 0x0300C01D +#define TLS1_CK_SRP_SHA_RSA_WITH_AES_128_CBC_SHA 0x0300C01E +#define TLS1_CK_SRP_SHA_DSS_WITH_AES_128_CBC_SHA 0x0300C01F +#define TLS1_CK_SRP_SHA_WITH_AES_256_CBC_SHA 0x0300C020 +#define TLS1_CK_SRP_SHA_RSA_WITH_AES_256_CBC_SHA 0x0300C021 +#define TLS1_CK_SRP_SHA_DSS_WITH_AES_256_CBC_SHA 0x0300C022 + +/* ECDH HMAC based ciphersuites from RFC5289 */ + +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_SHA256 0x0300C023 +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_SHA384 0x0300C024 +#define TLS1_CK_ECDH_ECDSA_WITH_AES_128_SHA256 0x0300C025 +#define TLS1_CK_ECDH_ECDSA_WITH_AES_256_SHA384 0x0300C026 +#define TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256 0x0300C027 +#define TLS1_CK_ECDHE_RSA_WITH_AES_256_SHA384 0x0300C028 +#define TLS1_CK_ECDH_RSA_WITH_AES_128_SHA256 0x0300C029 +#define TLS1_CK_ECDH_RSA_WITH_AES_256_SHA384 0x0300C02A + +/* ECDH GCM based ciphersuites from RFC5289 */ +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02B +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02C +#define TLS1_CK_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02D +#define TLS1_CK_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02E +#define TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0x0300C02F +#define TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384 0x0300C030 +#define TLS1_CK_ECDH_RSA_WITH_AES_128_GCM_SHA256 0x0300C031 +#define TLS1_CK_ECDH_RSA_WITH_AES_256_GCM_SHA384 0x0300C032 + +/* + * XXX * Backward compatibility alert: + * Older versions of OpenSSL gave + * some DHE ciphers names with "EDH" + * instead of "DHE". Going forward, we + * should be using DHE + * everywhere, though we may indefinitely maintain + * aliases for users + * or configurations that used "EDH" + + */ +#define TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_MD5 "EXP1024-RC4-MD5" +#define TLS1_TXT_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5 "EXP1024-RC2-CBC-MD5" +#define TLS1_TXT_RSA_EXPORT1024_WITH_DES_CBC_SHA "EXP1024-DES-CBC-SHA" +#define TLS1_TXT_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA \ + "EXP1024-DHE-DSS-DES-CBC-SHA" +#define TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_SHA "EXP1024-RC4-SHA" +#define TLS1_TXT_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA "EXP1024-DHE-DSS-RC4-SHA" +#define TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA "DHE-DSS-RC4-SHA" + +/* AES ciphersuites from RFC3268 */ +#define TLS1_TXT_RSA_WITH_AES_128_SHA "AES128-SHA" +#define TLS1_TXT_DH_DSS_WITH_AES_128_SHA "DH-DSS-AES128-SHA" +#define TLS1_TXT_DH_RSA_WITH_AES_128_SHA "DH-RSA-AES128-SHA" +#define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA "DHE-DSS-AES128-SHA" +#define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA "DHE-RSA-AES128-SHA" +#define TLS1_TXT_ADH_WITH_AES_128_SHA "ADH-AES128-SHA" + +#define TLS1_TXT_RSA_WITH_AES_256_SHA "AES256-SHA" +#define TLS1_TXT_DH_DSS_WITH_AES_256_SHA "DH-DSS-AES256-SHA" +#define TLS1_TXT_DH_RSA_WITH_AES_256_SHA "DH-RSA-AES256-SHA" +#define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA "DHE-DSS-AES256-SHA" +#define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA "DHE-RSA-AES256-SHA" +#define TLS1_TXT_ADH_WITH_AES_256_SHA "ADH-AES256-SHA" + +/* ECC ciphersuites from RFC4492 */ +#define TLS1_TXT_ECDH_ECDSA_WITH_NULL_SHA "ECDH-ECDSA-NULL-SHA" +#define TLS1_TXT_ECDH_ECDSA_WITH_RC4_128_SHA "ECDH-ECDSA-RC4-SHA" +#define TLS1_TXT_ECDH_ECDSA_WITH_DES_192_CBC3_SHA "ECDH-ECDSA-DES-CBC3-SHA" +#define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_CBC_SHA "ECDH-ECDSA-AES128-SHA" +#define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_CBC_SHA "ECDH-ECDSA-AES256-SHA" + +#define TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA "ECDHE-ECDSA-NULL-SHA" +#define TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA "ECDHE-ECDSA-RC4-SHA" +#define TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA "ECDHE-ECDSA-DES-CBC3-SHA" +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA "ECDHE-ECDSA-AES128-SHA" +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA "ECDHE-ECDSA-AES256-SHA" + +#define TLS1_TXT_ECDH_RSA_WITH_NULL_SHA "ECDH-RSA-NULL-SHA" +#define TLS1_TXT_ECDH_RSA_WITH_RC4_128_SHA "ECDH-RSA-RC4-SHA" +#define TLS1_TXT_ECDH_RSA_WITH_DES_192_CBC3_SHA "ECDH-RSA-DES-CBC3-SHA" +#define TLS1_TXT_ECDH_RSA_WITH_AES_128_CBC_SHA "ECDH-RSA-AES128-SHA" +#define TLS1_TXT_ECDH_RSA_WITH_AES_256_CBC_SHA "ECDH-RSA-AES256-SHA" + +#define TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA "ECDHE-RSA-NULL-SHA" +#define TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA "ECDHE-RSA-RC4-SHA" +#define TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA "ECDHE-RSA-DES-CBC3-SHA" +#define TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA "ECDHE-RSA-AES128-SHA" +#define TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA "ECDHE-RSA-AES256-SHA" + +#define TLS1_TXT_ECDH_anon_WITH_NULL_SHA "AECDH-NULL-SHA" +#define TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA "AECDH-RC4-SHA" +#define TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA "AECDH-DES-CBC3-SHA" +#define TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA "AECDH-AES128-SHA" +#define TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA "AECDH-AES256-SHA" + +/* PSK ciphersuites from RFC 4279 */ +#define TLS1_TXT_PSK_WITH_RC4_128_SHA "PSK-RC4-SHA" +#define TLS1_TXT_PSK_WITH_3DES_EDE_CBC_SHA "PSK-3DES-EDE-CBC-SHA" +#define TLS1_TXT_PSK_WITH_AES_128_CBC_SHA "PSK-AES128-CBC-SHA" +#define TLS1_TXT_PSK_WITH_AES_256_CBC_SHA "PSK-AES256-CBC-SHA" + +/* SRP ciphersuite from RFC 5054 */ +#define TLS1_TXT_SRP_SHA_WITH_3DES_EDE_CBC_SHA "SRP-3DES-EDE-CBC-SHA" +#define TLS1_TXT_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA "SRP-RSA-3DES-EDE-CBC-SHA" +#define TLS1_TXT_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA "SRP-DSS-3DES-EDE-CBC-SHA" +#define TLS1_TXT_SRP_SHA_WITH_AES_128_CBC_SHA "SRP-AES-128-CBC-SHA" +#define TLS1_TXT_SRP_SHA_RSA_WITH_AES_128_CBC_SHA "SRP-RSA-AES-128-CBC-SHA" +#define TLS1_TXT_SRP_SHA_DSS_WITH_AES_128_CBC_SHA "SRP-DSS-AES-128-CBC-SHA" +#define TLS1_TXT_SRP_SHA_WITH_AES_256_CBC_SHA "SRP-AES-256-CBC-SHA" +#define TLS1_TXT_SRP_SHA_RSA_WITH_AES_256_CBC_SHA "SRP-RSA-AES-256-CBC-SHA" +#define TLS1_TXT_SRP_SHA_DSS_WITH_AES_256_CBC_SHA "SRP-DSS-AES-256-CBC-SHA" + +/* Camellia ciphersuites from RFC4132 */ +#define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA "CAMELLIA128-SHA" +#define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA "DH-DSS-CAMELLIA128-SHA" +#define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA "DH-RSA-CAMELLIA128-SHA" +#define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA "DHE-DSS-CAMELLIA128-SHA" +#define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA "DHE-RSA-CAMELLIA128-SHA" +#define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA "ADH-CAMELLIA128-SHA" + +#define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA "CAMELLIA256-SHA" +#define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA "DH-DSS-CAMELLIA256-SHA" +#define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA "DH-RSA-CAMELLIA256-SHA" +#define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA "DHE-DSS-CAMELLIA256-SHA" +#define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA "DHE-RSA-CAMELLIA256-SHA" +#define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA "ADH-CAMELLIA256-SHA" + +/* SEED ciphersuites from RFC4162 */ +#define TLS1_TXT_RSA_WITH_SEED_SHA "SEED-SHA" +#define TLS1_TXT_DH_DSS_WITH_SEED_SHA "DH-DSS-SEED-SHA" +#define TLS1_TXT_DH_RSA_WITH_SEED_SHA "DH-RSA-SEED-SHA" +#define TLS1_TXT_DHE_DSS_WITH_SEED_SHA "DHE-DSS-SEED-SHA" +#define TLS1_TXT_DHE_RSA_WITH_SEED_SHA "DHE-RSA-SEED-SHA" +#define TLS1_TXT_ADH_WITH_SEED_SHA "ADH-SEED-SHA" + +/* TLS v1.2 ciphersuites */ +#define TLS1_TXT_RSA_WITH_NULL_SHA256 "NULL-SHA256" +#define TLS1_TXT_RSA_WITH_AES_128_SHA256 "AES128-SHA256" +#define TLS1_TXT_RSA_WITH_AES_256_SHA256 "AES256-SHA256" +#define TLS1_TXT_DH_DSS_WITH_AES_128_SHA256 "DH-DSS-AES128-SHA256" +#define TLS1_TXT_DH_RSA_WITH_AES_128_SHA256 "DH-RSA-AES128-SHA256" +#define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA256 "DHE-DSS-AES128-SHA256" +#define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA256 "DHE-RSA-AES128-SHA256" +#define TLS1_TXT_DH_DSS_WITH_AES_256_SHA256 "DH-DSS-AES256-SHA256" +#define TLS1_TXT_DH_RSA_WITH_AES_256_SHA256 "DH-RSA-AES256-SHA256" +#define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA256 "DHE-DSS-AES256-SHA256" +#define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA256 "DHE-RSA-AES256-SHA256" +#define TLS1_TXT_ADH_WITH_AES_128_SHA256 "ADH-AES128-SHA256" +#define TLS1_TXT_ADH_WITH_AES_256_SHA256 "ADH-AES256-SHA256" + +/* TLS v1.2 GCM ciphersuites from RFC5288 */ +#define TLS1_TXT_RSA_WITH_AES_128_GCM_SHA256 "AES128-GCM-SHA256" +#define TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384 "AES256-GCM-SHA384" +#define TLS1_TXT_DHE_RSA_WITH_AES_128_GCM_SHA256 "DHE-RSA-AES128-GCM-SHA256" +#define TLS1_TXT_DHE_RSA_WITH_AES_256_GCM_SHA384 "DHE-RSA-AES256-GCM-SHA384" +#define TLS1_TXT_DH_RSA_WITH_AES_128_GCM_SHA256 "DH-RSA-AES128-GCM-SHA256" +#define TLS1_TXT_DH_RSA_WITH_AES_256_GCM_SHA384 "DH-RSA-AES256-GCM-SHA384" +#define TLS1_TXT_DHE_DSS_WITH_AES_128_GCM_SHA256 "DHE-DSS-AES128-GCM-SHA256" +#define TLS1_TXT_DHE_DSS_WITH_AES_256_GCM_SHA384 "DHE-DSS-AES256-GCM-SHA384" +#define TLS1_TXT_DH_DSS_WITH_AES_128_GCM_SHA256 "DH-DSS-AES128-GCM-SHA256" +#define TLS1_TXT_DH_DSS_WITH_AES_256_GCM_SHA384 "DH-DSS-AES256-GCM-SHA384" +#define TLS1_TXT_ADH_WITH_AES_128_GCM_SHA256 "ADH-AES128-GCM-SHA256" +#define TLS1_TXT_ADH_WITH_AES_256_GCM_SHA384 "ADH-AES256-GCM-SHA384" + +/* ECDH HMAC based ciphersuites from RFC5289 */ + +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_SHA256 "ECDHE-ECDSA-AES128-SHA256" +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_SHA384 "ECDHE-ECDSA-AES256-SHA384" +#define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_SHA256 "ECDH-ECDSA-AES128-SHA256" +#define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_SHA384 "ECDH-ECDSA-AES256-SHA384" +#define TLS1_TXT_ECDHE_RSA_WITH_AES_128_SHA256 "ECDHE-RSA-AES128-SHA256" +#define TLS1_TXT_ECDHE_RSA_WITH_AES_256_SHA384 "ECDHE-RSA-AES256-SHA384" +#define TLS1_TXT_ECDH_RSA_WITH_AES_128_SHA256 "ECDH-RSA-AES128-SHA256" +#define TLS1_TXT_ECDH_RSA_WITH_AES_256_SHA384 "ECDH-RSA-AES256-SHA384" + +/* ECDH GCM based ciphersuites from RFC5289 */ +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 \ + "ECDHE-ECDSA-AES128-GCM-SHA256" +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 \ + "ECDHE-ECDSA-AES256-GCM-SHA384" +#define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 \ + "ECDH-ECDSA-AES128-GCM-SHA256" +#define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 \ + "ECDH-ECDSA-AES256-GCM-SHA384" +#define TLS1_TXT_ECDHE_RSA_WITH_AES_128_GCM_SHA256 "ECDHE-RSA-AES128-GCM-SHA256" +#define TLS1_TXT_ECDHE_RSA_WITH_AES_256_GCM_SHA384 "ECDHE-RSA-AES256-GCM-SHA384" +#define TLS1_TXT_ECDH_RSA_WITH_AES_128_GCM_SHA256 "ECDH-RSA-AES128-GCM-SHA256" +#define TLS1_TXT_ECDH_RSA_WITH_AES_256_GCM_SHA384 "ECDH-RSA-AES256-GCM-SHA384" + +#define TLS_CT_RSA_SIGN 1 +#define TLS_CT_DSS_SIGN 2 +#define TLS_CT_RSA_FIXED_DH 3 +#define TLS_CT_DSS_FIXED_DH 4 +#define TLS_CT_ECDSA_SIGN 64 +#define TLS_CT_RSA_FIXED_ECDH 65 +#define TLS_CT_ECDSA_FIXED_ECDH 66 +#define TLS_CT_GOST94_SIGN 21 +#define TLS_CT_GOST01_SIGN 22 +/* + * when correcting this number, correct also SSL3_CT_NUMBER in ssl3.h (see + * comment there) + */ +#define TLS_CT_NUMBER 9 + +#define TLS1_FINISH_MAC_LENGTH 12 + +#define TLS_MD_MAX_CONST_SIZE 20 +#define TLS_MD_CLIENT_FINISH_CONST "client finished" +#define TLS_MD_CLIENT_FINISH_CONST_SIZE 15 +#define TLS_MD_SERVER_FINISH_CONST "server finished" +#define TLS_MD_SERVER_FINISH_CONST_SIZE 15 +#define TLS_MD_SERVER_WRITE_KEY_CONST "server write key" +#define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE 16 +#define TLS_MD_KEY_EXPANSION_CONST "key expansion" +#define TLS_MD_KEY_EXPANSION_CONST_SIZE 13 +#define TLS_MD_CLIENT_WRITE_KEY_CONST "client write key" +#define TLS_MD_CLIENT_WRITE_KEY_CONST_SIZE 16 +#define TLS_MD_SERVER_WRITE_KEY_CONST "server write key" +#define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE 16 +#define TLS_MD_IV_BLOCK_CONST "IV block" +#define TLS_MD_IV_BLOCK_CONST_SIZE 8 +#define TLS_MD_MASTER_SECRET_CONST "master secret" +#define TLS_MD_MASTER_SECRET_CONST_SIZE 13 + +#ifdef CHARSET_EBCDIC +#undef TLS_MD_CLIENT_FINISH_CONST +/* + * client finished + */ +#define TLS_MD_CLIENT_FINISH_CONST \ + "\x63\x6c\x69\x65\x6e\x74\x20\x66\x69\x6e\x69\x73\x68\x65\x64" + +#undef TLS_MD_SERVER_FINISH_CONST +/* + * server finished + */ +#define TLS_MD_SERVER_FINISH_CONST \ + "\x73\x65\x72\x76\x65\x72\x20\x66\x69\x6e\x69\x73\x68\x65\x64" + +#undef TLS_MD_SERVER_WRITE_KEY_CONST +/* + * server write key + */ +#define TLS_MD_SERVER_WRITE_KEY_CONST \ + "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" + +#undef TLS_MD_KEY_EXPANSION_CONST +/* + * key expansion + */ +#define TLS_MD_KEY_EXPANSION_CONST \ + "\x6b\x65\x79\x20\x65\x78\x70\x61\x6e\x73\x69\x6f\x6e" + +#undef TLS_MD_CLIENT_WRITE_KEY_CONST +/* + * client write key + */ +#define TLS_MD_CLIENT_WRITE_KEY_CONST \ + "\x63\x6c\x69\x65\x6e\x74\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" + +#undef TLS_MD_SERVER_WRITE_KEY_CONST +/* + * server write key + */ +#define TLS_MD_SERVER_WRITE_KEY_CONST \ + "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" + +#undef TLS_MD_IV_BLOCK_CONST +/* + * IV block + */ +#define TLS_MD_IV_BLOCK_CONST "\x49\x56\x20\x62\x6c\x6f\x63\x6b" + +#undef TLS_MD_MASTER_SECRET_CONST +/* + * master secret + */ +#define TLS_MD_MASTER_SECRET_CONST \ + "\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74" +#endif + +/* TLS Session Ticket extension struct */ +struct tls_session_ticket_ext_st { + unsigned short length; + void* data; +}; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ts.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ts.h new file mode 100644 index 0000000..3b60476 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ts.h @@ -0,0 +1,889 @@ +/* crypto/ts/ts.h */ +/* + * Written by Zoltan Glozik (zglozik@opentsa.org) for the OpenSSL project + * 2002, 2003, 2004. + */ +/* ==================================================================== + * Copyright (c) 2006 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_TS_H +#define HEADER_TS_H + +#include +#include +#ifndef OPENSSL_NO_BUFFER +#include +#endif +#ifndef OPENSSL_NO_EVP +#include +#endif +#ifndef OPENSSL_NO_BIO +#include +#endif +#include +#include +#include + +#ifndef OPENSSL_NO_RSA +#include +#endif + +#ifndef OPENSSL_NO_DSA +#include +#endif + +#ifndef OPENSSL_NO_DH +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef WIN32 +/* Under Win32 this is defined in wincrypt.h */ +#undef X509_NAME +#endif + +#include +#include + +/*- +MessageImprint ::= SEQUENCE { + hashAlgorithm AlgorithmIdentifier, + hashedMessage OCTET STRING } +*/ + +typedef struct TS_msg_imprint_st { + X509_ALGOR* hash_algo; + ASN1_OCTET_STRING* hashed_msg; +} TS_MSG_IMPRINT; + +/*- +TimeStampReq ::= SEQUENCE { + version INTEGER { v1(1) }, + messageImprint MessageImprint, + --a hash algorithm OID and the hash value of the data to be + --time-stamped + reqPolicy TSAPolicyId OPTIONAL, + nonce INTEGER OPTIONAL, + certReq BOOLEAN DEFAULT FALSE, + extensions [0] IMPLICIT Extensions OPTIONAL } +*/ + +typedef struct TS_req_st { + ASN1_INTEGER* version; + TS_MSG_IMPRINT* msg_imprint; + ASN1_OBJECT* policy_id; /* OPTIONAL */ + ASN1_INTEGER* nonce; /* OPTIONAL */ + ASN1_BOOLEAN cert_req; /* DEFAULT FALSE */ + STACK_OF(X509_EXTENSION) * extensions; /* [0] OPTIONAL */ +} TS_REQ; + +/*- +Accuracy ::= SEQUENCE { + seconds INTEGER OPTIONAL, + millis [0] INTEGER (1..999) OPTIONAL, + micros [1] INTEGER (1..999) OPTIONAL } +*/ + +typedef struct TS_accuracy_st { + ASN1_INTEGER* seconds; + ASN1_INTEGER* millis; + ASN1_INTEGER* micros; +} TS_ACCURACY; + +/*- +TSTInfo ::= SEQUENCE { + version INTEGER { v1(1) }, + policy TSAPolicyId, + messageImprint MessageImprint, + -- MUST have the same value as the similar field in + -- TimeStampReq + serialNumber INTEGER, + -- Time-Stamping users MUST be ready to accommodate integers + -- up to 160 bits. + genTime GeneralizedTime, + accuracy Accuracy OPTIONAL, + ordering BOOLEAN DEFAULT FALSE, + nonce INTEGER OPTIONAL, + -- MUST be present if the similar field was present + -- in TimeStampReq. In that case it MUST have the same value. + tsa [0] GeneralName OPTIONAL, + extensions [1] IMPLICIT Extensions OPTIONAL } +*/ + +typedef struct TS_tst_info_st { + ASN1_INTEGER* version; + ASN1_OBJECT* policy_id; + TS_MSG_IMPRINT* msg_imprint; + ASN1_INTEGER* serial; + ASN1_GENERALIZEDTIME* time; + TS_ACCURACY* accuracy; + ASN1_BOOLEAN ordering; + ASN1_INTEGER* nonce; + GENERAL_NAME* tsa; + STACK_OF(X509_EXTENSION) * extensions; +} TS_TST_INFO; + +/*- +PKIStatusInfo ::= SEQUENCE { + status PKIStatus, + statusString PKIFreeText OPTIONAL, + failInfo PKIFailureInfo OPTIONAL } + +From RFC 1510 - section 3.1.1: +PKIFreeText ::= SEQUENCE SIZE (1..MAX) OF UTF8String + -- text encoded as UTF-8 String (note: each UTF8String SHOULD + -- include an RFC 1766 language tag to indicate the language + -- of the contained text) +*/ + +/* Possible values for status. See ts_resp_print.c && ts_resp_verify.c. */ + +#define TS_STATUS_GRANTED 0 +#define TS_STATUS_GRANTED_WITH_MODS 1 +#define TS_STATUS_REJECTION 2 +#define TS_STATUS_WAITING 3 +#define TS_STATUS_REVOCATION_WARNING 4 +#define TS_STATUS_REVOCATION_NOTIFICATION 5 + +/* + * Possible values for failure_info. See ts_resp_print.c && ts_resp_verify.c + */ + +#define TS_INFO_BAD_ALG 0 +#define TS_INFO_BAD_REQUEST 2 +#define TS_INFO_BAD_DATA_FORMAT 5 +#define TS_INFO_TIME_NOT_AVAILABLE 14 +#define TS_INFO_UNACCEPTED_POLICY 15 +#define TS_INFO_UNACCEPTED_EXTENSION 16 +#define TS_INFO_ADD_INFO_NOT_AVAILABLE 17 +#define TS_INFO_SYSTEM_FAILURE 25 + +typedef struct TS_status_info_st { + ASN1_INTEGER* status; + STACK_OF(ASN1_UTF8STRING) * text; + ASN1_BIT_STRING* failure_info; +} TS_STATUS_INFO; + +DECLARE_STACK_OF(ASN1_UTF8STRING) +DECLARE_ASN1_SET_OF(ASN1_UTF8STRING) + +/*- +TimeStampResp ::= SEQUENCE { + status PKIStatusInfo, + timeStampToken TimeStampToken OPTIONAL } +*/ + +typedef struct TS_resp_st { + TS_STATUS_INFO* status_info; + PKCS7* token; + TS_TST_INFO* tst_info; +} TS_RESP; + +/* The structure below would belong to the ESS component. */ + +/*- +IssuerSerial ::= SEQUENCE { + issuer GeneralNames, + serialNumber CertificateSerialNumber + } +*/ + +typedef struct ESS_issuer_serial { + STACK_OF(GENERAL_NAME) * issuer; + ASN1_INTEGER* serial; +} ESS_ISSUER_SERIAL; + +/*- +ESSCertID ::= SEQUENCE { + certHash Hash, + issuerSerial IssuerSerial OPTIONAL +} +*/ + +typedef struct ESS_cert_id { + ASN1_OCTET_STRING* hash; /* Always SHA-1 digest. */ + ESS_ISSUER_SERIAL* issuer_serial; +} ESS_CERT_ID; + +DECLARE_STACK_OF(ESS_CERT_ID) +DECLARE_ASN1_SET_OF(ESS_CERT_ID) + +/*- +SigningCertificate ::= SEQUENCE { + certs SEQUENCE OF ESSCertID, + policies SEQUENCE OF PolicyInformation OPTIONAL +} +*/ + +typedef struct ESS_signing_cert { + STACK_OF(ESS_CERT_ID) * cert_ids; + STACK_OF(POLICYINFO) * policy_info; +} ESS_SIGNING_CERT; + +TS_REQ* TS_REQ_new(void); +void TS_REQ_free(TS_REQ* a); +int i2d_TS_REQ(const TS_REQ* a, unsigned char** pp); +TS_REQ* d2i_TS_REQ(TS_REQ** a, const unsigned char** pp, long length); + +TS_REQ* TS_REQ_dup(TS_REQ* a); + +TS_REQ* d2i_TS_REQ_fp(FILE* fp, TS_REQ** a); +int i2d_TS_REQ_fp(FILE* fp, TS_REQ* a); +TS_REQ* d2i_TS_REQ_bio(BIO* fp, TS_REQ** a); +int i2d_TS_REQ_bio(BIO* fp, TS_REQ* a); + +TS_MSG_IMPRINT* TS_MSG_IMPRINT_new(void); +void TS_MSG_IMPRINT_free(TS_MSG_IMPRINT* a); +int i2d_TS_MSG_IMPRINT(const TS_MSG_IMPRINT* a, unsigned char** pp); +TS_MSG_IMPRINT* +d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT** a, const unsigned char** pp, long length); + +TS_MSG_IMPRINT* TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT* a); + +TS_MSG_IMPRINT* d2i_TS_MSG_IMPRINT_fp(FILE* fp, TS_MSG_IMPRINT** a); +int i2d_TS_MSG_IMPRINT_fp(FILE* fp, TS_MSG_IMPRINT* a); +TS_MSG_IMPRINT* d2i_TS_MSG_IMPRINT_bio(BIO* fp, TS_MSG_IMPRINT** a); +int i2d_TS_MSG_IMPRINT_bio(BIO* fp, TS_MSG_IMPRINT* a); + +TS_RESP* TS_RESP_new(void); +void TS_RESP_free(TS_RESP* a); +int i2d_TS_RESP(const TS_RESP* a, unsigned char** pp); +TS_RESP* d2i_TS_RESP(TS_RESP** a, const unsigned char** pp, long length); +TS_TST_INFO* PKCS7_to_TS_TST_INFO(PKCS7* token); +TS_RESP* TS_RESP_dup(TS_RESP* a); + +TS_RESP* d2i_TS_RESP_fp(FILE* fp, TS_RESP** a); +int i2d_TS_RESP_fp(FILE* fp, TS_RESP* a); +TS_RESP* d2i_TS_RESP_bio(BIO* fp, TS_RESP** a); +int i2d_TS_RESP_bio(BIO* fp, TS_RESP* a); + +TS_STATUS_INFO* TS_STATUS_INFO_new(void); +void TS_STATUS_INFO_free(TS_STATUS_INFO* a); +int i2d_TS_STATUS_INFO(const TS_STATUS_INFO* a, unsigned char** pp); +TS_STATUS_INFO* +d2i_TS_STATUS_INFO(TS_STATUS_INFO** a, const unsigned char** pp, long length); +TS_STATUS_INFO* TS_STATUS_INFO_dup(TS_STATUS_INFO* a); + +TS_TST_INFO* TS_TST_INFO_new(void); +void TS_TST_INFO_free(TS_TST_INFO* a); +int i2d_TS_TST_INFO(const TS_TST_INFO* a, unsigned char** pp); +TS_TST_INFO* +d2i_TS_TST_INFO(TS_TST_INFO** a, const unsigned char** pp, long length); +TS_TST_INFO* TS_TST_INFO_dup(TS_TST_INFO* a); + +TS_TST_INFO* d2i_TS_TST_INFO_fp(FILE* fp, TS_TST_INFO** a); +int i2d_TS_TST_INFO_fp(FILE* fp, TS_TST_INFO* a); +TS_TST_INFO* d2i_TS_TST_INFO_bio(BIO* fp, TS_TST_INFO** a); +int i2d_TS_TST_INFO_bio(BIO* fp, TS_TST_INFO* a); + +TS_ACCURACY* TS_ACCURACY_new(void); +void TS_ACCURACY_free(TS_ACCURACY* a); +int i2d_TS_ACCURACY(const TS_ACCURACY* a, unsigned char** pp); +TS_ACCURACY* +d2i_TS_ACCURACY(TS_ACCURACY** a, const unsigned char** pp, long length); +TS_ACCURACY* TS_ACCURACY_dup(TS_ACCURACY* a); + +ESS_ISSUER_SERIAL* ESS_ISSUER_SERIAL_new(void); +void ESS_ISSUER_SERIAL_free(ESS_ISSUER_SERIAL* a); +int i2d_ESS_ISSUER_SERIAL(const ESS_ISSUER_SERIAL* a, unsigned char** pp); +ESS_ISSUER_SERIAL* d2i_ESS_ISSUER_SERIAL( + ESS_ISSUER_SERIAL** a, + const unsigned char** pp, + long length); +ESS_ISSUER_SERIAL* ESS_ISSUER_SERIAL_dup(ESS_ISSUER_SERIAL* a); + +ESS_CERT_ID* ESS_CERT_ID_new(void); +void ESS_CERT_ID_free(ESS_CERT_ID* a); +int i2d_ESS_CERT_ID(const ESS_CERT_ID* a, unsigned char** pp); +ESS_CERT_ID* +d2i_ESS_CERT_ID(ESS_CERT_ID** a, const unsigned char** pp, long length); +ESS_CERT_ID* ESS_CERT_ID_dup(ESS_CERT_ID* a); + +ESS_SIGNING_CERT* ESS_SIGNING_CERT_new(void); +void ESS_SIGNING_CERT_free(ESS_SIGNING_CERT* a); +int i2d_ESS_SIGNING_CERT(const ESS_SIGNING_CERT* a, unsigned char** pp); +ESS_SIGNING_CERT* d2i_ESS_SIGNING_CERT( + ESS_SIGNING_CERT** a, + const unsigned char** pp, + long length); +ESS_SIGNING_CERT* ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT* a); + +void ERR_load_TS_strings(void); + +int TS_REQ_set_version(TS_REQ* a, long version); +long TS_REQ_get_version(const TS_REQ* a); + +int TS_REQ_set_msg_imprint(TS_REQ* a, TS_MSG_IMPRINT* msg_imprint); +TS_MSG_IMPRINT* TS_REQ_get_msg_imprint(TS_REQ* a); + +int TS_MSG_IMPRINT_set_algo(TS_MSG_IMPRINT* a, X509_ALGOR* alg); +X509_ALGOR* TS_MSG_IMPRINT_get_algo(TS_MSG_IMPRINT* a); + +int TS_MSG_IMPRINT_set_msg(TS_MSG_IMPRINT* a, unsigned char* d, int len); +ASN1_OCTET_STRING* TS_MSG_IMPRINT_get_msg(TS_MSG_IMPRINT* a); + +int TS_REQ_set_policy_id(TS_REQ* a, ASN1_OBJECT* policy); +ASN1_OBJECT* TS_REQ_get_policy_id(TS_REQ* a); + +int TS_REQ_set_nonce(TS_REQ* a, const ASN1_INTEGER* nonce); +const ASN1_INTEGER* TS_REQ_get_nonce(const TS_REQ* a); + +int TS_REQ_set_cert_req(TS_REQ* a, int cert_req); +int TS_REQ_get_cert_req(const TS_REQ* a); + +STACK_OF(X509_EXTENSION) * TS_REQ_get_exts(TS_REQ* a); +void TS_REQ_ext_free(TS_REQ* a); +int TS_REQ_get_ext_count(TS_REQ* a); +int TS_REQ_get_ext_by_NID(TS_REQ* a, int nid, int lastpos); +int TS_REQ_get_ext_by_OBJ(TS_REQ* a, ASN1_OBJECT* obj, int lastpos); +int TS_REQ_get_ext_by_critical(TS_REQ* a, int crit, int lastpos); +X509_EXTENSION* TS_REQ_get_ext(TS_REQ* a, int loc); +X509_EXTENSION* TS_REQ_delete_ext(TS_REQ* a, int loc); +int TS_REQ_add_ext(TS_REQ* a, X509_EXTENSION* ex, int loc); +void* TS_REQ_get_ext_d2i(TS_REQ* a, int nid, int* crit, int* idx); + +/* Function declarations for TS_REQ defined in ts/ts_req_print.c */ + +int TS_REQ_print_bio(BIO* bio, TS_REQ* a); + +/* Function declarations for TS_RESP defined in ts/ts_resp_utils.c */ + +int TS_RESP_set_status_info(TS_RESP* a, TS_STATUS_INFO* info); +TS_STATUS_INFO* TS_RESP_get_status_info(TS_RESP* a); + +/* Caller loses ownership of PKCS7 and TS_TST_INFO objects. */ +void TS_RESP_set_tst_info(TS_RESP* a, PKCS7* p7, TS_TST_INFO* tst_info); +PKCS7* TS_RESP_get_token(TS_RESP* a); +TS_TST_INFO* TS_RESP_get_tst_info(TS_RESP* a); + +int TS_TST_INFO_set_version(TS_TST_INFO* a, long version); +long TS_TST_INFO_get_version(const TS_TST_INFO* a); + +int TS_TST_INFO_set_policy_id(TS_TST_INFO* a, ASN1_OBJECT* policy_id); +ASN1_OBJECT* TS_TST_INFO_get_policy_id(TS_TST_INFO* a); + +int TS_TST_INFO_set_msg_imprint(TS_TST_INFO* a, TS_MSG_IMPRINT* msg_imprint); +TS_MSG_IMPRINT* TS_TST_INFO_get_msg_imprint(TS_TST_INFO* a); + +int TS_TST_INFO_set_serial(TS_TST_INFO* a, const ASN1_INTEGER* serial); +const ASN1_INTEGER* TS_TST_INFO_get_serial(const TS_TST_INFO* a); + +int TS_TST_INFO_set_time(TS_TST_INFO* a, const ASN1_GENERALIZEDTIME* gtime); +const ASN1_GENERALIZEDTIME* TS_TST_INFO_get_time(const TS_TST_INFO* a); + +int TS_TST_INFO_set_accuracy(TS_TST_INFO* a, TS_ACCURACY* accuracy); +TS_ACCURACY* TS_TST_INFO_get_accuracy(TS_TST_INFO* a); + +int TS_ACCURACY_set_seconds(TS_ACCURACY* a, const ASN1_INTEGER* seconds); +const ASN1_INTEGER* TS_ACCURACY_get_seconds(const TS_ACCURACY* a); + +int TS_ACCURACY_set_millis(TS_ACCURACY* a, const ASN1_INTEGER* millis); +const ASN1_INTEGER* TS_ACCURACY_get_millis(const TS_ACCURACY* a); + +int TS_ACCURACY_set_micros(TS_ACCURACY* a, const ASN1_INTEGER* micros); +const ASN1_INTEGER* TS_ACCURACY_get_micros(const TS_ACCURACY* a); + +int TS_TST_INFO_set_ordering(TS_TST_INFO* a, int ordering); +int TS_TST_INFO_get_ordering(const TS_TST_INFO* a); + +int TS_TST_INFO_set_nonce(TS_TST_INFO* a, const ASN1_INTEGER* nonce); +const ASN1_INTEGER* TS_TST_INFO_get_nonce(const TS_TST_INFO* a); + +int TS_TST_INFO_set_tsa(TS_TST_INFO* a, GENERAL_NAME* tsa); +GENERAL_NAME* TS_TST_INFO_get_tsa(TS_TST_INFO* a); + +STACK_OF(X509_EXTENSION) * TS_TST_INFO_get_exts(TS_TST_INFO* a); +void TS_TST_INFO_ext_free(TS_TST_INFO* a); +int TS_TST_INFO_get_ext_count(TS_TST_INFO* a); +int TS_TST_INFO_get_ext_by_NID(TS_TST_INFO* a, int nid, int lastpos); +int TS_TST_INFO_get_ext_by_OBJ(TS_TST_INFO* a, ASN1_OBJECT* obj, int lastpos); +int TS_TST_INFO_get_ext_by_critical(TS_TST_INFO* a, int crit, int lastpos); +X509_EXTENSION* TS_TST_INFO_get_ext(TS_TST_INFO* a, int loc); +X509_EXTENSION* TS_TST_INFO_delete_ext(TS_TST_INFO* a, int loc); +int TS_TST_INFO_add_ext(TS_TST_INFO* a, X509_EXTENSION* ex, int loc); +void* TS_TST_INFO_get_ext_d2i(TS_TST_INFO* a, int nid, int* crit, int* idx); + +/* + * Declarations related to response generation, defined in ts/ts_resp_sign.c. + */ + +/* Optional flags for response generation. */ + +/* Don't include the TSA name in response. */ +#define TS_TSA_NAME 0x01 + +/* Set ordering to true in response. */ +#define TS_ORDERING 0x02 + +/* + * Include the signer certificate and the other specified certificates in + * the ESS signing certificate attribute beside the PKCS7 signed data. + * Only the signer certificates is included by default. + */ +#define TS_ESS_CERT_ID_CHAIN 0x04 + +/* Forward declaration. */ +struct TS_resp_ctx; + +/* This must return a unique number less than 160 bits long. */ +typedef ASN1_INTEGER* (*TS_serial_cb)(struct TS_resp_ctx*, void*); + +/* + * This must return the seconds and microseconds since Jan 1, 1970 in the sec + * and usec variables allocated by the caller. Return non-zero for success + * and zero for failure. + */ +typedef int (*TS_time_cb)(struct TS_resp_ctx*, void*, long* sec, long* usec); + +/* + * This must process the given extension. It can modify the TS_TST_INFO + * object of the context. Return values: !0 (processed), 0 (error, it must + * set the status info/failure info of the response). + */ +typedef int (*TS_extension_cb)(struct TS_resp_ctx*, X509_EXTENSION*, void*); + +typedef struct TS_resp_ctx { + X509* signer_cert; + EVP_PKEY* signer_key; + STACK_OF(X509) * certs; /* Certs to include in signed data. */ + STACK_OF(ASN1_OBJECT) * policies; /* Acceptable policies. */ + ASN1_OBJECT* default_policy; /* It may appear in policies, too. */ + STACK_OF(EVP_MD) * mds; /* Acceptable message digests. */ + ASN1_INTEGER* seconds; /* accuracy, 0 means not specified. */ + ASN1_INTEGER* millis; /* accuracy, 0 means not specified. */ + ASN1_INTEGER* micros; /* accuracy, 0 means not specified. */ + unsigned clock_precision_digits; /* fraction of seconds in time stamp + * token. */ + unsigned flags; /* Optional info, see values above. */ + /* Callback functions. */ + TS_serial_cb serial_cb; + void* serial_cb_data; /* User data for serial_cb. */ + TS_time_cb time_cb; + void* time_cb_data; /* User data for time_cb. */ + TS_extension_cb extension_cb; + void* extension_cb_data; /* User data for extension_cb. */ + /* These members are used only while creating the response. */ + TS_REQ* request; + TS_RESP* response; + TS_TST_INFO* tst_info; +} TS_RESP_CTX; + +DECLARE_STACK_OF(EVP_MD) +DECLARE_ASN1_SET_OF(EVP_MD) + +/* Creates a response context that can be used for generating responses. */ +TS_RESP_CTX* TS_RESP_CTX_new(void); +void TS_RESP_CTX_free(TS_RESP_CTX* ctx); + +/* This parameter must be set. */ +int TS_RESP_CTX_set_signer_cert(TS_RESP_CTX* ctx, X509* signer); + +/* This parameter must be set. */ +int TS_RESP_CTX_set_signer_key(TS_RESP_CTX* ctx, EVP_PKEY* key); + +/* This parameter must be set. */ +int TS_RESP_CTX_set_def_policy(TS_RESP_CTX* ctx, ASN1_OBJECT* def_policy); + +/* No additional certs are included in the response by default. */ +int TS_RESP_CTX_set_certs(TS_RESP_CTX* ctx, STACK_OF(X509) * certs); + +/* + * Adds a new acceptable policy, only the default policy is accepted by + * default. + */ +int TS_RESP_CTX_add_policy(TS_RESP_CTX* ctx, ASN1_OBJECT* policy); + +/* + * Adds a new acceptable message digest. Note that no message digests are + * accepted by default. The md argument is shared with the caller. + */ +int TS_RESP_CTX_add_md(TS_RESP_CTX* ctx, const EVP_MD* md); + +/* Accuracy is not included by default. */ +int TS_RESP_CTX_set_accuracy( + TS_RESP_CTX* ctx, + int secs, + int millis, + int micros); + +/* + * Clock precision digits, i.e. the number of decimal digits: '0' means sec, + * '3' msec, '6' usec, and so on. Default is 0. + */ +int TS_RESP_CTX_set_clock_precision_digits( + TS_RESP_CTX* ctx, + unsigned clock_precision_digits); +/* At most we accept usec precision. */ +#define TS_MAX_CLOCK_PRECISION_DIGITS 6 + +/* Maximum status message length */ +#define TS_MAX_STATUS_LENGTH (1024 * 1024) + +/* No flags are set by default. */ +void TS_RESP_CTX_add_flags(TS_RESP_CTX* ctx, int flags); + +/* Default callback always returns a constant. */ +void TS_RESP_CTX_set_serial_cb(TS_RESP_CTX* ctx, TS_serial_cb cb, void* data); + +/* Default callback uses the gettimeofday() and gmtime() system calls. */ +void TS_RESP_CTX_set_time_cb(TS_RESP_CTX* ctx, TS_time_cb cb, void* data); + +/* + * Default callback rejects all extensions. The extension callback is called + * when the TS_TST_INFO object is already set up and not signed yet. + */ +/* FIXME: extension handling is not tested yet. */ +void TS_RESP_CTX_set_extension_cb( + TS_RESP_CTX* ctx, + TS_extension_cb cb, + void* data); + +/* The following methods can be used in the callbacks. */ +int TS_RESP_CTX_set_status_info(TS_RESP_CTX* ctx, int status, const char* text); + +/* Sets the status info only if it is still TS_STATUS_GRANTED. */ +int TS_RESP_CTX_set_status_info_cond( + TS_RESP_CTX* ctx, + int status, + const char* text); + +int TS_RESP_CTX_add_failure_info(TS_RESP_CTX* ctx, int failure); + +/* The get methods below can be used in the extension callback. */ +TS_REQ* TS_RESP_CTX_get_request(TS_RESP_CTX* ctx); + +TS_TST_INFO* TS_RESP_CTX_get_tst_info(TS_RESP_CTX* ctx); + +/* + * Creates the signed TS_TST_INFO and puts it in TS_RESP. + * In case of errors it sets the status info properly. + * Returns NULL only in case of memory allocation/fatal error. + */ +TS_RESP* TS_RESP_create_response(TS_RESP_CTX* ctx, BIO* req_bio); + +/* + * Declarations related to response verification, + * they are defined in ts/ts_resp_verify.c. + */ + +int TS_RESP_verify_signature( + PKCS7* token, + STACK_OF(X509) * certs, + X509_STORE* store, + X509** signer_out); + +/* Context structure for the generic verify method. */ + +/* Verify the signer's certificate and the signature of the response. */ +#define TS_VFY_SIGNATURE (1u << 0) +/* Verify the version number of the response. */ +#define TS_VFY_VERSION (1u << 1) +/* Verify if the policy supplied by the user matches the policy of the TSA. */ +#define TS_VFY_POLICY (1u << 2) +/* + * Verify the message imprint provided by the user. This flag should not be + * specified with TS_VFY_DATA. + */ +#define TS_VFY_IMPRINT (1u << 3) +/* + * Verify the message imprint computed by the verify method from the user + * provided data and the MD algorithm of the response. This flag should not + * be specified with TS_VFY_IMPRINT. + */ +#define TS_VFY_DATA (1u << 4) +/* Verify the nonce value. */ +#define TS_VFY_NONCE (1u << 5) +/* Verify if the TSA name field matches the signer certificate. */ +#define TS_VFY_SIGNER (1u << 6) +/* Verify if the TSA name field equals to the user provided name. */ +#define TS_VFY_TSA_NAME (1u << 7) + +/* You can use the following convenience constants. */ +#define TS_VFY_ALL_IMPRINT \ + (TS_VFY_SIGNATURE | TS_VFY_VERSION | TS_VFY_POLICY | TS_VFY_IMPRINT | \ + TS_VFY_NONCE | TS_VFY_SIGNER | TS_VFY_TSA_NAME) +#define TS_VFY_ALL_DATA \ + (TS_VFY_SIGNATURE | TS_VFY_VERSION | TS_VFY_POLICY | TS_VFY_DATA | \ + TS_VFY_NONCE | TS_VFY_SIGNER | TS_VFY_TSA_NAME) + +typedef struct TS_verify_ctx { + /* Set this to the union of TS_VFY_... flags you want to carry out. */ + unsigned flags; + /* Must be set only with TS_VFY_SIGNATURE. certs is optional. */ + X509_STORE* store; + STACK_OF(X509) * certs; + /* Must be set only with TS_VFY_POLICY. */ + ASN1_OBJECT* policy; + /* + * Must be set only with TS_VFY_IMPRINT. If md_alg is NULL, the + * algorithm from the response is used. + */ + X509_ALGOR* md_alg; + unsigned char* imprint; + unsigned imprint_len; + /* Must be set only with TS_VFY_DATA. */ + BIO* data; + /* Must be set only with TS_VFY_TSA_NAME. */ + ASN1_INTEGER* nonce; + /* Must be set only with TS_VFY_TSA_NAME. */ + GENERAL_NAME* tsa_name; +} TS_VERIFY_CTX; + +int TS_RESP_verify_response(TS_VERIFY_CTX* ctx, TS_RESP* response); +int TS_RESP_verify_token(TS_VERIFY_CTX* ctx, PKCS7* token); + +/* + * Declarations related to response verification context, + * they are defined in ts/ts_verify_ctx.c. + */ + +/* Set all fields to zero. */ +TS_VERIFY_CTX* TS_VERIFY_CTX_new(void); +void TS_VERIFY_CTX_init(TS_VERIFY_CTX* ctx); +void TS_VERIFY_CTX_free(TS_VERIFY_CTX* ctx); +void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX* ctx); + +/*- + * If ctx is NULL, it allocates and returns a new object, otherwise + * it returns ctx. It initialises all the members as follows: + * flags = TS_VFY_ALL_IMPRINT & ~(TS_VFY_TSA_NAME | TS_VFY_SIGNATURE) + * certs = NULL + * store = NULL + * policy = policy from the request or NULL if absent (in this case + * TS_VFY_POLICY is cleared from flags as well) + * md_alg = MD algorithm from request + * imprint, imprint_len = imprint from request + * data = NULL + * nonce, nonce_len = nonce from the request or NULL if absent (in this case + * TS_VFY_NONCE is cleared from flags as well) + * tsa_name = NULL + * Important: after calling this method TS_VFY_SIGNATURE should be added! + */ +TS_VERIFY_CTX* TS_REQ_to_TS_VERIFY_CTX(TS_REQ* req, TS_VERIFY_CTX* ctx); + +/* Function declarations for TS_RESP defined in ts/ts_resp_print.c */ + +int TS_RESP_print_bio(BIO* bio, TS_RESP* a); +int TS_STATUS_INFO_print_bio(BIO* bio, TS_STATUS_INFO* a); +int TS_TST_INFO_print_bio(BIO* bio, TS_TST_INFO* a); + +/* Common utility functions defined in ts/ts_lib.c */ + +int TS_ASN1_INTEGER_print_bio(BIO* bio, const ASN1_INTEGER* num); +int TS_OBJ_print_bio(BIO* bio, const ASN1_OBJECT* obj); +int TS_ext_print_bio(BIO* bio, const STACK_OF(X509_EXTENSION) * extensions); +int TS_X509_ALGOR_print_bio(BIO* bio, const X509_ALGOR* alg); +int TS_MSG_IMPRINT_print_bio(BIO* bio, TS_MSG_IMPRINT* msg); + +/* + * Function declarations for handling configuration options, defined in + * ts/ts_conf.c + */ + +X509* TS_CONF_load_cert(const char* file); +STACK_OF(X509) * TS_CONF_load_certs(const char* file); +EVP_PKEY* TS_CONF_load_key(const char* file, const char* pass); +const char* TS_CONF_get_tsa_section(CONF* conf, const char* section); +int TS_CONF_set_serial( + CONF* conf, + const char* section, + TS_serial_cb cb, + TS_RESP_CTX* ctx); +int TS_CONF_set_crypto_device( + CONF* conf, + const char* section, + const char* device); +int TS_CONF_set_default_engine(const char* name); +int TS_CONF_set_signer_cert( + CONF* conf, + const char* section, + const char* cert, + TS_RESP_CTX* ctx); +int TS_CONF_set_certs( + CONF* conf, + const char* section, + const char* certs, + TS_RESP_CTX* ctx); +int TS_CONF_set_signer_key( + CONF* conf, + const char* section, + const char* key, + const char* pass, + TS_RESP_CTX* ctx); +int TS_CONF_set_def_policy( + CONF* conf, + const char* section, + const char* policy, + TS_RESP_CTX* ctx); +int TS_CONF_set_policies(CONF* conf, const char* section, TS_RESP_CTX* ctx); +int TS_CONF_set_digests(CONF* conf, const char* section, TS_RESP_CTX* ctx); +int TS_CONF_set_accuracy(CONF* conf, const char* section, TS_RESP_CTX* ctx); +int TS_CONF_set_clock_precision_digits( + CONF* conf, + const char* section, + TS_RESP_CTX* ctx); +int TS_CONF_set_ordering(CONF* conf, const char* section, TS_RESP_CTX* ctx); +int TS_CONF_set_tsa_name(CONF* conf, const char* section, TS_RESP_CTX* ctx); +int TS_CONF_set_ess_cert_id_chain( + CONF* conf, + const char* section, + TS_RESP_CTX* ctx); + +/* -------------------------------------------------- */ +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_TS_strings(void); + +/* Error codes for the TS functions. */ + +/* Function codes. */ +#define TS_F_D2I_TS_RESP 147 +#define TS_F_DEF_SERIAL_CB 110 +#define TS_F_DEF_TIME_CB 111 +#define TS_F_ESS_ADD_SIGNING_CERT 112 +#define TS_F_ESS_CERT_ID_NEW_INIT 113 +#define TS_F_ESS_SIGNING_CERT_NEW_INIT 114 +#define TS_F_INT_TS_RESP_VERIFY_TOKEN 149 +#define TS_F_PKCS7_TO_TS_TST_INFO 148 +#define TS_F_TS_ACCURACY_SET_MICROS 115 +#define TS_F_TS_ACCURACY_SET_MILLIS 116 +#define TS_F_TS_ACCURACY_SET_SECONDS 117 +#define TS_F_TS_CHECK_IMPRINTS 100 +#define TS_F_TS_CHECK_NONCES 101 +#define TS_F_TS_CHECK_POLICY 102 +#define TS_F_TS_CHECK_SIGNING_CERTS 103 +#define TS_F_TS_CHECK_STATUS_INFO 104 +#define TS_F_TS_COMPUTE_IMPRINT 145 +#define TS_F_TS_CONF_SET_DEFAULT_ENGINE 146 +#define TS_F_TS_GET_STATUS_TEXT 105 +#define TS_F_TS_MSG_IMPRINT_SET_ALGO 118 +#define TS_F_TS_REQ_SET_MSG_IMPRINT 119 +#define TS_F_TS_REQ_SET_NONCE 120 +#define TS_F_TS_REQ_SET_POLICY_ID 121 +#define TS_F_TS_RESP_CREATE_RESPONSE 122 +#define TS_F_TS_RESP_CREATE_TST_INFO 123 +#define TS_F_TS_RESP_CTX_ADD_FAILURE_INFO 124 +#define TS_F_TS_RESP_CTX_ADD_MD 125 +#define TS_F_TS_RESP_CTX_ADD_POLICY 126 +#define TS_F_TS_RESP_CTX_NEW 127 +#define TS_F_TS_RESP_CTX_SET_ACCURACY 128 +#define TS_F_TS_RESP_CTX_SET_CERTS 129 +#define TS_F_TS_RESP_CTX_SET_DEF_POLICY 130 +#define TS_F_TS_RESP_CTX_SET_SIGNER_CERT 131 +#define TS_F_TS_RESP_CTX_SET_STATUS_INFO 132 +#define TS_F_TS_RESP_GET_POLICY 133 +#define TS_F_TS_RESP_SET_GENTIME_WITH_PRECISION 134 +#define TS_F_TS_RESP_SET_STATUS_INFO 135 +#define TS_F_TS_RESP_SET_TST_INFO 150 +#define TS_F_TS_RESP_SIGN 136 +#define TS_F_TS_RESP_VERIFY_SIGNATURE 106 +#define TS_F_TS_RESP_VERIFY_TOKEN 107 +#define TS_F_TS_TST_INFO_SET_ACCURACY 137 +#define TS_F_TS_TST_INFO_SET_MSG_IMPRINT 138 +#define TS_F_TS_TST_INFO_SET_NONCE 139 +#define TS_F_TS_TST_INFO_SET_POLICY_ID 140 +#define TS_F_TS_TST_INFO_SET_SERIAL 141 +#define TS_F_TS_TST_INFO_SET_TIME 142 +#define TS_F_TS_TST_INFO_SET_TSA 143 +#define TS_F_TS_VERIFY 108 +#define TS_F_TS_VERIFY_CERT 109 +#define TS_F_TS_VERIFY_CTX_NEW 144 + +/* Reason codes. */ +#define TS_R_BAD_PKCS7_TYPE 132 +#define TS_R_BAD_TYPE 133 +#define TS_R_CERTIFICATE_VERIFY_ERROR 100 +#define TS_R_COULD_NOT_SET_ENGINE 127 +#define TS_R_COULD_NOT_SET_TIME 115 +#define TS_R_D2I_TS_RESP_INT_FAILED 128 +#define TS_R_DETACHED_CONTENT 134 +#define TS_R_ESS_ADD_SIGNING_CERT_ERROR 116 +#define TS_R_ESS_SIGNING_CERTIFICATE_ERROR 101 +#define TS_R_INVALID_NULL_POINTER 102 +#define TS_R_INVALID_SIGNER_CERTIFICATE_PURPOSE 117 +#define TS_R_MESSAGE_IMPRINT_MISMATCH 103 +#define TS_R_NONCE_MISMATCH 104 +#define TS_R_NONCE_NOT_RETURNED 105 +#define TS_R_NO_CONTENT 106 +#define TS_R_NO_TIME_STAMP_TOKEN 107 +#define TS_R_PKCS7_ADD_SIGNATURE_ERROR 118 +#define TS_R_PKCS7_ADD_SIGNED_ATTR_ERROR 119 +#define TS_R_PKCS7_TO_TS_TST_INFO_FAILED 129 +#define TS_R_POLICY_MISMATCH 108 +#define TS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 120 +#define TS_R_RESPONSE_SETUP_ERROR 121 +#define TS_R_SIGNATURE_FAILURE 109 +#define TS_R_THERE_MUST_BE_ONE_SIGNER 110 +#define TS_R_TIME_SYSCALL_ERROR 122 +#define TS_R_TOKEN_NOT_PRESENT 130 +#define TS_R_TOKEN_PRESENT 131 +#define TS_R_TSA_NAME_MISMATCH 111 +#define TS_R_TSA_UNTRUSTED 112 +#define TS_R_TST_INFO_SETUP_ERROR 123 +#define TS_R_TS_DATASIGN 124 +#define TS_R_UNACCEPTABLE_POLICY 125 +#define TS_R_UNSUPPORTED_MD_ALGORITHM 126 +#define TS_R_UNSUPPORTED_VERSION 113 +#define TS_R_WRONG_CONTENT_TYPE 114 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/txt_db.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/txt_db.h new file mode 100644 index 0000000..2aadc09 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/txt_db.h @@ -0,0 +1,115 @@ +/* crypto/txt_db/txt_db.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_TXT_DB_H +#define HEADER_TXT_DB_H + +#include +#ifndef OPENSSL_NO_BIO +#include +#endif +#include +#include + +#define DB_ERROR_OK 0 +#define DB_ERROR_MALLOC 1 +#define DB_ERROR_INDEX_CLASH 2 +#define DB_ERROR_INDEX_OUT_OF_RANGE 3 +#define DB_ERROR_NO_INDEX 4 +#define DB_ERROR_INSERT_INDEX_CLASH 5 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef OPENSSL_STRING* OPENSSL_PSTRING; +DECLARE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING) + +typedef struct txt_db_st { + int num_fields; + STACK_OF(OPENSSL_PSTRING) * data; + LHASH_OF(OPENSSL_STRING) * *index; + int (**qual)(OPENSSL_STRING*); + long error; + long arg1; + long arg2; + OPENSSL_STRING* arg_row; +} TXT_DB; + +#ifndef OPENSSL_NO_BIO +TXT_DB* TXT_DB_read(BIO* in, int num); +long TXT_DB_write(BIO* out, TXT_DB* db); +#else +TXT_DB* TXT_DB_read(char* in, int num); +long TXT_DB_write(char* out, TXT_DB* db); +#endif +int TXT_DB_create_index( + TXT_DB* db, + int field, + int (*qual)(OPENSSL_STRING*), + LHASH_HASH_FN_TYPE hash, + LHASH_COMP_FN_TYPE cmp); +void TXT_DB_free(TXT_DB* db); +OPENSSL_STRING* TXT_DB_get_by_index(TXT_DB* db, int idx, OPENSSL_STRING* value); +int TXT_DB_insert(TXT_DB* db, OPENSSL_STRING* value); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ui.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ui.h new file mode 100644 index 0000000..3a82e88 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ui.h @@ -0,0 +1,461 @@ +/* crypto/ui/ui.h */ +/* + * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project + * 2001. + */ +/* ==================================================================== + * Copyright (c) 2001 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_UI_H +#define HEADER_UI_H + +#ifndef OPENSSL_NO_DEPRECATED +#include +#endif +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Declared already in ossl_typ.h */ +/* typedef struct ui_st UI; */ +/* typedef struct ui_method_st UI_METHOD; */ + +/* + * All the following functions return -1 or NULL on error and in some cases + * (UI_process()) -2 if interrupted or in some other way cancelled. When + * everything is fine, they return 0, a positive value or a non-NULL pointer, + * all depending on their purpose. + */ + +/* Creators and destructor. */ +UI* UI_new(void); +UI* UI_new_method(const UI_METHOD* method); +void UI_free(UI* ui); + +/*- + The following functions are used to add strings to be printed and prompt + strings to prompt for data. The names are UI_{add,dup}__string + and UI_{add,dup}_input_boolean. + + UI_{add,dup}__string have the following meanings: + add add a text or prompt string. The pointers given to these + functions are used verbatim, no copying is done. + dup make a copy of the text or prompt string, then add the copy + to the collection of strings in the user interface. + + The function is a name for the functionality that the given + string shall be used for. It can be one of: + input use the string as data prompt. + verify use the string as verification prompt. This + is used to verify a previous input. + info use the string for informational output. + error use the string for error output. + Honestly, there's currently no difference between info and error for the + moment. + + UI_{add,dup}_input_boolean have the same semantics for "add" and "dup", + and are typically used when one wants to prompt for a yes/no response. + + All of the functions in this group take a UI and a prompt string. + The string input and verify addition functions also take a flag argument, + a buffer for the result to end up with, a minimum input size and a maximum + input size (the result buffer MUST be large enough to be able to contain + the maximum number of characters). Additionally, the verify addition + functions takes another buffer to compare the result against. + The boolean input functions take an action description string (which should + be safe to ignore if the expected user action is obvious, for example with + a dialog box with an OK button and a Cancel button), a string of acceptable + characters to mean OK and to mean Cancel. The two last strings are checked + to make sure they don't have common characters. Additionally, the same + flag argument as for the string input is taken, as well as a result buffer. + The result buffer is required to be at least one byte long. Depending on + the answer, the first character from the OK or the Cancel character strings + will be stored in the first byte of the result buffer. No NUL will be + added, so the result is *not* a string. + + On success, the all return an index of the added information. That index + is usefull when retrieving results with UI_get0_result(). */ +int UI_add_input_string( + UI* ui, + const char* prompt, + int flags, + char* result_buf, + int minsize, + int maxsize); +int UI_dup_input_string( + UI* ui, + const char* prompt, + int flags, + char* result_buf, + int minsize, + int maxsize); +int UI_add_verify_string( + UI* ui, + const char* prompt, + int flags, + char* result_buf, + int minsize, + int maxsize, + const char* test_buf); +int UI_dup_verify_string( + UI* ui, + const char* prompt, + int flags, + char* result_buf, + int minsize, + int maxsize, + const char* test_buf); +int UI_add_input_boolean( + UI* ui, + const char* prompt, + const char* action_desc, + const char* ok_chars, + const char* cancel_chars, + int flags, + char* result_buf); +int UI_dup_input_boolean( + UI* ui, + const char* prompt, + const char* action_desc, + const char* ok_chars, + const char* cancel_chars, + int flags, + char* result_buf); +int UI_add_info_string(UI* ui, const char* text); +int UI_dup_info_string(UI* ui, const char* text); +int UI_add_error_string(UI* ui, const char* text); +int UI_dup_error_string(UI* ui, const char* text); + +/* These are the possible flags. They can be or'ed together. */ +/* Use to have echoing of input */ +#define UI_INPUT_FLAG_ECHO 0x01 +/* + * Use a default password. Where that password is found is completely up to + * the application, it might for example be in the user data set with + * UI_add_user_data(). It is not recommended to have more than one input in + * each UI being marked with this flag, or the application might get + * confused. + */ +#define UI_INPUT_FLAG_DEFAULT_PWD 0x02 + +/*- + * The user of these routines may want to define flags of their own. The core + * UI won't look at those, but will pass them on to the method routines. They + * must use higher bits so they don't get confused with the UI bits above. + * UI_INPUT_FLAG_USER_BASE tells which is the lowest bit to use. A good + * example of use is this: + * + * #define MY_UI_FLAG1 (0x01 << UI_INPUT_FLAG_USER_BASE) + * +*/ +#define UI_INPUT_FLAG_USER_BASE 16 + +/*- + * The following function helps construct a prompt. object_desc is a + * textual short description of the object, for example "pass phrase", + * and object_name is the name of the object (might be a card name or + * a file name. + * The returned string shall always be allocated on the heap with + * OPENSSL_malloc(), and need to be free'd with OPENSSL_free(). + * + * If the ui_method doesn't contain a pointer to a user-defined prompt + * constructor, a default string is built, looking like this: + * + * "Enter {object_desc} for {object_name}:" + * + * So, if object_desc has the value "pass phrase" and object_name has + * the value "foo.key", the resulting string is: + * + * "Enter pass phrase for foo.key:" +*/ +char* UI_construct_prompt( + UI* ui_method, + const char* object_desc, + const char* object_name); + +/* + * The following function is used to store a pointer to user-specific data. + * Any previous such pointer will be returned and replaced. + * + * For callback purposes, this function makes a lot more sense than using + * ex_data, since the latter requires that different parts of OpenSSL or + * applications share the same ex_data index. + * + * Note that the UI_OpenSSL() method completely ignores the user data. Other + * methods may not, however. + */ +void* UI_add_user_data(UI* ui, void* user_data); +/* We need a user data retrieving function as well. */ +void* UI_get0_user_data(UI* ui); + +/* Return the result associated with a prompt given with the index i. */ +const char* UI_get0_result(UI* ui, int i); + +/* When all strings have been added, process the whole thing. */ +int UI_process(UI* ui); + +/* + * Give a user interface parametrised control commands. This can be used to + * send down an integer, a data pointer or a function pointer, as well as be + * used to get information from a UI. + */ +int UI_ctrl(UI* ui, int cmd, long i, void* p, void (*f)(void)); + +/* The commands */ +/* + * Use UI_CONTROL_PRINT_ERRORS with the value 1 to have UI_process print the + * OpenSSL error stack before printing any info or added error messages and + * before any prompting. + */ +#define UI_CTRL_PRINT_ERRORS 1 +/* + * Check if a UI_process() is possible to do again with the same instance of + * a user interface. This makes UI_ctrl() return 1 if it is redoable, and 0 + * if not. + */ +#define UI_CTRL_IS_REDOABLE 2 + +/* Some methods may use extra data */ +#define UI_set_app_data(s, arg) UI_set_ex_data(s, 0, arg) +#define UI_get_app_data(s) UI_get_ex_data(s, 0) +int UI_get_ex_new_index( + long argl, + void* argp, + CRYPTO_EX_new* new_func, + CRYPTO_EX_dup* dup_func, + CRYPTO_EX_free* free_func); +int UI_set_ex_data(UI* r, int idx, void* arg); +void* UI_get_ex_data(UI* r, int idx); + +/* Use specific methods instead of the built-in one */ +void UI_set_default_method(const UI_METHOD* meth); +const UI_METHOD* UI_get_default_method(void); +const UI_METHOD* UI_get_method(UI* ui); +const UI_METHOD* UI_set_method(UI* ui, const UI_METHOD* meth); + +/* The method with all the built-in thingies */ +UI_METHOD* UI_OpenSSL(void); + +/* ---------- For method writers ---------- */ +/*- + A method contains a number of functions that implement the low level + of the User Interface. The functions are: + + an opener This function starts a session, maybe by opening + a channel to a tty, or by opening a window. + a writer This function is called to write a given string, + maybe to the tty, maybe as a field label in a + window. + a flusher This function is called to flush everything that + has been output so far. It can be used to actually + display a dialog box after it has been built. + a reader This function is called to read a given prompt, + maybe from the tty, maybe from a field in a + window. Note that it's called wth all string + structures, not only the prompt ones, so it must + check such things itself. + a closer This function closes the session, maybe by closing + the channel to the tty, or closing the window. + + All these functions are expected to return: + + 0 on error. + 1 on success. + -1 on out-of-band events, for example if some prompting has + been canceled (by pressing Ctrl-C, for example). This is + only checked when returned by the flusher or the reader. + + The way this is used, the opener is first called, then the writer for all + strings, then the flusher, then the reader for all strings and finally the + closer. Note that if you want to prompt from a terminal or other command + line interface, the best is to have the reader also write the prompts + instead of having the writer do it. If you want to prompt from a dialog + box, the writer can be used to build up the contents of the box, and the + flusher to actually display the box and run the event loop until all data + has been given, after which the reader only grabs the given data and puts + them back into the UI strings. + + All method functions take a UI as argument. Additionally, the writer and + the reader take a UI_STRING. +*/ + +/* + * The UI_STRING type is the data structure that contains all the needed info + * about a string or a prompt, including test data for a verification prompt. + */ +typedef struct ui_string_st UI_STRING; +DECLARE_STACK_OF(UI_STRING) + +/* + * The different types of strings that are currently supported. This is only + * needed by method authors. + */ +enum UI_string_types { + UIT_NONE = 0, + UIT_PROMPT, /* Prompt for a string */ + UIT_VERIFY, /* Prompt for a string and verify */ + UIT_BOOLEAN, /* Prompt for a yes/no response */ + UIT_INFO, /* Send info to the user */ + UIT_ERROR /* Send an error message to the user */ +}; + +/* Create and manipulate methods */ +UI_METHOD* UI_create_method(char* name); +void UI_destroy_method(UI_METHOD* ui_method); +int UI_method_set_opener(UI_METHOD* method, int (*opener)(UI* ui)); +int UI_method_set_writer( + UI_METHOD* method, + int (*writer)(UI* ui, UI_STRING* uis)); +int UI_method_set_flusher(UI_METHOD* method, int (*flusher)(UI* ui)); +int UI_method_set_reader( + UI_METHOD* method, + int (*reader)(UI* ui, UI_STRING* uis)); +int UI_method_set_closer(UI_METHOD* method, int (*closer)(UI* ui)); +int UI_method_set_prompt_constructor( + UI_METHOD* method, + char* (*prompt_constructor)( + UI* ui, + const char* object_desc, + const char* object_name)); +int (*UI_method_get_opener(UI_METHOD* method))(UI*); +int (*UI_method_get_writer(UI_METHOD* method))(UI*, UI_STRING*); +int (*UI_method_get_flusher(UI_METHOD* method))(UI*); +int (*UI_method_get_reader(UI_METHOD* method))(UI*, UI_STRING*); +int (*UI_method_get_closer(UI_METHOD* method))(UI*); +char* (*UI_method_get_prompt_constructor(UI_METHOD* method))( + UI*, + const char*, + const char*); + +/* + * The following functions are helpers for method writers to access relevant + * data from a UI_STRING. + */ + +/* Return type of the UI_STRING */ +enum UI_string_types UI_get_string_type(UI_STRING* uis); +/* Return input flags of the UI_STRING */ +int UI_get_input_flags(UI_STRING* uis); +/* Return the actual string to output (the prompt, info or error) */ +const char* UI_get0_output_string(UI_STRING* uis); +/* + * Return the optional action string to output (the boolean promtp + * instruction) + */ +const char* UI_get0_action_string(UI_STRING* uis); +/* Return the result of a prompt */ +const char* UI_get0_result_string(UI_STRING* uis); +/* + * Return the string to test the result against. Only useful with verifies. + */ +const char* UI_get0_test_string(UI_STRING* uis); +/* Return the required minimum size of the result */ +int UI_get_result_minsize(UI_STRING* uis); +/* Return the required maximum size of the result */ +int UI_get_result_maxsize(UI_STRING* uis); +/* Set the result of a UI_STRING. */ +int UI_set_result(UI* ui, UI_STRING* uis, const char* result); + +/* A couple of popular utility functions */ +int UI_UTIL_read_pw_string( + char* buf, + int length, + const char* prompt, + int verify); +int UI_UTIL_read_pw( + char* buf, + char* buff, + int size, + const char* prompt, + int verify); + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_UI_strings(void); + +/* Error codes for the UI functions. */ + +/* Function codes. */ +#define UI_F_GENERAL_ALLOCATE_BOOLEAN 108 +#define UI_F_GENERAL_ALLOCATE_PROMPT 109 +#define UI_F_GENERAL_ALLOCATE_STRING 100 +#define UI_F_UI_CTRL 111 +#define UI_F_UI_DUP_ERROR_STRING 101 +#define UI_F_UI_DUP_INFO_STRING 102 +#define UI_F_UI_DUP_INPUT_BOOLEAN 110 +#define UI_F_UI_DUP_INPUT_STRING 103 +#define UI_F_UI_DUP_VERIFY_STRING 106 +#define UI_F_UI_GET0_RESULT 107 +#define UI_F_UI_NEW_METHOD 104 +#define UI_F_UI_SET_RESULT 105 + +/* Reason codes. */ +#define UI_R_COMMON_OK_AND_CANCEL_CHARACTERS 104 +#define UI_R_INDEX_TOO_LARGE 102 +#define UI_R_INDEX_TOO_SMALL 103 +#define UI_R_NO_RESULT_BUFFER 105 +#define UI_R_RESULT_TOO_LARGE 100 +#define UI_R_RESULT_TOO_SMALL 101 +#define UI_R_UNKNOWN_CONTROL_COMMAND 106 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ui_compat.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ui_compat.h new file mode 100644 index 0000000..e9b31b8 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/ui_compat.h @@ -0,0 +1,95 @@ +/* crypto/ui/ui.h */ +/* + * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project + * 2001. + */ +/* ==================================================================== + * Copyright (c) 2001 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_UI_COMPAT_H +#define HEADER_UI_COMPAT_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The following functions were previously part of the DES section, and are + * provided here for backward compatibility reasons. + */ + +#define des_read_pw_string(b, l, p, v) \ + _ossl_old_des_read_pw_string((b), (l), (p), (v)) +#define des_read_pw(b, bf, s, p, v) \ + _ossl_old_des_read_pw((b), (bf), (s), (p), (v)) + +int _ossl_old_des_read_pw_string( + char* buf, + int length, + const char* prompt, + int verify); +int _ossl_old_des_read_pw( + char* buf, + char* buff, + int size, + const char* prompt, + int verify); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/whrlpool.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/whrlpool.h new file mode 100644 index 0000000..1cfe3ec --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/whrlpool.h @@ -0,0 +1,41 @@ +#ifndef HEADER_WHRLPOOL_H +#define HEADER_WHRLPOOL_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define WHIRLPOOL_DIGEST_LENGTH (512 / 8) +#define WHIRLPOOL_BBLOCK 512 +#define WHIRLPOOL_COUNTER (256 / 8) + +typedef struct { + union { + unsigned char c[WHIRLPOOL_DIGEST_LENGTH]; + /* double q is here to ensure 64-bit alignment */ + double q[WHIRLPOOL_DIGEST_LENGTH / sizeof(double)]; + } H; + unsigned char data[WHIRLPOOL_BBLOCK / 8]; + unsigned int bitoff; + size_t bitlen[WHIRLPOOL_COUNTER / sizeof(size_t)]; +} WHIRLPOOL_CTX; + +#ifndef OPENSSL_NO_WHIRLPOOL +#ifdef OPENSSL_FIPS +int private_WHIRLPOOL_Init(WHIRLPOOL_CTX* c); +#endif +int WHIRLPOOL_Init(WHIRLPOOL_CTX* c); +int WHIRLPOOL_Update(WHIRLPOOL_CTX* c, const void* inp, size_t bytes); +void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX* c, const void* inp, size_t bits); +int WHIRLPOOL_Final(unsigned char* md, WHIRLPOOL_CTX* c); +unsigned char* WHIRLPOOL(const void* inp, size_t bytes, unsigned char* md); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/x509.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/x509.h new file mode 100644 index 0000000..fb4ff7a --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/x509.h @@ -0,0 +1,1531 @@ +/* crypto/x509/x509.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * ECDH support in OpenSSL originally developed by + * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. + */ + +#ifndef HEADER_X509_H +#define HEADER_X509_H + +#include +#include +#ifndef OPENSSL_NO_BUFFER +#include +#endif +#ifndef OPENSSL_NO_EVP +#include +#endif +#ifndef OPENSSL_NO_BIO +#include +#endif +#include +#include +#include + +#ifndef OPENSSL_NO_EC +#include +#endif + +#ifndef OPENSSL_NO_ECDSA +#include +#endif + +#ifndef OPENSSL_NO_ECDH +#include +#endif + +#ifndef OPENSSL_NO_DEPRECATED +#ifndef OPENSSL_NO_RSA +#include +#endif +#ifndef OPENSSL_NO_DSA +#include +#endif +#ifndef OPENSSL_NO_DH +#include +#endif +#endif + +#ifndef OPENSSL_NO_SHA +#include +#endif +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSSL_SYS_WIN32 +/* Under Win32 these are defined in wincrypt.h */ +#undef X509_NAME +#undef X509_CERT_PAIR +#undef X509_EXTENSIONS +#endif + +#define X509_FILETYPE_PEM 1 +#define X509_FILETYPE_ASN1 2 +#define X509_FILETYPE_DEFAULT 3 + +#define X509v3_KU_DIGITAL_SIGNATURE 0x0080 +#define X509v3_KU_NON_REPUDIATION 0x0040 +#define X509v3_KU_KEY_ENCIPHERMENT 0x0020 +#define X509v3_KU_DATA_ENCIPHERMENT 0x0010 +#define X509v3_KU_KEY_AGREEMENT 0x0008 +#define X509v3_KU_KEY_CERT_SIGN 0x0004 +#define X509v3_KU_CRL_SIGN 0x0002 +#define X509v3_KU_ENCIPHER_ONLY 0x0001 +#define X509v3_KU_DECIPHER_ONLY 0x8000 +#define X509v3_KU_UNDEF 0xffff + +typedef struct X509_objects_st { + int nid; + int (*a2i)(void); + int (*i2a)(void); +} X509_OBJECTS; + +struct X509_algor_st { + ASN1_OBJECT* algorithm; + ASN1_TYPE* parameter; +} /* X509_ALGOR */; + +DECLARE_ASN1_SET_OF(X509_ALGOR) + +typedef STACK_OF(X509_ALGOR) X509_ALGORS; + +typedef struct X509_val_st { + ASN1_TIME* notBefore; + ASN1_TIME* notAfter; +} X509_VAL; + +struct X509_pubkey_st { + X509_ALGOR* algor; + ASN1_BIT_STRING* public_key; + EVP_PKEY* pkey; +}; + +typedef struct X509_sig_st { + X509_ALGOR* algor; + ASN1_OCTET_STRING* digest; +} X509_SIG; + +typedef struct X509_name_entry_st { + ASN1_OBJECT* object; + ASN1_STRING* value; + int set; + int size; /* temp variable */ +} X509_NAME_ENTRY; + +DECLARE_STACK_OF(X509_NAME_ENTRY) +DECLARE_ASN1_SET_OF(X509_NAME_ENTRY) + +/* we always keep X509_NAMEs in 2 forms. */ +struct X509_name_st { + STACK_OF(X509_NAME_ENTRY) * entries; + int modified; /* true if 'bytes' needs to be built */ +#ifndef OPENSSL_NO_BUFFER + BUF_MEM* bytes; +#else + char* bytes; +#endif + /* unsigned long hash; Keep the hash around for lookups */ + unsigned char* canon_enc; + int canon_enclen; +} /* X509_NAME */; + +DECLARE_STACK_OF(X509_NAME) + +#define X509_EX_V_NETSCAPE_HACK 0x8000 +#define X509_EX_V_INIT 0x0001 +typedef struct X509_extension_st { + ASN1_OBJECT* object; + ASN1_BOOLEAN critical; + ASN1_OCTET_STRING* value; +} X509_EXTENSION; + +typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS; + +DECLARE_STACK_OF(X509_EXTENSION) +DECLARE_ASN1_SET_OF(X509_EXTENSION) + +/* a sequence of these are used */ +typedef struct x509_attributes_st { + ASN1_OBJECT* object; + int single; /* 0 for a set, 1 for a single item (which is + * wrong) */ + union { + char* ptr; + /* + * 0 + */ STACK_OF(ASN1_TYPE) * set; + /* + * 1 + */ ASN1_TYPE* single; + } value; +} X509_ATTRIBUTE; + +DECLARE_STACK_OF(X509_ATTRIBUTE) +DECLARE_ASN1_SET_OF(X509_ATTRIBUTE) + +typedef struct X509_req_info_st { + ASN1_ENCODING enc; + ASN1_INTEGER* version; + X509_NAME* subject; + X509_PUBKEY* pubkey; + /* d=2 hl=2 l= 0 cons: cont: 00 */ + STACK_OF(X509_ATTRIBUTE) * attributes; /* [ 0 ] */ +} X509_REQ_INFO; + +typedef struct X509_req_st { + X509_REQ_INFO* req_info; + X509_ALGOR* sig_alg; + ASN1_BIT_STRING* signature; + int references; +} X509_REQ; + +typedef struct x509_cinf_st { + ASN1_INTEGER* version; /* [ 0 ] default of v1 */ + ASN1_INTEGER* serialNumber; + X509_ALGOR* signature; + X509_NAME* issuer; + X509_VAL* validity; + X509_NAME* subject; + X509_PUBKEY* key; + ASN1_BIT_STRING* issuerUID; /* [ 1 ] optional in v2 */ + ASN1_BIT_STRING* subjectUID; /* [ 2 ] optional in v2 */ + STACK_OF(X509_EXTENSION) * extensions; /* [ 3 ] optional in v3 */ + ASN1_ENCODING enc; +} X509_CINF; + +/* + * This stuff is certificate "auxiliary info" it contains details which are + * useful in certificate stores and databases. When used this is tagged onto + * the end of the certificate itself + */ + +typedef struct x509_cert_aux_st { + STACK_OF(ASN1_OBJECT) * trust; /* trusted uses */ + STACK_OF(ASN1_OBJECT) * reject; /* rejected uses */ + ASN1_UTF8STRING* alias; /* "friendly name" */ + ASN1_OCTET_STRING* keyid; /* key id of private key */ + STACK_OF(X509_ALGOR) * other; /* other unspecified info */ +} X509_CERT_AUX; + +struct x509_st { + X509_CINF* cert_info; + X509_ALGOR* sig_alg; + ASN1_BIT_STRING* signature; + int valid; + int references; + char* name; + CRYPTO_EX_DATA ex_data; + /* These contain copies of various extension values */ + long ex_pathlen; + long ex_pcpathlen; + unsigned long ex_flags; + unsigned long ex_kusage; + unsigned long ex_xkusage; + unsigned long ex_nscert; + ASN1_OCTET_STRING* skid; + AUTHORITY_KEYID* akid; + X509_POLICY_CACHE* policy_cache; + STACK_OF(DIST_POINT) * crldp; + STACK_OF(GENERAL_NAME) * altname; + NAME_CONSTRAINTS* nc; +#ifndef OPENSSL_NO_RFC3779 + STACK_OF(IPAddressFamily) * rfc3779_addr; + struct ASIdentifiers_st* rfc3779_asid; +#endif +#ifndef OPENSSL_NO_SHA + unsigned char sha1_hash[SHA_DIGEST_LENGTH]; +#endif + X509_CERT_AUX* aux; +} /* X509 */; + +DECLARE_STACK_OF(X509) +DECLARE_ASN1_SET_OF(X509) + +/* This is used for a table of trust checking functions */ + +typedef struct x509_trust_st { + int trust; + int flags; + int (*check_trust)(struct x509_trust_st*, X509*, int); + char* name; + int arg1; + void* arg2; +} X509_TRUST; + +DECLARE_STACK_OF(X509_TRUST) + +typedef struct x509_cert_pair_st { + X509* forward; + X509* reverse; +} X509_CERT_PAIR; + +/* standard trust ids */ + +#define X509_TRUST_DEFAULT -1 /* Only valid in purpose settings */ + +#define X509_TRUST_COMPAT 1 +#define X509_TRUST_SSL_CLIENT 2 +#define X509_TRUST_SSL_SERVER 3 +#define X509_TRUST_EMAIL 4 +#define X509_TRUST_OBJECT_SIGN 5 +#define X509_TRUST_OCSP_SIGN 6 +#define X509_TRUST_OCSP_REQUEST 7 +#define X509_TRUST_TSA 8 + +/* Keep these up to date! */ +#define X509_TRUST_MIN 1 +#define X509_TRUST_MAX 8 + +/* trust_flags values */ +#define X509_TRUST_DYNAMIC 1 +#define X509_TRUST_DYNAMIC_NAME 2 + +/* check_trust return codes */ + +#define X509_TRUST_TRUSTED 1 +#define X509_TRUST_REJECTED 2 +#define X509_TRUST_UNTRUSTED 3 + +/* Flags for X509_print_ex() */ + +#define X509_FLAG_COMPAT 0 +#define X509_FLAG_NO_HEADER 1L +#define X509_FLAG_NO_VERSION (1L << 1) +#define X509_FLAG_NO_SERIAL (1L << 2) +#define X509_FLAG_NO_SIGNAME (1L << 3) +#define X509_FLAG_NO_ISSUER (1L << 4) +#define X509_FLAG_NO_VALIDITY (1L << 5) +#define X509_FLAG_NO_SUBJECT (1L << 6) +#define X509_FLAG_NO_PUBKEY (1L << 7) +#define X509_FLAG_NO_EXTENSIONS (1L << 8) +#define X509_FLAG_NO_SIGDUMP (1L << 9) +#define X509_FLAG_NO_AUX (1L << 10) +#define X509_FLAG_NO_ATTRIBUTES (1L << 11) +#define X509_FLAG_NO_IDS (1L << 12) + +/* Flags specific to X509_NAME_print_ex() */ + +/* The field separator information */ + +#define XN_FLAG_SEP_MASK (0xf << 16) + +#define XN_FLAG_COMPAT \ + 0 /* Traditional SSLeay: use old \ + * X509_NAME_print */ +#define XN_FLAG_SEP_COMMA_PLUS (1 << 16) /* RFC2253 ,+ */ +#define XN_FLAG_SEP_CPLUS_SPC (2 << 16) /* ,+ spaced: more readable */ +#define XN_FLAG_SEP_SPLUS_SPC (3 << 16) /* ;+ spaced */ +#define XN_FLAG_SEP_MULTILINE (4 << 16) /* One line per field */ + +#define XN_FLAG_DN_REV (1 << 20) /* Reverse DN order */ + +/* How the field name is shown */ + +#define XN_FLAG_FN_MASK (0x3 << 21) + +#define XN_FLAG_FN_SN 0 /* Object short name */ +#define XN_FLAG_FN_LN (1 << 21) /* Object long name */ +#define XN_FLAG_FN_OID (2 << 21) /* Always use OIDs */ +#define XN_FLAG_FN_NONE (3 << 21) /* No field names */ + +#define XN_FLAG_SPC_EQ (1 << 23) /* Put spaces round '=' */ + +/* + * This determines if we dump fields we don't recognise: RFC2253 requires + * this. + */ + +#define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24) + +#define XN_FLAG_FN_ALIGN \ + (1 << 25) /* Align field names to 20 \ + * characters */ + +/* Complete set of RFC2253 flags */ + +#define XN_FLAG_RFC2253 \ + (ASN1_STRFLGS_RFC2253 | XN_FLAG_SEP_COMMA_PLUS | XN_FLAG_DN_REV | \ + XN_FLAG_FN_SN | XN_FLAG_DUMP_UNKNOWN_FIELDS) + +/* readable oneline form */ + +#define XN_FLAG_ONELINE \ + (ASN1_STRFLGS_RFC2253 | ASN1_STRFLGS_ESC_QUOTE | XN_FLAG_SEP_CPLUS_SPC | \ + XN_FLAG_SPC_EQ | XN_FLAG_FN_SN) + +/* readable multiline form */ + +#define XN_FLAG_MULTILINE \ + (ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | XN_FLAG_SEP_MULTILINE | \ + XN_FLAG_SPC_EQ | XN_FLAG_FN_LN | XN_FLAG_FN_ALIGN) + +struct x509_revoked_st { + ASN1_INTEGER* serialNumber; + ASN1_TIME* revocationDate; + STACK_OF(X509_EXTENSION) /* optional */ * extensions; + /* Set up if indirect CRL */ + STACK_OF(GENERAL_NAME) * issuer; + /* Revocation reason */ + int reason; + int sequence; /* load sequence */ +}; + +DECLARE_STACK_OF(X509_REVOKED) +DECLARE_ASN1_SET_OF(X509_REVOKED) + +typedef struct X509_crl_info_st { + ASN1_INTEGER* version; + X509_ALGOR* sig_alg; + X509_NAME* issuer; + ASN1_TIME* lastUpdate; + ASN1_TIME* nextUpdate; + STACK_OF(X509_REVOKED) * revoked; + STACK_OF(X509_EXTENSION) /* [0] */ * extensions; + ASN1_ENCODING enc; +} X509_CRL_INFO; + +struct X509_crl_st { + /* actual signature */ + X509_CRL_INFO* crl; + X509_ALGOR* sig_alg; + ASN1_BIT_STRING* signature; + int references; + int flags; + /* Copies of various extensions */ + AUTHORITY_KEYID* akid; + ISSUING_DIST_POINT* idp; + /* Convenient breakdown of IDP */ + int idp_flags; + int idp_reasons; + /* CRL and base CRL numbers for delta processing */ + ASN1_INTEGER* crl_number; + ASN1_INTEGER* base_crl_number; +#ifndef OPENSSL_NO_SHA + unsigned char sha1_hash[SHA_DIGEST_LENGTH]; +#endif + STACK_OF(GENERAL_NAMES) * issuers; + const X509_CRL_METHOD* meth; + void* meth_data; +} /* X509_CRL */; + +DECLARE_STACK_OF(X509_CRL) +DECLARE_ASN1_SET_OF(X509_CRL) + +typedef struct private_key_st { + int version; + /* The PKCS#8 data types */ + X509_ALGOR* enc_algor; + ASN1_OCTET_STRING* enc_pkey; /* encrypted pub key */ + /* When decrypted, the following will not be NULL */ + EVP_PKEY* dec_pkey; + /* used to encrypt and decrypt */ + int key_length; + char* key_data; + int key_free; /* true if we should auto free key_data */ + /* expanded version of 'enc_algor' */ + EVP_CIPHER_INFO cipher; + int references; +} X509_PKEY; + +#ifndef OPENSSL_NO_EVP +typedef struct X509_info_st { + X509* x509; + X509_CRL* crl; + X509_PKEY* x_pkey; + EVP_CIPHER_INFO enc_cipher; + int enc_len; + char* enc_data; + int references; +} X509_INFO; + +DECLARE_STACK_OF(X509_INFO) +#endif + +/* + * The next 2 structures and their 8 routines were sent to me by Pat Richard + * and are used to manipulate Netscapes spki structures - + * useful if you are writing a CA web page + */ +typedef struct Netscape_spkac_st { + X509_PUBKEY* pubkey; + ASN1_IA5STRING* challenge; /* challenge sent in atlas >= PR2 */ +} NETSCAPE_SPKAC; + +typedef struct Netscape_spki_st { + NETSCAPE_SPKAC* spkac; /* signed public key and challenge */ + X509_ALGOR* sig_algor; + ASN1_BIT_STRING* signature; +} NETSCAPE_SPKI; + +/* Netscape certificate sequence structure */ +typedef struct Netscape_certificate_sequence { + ASN1_OBJECT* type; + STACK_OF(X509) * certs; +} NETSCAPE_CERT_SEQUENCE; + +/*- Unused (and iv length is wrong) +typedef struct CBCParameter_st + { + unsigned char iv[8]; + } CBC_PARAM; +*/ + +/* Password based encryption structure */ + +typedef struct PBEPARAM_st { + ASN1_OCTET_STRING* salt; + ASN1_INTEGER* iter; +} PBEPARAM; + +/* Password based encryption V2 structures */ + +typedef struct PBE2PARAM_st { + X509_ALGOR* keyfunc; + X509_ALGOR* encryption; +} PBE2PARAM; + +typedef struct PBKDF2PARAM_st { + /* Usually OCTET STRING but could be anything */ + ASN1_TYPE* salt; + ASN1_INTEGER* iter; + ASN1_INTEGER* keylength; + X509_ALGOR* prf; +} PBKDF2PARAM; + +/* PKCS#8 private key info structure */ + +struct pkcs8_priv_key_info_st { + /* Flag for various broken formats */ + int broken; +#define PKCS8_OK 0 +#define PKCS8_NO_OCTET 1 +#define PKCS8_EMBEDDED_PARAM 2 +#define PKCS8_NS_DB 3 +#define PKCS8_NEG_PRIVKEY 4 + ASN1_INTEGER* version; + X509_ALGOR* pkeyalg; + /* Should be OCTET STRING but some are broken */ + ASN1_TYPE* pkey; + STACK_OF(X509_ATTRIBUTE) * attributes; +}; + +#ifdef __cplusplus +} +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define X509_EXT_PACK_UNKNOWN 1 +#define X509_EXT_PACK_STRING 2 + +#define X509_get_version(x) ASN1_INTEGER_get((x)->cert_info->version) +/* #define X509_get_serialNumber(x) ((x)->cert_info->serialNumber) */ +#define X509_get_notBefore(x) ((x)->cert_info->validity->notBefore) +#define X509_get_notAfter(x) ((x)->cert_info->validity->notAfter) +#define X509_extract_key(x) X509_get_pubkey(x) /*****/ +#define X509_REQ_get_version(x) ASN1_INTEGER_get((x)->req_info->version) +#define X509_REQ_get_subject_name(x) ((x)->req_info->subject) +#define X509_REQ_extract_key(a) X509_REQ_get_pubkey(a) +#define X509_name_cmp(a, b) X509_NAME_cmp((a), (b)) +#define X509_get_signature_type(x) \ + EVP_PKEY_type(OBJ_obj2nid((x)->sig_alg->algorithm)) + +#define X509_CRL_get_version(x) ASN1_INTEGER_get((x)->crl->version) +#define X509_CRL_get_lastUpdate(x) ((x)->crl->lastUpdate) +#define X509_CRL_get_nextUpdate(x) ((x)->crl->nextUpdate) +#define X509_CRL_get_issuer(x) ((x)->crl->issuer) +#define X509_CRL_get_REVOKED(x) ((x)->crl->revoked) + +void X509_CRL_set_default_method(const X509_CRL_METHOD* meth); +X509_CRL_METHOD* X509_CRL_METHOD_new( + int (*crl_init)(X509_CRL* crl), + int (*crl_free)(X509_CRL* crl), + int (*crl_lookup)( + X509_CRL* crl, + X509_REVOKED** ret, + ASN1_INTEGER* ser, + X509_NAME* issuer), + int (*crl_verify)(X509_CRL* crl, EVP_PKEY* pk)); +void X509_CRL_METHOD_free(X509_CRL_METHOD* m); + +void X509_CRL_set_meth_data(X509_CRL* crl, void* dat); +void* X509_CRL_get_meth_data(X509_CRL* crl); + +/* + * This one is only used so that a binary form can output, as in + * i2d_X509_NAME(X509_get_X509_PUBKEY(x),&buf) + */ +#define X509_get_X509_PUBKEY(x) ((x)->cert_info->key) + +const char* X509_verify_cert_error_string(long n); + +#ifndef OPENSSL_NO_EVP +int X509_verify(X509* a, EVP_PKEY* r); + +int X509_REQ_verify(X509_REQ* a, EVP_PKEY* r); +int X509_CRL_verify(X509_CRL* a, EVP_PKEY* r); +int NETSCAPE_SPKI_verify(NETSCAPE_SPKI* a, EVP_PKEY* r); + +NETSCAPE_SPKI* NETSCAPE_SPKI_b64_decode(const char* str, int len); +char* NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI* x); +EVP_PKEY* NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI* x); +int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI* x, EVP_PKEY* pkey); + +int NETSCAPE_SPKI_print(BIO* out, NETSCAPE_SPKI* spki); + +int X509_signature_dump(BIO* bp, const ASN1_STRING* sig, int indent); +int X509_signature_print(BIO* bp, X509_ALGOR* alg, ASN1_STRING* sig); + +int X509_sign(X509* x, EVP_PKEY* pkey, const EVP_MD* md); +int X509_sign_ctx(X509* x, EVP_MD_CTX* ctx); +int X509_http_nbio(OCSP_REQ_CTX* rctx, X509** pcert); +int X509_REQ_sign(X509_REQ* x, EVP_PKEY* pkey, const EVP_MD* md); +int X509_REQ_sign_ctx(X509_REQ* x, EVP_MD_CTX* ctx); +int X509_CRL_sign(X509_CRL* x, EVP_PKEY* pkey, const EVP_MD* md); +int X509_CRL_sign_ctx(X509_CRL* x, EVP_MD_CTX* ctx); +int X509_CRL_http_nbio(OCSP_REQ_CTX* rctx, X509_CRL** pcrl); +int NETSCAPE_SPKI_sign(NETSCAPE_SPKI* x, EVP_PKEY* pkey, const EVP_MD* md); + +int X509_pubkey_digest( + const X509* data, + const EVP_MD* type, + unsigned char* md, + unsigned int* len); +int X509_digest( + const X509* data, + const EVP_MD* type, + unsigned char* md, + unsigned int* len); +int X509_CRL_digest( + const X509_CRL* data, + const EVP_MD* type, + unsigned char* md, + unsigned int* len); +int X509_REQ_digest( + const X509_REQ* data, + const EVP_MD* type, + unsigned char* md, + unsigned int* len); +int X509_NAME_digest( + const X509_NAME* data, + const EVP_MD* type, + unsigned char* md, + unsigned int* len); +#endif + +#ifndef OPENSSL_NO_FP_API +X509* d2i_X509_fp(FILE* fp, X509** x509); +int i2d_X509_fp(FILE* fp, X509* x509); +X509_CRL* d2i_X509_CRL_fp(FILE* fp, X509_CRL** crl); +int i2d_X509_CRL_fp(FILE* fp, X509_CRL* crl); +X509_REQ* d2i_X509_REQ_fp(FILE* fp, X509_REQ** req); +int i2d_X509_REQ_fp(FILE* fp, X509_REQ* req); +#ifndef OPENSSL_NO_RSA +RSA* d2i_RSAPrivateKey_fp(FILE* fp, RSA** rsa); +int i2d_RSAPrivateKey_fp(FILE* fp, RSA* rsa); +RSA* d2i_RSAPublicKey_fp(FILE* fp, RSA** rsa); +int i2d_RSAPublicKey_fp(FILE* fp, RSA* rsa); +RSA* d2i_RSA_PUBKEY_fp(FILE* fp, RSA** rsa); +int i2d_RSA_PUBKEY_fp(FILE* fp, RSA* rsa); +#endif +#ifndef OPENSSL_NO_DSA +DSA* d2i_DSA_PUBKEY_fp(FILE* fp, DSA** dsa); +int i2d_DSA_PUBKEY_fp(FILE* fp, DSA* dsa); +DSA* d2i_DSAPrivateKey_fp(FILE* fp, DSA** dsa); +int i2d_DSAPrivateKey_fp(FILE* fp, DSA* dsa); +#endif +#ifndef OPENSSL_NO_EC +EC_KEY* d2i_EC_PUBKEY_fp(FILE* fp, EC_KEY** eckey); +int i2d_EC_PUBKEY_fp(FILE* fp, EC_KEY* eckey); +EC_KEY* d2i_ECPrivateKey_fp(FILE* fp, EC_KEY** eckey); +int i2d_ECPrivateKey_fp(FILE* fp, EC_KEY* eckey); +#endif +X509_SIG* d2i_PKCS8_fp(FILE* fp, X509_SIG** p8); +int i2d_PKCS8_fp(FILE* fp, X509_SIG* p8); +PKCS8_PRIV_KEY_INFO* d2i_PKCS8_PRIV_KEY_INFO_fp( + FILE* fp, + PKCS8_PRIV_KEY_INFO** p8inf); +int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE* fp, PKCS8_PRIV_KEY_INFO* p8inf); +int i2d_PKCS8PrivateKeyInfo_fp(FILE* fp, EVP_PKEY* key); +int i2d_PrivateKey_fp(FILE* fp, EVP_PKEY* pkey); +EVP_PKEY* d2i_PrivateKey_fp(FILE* fp, EVP_PKEY** a); +int i2d_PUBKEY_fp(FILE* fp, EVP_PKEY* pkey); +EVP_PKEY* d2i_PUBKEY_fp(FILE* fp, EVP_PKEY** a); +#endif + +#ifndef OPENSSL_NO_BIO +X509* d2i_X509_bio(BIO* bp, X509** x509); +int i2d_X509_bio(BIO* bp, X509* x509); +X509_CRL* d2i_X509_CRL_bio(BIO* bp, X509_CRL** crl); +int i2d_X509_CRL_bio(BIO* bp, X509_CRL* crl); +X509_REQ* d2i_X509_REQ_bio(BIO* bp, X509_REQ** req); +int i2d_X509_REQ_bio(BIO* bp, X509_REQ* req); +#ifndef OPENSSL_NO_RSA +RSA* d2i_RSAPrivateKey_bio(BIO* bp, RSA** rsa); +int i2d_RSAPrivateKey_bio(BIO* bp, RSA* rsa); +RSA* d2i_RSAPublicKey_bio(BIO* bp, RSA** rsa); +int i2d_RSAPublicKey_bio(BIO* bp, RSA* rsa); +RSA* d2i_RSA_PUBKEY_bio(BIO* bp, RSA** rsa); +int i2d_RSA_PUBKEY_bio(BIO* bp, RSA* rsa); +#endif +#ifndef OPENSSL_NO_DSA +DSA* d2i_DSA_PUBKEY_bio(BIO* bp, DSA** dsa); +int i2d_DSA_PUBKEY_bio(BIO* bp, DSA* dsa); +DSA* d2i_DSAPrivateKey_bio(BIO* bp, DSA** dsa); +int i2d_DSAPrivateKey_bio(BIO* bp, DSA* dsa); +#endif +#ifndef OPENSSL_NO_EC +EC_KEY* d2i_EC_PUBKEY_bio(BIO* bp, EC_KEY** eckey); +int i2d_EC_PUBKEY_bio(BIO* bp, EC_KEY* eckey); +EC_KEY* d2i_ECPrivateKey_bio(BIO* bp, EC_KEY** eckey); +int i2d_ECPrivateKey_bio(BIO* bp, EC_KEY* eckey); +#endif +X509_SIG* d2i_PKCS8_bio(BIO* bp, X509_SIG** p8); +int i2d_PKCS8_bio(BIO* bp, X509_SIG* p8); +PKCS8_PRIV_KEY_INFO* d2i_PKCS8_PRIV_KEY_INFO_bio( + BIO* bp, + PKCS8_PRIV_KEY_INFO** p8inf); +int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO* bp, PKCS8_PRIV_KEY_INFO* p8inf); +int i2d_PKCS8PrivateKeyInfo_bio(BIO* bp, EVP_PKEY* key); +int i2d_PrivateKey_bio(BIO* bp, EVP_PKEY* pkey); +EVP_PKEY* d2i_PrivateKey_bio(BIO* bp, EVP_PKEY** a); +int i2d_PUBKEY_bio(BIO* bp, EVP_PKEY* pkey); +EVP_PKEY* d2i_PUBKEY_bio(BIO* bp, EVP_PKEY** a); +#endif + +X509* X509_dup(X509* x509); +X509_ATTRIBUTE* X509_ATTRIBUTE_dup(X509_ATTRIBUTE* xa); +X509_EXTENSION* X509_EXTENSION_dup(X509_EXTENSION* ex); +X509_CRL* X509_CRL_dup(X509_CRL* crl); +X509_REVOKED* X509_REVOKED_dup(X509_REVOKED* rev); +X509_REQ* X509_REQ_dup(X509_REQ* req); +X509_ALGOR* X509_ALGOR_dup(X509_ALGOR* xn); +int X509_ALGOR_set0(X509_ALGOR* alg, ASN1_OBJECT* aobj, int ptype, void* pval); +void X509_ALGOR_get0( + ASN1_OBJECT** paobj, + int* pptype, + void** ppval, + X509_ALGOR* algor); +void X509_ALGOR_set_md(X509_ALGOR* alg, const EVP_MD* md); +int X509_ALGOR_cmp(const X509_ALGOR* a, const X509_ALGOR* b); + +X509_NAME* X509_NAME_dup(X509_NAME* xn); +X509_NAME_ENTRY* X509_NAME_ENTRY_dup(X509_NAME_ENTRY* ne); + +int X509_cmp_time(const ASN1_TIME* s, time_t* t); +int X509_cmp_current_time(const ASN1_TIME* s); +ASN1_TIME* X509_time_adj(ASN1_TIME* s, long adj, time_t* t); +ASN1_TIME* +X509_time_adj_ex(ASN1_TIME* s, int offset_day, long offset_sec, time_t* t); +ASN1_TIME* X509_gmtime_adj(ASN1_TIME* s, long adj); + +const char* X509_get_default_cert_area(void); +const char* X509_get_default_cert_dir(void); +const char* X509_get_default_cert_file(void); +const char* X509_get_default_cert_dir_env(void); +const char* X509_get_default_cert_file_env(void); +const char* X509_get_default_private_dir(void); + +X509_REQ* X509_to_X509_REQ(X509* x, EVP_PKEY* pkey, const EVP_MD* md); +X509* X509_REQ_to_X509(X509_REQ* r, int days, EVP_PKEY* pkey); + +DECLARE_ASN1_FUNCTIONS(X509_ALGOR) +DECLARE_ASN1_ENCODE_FUNCTIONS(X509_ALGORS, X509_ALGORS, X509_ALGORS) +DECLARE_ASN1_FUNCTIONS(X509_VAL) + +DECLARE_ASN1_FUNCTIONS(X509_PUBKEY) + +int X509_PUBKEY_set(X509_PUBKEY** x, EVP_PKEY* pkey); +EVP_PKEY* X509_PUBKEY_get(X509_PUBKEY* key); +int X509_get_pubkey_parameters(EVP_PKEY* pkey, STACK_OF(X509) * chain); +int i2d_PUBKEY(EVP_PKEY* a, unsigned char** pp); +EVP_PKEY* d2i_PUBKEY(EVP_PKEY** a, const unsigned char** pp, long length); +#ifndef OPENSSL_NO_RSA +int i2d_RSA_PUBKEY(RSA* a, unsigned char** pp); +RSA* d2i_RSA_PUBKEY(RSA** a, const unsigned char** pp, long length); +#endif +#ifndef OPENSSL_NO_DSA +int i2d_DSA_PUBKEY(DSA* a, unsigned char** pp); +DSA* d2i_DSA_PUBKEY(DSA** a, const unsigned char** pp, long length); +#endif +#ifndef OPENSSL_NO_EC +int i2d_EC_PUBKEY(EC_KEY* a, unsigned char** pp); +EC_KEY* d2i_EC_PUBKEY(EC_KEY** a, const unsigned char** pp, long length); +#endif + +DECLARE_ASN1_FUNCTIONS(X509_SIG) +DECLARE_ASN1_FUNCTIONS(X509_REQ_INFO) +DECLARE_ASN1_FUNCTIONS(X509_REQ) + +DECLARE_ASN1_FUNCTIONS(X509_ATTRIBUTE) +X509_ATTRIBUTE* X509_ATTRIBUTE_create(int nid, int atrtype, void* value); + +DECLARE_ASN1_FUNCTIONS(X509_EXTENSION) +DECLARE_ASN1_ENCODE_FUNCTIONS(X509_EXTENSIONS, X509_EXTENSIONS, X509_EXTENSIONS) + +DECLARE_ASN1_FUNCTIONS(X509_NAME_ENTRY) + +DECLARE_ASN1_FUNCTIONS(X509_NAME) + +int X509_NAME_set(X509_NAME** xn, X509_NAME* name); + +DECLARE_ASN1_FUNCTIONS(X509_CINF) + +DECLARE_ASN1_FUNCTIONS(X509) +DECLARE_ASN1_FUNCTIONS(X509_CERT_AUX) + +DECLARE_ASN1_FUNCTIONS(X509_CERT_PAIR) + +int X509_get_ex_new_index( + long argl, + void* argp, + CRYPTO_EX_new* new_func, + CRYPTO_EX_dup* dup_func, + CRYPTO_EX_free* free_func); +int X509_set_ex_data(X509* r, int idx, void* arg); +void* X509_get_ex_data(X509* r, int idx); +int i2d_X509_AUX(X509* a, unsigned char** pp); +X509* d2i_X509_AUX(X509** a, const unsigned char** pp, long length); + +int i2d_re_X509_tbs(X509* x, unsigned char** pp); + +void X509_get0_signature( + ASN1_BIT_STRING** psig, + X509_ALGOR** palg, + const X509* x); +int X509_get_signature_nid(const X509* x); + +int X509_alias_set1(X509* x, unsigned char* name, int len); +int X509_keyid_set1(X509* x, unsigned char* id, int len); +unsigned char* X509_alias_get0(X509* x, int* len); +unsigned char* X509_keyid_get0(X509* x, int* len); +int (*X509_TRUST_set_default(int (*trust)(int, X509*, int)))(int, X509*, int); +int X509_TRUST_set(int* t, int trust); +int X509_add1_trust_object(X509* x, ASN1_OBJECT* obj); +int X509_add1_reject_object(X509* x, ASN1_OBJECT* obj); +void X509_trust_clear(X509* x); +void X509_reject_clear(X509* x); + +DECLARE_ASN1_FUNCTIONS(X509_REVOKED) +DECLARE_ASN1_FUNCTIONS(X509_CRL_INFO) +DECLARE_ASN1_FUNCTIONS(X509_CRL) + +int X509_CRL_add0_revoked(X509_CRL* crl, X509_REVOKED* rev); +int X509_CRL_get0_by_serial( + X509_CRL* crl, + X509_REVOKED** ret, + ASN1_INTEGER* serial); +int X509_CRL_get0_by_cert(X509_CRL* crl, X509_REVOKED** ret, X509* x); + +X509_PKEY* X509_PKEY_new(void); +void X509_PKEY_free(X509_PKEY* a); +int i2d_X509_PKEY(X509_PKEY* a, unsigned char** pp); +X509_PKEY* d2i_X509_PKEY(X509_PKEY** a, const unsigned char** pp, long length); + +DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI) +DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC) +DECLARE_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE) + +#ifndef OPENSSL_NO_EVP +X509_INFO* X509_INFO_new(void); +void X509_INFO_free(X509_INFO* a); +char* X509_NAME_oneline(X509_NAME* a, char* buf, int size); + +int ASN1_verify( + i2d_of_void* i2d, + X509_ALGOR* algor1, + ASN1_BIT_STRING* signature, + char* data, + EVP_PKEY* pkey); + +int ASN1_digest( + i2d_of_void* i2d, + const EVP_MD* type, + char* data, + unsigned char* md, + unsigned int* len); + +int ASN1_sign( + i2d_of_void* i2d, + X509_ALGOR* algor1, + X509_ALGOR* algor2, + ASN1_BIT_STRING* signature, + char* data, + EVP_PKEY* pkey, + const EVP_MD* type); + +int ASN1_item_digest( + const ASN1_ITEM* it, + const EVP_MD* type, + void* data, + unsigned char* md, + unsigned int* len); + +int ASN1_item_verify( + const ASN1_ITEM* it, + X509_ALGOR* algor1, + ASN1_BIT_STRING* signature, + void* data, + EVP_PKEY* pkey); + +int ASN1_item_sign( + const ASN1_ITEM* it, + X509_ALGOR* algor1, + X509_ALGOR* algor2, + ASN1_BIT_STRING* signature, + void* data, + EVP_PKEY* pkey, + const EVP_MD* type); +int ASN1_item_sign_ctx( + const ASN1_ITEM* it, + X509_ALGOR* algor1, + X509_ALGOR* algor2, + ASN1_BIT_STRING* signature, + void* asn, + EVP_MD_CTX* ctx); +#endif + +int X509_set_version(X509* x, long version); +int X509_set_serialNumber(X509* x, ASN1_INTEGER* serial); +ASN1_INTEGER* X509_get_serialNumber(X509* x); +int X509_set_issuer_name(X509* x, X509_NAME* name); +X509_NAME* X509_get_issuer_name(X509* a); +int X509_set_subject_name(X509* x, X509_NAME* name); +X509_NAME* X509_get_subject_name(X509* a); +int X509_set_notBefore(X509* x, const ASN1_TIME* tm); +int X509_set_notAfter(X509* x, const ASN1_TIME* tm); +int X509_set_pubkey(X509* x, EVP_PKEY* pkey); +EVP_PKEY* X509_get_pubkey(X509* x); +ASN1_BIT_STRING* X509_get0_pubkey_bitstr(const X509* x); +int X509_certificate_type(X509* x, EVP_PKEY* pubkey /* optional */); + +int X509_REQ_set_version(X509_REQ* x, long version); +int X509_REQ_set_subject_name(X509_REQ* req, X509_NAME* name); +int X509_REQ_set_pubkey(X509_REQ* x, EVP_PKEY* pkey); +EVP_PKEY* X509_REQ_get_pubkey(X509_REQ* req); +int X509_REQ_extension_nid(int nid); +int* X509_REQ_get_extension_nids(void); +void X509_REQ_set_extension_nids(int* nids); +STACK_OF(X509_EXTENSION) * X509_REQ_get_extensions(X509_REQ* req); +int X509_REQ_add_extensions_nid( + X509_REQ* req, + STACK_OF(X509_EXTENSION) * exts, + int nid); +int X509_REQ_add_extensions(X509_REQ* req, STACK_OF(X509_EXTENSION) * exts); +int X509_REQ_get_attr_count(const X509_REQ* req); +int X509_REQ_get_attr_by_NID(const X509_REQ* req, int nid, int lastpos); +int X509_REQ_get_attr_by_OBJ( + const X509_REQ* req, + ASN1_OBJECT* obj, + int lastpos); +X509_ATTRIBUTE* X509_REQ_get_attr(const X509_REQ* req, int loc); +X509_ATTRIBUTE* X509_REQ_delete_attr(X509_REQ* req, int loc); +int X509_REQ_add1_attr(X509_REQ* req, X509_ATTRIBUTE* attr); +int X509_REQ_add1_attr_by_OBJ( + X509_REQ* req, + const ASN1_OBJECT* obj, + int type, + const unsigned char* bytes, + int len); +int X509_REQ_add1_attr_by_NID( + X509_REQ* req, + int nid, + int type, + const unsigned char* bytes, + int len); +int X509_REQ_add1_attr_by_txt( + X509_REQ* req, + const char* attrname, + int type, + const unsigned char* bytes, + int len); + +int X509_CRL_set_version(X509_CRL* x, long version); +int X509_CRL_set_issuer_name(X509_CRL* x, X509_NAME* name); +int X509_CRL_set_lastUpdate(X509_CRL* x, const ASN1_TIME* tm); +int X509_CRL_set_nextUpdate(X509_CRL* x, const ASN1_TIME* tm); +int X509_CRL_sort(X509_CRL* crl); + +int X509_REVOKED_set_serialNumber(X509_REVOKED* x, ASN1_INTEGER* serial); +int X509_REVOKED_set_revocationDate(X509_REVOKED* r, ASN1_TIME* tm); + +X509_CRL* X509_CRL_diff( + X509_CRL* base, + X509_CRL* newer, + EVP_PKEY* skey, + const EVP_MD* md, + unsigned int flags); + +int X509_REQ_check_private_key(X509_REQ* x509, EVP_PKEY* pkey); + +int X509_check_private_key(X509* x509, EVP_PKEY* pkey); +int X509_chain_check_suiteb( + int* perror_depth, + X509* x, + STACK_OF(X509) * chain, + unsigned long flags); +int X509_CRL_check_suiteb(X509_CRL* crl, EVP_PKEY* pk, unsigned long flags); +STACK_OF(X509) * X509_chain_up_ref(STACK_OF(X509) * chain); + +int X509_issuer_and_serial_cmp(const X509* a, const X509* b); +unsigned long X509_issuer_and_serial_hash(X509* a); + +int X509_issuer_name_cmp(const X509* a, const X509* b); +unsigned long X509_issuer_name_hash(X509* a); + +int X509_subject_name_cmp(const X509* a, const X509* b); +unsigned long X509_subject_name_hash(X509* x); + +#ifndef OPENSSL_NO_MD5 +unsigned long X509_issuer_name_hash_old(X509* a); +unsigned long X509_subject_name_hash_old(X509* x); +#endif + +int X509_cmp(const X509* a, const X509* b); +int X509_NAME_cmp(const X509_NAME* a, const X509_NAME* b); +unsigned long X509_NAME_hash(X509_NAME* x); +unsigned long X509_NAME_hash_old(X509_NAME* x); + +int X509_CRL_cmp(const X509_CRL* a, const X509_CRL* b); +int X509_CRL_match(const X509_CRL* a, const X509_CRL* b); +#ifndef OPENSSL_NO_FP_API +int X509_print_ex_fp( + FILE* bp, + X509* x, + unsigned long nmflag, + unsigned long cflag); +int X509_print_fp(FILE* bp, X509* x); +int X509_CRL_print_fp(FILE* bp, X509_CRL* x); +int X509_REQ_print_fp(FILE* bp, X509_REQ* req); +int X509_NAME_print_ex_fp( + FILE* fp, + X509_NAME* nm, + int indent, + unsigned long flags); +#endif + +#ifndef OPENSSL_NO_BIO +int X509_NAME_print(BIO* bp, X509_NAME* name, int obase); +int X509_NAME_print_ex( + BIO* out, + X509_NAME* nm, + int indent, + unsigned long flags); +int X509_print_ex(BIO* bp, X509* x, unsigned long nmflag, unsigned long cflag); +int X509_print(BIO* bp, X509* x); +int X509_ocspid_print(BIO* bp, X509* x); +int X509_CERT_AUX_print(BIO* bp, X509_CERT_AUX* x, int indent); +int X509_CRL_print(BIO* bp, X509_CRL* x); +int X509_REQ_print_ex( + BIO* bp, + X509_REQ* x, + unsigned long nmflag, + unsigned long cflag); +int X509_REQ_print(BIO* bp, X509_REQ* req); +#endif + +int X509_NAME_entry_count(X509_NAME* name); +int X509_NAME_get_text_by_NID(X509_NAME* name, int nid, char* buf, int len); +int X509_NAME_get_text_by_OBJ( + X509_NAME* name, + ASN1_OBJECT* obj, + char* buf, + int len); + +/* + * NOTE: you should be passsing -1, not 0 as lastpos. The functions that use + * lastpos, search after that position on. + */ +int X509_NAME_get_index_by_NID(X509_NAME* name, int nid, int lastpos); +int X509_NAME_get_index_by_OBJ(X509_NAME* name, ASN1_OBJECT* obj, int lastpos); +X509_NAME_ENTRY* X509_NAME_get_entry(X509_NAME* name, int loc); +X509_NAME_ENTRY* X509_NAME_delete_entry(X509_NAME* name, int loc); +int X509_NAME_add_entry(X509_NAME* name, X509_NAME_ENTRY* ne, int loc, int set); +int X509_NAME_add_entry_by_OBJ( + X509_NAME* name, + ASN1_OBJECT* obj, + int type, + unsigned char* bytes, + int len, + int loc, + int set); +int X509_NAME_add_entry_by_NID( + X509_NAME* name, + int nid, + int type, + unsigned char* bytes, + int len, + int loc, + int set); +X509_NAME_ENTRY* X509_NAME_ENTRY_create_by_txt( + X509_NAME_ENTRY** ne, + const char* field, + int type, + const unsigned char* bytes, + int len); +X509_NAME_ENTRY* X509_NAME_ENTRY_create_by_NID( + X509_NAME_ENTRY** ne, + int nid, + int type, + unsigned char* bytes, + int len); +int X509_NAME_add_entry_by_txt( + X509_NAME* name, + const char* field, + int type, + const unsigned char* bytes, + int len, + int loc, + int set); +X509_NAME_ENTRY* X509_NAME_ENTRY_create_by_OBJ( + X509_NAME_ENTRY** ne, + ASN1_OBJECT* obj, + int type, + const unsigned char* bytes, + int len); +int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY* ne, ASN1_OBJECT* obj); +int X509_NAME_ENTRY_set_data( + X509_NAME_ENTRY* ne, + int type, + const unsigned char* bytes, + int len); +ASN1_OBJECT* X509_NAME_ENTRY_get_object(X509_NAME_ENTRY* ne); +ASN1_STRING* X509_NAME_ENTRY_get_data(X509_NAME_ENTRY* ne); + +int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) * x); +int X509v3_get_ext_by_NID( + const STACK_OF(X509_EXTENSION) * x, + int nid, + int lastpos); +int X509v3_get_ext_by_OBJ( + const STACK_OF(X509_EXTENSION) * x, + ASN1_OBJECT* obj, + int lastpos); +int X509v3_get_ext_by_critical( + const STACK_OF(X509_EXTENSION) * x, + int crit, + int lastpos); +X509_EXTENSION* X509v3_get_ext(const STACK_OF(X509_EXTENSION) * x, int loc); +X509_EXTENSION* X509v3_delete_ext(STACK_OF(X509_EXTENSION) * x, int loc); +STACK_OF(X509_EXTENSION) * + X509v3_add_ext(STACK_OF(X509_EXTENSION) * *x, X509_EXTENSION* ex, int loc); + +int X509_get_ext_count(X509* x); +int X509_get_ext_by_NID(X509* x, int nid, int lastpos); +int X509_get_ext_by_OBJ(X509* x, ASN1_OBJECT* obj, int lastpos); +int X509_get_ext_by_critical(X509* x, int crit, int lastpos); +X509_EXTENSION* X509_get_ext(X509* x, int loc); +X509_EXTENSION* X509_delete_ext(X509* x, int loc); +int X509_add_ext(X509* x, X509_EXTENSION* ex, int loc); +void* X509_get_ext_d2i(X509* x, int nid, int* crit, int* idx); +int X509_add1_ext_i2d( + X509* x, + int nid, + void* value, + int crit, + unsigned long flags); + +int X509_CRL_get_ext_count(X509_CRL* x); +int X509_CRL_get_ext_by_NID(X509_CRL* x, int nid, int lastpos); +int X509_CRL_get_ext_by_OBJ(X509_CRL* x, ASN1_OBJECT* obj, int lastpos); +int X509_CRL_get_ext_by_critical(X509_CRL* x, int crit, int lastpos); +X509_EXTENSION* X509_CRL_get_ext(X509_CRL* x, int loc); +X509_EXTENSION* X509_CRL_delete_ext(X509_CRL* x, int loc); +int X509_CRL_add_ext(X509_CRL* x, X509_EXTENSION* ex, int loc); +void* X509_CRL_get_ext_d2i(X509_CRL* x, int nid, int* crit, int* idx); +int X509_CRL_add1_ext_i2d( + X509_CRL* x, + int nid, + void* value, + int crit, + unsigned long flags); + +int X509_REVOKED_get_ext_count(X509_REVOKED* x); +int X509_REVOKED_get_ext_by_NID(X509_REVOKED* x, int nid, int lastpos); +int X509_REVOKED_get_ext_by_OBJ(X509_REVOKED* x, ASN1_OBJECT* obj, int lastpos); +int X509_REVOKED_get_ext_by_critical(X509_REVOKED* x, int crit, int lastpos); +X509_EXTENSION* X509_REVOKED_get_ext(X509_REVOKED* x, int loc); +X509_EXTENSION* X509_REVOKED_delete_ext(X509_REVOKED* x, int loc); +int X509_REVOKED_add_ext(X509_REVOKED* x, X509_EXTENSION* ex, int loc); +void* X509_REVOKED_get_ext_d2i(X509_REVOKED* x, int nid, int* crit, int* idx); +int X509_REVOKED_add1_ext_i2d( + X509_REVOKED* x, + int nid, + void* value, + int crit, + unsigned long flags); + +X509_EXTENSION* X509_EXTENSION_create_by_NID( + X509_EXTENSION** ex, + int nid, + int crit, + ASN1_OCTET_STRING* data); +X509_EXTENSION* X509_EXTENSION_create_by_OBJ( + X509_EXTENSION** ex, + ASN1_OBJECT* obj, + int crit, + ASN1_OCTET_STRING* data); +int X509_EXTENSION_set_object(X509_EXTENSION* ex, ASN1_OBJECT* obj); +int X509_EXTENSION_set_critical(X509_EXTENSION* ex, int crit); +int X509_EXTENSION_set_data(X509_EXTENSION* ex, ASN1_OCTET_STRING* data); +ASN1_OBJECT* X509_EXTENSION_get_object(X509_EXTENSION* ex); +ASN1_OCTET_STRING* X509_EXTENSION_get_data(X509_EXTENSION* ne); +int X509_EXTENSION_get_critical(X509_EXTENSION* ex); + +int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) * x); +int X509at_get_attr_by_NID( + const STACK_OF(X509_ATTRIBUTE) * x, + int nid, + int lastpos); +int X509at_get_attr_by_OBJ( + const STACK_OF(X509_ATTRIBUTE) * sk, + ASN1_OBJECT* obj, + int lastpos); +X509_ATTRIBUTE* X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) * x, int loc); +X509_ATTRIBUTE* X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) * x, int loc); +STACK_OF(X509_ATTRIBUTE) * + X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) * *x, X509_ATTRIBUTE* attr); +STACK_OF(X509_ATTRIBUTE) * X509at_add1_attr_by_OBJ( + STACK_OF(X509_ATTRIBUTE) * *x, + const ASN1_OBJECT* obj, + int type, + const unsigned char* bytes, + int len); +STACK_OF(X509_ATTRIBUTE) * X509at_add1_attr_by_NID( + STACK_OF(X509_ATTRIBUTE) * *x, + int nid, + int type, + const unsigned char* bytes, + int len); +STACK_OF(X509_ATTRIBUTE) * X509at_add1_attr_by_txt( + STACK_OF(X509_ATTRIBUTE) * *x, + const char* attrname, + int type, + const unsigned char* bytes, + int len); +void* X509at_get0_data_by_OBJ( + STACK_OF(X509_ATTRIBUTE) * x, + ASN1_OBJECT* obj, + int lastpos, + int type); +X509_ATTRIBUTE* X509_ATTRIBUTE_create_by_NID( + X509_ATTRIBUTE** attr, + int nid, + int atrtype, + const void* data, + int len); +X509_ATTRIBUTE* X509_ATTRIBUTE_create_by_OBJ( + X509_ATTRIBUTE** attr, + const ASN1_OBJECT* obj, + int atrtype, + const void* data, + int len); +X509_ATTRIBUTE* X509_ATTRIBUTE_create_by_txt( + X509_ATTRIBUTE** attr, + const char* atrname, + int type, + const unsigned char* bytes, + int len); +int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE* attr, const ASN1_OBJECT* obj); +int X509_ATTRIBUTE_set1_data( + X509_ATTRIBUTE* attr, + int attrtype, + const void* data, + int len); +void* X509_ATTRIBUTE_get0_data( + X509_ATTRIBUTE* attr, + int idx, + int atrtype, + void* data); +int X509_ATTRIBUTE_count(X509_ATTRIBUTE* attr); +ASN1_OBJECT* X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE* attr); +ASN1_TYPE* X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE* attr, int idx); + +int EVP_PKEY_get_attr_count(const EVP_PKEY* key); +int EVP_PKEY_get_attr_by_NID(const EVP_PKEY* key, int nid, int lastpos); +int EVP_PKEY_get_attr_by_OBJ( + const EVP_PKEY* key, + ASN1_OBJECT* obj, + int lastpos); +X509_ATTRIBUTE* EVP_PKEY_get_attr(const EVP_PKEY* key, int loc); +X509_ATTRIBUTE* EVP_PKEY_delete_attr(EVP_PKEY* key, int loc); +int EVP_PKEY_add1_attr(EVP_PKEY* key, X509_ATTRIBUTE* attr); +int EVP_PKEY_add1_attr_by_OBJ( + EVP_PKEY* key, + const ASN1_OBJECT* obj, + int type, + const unsigned char* bytes, + int len); +int EVP_PKEY_add1_attr_by_NID( + EVP_PKEY* key, + int nid, + int type, + const unsigned char* bytes, + int len); +int EVP_PKEY_add1_attr_by_txt( + EVP_PKEY* key, + const char* attrname, + int type, + const unsigned char* bytes, + int len); + +int X509_verify_cert(X509_STORE_CTX* ctx); + +/* lookup a cert from a X509 STACK */ +X509* X509_find_by_issuer_and_serial( + STACK_OF(X509) * sk, + X509_NAME* name, + ASN1_INTEGER* serial); +X509* X509_find_by_subject(STACK_OF(X509) * sk, X509_NAME* name); + +DECLARE_ASN1_FUNCTIONS(PBEPARAM) +DECLARE_ASN1_FUNCTIONS(PBE2PARAM) +DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM) + +int PKCS5_pbe_set0_algor( + X509_ALGOR* algor, + int alg, + int iter, + const unsigned char* salt, + int saltlen); + +X509_ALGOR* +PKCS5_pbe_set(int alg, int iter, const unsigned char* salt, int saltlen); +X509_ALGOR* PKCS5_pbe2_set( + const EVP_CIPHER* cipher, + int iter, + unsigned char* salt, + int saltlen); +X509_ALGOR* PKCS5_pbe2_set_iv( + const EVP_CIPHER* cipher, + int iter, + unsigned char* salt, + int saltlen, + unsigned char* aiv, + int prf_nid); + +X509_ALGOR* PKCS5_pbkdf2_set( + int iter, + unsigned char* salt, + int saltlen, + int prf_nid, + int keylen); + +/* PKCS#8 utilities */ + +DECLARE_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO) + +EVP_PKEY* EVP_PKCS82PKEY(PKCS8_PRIV_KEY_INFO* p8); +PKCS8_PRIV_KEY_INFO* EVP_PKEY2PKCS8(EVP_PKEY* pkey); +PKCS8_PRIV_KEY_INFO* EVP_PKEY2PKCS8_broken(EVP_PKEY* pkey, int broken); +PKCS8_PRIV_KEY_INFO* PKCS8_set_broken(PKCS8_PRIV_KEY_INFO* p8, int broken); + +int PKCS8_pkey_set0( + PKCS8_PRIV_KEY_INFO* priv, + ASN1_OBJECT* aobj, + int version, + int ptype, + void* pval, + unsigned char* penc, + int penclen); +int PKCS8_pkey_get0( + ASN1_OBJECT** ppkalg, + const unsigned char** pk, + int* ppklen, + X509_ALGOR** pa, + PKCS8_PRIV_KEY_INFO* p8); + +int X509_PUBKEY_set0_param( + X509_PUBKEY* pub, + ASN1_OBJECT* aobj, + int ptype, + void* pval, + unsigned char* penc, + int penclen); +int X509_PUBKEY_get0_param( + ASN1_OBJECT** ppkalg, + const unsigned char** pk, + int* ppklen, + X509_ALGOR** pa, + X509_PUBKEY* pub); + +int X509_check_trust(X509* x, int id, int flags); +int X509_TRUST_get_count(void); +X509_TRUST* X509_TRUST_get0(int idx); +int X509_TRUST_get_by_id(int id); +int X509_TRUST_add( + int id, + int flags, + int (*ck)(X509_TRUST*, X509*, int), + char* name, + int arg1, + void* arg2); +void X509_TRUST_cleanup(void); +int X509_TRUST_get_flags(X509_TRUST* xp); +char* X509_TRUST_get0_name(X509_TRUST* xp); +int X509_TRUST_get_trust(X509_TRUST* xp); + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ + +void ERR_load_X509_strings(void); + +/* Error codes for the X509 functions. */ + +/* Function codes. */ +#define X509_F_ADD_CERT_DIR 100 +#define X509_F_BY_FILE_CTRL 101 +#define X509_F_CHECK_NAME_CONSTRAINTS 106 +#define X509_F_CHECK_POLICY 145 +#define X509_F_DIR_CTRL 102 +#define X509_F_GET_CERT_BY_SUBJECT 103 +#define X509_F_NETSCAPE_SPKI_B64_DECODE 129 +#define X509_F_NETSCAPE_SPKI_B64_ENCODE 130 +#define X509_F_X509AT_ADD1_ATTR 135 +#define X509_F_X509V3_ADD_EXT 104 +#define X509_F_X509_ATTRIBUTE_CREATE_BY_NID 136 +#define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ 137 +#define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT 140 +#define X509_F_X509_ATTRIBUTE_GET0_DATA 139 +#define X509_F_X509_ATTRIBUTE_SET1_DATA 138 +#define X509_F_X509_CHECK_PRIVATE_KEY 128 +#define X509_F_X509_CRL_DIFF 105 +#define X509_F_X509_CRL_PRINT_FP 147 +#define X509_F_X509_EXTENSION_CREATE_BY_NID 108 +#define X509_F_X509_EXTENSION_CREATE_BY_OBJ 109 +#define X509_F_X509_GET_PUBKEY_PARAMETERS 110 +#define X509_F_X509_LOAD_CERT_CRL_FILE 132 +#define X509_F_X509_LOAD_CERT_FILE 111 +#define X509_F_X509_LOAD_CRL_FILE 112 +#define X509_F_X509_NAME_ADD_ENTRY 113 +#define X509_F_X509_NAME_ENTRY_CREATE_BY_NID 114 +#define X509_F_X509_NAME_ENTRY_CREATE_BY_TXT 131 +#define X509_F_X509_NAME_ENTRY_SET_OBJECT 115 +#define X509_F_X509_NAME_ONELINE 116 +#define X509_F_X509_NAME_PRINT 117 +#define X509_F_X509_PRINT_EX_FP 118 +#define X509_F_X509_PUBKEY_GET 119 +#define X509_F_X509_PUBKEY_SET 120 +#define X509_F_X509_REQ_CHECK_PRIVATE_KEY 144 +#define X509_F_X509_REQ_PRINT_EX 121 +#define X509_F_X509_REQ_PRINT_FP 122 +#define X509_F_X509_REQ_TO_X509 123 +#define X509_F_X509_STORE_ADD_CERT 124 +#define X509_F_X509_STORE_ADD_CRL 125 +#define X509_F_X509_STORE_CTX_GET1_ISSUER 146 +#define X509_F_X509_STORE_CTX_INIT 143 +#define X509_F_X509_STORE_CTX_NEW 142 +#define X509_F_X509_STORE_CTX_PURPOSE_INHERIT 134 +#define X509_F_X509_TO_X509_REQ 126 +#define X509_F_X509_TRUST_ADD 133 +#define X509_F_X509_TRUST_SET 141 +#define X509_F_X509_VERIFY_CERT 127 + +/* Reason codes. */ +#define X509_R_AKID_MISMATCH 110 +#define X509_R_BAD_X509_FILETYPE 100 +#define X509_R_BASE64_DECODE_ERROR 118 +#define X509_R_CANT_CHECK_DH_KEY 114 +#define X509_R_CERT_ALREADY_IN_HASH_TABLE 101 +#define X509_R_CRL_ALREADY_DELTA 127 +#define X509_R_CRL_VERIFY_FAILURE 131 +#define X509_R_ERR_ASN1_LIB 102 +#define X509_R_IDP_MISMATCH 128 +#define X509_R_INVALID_DIRECTORY 113 +#define X509_R_INVALID_FIELD_NAME 119 +#define X509_R_INVALID_TRUST 123 +#define X509_R_ISSUER_MISMATCH 129 +#define X509_R_KEY_TYPE_MISMATCH 115 +#define X509_R_KEY_VALUES_MISMATCH 116 +#define X509_R_LOADING_CERT_DIR 103 +#define X509_R_LOADING_DEFAULTS 104 +#define X509_R_METHOD_NOT_SUPPORTED 124 +#define X509_R_NAME_TOO_LONG 134 +#define X509_R_NEWER_CRL_NOT_NEWER 132 +#define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 105 +#define X509_R_NO_CRL_NUMBER 130 +#define X509_R_PUBLIC_KEY_DECODE_ERROR 125 +#define X509_R_PUBLIC_KEY_ENCODE_ERROR 126 +#define X509_R_SHOULD_RETRY 106 +#define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN 107 +#define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 108 +#define X509_R_UNKNOWN_KEY_TYPE 117 +#define X509_R_UNKNOWN_NID 109 +#define X509_R_UNKNOWN_PURPOSE_ID 121 +#define X509_R_UNKNOWN_TRUST_ID 120 +#define X509_R_UNSUPPORTED_ALGORITHM 111 +#define X509_R_WRONG_LOOKUP_TYPE 112 +#define X509_R_WRONG_TYPE 122 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/x509_vfy.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/x509_vfy.h new file mode 100644 index 0000000..c0dde7c --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/x509_vfy.h @@ -0,0 +1,719 @@ +/* crypto/x509/x509_vfy.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_X509_H +#include +/* + * openssl/x509.h ends up #include-ing this file at about the only + * appropriate moment. + */ +#endif + +#ifndef HEADER_X509_VFY_H +#define HEADER_X509_VFY_H + +#include +#ifndef OPENSSL_NO_LHASH +#include +#endif +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#if 0 +/* Outer object */ +typedef struct x509_hash_dir_st { + int num_dirs; + char **dirs; + int *dirs_type; + int num_dirs_alloced; +} X509_HASH_DIR_CTX; +#endif + +typedef struct x509_file_st { + int num_paths; /* number of paths to files or directories */ + int num_alloced; + char** paths; /* the list of paths or directories */ + int* path_type; +} X509_CERT_FILE_CTX; + +/*******************************/ +/*- +SSL_CTX -> X509_STORE + -> X509_LOOKUP + ->X509_LOOKUP_METHOD + -> X509_LOOKUP + ->X509_LOOKUP_METHOD + +SSL -> X509_STORE_CTX + ->X509_STORE + +The X509_STORE holds the tables etc for verification stuff. +A X509_STORE_CTX is used while validating a single certificate. +The X509_STORE has X509_LOOKUPs for looking up certs. +The X509_STORE then calls a function to actually verify the +certificate chain. +*/ + +#define X509_LU_RETRY -1 +#define X509_LU_FAIL 0 +#define X509_LU_X509 1 +#define X509_LU_CRL 2 +#define X509_LU_PKEY 3 + +typedef struct x509_object_st { + /* one of the above types */ + int type; + union { + char* ptr; + X509* x509; + X509_CRL* crl; + EVP_PKEY* pkey; + } data; +} X509_OBJECT; + +typedef struct x509_lookup_st X509_LOOKUP; + +DECLARE_STACK_OF(X509_LOOKUP) +DECLARE_STACK_OF(X509_OBJECT) + +/* This is a static that defines the function interface */ +typedef struct x509_lookup_method_st { + const char* name; + int (*new_item)(X509_LOOKUP* ctx); + void (*free)(X509_LOOKUP* ctx); + int (*init)(X509_LOOKUP* ctx); + int (*shutdown)(X509_LOOKUP* ctx); + int (*ctrl)( + X509_LOOKUP* ctx, + int cmd, + const char* argc, + long argl, + char** ret); + int (*get_by_subject)( + X509_LOOKUP* ctx, + int type, + X509_NAME* name, + X509_OBJECT* ret); + int (*get_by_issuer_serial)( + X509_LOOKUP* ctx, + int type, + X509_NAME* name, + ASN1_INTEGER* serial, + X509_OBJECT* ret); + int (*get_by_fingerprint)( + X509_LOOKUP* ctx, + int type, + unsigned char* bytes, + int len, + X509_OBJECT* ret); + int (*get_by_alias)( + X509_LOOKUP* ctx, + int type, + char* str, + int len, + X509_OBJECT* ret); +} X509_LOOKUP_METHOD; + +typedef struct X509_VERIFY_PARAM_ID_st X509_VERIFY_PARAM_ID; + +/* + * This structure hold all parameters associated with a verify operation by + * including an X509_VERIFY_PARAM structure in related structures the + * parameters used can be customized + */ + +typedef struct X509_VERIFY_PARAM_st { + char* name; + time_t check_time; /* Time to use */ + unsigned long inh_flags; /* Inheritance flags */ + unsigned long flags; /* Various verify flags */ + int purpose; /* purpose to check untrusted certificates */ + int trust; /* trust setting to check */ + int depth; /* Verify depth */ + STACK_OF(ASN1_OBJECT) * policies; /* Permissible policies */ + X509_VERIFY_PARAM_ID* id; /* opaque ID data */ +} X509_VERIFY_PARAM; + +DECLARE_STACK_OF(X509_VERIFY_PARAM) + +/* + * This is used to hold everything. It is used for all certificate + * validation. Once we have a certificate chain, the 'verify' function is + * then called to actually check the cert chain. + */ +struct x509_store_st { + /* The following is a cache of trusted certs */ + int cache; /* if true, stash any hits */ + STACK_OF(X509_OBJECT) * objs; /* Cache of all objects */ + /* These are external lookup methods */ + STACK_OF(X509_LOOKUP) * get_cert_methods; + X509_VERIFY_PARAM* param; + /* Callbacks for various operations */ + /* called to verify a certificate */ + int (*verify)(X509_STORE_CTX* ctx); + /* error callback */ + int (*verify_cb)(int ok, X509_STORE_CTX* ctx); + /* get issuers cert from ctx */ + int (*get_issuer)(X509** issuer, X509_STORE_CTX* ctx, X509* x); + /* check issued */ + int (*check_issued)(X509_STORE_CTX* ctx, X509* x, X509* issuer); + /* Check revocation status of chain */ + int (*check_revocation)(X509_STORE_CTX* ctx); + /* retrieve CRL */ + int (*get_crl)(X509_STORE_CTX* ctx, X509_CRL** crl, X509* x); + /* Check CRL validity */ + int (*check_crl)(X509_STORE_CTX* ctx, X509_CRL* crl); + /* Check certificate against CRL */ + int (*cert_crl)(X509_STORE_CTX* ctx, X509_CRL* crl, X509* x); + STACK_OF(X509) * (*lookup_certs)(X509_STORE_CTX* ctx, X509_NAME* nm); + STACK_OF(X509_CRL) * (*lookup_crls)(X509_STORE_CTX* ctx, X509_NAME* nm); + int (*cleanup)(X509_STORE_CTX* ctx); + CRYPTO_EX_DATA ex_data; + int references; +} /* X509_STORE */; + +int X509_STORE_set_depth(X509_STORE* store, int depth); + +#define X509_STORE_set_verify_cb_func(ctx, func) ((ctx)->verify_cb = (func)) +#define X509_STORE_set_verify_func(ctx, func) ((ctx)->verify = (func)) + +/* This is the functions plus an instance of the local variables. */ +struct x509_lookup_st { + int init; /* have we been started */ + int skip; /* don't use us. */ + X509_LOOKUP_METHOD* method; /* the functions */ + char* method_data; /* method data */ + X509_STORE* store_ctx; /* who owns us */ +} /* X509_LOOKUP */; + +/* + * This is a used when verifying cert chains. Since the gathering of the + * cert chain can take some time (and have to be 'retried', this needs to be + * kept and passed around. + */ +struct x509_store_ctx_st { /* X509_STORE_CTX */ + X509_STORE* ctx; + /* used when looking up certs */ + int current_method; + /* The following are set by the caller */ + /* The cert to check */ + X509* cert; + /* chain of X509s - untrusted - passed in */ + STACK_OF(X509) * untrusted; + /* set of CRLs passed in */ + STACK_OF(X509_CRL) * crls; + X509_VERIFY_PARAM* param; + /* Other info for use with get_issuer() */ + void* other_ctx; + /* Callbacks for various operations */ + /* called to verify a certificate */ + int (*verify)(X509_STORE_CTX* ctx); + /* error callback */ + int (*verify_cb)(int ok, X509_STORE_CTX* ctx); + /* get issuers cert from ctx */ + int (*get_issuer)(X509** issuer, X509_STORE_CTX* ctx, X509* x); + /* check issued */ + int (*check_issued)(X509_STORE_CTX* ctx, X509* x, X509* issuer); + /* Check revocation status of chain */ + int (*check_revocation)(X509_STORE_CTX* ctx); + /* retrieve CRL */ + int (*get_crl)(X509_STORE_CTX* ctx, X509_CRL** crl, X509* x); + /* Check CRL validity */ + int (*check_crl)(X509_STORE_CTX* ctx, X509_CRL* crl); + /* Check certificate against CRL */ + int (*cert_crl)(X509_STORE_CTX* ctx, X509_CRL* crl, X509* x); + int (*check_policy)(X509_STORE_CTX* ctx); + STACK_OF(X509) * (*lookup_certs)(X509_STORE_CTX* ctx, X509_NAME* nm); + STACK_OF(X509_CRL) * (*lookup_crls)(X509_STORE_CTX* ctx, X509_NAME* nm); + int (*cleanup)(X509_STORE_CTX* ctx); + /* The following is built up */ + /* if 0, rebuild chain */ + int valid; + /* index of last untrusted cert */ + int last_untrusted; + /* chain of X509s - built up and trusted */ + STACK_OF(X509) * chain; + /* Valid policy tree */ + X509_POLICY_TREE* tree; + /* Require explicit policy value */ + int explicit_policy; + /* When something goes wrong, this is why */ + int error_depth; + int error; + X509* current_cert; + /* cert currently being tested as valid issuer */ + X509* current_issuer; + /* current CRL */ + X509_CRL* current_crl; + /* score of current CRL */ + int current_crl_score; + /* Reason mask */ + unsigned int current_reasons; + /* For CRL path validation: parent context */ + X509_STORE_CTX* parent; + CRYPTO_EX_DATA ex_data; +} /* X509_STORE_CTX */; + +void X509_STORE_CTX_set_depth(X509_STORE_CTX* ctx, int depth); + +#define X509_STORE_CTX_set_app_data(ctx, data) \ + X509_STORE_CTX_set_ex_data(ctx, 0, data) +#define X509_STORE_CTX_get_app_data(ctx) X509_STORE_CTX_get_ex_data(ctx, 0) + +#define X509_L_FILE_LOAD 1 +#define X509_L_ADD_DIR 2 + +#define X509_LOOKUP_load_file(x, name, type) \ + X509_LOOKUP_ctrl((x), X509_L_FILE_LOAD, (name), (long)(type), NULL) + +#define X509_LOOKUP_add_dir(x, name, type) \ + X509_LOOKUP_ctrl((x), X509_L_ADD_DIR, (name), (long)(type), NULL) + +#define X509_V_OK 0 +#define X509_V_ERR_UNSPECIFIED 1 + +#define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT 2 +#define X509_V_ERR_UNABLE_TO_GET_CRL 3 +#define X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE 4 +#define X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE 5 +#define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6 +#define X509_V_ERR_CERT_SIGNATURE_FAILURE 7 +#define X509_V_ERR_CRL_SIGNATURE_FAILURE 8 +#define X509_V_ERR_CERT_NOT_YET_VALID 9 +#define X509_V_ERR_CERT_HAS_EXPIRED 10 +#define X509_V_ERR_CRL_NOT_YET_VALID 11 +#define X509_V_ERR_CRL_HAS_EXPIRED 12 +#define X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD 13 +#define X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD 14 +#define X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD 15 +#define X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD 16 +#define X509_V_ERR_OUT_OF_MEM 17 +#define X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT 18 +#define X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN 19 +#define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY 20 +#define X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE 21 +#define X509_V_ERR_CERT_CHAIN_TOO_LONG 22 +#define X509_V_ERR_CERT_REVOKED 23 +#define X509_V_ERR_INVALID_CA 24 +#define X509_V_ERR_PATH_LENGTH_EXCEEDED 25 +#define X509_V_ERR_INVALID_PURPOSE 26 +#define X509_V_ERR_CERT_UNTRUSTED 27 +#define X509_V_ERR_CERT_REJECTED 28 +/* These are 'informational' when looking for issuer cert */ +#define X509_V_ERR_SUBJECT_ISSUER_MISMATCH 29 +#define X509_V_ERR_AKID_SKID_MISMATCH 30 +#define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH 31 +#define X509_V_ERR_KEYUSAGE_NO_CERTSIGN 32 + +#define X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER 33 +#define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34 +#define X509_V_ERR_KEYUSAGE_NO_CRL_SIGN 35 +#define X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION 36 +#define X509_V_ERR_INVALID_NON_CA 37 +#define X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED 38 +#define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE 39 +#define X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED 40 + +#define X509_V_ERR_INVALID_EXTENSION 41 +#define X509_V_ERR_INVALID_POLICY_EXTENSION 42 +#define X509_V_ERR_NO_EXPLICIT_POLICY 43 +#define X509_V_ERR_DIFFERENT_CRL_SCOPE 44 +#define X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE 45 + +#define X509_V_ERR_UNNESTED_RESOURCE 46 + +#define X509_V_ERR_PERMITTED_VIOLATION 47 +#define X509_V_ERR_EXCLUDED_VIOLATION 48 +#define X509_V_ERR_SUBTREE_MINMAX 49 +#define X509_V_ERR_APPLICATION_VERIFICATION 50 +#define X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE 51 +#define X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX 52 +#define X509_V_ERR_UNSUPPORTED_NAME_SYNTAX 53 +#define X509_V_ERR_CRL_PATH_VALIDATION_ERROR 54 + +/* Suite B mode algorithm violation */ +#define X509_V_ERR_SUITE_B_INVALID_VERSION 56 +#define X509_V_ERR_SUITE_B_INVALID_ALGORITHM 57 +#define X509_V_ERR_SUITE_B_INVALID_CURVE 58 +#define X509_V_ERR_SUITE_B_INVALID_SIGNATURE_ALGORITHM 59 +#define X509_V_ERR_SUITE_B_LOS_NOT_ALLOWED 60 +#define X509_V_ERR_SUITE_B_CANNOT_SIGN_P_384_WITH_P_256 61 + +/* Host, email and IP check errors */ +#define X509_V_ERR_HOSTNAME_MISMATCH 62 +#define X509_V_ERR_EMAIL_MISMATCH 63 +#define X509_V_ERR_IP_ADDRESS_MISMATCH 64 + +/* Caller error */ +#define X509_V_ERR_INVALID_CALL 65 +/* Issuer lookup error */ +#define X509_V_ERR_STORE_LOOKUP 66 + +#define X509_V_ERR_PROXY_SUBJECT_NAME_VIOLATION 67 + +/* Certificate verify flags */ + +/* Send issuer+subject checks to verify_cb */ +#define X509_V_FLAG_CB_ISSUER_CHECK 0x1 +/* Use check time instead of current time */ +#define X509_V_FLAG_USE_CHECK_TIME 0x2 +/* Lookup CRLs */ +#define X509_V_FLAG_CRL_CHECK 0x4 +/* Lookup CRLs for whole chain */ +#define X509_V_FLAG_CRL_CHECK_ALL 0x8 +/* Ignore unhandled critical extensions */ +#define X509_V_FLAG_IGNORE_CRITICAL 0x10 +/* Disable workarounds for broken certificates */ +#define X509_V_FLAG_X509_STRICT 0x20 +/* Enable proxy certificate validation */ +#define X509_V_FLAG_ALLOW_PROXY_CERTS 0x40 +/* Enable policy checking */ +#define X509_V_FLAG_POLICY_CHECK 0x80 +/* Policy variable require-explicit-policy */ +#define X509_V_FLAG_EXPLICIT_POLICY 0x100 +/* Policy variable inhibit-any-policy */ +#define X509_V_FLAG_INHIBIT_ANY 0x200 +/* Policy variable inhibit-policy-mapping */ +#define X509_V_FLAG_INHIBIT_MAP 0x400 +/* Notify callback that policy is OK */ +#define X509_V_FLAG_NOTIFY_POLICY 0x800 +/* Extended CRL features such as indirect CRLs, alternate CRL signing keys */ +#define X509_V_FLAG_EXTENDED_CRL_SUPPORT 0x1000 +/* Delta CRL support */ +#define X509_V_FLAG_USE_DELTAS 0x2000 +/* Check selfsigned CA signature */ +#define X509_V_FLAG_CHECK_SS_SIGNATURE 0x4000 +/* Use trusted store first */ +#define X509_V_FLAG_TRUSTED_FIRST 0x8000 +/* Suite B 128 bit only mode: not normally used */ +#define X509_V_FLAG_SUITEB_128_LOS_ONLY 0x10000 +/* Suite B 192 bit only mode */ +#define X509_V_FLAG_SUITEB_192_LOS 0x20000 +/* Suite B 128 bit mode allowing 192 bit algorithms */ +#define X509_V_FLAG_SUITEB_128_LOS 0x30000 + +/* Allow partial chains if at least one certificate is in trusted store */ +#define X509_V_FLAG_PARTIAL_CHAIN 0x80000 +/* + * If the initial chain is not trusted, do not attempt to build an alternative + * chain. Alternate chain checking was introduced in 1.0.2b. Setting this flag + * will force the behaviour to match that of previous versions. + */ +#define X509_V_FLAG_NO_ALT_CHAINS 0x100000 + +#define X509_VP_FLAG_DEFAULT 0x1 +#define X509_VP_FLAG_OVERWRITE 0x2 +#define X509_VP_FLAG_RESET_FLAGS 0x4 +#define X509_VP_FLAG_LOCKED 0x8 +#define X509_VP_FLAG_ONCE 0x10 + +/* Internal use: mask of policy related options */ +#define X509_V_FLAG_POLICY_MASK \ + (X509_V_FLAG_POLICY_CHECK | X509_V_FLAG_EXPLICIT_POLICY | \ + X509_V_FLAG_INHIBIT_ANY | X509_V_FLAG_INHIBIT_MAP) + +int X509_OBJECT_idx_by_subject( + STACK_OF(X509_OBJECT) * h, + int type, + X509_NAME* name); +X509_OBJECT* X509_OBJECT_retrieve_by_subject( + STACK_OF(X509_OBJECT) * h, + int type, + X509_NAME* name); +X509_OBJECT* X509_OBJECT_retrieve_match( + STACK_OF(X509_OBJECT) * h, + X509_OBJECT* x); +void X509_OBJECT_up_ref_count(X509_OBJECT* a); +void X509_OBJECT_free_contents(X509_OBJECT* a); +X509_STORE* X509_STORE_new(void); +void X509_STORE_free(X509_STORE* v); + +STACK_OF(X509) * X509_STORE_get1_certs(X509_STORE_CTX* st, X509_NAME* nm); +STACK_OF(X509_CRL) * X509_STORE_get1_crls(X509_STORE_CTX* st, X509_NAME* nm); +int X509_STORE_set_flags(X509_STORE* ctx, unsigned long flags); +int X509_STORE_set_purpose(X509_STORE* ctx, int purpose); +int X509_STORE_set_trust(X509_STORE* ctx, int trust); +int X509_STORE_set1_param(X509_STORE* ctx, X509_VERIFY_PARAM* pm); + +void X509_STORE_set_verify_cb( + X509_STORE* ctx, + int (*verify_cb)(int, X509_STORE_CTX*)); + +void X509_STORE_set_lookup_crls_cb( + X509_STORE* ctx, + STACK_OF(X509_CRL) * (*cb)(X509_STORE_CTX * ctx, X509_NAME* nm)); + +X509_STORE_CTX* X509_STORE_CTX_new(void); + +int X509_STORE_CTX_get1_issuer(X509** issuer, X509_STORE_CTX* ctx, X509* x); + +void X509_STORE_CTX_free(X509_STORE_CTX* ctx); +int X509_STORE_CTX_init( + X509_STORE_CTX* ctx, + X509_STORE* store, + X509* x509, + STACK_OF(X509) * chain); +void X509_STORE_CTX_trusted_stack(X509_STORE_CTX* ctx, STACK_OF(X509) * sk); +void X509_STORE_CTX_cleanup(X509_STORE_CTX* ctx); + +X509_STORE* X509_STORE_CTX_get0_store(X509_STORE_CTX* ctx); + +X509_LOOKUP* X509_STORE_add_lookup(X509_STORE* v, X509_LOOKUP_METHOD* m); + +X509_LOOKUP_METHOD* X509_LOOKUP_hash_dir(void); +X509_LOOKUP_METHOD* X509_LOOKUP_file(void); + +int X509_STORE_add_cert(X509_STORE* ctx, X509* x); +int X509_STORE_add_crl(X509_STORE* ctx, X509_CRL* x); + +int X509_STORE_get_by_subject( + X509_STORE_CTX* vs, + int type, + X509_NAME* name, + X509_OBJECT* ret); + +int X509_LOOKUP_ctrl( + X509_LOOKUP* ctx, + int cmd, + const char* argc, + long argl, + char** ret); + +#ifndef OPENSSL_NO_STDIO +int X509_load_cert_file(X509_LOOKUP* ctx, const char* file, int type); +int X509_load_crl_file(X509_LOOKUP* ctx, const char* file, int type); +int X509_load_cert_crl_file(X509_LOOKUP* ctx, const char* file, int type); +#endif + +X509_LOOKUP* X509_LOOKUP_new(X509_LOOKUP_METHOD* method); +void X509_LOOKUP_free(X509_LOOKUP* ctx); +int X509_LOOKUP_init(X509_LOOKUP* ctx); +int X509_LOOKUP_by_subject( + X509_LOOKUP* ctx, + int type, + X509_NAME* name, + X509_OBJECT* ret); +int X509_LOOKUP_by_issuer_serial( + X509_LOOKUP* ctx, + int type, + X509_NAME* name, + ASN1_INTEGER* serial, + X509_OBJECT* ret); +int X509_LOOKUP_by_fingerprint( + X509_LOOKUP* ctx, + int type, + unsigned char* bytes, + int len, + X509_OBJECT* ret); +int X509_LOOKUP_by_alias( + X509_LOOKUP* ctx, + int type, + char* str, + int len, + X509_OBJECT* ret); +int X509_LOOKUP_shutdown(X509_LOOKUP* ctx); + +#ifndef OPENSSL_NO_STDIO +int X509_STORE_load_locations( + X509_STORE* ctx, + const char* file, + const char* dir); +int X509_STORE_set_default_paths(X509_STORE* ctx); +#endif + +int X509_STORE_CTX_get_ex_new_index( + long argl, + void* argp, + CRYPTO_EX_new* new_func, + CRYPTO_EX_dup* dup_func, + CRYPTO_EX_free* free_func); +int X509_STORE_CTX_set_ex_data(X509_STORE_CTX* ctx, int idx, void* data); +void* X509_STORE_CTX_get_ex_data(X509_STORE_CTX* ctx, int idx); +int X509_STORE_CTX_get_error(X509_STORE_CTX* ctx); +void X509_STORE_CTX_set_error(X509_STORE_CTX* ctx, int s); +int X509_STORE_CTX_get_error_depth(X509_STORE_CTX* ctx); +X509* X509_STORE_CTX_get_current_cert(X509_STORE_CTX* ctx); +X509* X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX* ctx); +X509_CRL* X509_STORE_CTX_get0_current_crl(X509_STORE_CTX* ctx); +X509_STORE_CTX* X509_STORE_CTX_get0_parent_ctx(X509_STORE_CTX* ctx); +STACK_OF(X509) * X509_STORE_CTX_get_chain(X509_STORE_CTX* ctx); +STACK_OF(X509) * X509_STORE_CTX_get1_chain(X509_STORE_CTX* ctx); +void X509_STORE_CTX_set_cert(X509_STORE_CTX* c, X509* x); +void X509_STORE_CTX_set_chain(X509_STORE_CTX* c, STACK_OF(X509) * sk); +void X509_STORE_CTX_set0_crls(X509_STORE_CTX* c, STACK_OF(X509_CRL) * sk); +int X509_STORE_CTX_set_purpose(X509_STORE_CTX* ctx, int purpose); +int X509_STORE_CTX_set_trust(X509_STORE_CTX* ctx, int trust); +int X509_STORE_CTX_purpose_inherit( + X509_STORE_CTX* ctx, + int def_purpose, + int purpose, + int trust); +void X509_STORE_CTX_set_flags(X509_STORE_CTX* ctx, unsigned long flags); +void X509_STORE_CTX_set_time( + X509_STORE_CTX* ctx, + unsigned long flags, + time_t t); +void X509_STORE_CTX_set_verify_cb( + X509_STORE_CTX* ctx, + int (*verify_cb)(int, X509_STORE_CTX*)); + +X509_POLICY_TREE* X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX* ctx); +int X509_STORE_CTX_get_explicit_policy(X509_STORE_CTX* ctx); + +X509_VERIFY_PARAM* X509_STORE_CTX_get0_param(X509_STORE_CTX* ctx); +void X509_STORE_CTX_set0_param(X509_STORE_CTX* ctx, X509_VERIFY_PARAM* param); +int X509_STORE_CTX_set_default(X509_STORE_CTX* ctx, const char* name); + +/* X509_VERIFY_PARAM functions */ + +X509_VERIFY_PARAM* X509_VERIFY_PARAM_new(void); +void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM* param); +int X509_VERIFY_PARAM_inherit( + X509_VERIFY_PARAM* to, + const X509_VERIFY_PARAM* from); +int X509_VERIFY_PARAM_set1( + X509_VERIFY_PARAM* to, + const X509_VERIFY_PARAM* from); +int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM* param, const char* name); +int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM* param, unsigned long flags); +int X509_VERIFY_PARAM_clear_flags( + X509_VERIFY_PARAM* param, + unsigned long flags); +unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM* param); +int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM* param, int purpose); +int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM* param, int trust); +void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM* param, int depth); +void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM* param, time_t t); +int X509_VERIFY_PARAM_add0_policy( + X509_VERIFY_PARAM* param, + ASN1_OBJECT* policy); +int X509_VERIFY_PARAM_set1_policies( + X509_VERIFY_PARAM* param, + STACK_OF(ASN1_OBJECT) * policies); + +int X509_VERIFY_PARAM_set1_host( + X509_VERIFY_PARAM* param, + const char* name, + size_t namelen); +int X509_VERIFY_PARAM_add1_host( + X509_VERIFY_PARAM* param, + const char* name, + size_t namelen); +void X509_VERIFY_PARAM_set_hostflags( + X509_VERIFY_PARAM* param, + unsigned int flags); +char* X509_VERIFY_PARAM_get0_peername(X509_VERIFY_PARAM*); +int X509_VERIFY_PARAM_set1_email( + X509_VERIFY_PARAM* param, + const char* email, + size_t emaillen); +int X509_VERIFY_PARAM_set1_ip( + X509_VERIFY_PARAM* param, + const unsigned char* ip, + size_t iplen); +int X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM* param, const char* ipasc); + +int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM* param); +const char* X509_VERIFY_PARAM_get0_name(const X509_VERIFY_PARAM* param); + +int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM* param); +int X509_VERIFY_PARAM_get_count(void); +const X509_VERIFY_PARAM* X509_VERIFY_PARAM_get0(int id); +const X509_VERIFY_PARAM* X509_VERIFY_PARAM_lookup(const char* name); +void X509_VERIFY_PARAM_table_cleanup(void); + +int X509_policy_check( + X509_POLICY_TREE** ptree, + int* pexplicit_policy, + STACK_OF(X509) * certs, + STACK_OF(ASN1_OBJECT) * policy_oids, + unsigned int flags); + +void X509_policy_tree_free(X509_POLICY_TREE* tree); + +int X509_policy_tree_level_count(const X509_POLICY_TREE* tree); +X509_POLICY_LEVEL* X509_policy_tree_get0_level( + const X509_POLICY_TREE* tree, + int i); + +STACK_OF(X509_POLICY_NODE) * + X509_policy_tree_get0_policies(const X509_POLICY_TREE* tree); + +STACK_OF(X509_POLICY_NODE) * + X509_policy_tree_get0_user_policies(const X509_POLICY_TREE* tree); + +int X509_policy_level_node_count(X509_POLICY_LEVEL* level); + +X509_POLICY_NODE* X509_policy_level_get0_node(X509_POLICY_LEVEL* level, int i); + +const ASN1_OBJECT* X509_policy_node_get0_policy(const X509_POLICY_NODE* node); + +STACK_OF(POLICYQUALINFO) * + X509_policy_node_get0_qualifiers(const X509_POLICY_NODE* node); +const X509_POLICY_NODE* X509_policy_node_get0_parent( + const X509_POLICY_NODE* node); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/x509v3.h b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/x509v3.h new file mode 100644 index 0000000..219f0ae --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/openssl/x509v3.h @@ -0,0 +1,1179 @@ +/* x509v3.h */ +/* + * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project + * 1999. + */ +/* ==================================================================== + * Copyright (c) 1999-2004 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +#ifndef HEADER_X509V3_H +#define HEADER_X509V3_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSSL_SYS_WIN32 +/* Under Win32 these are defined in wincrypt.h */ +#undef X509_NAME +#undef X509_CERT_PAIR +#undef X509_EXTENSIONS +#endif + +/* Forward reference */ +struct v3_ext_method; +struct v3_ext_ctx; + +/* Useful typedefs */ + +typedef void* (*X509V3_EXT_NEW)(void); +typedef void (*X509V3_EXT_FREE)(void*); +typedef void* (*X509V3_EXT_D2I)(void*, const unsigned char**, long); +typedef int (*X509V3_EXT_I2D)(void*, unsigned char**); +typedef STACK_OF(CONF_VALUE) * (*X509V3_EXT_I2V)( + const struct v3_ext_method* method, + void* ext, + STACK_OF(CONF_VALUE) * extlist); +typedef void* (*X509V3_EXT_V2I)( + const struct v3_ext_method* method, + struct v3_ext_ctx* ctx, + STACK_OF(CONF_VALUE) * values); +typedef char* (*X509V3_EXT_I2S)(const struct v3_ext_method* method, void* ext); +typedef void* (*X509V3_EXT_S2I)( + const struct v3_ext_method* method, + struct v3_ext_ctx* ctx, + const char* str); +typedef int (*X509V3_EXT_I2R)( + const struct v3_ext_method* method, + void* ext, + BIO* out, + int indent); +typedef void* (*X509V3_EXT_R2I)( + const struct v3_ext_method* method, + struct v3_ext_ctx* ctx, + const char* str); + +/* V3 extension structure */ + +struct v3_ext_method { + int ext_nid; + int ext_flags; + /* If this is set the following four fields are ignored */ + ASN1_ITEM_EXP* it; + /* Old style ASN1 calls */ + X509V3_EXT_NEW ext_new; + X509V3_EXT_FREE ext_free; + X509V3_EXT_D2I d2i; + X509V3_EXT_I2D i2d; + /* The following pair is used for string extensions */ + X509V3_EXT_I2S i2s; + X509V3_EXT_S2I s2i; + /* The following pair is used for multi-valued extensions */ + X509V3_EXT_I2V i2v; + X509V3_EXT_V2I v2i; + /* The following are used for raw extensions */ + X509V3_EXT_I2R i2r; + X509V3_EXT_R2I r2i; + void* usr_data; /* Any extension specific data */ +}; + +typedef struct X509V3_CONF_METHOD_st { + char* (*get_string)(void* db, char* section, char* value); + STACK_OF(CONF_VALUE) * (*get_section)(void* db, char* section); + void (*free_string)(void* db, char* string); + void (*free_section)(void* db, STACK_OF(CONF_VALUE) * section); +} X509V3_CONF_METHOD; + +/* Context specific info */ +struct v3_ext_ctx { +#define CTX_TEST 0x1 + int flags; + X509* issuer_cert; + X509* subject_cert; + X509_REQ* subject_req; + X509_CRL* crl; + X509V3_CONF_METHOD* db_meth; + void* db; + /* Maybe more here */ +}; + +typedef struct v3_ext_method X509V3_EXT_METHOD; + +DECLARE_STACK_OF(X509V3_EXT_METHOD) + +/* ext_flags values */ +#define X509V3_EXT_DYNAMIC 0x1 +#define X509V3_EXT_CTX_DEP 0x2 +#define X509V3_EXT_MULTILINE 0x4 + +typedef BIT_STRING_BITNAME ENUMERATED_NAMES; + +typedef struct BASIC_CONSTRAINTS_st { + int ca; + ASN1_INTEGER* pathlen; +} BASIC_CONSTRAINTS; + +typedef struct PKEY_USAGE_PERIOD_st { + ASN1_GENERALIZEDTIME* notBefore; + ASN1_GENERALIZEDTIME* notAfter; +} PKEY_USAGE_PERIOD; + +typedef struct otherName_st { + ASN1_OBJECT* type_id; + ASN1_TYPE* value; +} OTHERNAME; + +typedef struct EDIPartyName_st { + ASN1_STRING* nameAssigner; + ASN1_STRING* partyName; +} EDIPARTYNAME; + +typedef struct GENERAL_NAME_st { +#define GEN_OTHERNAME 0 +#define GEN_EMAIL 1 +#define GEN_DNS 2 +#define GEN_X400 3 +#define GEN_DIRNAME 4 +#define GEN_EDIPARTY 5 +#define GEN_URI 6 +#define GEN_IPADD 7 +#define GEN_RID 8 + int type; + union { + char* ptr; + OTHERNAME* otherName; /* otherName */ + ASN1_IA5STRING* rfc822Name; + ASN1_IA5STRING* dNSName; + ASN1_TYPE* x400Address; + X509_NAME* directoryName; + EDIPARTYNAME* ediPartyName; + ASN1_IA5STRING* uniformResourceIdentifier; + ASN1_OCTET_STRING* iPAddress; + ASN1_OBJECT* registeredID; + /* Old names */ + ASN1_OCTET_STRING* ip; /* iPAddress */ + X509_NAME* dirn; /* dirn */ + ASN1_IA5STRING* ia5; /* rfc822Name, dNSName, + * uniformResourceIdentifier */ + ASN1_OBJECT* rid; /* registeredID */ + ASN1_TYPE* other; /* x400Address */ + } d; +} GENERAL_NAME; + +typedef STACK_OF(GENERAL_NAME) GENERAL_NAMES; + +typedef struct ACCESS_DESCRIPTION_st { + ASN1_OBJECT* method; + GENERAL_NAME* location; +} ACCESS_DESCRIPTION; + +typedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS; + +typedef STACK_OF(ASN1_OBJECT) EXTENDED_KEY_USAGE; + +DECLARE_STACK_OF(GENERAL_NAME) +DECLARE_ASN1_SET_OF(GENERAL_NAME) + +DECLARE_STACK_OF(ACCESS_DESCRIPTION) +DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION) + +typedef struct DIST_POINT_NAME_st { + int type; + union { + GENERAL_NAMES* fullname; + STACK_OF(X509_NAME_ENTRY) * relativename; + } name; + /* If relativename then this contains the full distribution point name */ + X509_NAME* dpname; +} DIST_POINT_NAME; +/* All existing reasons */ +#define CRLDP_ALL_REASONS 0x807f + +#define CRL_REASON_NONE -1 +#define CRL_REASON_UNSPECIFIED 0 +#define CRL_REASON_KEY_COMPROMISE 1 +#define CRL_REASON_CA_COMPROMISE 2 +#define CRL_REASON_AFFILIATION_CHANGED 3 +#define CRL_REASON_SUPERSEDED 4 +#define CRL_REASON_CESSATION_OF_OPERATION 5 +#define CRL_REASON_CERTIFICATE_HOLD 6 +#define CRL_REASON_REMOVE_FROM_CRL 8 +#define CRL_REASON_PRIVILEGE_WITHDRAWN 9 +#define CRL_REASON_AA_COMPROMISE 10 + +struct DIST_POINT_st { + DIST_POINT_NAME* distpoint; + ASN1_BIT_STRING* reasons; + GENERAL_NAMES* CRLissuer; + int dp_reasons; +}; + +typedef STACK_OF(DIST_POINT) CRL_DIST_POINTS; + +DECLARE_STACK_OF(DIST_POINT) +DECLARE_ASN1_SET_OF(DIST_POINT) + +struct AUTHORITY_KEYID_st { + ASN1_OCTET_STRING* keyid; + GENERAL_NAMES* issuer; + ASN1_INTEGER* serial; +}; + +/* Strong extranet structures */ + +typedef struct SXNET_ID_st { + ASN1_INTEGER* zone; + ASN1_OCTET_STRING* user; +} SXNETID; + +DECLARE_STACK_OF(SXNETID) +DECLARE_ASN1_SET_OF(SXNETID) + +typedef struct SXNET_st { + ASN1_INTEGER* version; + STACK_OF(SXNETID) * ids; +} SXNET; + +typedef struct NOTICEREF_st { + ASN1_STRING* organization; + STACK_OF(ASN1_INTEGER) * noticenos; +} NOTICEREF; + +typedef struct USERNOTICE_st { + NOTICEREF* noticeref; + ASN1_STRING* exptext; +} USERNOTICE; + +typedef struct POLICYQUALINFO_st { + ASN1_OBJECT* pqualid; + union { + ASN1_IA5STRING* cpsuri; + USERNOTICE* usernotice; + ASN1_TYPE* other; + } d; +} POLICYQUALINFO; + +DECLARE_STACK_OF(POLICYQUALINFO) +DECLARE_ASN1_SET_OF(POLICYQUALINFO) + +typedef struct POLICYINFO_st { + ASN1_OBJECT* policyid; + STACK_OF(POLICYQUALINFO) * qualifiers; +} POLICYINFO; + +typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES; + +DECLARE_STACK_OF(POLICYINFO) +DECLARE_ASN1_SET_OF(POLICYINFO) + +typedef struct POLICY_MAPPING_st { + ASN1_OBJECT* issuerDomainPolicy; + ASN1_OBJECT* subjectDomainPolicy; +} POLICY_MAPPING; + +DECLARE_STACK_OF(POLICY_MAPPING) + +typedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS; + +typedef struct GENERAL_SUBTREE_st { + GENERAL_NAME* base; + ASN1_INTEGER* minimum; + ASN1_INTEGER* maximum; +} GENERAL_SUBTREE; + +DECLARE_STACK_OF(GENERAL_SUBTREE) + +struct NAME_CONSTRAINTS_st { + STACK_OF(GENERAL_SUBTREE) * permittedSubtrees; + STACK_OF(GENERAL_SUBTREE) * excludedSubtrees; +}; + +typedef struct POLICY_CONSTRAINTS_st { + ASN1_INTEGER* requireExplicitPolicy; + ASN1_INTEGER* inhibitPolicyMapping; +} POLICY_CONSTRAINTS; + +/* Proxy certificate structures, see RFC 3820 */ +typedef struct PROXY_POLICY_st { + ASN1_OBJECT* policyLanguage; + ASN1_OCTET_STRING* policy; +} PROXY_POLICY; + +typedef struct PROXY_CERT_INFO_EXTENSION_st { + ASN1_INTEGER* pcPathLengthConstraint; + PROXY_POLICY* proxyPolicy; +} PROXY_CERT_INFO_EXTENSION; + +DECLARE_ASN1_FUNCTIONS(PROXY_POLICY) +DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION) + +struct ISSUING_DIST_POINT_st { + DIST_POINT_NAME* distpoint; + int onlyuser; + int onlyCA; + ASN1_BIT_STRING* onlysomereasons; + int indirectCRL; + int onlyattr; +}; + +/* Values in idp_flags field */ +/* IDP present */ +#define IDP_PRESENT 0x1 +/* IDP values inconsistent */ +#define IDP_INVALID 0x2 +/* onlyuser true */ +#define IDP_ONLYUSER 0x4 +/* onlyCA true */ +#define IDP_ONLYCA 0x8 +/* onlyattr true */ +#define IDP_ONLYATTR 0x10 +/* indirectCRL true */ +#define IDP_INDIRECT 0x20 +/* onlysomereasons present */ +#define IDP_REASONS 0x40 + +#define X509V3_conf_err(val) \ + ERR_add_error_data( \ + 6, \ + "section:", \ + val->section, \ + ",name:", \ + val->name, \ + ",value:", \ + val->value); + +#define X509V3_set_ctx_test(ctx) \ + X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST) +#define X509V3_set_ctx_nodb(ctx) (ctx)->db = NULL; + +#define EXT_BITSTRING(nid, table) \ + { \ + nid, 0, ASN1_ITEM_ref(ASN1_BIT_STRING), 0, 0, 0, 0, 0, 0, \ + (X509V3_EXT_I2V)i2v_ASN1_BIT_STRING, \ + (X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, NULL, NULL, table \ + } + +#define EXT_IA5STRING(nid) \ + { \ + nid, 0, ASN1_ITEM_ref(ASN1_IA5STRING), 0, 0, 0, 0, \ + (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, \ + (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, 0, 0, 0, 0, NULL \ + } + +#define EXT_END \ + { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + +/* X509_PURPOSE stuff */ + +#define EXFLAG_BCONS 0x1 +#define EXFLAG_KUSAGE 0x2 +#define EXFLAG_XKUSAGE 0x4 +#define EXFLAG_NSCERT 0x8 + +#define EXFLAG_CA 0x10 +/* Really self issued not necessarily self signed */ +#define EXFLAG_SI 0x20 +#define EXFLAG_V1 0x40 +#define EXFLAG_INVALID 0x80 +#define EXFLAG_SET 0x100 +#define EXFLAG_CRITICAL 0x200 +#define EXFLAG_PROXY 0x400 + +#define EXFLAG_INVALID_POLICY 0x800 +#define EXFLAG_FRESHEST 0x1000 +/* Self signed */ +#define EXFLAG_SS 0x2000 + +#define KU_DIGITAL_SIGNATURE 0x0080 +#define KU_NON_REPUDIATION 0x0040 +#define KU_KEY_ENCIPHERMENT 0x0020 +#define KU_DATA_ENCIPHERMENT 0x0010 +#define KU_KEY_AGREEMENT 0x0008 +#define KU_KEY_CERT_SIGN 0x0004 +#define KU_CRL_SIGN 0x0002 +#define KU_ENCIPHER_ONLY 0x0001 +#define KU_DECIPHER_ONLY 0x8000 + +#define NS_SSL_CLIENT 0x80 +#define NS_SSL_SERVER 0x40 +#define NS_SMIME 0x20 +#define NS_OBJSIGN 0x10 +#define NS_SSL_CA 0x04 +#define NS_SMIME_CA 0x02 +#define NS_OBJSIGN_CA 0x01 +#define NS_ANY_CA (NS_SSL_CA | NS_SMIME_CA | NS_OBJSIGN_CA) + +#define XKU_SSL_SERVER 0x1 +#define XKU_SSL_CLIENT 0x2 +#define XKU_SMIME 0x4 +#define XKU_CODE_SIGN 0x8 +#define XKU_SGC 0x10 +#define XKU_OCSP_SIGN 0x20 +#define XKU_TIMESTAMP 0x40 +#define XKU_DVCS 0x80 +#define XKU_ANYEKU 0x100 + +#define X509_PURPOSE_DYNAMIC 0x1 +#define X509_PURPOSE_DYNAMIC_NAME 0x2 + +typedef struct x509_purpose_st { + int purpose; + int trust; /* Default trust ID */ + int flags; + int (*check_purpose)(const struct x509_purpose_st*, const X509*, int); + char* name; + char* sname; + void* usr_data; +} X509_PURPOSE; + +#define X509_PURPOSE_SSL_CLIENT 1 +#define X509_PURPOSE_SSL_SERVER 2 +#define X509_PURPOSE_NS_SSL_SERVER 3 +#define X509_PURPOSE_SMIME_SIGN 4 +#define X509_PURPOSE_SMIME_ENCRYPT 5 +#define X509_PURPOSE_CRL_SIGN 6 +#define X509_PURPOSE_ANY 7 +#define X509_PURPOSE_OCSP_HELPER 8 +#define X509_PURPOSE_TIMESTAMP_SIGN 9 + +#define X509_PURPOSE_MIN 1 +#define X509_PURPOSE_MAX 9 + +/* Flags for X509V3_EXT_print() */ + +#define X509V3_EXT_UNKNOWN_MASK (0xfL << 16) +/* Return error for unknown extensions */ +#define X509V3_EXT_DEFAULT 0 +/* Print error for unknown extensions */ +#define X509V3_EXT_ERROR_UNKNOWN (1L << 16) +/* ASN1 parse unknown extensions */ +#define X509V3_EXT_PARSE_UNKNOWN (2L << 16) +/* BIO_dump unknown extensions */ +#define X509V3_EXT_DUMP_UNKNOWN (3L << 16) + +/* Flags for X509V3_add1_i2d */ + +#define X509V3_ADD_OP_MASK 0xfL +#define X509V3_ADD_DEFAULT 0L +#define X509V3_ADD_APPEND 1L +#define X509V3_ADD_REPLACE 2L +#define X509V3_ADD_REPLACE_EXISTING 3L +#define X509V3_ADD_KEEP_EXISTING 4L +#define X509V3_ADD_DELETE 5L +#define X509V3_ADD_SILENT 0x10 + +DECLARE_STACK_OF(X509_PURPOSE) + +DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS) + +DECLARE_ASN1_FUNCTIONS(SXNET) +DECLARE_ASN1_FUNCTIONS(SXNETID) + +int SXNET_add_id_asc(SXNET** psx, char* zone, char* user, int userlen); +int SXNET_add_id_ulong( + SXNET** psx, + unsigned long lzone, + char* user, + int userlen); +int SXNET_add_id_INTEGER( + SXNET** psx, + ASN1_INTEGER* izone, + char* user, + int userlen); + +ASN1_OCTET_STRING* SXNET_get_id_asc(SXNET* sx, char* zone); +ASN1_OCTET_STRING* SXNET_get_id_ulong(SXNET* sx, unsigned long lzone); +ASN1_OCTET_STRING* SXNET_get_id_INTEGER(SXNET* sx, ASN1_INTEGER* zone); + +DECLARE_ASN1_FUNCTIONS(AUTHORITY_KEYID) + +DECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD) + +DECLARE_ASN1_FUNCTIONS(GENERAL_NAME) +GENERAL_NAME* GENERAL_NAME_dup(GENERAL_NAME* a); +int GENERAL_NAME_cmp(GENERAL_NAME* a, GENERAL_NAME* b); + +ASN1_BIT_STRING* v2i_ASN1_BIT_STRING( + X509V3_EXT_METHOD* method, + X509V3_CTX* ctx, + STACK_OF(CONF_VALUE) * nval); +STACK_OF(CONF_VALUE) * i2v_ASN1_BIT_STRING( + X509V3_EXT_METHOD* method, + ASN1_BIT_STRING* bits, + STACK_OF(CONF_VALUE) * extlist); + +STACK_OF(CONF_VALUE) * i2v_GENERAL_NAME( + X509V3_EXT_METHOD* method, + GENERAL_NAME* gen, + STACK_OF(CONF_VALUE) * ret); +int GENERAL_NAME_print(BIO* out, GENERAL_NAME* gen); + +DECLARE_ASN1_FUNCTIONS(GENERAL_NAMES) + +STACK_OF(CONF_VALUE) * i2v_GENERAL_NAMES( + X509V3_EXT_METHOD* method, + GENERAL_NAMES* gen, + STACK_OF(CONF_VALUE) * extlist); +GENERAL_NAMES* v2i_GENERAL_NAMES( + const X509V3_EXT_METHOD* method, + X509V3_CTX* ctx, + STACK_OF(CONF_VALUE) * nval); + +DECLARE_ASN1_FUNCTIONS(OTHERNAME) +DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME) +int OTHERNAME_cmp(OTHERNAME* a, OTHERNAME* b); +void GENERAL_NAME_set0_value(GENERAL_NAME* a, int type, void* value); +void* GENERAL_NAME_get0_value(GENERAL_NAME* a, int* ptype); +int GENERAL_NAME_set0_othername( + GENERAL_NAME* gen, + ASN1_OBJECT* oid, + ASN1_TYPE* value); +int GENERAL_NAME_get0_otherName( + GENERAL_NAME* gen, + ASN1_OBJECT** poid, + ASN1_TYPE** pvalue); + +char* i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD* method, ASN1_OCTET_STRING* ia5); +ASN1_OCTET_STRING* +s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD* method, X509V3_CTX* ctx, char* str); + +DECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE) +int i2a_ACCESS_DESCRIPTION(BIO* bp, ACCESS_DESCRIPTION* a); + +DECLARE_ASN1_FUNCTIONS(CERTIFICATEPOLICIES) +DECLARE_ASN1_FUNCTIONS(POLICYINFO) +DECLARE_ASN1_FUNCTIONS(POLICYQUALINFO) +DECLARE_ASN1_FUNCTIONS(USERNOTICE) +DECLARE_ASN1_FUNCTIONS(NOTICEREF) + +DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS) +DECLARE_ASN1_FUNCTIONS(DIST_POINT) +DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME) +DECLARE_ASN1_FUNCTIONS(ISSUING_DIST_POINT) + +int DIST_POINT_set_dpname(DIST_POINT_NAME* dpn, X509_NAME* iname); + +int NAME_CONSTRAINTS_check(X509* x, NAME_CONSTRAINTS* nc); + +DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION) +DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS) + +DECLARE_ASN1_ITEM(POLICY_MAPPING) +DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING) +DECLARE_ASN1_ITEM(POLICY_MAPPINGS) + +DECLARE_ASN1_ITEM(GENERAL_SUBTREE) +DECLARE_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE) + +DECLARE_ASN1_ITEM(NAME_CONSTRAINTS) +DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS) + +DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS) +DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS) + +GENERAL_NAME* a2i_GENERAL_NAME( + GENERAL_NAME* out, + const X509V3_EXT_METHOD* method, + X509V3_CTX* ctx, + int gen_type, + char* value, + int is_nc); + +#ifdef HEADER_CONF_H +GENERAL_NAME* v2i_GENERAL_NAME( + const X509V3_EXT_METHOD* method, + X509V3_CTX* ctx, + CONF_VALUE* cnf); +GENERAL_NAME* v2i_GENERAL_NAME_ex( + GENERAL_NAME* out, + const X509V3_EXT_METHOD* method, + X509V3_CTX* ctx, + CONF_VALUE* cnf, + int is_nc); +void X509V3_conf_free(CONF_VALUE* val); + +X509_EXTENSION* +X509V3_EXT_nconf_nid(CONF* conf, X509V3_CTX* ctx, int ext_nid, char* value); +X509_EXTENSION* +X509V3_EXT_nconf(CONF* conf, X509V3_CTX* ctx, char* name, char* value); +int X509V3_EXT_add_nconf_sk( + CONF* conf, + X509V3_CTX* ctx, + char* section, + STACK_OF(X509_EXTENSION) * *sk); +int X509V3_EXT_add_nconf( + CONF* conf, + X509V3_CTX* ctx, + char* section, + X509* cert); +int X509V3_EXT_REQ_add_nconf( + CONF* conf, + X509V3_CTX* ctx, + char* section, + X509_REQ* req); +int X509V3_EXT_CRL_add_nconf( + CONF* conf, + X509V3_CTX* ctx, + char* section, + X509_CRL* crl); + +X509_EXTENSION* X509V3_EXT_conf_nid( + LHASH_OF(CONF_VALUE) * conf, + X509V3_CTX* ctx, + int ext_nid, + char* value); +X509_EXTENSION* X509V3_EXT_conf( + LHASH_OF(CONF_VALUE) * conf, + X509V3_CTX* ctx, + char* name, + char* value); +int X509V3_EXT_add_conf( + LHASH_OF(CONF_VALUE) * conf, + X509V3_CTX* ctx, + char* section, + X509* cert); +int X509V3_EXT_REQ_add_conf( + LHASH_OF(CONF_VALUE) * conf, + X509V3_CTX* ctx, + char* section, + X509_REQ* req); +int X509V3_EXT_CRL_add_conf( + LHASH_OF(CONF_VALUE) * conf, + X509V3_CTX* ctx, + char* section, + X509_CRL* crl); + +int X509V3_add_value_bool_nf( + char* name, + int asn1_bool, + STACK_OF(CONF_VALUE) * *extlist); +int X509V3_get_value_bool(CONF_VALUE* value, int* asn1_bool); +int X509V3_get_value_int(CONF_VALUE* value, ASN1_INTEGER** aint); +void X509V3_set_nconf(X509V3_CTX* ctx, CONF* conf); +void X509V3_set_conf_lhash(X509V3_CTX* ctx, LHASH_OF(CONF_VALUE) * lhash); +#endif + +char* X509V3_get_string(X509V3_CTX* ctx, char* name, char* section); +STACK_OF(CONF_VALUE) * X509V3_get_section(X509V3_CTX* ctx, char* section); +void X509V3_string_free(X509V3_CTX* ctx, char* str); +void X509V3_section_free(X509V3_CTX* ctx, STACK_OF(CONF_VALUE) * section); +void X509V3_set_ctx( + X509V3_CTX* ctx, + X509* issuer, + X509* subject, + X509_REQ* req, + X509_CRL* crl, + int flags); + +int X509V3_add_value( + const char* name, + const char* value, + STACK_OF(CONF_VALUE) * *extlist); +int X509V3_add_value_uchar( + const char* name, + const unsigned char* value, + STACK_OF(CONF_VALUE) * *extlist); +int X509V3_add_value_bool( + const char* name, + int asn1_bool, + STACK_OF(CONF_VALUE) * *extlist); +int X509V3_add_value_int( + const char* name, + ASN1_INTEGER* aint, + STACK_OF(CONF_VALUE) * *extlist); +char* i2s_ASN1_INTEGER(X509V3_EXT_METHOD* meth, ASN1_INTEGER* aint); +ASN1_INTEGER* s2i_ASN1_INTEGER(X509V3_EXT_METHOD* meth, char* value); +char* i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD* meth, ASN1_ENUMERATED* aint); +char* i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD* meth, ASN1_ENUMERATED* aint); +int X509V3_EXT_add(X509V3_EXT_METHOD* ext); +int X509V3_EXT_add_list(X509V3_EXT_METHOD* extlist); +int X509V3_EXT_add_alias(int nid_to, int nid_from); +void X509V3_EXT_cleanup(void); + +const X509V3_EXT_METHOD* X509V3_EXT_get(X509_EXTENSION* ext); +const X509V3_EXT_METHOD* X509V3_EXT_get_nid(int nid); +int X509V3_add_standard_extensions(void); +STACK_OF(CONF_VALUE) * X509V3_parse_list(const char* line); +void* X509V3_EXT_d2i(X509_EXTENSION* ext); +void* X509V3_get_d2i( + STACK_OF(X509_EXTENSION) * x, + int nid, + int* crit, + int* idx); +int X509V3_EXT_free(int nid, void* ext_data); + +X509_EXTENSION* X509V3_EXT_i2d(int ext_nid, int crit, void* ext_struc); +int X509V3_add1_i2d( + STACK_OF(X509_EXTENSION) * *x, + int nid, + void* value, + int crit, + unsigned long flags); + +char* hex_to_string(const unsigned char* buffer, long len); +unsigned char* string_to_hex(const char* str, long* len); +int name_cmp(const char* name, const char* cmp); + +void X509V3_EXT_val_prn( + BIO* out, + STACK_OF(CONF_VALUE) * val, + int indent, + int ml); +int X509V3_EXT_print( + BIO* out, + X509_EXTENSION* ext, + unsigned long flag, + int indent); +int X509V3_EXT_print_fp(FILE* out, X509_EXTENSION* ext, int flag, int indent); + +int X509V3_extensions_print( + BIO* out, + char* title, + STACK_OF(X509_EXTENSION) * exts, + unsigned long flag, + int indent); + +int X509_check_ca(X509* x); +int X509_check_purpose(X509* x, int id, int ca); +int X509_supported_extension(X509_EXTENSION* ex); +int X509_PURPOSE_set(int* p, int purpose); +int X509_check_issued(X509* issuer, X509* subject); +int X509_check_akid(X509* issuer, AUTHORITY_KEYID* akid); +int X509_PURPOSE_get_count(void); +X509_PURPOSE* X509_PURPOSE_get0(int idx); +int X509_PURPOSE_get_by_sname(char* sname); +int X509_PURPOSE_get_by_id(int id); +int X509_PURPOSE_add( + int id, + int trust, + int flags, + int (*ck)(const X509_PURPOSE*, const X509*, int), + char* name, + char* sname, + void* arg); +char* X509_PURPOSE_get0_name(X509_PURPOSE* xp); +char* X509_PURPOSE_get0_sname(X509_PURPOSE* xp); +int X509_PURPOSE_get_trust(X509_PURPOSE* xp); +void X509_PURPOSE_cleanup(void); +int X509_PURPOSE_get_id(X509_PURPOSE*); + +STACK_OF(OPENSSL_STRING) * X509_get1_email(X509* x); +STACK_OF(OPENSSL_STRING) * X509_REQ_get1_email(X509_REQ* x); +void X509_email_free(STACK_OF(OPENSSL_STRING) * sk); +STACK_OF(OPENSSL_STRING) * X509_get1_ocsp(X509* x); +/* Flags for X509_check_* functions */ + +/* + * Always check subject name for host match even if subject alt names present + */ +#define X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT 0x1 +/* Disable wildcard matching for dnsName fields and common name. */ +#define X509_CHECK_FLAG_NO_WILDCARDS 0x2 +/* Wildcards must not match a partial label. */ +#define X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS 0x4 +/* Allow (non-partial) wildcards to match multiple labels. */ +#define X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS 0x8 +/* Constraint verifier subdomain patterns to match a single labels. */ +#define X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS 0x10 +/* + * Match reference identifiers starting with "." to any sub-domain. + * This is a non-public flag, turned on implicitly when the subject + * reference identity is a DNS name. + */ +#define _X509_CHECK_FLAG_DOT_SUBDOMAINS 0x8000 + +int X509_check_host( + X509* x, + const char* chk, + size_t chklen, + unsigned int flags, + char** peername); +int X509_check_email( + X509* x, + const char* chk, + size_t chklen, + unsigned int flags); +int X509_check_ip( + X509* x, + const unsigned char* chk, + size_t chklen, + unsigned int flags); +int X509_check_ip_asc(X509* x, const char* ipasc, unsigned int flags); + +ASN1_OCTET_STRING* a2i_IPADDRESS(const char* ipasc); +ASN1_OCTET_STRING* a2i_IPADDRESS_NC(const char* ipasc); +int a2i_ipadd(unsigned char* ipout, const char* ipasc); +int X509V3_NAME_from_section( + X509_NAME* nm, + STACK_OF(CONF_VALUE) * dn_sk, + unsigned long chtype); + +void X509_POLICY_NODE_print(BIO* out, X509_POLICY_NODE* node, int indent); +DECLARE_STACK_OF(X509_POLICY_NODE) + +#ifndef OPENSSL_NO_RFC3779 + +typedef struct ASRange_st { ASN1_INTEGER *min, *max; } ASRange; + +#define ASIdOrRange_id 0 +#define ASIdOrRange_range 1 + +typedef struct ASIdOrRange_st { + int type; + union { + ASN1_INTEGER* id; + ASRange* range; + } u; +} ASIdOrRange; + +typedef STACK_OF(ASIdOrRange) ASIdOrRanges; +DECLARE_STACK_OF(ASIdOrRange) + +#define ASIdentifierChoice_inherit 0 +#define ASIdentifierChoice_asIdsOrRanges 1 + +typedef struct ASIdentifierChoice_st { + int type; + union { + ASN1_NULL* inherit; + ASIdOrRanges* asIdsOrRanges; + } u; +} ASIdentifierChoice; + +typedef struct ASIdentifiers_st { + ASIdentifierChoice *asnum, *rdi; +} ASIdentifiers; + +DECLARE_ASN1_FUNCTIONS(ASRange) +DECLARE_ASN1_FUNCTIONS(ASIdOrRange) +DECLARE_ASN1_FUNCTIONS(ASIdentifierChoice) +DECLARE_ASN1_FUNCTIONS(ASIdentifiers) + +typedef struct IPAddressRange_st { ASN1_BIT_STRING *min, *max; } IPAddressRange; + +#define IPAddressOrRange_addressPrefix 0 +#define IPAddressOrRange_addressRange 1 + +typedef struct IPAddressOrRange_st { + int type; + union { + ASN1_BIT_STRING* addressPrefix; + IPAddressRange* addressRange; + } u; +} IPAddressOrRange; + +typedef STACK_OF(IPAddressOrRange) IPAddressOrRanges; +DECLARE_STACK_OF(IPAddressOrRange) + +#define IPAddressChoice_inherit 0 +#define IPAddressChoice_addressesOrRanges 1 + +typedef struct IPAddressChoice_st { + int type; + union { + ASN1_NULL* inherit; + IPAddressOrRanges* addressesOrRanges; + } u; +} IPAddressChoice; + +typedef struct IPAddressFamily_st { + ASN1_OCTET_STRING* addressFamily; + IPAddressChoice* ipAddressChoice; +} IPAddressFamily; + +typedef STACK_OF(IPAddressFamily) IPAddrBlocks; +DECLARE_STACK_OF(IPAddressFamily) + +DECLARE_ASN1_FUNCTIONS(IPAddressRange) +DECLARE_ASN1_FUNCTIONS(IPAddressOrRange) +DECLARE_ASN1_FUNCTIONS(IPAddressChoice) +DECLARE_ASN1_FUNCTIONS(IPAddressFamily) + +/* + * API tag for elements of the ASIdentifer SEQUENCE. + */ +#define V3_ASID_ASNUM 0 +#define V3_ASID_RDI 1 + +/* + * AFI values, assigned by IANA. It'd be nice to make the AFI + * handling code totally generic, but there are too many little things + * that would need to be defined for other address families for it to + * be worth the trouble. + */ +#define IANA_AFI_IPV4 1 +#define IANA_AFI_IPV6 2 + +/* + * Utilities to construct and extract values from RFC3779 extensions, + * since some of the encodings (particularly for IP address prefixes + * and ranges) are a bit tedious to work with directly. + */ +int v3_asid_add_inherit(ASIdentifiers* asid, int which); +int v3_asid_add_id_or_range( + ASIdentifiers* asid, + int which, + ASN1_INTEGER* min, + ASN1_INTEGER* max); +int v3_addr_add_inherit( + IPAddrBlocks* addr, + const unsigned afi, + const unsigned* safi); +int v3_addr_add_prefix( + IPAddrBlocks* addr, + const unsigned afi, + const unsigned* safi, + unsigned char* a, + const int prefixlen); +int v3_addr_add_range( + IPAddrBlocks* addr, + const unsigned afi, + const unsigned* safi, + unsigned char* min, + unsigned char* max); +unsigned v3_addr_get_afi(const IPAddressFamily* f); +int v3_addr_get_range( + IPAddressOrRange* aor, + const unsigned afi, + unsigned char* min, + unsigned char* max, + const int length); + +/* + * Canonical forms. + */ +int v3_asid_is_canonical(ASIdentifiers* asid); +int v3_addr_is_canonical(IPAddrBlocks* addr); +int v3_asid_canonize(ASIdentifiers* asid); +int v3_addr_canonize(IPAddrBlocks* addr); + +/* + * Tests for inheritance and containment. + */ +int v3_asid_inherits(ASIdentifiers* asid); +int v3_addr_inherits(IPAddrBlocks* addr); +int v3_asid_subset(ASIdentifiers* a, ASIdentifiers* b); +int v3_addr_subset(IPAddrBlocks* a, IPAddrBlocks* b); + +/* + * Check whether RFC 3779 extensions nest properly in chains. + */ +int v3_asid_validate_path(X509_STORE_CTX*); +int v3_addr_validate_path(X509_STORE_CTX*); +int v3_asid_validate_resource_set( + STACK_OF(X509) * chain, + ASIdentifiers* ext, + int allow_inheritance); +int v3_addr_validate_resource_set( + STACK_OF(X509) * chain, + IPAddrBlocks* ext, + int allow_inheritance); + +#endif /* OPENSSL_NO_RFC3779 */ + +/* BEGIN ERROR CODES */ +/* + * The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_X509V3_strings(void); + +/* Error codes for the X509V3 functions. */ + +/* Function codes. */ +#define X509V3_F_A2I_GENERAL_NAME 164 +#define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE 161 +#define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL 162 +#define X509V3_F_COPY_EMAIL 122 +#define X509V3_F_COPY_ISSUER 123 +#define X509V3_F_DO_DIRNAME 144 +#define X509V3_F_DO_EXT_CONF 124 +#define X509V3_F_DO_EXT_I2D 135 +#define X509V3_F_DO_EXT_NCONF 151 +#define X509V3_F_DO_I2V_NAME_CONSTRAINTS 148 +#define X509V3_F_GNAMES_FROM_SECTNAME 156 +#define X509V3_F_HEX_TO_STRING 111 +#define X509V3_F_I2S_ASN1_ENUMERATED 121 +#define X509V3_F_I2S_ASN1_IA5STRING 149 +#define X509V3_F_I2S_ASN1_INTEGER 120 +#define X509V3_F_I2V_AUTHORITY_INFO_ACCESS 138 +#define X509V3_F_NOTICE_SECTION 132 +#define X509V3_F_NREF_NOS 133 +#define X509V3_F_POLICY_SECTION 131 +#define X509V3_F_PROCESS_PCI_VALUE 150 +#define X509V3_F_R2I_CERTPOL 130 +#define X509V3_F_R2I_PCI 155 +#define X509V3_F_S2I_ASN1_IA5STRING 100 +#define X509V3_F_S2I_ASN1_INTEGER 108 +#define X509V3_F_S2I_ASN1_OCTET_STRING 112 +#define X509V3_F_S2I_ASN1_SKEY_ID 114 +#define X509V3_F_S2I_SKEY_ID 115 +#define X509V3_F_SET_DIST_POINT_NAME 158 +#define X509V3_F_STRING_TO_HEX 113 +#define X509V3_F_SXNET_ADD_ID_ASC 125 +#define X509V3_F_SXNET_ADD_ID_INTEGER 126 +#define X509V3_F_SXNET_ADD_ID_ULONG 127 +#define X509V3_F_SXNET_GET_ID_ASC 128 +#define X509V3_F_SXNET_GET_ID_ULONG 129 +#define X509V3_F_V2I_ASIDENTIFIERS 163 +#define X509V3_F_V2I_ASN1_BIT_STRING 101 +#define X509V3_F_V2I_AUTHORITY_INFO_ACCESS 139 +#define X509V3_F_V2I_AUTHORITY_KEYID 119 +#define X509V3_F_V2I_BASIC_CONSTRAINTS 102 +#define X509V3_F_V2I_CRLD 134 +#define X509V3_F_V2I_EXTENDED_KEY_USAGE 103 +#define X509V3_F_V2I_GENERAL_NAMES 118 +#define X509V3_F_V2I_GENERAL_NAME_EX 117 +#define X509V3_F_V2I_IDP 157 +#define X509V3_F_V2I_IPADDRBLOCKS 159 +#define X509V3_F_V2I_ISSUER_ALT 153 +#define X509V3_F_V2I_NAME_CONSTRAINTS 147 +#define X509V3_F_V2I_POLICY_CONSTRAINTS 146 +#define X509V3_F_V2I_POLICY_MAPPINGS 145 +#define X509V3_F_V2I_SUBJECT_ALT 154 +#define X509V3_F_V3_ADDR_VALIDATE_PATH_INTERNAL 160 +#define X509V3_F_V3_GENERIC_EXTENSION 116 +#define X509V3_F_X509V3_ADD1_I2D 140 +#define X509V3_F_X509V3_ADD_VALUE 105 +#define X509V3_F_X509V3_EXT_ADD 104 +#define X509V3_F_X509V3_EXT_ADD_ALIAS 106 +#define X509V3_F_X509V3_EXT_CONF 107 +#define X509V3_F_X509V3_EXT_FREE 165 +#define X509V3_F_X509V3_EXT_I2D 136 +#define X509V3_F_X509V3_EXT_NCONF 152 +#define X509V3_F_X509V3_GET_SECTION 142 +#define X509V3_F_X509V3_GET_STRING 143 +#define X509V3_F_X509V3_GET_VALUE_BOOL 110 +#define X509V3_F_X509V3_PARSE_LIST 109 +#define X509V3_F_X509_PURPOSE_ADD 137 +#define X509V3_F_X509_PURPOSE_SET 141 + +/* Reason codes. */ +#define X509V3_R_BAD_IP_ADDRESS 118 +#define X509V3_R_BAD_OBJECT 119 +#define X509V3_R_BN_DEC2BN_ERROR 100 +#define X509V3_R_BN_TO_ASN1_INTEGER_ERROR 101 +#define X509V3_R_CANNOT_FIND_FREE_FUNCTION 168 +#define X509V3_R_DIRNAME_ERROR 149 +#define X509V3_R_DISTPOINT_ALREADY_SET 160 +#define X509V3_R_DUPLICATE_ZONE_ID 133 +#define X509V3_R_ERROR_CONVERTING_ZONE 131 +#define X509V3_R_ERROR_CREATING_EXTENSION 144 +#define X509V3_R_ERROR_IN_EXTENSION 128 +#define X509V3_R_EXPECTED_A_SECTION_NAME 137 +#define X509V3_R_EXTENSION_EXISTS 145 +#define X509V3_R_EXTENSION_NAME_ERROR 115 +#define X509V3_R_EXTENSION_NOT_FOUND 102 +#define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED 103 +#define X509V3_R_EXTENSION_VALUE_ERROR 116 +#define X509V3_R_ILLEGAL_EMPTY_EXTENSION 151 +#define X509V3_R_ILLEGAL_HEX_DIGIT 113 +#define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG 152 +#define X509V3_R_INVALID_ASNUMBER 162 +#define X509V3_R_INVALID_ASRANGE 163 +#define X509V3_R_INVALID_BOOLEAN_STRING 104 +#define X509V3_R_INVALID_EXTENSION_STRING 105 +#define X509V3_R_INVALID_INHERITANCE 165 +#define X509V3_R_INVALID_IPADDRESS 166 +#define X509V3_R_INVALID_MULTIPLE_RDNS 161 +#define X509V3_R_INVALID_NAME 106 +#define X509V3_R_INVALID_NULL_ARGUMENT 107 +#define X509V3_R_INVALID_NULL_NAME 108 +#define X509V3_R_INVALID_NULL_VALUE 109 +#define X509V3_R_INVALID_NUMBER 140 +#define X509V3_R_INVALID_NUMBERS 141 +#define X509V3_R_INVALID_OBJECT_IDENTIFIER 110 +#define X509V3_R_INVALID_OPTION 138 +#define X509V3_R_INVALID_POLICY_IDENTIFIER 134 +#define X509V3_R_INVALID_PROXY_POLICY_SETTING 153 +#define X509V3_R_INVALID_PURPOSE 146 +#define X509V3_R_INVALID_SAFI 164 +#define X509V3_R_INVALID_SECTION 135 +#define X509V3_R_INVALID_SYNTAX 143 +#define X509V3_R_ISSUER_DECODE_ERROR 126 +#define X509V3_R_MISSING_VALUE 124 +#define X509V3_R_NEED_ORGANIZATION_AND_NUMBERS 142 +#define X509V3_R_NO_CONFIG_DATABASE 136 +#define X509V3_R_NO_ISSUER_CERTIFICATE 121 +#define X509V3_R_NO_ISSUER_DETAILS 127 +#define X509V3_R_NO_POLICY_IDENTIFIER 139 +#define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED 154 +#define X509V3_R_NO_PUBLIC_KEY 114 +#define X509V3_R_NO_SUBJECT_DETAILS 125 +#define X509V3_R_ODD_NUMBER_OF_DIGITS 112 +#define X509V3_R_OPERATION_NOT_DEFINED 148 +#define X509V3_R_OTHERNAME_ERROR 147 +#define X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED 155 +#define X509V3_R_POLICY_PATH_LENGTH 156 +#define X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED 157 +#define X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED 158 +#define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 159 +#define X509V3_R_SECTION_NOT_FOUND 150 +#define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS 122 +#define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID 123 +#define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT 111 +#define X509V3_R_UNKNOWN_EXTENSION 129 +#define X509V3_R_UNKNOWN_EXTENSION_NAME 130 +#define X509V3_R_UNKNOWN_OPTION 120 +#define X509V3_R_UNSUPPORTED_OPTION 117 +#define X509V3_R_UNSUPPORTED_TYPE 167 +#define X509V3_R_USER_TOO_LONG 132 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/panel.h b/src_cpp/elfgames/tasks/elf2codingenv/include/panel.h new file mode 100644 index 0000000..104d587 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/panel.h @@ -0,0 +1,88 @@ +/**************************************************************************** + * Copyright (c) 1998-2009,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1995 * + * and: Eric S. Raymond * + * and: Juergen Pfeifer 1996-1999,2008 * + ****************************************************************************/ + +/* $Id: panel.h,v 1.12 2017/02/11 16:50:28 tom Exp $ */ + +/* panel.h -- interface file for panels library */ + +#ifndef NCURSES_PANEL_H_incl +#define NCURSES_PANEL_H_incl 1 + +#include + +typedef struct panel +#if !NCURSES_OPAQUE_PANEL +{ + WINDOW* win; + struct panel* below; + struct panel* above; + NCURSES_CONST void* user; +} +#endif /* !NCURSES_OPAQUE_PANEL */ +PANEL; + +#if defined(__cplusplus) +extern "C" { +#endif + +extern NCURSES_EXPORT(WINDOW*) panel_window(const PANEL*); +extern NCURSES_EXPORT(void) update_panels(void); +extern NCURSES_EXPORT(int) hide_panel(PANEL*); +extern NCURSES_EXPORT(int) show_panel(PANEL*); +extern NCURSES_EXPORT(int) del_panel(PANEL*); +extern NCURSES_EXPORT(int) top_panel(PANEL*); +extern NCURSES_EXPORT(int) bottom_panel(PANEL*); +extern NCURSES_EXPORT(PANEL*) new_panel(WINDOW*); +extern NCURSES_EXPORT(PANEL*) panel_above(const PANEL*); +extern NCURSES_EXPORT(PANEL*) panel_below(const PANEL*); +extern NCURSES_EXPORT(int) set_panel_userptr(PANEL*, NCURSES_CONST void*); +extern NCURSES_EXPORT(NCURSES_CONST void*) panel_userptr(const PANEL*); +extern NCURSES_EXPORT(int) move_panel(PANEL*, int, int); +extern NCURSES_EXPORT(int) replace_panel(PANEL*, WINDOW*); +extern NCURSES_EXPORT(int) panel_hidden(const PANEL*); + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(PANEL*) ground_panel(SCREEN*); +extern NCURSES_EXPORT(PANEL*) ceiling_panel(SCREEN*); + +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(update_panels)(SCREEN*); +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /* NCURSES_PANEL_H_incl */ + +/* end of panel.h */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/pqStubs.h b/src_cpp/elfgames/tasks/elf2codingenv/include/pqStubs.h new file mode 100644 index 0000000..f0e611c --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/pqStubs.h @@ -0,0 +1,92 @@ +/* + *----------------------------------------------------------------------------- + * + * ../generic/pqStubs.h -- + * + * Stubs for procedures in pqStubDefs.txt + * + * Generated by genExtStubs.tcl: DO NOT EDIT + * 2015-06-26 12:55:15Z + * + *----------------------------------------------------------------------------- + */ + +typedef struct pqStubDefs { + /* Functions from libraries: pq */ + + const char* (*pg_encoding_to_charPtr)(int); + void (*PQclearPtr)(PGresult*); + int (*PQclientEncodingPtr)(const PGconn*); + char* (*PQcmdTuplesPtr)(PGresult*); + PGconn* (*PQconnectdbPtr)(const char*); + char* (*PQerrorMessagePtr)(const PGconn*); + PGresult* (*PQdescribePreparedPtr)(PGconn*, const char*); + PGresult* (*PQexecPtr)(PGconn*, const char*); + PGresult* (*PQexecPreparedPtr)( + PGconn*, + const char*, + int, + const char* const*, + const int*, + const int*, + int); + char* (*PQdbPtr)(const PGconn*); + void (*PQfinishPtr)(PGconn*); + char* (*PQfnamePtr)(PGresult*, int); + int (*PQfnumberPtr)(const PGresult*, const char*); + Oid (*PQftypePtr)(const PGresult*, int); + int (*PQgetisnullPtr)(const PGresult*, int, int); + int (*PQgetlengthPtr)(const PGresult*, int, int); + char* (*PQgetvaluePtr)(const PGresult*, int, int); + char* (*PQhostPtr)(const PGconn*); + int (*PQnfieldsPtr)(const PGresult*); + int (*PQnparamsPtr)(const PGresult*); + int (*PQntuplesPtr)(const PGresult*); + char* (*PQoptionsPtr)(const PGconn*); + Oid (*PQparamtypePtr)(const PGresult*, int); + char* (*PQpassPtr)(const PGconn*); + char* (*PQportPtr)(const PGconn*); + PGresult* (*PQpreparePtr)(PGconn*, const char*, const char*, int, const Oid*); + char* (*PQresultErrorFieldPtr)(const PGresult*, int); + ExecStatusType (*PQresultStatusPtr)(const PGresult*); + int (*PQsetClientEncodingPtr)(PGconn*, const char*); + PQnoticeProcessor ( + *PQsetNoticeProcessorPtr)(PGconn*, PQnoticeProcessor, void*); + ConnStatusType (*PQstatusPtr)(PGconn*); + char* (*PQuserPtr)(const PGconn*); + char* (*PQttyPtr)(const PGconn*); +} pqStubDefs; +#define pg_encoding_to_char (pqStubs->pg_encoding_to_charPtr) +#define PQclear (pqStubs->PQclearPtr) +#define PQclientEncoding (pqStubs->PQclientEncodingPtr) +#define PQcmdTuples (pqStubs->PQcmdTuplesPtr) +#define PQconnectdb (pqStubs->PQconnectdbPtr) +#define PQerrorMessage (pqStubs->PQerrorMessagePtr) +#define PQdescribePrepared (pqStubs->PQdescribePreparedPtr) +#define PQexec (pqStubs->PQexecPtr) +#define PQexecPrepared (pqStubs->PQexecPreparedPtr) +#define PQdb (pqStubs->PQdbPtr) +#define PQfinish (pqStubs->PQfinishPtr) +#define PQfname (pqStubs->PQfnamePtr) +#define PQfnumber (pqStubs->PQfnumberPtr) +#define PQftype (pqStubs->PQftypePtr) +#define PQgetisnull (pqStubs->PQgetisnullPtr) +#define PQgetlength (pqStubs->PQgetlengthPtr) +#define PQgetvalue (pqStubs->PQgetvaluePtr) +#define PQhost (pqStubs->PQhostPtr) +#define PQnfields (pqStubs->PQnfieldsPtr) +#define PQnparams (pqStubs->PQnparamsPtr) +#define PQntuples (pqStubs->PQntuplesPtr) +#define PQoptions (pqStubs->PQoptionsPtr) +#define PQparamtype (pqStubs->PQparamtypePtr) +#define PQpass (pqStubs->PQpassPtr) +#define PQport (pqStubs->PQportPtr) +#define PQprepare (pqStubs->PQpreparePtr) +#define PQresultErrorField (pqStubs->PQresultErrorFieldPtr) +#define PQresultStatus (pqStubs->PQresultStatusPtr) +#define PQsetClientEncoding (pqStubs->PQsetClientEncodingPtr) +#define PQsetNoticeProcessor (pqStubs->PQsetNoticeProcessorPtr) +#define PQstatus (pqStubs->PQstatusPtr) +#define PQuser (pqStubs->PQuserPtr) +#define PQtty (pqStubs->PQttyPtr) +MODULE_SCOPE const pqStubDefs* pqStubs; diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/Python-ast.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/Python-ast.h new file mode 100644 index 0000000..990d34e --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/Python-ast.h @@ -0,0 +1,898 @@ +/* File automatically generated by Parser/asdl_c.py. */ + +#include "asdl.h" + +typedef struct _mod* mod_ty; + +typedef struct _stmt* stmt_ty; + +typedef struct _expr* expr_ty; + +typedef enum _expr_context { + Load = 1, + Store = 2, + Del = 3, + AugLoad = 4, + AugStore = 5, + Param = 6 +} expr_context_ty; + +typedef struct _slice* slice_ty; + +typedef enum _boolop { And = 1, Or = 2 } boolop_ty; + +typedef enum _operator { + Add = 1, + Sub = 2, + Mult = 3, + MatMult = 4, + Div = 5, + Mod = 6, + Pow = 7, + LShift = 8, + RShift = 9, + BitOr = 10, + BitXor = 11, + BitAnd = 12, + FloorDiv = 13 +} operator_ty; + +typedef enum _unaryop { Invert = 1, Not = 2, UAdd = 3, USub = 4 } unaryop_ty; + +typedef enum _cmpop { + Eq = 1, + NotEq = 2, + Lt = 3, + LtE = 4, + Gt = 5, + GtE = 6, + Is = 7, + IsNot = 8, + In = 9, + NotIn = 10 +} cmpop_ty; + +typedef struct _comprehension* comprehension_ty; + +typedef struct _excepthandler* excepthandler_ty; + +typedef struct _arguments* arguments_ty; + +typedef struct _arg* arg_ty; + +typedef struct _keyword* keyword_ty; + +typedef struct _alias* alias_ty; + +typedef struct _withitem* withitem_ty; + +enum _mod_kind { + Module_kind = 1, + Interactive_kind = 2, + Expression_kind = 3, + Suite_kind = 4 +}; +struct _mod { + enum _mod_kind kind; + union { + struct { + asdl_seq* body; + } Module; + + struct { + asdl_seq* body; + } Interactive; + + struct { + expr_ty body; + } Expression; + + struct { + asdl_seq* body; + } Suite; + + } v; +}; + +enum _stmt_kind { + FunctionDef_kind = 1, + AsyncFunctionDef_kind = 2, + ClassDef_kind = 3, + Return_kind = 4, + Delete_kind = 5, + Assign_kind = 6, + AugAssign_kind = 7, + AnnAssign_kind = 8, + For_kind = 9, + AsyncFor_kind = 10, + While_kind = 11, + If_kind = 12, + With_kind = 13, + AsyncWith_kind = 14, + Raise_kind = 15, + Try_kind = 16, + Assert_kind = 17, + Import_kind = 18, + ImportFrom_kind = 19, + Global_kind = 20, + Nonlocal_kind = 21, + Expr_kind = 22, + Pass_kind = 23, + Break_kind = 24, + Continue_kind = 25 +}; +struct _stmt { + enum _stmt_kind kind; + union { + struct { + identifier name; + arguments_ty args; + asdl_seq* body; + asdl_seq* decorator_list; + expr_ty returns; + } FunctionDef; + + struct { + identifier name; + arguments_ty args; + asdl_seq* body; + asdl_seq* decorator_list; + expr_ty returns; + } AsyncFunctionDef; + + struct { + identifier name; + asdl_seq* bases; + asdl_seq* keywords; + asdl_seq* body; + asdl_seq* decorator_list; + } ClassDef; + + struct { + expr_ty value; + } Return; + + struct { + asdl_seq* targets; + } Delete; + + struct { + asdl_seq* targets; + expr_ty value; + } Assign; + + struct { + expr_ty target; + operator_ty op; + expr_ty value; + } AugAssign; + + struct { + expr_ty target; + expr_ty annotation; + expr_ty value; + int simple; + } AnnAssign; + + struct { + expr_ty target; + expr_ty iter; + asdl_seq* body; + asdl_seq* orelse; + } For; + + struct { + expr_ty target; + expr_ty iter; + asdl_seq* body; + asdl_seq* orelse; + } AsyncFor; + + struct { + expr_ty test; + asdl_seq* body; + asdl_seq* orelse; + } While; + + struct { + expr_ty test; + asdl_seq* body; + asdl_seq* orelse; + } If; + + struct { + asdl_seq* items; + asdl_seq* body; + } With; + + struct { + asdl_seq* items; + asdl_seq* body; + } AsyncWith; + + struct { + expr_ty exc; + expr_ty cause; + } Raise; + + struct { + asdl_seq* body; + asdl_seq* handlers; + asdl_seq* orelse; + asdl_seq* finalbody; + } Try; + + struct { + expr_ty test; + expr_ty msg; + } Assert; + + struct { + asdl_seq* names; + } Import; + + struct { + identifier module; + asdl_seq* names; + int level; + } ImportFrom; + + struct { + asdl_seq* names; + } Global; + + struct { + asdl_seq* names; + } Nonlocal; + + struct { + expr_ty value; + } Expr; + + } v; + int lineno; + int col_offset; +}; + +enum _expr_kind { + BoolOp_kind = 1, + BinOp_kind = 2, + UnaryOp_kind = 3, + Lambda_kind = 4, + IfExp_kind = 5, + Dict_kind = 6, + Set_kind = 7, + ListComp_kind = 8, + SetComp_kind = 9, + DictComp_kind = 10, + GeneratorExp_kind = 11, + Await_kind = 12, + Yield_kind = 13, + YieldFrom_kind = 14, + Compare_kind = 15, + Call_kind = 16, + Num_kind = 17, + Str_kind = 18, + FormattedValue_kind = 19, + JoinedStr_kind = 20, + Bytes_kind = 21, + NameConstant_kind = 22, + Ellipsis_kind = 23, + Constant_kind = 24, + Attribute_kind = 25, + Subscript_kind = 26, + Starred_kind = 27, + Name_kind = 28, + List_kind = 29, + Tuple_kind = 30 +}; +struct _expr { + enum _expr_kind kind; + union { + struct { + boolop_ty op; + asdl_seq* values; + } BoolOp; + + struct { + expr_ty left; + operator_ty op; + expr_ty right; + } BinOp; + + struct { + unaryop_ty op; + expr_ty operand; + } UnaryOp; + + struct { + arguments_ty args; + expr_ty body; + } Lambda; + + struct { + expr_ty test; + expr_ty body; + expr_ty orelse; + } IfExp; + + struct { + asdl_seq* keys; + asdl_seq* values; + } Dict; + + struct { + asdl_seq* elts; + } Set; + + struct { + expr_ty elt; + asdl_seq* generators; + } ListComp; + + struct { + expr_ty elt; + asdl_seq* generators; + } SetComp; + + struct { + expr_ty key; + expr_ty value; + asdl_seq* generators; + } DictComp; + + struct { + expr_ty elt; + asdl_seq* generators; + } GeneratorExp; + + struct { + expr_ty value; + } Await; + + struct { + expr_ty value; + } Yield; + + struct { + expr_ty value; + } YieldFrom; + + struct { + expr_ty left; + asdl_int_seq* ops; + asdl_seq* comparators; + } Compare; + + struct { + expr_ty func; + asdl_seq* args; + asdl_seq* keywords; + } Call; + + struct { + object n; + } Num; + + struct { + string s; + } Str; + + struct { + expr_ty value; + int conversion; + expr_ty format_spec; + } FormattedValue; + + struct { + asdl_seq* values; + } JoinedStr; + + struct { + bytes s; + } Bytes; + + struct { + singleton value; + } NameConstant; + + struct { + constant value; + } Constant; + + struct { + expr_ty value; + identifier attr; + expr_context_ty ctx; + } Attribute; + + struct { + expr_ty value; + slice_ty slice; + expr_context_ty ctx; + } Subscript; + + struct { + expr_ty value; + expr_context_ty ctx; + } Starred; + + struct { + identifier id; + expr_context_ty ctx; + } Name; + + struct { + asdl_seq* elts; + expr_context_ty ctx; + } List; + + struct { + asdl_seq* elts; + expr_context_ty ctx; + } Tuple; + + } v; + int lineno; + int col_offset; +}; + +enum _slice_kind { Slice_kind = 1, ExtSlice_kind = 2, Index_kind = 3 }; +struct _slice { + enum _slice_kind kind; + union { + struct { + expr_ty lower; + expr_ty upper; + expr_ty step; + } Slice; + + struct { + asdl_seq* dims; + } ExtSlice; + + struct { + expr_ty value; + } Index; + + } v; +}; + +struct _comprehension { + expr_ty target; + expr_ty iter; + asdl_seq* ifs; + int is_async; +}; + +enum _excepthandler_kind { ExceptHandler_kind = 1 }; +struct _excepthandler { + enum _excepthandler_kind kind; + union { + struct { + expr_ty type; + identifier name; + asdl_seq* body; + } ExceptHandler; + + } v; + int lineno; + int col_offset; +}; + +struct _arguments { + asdl_seq* args; + arg_ty vararg; + asdl_seq* kwonlyargs; + asdl_seq* kw_defaults; + arg_ty kwarg; + asdl_seq* defaults; +}; + +struct _arg { + identifier arg; + expr_ty annotation; + int lineno; + int col_offset; +}; + +struct _keyword { + identifier arg; + expr_ty value; +}; + +struct _alias { + identifier name; + identifier asname; +}; + +struct _withitem { + expr_ty context_expr; + expr_ty optional_vars; +}; + +#define Module(a0, a1) _Py_Module(a0, a1) +mod_ty _Py_Module(asdl_seq* body, PyArena* arena); +#define Interactive(a0, a1) _Py_Interactive(a0, a1) +mod_ty _Py_Interactive(asdl_seq* body, PyArena* arena); +#define Expression(a0, a1) _Py_Expression(a0, a1) +mod_ty _Py_Expression(expr_ty body, PyArena* arena); +#define Suite(a0, a1) _Py_Suite(a0, a1) +mod_ty _Py_Suite(asdl_seq* body, PyArena* arena); +#define FunctionDef(a0, a1, a2, a3, a4, a5, a6, a7) \ + _Py_FunctionDef(a0, a1, a2, a3, a4, a5, a6, a7) +stmt_ty _Py_FunctionDef( + identifier name, + arguments_ty args, + asdl_seq* body, + asdl_seq* decorator_list, + expr_ty returns, + int lineno, + int col_offset, + PyArena* arena); +#define AsyncFunctionDef(a0, a1, a2, a3, a4, a5, a6, a7) \ + _Py_AsyncFunctionDef(a0, a1, a2, a3, a4, a5, a6, a7) +stmt_ty _Py_AsyncFunctionDef( + identifier name, + arguments_ty args, + asdl_seq* body, + asdl_seq* decorator_list, + expr_ty returns, + int lineno, + int col_offset, + PyArena* arena); +#define ClassDef(a0, a1, a2, a3, a4, a5, a6, a7) \ + _Py_ClassDef(a0, a1, a2, a3, a4, a5, a6, a7) +stmt_ty _Py_ClassDef( + identifier name, + asdl_seq* bases, + asdl_seq* keywords, + asdl_seq* body, + asdl_seq* decorator_list, + int lineno, + int col_offset, + PyArena* arena); +#define Return(a0, a1, a2, a3) _Py_Return(a0, a1, a2, a3) +stmt_ty _Py_Return(expr_ty value, int lineno, int col_offset, PyArena* arena); +#define Delete(a0, a1, a2, a3) _Py_Delete(a0, a1, a2, a3) +stmt_ty +_Py_Delete(asdl_seq* targets, int lineno, int col_offset, PyArena* arena); +#define Assign(a0, a1, a2, a3, a4) _Py_Assign(a0, a1, a2, a3, a4) +stmt_ty _Py_Assign( + asdl_seq* targets, + expr_ty value, + int lineno, + int col_offset, + PyArena* arena); +#define AugAssign(a0, a1, a2, a3, a4, a5) _Py_AugAssign(a0, a1, a2, a3, a4, a5) +stmt_ty _Py_AugAssign( + expr_ty target, + operator_ty op, + expr_ty value, + int lineno, + int col_offset, + PyArena* arena); +#define AnnAssign(a0, a1, a2, a3, a4, a5, a6) \ + _Py_AnnAssign(a0, a1, a2, a3, a4, a5, a6) +stmt_ty _Py_AnnAssign( + expr_ty target, + expr_ty annotation, + expr_ty value, + int simple, + int lineno, + int col_offset, + PyArena* arena); +#define For(a0, a1, a2, a3, a4, a5, a6) _Py_For(a0, a1, a2, a3, a4, a5, a6) +stmt_ty _Py_For( + expr_ty target, + expr_ty iter, + asdl_seq* body, + asdl_seq* orelse, + int lineno, + int col_offset, + PyArena* arena); +#define AsyncFor(a0, a1, a2, a3, a4, a5, a6) \ + _Py_AsyncFor(a0, a1, a2, a3, a4, a5, a6) +stmt_ty _Py_AsyncFor( + expr_ty target, + expr_ty iter, + asdl_seq* body, + asdl_seq* orelse, + int lineno, + int col_offset, + PyArena* arena); +#define While(a0, a1, a2, a3, a4, a5) _Py_While(a0, a1, a2, a3, a4, a5) +stmt_ty _Py_While( + expr_ty test, + asdl_seq* body, + asdl_seq* orelse, + int lineno, + int col_offset, + PyArena* arena); +#define If(a0, a1, a2, a3, a4, a5) _Py_If(a0, a1, a2, a3, a4, a5) +stmt_ty _Py_If( + expr_ty test, + asdl_seq* body, + asdl_seq* orelse, + int lineno, + int col_offset, + PyArena* arena); +#define With(a0, a1, a2, a3, a4) _Py_With(a0, a1, a2, a3, a4) +stmt_ty _Py_With( + asdl_seq* items, + asdl_seq* body, + int lineno, + int col_offset, + PyArena* arena); +#define AsyncWith(a0, a1, a2, a3, a4) _Py_AsyncWith(a0, a1, a2, a3, a4) +stmt_ty _Py_AsyncWith( + asdl_seq* items, + asdl_seq* body, + int lineno, + int col_offset, + PyArena* arena); +#define Raise(a0, a1, a2, a3, a4) _Py_Raise(a0, a1, a2, a3, a4) +stmt_ty _Py_Raise( + expr_ty exc, + expr_ty cause, + int lineno, + int col_offset, + PyArena* arena); +#define Try(a0, a1, a2, a3, a4, a5, a6) _Py_Try(a0, a1, a2, a3, a4, a5, a6) +stmt_ty _Py_Try( + asdl_seq* body, + asdl_seq* handlers, + asdl_seq* orelse, + asdl_seq* finalbody, + int lineno, + int col_offset, + PyArena* arena); +#define Assert(a0, a1, a2, a3, a4) _Py_Assert(a0, a1, a2, a3, a4) +stmt_ty _Py_Assert( + expr_ty test, + expr_ty msg, + int lineno, + int col_offset, + PyArena* arena); +#define Import(a0, a1, a2, a3) _Py_Import(a0, a1, a2, a3) +stmt_ty _Py_Import(asdl_seq* names, int lineno, int col_offset, PyArena* arena); +#define ImportFrom(a0, a1, a2, a3, a4, a5) \ + _Py_ImportFrom(a0, a1, a2, a3, a4, a5) +stmt_ty _Py_ImportFrom( + identifier module, + asdl_seq* names, + int level, + int lineno, + int col_offset, + PyArena* arena); +#define Global(a0, a1, a2, a3) _Py_Global(a0, a1, a2, a3) +stmt_ty _Py_Global(asdl_seq* names, int lineno, int col_offset, PyArena* arena); +#define Nonlocal(a0, a1, a2, a3) _Py_Nonlocal(a0, a1, a2, a3) +stmt_ty +_Py_Nonlocal(asdl_seq* names, int lineno, int col_offset, PyArena* arena); +#define Expr(a0, a1, a2, a3) _Py_Expr(a0, a1, a2, a3) +stmt_ty _Py_Expr(expr_ty value, int lineno, int col_offset, PyArena* arena); +#define Pass(a0, a1, a2) _Py_Pass(a0, a1, a2) +stmt_ty _Py_Pass(int lineno, int col_offset, PyArena* arena); +#define Break(a0, a1, a2) _Py_Break(a0, a1, a2) +stmt_ty _Py_Break(int lineno, int col_offset, PyArena* arena); +#define Continue(a0, a1, a2) _Py_Continue(a0, a1, a2) +stmt_ty _Py_Continue(int lineno, int col_offset, PyArena* arena); +#define BoolOp(a0, a1, a2, a3, a4) _Py_BoolOp(a0, a1, a2, a3, a4) +expr_ty _Py_BoolOp( + boolop_ty op, + asdl_seq* values, + int lineno, + int col_offset, + PyArena* arena); +#define BinOp(a0, a1, a2, a3, a4, a5) _Py_BinOp(a0, a1, a2, a3, a4, a5) +expr_ty _Py_BinOp( + expr_ty left, + operator_ty op, + expr_ty right, + int lineno, + int col_offset, + PyArena* arena); +#define UnaryOp(a0, a1, a2, a3, a4) _Py_UnaryOp(a0, a1, a2, a3, a4) +expr_ty _Py_UnaryOp( + unaryop_ty op, + expr_ty operand, + int lineno, + int col_offset, + PyArena* arena); +#define Lambda(a0, a1, a2, a3, a4) _Py_Lambda(a0, a1, a2, a3, a4) +expr_ty _Py_Lambda( + arguments_ty args, + expr_ty body, + int lineno, + int col_offset, + PyArena* arena); +#define IfExp(a0, a1, a2, a3, a4, a5) _Py_IfExp(a0, a1, a2, a3, a4, a5) +expr_ty _Py_IfExp( + expr_ty test, + expr_ty body, + expr_ty orelse, + int lineno, + int col_offset, + PyArena* arena); +#define Dict(a0, a1, a2, a3, a4) _Py_Dict(a0, a1, a2, a3, a4) +expr_ty _Py_Dict( + asdl_seq* keys, + asdl_seq* values, + int lineno, + int col_offset, + PyArena* arena); +#define Set(a0, a1, a2, a3) _Py_Set(a0, a1, a2, a3) +expr_ty _Py_Set(asdl_seq* elts, int lineno, int col_offset, PyArena* arena); +#define ListComp(a0, a1, a2, a3, a4) _Py_ListComp(a0, a1, a2, a3, a4) +expr_ty _Py_ListComp( + expr_ty elt, + asdl_seq* generators, + int lineno, + int col_offset, + PyArena* arena); +#define SetComp(a0, a1, a2, a3, a4) _Py_SetComp(a0, a1, a2, a3, a4) +expr_ty _Py_SetComp( + expr_ty elt, + asdl_seq* generators, + int lineno, + int col_offset, + PyArena* arena); +#define DictComp(a0, a1, a2, a3, a4, a5) _Py_DictComp(a0, a1, a2, a3, a4, a5) +expr_ty _Py_DictComp( + expr_ty key, + expr_ty value, + asdl_seq* generators, + int lineno, + int col_offset, + PyArena* arena); +#define GeneratorExp(a0, a1, a2, a3, a4) _Py_GeneratorExp(a0, a1, a2, a3, a4) +expr_ty _Py_GeneratorExp( + expr_ty elt, + asdl_seq* generators, + int lineno, + int col_offset, + PyArena* arena); +#define Await(a0, a1, a2, a3) _Py_Await(a0, a1, a2, a3) +expr_ty _Py_Await(expr_ty value, int lineno, int col_offset, PyArena* arena); +#define Yield(a0, a1, a2, a3) _Py_Yield(a0, a1, a2, a3) +expr_ty _Py_Yield(expr_ty value, int lineno, int col_offset, PyArena* arena); +#define YieldFrom(a0, a1, a2, a3) _Py_YieldFrom(a0, a1, a2, a3) +expr_ty +_Py_YieldFrom(expr_ty value, int lineno, int col_offset, PyArena* arena); +#define Compare(a0, a1, a2, a3, a4, a5) _Py_Compare(a0, a1, a2, a3, a4, a5) +expr_ty _Py_Compare( + expr_ty left, + asdl_int_seq* ops, + asdl_seq* comparators, + int lineno, + int col_offset, + PyArena* arena); +#define Call(a0, a1, a2, a3, a4, a5) _Py_Call(a0, a1, a2, a3, a4, a5) +expr_ty _Py_Call( + expr_ty func, + asdl_seq* args, + asdl_seq* keywords, + int lineno, + int col_offset, + PyArena* arena); +#define Num(a0, a1, a2, a3) _Py_Num(a0, a1, a2, a3) +expr_ty _Py_Num(object n, int lineno, int col_offset, PyArena* arena); +#define Str(a0, a1, a2, a3) _Py_Str(a0, a1, a2, a3) +expr_ty _Py_Str(string s, int lineno, int col_offset, PyArena* arena); +#define FormattedValue(a0, a1, a2, a3, a4, a5) \ + _Py_FormattedValue(a0, a1, a2, a3, a4, a5) +expr_ty _Py_FormattedValue( + expr_ty value, + int conversion, + expr_ty format_spec, + int lineno, + int col_offset, + PyArena* arena); +#define JoinedStr(a0, a1, a2, a3) _Py_JoinedStr(a0, a1, a2, a3) +expr_ty +_Py_JoinedStr(asdl_seq* values, int lineno, int col_offset, PyArena* arena); +#define Bytes(a0, a1, a2, a3) _Py_Bytes(a0, a1, a2, a3) +expr_ty _Py_Bytes(bytes s, int lineno, int col_offset, PyArena* arena); +#define NameConstant(a0, a1, a2, a3) _Py_NameConstant(a0, a1, a2, a3) +expr_ty +_Py_NameConstant(singleton value, int lineno, int col_offset, PyArena* arena); +#define Ellipsis(a0, a1, a2) _Py_Ellipsis(a0, a1, a2) +expr_ty _Py_Ellipsis(int lineno, int col_offset, PyArena* arena); +#define Constant(a0, a1, a2, a3) _Py_Constant(a0, a1, a2, a3) +expr_ty +_Py_Constant(constant value, int lineno, int col_offset, PyArena* arena); +#define Attribute(a0, a1, a2, a3, a4, a5) _Py_Attribute(a0, a1, a2, a3, a4, a5) +expr_ty _Py_Attribute( + expr_ty value, + identifier attr, + expr_context_ty ctx, + int lineno, + int col_offset, + PyArena* arena); +#define Subscript(a0, a1, a2, a3, a4, a5) _Py_Subscript(a0, a1, a2, a3, a4, a5) +expr_ty _Py_Subscript( + expr_ty value, + slice_ty slice, + expr_context_ty ctx, + int lineno, + int col_offset, + PyArena* arena); +#define Starred(a0, a1, a2, a3, a4) _Py_Starred(a0, a1, a2, a3, a4) +expr_ty _Py_Starred( + expr_ty value, + expr_context_ty ctx, + int lineno, + int col_offset, + PyArena* arena); +#define Name(a0, a1, a2, a3, a4) _Py_Name(a0, a1, a2, a3, a4) +expr_ty _Py_Name( + identifier id, + expr_context_ty ctx, + int lineno, + int col_offset, + PyArena* arena); +#define List(a0, a1, a2, a3, a4) _Py_List(a0, a1, a2, a3, a4) +expr_ty _Py_List( + asdl_seq* elts, + expr_context_ty ctx, + int lineno, + int col_offset, + PyArena* arena); +#define Tuple(a0, a1, a2, a3, a4) _Py_Tuple(a0, a1, a2, a3, a4) +expr_ty _Py_Tuple( + asdl_seq* elts, + expr_context_ty ctx, + int lineno, + int col_offset, + PyArena* arena); +#define Slice(a0, a1, a2, a3) _Py_Slice(a0, a1, a2, a3) +slice_ty _Py_Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena* arena); +#define ExtSlice(a0, a1) _Py_ExtSlice(a0, a1) +slice_ty _Py_ExtSlice(asdl_seq* dims, PyArena* arena); +#define Index(a0, a1) _Py_Index(a0, a1) +slice_ty _Py_Index(expr_ty value, PyArena* arena); +#define comprehension(a0, a1, a2, a3, a4) _Py_comprehension(a0, a1, a2, a3, a4) +comprehension_ty _Py_comprehension( + expr_ty target, + expr_ty iter, + asdl_seq* ifs, + int is_async, + PyArena* arena); +#define ExceptHandler(a0, a1, a2, a3, a4, a5) \ + _Py_ExceptHandler(a0, a1, a2, a3, a4, a5) +excepthandler_ty _Py_ExceptHandler( + expr_ty type, + identifier name, + asdl_seq* body, + int lineno, + int col_offset, + PyArena* arena); +#define arguments(a0, a1, a2, a3, a4, a5, a6) \ + _Py_arguments(a0, a1, a2, a3, a4, a5, a6) +arguments_ty _Py_arguments( + asdl_seq* args, + arg_ty vararg, + asdl_seq* kwonlyargs, + asdl_seq* kw_defaults, + arg_ty kwarg, + asdl_seq* defaults, + PyArena* arena); +#define arg(a0, a1, a2, a3, a4) _Py_arg(a0, a1, a2, a3, a4) +arg_ty _Py_arg( + identifier arg, + expr_ty annotation, + int lineno, + int col_offset, + PyArena* arena); +#define keyword(a0, a1, a2) _Py_keyword(a0, a1, a2) +keyword_ty _Py_keyword(identifier arg, expr_ty value, PyArena* arena); +#define alias(a0, a1, a2) _Py_alias(a0, a1, a2) +alias_ty _Py_alias(identifier name, identifier asname, PyArena* arena); +#define withitem(a0, a1, a2) _Py_withitem(a0, a1, a2) +withitem_ty +_Py_withitem(expr_ty context_expr, expr_ty optional_vars, PyArena* arena); + +PyObject* PyAST_mod2obj(mod_ty t); +mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode); +int PyAST_Check(PyObject* obj); diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/Python.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/Python.h new file mode 100644 index 0000000..f4eeb89 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/Python.h @@ -0,0 +1,139 @@ +#ifndef Py_PYTHON_H +#define Py_PYTHON_H +/* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */ + +/* Include nearly all Python header files */ + +#include "patchlevel.h" +#include "pyconfig.h" +#include "pymacconfig.h" + +#include + +#ifndef UCHAR_MAX +#error "Something's broken. UCHAR_MAX should be defined in limits.h." +#endif + +#if UCHAR_MAX != 255 +#error "Python's source code assumes C's unsigned char is an 8-bit type." +#endif + +#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE) +#define _SGI_MP_SOURCE +#endif + +#include +#ifndef NULL +#error "Python.h requires that stdio.h define NULL." +#endif + +#include +#ifdef HAVE_ERRNO_H +#include +#endif +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_CRYPT_H +#include +#endif + +/* For size_t? */ +#ifdef HAVE_STDDEF_H +#include +#endif + +/* CAUTION: Build setups should ensure that NDEBUG is defined on the + * compiler command line when building Python in release mode; else + * assert() calls won't be removed. + */ +#include + +#include "pymacro.h" +#include "pyport.h" + +#include "pyatomic.h" + +/* Debug-mode build with pymalloc implies PYMALLOC_DEBUG. + * PYMALLOC_DEBUG is in error if pymalloc is not in use. + */ +#if defined(Py_DEBUG) && defined(WITH_PYMALLOC) && !defined(PYMALLOC_DEBUG) +#define PYMALLOC_DEBUG +#endif +#if defined(PYMALLOC_DEBUG) && !defined(WITH_PYMALLOC) +#error "PYMALLOC_DEBUG requires WITH_PYMALLOC" +#endif +#include "pymath.h" +#include "pymem.h" +#include "pytime.h" + +#include "object.h" +#include "objimpl.h" +#include "pyhash.h" +#include "typeslots.h" + +#include "pydebug.h" + +#include "boolobject.h" +#include "bytearrayobject.h" +#include "bytesobject.h" +#include "cellobject.h" +#include "classobject.h" +#include "complexobject.h" +#include "descrobject.h" +#include "dictobject.h" +#include "enumobject.h" +#include "fileobject.h" +#include "floatobject.h" +#include "funcobject.h" +#include "genobject.h" +#include "iterobject.h" +#include "listobject.h" +#include "longintrepr.h" +#include "longobject.h" +#include "memoryobject.h" +#include "methodobject.h" +#include "moduleobject.h" +#include "namespaceobject.h" +#include "odictobject.h" +#include "pycapsule.h" +#include "rangeobject.h" +#include "setobject.h" +#include "sliceobject.h" +#include "structseq.h" +#include "traceback.h" +#include "tupleobject.h" +#include "unicodeobject.h" +#include "warnings.h" +#include "weakrefobject.h" + +#include "codecs.h" +#include "pyerrors.h" + +#include "pystate.h" + +#include "ceval.h" +#include "import.h" +#include "intrcheck.h" +#include "modsupport.h" +#include "osmodule.h" +#include "pyarena.h" +#include "pylifecycle.h" +#include "pythonrun.h" +#include "sysmodule.h" + +#include "abstract.h" +#include "bltinmodule.h" + +#include "compile.h" +#include "eval.h" + +#include "dtoa.h" +#include "fileutils.h" +#include "pyctype.h" +#include "pyfpe.h" +#include "pystrcmp.h" +#include "pystrtod.h" + +#endif /* !Py_PYTHON_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/abstract.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/abstract.h new file mode 100644 index 0000000..2bf83c4 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/abstract.h @@ -0,0 +1,1374 @@ +#ifndef Py_ABSTRACTOBJECT_H +#define Py_ABSTRACTOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef PY_SSIZE_T_CLEAN +#define PyObject_CallFunction _PyObject_CallFunction_SizeT +#define PyObject_CallMethod _PyObject_CallMethod_SizeT +#ifndef Py_LIMITED_API +#define _PyObject_CallMethodId _PyObject_CallMethodId_SizeT +#endif /* !Py_LIMITED_API */ +#endif + +/* Abstract Object Interface (many thanks to Jim Fulton) */ + +/* + PROPOSAL: A Generic Python Object Interface for Python C Modules + +Problem + + Python modules written in C that must access Python objects must do + so through routines whose interfaces are described by a set of + include files. Unfortunately, these routines vary according to the + object accessed. To use these routines, the C programmer must check + the type of the object being used and must call a routine based on + the object type. For example, to access an element of a sequence, + the programmer must determine whether the sequence is a list or a + tuple: + + if(is_tupleobject(o)) + e=gettupleitem(o,i) + else if(is_listitem(o)) + e=getlistitem(o,i) + + If the programmer wants to get an item from another type of object + that provides sequence behavior, there is no clear way to do it + correctly. + + The persistent programmer may peruse object.h and find that the + _typeobject structure provides a means of invoking up to (currently + about) 41 special operators. So, for example, a routine can get an + item from any object that provides sequence behavior. However, to + use this mechanism, the programmer must make their code dependent on + the current Python implementation. + + Also, certain semantics, especially memory management semantics, may + differ by the type of object being used. Unfortunately, these + semantics are not clearly described in the current include files. + An abstract interface providing more consistent semantics is needed. + +Proposal + + I propose the creation of a standard interface (with an associated + library of routines and/or macros) for generically obtaining the + services of Python objects. This proposal can be viewed as one + components of a Python C interface consisting of several components. + + From the viewpoint of C access to Python services, we have (as + suggested by Guido in off-line discussions): + + - "Very high level layer": two or three functions that let you exec or + eval arbitrary Python code given as a string in a module whose name is + given, passing C values in and getting C values out using + mkvalue/getargs style format strings. This does not require the user + to declare any variables of type "PyObject *". This should be enough + to write a simple application that gets Python code from the user, + execs it, and returns the output or errors. (Error handling must also + be part of this API.) + + - "Abstract objects layer": which is the subject of this proposal. + It has many functions operating on objects, and lest you do many + things from C that you can also write in Python, without going + through the Python parser. + + - "Concrete objects layer": This is the public type-dependent + interface provided by the standard built-in types, such as floats, + strings, and lists. This interface exists and is currently + documented by the collection of include files provided with the + Python distributions. + + From the point of view of Python accessing services provided by C + modules: + + - "Python module interface": this interface consist of the basic + routines used to define modules and their members. Most of the + current extensions-writing guide deals with this interface. + + - "Built-in object interface": this is the interface that a new + built-in type must provide and the mechanisms and rules that a + developer of a new built-in type must use and follow. + + This proposal is a "first-cut" that is intended to spur + discussion. See especially the lists of notes. + + The Python C object interface will provide four protocols: object, + numeric, sequence, and mapping. Each protocol consists of a + collection of related operations. If an operation that is not + provided by a particular type is invoked, then a standard exception, + NotImplementedError is raised with an operation name as an argument. + In addition, for convenience this interface defines a set of + constructors for building objects of built-in types. This is needed + so new objects can be returned from C functions that otherwise treat + objects generically. + +Memory Management + + For all of the functions described in this proposal, if a function + retains a reference to a Python object passed as an argument, then the + function will increase the reference count of the object. It is + unnecessary for the caller to increase the reference count of an + argument in anticipation of the object's retention. + + All Python objects returned from functions should be treated as new + objects. Functions that return objects assume that the caller will + retain a reference and the reference count of the object has already + been incremented to account for this fact. A caller that does not + retain a reference to an object that is returned from a function + must decrement the reference count of the object (using + DECREF(object)) to prevent memory leaks. + + Note that the behavior mentioned here is different from the current + behavior for some objects (e.g. lists and tuples) when certain + type-specific routines are called directly (e.g. setlistitem). The + proposed abstraction layer will provide a consistent memory + management interface, correcting for inconsistent behavior for some + built-in types. + +Protocols + +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ + +/* Object Protocol: */ + +/* Implemented elsewhere: + +int PyObject_Print(PyObject *o, FILE *fp, int flags); + +Print an object, o, on file, fp. Returns -1 on +error. The flags argument is used to enable certain printing +options. The only option currently supported is Py_Print_RAW. + +(What should be said about Py_Print_RAW?) + + */ + +/* Implemented elsewhere: + +int PyObject_HasAttrString(PyObject *o, const char *attr_name); + +Returns 1 if o has the attribute attr_name, and 0 otherwise. +This is equivalent to the Python expression: +hasattr(o,attr_name). + +This function always succeeds. + + */ + +/* Implemented elsewhere: + +PyObject* PyObject_GetAttrString(PyObject *o, const char *attr_name); + +Retrieve an attributed named attr_name form object o. +Returns the attribute value on success, or NULL on failure. +This is the equivalent of the Python expression: o.attr_name. + + */ + +/* Implemented elsewhere: + +int PyObject_HasAttr(PyObject *o, PyObject *attr_name); + +Returns 1 if o has the attribute attr_name, and 0 otherwise. +This is equivalent to the Python expression: +hasattr(o,attr_name). + +This function always succeeds. + + */ + +/* Implemented elsewhere: + +PyObject* PyObject_GetAttr(PyObject *o, PyObject *attr_name); + +Retrieve an attributed named attr_name form object o. +Returns the attribute value on success, or NULL on failure. +This is the equivalent of the Python expression: o.attr_name. + + */ + +/* Implemented elsewhere: + +int PyObject_SetAttrString(PyObject *o, const char *attr_name, PyObject *v); + +Set the value of the attribute named attr_name, for object o, +to the value v. Raise an exception and return -1 on failure; return 0 on +success. This is the equivalent of the Python statement o.attr_name=v. + + */ + +/* Implemented elsewhere: + +int PyObject_SetAttr(PyObject *o, PyObject *attr_name, PyObject *v); + +Set the value of the attribute named attr_name, for object o, +to the value v. Raise an exception and return -1 on failure; return 0 on +success. This is the equivalent of the Python statement o.attr_name=v. + + */ + +/* implemented as a macro: + +int PyObject_DelAttrString(PyObject *o, const char *attr_name); + +Delete attribute named attr_name, for object o. Returns +-1 on failure. This is the equivalent of the Python +statement: del o.attr_name. + + */ +#define PyObject_DelAttrString(O, A) PyObject_SetAttrString((O), (A), NULL) + +/* implemented as a macro: + +int PyObject_DelAttr(PyObject *o, PyObject *attr_name); + +Delete attribute named attr_name, for object o. Returns -1 +on failure. This is the equivalent of the Python +statement: del o.attr_name. + + */ +#define PyObject_DelAttr(O, A) PyObject_SetAttr((O), (A), NULL) + +/* Implemented elsewhere: + +PyObject *PyObject_Repr(PyObject *o); + +Compute the string representation of object, o. Returns the +string representation on success, NULL on failure. This is +the equivalent of the Python expression: repr(o). + +Called by the repr() built-in function. + + */ + +/* Implemented elsewhere: + +PyObject *PyObject_Str(PyObject *o); + +Compute the string representation of object, o. Returns the +string representation on success, NULL on failure. This is +the equivalent of the Python expression: str(o).) + +Called by the str() and print() built-in functions. + + */ + +/* Declared elsewhere + +PyAPI_FUNC(int) PyCallable_Check(PyObject *o); + +Determine if the object, o, is callable. Return 1 if the +object is callable and 0 otherwise. + +This function always succeeds. +*/ + +PyAPI_FUNC(PyObject*) + PyObject_Call(PyObject* callable_object, PyObject* args, PyObject* kwargs); + +/* +Call a callable Python object, callable_object, with +arguments and keywords arguments. The 'args' argument can not be +NULL. +*/ + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _PyStack_AsTuple(PyObject** stack, Py_ssize_t nargs); + +/* Convert keyword arguments from the (stack, kwnames) format to a Python + dictionary. + + kwnames must only contains str strings, no subclass, and all keys must + be unique. kwnames is not checked, usually these checks are done before or + later + calling _PyStack_AsDict(). For example, _PyArg_ParseStack() raises an + error if a key is not a string. */ +PyAPI_FUNC(PyObject*) _PyStack_AsDict(PyObject** values, PyObject* kwnames); + +/* Convert (args, nargs, kwargs: dict) into (stack, nargs, kwnames: tuple). + + Return 0 on success, raise an exception and return -1 on error. + + Write the new stack into *p_stack. If *p_stack is differen than args, it + must be released by PyMem_Free(). + + The stack uses borrowed references. + + The type of keyword keys is not checked, these checks should be done + later (ex: _PyArg_ParseStackAndKeywords). */ +PyAPI_FUNC(int) _PyStack_UnpackDict( + PyObject** args, + Py_ssize_t nargs, + PyObject* kwargs, + PyObject*** p_stack, + PyObject** p_kwnames); + +/* Call the callable object func with the "fast call" calling convention: + args is a C array for positional arguments (nargs is the number of + positional arguments), kwargs is a dictionary for keyword arguments. + + If nargs is equal to zero, args can be NULL. kwargs can be NULL. + nargs must be greater or equal to zero. + + Return the result on success. Raise an exception on return NULL on + error. */ +PyAPI_FUNC(PyObject*) _PyObject_FastCallDict( + PyObject* func, + PyObject** args, + Py_ssize_t nargs, + PyObject* kwargs); + +/* Call the callable object func with the "fast call" calling convention: + args is a C array for positional arguments followed by values of + keyword arguments. Keys of keyword arguments are stored as a tuple + of strings in kwnames. nargs is the number of positional parameters at + the beginning of stack. The size of kwnames gives the number of keyword + values in the stack after positional arguments. + + kwnames must only contains str strings, no subclass, and all keys must + be unique. + + If nargs is equal to zero and there is no keyword argument (kwnames is + NULL or its size is zero), args can be NULL. + + Return the result on success. Raise an exception and return NULL on + error. */ +PyAPI_FUNC(PyObject*) _PyObject_FastCallKeywords( + PyObject* func, + PyObject** args, + Py_ssize_t nargs, + PyObject* kwnames); + +#define _PyObject_FastCall(func, args, nargs) \ + _PyObject_FastCallDict((func), (args), (nargs), NULL) + +#define _PyObject_CallNoArg(func) _PyObject_FastCall((func), NULL, 0) + +#define _PyObject_CallArg1(func, arg) _PyObject_FastCall((func), &(arg), 1) + +PyAPI_FUNC(PyObject*) _PyObject_Call_Prepend( + PyObject* func, + PyObject* obj, + PyObject* args, + PyObject* kwargs); + +PyAPI_FUNC(PyObject*) _Py_CheckFunctionResult( + PyObject* func, + PyObject* result, + const char* where); +#endif /* Py_LIMITED_API */ + +PyAPI_FUNC(PyObject*) + PyObject_CallObject(PyObject* callable_object, PyObject* args); + +/* +Call a callable Python object, callable_object, with +arguments given by the tuple, args. If no arguments are +needed, then args may be NULL. Returns the result of the +call on success, or NULL on failure. This is the equivalent +of the Python expression: o(*args). +*/ + +PyAPI_FUNC(PyObject*) + PyObject_CallFunction(PyObject* callable_object, const char* format, ...); + +/* +Call a callable Python object, callable_object, with a +variable number of C arguments. The C arguments are described +using a mkvalue-style format string. The format may be NULL, +indicating that no arguments are provided. Returns the +result of the call on success, or NULL on failure. This is +the equivalent of the Python expression: o(*args). +*/ + +PyAPI_FUNC(PyObject*) PyObject_CallMethod( + PyObject* o, + const char* method, + const char* format, + ...); + +/* +Call the method named m of object o with a variable number of +C arguments. The C arguments are described by a mkvalue +format string. The format may be NULL, indicating that no +arguments are provided. Returns the result of the call on +success, or NULL on failure. This is the equivalent of the +Python expression: o.method(args). +*/ + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _PyObject_CallMethodId( + PyObject* o, + _Py_Identifier* method, + const char* format, + ...); + +/* + Like PyObject_CallMethod, but expect a _Py_Identifier* as the + method name. +*/ +#endif /* !Py_LIMITED_API */ + +PyAPI_FUNC(PyObject*) + _PyObject_CallFunction_SizeT(PyObject* callable, const char* format, ...); +PyAPI_FUNC(PyObject*) _PyObject_CallMethod_SizeT( + PyObject* o, + const char* name, + const char* format, + ...); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _PyObject_CallMethodId_SizeT( + PyObject* o, + _Py_Identifier* name, + const char* format, + ...); +#endif /* !Py_LIMITED_API */ + +PyAPI_FUNC(PyObject*) PyObject_CallFunctionObjArgs(PyObject* callable, ...); + +/* +Call a callable Python object, callable_object, with a +variable number of C arguments. The C arguments are provided +as PyObject * values, terminated by a NULL. Returns the +result of the call on success, or NULL on failure. This is +the equivalent of the Python expression: o(*args). +*/ + +PyAPI_FUNC(PyObject*) + PyObject_CallMethodObjArgs(PyObject* o, PyObject* method, ...); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _PyObject_CallMethodIdObjArgs( + PyObject* o, + struct _Py_Identifier* method, + ...); +#endif /* !Py_LIMITED_API */ + +/* +Call the method named m of object o with a variable number of +C arguments. The C arguments are provided as PyObject * +values, terminated by NULL. Returns the result of the call +on success, or NULL on failure. This is the equivalent of +the Python expression: o.method(args). +*/ + +/* Implemented elsewhere: + +long PyObject_Hash(PyObject *o); + +Compute and return the hash, hash_value, of an object, o. On +failure, return -1. This is the equivalent of the Python +expression: hash(o). + */ + +/* Implemented elsewhere: + +int PyObject_IsTrue(PyObject *o); + +Returns 1 if the object, o, is considered to be true, 0 if o is +considered to be false and -1 on failure. This is equivalent to the +Python expression: not not o + */ + +/* Implemented elsewhere: + +int PyObject_Not(PyObject *o); + +Returns 0 if the object, o, is considered to be true, 1 if o is +considered to be false and -1 on failure. This is equivalent to the +Python expression: not o + */ + +PyAPI_FUNC(PyObject*) PyObject_Type(PyObject* o); + +/* +On success, returns a type object corresponding to the object +type of object o. On failure, returns NULL. This is +equivalent to the Python expression: type(o). +*/ + +PyAPI_FUNC(Py_ssize_t) PyObject_Size(PyObject* o); + +/* +Return the size of object o. If the object, o, provides +both sequence and mapping protocols, the sequence size is +returned. On error, -1 is returned. This is the equivalent +to the Python expression: len(o). +*/ + +/* For DLL compatibility */ +#undef PyObject_Length +PyAPI_FUNC(Py_ssize_t) PyObject_Length(PyObject* o); +#define PyObject_Length PyObject_Size + +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _PyObject_HasLen(PyObject* o); +PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject* o, Py_ssize_t); +#endif + +/* +Guess the size of object o using len(o) or o.__length_hint__(). +If neither of those return a non-negative value, then return the +default value. If one of the calls fails, this function returns -1. +*/ + +PyAPI_FUNC(PyObject*) PyObject_GetItem(PyObject* o, PyObject* key); + +/* +Return element of o corresponding to the object, key, or NULL +on failure. This is the equivalent of the Python expression: +o[key]. +*/ + +PyAPI_FUNC(int) PyObject_SetItem(PyObject* o, PyObject* key, PyObject* v); + +/* +Map the object key to the value v. Raise an exception and return -1 +on failure; return 0 on success. This is the equivalent of the Python +statement o[key]=v. +*/ + +PyAPI_FUNC(int) PyObject_DelItemString(PyObject* o, const char* key); + +/* +Remove the mapping for object, key, from the object *o. +Returns -1 on failure. This is equivalent to +the Python statement: del o[key]. +*/ + +PyAPI_FUNC(int) PyObject_DelItem(PyObject* o, PyObject* key); + +/* +Delete the mapping for key from *o. Returns -1 on failure. +This is the equivalent of the Python statement: del o[key]. +*/ + +/* old buffer API + FIXME: usage of these should all be replaced in Python itself + but for backwards compatibility we will implement them. + Their usage without a corresponding "unlock" mechanism + may create issues (but they would already be there). */ + +PyAPI_FUNC(int) PyObject_AsCharBuffer( + PyObject* obj, + const char** buffer, + Py_ssize_t* buffer_len); + +/* +Takes an arbitrary object which must support the (character, +single segment) buffer interface and returns a pointer to a +read-only memory location useable as character based input +for subsequent processing. + +0 is returned on success. buffer and buffer_len are only +set in case no error occurs. Otherwise, -1 is returned and +an exception set. +*/ + +PyAPI_FUNC(int) PyObject_CheckReadBuffer(PyObject* obj); + +/* +Checks whether an arbitrary object supports the (character, +single segment) buffer interface. Returns 1 on success, 0 +on failure. +*/ + +PyAPI_FUNC(int) PyObject_AsReadBuffer( + PyObject* obj, + const void** buffer, + Py_ssize_t* buffer_len); + +/* +Same as PyObject_AsCharBuffer() except that this API expects +(readable, single segment) buffer interface and returns a +pointer to a read-only memory location which can contain +arbitrary data. + +0 is returned on success. buffer and buffer_len are only +set in case no error occurs. Otherwise, -1 is returned and +an exception set. +*/ + +PyAPI_FUNC(int) PyObject_AsWriteBuffer( + PyObject* obj, + void** buffer, + Py_ssize_t* buffer_len); + +/* +Takes an arbitrary object which must support the (writable, +single segment) buffer interface and returns a pointer to a +writable memory location in buffer of size buffer_len. + +0 is returned on success. buffer and buffer_len are only +set in case no error occurs. Otherwise, -1 is returned and +an exception set. +*/ + +/* new buffer API */ + +#ifndef Py_LIMITED_API +#define PyObject_CheckBuffer(obj) \ + (((obj)->ob_type->tp_as_buffer != NULL) && \ + ((obj)->ob_type->tp_as_buffer->bf_getbuffer != NULL)) + +/* Return 1 if the getbuffer function is available, otherwise + return 0 */ + +PyAPI_FUNC(int) PyObject_GetBuffer(PyObject* obj, Py_buffer* view, int flags); + +/* This is a C-API version of the getbuffer function call. It checks + to make sure object has the required function pointer and issues the + call. Returns -1 and raises an error on failure and returns 0 on + success +*/ + +PyAPI_FUNC(void*) PyBuffer_GetPointer(Py_buffer* view, Py_ssize_t* indices); + +/* Get the memory area pointed to by the indices for the buffer given. + Note that view->ndim is the assumed size of indices +*/ + +PyAPI_FUNC(int) PyBuffer_SizeFromFormat(const char*); + +/* Return the implied itemsize of the data-format area from a + struct-style description */ + +/* Implementation in memoryobject.c */ +PyAPI_FUNC(int) PyBuffer_ToContiguous( + void* buf, + Py_buffer* view, + Py_ssize_t len, + char order); + +PyAPI_FUNC(int) PyBuffer_FromContiguous( + Py_buffer* view, + void* buf, + Py_ssize_t len, + char order); + +/* Copy len bytes of data from the contiguous chunk of memory + pointed to by buf into the buffer exported by obj. Return + 0 on success and return -1 and raise a PyBuffer_Error on + error (i.e. the object does not have a buffer interface or + it is not working). + + If fort is 'F', then if the object is multi-dimensional, + then the data will be copied into the array in + Fortran-style (first dimension varies the fastest). If + fort is 'C', then the data will be copied into the array + in C-style (last dimension varies the fastest). If fort + is 'A', then it does not matter and the copy will be made + in whatever way is more efficient. + +*/ + +PyAPI_FUNC(int) PyObject_CopyData(PyObject* dest, PyObject* src); + +/* Copy the data from the src buffer to the buffer of destination + */ + +PyAPI_FUNC(int) PyBuffer_IsContiguous(const Py_buffer* view, char fort); + +PyAPI_FUNC(void) PyBuffer_FillContiguousStrides( + int ndims, + Py_ssize_t* shape, + Py_ssize_t* strides, + int itemsize, + char fort); + +/* Fill the strides array with byte-strides of a contiguous + (Fortran-style if fort is 'F' or C-style otherwise) + array of the given shape with the given number of bytes + per element. +*/ + +PyAPI_FUNC(int) PyBuffer_FillInfo( + Py_buffer* view, + PyObject* o, + void* buf, + Py_ssize_t len, + int readonly, + int flags); + +/* Fills in a buffer-info structure correctly for an exporter + that can only share a contiguous chunk of memory of + "unsigned bytes" of the given length. Returns 0 on success + and -1 (with raising an error) on error. + */ + +PyAPI_FUNC(void) PyBuffer_Release(Py_buffer* view); + +/* Releases a Py_buffer obtained from getbuffer ParseTuple's s*. +*/ +#endif /* Py_LIMITED_API */ + +PyAPI_FUNC(PyObject*) PyObject_Format(PyObject* obj, PyObject* format_spec); +/* +Takes an arbitrary object and returns the result of +calling obj.__format__(format_spec). +*/ + +/* Iterators */ + +PyAPI_FUNC(PyObject*) PyObject_GetIter(PyObject*); +/* Takes an object and returns an iterator for it. +This is typically a new iterator but if the argument +is an iterator, this returns itself. */ + +#define PyIter_Check(obj) \ + ((obj)->ob_type->tp_iternext != NULL && \ + (obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented) + +PyAPI_FUNC(PyObject*) PyIter_Next(PyObject*); +/* Takes an iterator object and calls its tp_iternext slot, +returning the next value. If the iterator is exhausted, +this returns NULL without setting an exception. +NULL with an exception means an error occurred. */ + +/* Number Protocol:*/ + +PyAPI_FUNC(int) PyNumber_Check(PyObject* o); + +/* +Returns 1 if the object, o, provides numeric protocols, and +false otherwise. + +This function always succeeds. +*/ + +PyAPI_FUNC(PyObject*) PyNumber_Add(PyObject* o1, PyObject* o2); + +/* +Returns the result of adding o1 and o2, or null on failure. +This is the equivalent of the Python expression: o1+o2. +*/ + +PyAPI_FUNC(PyObject*) PyNumber_Subtract(PyObject* o1, PyObject* o2); + +/* +Returns the result of subtracting o2 from o1, or null on +failure. This is the equivalent of the Python expression: +o1-o2. +*/ + +PyAPI_FUNC(PyObject*) PyNumber_Multiply(PyObject* o1, PyObject* o2); + +/* +Returns the result of multiplying o1 and o2, or null on +failure. This is the equivalent of the Python expression: +o1*o2. +*/ + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03050000 +PyAPI_FUNC(PyObject*) PyNumber_MatrixMultiply(PyObject* o1, PyObject* o2); + +/* +This is the equivalent of the Python expression: o1 @ o2. +*/ +#endif + +PyAPI_FUNC(PyObject*) PyNumber_FloorDivide(PyObject* o1, PyObject* o2); + +/* +Returns the result of dividing o1 by o2 giving an integral result, +or null on failure. +This is the equivalent of the Python expression: o1//o2. +*/ + +PyAPI_FUNC(PyObject*) PyNumber_TrueDivide(PyObject* o1, PyObject* o2); + +/* +Returns the result of dividing o1 by o2 giving a float result, +or null on failure. +This is the equivalent of the Python expression: o1/o2. +*/ + +PyAPI_FUNC(PyObject*) PyNumber_Remainder(PyObject* o1, PyObject* o2); + +/* +Returns the remainder of dividing o1 by o2, or null on +failure. This is the equivalent of the Python expression: +o1%o2. +*/ + +PyAPI_FUNC(PyObject*) PyNumber_Divmod(PyObject* o1, PyObject* o2); + +/* +See the built-in function divmod. Returns NULL on failure. +This is the equivalent of the Python expression: +divmod(o1,o2). +*/ + +PyAPI_FUNC(PyObject*) PyNumber_Power(PyObject* o1, PyObject* o2, PyObject* o3); + +/* +See the built-in function pow. Returns NULL on failure. +This is the equivalent of the Python expression: +pow(o1,o2,o3), where o3 is optional. +*/ + +PyAPI_FUNC(PyObject*) PyNumber_Negative(PyObject* o); + +/* +Returns the negation of o on success, or null on failure. +This is the equivalent of the Python expression: -o. +*/ + +PyAPI_FUNC(PyObject*) PyNumber_Positive(PyObject* o); + +/* +Returns the (what?) of o on success, or NULL on failure. +This is the equivalent of the Python expression: +o. +*/ + +PyAPI_FUNC(PyObject*) PyNumber_Absolute(PyObject* o); + +/* +Returns the absolute value of o, or null on failure. This is +the equivalent of the Python expression: abs(o). +*/ + +PyAPI_FUNC(PyObject*) PyNumber_Invert(PyObject* o); + +/* +Returns the bitwise negation of o on success, or NULL on +failure. This is the equivalent of the Python expression: +~o. +*/ + +PyAPI_FUNC(PyObject*) PyNumber_Lshift(PyObject* o1, PyObject* o2); + +/* +Returns the result of left shifting o1 by o2 on success, or +NULL on failure. This is the equivalent of the Python +expression: o1 << o2. +*/ + +PyAPI_FUNC(PyObject*) PyNumber_Rshift(PyObject* o1, PyObject* o2); + +/* +Returns the result of right shifting o1 by o2 on success, or +NULL on failure. This is the equivalent of the Python +expression: o1 >> o2. +*/ + +PyAPI_FUNC(PyObject*) PyNumber_And(PyObject* o1, PyObject* o2); + +/* +Returns the result of bitwise and of o1 and o2 on success, or +NULL on failure. This is the equivalent of the Python +expression: o1&o2. + +*/ + +PyAPI_FUNC(PyObject*) PyNumber_Xor(PyObject* o1, PyObject* o2); + +/* +Returns the bitwise exclusive or of o1 by o2 on success, or +NULL on failure. This is the equivalent of the Python +expression: o1^o2. +*/ + +PyAPI_FUNC(PyObject*) PyNumber_Or(PyObject* o1, PyObject* o2); + +/* +Returns the result of bitwise or on o1 and o2 on success, or +NULL on failure. This is the equivalent of the Python +expression: o1|o2. +*/ + +#define PyIndex_Check(obj) \ + ((obj)->ob_type->tp_as_number != NULL && \ + (obj)->ob_type->tp_as_number->nb_index != NULL) + +PyAPI_FUNC(PyObject*) PyNumber_Index(PyObject* o); + +/* +Returns the object converted to a Python int +or NULL with an error raised on failure. +*/ + +PyAPI_FUNC(Py_ssize_t) PyNumber_AsSsize_t(PyObject* o, PyObject* exc); + +/* +Returns the object converted to Py_ssize_t by going through +PyNumber_Index first. If an overflow error occurs while +converting the int to Py_ssize_t, then the second argument +is the error-type to return. If it is NULL, then the overflow error +is cleared and the value is clipped. +*/ + +PyAPI_FUNC(PyObject*) PyNumber_Long(PyObject* o); + +/* +Returns the o converted to an integer object on success, or +NULL on failure. This is the equivalent of the Python +expression: int(o). +*/ + +PyAPI_FUNC(PyObject*) PyNumber_Float(PyObject* o); + +/* +Returns the o converted to a float object on success, or NULL +on failure. This is the equivalent of the Python expression: +float(o). +*/ + +/* In-place variants of (some of) the above number protocol functions */ + +PyAPI_FUNC(PyObject*) PyNumber_InPlaceAdd(PyObject* o1, PyObject* o2); + +/* +Returns the result of adding o2 to o1, possibly in-place, or null +on failure. This is the equivalent of the Python expression: +o1 += o2. +*/ + +PyAPI_FUNC(PyObject*) PyNumber_InPlaceSubtract(PyObject* o1, PyObject* o2); + +/* +Returns the result of subtracting o2 from o1, possibly in-place or +null on failure. This is the equivalent of the Python expression: +o1 -= o2. +*/ + +PyAPI_FUNC(PyObject*) PyNumber_InPlaceMultiply(PyObject* o1, PyObject* o2); + +/* +Returns the result of multiplying o1 by o2, possibly in-place, or +null on failure. This is the equivalent of the Python expression: +o1 *= o2. +*/ + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03050000 +PyAPI_FUNC(PyObject*) + PyNumber_InPlaceMatrixMultiply(PyObject* o1, PyObject* o2); + +/* +This is the equivalent of the Python expression: o1 @= o2. +*/ +#endif + +PyAPI_FUNC(PyObject*) PyNumber_InPlaceFloorDivide(PyObject* o1, PyObject* o2); + +/* +Returns the result of dividing o1 by o2 giving an integral result, +possibly in-place, or null on failure. +This is the equivalent of the Python expression: +o1 /= o2. +*/ + +PyAPI_FUNC(PyObject*) PyNumber_InPlaceTrueDivide(PyObject* o1, PyObject* o2); + +/* +Returns the result of dividing o1 by o2 giving a float result, +possibly in-place, or null on failure. +This is the equivalent of the Python expression: +o1 /= o2. +*/ + +PyAPI_FUNC(PyObject*) PyNumber_InPlaceRemainder(PyObject* o1, PyObject* o2); + +/* +Returns the remainder of dividing o1 by o2, possibly in-place, or +null on failure. This is the equivalent of the Python expression: +o1 %= o2. +*/ + +PyAPI_FUNC(PyObject*) + PyNumber_InPlacePower(PyObject* o1, PyObject* o2, PyObject* o3); + +/* +Returns the result of raising o1 to the power of o2, possibly +in-place, or null on failure. This is the equivalent of the Python +expression: o1 **= o2, or pow(o1, o2, o3) if o3 is present. +*/ + +PyAPI_FUNC(PyObject*) PyNumber_InPlaceLshift(PyObject* o1, PyObject* o2); + +/* +Returns the result of left shifting o1 by o2, possibly in-place, or +null on failure. This is the equivalent of the Python expression: +o1 <<= o2. +*/ + +PyAPI_FUNC(PyObject*) PyNumber_InPlaceRshift(PyObject* o1, PyObject* o2); + +/* +Returns the result of right shifting o1 by o2, possibly in-place or +null on failure. This is the equivalent of the Python expression: +o1 >>= o2. +*/ + +PyAPI_FUNC(PyObject*) PyNumber_InPlaceAnd(PyObject* o1, PyObject* o2); + +/* +Returns the result of bitwise and of o1 and o2, possibly in-place, +or null on failure. This is the equivalent of the Python +expression: o1 &= o2. +*/ + +PyAPI_FUNC(PyObject*) PyNumber_InPlaceXor(PyObject* o1, PyObject* o2); + +/* +Returns the bitwise exclusive or of o1 by o2, possibly in-place, or +null on failure. This is the equivalent of the Python expression: +o1 ^= o2. +*/ + +PyAPI_FUNC(PyObject*) PyNumber_InPlaceOr(PyObject* o1, PyObject* o2); + +/* +Returns the result of bitwise or of o1 and o2, possibly in-place, +or null on failure. This is the equivalent of the Python +expression: o1 |= o2. +*/ + +PyAPI_FUNC(PyObject*) PyNumber_ToBase(PyObject* n, int base); + +/* +Returns the integer n converted to a string with a base, with a base +marker of 0b, 0o or 0x prefixed if applicable. +If n is not an int object, it is converted with PyNumber_Index first. +*/ + +/* Sequence protocol:*/ + +PyAPI_FUNC(int) PySequence_Check(PyObject* o); + +/* +Return 1 if the object provides sequence protocol, and zero +otherwise. + +This function always succeeds. +*/ + +PyAPI_FUNC(Py_ssize_t) PySequence_Size(PyObject* o); + +/* +Return the size of sequence object o, or -1 on failure. +*/ + +/* For DLL compatibility */ +#undef PySequence_Length +PyAPI_FUNC(Py_ssize_t) PySequence_Length(PyObject* o); +#define PySequence_Length PySequence_Size + +PyAPI_FUNC(PyObject*) PySequence_Concat(PyObject* o1, PyObject* o2); + +/* +Return the concatenation of o1 and o2 on success, and NULL on +failure. This is the equivalent of the Python +expression: o1+o2. +*/ + +PyAPI_FUNC(PyObject*) PySequence_Repeat(PyObject* o, Py_ssize_t count); + +/* +Return the result of repeating sequence object o count times, +or NULL on failure. This is the equivalent of the Python +expression: o1*count. +*/ + +PyAPI_FUNC(PyObject*) PySequence_GetItem(PyObject* o, Py_ssize_t i); + +/* +Return the ith element of o, or NULL on failure. This is the +equivalent of the Python expression: o[i]. +*/ + +PyAPI_FUNC(PyObject*) + PySequence_GetSlice(PyObject* o, Py_ssize_t i1, Py_ssize_t i2); + +/* +Return the slice of sequence object o between i1 and i2, or +NULL on failure. This is the equivalent of the Python +expression: o[i1:i2]. +*/ + +PyAPI_FUNC(int) PySequence_SetItem(PyObject* o, Py_ssize_t i, PyObject* v); + +/* +Assign object v to the ith element of o. Raise an exception and return +-1 on failure; return 0 on success. This is the equivalent of the +Python statement o[i]=v. +*/ + +PyAPI_FUNC(int) PySequence_DelItem(PyObject* o, Py_ssize_t i); + +/* +Delete the ith element of object v. Returns +-1 on failure. This is the equivalent of the Python +statement: del o[i]. +*/ + +PyAPI_FUNC(int) + PySequence_SetSlice(PyObject* o, Py_ssize_t i1, Py_ssize_t i2, PyObject* v); + +/* +Assign the sequence object, v, to the slice in sequence +object, o, from i1 to i2. Returns -1 on failure. This is the +equivalent of the Python statement: o[i1:i2]=v. +*/ + +PyAPI_FUNC(int) PySequence_DelSlice(PyObject* o, Py_ssize_t i1, Py_ssize_t i2); + +/* +Delete the slice in sequence object, o, from i1 to i2. +Returns -1 on failure. This is the equivalent of the Python +statement: del o[i1:i2]. +*/ + +PyAPI_FUNC(PyObject*) PySequence_Tuple(PyObject* o); + +/* +Returns the sequence, o, as a tuple on success, and NULL on failure. +This is equivalent to the Python expression: tuple(o) +*/ + +PyAPI_FUNC(PyObject*) PySequence_List(PyObject* o); +/* +Returns the sequence, o, as a list on success, and NULL on failure. +This is equivalent to the Python expression: list(o) +*/ + +PyAPI_FUNC(PyObject*) PySequence_Fast(PyObject* o, const char* m); +/* +Return the sequence, o, as a list, unless it's already a +tuple or list. Use PySequence_Fast_GET_ITEM to access the +members of this list, and PySequence_Fast_GET_SIZE to get its length. + +Returns NULL on failure. If the object does not support iteration, +raises a TypeError exception with m as the message text. +*/ + +#define PySequence_Fast_GET_SIZE(o) \ + (PyList_Check(o) ? PyList_GET_SIZE(o) : PyTuple_GET_SIZE(o)) +/* +Return the size of o, assuming that o was returned by +PySequence_Fast and is not NULL. +*/ + +#define PySequence_Fast_GET_ITEM(o, i) \ + (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i)) +/* +Return the ith element of o, assuming that o was returned by +PySequence_Fast, and that i is within bounds. +*/ + +#define PySequence_ITEM(o, i) (Py_TYPE(o)->tp_as_sequence->sq_item(o, i)) +/* Assume tp_as_sequence and sq_item exist and that i does not +need to be corrected for a negative index +*/ + +#define PySequence_Fast_ITEMS(sf) \ + (PyList_Check(sf) ? ((PyListObject*)(sf))->ob_item \ + : ((PyTupleObject*)(sf))->ob_item) +/* Return a pointer to the underlying item array for + an object retured by PySequence_Fast */ + +PyAPI_FUNC(Py_ssize_t) PySequence_Count(PyObject* o, PyObject* value); + +/* +Return the number of occurrences on value on o, that is, +return the number of keys for which o[key]==value. On +failure, return -1. This is equivalent to the Python +expression: o.count(value). +*/ + +PyAPI_FUNC(int) PySequence_Contains(PyObject* seq, PyObject* ob); +/* +Return -1 if error; 1 if ob in seq; 0 if ob not in seq. +Use __contains__ if possible, else _PySequence_IterSearch(). +*/ + +#ifndef Py_LIMITED_API +#define PY_ITERSEARCH_COUNT 1 +#define PY_ITERSEARCH_INDEX 2 +#define PY_ITERSEARCH_CONTAINS 3 +PyAPI_FUNC(Py_ssize_t) + _PySequence_IterSearch(PyObject* seq, PyObject* obj, int operation); +#endif +/* + Iterate over seq. Result depends on the operation: + PY_ITERSEARCH_COUNT: return # of times obj appears in seq; -1 if + error. + PY_ITERSEARCH_INDEX: return 0-based index of first occurrence of + obj in seq; set ValueError and return -1 if none found; + also return -1 on error. + PY_ITERSEARCH_CONTAINS: return 1 if obj in seq, else 0; -1 on + error. +*/ + +/* For DLL-level backwards compatibility */ +#undef PySequence_In +PyAPI_FUNC(int) PySequence_In(PyObject* o, PyObject* value); + +/* For source-level backwards compatibility */ +#define PySequence_In PySequence_Contains + +/* +Determine if o contains value. If an item in o is equal to +X, return 1, otherwise return 0. On error, return -1. This +is equivalent to the Python expression: value in o. +*/ + +PyAPI_FUNC(Py_ssize_t) PySequence_Index(PyObject* o, PyObject* value); + +/* +Return the first index for which o[i]=value. On error, +return -1. This is equivalent to the Python +expression: o.index(value). +*/ + +/* In-place versions of some of the above Sequence functions. */ + +PyAPI_FUNC(PyObject*) PySequence_InPlaceConcat(PyObject* o1, PyObject* o2); + +/* +Append o2 to o1, in-place when possible. Return the resulting +object, which could be o1, or NULL on failure. This is the +equivalent of the Python expression: o1 += o2. + +*/ + +PyAPI_FUNC(PyObject*) PySequence_InPlaceRepeat(PyObject* o, Py_ssize_t count); + +/* +Repeat o1 by count, in-place when possible. Return the resulting +object, which could be o1, or NULL on failure. This is the +equivalent of the Python expression: o1 *= count. + +*/ + +/* Mapping protocol:*/ + +PyAPI_FUNC(int) PyMapping_Check(PyObject* o); + +/* +Return 1 if the object provides mapping protocol, and zero +otherwise. + +This function always succeeds. +*/ + +PyAPI_FUNC(Py_ssize_t) PyMapping_Size(PyObject* o); + +/* +Returns the number of keys in object o on success, and -1 on +failure. For objects that do not provide sequence protocol, +this is equivalent to the Python expression: len(o). +*/ + +/* For DLL compatibility */ +#undef PyMapping_Length +PyAPI_FUNC(Py_ssize_t) PyMapping_Length(PyObject* o); +#define PyMapping_Length PyMapping_Size + +/* implemented as a macro: + +int PyMapping_DelItemString(PyObject *o, const char *key); + +Remove the mapping for object, key, from the object *o. +Returns -1 on failure. This is equivalent to +the Python statement: del o[key]. + */ +#define PyMapping_DelItemString(O, K) PyObject_DelItemString((O), (K)) + +/* implemented as a macro: + +int PyMapping_DelItem(PyObject *o, PyObject *key); + +Remove the mapping for object, key, from the object *o. +Returns -1 on failure. This is equivalent to +the Python statement: del o[key]. + */ +#define PyMapping_DelItem(O, K) PyObject_DelItem((O), (K)) + +PyAPI_FUNC(int) PyMapping_HasKeyString(PyObject* o, const char* key); + +/* +On success, return 1 if the mapping object has the key, key, +and 0 otherwise. This is equivalent to the Python expression: +key in o. + +This function always succeeds. +*/ + +PyAPI_FUNC(int) PyMapping_HasKey(PyObject* o, PyObject* key); + +/* +Return 1 if the mapping object has the key, key, +and 0 otherwise. This is equivalent to the Python expression: +key in o. + +This function always succeeds. + +*/ + +PyAPI_FUNC(PyObject*) PyMapping_Keys(PyObject* o); + +/* +On success, return a list or tuple of the keys in object o. +On failure, return NULL. +*/ + +PyAPI_FUNC(PyObject*) PyMapping_Values(PyObject* o); + +/* +On success, return a list or tuple of the values in object o. +On failure, return NULL. +*/ + +PyAPI_FUNC(PyObject*) PyMapping_Items(PyObject* o); + +/* +On success, return a list or tuple of the items in object o, +where each item is a tuple containing a key-value pair. +On failure, return NULL. + +*/ + +PyAPI_FUNC(PyObject*) PyMapping_GetItemString(PyObject* o, const char* key); + +/* +Return element of o corresponding to the object, key, or NULL +on failure. This is the equivalent of the Python expression: +o[key]. +*/ + +PyAPI_FUNC(int) + PyMapping_SetItemString(PyObject* o, const char* key, PyObject* value); + +/* +Map the object, key, to the value, v. Returns +-1 on failure. This is the equivalent of the Python +statement: o[key]=v. +*/ + +PyAPI_FUNC(int) PyObject_IsInstance(PyObject* object, PyObject* typeorclass); +/* isinstance(object, typeorclass) */ + +PyAPI_FUNC(int) PyObject_IsSubclass(PyObject* object, PyObject* typeorclass); +/* issubclass(object, typeorclass) */ + +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _PyObject_RealIsInstance(PyObject* inst, PyObject* cls); + +PyAPI_FUNC(int) _PyObject_RealIsSubclass(PyObject* derived, PyObject* cls); + +PyAPI_FUNC(char* const*) _PySequence_BytesToCharpArray(PyObject* self); + +PyAPI_FUNC(void) _Py_FreeCharPArray(char* const array[]); + +/* For internal use by buffer API functions */ +PyAPI_FUNC(void) + _Py_add_one_to_index_F(int nd, Py_ssize_t* index, const Py_ssize_t* shape); +PyAPI_FUNC(void) + _Py_add_one_to_index_C(int nd, Py_ssize_t* index, const Py_ssize_t* shape); +#endif /* !Py_LIMITED_API */ + +#ifdef __cplusplus +} +#endif +#endif /* Py_ABSTRACTOBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/accu.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/accu.h new file mode 100644 index 0000000..5a35009 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/accu.h @@ -0,0 +1,37 @@ +#ifndef Py_LIMITED_API +#ifndef Py_ACCU_H +#define Py_ACCU_H + +/*** This is a private API for use by the interpreter and the stdlib. + *** Its definition may be changed or removed at any moment. + ***/ + +/* + * A two-level accumulator of unicode objects that avoids both the overhead + * of keeping a huge number of small separate objects, and the quadratic + * behaviour of using a naive repeated concatenation scheme. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#undef small /* defined by some Windows headers */ + +typedef struct { + PyObject* large; /* A list of previously accumulated large strings */ + PyObject* small; /* Pending small strings */ +} _PyAccu; + +PyAPI_FUNC(int) _PyAccu_Init(_PyAccu* acc); +PyAPI_FUNC(int) _PyAccu_Accumulate(_PyAccu* acc, PyObject* unicode); +PyAPI_FUNC(PyObject*) _PyAccu_FinishAsList(_PyAccu* acc); +PyAPI_FUNC(PyObject*) _PyAccu_Finish(_PyAccu* acc); +PyAPI_FUNC(void) _PyAccu_Destroy(_PyAccu* acc); + +#ifdef __cplusplus +} +#endif + +#endif /* Py_ACCU_H */ +#endif /* Py_LIMITED_API */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/asdl.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/asdl.h new file mode 100644 index 0000000..457968d --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/asdl.h @@ -0,0 +1,46 @@ +#ifndef Py_ASDL_H +#define Py_ASDL_H + +typedef PyObject* identifier; +typedef PyObject* string; +typedef PyObject* bytes; +typedef PyObject* object; +typedef PyObject* singleton; +typedef PyObject* constant; + +/* It would be nice if the code generated by asdl_c.py was completely + independent of Python, but it is a goal the requires too much work + at this stage. So, for example, I'll represent identifiers as + interned Python strings. +*/ + +/* XXX A sequence should be typed so that its use can be typechecked. */ + +typedef struct { + Py_ssize_t size; + void* elements[1]; +} asdl_seq; + +typedef struct { + Py_ssize_t size; + int elements[1]; +} asdl_int_seq; + +asdl_seq* _Py_asdl_seq_new(Py_ssize_t size, PyArena* arena); +asdl_int_seq* _Py_asdl_int_seq_new(Py_ssize_t size, PyArena* arena); + +#define asdl_seq_GET(S, I) (S)->elements[(I)] +#define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size) +#ifdef Py_DEBUG +#define asdl_seq_SET(S, I, V) \ + do { \ + Py_ssize_t _asdl_i = (I); \ + assert((S) != NULL); \ + assert(_asdl_i < (S)->size); \ + (S)->elements[_asdl_i] = (V); \ + } while (0) +#else +#define asdl_seq_SET(S, I, V) (S)->elements[I] = (V) +#endif + +#endif /* !Py_ASDL_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/ast.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/ast.h new file mode 100644 index 0000000..75fd627 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/ast.h @@ -0,0 +1,22 @@ +#ifndef Py_AST_H +#define Py_AST_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_FUNC(int) PyAST_Validate(mod_ty); +PyAPI_FUNC(mod_ty) PyAST_FromNode( + const node* n, + PyCompilerFlags* flags, + const char* filename, /* decoded from the filesystem encoding */ + PyArena* arena); +PyAPI_FUNC(mod_ty) PyAST_FromNodeObject( + const node* n, + PyCompilerFlags* flags, + PyObject* filename, + PyArena* arena); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_AST_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/bitset.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/bitset.h new file mode 100644 index 0000000..b9be9a4 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/bitset.h @@ -0,0 +1,32 @@ + +#ifndef Py_BITSET_H +#define Py_BITSET_H +#ifdef __cplusplus +extern "C" { +#endif + +/* Bitset interface */ + +#define BYTE char + +typedef BYTE* bitset; + +bitset newbitset(int nbits); +void delbitset(bitset bs); +#define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0) +int addbit(bitset bs, int ibit); /* Returns 0 if already set */ +int samebitset(bitset bs1, bitset bs2, int nbits); +void mergebitset(bitset bs1, bitset bs2, int nbits); + +#define BITSPERBYTE (8 * sizeof(BYTE)) +#define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE) + +#define BIT2BYTE(ibit) ((ibit) / BITSPERBYTE) +#define BIT2SHIFT(ibit) ((ibit) % BITSPERBYTE) +#define BIT2MASK(ibit) (1 << BIT2SHIFT(ibit)) +#define BYTE2BIT(ibyte) ((ibyte)*BITSPERBYTE) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_BITSET_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/bltinmodule.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/bltinmodule.h new file mode 100644 index 0000000..868c9e6 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/bltinmodule.h @@ -0,0 +1,14 @@ +#ifndef Py_BLTINMODULE_H +#define Py_BLTINMODULE_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_DATA(PyTypeObject) PyFilter_Type; +PyAPI_DATA(PyTypeObject) PyMap_Type; +PyAPI_DATA(PyTypeObject) PyZip_Type; + +#ifdef __cplusplus +} +#endif +#endif /* !Py_BLTINMODULE_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/boolobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/boolobject.h new file mode 100644 index 0000000..aeff06b --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/boolobject.h @@ -0,0 +1,33 @@ +/* Boolean object interface */ + +#ifndef Py_BOOLOBJECT_H +#define Py_BOOLOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_DATA(PyTypeObject) PyBool_Type; + +#define PyBool_Check(x) (Py_TYPE(x) == &PyBool_Type) + +/* Py_False and Py_True are the only two bools in existence. +Don't forget to apply Py_INCREF() when returning either!!! */ + +/* Don't use these directly */ +PyAPI_DATA(struct _longobject) _Py_FalseStruct, _Py_TrueStruct; + +/* Use these macros */ +#define Py_False ((PyObject*)&_Py_FalseStruct) +#define Py_True ((PyObject*)&_Py_TrueStruct) + +/* Macros for returning Py_True or Py_False, respectively */ +#define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True +#define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False + +/* Function to return a bool from a C long */ +PyAPI_FUNC(PyObject*) PyBool_FromLong(long); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_BOOLOBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/bytearrayobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/bytearrayobject.h new file mode 100644 index 0000000..0fd46b3 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/bytearrayobject.h @@ -0,0 +1,64 @@ +/* ByteArray object interface */ + +#ifndef Py_BYTEARRAYOBJECT_H +#define Py_BYTEARRAYOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* Type PyByteArrayObject represents a mutable array of bytes. + * The Python API is that of a sequence; + * the bytes are mapped to ints in [0, 256). + * Bytes are not characters; they may be used to encode characters. + * The only way to go between bytes and str/unicode is via encoding + * and decoding. + * For the convenience of C programmers, the bytes type is considered + * to contain a char pointer, not an unsigned char pointer. + */ + +/* Object layout */ +#ifndef Py_LIMITED_API +typedef struct { + PyObject_VAR_HEAD Py_ssize_t + ob_alloc; /* How many bytes allocated in ob_bytes */ + char* ob_bytes; /* Physical backing buffer */ + char* ob_start; /* Logical start inside ob_bytes */ + /* XXX(nnorwitz): should ob_exports be Py_ssize_t? */ + int ob_exports; /* How many buffer exports */ +} PyByteArrayObject; +#endif + +/* Type object */ +PyAPI_DATA(PyTypeObject) PyByteArray_Type; +PyAPI_DATA(PyTypeObject) PyByteArrayIter_Type; + +/* Type check macros */ +#define PyByteArray_Check(self) PyObject_TypeCheck(self, &PyByteArray_Type) +#define PyByteArray_CheckExact(self) (Py_TYPE(self) == &PyByteArray_Type) + +/* Direct API functions */ +PyAPI_FUNC(PyObject*) PyByteArray_FromObject(PyObject*); +PyAPI_FUNC(PyObject*) PyByteArray_Concat(PyObject*, PyObject*); +PyAPI_FUNC(PyObject*) PyByteArray_FromStringAndSize(const char*, Py_ssize_t); +PyAPI_FUNC(Py_ssize_t) PyByteArray_Size(PyObject*); +PyAPI_FUNC(char*) PyByteArray_AsString(PyObject*); +PyAPI_FUNC(int) PyByteArray_Resize(PyObject*, Py_ssize_t); + +/* Macros, trading safety for speed */ +#ifndef Py_LIMITED_API +#define PyByteArray_AS_STRING(self) \ + (assert(PyByteArray_Check(self)), \ + Py_SIZE(self) ? ((PyByteArrayObject*)(self))->ob_start \ + : _PyByteArray_empty_string) +#define PyByteArray_GET_SIZE(self) \ + (assert(PyByteArray_Check(self)), Py_SIZE(self)) + +PyAPI_DATA(char) _PyByteArray_empty_string[]; +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_BYTEARRAYOBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/bytes_methods.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/bytes_methods.h new file mode 100644 index 0000000..d466af1 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/bytes_methods.h @@ -0,0 +1,75 @@ +#ifndef Py_LIMITED_API +#ifndef Py_BYTES_CTYPE_H +#define Py_BYTES_CTYPE_H + +/* + * The internal implementation behind PyBytes (bytes) and PyByteArray + * (bytearray) + * methods of the given names, they operate on ASCII byte strings. + */ +extern PyObject* _Py_bytes_isspace(const char* cptr, Py_ssize_t len); +extern PyObject* _Py_bytes_isalpha(const char* cptr, Py_ssize_t len); +extern PyObject* _Py_bytes_isalnum(const char* cptr, Py_ssize_t len); +extern PyObject* _Py_bytes_isdigit(const char* cptr, Py_ssize_t len); +extern PyObject* _Py_bytes_islower(const char* cptr, Py_ssize_t len); +extern PyObject* _Py_bytes_isupper(const char* cptr, Py_ssize_t len); +extern PyObject* _Py_bytes_istitle(const char* cptr, Py_ssize_t len); + +/* These store their len sized answer in the given preallocated *result arg. */ +extern void _Py_bytes_lower(char* result, const char* cptr, Py_ssize_t len); +extern void _Py_bytes_upper(char* result, const char* cptr, Py_ssize_t len); +extern void _Py_bytes_title(char* result, const char* s, Py_ssize_t len); +extern void _Py_bytes_capitalize(char* result, const char* s, Py_ssize_t len); +extern void _Py_bytes_swapcase(char* result, const char* s, Py_ssize_t len); + +extern PyObject* +_Py_bytes_find(const char* str, Py_ssize_t len, PyObject* args); +extern PyObject* +_Py_bytes_index(const char* str, Py_ssize_t len, PyObject* args); +extern PyObject* +_Py_bytes_rfind(const char* str, Py_ssize_t len, PyObject* args); +extern PyObject* +_Py_bytes_rindex(const char* str, Py_ssize_t len, PyObject* args); +extern PyObject* +_Py_bytes_count(const char* str, Py_ssize_t len, PyObject* args); +extern int _Py_bytes_contains(const char* str, Py_ssize_t len, PyObject* arg); +extern PyObject* +_Py_bytes_startswith(const char* str, Py_ssize_t len, PyObject* args); +extern PyObject* +_Py_bytes_endswith(const char* str, Py_ssize_t len, PyObject* args); + +/* The maketrans() static method. */ +extern PyObject* _Py_bytes_maketrans(Py_buffer* frm, Py_buffer* to); + +/* Shared __doc__ strings. */ +extern const char _Py_isspace__doc__[]; +extern const char _Py_isalpha__doc__[]; +extern const char _Py_isalnum__doc__[]; +extern const char _Py_isdigit__doc__[]; +extern const char _Py_islower__doc__[]; +extern const char _Py_isupper__doc__[]; +extern const char _Py_istitle__doc__[]; +extern const char _Py_lower__doc__[]; +extern const char _Py_upper__doc__[]; +extern const char _Py_title__doc__[]; +extern const char _Py_capitalize__doc__[]; +extern const char _Py_swapcase__doc__[]; +extern const char _Py_count__doc__[]; +extern const char _Py_find__doc__[]; +extern const char _Py_index__doc__[]; +extern const char _Py_rfind__doc__[]; +extern const char _Py_rindex__doc__[]; +extern const char _Py_startswith__doc__[]; +extern const char _Py_endswith__doc__[]; +extern const char _Py_maketrans__doc__[]; +extern const char _Py_expandtabs__doc__[]; +extern const char _Py_ljust__doc__[]; +extern const char _Py_rjust__doc__[]; +extern const char _Py_center__doc__[]; +extern const char _Py_zfill__doc__[]; + +/* this is needed because some docs are shared from the .o, not static */ +#define PyDoc_STRVAR_shared(name, str) const char name[] = PyDoc_STR(str) + +#endif /* !Py_BYTES_CTYPE_H */ +#endif /* !Py_LIMITED_API */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/bytesobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/bytesobject.h new file mode 100644 index 0000000..f6bd3ec --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/bytesobject.h @@ -0,0 +1,226 @@ + +/* Bytes (String) object interface */ + +#ifndef Py_BYTESOBJECT_H +#define Py_BYTESOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* +Type PyBytesObject represents a character string. An extra zero byte is +reserved at the end to ensure it is zero-terminated, but a size is +present so strings with null bytes in them can be represented. This +is an immutable object type. + +There are functions to create new string objects, to test +an object for string-ness, and to get the +string value. The latter function returns a null pointer +if the object is not of the proper type. +There is a variant that takes an explicit size as well as a +variant that assumes a zero-terminated string. Note that none of the +functions should be applied to nil objects. +*/ + +/* Caching the hash (ob_shash) saves recalculation of a string's hash value. + This significantly speeds up dict lookups. */ + +#ifndef Py_LIMITED_API +typedef struct { + PyObject_VAR_HEAD Py_hash_t ob_shash; + char ob_sval[1]; + + /* Invariants: + * ob_sval contains space for 'ob_size+1' elements. + * ob_sval[ob_size] == 0. + * ob_shash is the hash of the string or -1 if not computed yet. + */ +} PyBytesObject; +#endif + +PyAPI_DATA(PyTypeObject) PyBytes_Type; +PyAPI_DATA(PyTypeObject) PyBytesIter_Type; + +#define PyBytes_Check(op) \ + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_BYTES_SUBCLASS) +#define PyBytes_CheckExact(op) (Py_TYPE(op) == &PyBytes_Type) + +PyAPI_FUNC(PyObject*) PyBytes_FromStringAndSize(const char*, Py_ssize_t); +PyAPI_FUNC(PyObject*) PyBytes_FromString(const char*); +PyAPI_FUNC(PyObject*) PyBytes_FromObject(PyObject*); +PyAPI_FUNC(PyObject*) PyBytes_FromFormatV(const char*, va_list) + Py_GCC_ATTRIBUTE((format(printf, 1, 0))); +PyAPI_FUNC(PyObject*) PyBytes_FromFormat(const char*, ...) + Py_GCC_ATTRIBUTE((format(printf, 1, 2))); +PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject*); +PyAPI_FUNC(char*) PyBytes_AsString(PyObject*); +PyAPI_FUNC(PyObject*) PyBytes_Repr(PyObject*, int); +PyAPI_FUNC(void) PyBytes_Concat(PyObject**, PyObject*); +PyAPI_FUNC(void) PyBytes_ConcatAndDel(PyObject**, PyObject*); +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _PyBytes_Resize(PyObject**, Py_ssize_t); +PyAPI_FUNC(PyObject*) _PyBytes_FormatEx( + const char* format, + Py_ssize_t format_len, + PyObject* args, + int use_bytearray); +PyAPI_FUNC(PyObject*) _PyBytes_FromHex(PyObject* string, int use_bytearray); +#endif +PyAPI_FUNC(PyObject*) PyBytes_DecodeEscape( + const char*, + Py_ssize_t, + const char*, + Py_ssize_t, + const char*); +#ifndef Py_LIMITED_API +/* Helper for PyBytes_DecodeEscape that detects invalid escape chars. */ +PyAPI_FUNC(PyObject*) _PyBytes_DecodeEscape( + const char*, + Py_ssize_t, + const char*, + Py_ssize_t, + const char*, + const char**); +#endif + +/* Macro, trading safety for speed */ +#ifndef Py_LIMITED_API +#define PyBytes_AS_STRING(op) \ + (assert(PyBytes_Check(op)), (((PyBytesObject*)(op))->ob_sval)) +#define PyBytes_GET_SIZE(op) (assert(PyBytes_Check(op)), Py_SIZE(op)) +#endif + +/* _PyBytes_Join(sep, x) is like sep.join(x). sep must be PyBytesObject*, + x must be an iterable object. */ +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _PyBytes_Join(PyObject* sep, PyObject* x); +#endif + +/* Provides access to the internal data buffer and size of a string + object or the default encoded version of a Unicode object. Passing + NULL as *len parameter will force the string buffer to be + 0-terminated (passing a string with embedded NULL characters will + cause an exception). */ +PyAPI_FUNC(int) PyBytes_AsStringAndSize( + PyObject* obj, /* string or Unicode object */ + char** s, /* pointer to buffer variable */ + Py_ssize_t* len /* pointer to length variable or NULL + (only possible for 0-terminated + strings) */ + ); + +/* Using the current locale, insert the thousands grouping + into the string pointed to by buffer. For the argument descriptions, + see Objects/stringlib/localeutil.h */ +#ifndef Py_LIMITED_API +PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGroupingLocale( + char* buffer, + Py_ssize_t n_buffer, + char* digits, + Py_ssize_t n_digits, + Py_ssize_t min_width); + +/* Using explicit passed-in values, insert the thousands grouping + into the string pointed to by buffer. For the argument descriptions, + see Objects/stringlib/localeutil.h */ +PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGrouping( + char* buffer, + Py_ssize_t n_buffer, + char* digits, + Py_ssize_t n_digits, + Py_ssize_t min_width, + const char* grouping, + const char* thousands_sep); +#endif + +/* Flags used by string formatting */ +#define F_LJUST (1 << 0) +#define F_SIGN (1 << 1) +#define F_BLANK (1 << 2) +#define F_ALT (1 << 3) +#define F_ZERO (1 << 4) + +#ifndef Py_LIMITED_API +/* The _PyBytesWriter structure is big: it contains an embedded "stack buffer". + A _PyBytesWriter variable must be declared at the end of variables in a + function to optimize the memory allocation on the stack. */ +typedef struct { + /* bytes, bytearray or NULL (when the small buffer is used) */ + PyObject* buffer; + + /* Number of allocated size. */ + Py_ssize_t allocated; + + /* Minimum number of allocated bytes, + incremented by _PyBytesWriter_Prepare() */ + Py_ssize_t min_size; + + /* If non-zero, use a bytearray instead of a bytes object for buffer. */ + int use_bytearray; + + /* If non-zero, overallocate the buffer (default: 0). + This flag must be zero if use_bytearray is non-zero. */ + int overallocate; + + /* Stack buffer */ + int use_small_buffer; + char small_buffer[512]; +} _PyBytesWriter; + +/* Initialize a bytes writer + + By default, the overallocation is disabled. Set the overallocate attribute + to control the allocation of the buffer. */ +PyAPI_FUNC(void) _PyBytesWriter_Init(_PyBytesWriter* writer); + +/* Get the buffer content and reset the writer. + Return a bytes object, or a bytearray object if use_bytearray is non-zero. + Raise an exception and return NULL on error. */ +PyAPI_FUNC(PyObject*) _PyBytesWriter_Finish(_PyBytesWriter* writer, void* str); + +/* Deallocate memory of a writer (clear its internal buffer). */ +PyAPI_FUNC(void) _PyBytesWriter_Dealloc(_PyBytesWriter* writer); + +/* Allocate the buffer to write size bytes. + Return the pointer to the beginning of buffer data. + Raise an exception and return NULL on error. */ +PyAPI_FUNC(void*) _PyBytesWriter_Alloc(_PyBytesWriter* writer, Py_ssize_t size); + +/* Ensure that the buffer is large enough to write *size* bytes. + Add size to the writer minimum size (min_size attribute). + + str is the current pointer inside the buffer. + Return the updated current pointer inside the buffer. + Raise an exception and return NULL on error. */ +PyAPI_FUNC(void*) + _PyBytesWriter_Prepare(_PyBytesWriter* writer, void* str, Py_ssize_t size); + +/* Resize the buffer to make it larger. + The new buffer may be larger than size bytes because of overallocation. + Return the updated current pointer inside the buffer. + Raise an exception and return NULL on error. + + Note: size must be greater than the number of allocated bytes in the writer. + + This function doesn't use the writer minimum size (min_size attribute). + + See also _PyBytesWriter_Prepare(). + */ +PyAPI_FUNC(void*) + _PyBytesWriter_Resize(_PyBytesWriter* writer, void* str, Py_ssize_t size); + +/* Write bytes. + Raise an exception and return NULL on error. */ +PyAPI_FUNC(void*) _PyBytesWriter_WriteBytes( + _PyBytesWriter* writer, + void* str, + const void* bytes, + Py_ssize_t size); +#endif /* Py_LIMITED_API */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_BYTESOBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/cellobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/cellobject.h new file mode 100644 index 0000000..19227fe --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/cellobject.h @@ -0,0 +1,28 @@ +/* Cell object interface */ +#ifndef Py_LIMITED_API +#ifndef Py_CELLOBJECT_H +#define Py_CELLOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + PyObject_HEAD PyObject* ob_ref; /* Content of the cell or NULL when empty */ +} PyCellObject; + +PyAPI_DATA(PyTypeObject) PyCell_Type; + +#define PyCell_Check(op) (Py_TYPE(op) == &PyCell_Type) + +PyAPI_FUNC(PyObject*) PyCell_New(PyObject*); +PyAPI_FUNC(PyObject*) PyCell_Get(PyObject*); +PyAPI_FUNC(int) PyCell_Set(PyObject*, PyObject*); + +#define PyCell_GET(op) (((PyCellObject*)(op))->ob_ref) +#define PyCell_SET(op, v) (((PyCellObject*)(op))->ob_ref = v) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_TUPLEOBJECT_H */ +#endif /* Py_LIMITED_API */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/ceval.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/ceval.h new file mode 100644 index 0000000..a56cc0d --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/ceval.h @@ -0,0 +1,243 @@ +#ifndef Py_CEVAL_H +#define Py_CEVAL_H +#ifdef __cplusplus +extern "C" { +#endif + +/* Interface to random parts in ceval.c */ + +PyAPI_FUNC(PyObject*) PyEval_CallObjectWithKeywords( + PyObject* func, + PyObject* args, + PyObject* kwargs); + +/* Inline this */ +#define PyEval_CallObject(func, arg) \ + PyEval_CallObjectWithKeywords(func, arg, (PyObject*)NULL) + +PyAPI_FUNC(PyObject*) + PyEval_CallFunction(PyObject* obj, const char* format, ...); +PyAPI_FUNC(PyObject*) PyEval_CallMethod( + PyObject* obj, + const char* methodname, + const char* format, + ...); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject*); +PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject*); +PyAPI_FUNC(void) _PyEval_SetCoroutineWrapper(PyObject*); +PyAPI_FUNC(PyObject*) _PyEval_GetCoroutineWrapper(void); +PyAPI_FUNC(void) _PyEval_SetAsyncGenFirstiter(PyObject*); +PyAPI_FUNC(PyObject*) _PyEval_GetAsyncGenFirstiter(void); +PyAPI_FUNC(void) _PyEval_SetAsyncGenFinalizer(PyObject*); +PyAPI_FUNC(PyObject*) _PyEval_GetAsyncGenFinalizer(void); +#endif + +struct _frame; /* Avoid including frameobject.h */ + +PyAPI_FUNC(PyObject*) PyEval_GetBuiltins(void); +PyAPI_FUNC(PyObject*) PyEval_GetGlobals(void); +PyAPI_FUNC(PyObject*) PyEval_GetLocals(void); +PyAPI_FUNC(struct _frame*) PyEval_GetFrame(void); + +/* Look at the current frame's (if any) code's co_flags, and turn on + the corresponding compiler flags in cf->cf_flags. Return 1 if any + flag was set, else return 0. */ +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags* cf); +#endif + +PyAPI_FUNC(int) Py_AddPendingCall(int (*func)(void*), void* arg); +PyAPI_FUNC(void) _PyEval_SignalReceived(void); +PyAPI_FUNC(int) Py_MakePendingCalls(void); + +/* Protection against deeply nested recursive calls + + In Python 3.0, this protection has two levels: + * normal anti-recursion protection is triggered when the recursion level + exceeds the current recursion limit. It raises a RecursionError, and sets + the "overflowed" flag in the thread state structure. This flag + temporarily *disables* the normal protection; this allows cleanup code + to potentially outgrow the recursion limit while processing the + RecursionError. + * "last chance" anti-recursion protection is triggered when the recursion + level exceeds "current recursion limit + 50". By construction, this + protection can only be triggered when the "overflowed" flag is set. It + means the cleanup code has itself gone into an infinite loop, or the + RecursionError has been mistakingly ignored. When this protection is + triggered, the interpreter aborts with a Fatal Error. + + In addition, the "overflowed" flag is automatically reset when the + recursion level drops below "current recursion limit - 50". This heuristic + is meant to ensure that the normal anti-recursion protection doesn't get + disabled too long. + + Please note: this scheme has its own limitations. See: + http://mail.python.org/pipermail/python-dev/2008-August/082106.html + for some observations. +*/ +PyAPI_FUNC(void) Py_SetRecursionLimit(int); +PyAPI_FUNC(int) Py_GetRecursionLimit(void); + +#define Py_EnterRecursiveCall(where) \ + (_Py_MakeRecCheck(PyThreadState_GET()->recursion_depth) && \ + _Py_CheckRecursiveCall(where)) +#define Py_LeaveRecursiveCall() \ + do { \ + if (_Py_MakeEndRecCheck(PyThreadState_GET()->recursion_depth)) \ + PyThreadState_GET()->overflowed = 0; \ + } while (0) +PyAPI_FUNC(int) _Py_CheckRecursiveCall(const char* where); +PyAPI_DATA(int) _Py_CheckRecursionLimit; + +#ifdef USE_STACKCHECK +/* With USE_STACKCHECK, we artificially decrement the recursion limit in order + to trigger regular stack checks in _Py_CheckRecursiveCall(), except if + the "overflowed" flag is set, in which case we need the true value + of _Py_CheckRecursionLimit for _Py_MakeEndRecCheck() to function properly. +*/ +#define _Py_MakeRecCheck(x) \ + (++(x) > (_Py_CheckRecursionLimit += PyThreadState_GET()->overflowed - 1)) +#else +#define _Py_MakeRecCheck(x) (++(x) > _Py_CheckRecursionLimit) +#endif + +/* Compute the "lower-water mark" for a recursion limit. When + * Py_LeaveRecursiveCall() is called with a recursion depth below this mark, + * the overflowed flag is reset to 0. */ +#define _Py_RecursionLimitLowerWaterMark(limit) \ + (((limit) > 200) ? ((limit)-50) : (3 * ((limit) >> 2))) + +#define _Py_MakeEndRecCheck(x) \ + (--(x) < _Py_RecursionLimitLowerWaterMark(_Py_CheckRecursionLimit)) + +#define Py_ALLOW_RECURSION \ + do { \ + unsigned char _old = PyThreadState_GET()->recursion_critical; \ + PyThreadState_GET()->recursion_critical = 1; + +#define Py_END_ALLOW_RECURSION \ + PyThreadState_GET()->recursion_critical = _old; \ + } \ + while (0) \ + ; + +PyAPI_FUNC(const char*) PyEval_GetFuncName(PyObject*); +PyAPI_FUNC(const char*) PyEval_GetFuncDesc(PyObject*); + +PyAPI_FUNC(PyObject*) PyEval_GetCallStats(PyObject*); +PyAPI_FUNC(PyObject*) PyEval_EvalFrame(struct _frame*); +PyAPI_FUNC(PyObject*) PyEval_EvalFrameEx(struct _frame* f, int exc); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _PyEval_EvalFrameDefault(struct _frame* f, int exc); +#endif + +/* Interface for threads. + + A module that plans to do a blocking system call (or something else + that lasts a long time and doesn't touch Python data) can allow other + threads to run as follows: + + ...preparations here... + Py_BEGIN_ALLOW_THREADS + ...blocking system call here... + Py_END_ALLOW_THREADS + ...interpret result here... + + The Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS pair expands to a + {}-surrounded block. + To leave the block in the middle (e.g., with return), you must insert + a line containing Py_BLOCK_THREADS before the return, e.g. + + if (...premature_exit...) { + Py_BLOCK_THREADS + PyErr_SetFromErrno(PyExc_IOError); + return NULL; + } + + An alternative is: + + Py_BLOCK_THREADS + if (...premature_exit...) { + PyErr_SetFromErrno(PyExc_IOError); + return NULL; + } + Py_UNBLOCK_THREADS + + For convenience, that the value of 'errno' is restored across + Py_END_ALLOW_THREADS and Py_BLOCK_THREADS. + + WARNING: NEVER NEST CALLS TO Py_BEGIN_ALLOW_THREADS AND + Py_END_ALLOW_THREADS!!! + + The function PyEval_InitThreads() should be called only from + init_thread() in "_threadmodule.c". + + Note that not yet all candidates have been converted to use this + mechanism! +*/ + +PyAPI_FUNC(PyThreadState*) PyEval_SaveThread(void); +PyAPI_FUNC(void) PyEval_RestoreThread(PyThreadState*); + +#ifdef WITH_THREAD + +PyAPI_FUNC(int) PyEval_ThreadsInitialized(void); +PyAPI_FUNC(void) PyEval_InitThreads(void); +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) _PyEval_FiniThreads(void); +#endif /* !Py_LIMITED_API */ +PyAPI_FUNC(void) PyEval_AcquireLock(void); +PyAPI_FUNC(void) PyEval_ReleaseLock(void); +PyAPI_FUNC(void) PyEval_AcquireThread(PyThreadState* tstate); +PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState* tstate); +PyAPI_FUNC(void) PyEval_ReInitThreads(void); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) _PyEval_SetSwitchInterval(unsigned long microseconds); +PyAPI_FUNC(unsigned long) _PyEval_GetSwitchInterval(void); +#endif + +#ifndef Py_LIMITED_API +PyAPI_FUNC(Py_ssize_t) _PyEval_RequestCodeExtraIndex(freefunc); +#endif + +#define Py_BEGIN_ALLOW_THREADS \ + { \ + PyThreadState* _save; \ + _save = PyEval_SaveThread(); +#define Py_BLOCK_THREADS PyEval_RestoreThread(_save); +#define Py_UNBLOCK_THREADS _save = PyEval_SaveThread(); +#define Py_END_ALLOW_THREADS \ + PyEval_RestoreThread(_save); \ + } + +#else /* !WITH_THREAD */ + +#define Py_BEGIN_ALLOW_THREADS { +#define Py_BLOCK_THREADS +#define Py_UNBLOCK_THREADS +#define Py_END_ALLOW_THREADS } + +#endif /* !WITH_THREAD */ + +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject*, Py_ssize_t*); +PyAPI_FUNC(int) _PyEval_SliceIndexNotNone(PyObject*, Py_ssize_t*); +PyAPI_FUNC(void) _PyEval_SignalAsyncExc(void); +#endif + +/* Masks and values used by FORMAT_VALUE opcode. */ +#define FVC_MASK 0x3 +#define FVC_NONE 0x0 +#define FVC_STR 0x1 +#define FVC_REPR 0x2 +#define FVC_ASCII 0x3 +#define FVS_MASK 0x4 +#define FVS_HAVE_SPEC 0x4 + +#ifdef __cplusplus +} +#endif +#endif /* !Py_CEVAL_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/classobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/classobject.h new file mode 100644 index 0000000..282fe38 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/classobject.h @@ -0,0 +1,53 @@ +/* Former class object interface -- now only bound methods are here */ + +/* Revealing some structures (not for general use) */ + +#ifndef Py_LIMITED_API +#ifndef Py_CLASSOBJECT_H +#define Py_CLASSOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + PyObject_HEAD PyObject* + im_func; /* The callable object implementing the method */ + PyObject* im_self; /* The instance it is bound to */ + PyObject* im_weakreflist; /* List of weak references */ +} PyMethodObject; + +PyAPI_DATA(PyTypeObject) PyMethod_Type; + +#define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type) + +PyAPI_FUNC(PyObject*) PyMethod_New(PyObject*, PyObject*); + +PyAPI_FUNC(PyObject*) PyMethod_Function(PyObject*); +PyAPI_FUNC(PyObject*) PyMethod_Self(PyObject*); + +/* Macros for direct access to these values. Type checks are *not* + done, so use with care. */ +#define PyMethod_GET_FUNCTION(meth) (((PyMethodObject*)meth)->im_func) +#define PyMethod_GET_SELF(meth) (((PyMethodObject*)meth)->im_self) + +PyAPI_FUNC(int) PyMethod_ClearFreeList(void); + +typedef struct { PyObject_HEAD PyObject* func; } PyInstanceMethodObject; + +PyAPI_DATA(PyTypeObject) PyInstanceMethod_Type; + +#define PyInstanceMethod_Check(op) ((op)->ob_type == &PyInstanceMethod_Type) + +PyAPI_FUNC(PyObject*) PyInstanceMethod_New(PyObject*); +PyAPI_FUNC(PyObject*) PyInstanceMethod_Function(PyObject*); + +/* Macros for direct access to these values. Type checks are *not* + done, so use with care. */ +#define PyInstanceMethod_GET_FUNCTION(meth) \ + (((PyInstanceMethodObject*)meth)->func) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_CLASSOBJECT_H */ +#endif /* Py_LIMITED_API */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/code.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/code.h new file mode 100644 index 0000000..ef60500 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/code.h @@ -0,0 +1,172 @@ +/* Definitions for bytecode */ + +#ifndef Py_LIMITED_API +#ifndef Py_CODE_H +#define Py_CODE_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef uint16_t _Py_CODEUNIT; + +#ifdef WORDS_BIGENDIAN +#define _Py_OPCODE(word) ((word) >> 8) +#define _Py_OPARG(word) ((word)&255) +#else +#define _Py_OPCODE(word) ((word)&255) +#define _Py_OPARG(word) ((word) >> 8) +#endif + +/* Bytecode object */ +typedef struct { + PyObject_HEAD int co_argcount; /* #arguments, except *args */ + int co_kwonlyargcount; /* #keyword only arguments */ + int co_nlocals; /* #local variables */ + int co_stacksize; /* #entries needed for evaluation stack */ + int co_flags; /* CO_..., see below */ + int co_firstlineno; /* first source line number */ + PyObject* co_code; /* instruction opcodes */ + PyObject* co_consts; /* list (constants used) */ + PyObject* co_names; /* list of strings (names used) */ + PyObject* co_varnames; /* tuple of strings (local variable names) */ + PyObject* co_freevars; /* tuple of strings (free variable names) */ + PyObject* co_cellvars; /* tuple of strings (cell variable names) */ + /* The rest aren't used in either hash or comparisons, except for co_name, + used in both. This is done to preserve the name and line number + for tracebacks and debuggers; otherwise, constant de-duplication + would collapse identical functions/lambdas defined on different lines. + */ + unsigned char* co_cell2arg; /* Maps cell vars which are arguments. */ + PyObject* co_filename; /* unicode (where it was loaded from) */ + PyObject* co_name; /* unicode (name, for reference) */ + PyObject* co_lnotab; /* string (encoding addr<->lineno mapping) See + Objects/lnotab_notes.txt for details. */ + void* co_zombieframe; /* for optimization only (see frameobject.c) */ + PyObject* co_weakreflist; /* to support weakrefs to code objects */ + /* Scratch space for extra data relating to the code object. + Type is a void* to keep the format private in codeobject.c to force + people to go through the proper APIs. */ + void* co_extra; +} PyCodeObject; + +/* Masks for co_flags above */ +#define CO_OPTIMIZED 0x0001 +#define CO_NEWLOCALS 0x0002 +#define CO_VARARGS 0x0004 +#define CO_VARKEYWORDS 0x0008 +#define CO_NESTED 0x0010 +#define CO_GENERATOR 0x0020 +/* The CO_NOFREE flag is set if there are no free or cell variables. + This information is redundant, but it allows a single flag test + to determine whether there is any extra work to be done when the + call frame it setup. +*/ +#define CO_NOFREE 0x0040 + +/* The CO_COROUTINE flag is set for coroutine functions (defined with + ``async def`` keywords) */ +#define CO_COROUTINE 0x0080 +#define CO_ITERABLE_COROUTINE 0x0100 +#define CO_ASYNC_GENERATOR 0x0200 + +/* These are no longer used. */ +#if 0 +#define CO_GENERATOR_ALLOWED 0x1000 +#endif +#define CO_FUTURE_DIVISION 0x2000 +#define CO_FUTURE_ABSOLUTE_IMPORT 0x4000 /* do absolute imports by default */ +#define CO_FUTURE_WITH_STATEMENT 0x8000 +#define CO_FUTURE_PRINT_FUNCTION 0x10000 +#define CO_FUTURE_UNICODE_LITERALS 0x20000 + +#define CO_FUTURE_BARRY_AS_BDFL 0x40000 +#define CO_FUTURE_GENERATOR_STOP 0x80000 + +/* This value is found in the co_cell2arg array when the associated cell + variable does not correspond to an argument. The maximum number of + arguments is 255 (indexed up to 254), so 255 work as a special flag.*/ +#define CO_CELL_NOT_AN_ARG 255 + +/* This should be defined if a future statement modifies the syntax. + For example, when a keyword is added. +*/ +#define PY_PARSER_REQUIRES_FUTURE_KEYWORD + +#define CO_MAXBLOCKS 20 /* Max static block nesting within a function */ + +PyAPI_DATA(PyTypeObject) PyCode_Type; + +#define PyCode_Check(op) (Py_TYPE(op) == &PyCode_Type) +#define PyCode_GetNumFree(op) (PyTuple_GET_SIZE((op)->co_freevars)) + +/* Public interface */ +PyAPI_FUNC(PyCodeObject*) PyCode_New( + int, + int, + int, + int, + int, + PyObject*, + PyObject*, + PyObject*, + PyObject*, + PyObject*, + PyObject*, + PyObject*, + PyObject*, + int, + PyObject*); +/* same as struct above */ + +/* Creates a new empty code object with the specified source location. */ +PyAPI_FUNC(PyCodeObject*) PyCode_NewEmpty( + const char* filename, + const char* funcname, + int firstlineno); + +/* Return the line number associated with the specified bytecode index + in this code object. If you just need the line number of a frame, + use PyFrame_GetLineNumber() instead. */ +PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject*, int); + +/* for internal use only */ +typedef struct _addr_pair { + int ap_lower; + int ap_upper; +} PyAddrPair; + +#ifndef Py_LIMITED_API +/* Update *bounds to describe the first and one-past-the-last instructions in + the + same line as lasti. Return the number of that line. +*/ +PyAPI_FUNC(int) + _PyCode_CheckLineNumber(PyCodeObject* co, int lasti, PyAddrPair* bounds); + +/* Create a comparable key used to compare constants taking in account the + * object type. It is used to make sure types are not coerced (e.g., float and + * complex) _and_ to distinguish 0.0 from -0.0 e.g. on IEEE platforms + * + * Return (type(obj), obj, ...): a tuple with variable size (at least 2 items) + * depending on the type and the value. The type is the first item to not + * compare bytes and str which can raise a BytesWarning exception. */ +PyAPI_FUNC(PyObject*) _PyCode_ConstantKey(PyObject* obj); +#endif + +PyAPI_FUNC(PyObject*) PyCode_Optimize( + PyObject* code, + PyObject* consts, + PyObject* names, + PyObject* lnotab); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) + _PyCode_GetExtra(PyObject* code, Py_ssize_t index, void** extra); +PyAPI_FUNC(int) _PyCode_SetExtra(PyObject* code, Py_ssize_t index, void* extra); +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_CODE_H */ +#endif /* Py_LIMITED_API */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/codecs.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/codecs.h new file mode 100644 index 0000000..bbdf125 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/codecs.h @@ -0,0 +1,210 @@ +#ifndef Py_CODECREGISTRY_H +#define Py_CODECREGISTRY_H +#ifdef __cplusplus +extern "C" { +#endif + +/* ------------------------------------------------------------------------ + + Python Codec Registry and support functions + + +Written by Marc-Andre Lemburg (mal@lemburg.com). + +Copyright (c) Corporation for National Research Initiatives. + + ------------------------------------------------------------------------ */ + +/* Register a new codec search function. + + As side effect, this tries to load the encodings package, if not + yet done, to make sure that it is always first in the list of + search functions. + + The search_function's refcount is incremented by this function. */ + +PyAPI_FUNC(int) PyCodec_Register(PyObject* search_function); + +/* Codec registry lookup API. + + Looks up the given encoding and returns a CodecInfo object with + function attributes which implement the different aspects of + processing the encoding. + + The encoding string is looked up converted to all lower-case + characters. This makes encodings looked up through this mechanism + effectively case-insensitive. + + If no codec is found, a KeyError is set and NULL returned. + + As side effect, this tries to load the encodings package, if not + yet done. This is part of the lazy load strategy for the encodings + package. + + */ + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _PyCodec_Lookup(const char* encoding); + +PyAPI_FUNC(int) _PyCodec_Forget(const char* encoding); +#endif + +/* Codec registry encoding check API. + + Returns 1/0 depending on whether there is a registered codec for + the given encoding. + +*/ + +PyAPI_FUNC(int) PyCodec_KnownEncoding(const char* encoding); + +/* Generic codec based encoding API. + + object is passed through the encoder function found for the given + encoding using the error handling method defined by errors. errors + may be NULL to use the default method defined for the codec. + + Raises a LookupError in case no encoder can be found. + + */ + +PyAPI_FUNC(PyObject*) + PyCodec_Encode(PyObject* object, const char* encoding, const char* errors); + +/* Generic codec based decoding API. + + object is passed through the decoder function found for the given + encoding using the error handling method defined by errors. errors + may be NULL to use the default method defined for the codec. + + Raises a LookupError in case no encoder can be found. + + */ + +PyAPI_FUNC(PyObject*) + PyCodec_Decode(PyObject* object, const char* encoding, const char* errors); + +#ifndef Py_LIMITED_API +/* Text codec specific encoding and decoding API. + + Checks the encoding against a list of codecs which do not + implement a str<->bytes encoding before attempting the + operation. + + Please note that these APIs are internal and should not + be used in Python C extensions. + + XXX (ncoghlan): should we make these, or something like them, public + in Python 3.5+? + + */ +PyAPI_FUNC(PyObject*) _PyCodec_LookupTextEncoding( + const char* encoding, + const char* alternate_command); + +PyAPI_FUNC(PyObject*) _PyCodec_EncodeText( + PyObject* object, + const char* encoding, + const char* errors); + +PyAPI_FUNC(PyObject*) _PyCodec_DecodeText( + PyObject* object, + const char* encoding, + const char* errors); + +/* These two aren't actually text encoding specific, but _io.TextIOWrapper + * is the only current API consumer. + */ +PyAPI_FUNC(PyObject*) _PyCodecInfo_GetIncrementalDecoder( + PyObject* codec_info, + const char* errors); + +PyAPI_FUNC(PyObject*) _PyCodecInfo_GetIncrementalEncoder( + PyObject* codec_info, + const char* errors); +#endif + +/* --- Codec Lookup APIs -------------------------------------------------- + + All APIs return a codec object with incremented refcount and are + based on _PyCodec_Lookup(). The same comments w/r to the encoding + name also apply to these APIs. + +*/ + +/* Get an encoder function for the given encoding. */ + +PyAPI_FUNC(PyObject*) PyCodec_Encoder(const char* encoding); + +/* Get a decoder function for the given encoding. */ + +PyAPI_FUNC(PyObject*) PyCodec_Decoder(const char* encoding); + +/* Get an IncrementalEncoder object for the given encoding. */ + +PyAPI_FUNC(PyObject*) + PyCodec_IncrementalEncoder(const char* encoding, const char* errors); + +/* Get an IncrementalDecoder object function for the given encoding. */ + +PyAPI_FUNC(PyObject*) + PyCodec_IncrementalDecoder(const char* encoding, const char* errors); + +/* Get a StreamReader factory function for the given encoding. */ + +PyAPI_FUNC(PyObject*) PyCodec_StreamReader( + const char* encoding, + PyObject* stream, + const char* errors); + +/* Get a StreamWriter factory function for the given encoding. */ + +PyAPI_FUNC(PyObject*) PyCodec_StreamWriter( + const char* encoding, + PyObject* stream, + const char* errors); + +/* Unicode encoding error handling callback registry API */ + +/* Register the error handling callback function error under the given + name. This function will be called by the codec when it encounters + unencodable characters/undecodable bytes and doesn't know the + callback name, when name is specified as the error parameter + in the call to the encode/decode function. + Return 0 on success, -1 on error */ +PyAPI_FUNC(int) PyCodec_RegisterError(const char* name, PyObject* error); + +/* Lookup the error handling callback function registered under the given + name. As a special case NULL can be passed, in which case + the error handling callback for "strict" will be returned. */ +PyAPI_FUNC(PyObject*) PyCodec_LookupError(const char* name); + +/* raise exc as an exception */ +PyAPI_FUNC(PyObject*) PyCodec_StrictErrors(PyObject* exc); + +/* ignore the unicode error, skipping the faulty input */ +PyAPI_FUNC(PyObject*) PyCodec_IgnoreErrors(PyObject* exc); + +/* replace the unicode encode error with ? or U+FFFD */ +PyAPI_FUNC(PyObject*) PyCodec_ReplaceErrors(PyObject* exc); + +/* replace the unicode encode error with XML character references */ +PyAPI_FUNC(PyObject*) PyCodec_XMLCharRefReplaceErrors(PyObject* exc); + +/* replace the unicode encode error with backslash escapes (\x, \u and \U) */ +PyAPI_FUNC(PyObject*) PyCodec_BackslashReplaceErrors(PyObject* exc); + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03050000 +/* replace the unicode encode error with backslash escapes (\N, \x, \u and \U) + */ +PyAPI_FUNC(PyObject*) PyCodec_NameReplaceErrors(PyObject* exc); +#endif + +#ifndef Py_LIMITED_API +PyAPI_DATA(const char*) Py_hexdigits; +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_CODECREGISTRY_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/compile.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/compile.h new file mode 100644 index 0000000..964821a --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/compile.h @@ -0,0 +1,71 @@ +#ifndef Py_COMPILE_H +#define Py_COMPILE_H + +#ifndef Py_LIMITED_API +#include "code.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Public interface */ +struct _node; /* Declare the existence of this type */ +PyAPI_FUNC(PyCodeObject*) PyNode_Compile(struct _node*, const char*); + +/* Future feature support */ + +typedef struct { + int ff_features; /* flags set by future statements */ + int ff_lineno; /* line number of last future statement */ +} PyFutureFeatures; + +#define FUTURE_NESTED_SCOPES "nested_scopes" +#define FUTURE_GENERATORS "generators" +#define FUTURE_DIVISION "division" +#define FUTURE_ABSOLUTE_IMPORT "absolute_import" +#define FUTURE_WITH_STATEMENT "with_statement" +#define FUTURE_PRINT_FUNCTION "print_function" +#define FUTURE_UNICODE_LITERALS "unicode_literals" +#define FUTURE_BARRY_AS_BDFL "barry_as_FLUFL" +#define FUTURE_GENERATOR_STOP "generator_stop" + +struct _mod; /* Declare the existence of this type */ +#define PyAST_Compile(mod, s, f, ar) PyAST_CompileEx(mod, s, f, -1, ar) +PyAPI_FUNC(PyCodeObject*) PyAST_CompileEx( + struct _mod* mod, + const char* filename, /* decoded from the filesystem encoding */ + PyCompilerFlags* flags, + int optimize, + PyArena* arena); +PyAPI_FUNC(PyCodeObject*) PyAST_CompileObject( + struct _mod* mod, + PyObject* filename, + PyCompilerFlags* flags, + int optimize, + PyArena* arena); +PyAPI_FUNC(PyFutureFeatures*) PyFuture_FromAST( + struct _mod* mod, + const char* filename /* decoded from the filesystem encoding */ + ); +PyAPI_FUNC(PyFutureFeatures*) + PyFuture_FromASTObject(struct _mod* mod, PyObject* filename); + +/* _Py_Mangle is defined in compile.c */ +PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject* p, PyObject* name); + +#define PY_INVALID_STACK_EFFECT INT_MAX +PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg); + +#ifdef __cplusplus +} +#endif + +#endif /* !Py_LIMITED_API */ + +/* These definitions must match corresponding definitions in graminit.h. + There's code in compile.c that checks that they are the same. */ +#define Py_single_input 256 +#define Py_file_input 257 +#define Py_eval_input 258 + +#endif /* !Py_COMPILE_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/complexobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/complexobject.h new file mode 100644 index 0000000..5bc7c7f --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/complexobject.h @@ -0,0 +1,66 @@ +/* Complex number structure */ + +#ifndef Py_COMPLEXOBJECT_H +#define Py_COMPLEXOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_LIMITED_API +typedef struct { + double real; + double imag; +} Py_complex; + +/* Operations on complex numbers from complexmodule.c */ + +PyAPI_FUNC(Py_complex) _Py_c_sum(Py_complex, Py_complex); +PyAPI_FUNC(Py_complex) _Py_c_diff(Py_complex, Py_complex); +PyAPI_FUNC(Py_complex) _Py_c_neg(Py_complex); +PyAPI_FUNC(Py_complex) _Py_c_prod(Py_complex, Py_complex); +PyAPI_FUNC(Py_complex) _Py_c_quot(Py_complex, Py_complex); +PyAPI_FUNC(Py_complex) _Py_c_pow(Py_complex, Py_complex); +PyAPI_FUNC(double) _Py_c_abs(Py_complex); +#endif + +/* Complex object interface */ + +/* +PyComplexObject represents a complex number with double-precision +real and imaginary parts. +*/ +#ifndef Py_LIMITED_API +typedef struct { PyObject_HEAD Py_complex cval; } PyComplexObject; +#endif + +PyAPI_DATA(PyTypeObject) PyComplex_Type; + +#define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type) +#define PyComplex_CheckExact(op) (Py_TYPE(op) == &PyComplex_Type) + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) PyComplex_FromCComplex(Py_complex); +#endif +PyAPI_FUNC(PyObject*) PyComplex_FromDoubles(double real, double imag); + +PyAPI_FUNC(double) PyComplex_RealAsDouble(PyObject* op); +PyAPI_FUNC(double) PyComplex_ImagAsDouble(PyObject* op); +#ifndef Py_LIMITED_API +PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject* op); +#endif + +/* Format the object based on the format_spec, as defined in PEP 3101 + (Advanced String Formatting). */ +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _PyComplex_FormatAdvancedWriter( + _PyUnicodeWriter* writer, + PyObject* obj, + PyObject* format_spec, + Py_ssize_t start, + Py_ssize_t end); +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_COMPLEXOBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/datetime.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/datetime.h new file mode 100644 index 0000000..1592300 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/datetime.h @@ -0,0 +1,271 @@ +/* datetime.h + */ +#ifndef Py_LIMITED_API +#ifndef DATETIME_H +#define DATETIME_H +#ifdef __cplusplus +extern "C" { +#endif + +/* Fields are packed into successive bytes, each viewed as unsigned and + * big-endian, unless otherwise noted: + * + * byte offset + * 0 year 2 bytes, 1-9999 + * 2 month 1 byte, 1-12 + * 3 day 1 byte, 1-31 + * 4 hour 1 byte, 0-23 + * 5 minute 1 byte, 0-59 + * 6 second 1 byte, 0-59 + * 7 usecond 3 bytes, 0-999999 + * 10 + */ + +/* # of bytes for year, month, and day. */ +#define _PyDateTime_DATE_DATASIZE 4 + +/* # of bytes for hour, minute, second, and usecond. */ +#define _PyDateTime_TIME_DATASIZE 6 + +/* # of bytes for year, month, day, hour, minute, second, and usecond. */ +#define _PyDateTime_DATETIME_DATASIZE 10 + +typedef struct { + PyObject_HEAD Py_hash_t hashcode; /* -1 when unknown */ + int days; /* -MAX_DELTA_DAYS <= days <= MAX_DELTA_DAYS */ + int seconds; /* 0 <= seconds < 24*3600 is invariant */ + int microseconds; /* 0 <= microseconds < 1000000 is invariant */ +} PyDateTime_Delta; + +typedef struct { + PyObject_HEAD /* a pure abstract base class */ +} PyDateTime_TZInfo; + +/* The datetime and time types have hashcodes, and an optional tzinfo member, + * present if and only if hastzinfo is true. + */ +#define _PyTZINFO_HEAD \ + PyObject_HEAD Py_hash_t hashcode; \ + char hastzinfo; /* boolean flag */ + +/* No _PyDateTime_BaseTZInfo is allocated; it's just to have something + * convenient to cast to, when getting at the hastzinfo member of objects + * starting with _PyTZINFO_HEAD. + */ +typedef struct { _PyTZINFO_HEAD } _PyDateTime_BaseTZInfo; + +/* All time objects are of PyDateTime_TimeType, but that can be allocated + * in two ways, with or without a tzinfo member. Without is the same as + * tzinfo == None, but consumes less memory. _PyDateTime_BaseTime is an + * internal struct used to allocate the right amount of space for the + * "without" case. + */ +#define _PyDateTime_TIMEHEAD \ + _PyTZINFO_HEAD unsigned char data[_PyDateTime_TIME_DATASIZE]; + +typedef struct { + _PyDateTime_TIMEHEAD +} _PyDateTime_BaseTime; /* hastzinfo false */ + +typedef struct { + _PyDateTime_TIMEHEAD unsigned char fold; + PyObject* tzinfo; +} PyDateTime_Time; /* hastzinfo true */ + +/* All datetime objects are of PyDateTime_DateTimeType, but that can be + * allocated in two ways too, just like for time objects above. In addition, + * the plain date type is a base class for datetime, so it must also have + * a hastzinfo member (although it's unused there). + */ +typedef struct { + _PyTZINFO_HEAD unsigned char data[_PyDateTime_DATE_DATASIZE]; +} PyDateTime_Date; + +#define _PyDateTime_DATETIMEHEAD \ + _PyTZINFO_HEAD unsigned char data[_PyDateTime_DATETIME_DATASIZE]; + +typedef struct { + _PyDateTime_DATETIMEHEAD +} _PyDateTime_BaseDateTime; /* hastzinfo false */ + +typedef struct { + _PyDateTime_DATETIMEHEAD unsigned char fold; + PyObject* tzinfo; +} PyDateTime_DateTime; /* hastzinfo true */ + +/* Apply for date and datetime instances. */ +#define PyDateTime_GET_YEAR(o) \ + ((((PyDateTime_Date*)o)->data[0] << 8) | ((PyDateTime_Date*)o)->data[1]) +#define PyDateTime_GET_MONTH(o) (((PyDateTime_Date*)o)->data[2]) +#define PyDateTime_GET_DAY(o) (((PyDateTime_Date*)o)->data[3]) + +#define PyDateTime_DATE_GET_HOUR(o) (((PyDateTime_DateTime*)o)->data[4]) +#define PyDateTime_DATE_GET_MINUTE(o) (((PyDateTime_DateTime*)o)->data[5]) +#define PyDateTime_DATE_GET_SECOND(o) (((PyDateTime_DateTime*)o)->data[6]) +#define PyDateTime_DATE_GET_MICROSECOND(o) \ + ((((PyDateTime_DateTime*)o)->data[7] << 16) | \ + (((PyDateTime_DateTime*)o)->data[8] << 8) | \ + ((PyDateTime_DateTime*)o)->data[9]) +#define PyDateTime_DATE_GET_FOLD(o) (((PyDateTime_DateTime*)o)->fold) + +/* Apply for time instances. */ +#define PyDateTime_TIME_GET_HOUR(o) (((PyDateTime_Time*)o)->data[0]) +#define PyDateTime_TIME_GET_MINUTE(o) (((PyDateTime_Time*)o)->data[1]) +#define PyDateTime_TIME_GET_SECOND(o) (((PyDateTime_Time*)o)->data[2]) +#define PyDateTime_TIME_GET_MICROSECOND(o) \ + ((((PyDateTime_Time*)o)->data[3] << 16) | \ + (((PyDateTime_Time*)o)->data[4] << 8) | ((PyDateTime_Time*)o)->data[5]) +#define PyDateTime_TIME_GET_FOLD(o) (((PyDateTime_Time*)o)->fold) + +/* Apply for time delta instances */ +#define PyDateTime_DELTA_GET_DAYS(o) (((PyDateTime_Delta*)o)->days) +#define PyDateTime_DELTA_GET_SECONDS(o) (((PyDateTime_Delta*)o)->seconds) +#define PyDateTime_DELTA_GET_MICROSECONDS(o) \ + (((PyDateTime_Delta*)o)->microseconds) + +/* Define structure for C API. */ +typedef struct { + /* type objects */ + PyTypeObject* DateType; + PyTypeObject* DateTimeType; + PyTypeObject* TimeType; + PyTypeObject* DeltaType; + PyTypeObject* TZInfoType; + + /* constructors */ + PyObject* (*Date_FromDate)(int, int, int, PyTypeObject*); + PyObject* (*DateTime_FromDateAndTime)( + int, + int, + int, + int, + int, + int, + int, + PyObject*, + PyTypeObject*); + PyObject* (*Time_FromTime)(int, int, int, int, PyObject*, PyTypeObject*); + PyObject* (*Delta_FromDelta)(int, int, int, int, PyTypeObject*); + + /* constructors for the DB API */ + PyObject* (*DateTime_FromTimestamp)(PyObject*, PyObject*, PyObject*); + PyObject* (*Date_FromTimestamp)(PyObject*, PyObject*); + + /* PEP 495 constructors */ + PyObject* (*DateTime_FromDateAndTimeAndFold)( + int, + int, + int, + int, + int, + int, + int, + PyObject*, + int, + PyTypeObject*); + PyObject* ( + *Time_FromTimeAndFold)(int, int, int, int, PyObject*, int, PyTypeObject*); + +} PyDateTime_CAPI; + +#define PyDateTime_CAPSULE_NAME "datetime.datetime_CAPI" + +#ifdef Py_BUILD_CORE + +/* Macros for type checking when building the Python core. */ +#define PyDate_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateType) +#define PyDate_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DateType) + +#define PyDateTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateTimeType) +#define PyDateTime_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DateTimeType) + +#define PyTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_TimeType) +#define PyTime_CheckExact(op) (Py_TYPE(op) == &PyDateTime_TimeType) + +#define PyDelta_Check(op) PyObject_TypeCheck(op, &PyDateTime_DeltaType) +#define PyDelta_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DeltaType) + +#define PyTZInfo_Check(op) PyObject_TypeCheck(op, &PyDateTime_TZInfoType) +#define PyTZInfo_CheckExact(op) (Py_TYPE(op) == &PyDateTime_TZInfoType) + +#else + +/* Define global variable for the C API and a macro for setting it. */ +static PyDateTime_CAPI* PyDateTimeAPI = NULL; + +#define PyDateTime_IMPORT \ + PyDateTimeAPI = (PyDateTime_CAPI*)PyCapsule_Import(PyDateTime_CAPSULE_NAME, 0) + +/* Macros for type checking when not building the Python core. */ +#define PyDate_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateType) +#define PyDate_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DateType) + +#define PyDateTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateTimeType) +#define PyDateTime_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DateTimeType) + +#define PyTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TimeType) +#define PyTime_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->TimeType) + +#define PyDelta_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DeltaType) +#define PyDelta_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DeltaType) + +#define PyTZInfo_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TZInfoType) +#define PyTZInfo_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->TZInfoType) + +/* Macros for accessing constructors in a simplified fashion. */ +#define PyDate_FromDate(year, month, day) \ + PyDateTimeAPI->Date_FromDate(year, month, day, PyDateTimeAPI->DateType) + +#define PyDateTime_FromDateAndTime(year, month, day, hour, min, sec, usec) \ + PyDateTimeAPI->DateTime_FromDateAndTime( \ + year, \ + month, \ + day, \ + hour, \ + min, \ + sec, \ + usec, \ + Py_None, \ + PyDateTimeAPI->DateTimeType) + +#define PyDateTime_FromDateAndTimeAndFold( \ + year, month, day, hour, min, sec, usec, fold) \ + PyDateTimeAPI->DateTime_FromDateAndTimeAndFold( \ + year, \ + month, \ + day, \ + hour, \ + min, \ + sec, \ + usec, \ + Py_None, \ + fold, \ + PyDateTimeAPI->DateTimeType) + +#define PyTime_FromTime(hour, minute, second, usecond) \ + PyDateTimeAPI->Time_FromTime( \ + hour, minute, second, usecond, Py_None, PyDateTimeAPI->TimeType) + +#define PyTime_FromTimeAndFold(hour, minute, second, usecond, fold) \ + PyDateTimeAPI->Time_FromTimeAndFold( \ + hour, minute, second, usecond, Py_None, fold, PyDateTimeAPI->TimeType) + +#define PyDelta_FromDSU(days, seconds, useconds) \ + PyDateTimeAPI->Delta_FromDelta( \ + days, seconds, useconds, 1, PyDateTimeAPI->DeltaType) + +/* Macros supporting the DB API. */ +#define PyDateTime_FromTimestamp(args) \ + PyDateTimeAPI->DateTime_FromTimestamp( \ + (PyObject*)(PyDateTimeAPI->DateTimeType), args, NULL) + +#define PyDate_FromTimestamp(args) \ + PyDateTimeAPI->Date_FromTimestamp((PyObject*)(PyDateTimeAPI->DateType), args) + +#endif /* Py_BUILD_CORE */ + +#ifdef __cplusplus +} +#endif +#endif +#endif /* !Py_LIMITED_API */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/descrobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/descrobject.h new file mode 100644 index 0000000..a50d086 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/descrobject.h @@ -0,0 +1,104 @@ +/* Descriptors */ +#ifndef Py_DESCROBJECT_H +#define Py_DESCROBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef PyObject* (*getter)(PyObject*, void*); +typedef int (*setter)(PyObject*, PyObject*, void*); + +typedef struct PyGetSetDef { + char* name; + getter get; + setter set; + char* doc; + void* closure; +} PyGetSetDef; + +#ifndef Py_LIMITED_API +typedef PyObject* (*wrapperfunc)(PyObject* self, PyObject* args, void* wrapped); + +typedef PyObject* (*wrapperfunc_kwds)( + PyObject* self, + PyObject* args, + void* wrapped, + PyObject* kwds); + +struct wrapperbase { + char* name; + int offset; + void* function; + wrapperfunc wrapper; + char* doc; + int flags; + PyObject* name_strobj; +}; + +/* Flags for above struct */ +#define PyWrapperFlag_KEYWORDS 1 /* wrapper function takes keyword args */ + +/* Various kinds of descriptor objects */ + +typedef struct { + PyObject_HEAD PyTypeObject* d_type; + PyObject* d_name; + PyObject* d_qualname; +} PyDescrObject; + +#define PyDescr_COMMON PyDescrObject d_common + +#define PyDescr_TYPE(x) (((PyDescrObject*)(x))->d_type) +#define PyDescr_NAME(x) (((PyDescrObject*)(x))->d_name) + +typedef struct { + PyDescr_COMMON; + PyMethodDef* d_method; +} PyMethodDescrObject; + +typedef struct { + PyDescr_COMMON; + struct PyMemberDef* d_member; +} PyMemberDescrObject; + +typedef struct { + PyDescr_COMMON; + PyGetSetDef* d_getset; +} PyGetSetDescrObject; + +typedef struct { + PyDescr_COMMON; + struct wrapperbase* d_base; + void* d_wrapped; /* This can be any function pointer */ +} PyWrapperDescrObject; +#endif /* Py_LIMITED_API */ + +PyAPI_DATA(PyTypeObject) PyClassMethodDescr_Type; +PyAPI_DATA(PyTypeObject) PyGetSetDescr_Type; +PyAPI_DATA(PyTypeObject) PyMemberDescr_Type; +PyAPI_DATA(PyTypeObject) PyMethodDescr_Type; +PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type; +PyAPI_DATA(PyTypeObject) PyDictProxy_Type; +#ifndef Py_LIMITED_API +PyAPI_DATA(PyTypeObject) _PyMethodWrapper_Type; +#endif /* Py_LIMITED_API */ + +PyAPI_FUNC(PyObject*) PyDescr_NewMethod(PyTypeObject*, PyMethodDef*); +PyAPI_FUNC(PyObject*) PyDescr_NewClassMethod(PyTypeObject*, PyMethodDef*); +struct PyMemberDef; /* forward declaration for following prototype */ +PyAPI_FUNC(PyObject*) PyDescr_NewMember(PyTypeObject*, struct PyMemberDef*); +PyAPI_FUNC(PyObject*) PyDescr_NewGetSet(PyTypeObject*, struct PyGetSetDef*); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) + PyDescr_NewWrapper(PyTypeObject*, struct wrapperbase*, void*); +#define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL) +#endif + +PyAPI_FUNC(PyObject*) PyDictProxy_New(PyObject*); +PyAPI_FUNC(PyObject*) PyWrapper_New(PyObject*, PyObject*); + +PyAPI_DATA(PyTypeObject) PyProperty_Type; +#ifdef __cplusplus +} +#endif +#endif /* !Py_DESCROBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/dictobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/dictobject.h new file mode 100644 index 0000000..d6441ae --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/dictobject.h @@ -0,0 +1,186 @@ +#ifndef Py_DICTOBJECT_H +#define Py_DICTOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +/* Dictionary object type -- mapping from hashable object to object */ + +/* The distribution includes a separate file, Objects/dictnotes.txt, + describing explorations into dictionary design and optimization. + It covers typical dictionary use patterns, the parameters for + tuning dictionaries, and several ideas for possible optimizations. +*/ + +#ifndef Py_LIMITED_API + +typedef struct _dictkeysobject PyDictKeysObject; + +/* The ma_values pointer is NULL for a combined table + * or points to an array of PyObject* for a split table + */ +typedef struct { + PyObject_HEAD + + /* Number of items in the dictionary */ + Py_ssize_t ma_used; + + /* Dictionary version: globally unique, value change each time + the dictionary is modified */ + uint64_t ma_version_tag; + + PyDictKeysObject* ma_keys; + + /* If ma_values is NULL, the table is "combined": keys and values + are stored in ma_keys. + + If ma_values is not NULL, the table is splitted: + keys are stored in ma_keys and values are stored in ma_values */ + PyObject** ma_values; +} PyDictObject; + +typedef struct { PyObject_HEAD PyDictObject* dv_dict; } _PyDictViewObject; + +#endif /* Py_LIMITED_API */ + +PyAPI_DATA(PyTypeObject) PyDict_Type; +PyAPI_DATA(PyTypeObject) PyDictIterKey_Type; +PyAPI_DATA(PyTypeObject) PyDictIterValue_Type; +PyAPI_DATA(PyTypeObject) PyDictIterItem_Type; +PyAPI_DATA(PyTypeObject) PyDictKeys_Type; +PyAPI_DATA(PyTypeObject) PyDictItems_Type; +PyAPI_DATA(PyTypeObject) PyDictValues_Type; + +#define PyDict_Check(op) \ + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS) +#define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) +#define PyDictKeys_Check(op) PyObject_TypeCheck(op, &PyDictKeys_Type) +#define PyDictItems_Check(op) PyObject_TypeCheck(op, &PyDictItems_Type) +#define PyDictValues_Check(op) PyObject_TypeCheck(op, &PyDictValues_Type) +/* This excludes Values, since they are not sets. */ +#define PyDictViewSet_Check(op) (PyDictKeys_Check(op) || PyDictItems_Check(op)) + +PyAPI_FUNC(PyObject*) PyDict_New(void); +PyAPI_FUNC(PyObject*) PyDict_GetItem(PyObject* mp, PyObject* key); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) + _PyDict_GetItem_KnownHash(PyObject* mp, PyObject* key, Py_hash_t hash); +#endif +PyAPI_FUNC(PyObject*) PyDict_GetItemWithError(PyObject* mp, PyObject* key); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) + _PyDict_GetItemIdWithError(PyObject* dp, struct _Py_Identifier* key); +PyAPI_FUNC(PyObject*) + PyDict_SetDefault(PyObject* mp, PyObject* key, PyObject* defaultobj); +#endif +PyAPI_FUNC(int) PyDict_SetItem(PyObject* mp, PyObject* key, PyObject* item); +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _PyDict_SetItem_KnownHash( + PyObject* mp, + PyObject* key, + PyObject* item, + Py_hash_t hash); +#endif +PyAPI_FUNC(int) PyDict_DelItem(PyObject* mp, PyObject* key); +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) + _PyDict_DelItem_KnownHash(PyObject* mp, PyObject* key, Py_hash_t hash); +PyAPI_FUNC(int) _PyDict_DelItemIf( + PyObject* mp, + PyObject* key, + int (*predicate)(PyObject* value)); +#endif +PyAPI_FUNC(void) PyDict_Clear(PyObject* mp); +PyAPI_FUNC(int) PyDict_Next( + PyObject* mp, + Py_ssize_t* pos, + PyObject** key, + PyObject** value); +#ifndef Py_LIMITED_API +PyDictKeysObject* _PyDict_NewKeysForClass(void); +PyAPI_FUNC(PyObject*) PyObject_GenericGetDict(PyObject*, void*); +PyAPI_FUNC(int) _PyDict_Next( + PyObject* mp, + Py_ssize_t* pos, + PyObject** key, + PyObject** value, + Py_hash_t* hash); +PyObject* _PyDictView_New(PyObject*, PyTypeObject*); +#endif +PyAPI_FUNC(PyObject*) PyDict_Keys(PyObject* mp); +PyAPI_FUNC(PyObject*) PyDict_Values(PyObject* mp); +PyAPI_FUNC(PyObject*) PyDict_Items(PyObject* mp); +PyAPI_FUNC(Py_ssize_t) PyDict_Size(PyObject* mp); +PyAPI_FUNC(PyObject*) PyDict_Copy(PyObject* mp); +PyAPI_FUNC(int) PyDict_Contains(PyObject* mp, PyObject* key); +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _PyDict_Contains(PyObject* mp, PyObject* key, Py_hash_t hash); +PyAPI_FUNC(PyObject*) _PyDict_NewPresized(Py_ssize_t minused); +PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject* mp); +PyAPI_FUNC(int) _PyDict_HasOnlyStringKeys(PyObject* mp); +Py_ssize_t _PyDict_KeysSize(PyDictKeysObject* keys); +Py_ssize_t _PyDict_SizeOf(PyDictObject*); +PyAPI_FUNC(PyObject*) _PyDict_Pop(PyObject*, PyObject*, PyObject*); +PyObject* _PyDict_Pop_KnownHash(PyObject*, PyObject*, Py_hash_t, PyObject*); +PyObject* _PyDict_FromKeys(PyObject*, PyObject*, PyObject*); +#define _PyDict_HasSplitTable(d) ((d)->ma_values != NULL) + +PyAPI_FUNC(int) PyDict_ClearFreeList(void); +#endif + +/* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */ +PyAPI_FUNC(int) PyDict_Update(PyObject* mp, PyObject* other); + +/* PyDict_Merge updates/merges from a mapping object (an object that + supports PyMapping_Keys() and PyObject_GetItem()). If override is true, + the last occurrence of a key wins, else the first. The Python + dict.update(other) is equivalent to PyDict_Merge(dict, other, 1). +*/ +PyAPI_FUNC(int) PyDict_Merge(PyObject* mp, PyObject* other, int override); + +#ifndef Py_LIMITED_API +/* Like PyDict_Merge, but override can be 0, 1 or 2. If override is 0, + the first occurrence of a key wins, if override is 1, the last occurrence + of a key wins, if override is 2, a KeyError with conflicting key as + argument is raised. +*/ +PyAPI_FUNC(int) _PyDict_MergeEx(PyObject* mp, PyObject* other, int override); +PyAPI_FUNC(PyObject*) _PyDictView_Intersect(PyObject* self, PyObject* other); +#endif + +/* PyDict_MergeFromSeq2 updates/merges from an iterable object producing + iterable objects of length 2. If override is true, the last occurrence + of a key wins, else the first. The Python dict constructor dict(seq2) + is equivalent to dict={}; PyDict_MergeFromSeq(dict, seq2, 1). +*/ +PyAPI_FUNC(int) PyDict_MergeFromSeq2(PyObject* d, PyObject* seq2, int override); + +PyAPI_FUNC(PyObject*) PyDict_GetItemString(PyObject* dp, const char* key); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) + _PyDict_GetItemId(PyObject* dp, struct _Py_Identifier* key); +#endif /* !Py_LIMITED_API */ +PyAPI_FUNC(int) + PyDict_SetItemString(PyObject* dp, const char* key, PyObject* item); +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) + _PyDict_SetItemId(PyObject* dp, struct _Py_Identifier* key, PyObject* item); +#endif /* !Py_LIMITED_API */ +PyAPI_FUNC(int) PyDict_DelItemString(PyObject* dp, const char* key); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _PyDict_DelItemId(PyObject* mp, struct _Py_Identifier* key); +PyAPI_FUNC(void) _PyDict_DebugMallocStats(FILE* out); + +int _PyObjectDict_SetItem( + PyTypeObject* tp, + PyObject** dictptr, + PyObject* name, + PyObject* value); +PyObject* _PyDict_LoadGlobal(PyDictObject*, PyDictObject*, PyObject*); +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_DICTOBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/dtoa.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/dtoa.h new file mode 100644 index 0000000..3dcb129 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/dtoa.h @@ -0,0 +1,23 @@ +#ifndef Py_LIMITED_API +#ifndef PY_NO_SHORT_FLOAT_REPR +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_FUNC(double) _Py_dg_strtod(const char* str, char** ptr); +PyAPI_FUNC(char*) _Py_dg_dtoa( + double d, + int mode, + int ndigits, + int* decpt, + int* sign, + char** rve); +PyAPI_FUNC(void) _Py_dg_freedtoa(char* s); +PyAPI_FUNC(double) _Py_dg_stdnan(int sign); +PyAPI_FUNC(double) _Py_dg_infinity(int sign); + +#ifdef __cplusplus +} +#endif +#endif +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/dynamic_annotations.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/dynamic_annotations.h new file mode 100644 index 0000000..b1858fb --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/dynamic_annotations.h @@ -0,0 +1,521 @@ +/* Copyright (c) 2008-2009, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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. + * + * --- + * Author: Kostya Serebryany + * Copied to CPython by Jeffrey Yasskin, with all macros renamed to + * start with _Py_ to avoid colliding with users embedding Python, and + * with deprecated macros removed. + */ + +/* This file defines dynamic annotations for use with dynamic analysis + tool such as valgrind, PIN, etc. + + Dynamic annotation is a source code annotation that affects + the generated code (that is, the annotation is not a comment). + Each such annotation is attached to a particular + instruction and/or to a particular object (address) in the program. + + The annotations that should be used by users are macros in all upper-case + (e.g., _Py_ANNOTATE_NEW_MEMORY). + + Actual implementation of these macros may differ depending on the + dynamic analysis tool being used. + + See http://code.google.com/p/data-race-test/ for more information. + + This file supports the following dynamic analysis tools: + - None (DYNAMIC_ANNOTATIONS_ENABLED is not defined or zero). + Macros are defined empty. + - ThreadSanitizer, Helgrind, DRD (DYNAMIC_ANNOTATIONS_ENABLED is 1). + Macros are defined as calls to non-inlinable empty functions + that are intercepted by Valgrind. */ + +#ifndef __DYNAMIC_ANNOTATIONS_H__ +#define __DYNAMIC_ANNOTATIONS_H__ + +#ifndef DYNAMIC_ANNOTATIONS_ENABLED +#define DYNAMIC_ANNOTATIONS_ENABLED 0 +#endif + +#if DYNAMIC_ANNOTATIONS_ENABLED != 0 + +/* ------------------------------------------------------------- + Annotations useful when implementing condition variables such as CondVar, + using conditional critical sections (Await/LockWhen) and when constructing + user-defined synchronization mechanisms. + + The annotations _Py_ANNOTATE_HAPPENS_BEFORE() and + _Py_ANNOTATE_HAPPENS_AFTER() can be used to define happens-before arcs in + user-defined synchronization mechanisms: the race detector will infer an + arc from the former to the latter when they share the same argument + pointer. + + Example 1 (reference counting): + + void Unref() { + _Py_ANNOTATE_HAPPENS_BEFORE(&refcount_); + if (AtomicDecrementByOne(&refcount_) == 0) { + _Py_ANNOTATE_HAPPENS_AFTER(&refcount_); + delete this; + } + } + + Example 2 (message queue): + + void MyQueue::Put(Type *e) { + MutexLock lock(&mu_); + _Py_ANNOTATE_HAPPENS_BEFORE(e); + PutElementIntoMyQueue(e); + } + + Type *MyQueue::Get() { + MutexLock lock(&mu_); + Type *e = GetElementFromMyQueue(); + _Py_ANNOTATE_HAPPENS_AFTER(e); + return e; + } + + Note: when possible, please use the existing reference counting and message + queue implementations instead of inventing new ones. */ + +/* Report that wait on the condition variable at address "cv" has succeeded + and the lock at address "lock" is held. */ +#define _Py_ANNOTATE_CONDVAR_LOCK_WAIT(cv, lock) \ + AnnotateCondVarWait(__FILE__, __LINE__, cv, lock) + +/* Report that wait on the condition variable at "cv" has succeeded. Variant + w/o lock. */ +#define _Py_ANNOTATE_CONDVAR_WAIT(cv) \ + AnnotateCondVarWait(__FILE__, __LINE__, cv, NULL) + +/* Report that we are about to signal on the condition variable at address + "cv". */ +#define _Py_ANNOTATE_CONDVAR_SIGNAL(cv) \ + AnnotateCondVarSignal(__FILE__, __LINE__, cv) + +/* Report that we are about to signal_all on the condition variable at "cv". */ +#define _Py_ANNOTATE_CONDVAR_SIGNAL_ALL(cv) \ + AnnotateCondVarSignalAll(__FILE__, __LINE__, cv) + +/* Annotations for user-defined synchronization mechanisms. */ +#define _Py_ANNOTATE_HAPPENS_BEFORE(obj) _Py_ANNOTATE_CONDVAR_SIGNAL(obj) +#define _Py_ANNOTATE_HAPPENS_AFTER(obj) _Py_ANNOTATE_CONDVAR_WAIT(obj) + +/* Report that the bytes in the range [pointer, pointer+size) are about + to be published safely. The race checker will create a happens-before + arc from the call _Py_ANNOTATE_PUBLISH_MEMORY_RANGE(pointer, size) to + subsequent accesses to this memory. + Note: this annotation may not work properly if the race detector uses + sampling, i.e. does not observe all memory accesses. + */ +#define _Py_ANNOTATE_PUBLISH_MEMORY_RANGE(pointer, size) \ + AnnotatePublishMemoryRange(__FILE__, __LINE__, pointer, size) + +/* Instruct the tool to create a happens-before arc between mu->Unlock() and + mu->Lock(). This annotation may slow down the race detector and hide real + races. Normally it is used only when it would be difficult to annotate each + of the mutex's critical sections individually using the annotations above. + This annotation makes sense only for hybrid race detectors. For pure + happens-before detectors this is a no-op. For more details see + http://code.google.com/p/data-race-test/wiki/PureHappensBeforeVsHybrid . */ +#define _Py_ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX(mu) \ + AnnotateMutexIsUsedAsCondVar(__FILE__, __LINE__, mu) + +/* ------------------------------------------------------------- + Annotations useful when defining memory allocators, or when memory that + was protected in one way starts to be protected in another. */ + +/* Report that a new memory at "address" of size "size" has been allocated. + This might be used when the memory has been retrieved from a free list and + is about to be reused, or when the locking discipline for a variable + changes. */ +#define _Py_ANNOTATE_NEW_MEMORY(address, size) \ + AnnotateNewMemory(__FILE__, __LINE__, address, size) + +/* ------------------------------------------------------------- + Annotations useful when defining FIFO queues that transfer data between + threads. */ + +/* Report that the producer-consumer queue (such as ProducerConsumerQueue) at + address "pcq" has been created. The _Py_ANNOTATE_PCQ_* annotations should + be used only for FIFO queues. For non-FIFO queues use + _Py_ANNOTATE_HAPPENS_BEFORE (for put) and _Py_ANNOTATE_HAPPENS_AFTER (for + get). */ +#define _Py_ANNOTATE_PCQ_CREATE(pcq) AnnotatePCQCreate(__FILE__, __LINE__, pcq) + +/* Report that the queue at address "pcq" is about to be destroyed. */ +#define _Py_ANNOTATE_PCQ_DESTROY(pcq) \ + AnnotatePCQDestroy(__FILE__, __LINE__, pcq) + +/* Report that we are about to put an element into a FIFO queue at address + "pcq". */ +#define _Py_ANNOTATE_PCQ_PUT(pcq) AnnotatePCQPut(__FILE__, __LINE__, pcq) + +/* Report that we've just got an element from a FIFO queue at address "pcq". */ +#define _Py_ANNOTATE_PCQ_GET(pcq) AnnotatePCQGet(__FILE__, __LINE__, pcq) + +/* ------------------------------------------------------------- + Annotations that suppress errors. It is usually better to express the + program's synchronization using the other annotations, but these can + be used when all else fails. */ + +/* Report that we may have a benign race at "pointer", with size + "sizeof(*(pointer))". "pointer" must be a non-void* pointer. Insert at the + point where "pointer" has been allocated, preferably close to the point + where the race happens. See also _Py_ANNOTATE_BENIGN_RACE_STATIC. */ +#define _Py_ANNOTATE_BENIGN_RACE(pointer, description) \ + AnnotateBenignRaceSized( \ + __FILE__, __LINE__, pointer, sizeof(*(pointer)), description) + +/* Same as _Py_ANNOTATE_BENIGN_RACE(address, description), but applies to + the memory range [address, address+size). */ +#define _Py_ANNOTATE_BENIGN_RACE_SIZED(address, size, description) \ + AnnotateBenignRaceSized(__FILE__, __LINE__, address, size, description) + +/* Request the analysis tool to ignore all reads in the current thread + until _Py_ANNOTATE_IGNORE_READS_END is called. + Useful to ignore intentional racey reads, while still checking + other reads and all writes. + See also _Py_ANNOTATE_UNPROTECTED_READ. */ +#define _Py_ANNOTATE_IGNORE_READS_BEGIN() \ + AnnotateIgnoreReadsBegin(__FILE__, __LINE__) + +/* Stop ignoring reads. */ +#define _Py_ANNOTATE_IGNORE_READS_END() \ + AnnotateIgnoreReadsEnd(__FILE__, __LINE__) + +/* Similar to _Py_ANNOTATE_IGNORE_READS_BEGIN, but ignore writes. */ +#define _Py_ANNOTATE_IGNORE_WRITES_BEGIN() \ + AnnotateIgnoreWritesBegin(__FILE__, __LINE__) + +/* Stop ignoring writes. */ +#define _Py_ANNOTATE_IGNORE_WRITES_END() \ + AnnotateIgnoreWritesEnd(__FILE__, __LINE__) + +/* Start ignoring all memory accesses (reads and writes). */ +#define _Py_ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN() \ + do { \ + _Py_ANNOTATE_IGNORE_READS_BEGIN(); \ + _Py_ANNOTATE_IGNORE_WRITES_BEGIN(); \ + } while (0) + +/* Stop ignoring all memory accesses. */ +#define _Py_ANNOTATE_IGNORE_READS_AND_WRITES_END() \ + do { \ + _Py_ANNOTATE_IGNORE_WRITES_END(); \ + _Py_ANNOTATE_IGNORE_READS_END(); \ + } while (0) + +/* Similar to _Py_ANNOTATE_IGNORE_READS_BEGIN, but ignore synchronization + events: + RWLOCK* and CONDVAR*. */ +#define _Py_ANNOTATE_IGNORE_SYNC_BEGIN() \ + AnnotateIgnoreSyncBegin(__FILE__, __LINE__) + +/* Stop ignoring sync events. */ +#define _Py_ANNOTATE_IGNORE_SYNC_END() AnnotateIgnoreSyncEnd(__FILE__, __LINE__) + +/* Enable (enable!=0) or disable (enable==0) race detection for all threads. + This annotation could be useful if you want to skip expensive race analysis + during some period of program execution, e.g. during initialization. */ +#define _Py_ANNOTATE_ENABLE_RACE_DETECTION(enable) \ + AnnotateEnableRaceDetection(__FILE__, __LINE__, enable) + +/* ------------------------------------------------------------- + Annotations useful for debugging. */ + +/* Request to trace every access to "address". */ +#define _Py_ANNOTATE_TRACE_MEMORY(address) \ + AnnotateTraceMemory(__FILE__, __LINE__, address) + +/* Report the current thread name to a race detector. */ +#define _Py_ANNOTATE_THREAD_NAME(name) \ + AnnotateThreadName(__FILE__, __LINE__, name) + +/* ------------------------------------------------------------- + Annotations useful when implementing locks. They are not + normally needed by modules that merely use locks. + The "lock" argument is a pointer to the lock object. */ + +/* Report that a lock has been created at address "lock". */ +#define _Py_ANNOTATE_RWLOCK_CREATE(lock) \ + AnnotateRWLockCreate(__FILE__, __LINE__, lock) + +/* Report that the lock at address "lock" is about to be destroyed. */ +#define _Py_ANNOTATE_RWLOCK_DESTROY(lock) \ + AnnotateRWLockDestroy(__FILE__, __LINE__, lock) + +/* Report that the lock at address "lock" has been acquired. + is_w=1 for writer lock, is_w=0 for reader lock. */ +#define _Py_ANNOTATE_RWLOCK_ACQUIRED(lock, is_w) \ + AnnotateRWLockAcquired(__FILE__, __LINE__, lock, is_w) + +/* Report that the lock at address "lock" is about to be released. */ +#define _Py_ANNOTATE_RWLOCK_RELEASED(lock, is_w) \ + AnnotateRWLockReleased(__FILE__, __LINE__, lock, is_w) + +/* ------------------------------------------------------------- + Annotations useful when implementing barriers. They are not + normally needed by modules that merely use barriers. + The "barrier" argument is a pointer to the barrier object. */ + +/* Report that the "barrier" has been initialized with initial "count". + If 'reinitialization_allowed' is true, initialization is allowed to happen + multiple times w/o calling barrier_destroy() */ +#define _Py_ANNOTATE_BARRIER_INIT(barrier, count, reinitialization_allowed) \ + AnnotateBarrierInit( \ + __FILE__, __LINE__, barrier, count, reinitialization_allowed) + +/* Report that we are about to enter barrier_wait("barrier"). */ +#define _Py_ANNOTATE_BARRIER_WAIT_BEFORE(barrier) \ + AnnotateBarrierWaitBefore(__FILE__, __LINE__, barrier) + +/* Report that we just exited barrier_wait("barrier"). */ +#define _Py_ANNOTATE_BARRIER_WAIT_AFTER(barrier) \ + AnnotateBarrierWaitAfter(__FILE__, __LINE__, barrier) + +/* Report that the "barrier" has been destroyed. */ +#define _Py_ANNOTATE_BARRIER_DESTROY(barrier) \ + AnnotateBarrierDestroy(__FILE__, __LINE__, barrier) + +/* ------------------------------------------------------------- + Annotations useful for testing race detectors. */ + +/* Report that we expect a race on the variable at "address". + Use only in unit tests for a race detector. */ +#define _Py_ANNOTATE_EXPECT_RACE(address, description) \ + AnnotateExpectRace(__FILE__, __LINE__, address, description) + +/* A no-op. Insert where you like to test the interceptors. */ +#define _Py_ANNOTATE_NO_OP(arg) AnnotateNoOp(__FILE__, __LINE__, arg) + +/* Force the race detector to flush its state. The actual effect depends on + * the implementation of the detector. */ +#define _Py_ANNOTATE_FLUSH_STATE() AnnotateFlushState(__FILE__, __LINE__) + +#else /* DYNAMIC_ANNOTATIONS_ENABLED == 0 */ + +#define _Py_ANNOTATE_RWLOCK_CREATE(lock) /* empty */ +#define _Py_ANNOTATE_RWLOCK_DESTROY(lock) /* empty */ +#define _Py_ANNOTATE_RWLOCK_ACQUIRED(lock, is_w) /* empty */ +#define _Py_ANNOTATE_RWLOCK_RELEASED(lock, is_w) /* empty */ +#define _Py_ANNOTATE_BARRIER_INIT( \ + barrier, count, reinitialization_allowed) /* */ +#define _Py_ANNOTATE_BARRIER_WAIT_BEFORE(barrier) /* empty */ +#define _Py_ANNOTATE_BARRIER_WAIT_AFTER(barrier) /* empty */ +#define _Py_ANNOTATE_BARRIER_DESTROY(barrier) /* empty */ +#define _Py_ANNOTATE_CONDVAR_LOCK_WAIT(cv, lock) /* empty */ +#define _Py_ANNOTATE_CONDVAR_WAIT(cv) /* empty */ +#define _Py_ANNOTATE_CONDVAR_SIGNAL(cv) /* empty */ +#define _Py_ANNOTATE_CONDVAR_SIGNAL_ALL(cv) /* empty */ +#define _Py_ANNOTATE_HAPPENS_BEFORE(obj) /* empty */ +#define _Py_ANNOTATE_HAPPENS_AFTER(obj) /* empty */ +#define _Py_ANNOTATE_PUBLISH_MEMORY_RANGE(address, size) /* empty */ +#define _Py_ANNOTATE_UNPUBLISH_MEMORY_RANGE(address, size) /* empty */ +#define _Py_ANNOTATE_SWAP_MEMORY_RANGE(address, size) /* empty */ +#define _Py_ANNOTATE_PCQ_CREATE(pcq) /* empty */ +#define _Py_ANNOTATE_PCQ_DESTROY(pcq) /* empty */ +#define _Py_ANNOTATE_PCQ_PUT(pcq) /* empty */ +#define _Py_ANNOTATE_PCQ_GET(pcq) /* empty */ +#define _Py_ANNOTATE_NEW_MEMORY(address, size) /* empty */ +#define _Py_ANNOTATE_EXPECT_RACE(address, description) /* empty */ +#define _Py_ANNOTATE_BENIGN_RACE(address, description) /* empty */ +#define _Py_ANNOTATE_BENIGN_RACE_SIZED(address, size, description) /* empty */ +#define _Py_ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX(mu) /* empty */ +#define _Py_ANNOTATE_MUTEX_IS_USED_AS_CONDVAR(mu) /* empty */ +#define _Py_ANNOTATE_TRACE_MEMORY(arg) /* empty */ +#define _Py_ANNOTATE_THREAD_NAME(name) /* empty */ +#define _Py_ANNOTATE_IGNORE_READS_BEGIN() /* empty */ +#define _Py_ANNOTATE_IGNORE_READS_END() /* empty */ +#define _Py_ANNOTATE_IGNORE_WRITES_BEGIN() /* empty */ +#define _Py_ANNOTATE_IGNORE_WRITES_END() /* empty */ +#define _Py_ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN() /* empty */ +#define _Py_ANNOTATE_IGNORE_READS_AND_WRITES_END() /* empty */ +#define _Py_ANNOTATE_IGNORE_SYNC_BEGIN() /* empty */ +#define _Py_ANNOTATE_IGNORE_SYNC_END() /* empty */ +#define _Py_ANNOTATE_ENABLE_RACE_DETECTION(enable) /* empty */ +#define _Py_ANNOTATE_NO_OP(arg) /* empty */ +#define _Py_ANNOTATE_FLUSH_STATE() /* empty */ + +#endif /* DYNAMIC_ANNOTATIONS_ENABLED */ + +/* Use the macros above rather than using these functions directly. */ +#ifdef __cplusplus +extern "C" { +#endif +void AnnotateRWLockCreate( + const char* file, + int line, + const volatile void* lock); +void AnnotateRWLockDestroy( + const char* file, + int line, + const volatile void* lock); +void AnnotateRWLockAcquired( + const char* file, + int line, + const volatile void* lock, + long is_w); +void AnnotateRWLockReleased( + const char* file, + int line, + const volatile void* lock, + long is_w); +void AnnotateBarrierInit( + const char* file, + int line, + const volatile void* barrier, + long count, + long reinitialization_allowed); +void AnnotateBarrierWaitBefore( + const char* file, + int line, + const volatile void* barrier); +void AnnotateBarrierWaitAfter( + const char* file, + int line, + const volatile void* barrier); +void AnnotateBarrierDestroy( + const char* file, + int line, + const volatile void* barrier); +void AnnotateCondVarWait( + const char* file, + int line, + const volatile void* cv, + const volatile void* lock); +void AnnotateCondVarSignal(const char* file, int line, const volatile void* cv); +void AnnotateCondVarSignalAll( + const char* file, + int line, + const volatile void* cv); +void AnnotatePublishMemoryRange( + const char* file, + int line, + const volatile void* address, + long size); +void AnnotateUnpublishMemoryRange( + const char* file, + int line, + const volatile void* address, + long size); +void AnnotatePCQCreate(const char* file, int line, const volatile void* pcq); +void AnnotatePCQDestroy(const char* file, int line, const volatile void* pcq); +void AnnotatePCQPut(const char* file, int line, const volatile void* pcq); +void AnnotatePCQGet(const char* file, int line, const volatile void* pcq); +void AnnotateNewMemory( + const char* file, + int line, + const volatile void* address, + long size); +void AnnotateExpectRace( + const char* file, + int line, + const volatile void* address, + const char* description); +void AnnotateBenignRace( + const char* file, + int line, + const volatile void* address, + const char* description); +void AnnotateBenignRaceSized( + const char* file, + int line, + const volatile void* address, + long size, + const char* description); +void AnnotateMutexIsUsedAsCondVar( + const char* file, + int line, + const volatile void* mu); +void AnnotateTraceMemory(const char* file, int line, const volatile void* arg); +void AnnotateThreadName(const char* file, int line, const char* name); +void AnnotateIgnoreReadsBegin(const char* file, int line); +void AnnotateIgnoreReadsEnd(const char* file, int line); +void AnnotateIgnoreWritesBegin(const char* file, int line); +void AnnotateIgnoreWritesEnd(const char* file, int line); +void AnnotateEnableRaceDetection(const char* file, int line, int enable); +void AnnotateNoOp(const char* file, int line, const volatile void* arg); +void AnnotateFlushState(const char* file, int line); + +/* Return non-zero value if running under valgrind. + + If "valgrind.h" is included into dynamic_annotations.c, + the regular valgrind mechanism will be used. + See http://valgrind.org/docs/manual/manual-core-adv.html about + RUNNING_ON_VALGRIND and other valgrind "client requests". + The file "valgrind.h" may be obtained by doing + svn co svn://svn.valgrind.org/valgrind/trunk/include + + If for some reason you can't use "valgrind.h" or want to fake valgrind, + there are two ways to make this function return non-zero: + - Use environment variable: export RUNNING_ON_VALGRIND=1 + - Make your tool intercept the function RunningOnValgrind() and + change its return value. + */ +int RunningOnValgrind(void); + +#ifdef __cplusplus +} +#endif + +#if DYNAMIC_ANNOTATIONS_ENABLED != 0 && defined(__cplusplus) + +/* _Py_ANNOTATE_UNPROTECTED_READ is the preferred way to annotate racey reads. + + Instead of doing + _Py_ANNOTATE_IGNORE_READS_BEGIN(); + ... = x; + _Py_ANNOTATE_IGNORE_READS_END(); + one can use + ... = _Py_ANNOTATE_UNPROTECTED_READ(x); */ +template +inline T _Py_ANNOTATE_UNPROTECTED_READ(const volatile T& x) { + _Py_ANNOTATE_IGNORE_READS_BEGIN(); + T res = x; + _Py_ANNOTATE_IGNORE_READS_END(); + return res; +} +/* Apply _Py_ANNOTATE_BENIGN_RACE_SIZED to a static variable. */ +#define _Py_ANNOTATE_BENIGN_RACE_STATIC(static_var, description) \ + namespace { \ + class static_var##_annotator { \ + public: \ + static_var##_annotator() { \ + _Py_ANNOTATE_BENIGN_RACE_SIZED( \ + &static_var, sizeof(static_var), #static_var ": " description); \ + } \ + }; \ + static static_var##_annotator the##static_var##_annotator; \ + } +#else /* DYNAMIC_ANNOTATIONS_ENABLED == 0 */ + +#define _Py_ANNOTATE_UNPROTECTED_READ(x) (x) +#define _Py_ANNOTATE_BENIGN_RACE_STATIC(static_var, description) /* empty */ + +#endif /* DYNAMIC_ANNOTATIONS_ENABLED */ + +#endif /* __DYNAMIC_ANNOTATIONS_H__ */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/enumobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/enumobject.h new file mode 100644 index 0000000..c14dbfc --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/enumobject.h @@ -0,0 +1,17 @@ +#ifndef Py_ENUMOBJECT_H +#define Py_ENUMOBJECT_H + +/* Enumerate Object */ + +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_DATA(PyTypeObject) PyEnum_Type; +PyAPI_DATA(PyTypeObject) PyReversed_Type; + +#ifdef __cplusplus +} +#endif + +#endif /* !Py_ENUMOBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/errcode.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/errcode.h new file mode 100644 index 0000000..f18d31d --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/errcode.h @@ -0,0 +1,37 @@ +#ifndef Py_ERRCODE_H +#define Py_ERRCODE_H +#ifdef __cplusplus +extern "C" { +#endif + +/* Error codes passed around between file input, tokenizer, parser and + interpreter. This is necessary so we can turn them into Python + exceptions at a higher level. Note that some errors have a + slightly different meaning when passed from the tokenizer to the + parser than when passed from the parser to the interpreter; e.g. + the parser only returns E_EOF when it hits EOF immediately, and it + never returns E_OK. */ + +#define E_OK 10 /* No error */ +#define E_EOF 11 /* End Of File */ +#define E_INTR 12 /* Interrupted */ +#define E_TOKEN 13 /* Bad token */ +#define E_SYNTAX 14 /* Syntax error */ +#define E_NOMEM 15 /* Ran out of memory */ +#define E_DONE 16 /* Parsing complete */ +#define E_ERROR 17 /* Execution error */ +#define E_TABSPACE 18 /* Inconsistent mixing of tabs and spaces */ +#define E_OVERFLOW 19 /* Node had too many children */ +#define E_TOODEEP 20 /* Too many indentation levels */ +#define E_DEDENT 21 /* No matching outer block for dedent */ +#define E_DECODE 22 /* Error in decoding into Unicode */ +#define E_EOFS 23 /* EOF in triple-quoted string */ +#define E_EOLS 24 /* EOL in single-quoted string */ +#define E_LINECONT 25 /* Unexpected characters after a line continuation */ +#define E_IDENTIFIER 26 /* Invalid characters in identifier */ +#define E_BADSINGLE 27 /* Ill-formed single statement input */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_ERRCODE_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/eval.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/eval.h new file mode 100644 index 0000000..d09df7f --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/eval.h @@ -0,0 +1,32 @@ + +/* Interface to execute compiled code */ + +#ifndef Py_EVAL_H +#define Py_EVAL_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_FUNC(PyObject*) PyEval_EvalCode(PyObject*, PyObject*, PyObject*); + +PyAPI_FUNC(PyObject*) PyEval_EvalCodeEx( + PyObject* co, + PyObject* globals, + PyObject* locals, + PyObject** args, + int argc, + PyObject** kwds, + int kwdc, + PyObject** defs, + int defc, + PyObject* kwdefs, + PyObject* closure); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _PyEval_CallTracing(PyObject* func, PyObject* args); +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_EVAL_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/fileobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/fileobject.h new file mode 100644 index 0000000..1abac0a --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/fileobject.h @@ -0,0 +1,56 @@ +/* File object interface (what's left of it -- see io.py) */ + +#ifndef Py_FILEOBJECT_H +#define Py_FILEOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#define PY_STDIOTEXTMODE "b" + +PyAPI_FUNC(PyObject*) PyFile_FromFd( + int, + const char*, + const char*, + int, + const char*, + const char*, + const char*, + int); +PyAPI_FUNC(PyObject*) PyFile_GetLine(PyObject*, int); +PyAPI_FUNC(int) PyFile_WriteObject(PyObject*, PyObject*, int); +PyAPI_FUNC(int) PyFile_WriteString(const char*, PyObject*); +PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject*); +#ifndef Py_LIMITED_API +PyAPI_FUNC(char*) Py_UniversalNewlineFgets(char*, int, FILE*, PyObject*); +#endif + +/* The default encoding used by the platform file system APIs + If non-NULL, this is different than the default encoding for strings +*/ +PyAPI_DATA(const char*) Py_FileSystemDefaultEncoding; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03060000 +PyAPI_DATA(const char*) Py_FileSystemDefaultEncodeErrors; +#endif +PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding; + +/* Internal API + + The std printer acts as a preliminary sys.stderr until the new io + infrastructure is in place. */ +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) PyFile_NewStdPrinter(int); +PyAPI_DATA(PyTypeObject) PyStdPrinter_Type; +#endif /* Py_LIMITED_API */ + +/* A routine to check if a file descriptor can be select()-ed. */ +#ifdef HAVE_SELECT +#define _PyIsSelectable_fd(FD) ((unsigned int)(FD) < (unsigned int)FD_SETSIZE) +#else +#define _PyIsSelectable_fd(FD) (1) +#endif /* HAVE_SELECT */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_FILEOBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/fileutils.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/fileutils.h new file mode 100644 index 0000000..5c8a154 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/fileutils.h @@ -0,0 +1,112 @@ +#ifndef Py_FILEUTILS_H +#define Py_FILEUTILS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03050000 +PyAPI_FUNC(wchar_t*) Py_DecodeLocale(const char* arg, size_t* size); + +PyAPI_FUNC(char*) Py_EncodeLocale(const wchar_t* text, size_t* error_pos); +#endif + +#ifndef Py_LIMITED_API + +PyAPI_FUNC(wchar_t*) + _Py_DecodeLocaleEx(const char* arg, size_t* size, int current_locale); + +PyAPI_FUNC(char*) _Py_EncodeLocaleEx( + const wchar_t* text, + size_t* error_pos, + int current_locale); + +PyAPI_FUNC(PyObject*) _Py_device_encoding(int); + +#ifdef MS_WINDOWS +struct _Py_stat_struct { + unsigned long st_dev; + uint64_t st_ino; + unsigned short st_mode; + int st_nlink; + int st_uid; + int st_gid; + unsigned long st_rdev; + __int64 st_size; + time_t st_atime; + int st_atime_nsec; + time_t st_mtime; + int st_mtime_nsec; + time_t st_ctime; + int st_ctime_nsec; + unsigned long st_file_attributes; +}; +#else +#define _Py_stat_struct stat +#endif + +PyAPI_FUNC(int) _Py_fstat(int fd, struct _Py_stat_struct* status); + +PyAPI_FUNC(int) _Py_fstat_noraise(int fd, struct _Py_stat_struct* status); + +PyAPI_FUNC(int) _Py_stat(PyObject* path, struct stat* status); + +PyAPI_FUNC(int) _Py_open(const char* pathname, int flags); + +PyAPI_FUNC(int) _Py_open_noraise(const char* pathname, int flags); + +PyAPI_FUNC(FILE*) _Py_wfopen(const wchar_t* path, const wchar_t* mode); + +PyAPI_FUNC(FILE*) _Py_fopen(const char* pathname, const char* mode); + +PyAPI_FUNC(FILE*) _Py_fopen_obj(PyObject* path, const char* mode); + +PyAPI_FUNC(Py_ssize_t) _Py_read(int fd, void* buf, size_t count); + +PyAPI_FUNC(Py_ssize_t) _Py_write(int fd, const void* buf, size_t count); + +PyAPI_FUNC(Py_ssize_t) _Py_write_noraise(int fd, const void* buf, size_t count); + +#ifdef HAVE_READLINK +PyAPI_FUNC(int) _Py_wreadlink(const wchar_t* path, wchar_t* buf, size_t bufsiz); +#endif + +#ifdef HAVE_REALPATH +PyAPI_FUNC(wchar_t*) _Py_wrealpath( + const wchar_t* path, + wchar_t* resolved_path, + size_t resolved_path_size); +#endif + +PyAPI_FUNC(wchar_t*) _Py_wgetcwd(wchar_t* buf, size_t size); + +PyAPI_FUNC(int) _Py_get_inheritable(int fd); + +PyAPI_FUNC(int) + _Py_set_inheritable(int fd, int inheritable, int* atomic_flag_works); + +PyAPI_FUNC(int) _Py_set_inheritable_async_safe( + int fd, + int inheritable, + int* atomic_flag_works); + +PyAPI_FUNC(int) _Py_dup(int fd); + +#ifndef MS_WINDOWS +PyAPI_FUNC(int) _Py_get_blocking(int fd); + +PyAPI_FUNC(int) _Py_set_blocking(int fd, int blocking); +#endif /* !MS_WINDOWS */ + +PyAPI_FUNC(int) _Py_GetLocaleconvNumeric( + PyObject** decimal_point, + PyObject** thousands_sep, + const char** grouping); + +#endif /* Py_LIMITED_API */ + +#ifdef __cplusplus +} +#endif + +#endif /* !Py_FILEUTILS_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/floatobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/floatobject.h new file mode 100644 index 0000000..0558fb9 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/floatobject.h @@ -0,0 +1,129 @@ + +/* Float object interface */ + +/* +PyFloatObject represents a (double precision) floating point number. +*/ + +#ifndef Py_FLOATOBJECT_H +#define Py_FLOATOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_LIMITED_API +typedef struct { PyObject_HEAD double ob_fval; } PyFloatObject; +#endif + +PyAPI_DATA(PyTypeObject) PyFloat_Type; + +#define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type) +#define PyFloat_CheckExact(op) (Py_TYPE(op) == &PyFloat_Type) + +#ifdef Py_NAN +#define Py_RETURN_NAN return PyFloat_FromDouble(Py_NAN) +#endif + +#define Py_RETURN_INF(sign) \ + do \ + if (copysign(1., sign) == 1.) { \ + return PyFloat_FromDouble(Py_HUGE_VAL); \ + } else { \ + return PyFloat_FromDouble(-Py_HUGE_VAL); \ + } \ + while (0) + +PyAPI_FUNC(double) PyFloat_GetMax(void); +PyAPI_FUNC(double) PyFloat_GetMin(void); +PyAPI_FUNC(PyObject*) PyFloat_GetInfo(void); + +/* Return Python float from string PyObject. */ +PyAPI_FUNC(PyObject*) PyFloat_FromString(PyObject*); + +/* Return Python float from C double. */ +PyAPI_FUNC(PyObject*) PyFloat_FromDouble(double); + +/* Extract C double from Python float. The macro version trades safety for + speed. */ +PyAPI_FUNC(double) PyFloat_AsDouble(PyObject*); +#ifndef Py_LIMITED_API +#define PyFloat_AS_DOUBLE(op) (((PyFloatObject*)(op))->ob_fval) +#endif + +#ifndef Py_LIMITED_API +/* _PyFloat_{Pack,Unpack}{4,8} + * + * The struct and pickle (at least) modules need an efficient platform- + * independent way to store floating-point values as byte strings. + * The Pack routines produce a string from a C double, and the Unpack + * routines produce a C double from such a string. The suffix (4 or 8) + * specifies the number of bytes in the string. + * + * On platforms that appear to use (see _PyFloat_Init()) IEEE-754 formats + * these functions work by copying bits. On other platforms, the formats the + * 4- byte format is identical to the IEEE-754 single precision format, and + * the 8-byte format to the IEEE-754 double precision format, although the + * packing of INFs and NaNs (if such things exist on the platform) isn't + * handled correctly, and attempting to unpack a string containing an IEEE + * INF or NaN will raise an exception. + * + * On non-IEEE platforms with more precision, or larger dynamic range, than + * 754 supports, not all values can be packed; on non-IEEE platforms with less + * precision, or smaller dynamic range, not all values can be unpacked. What + * happens in such cases is partly accidental (alas). + */ + +/* The pack routines write 2, 4 or 8 bytes, starting at p. le is a bool + * argument, true if you want the string in little-endian format (exponent + * last, at p+1, p+3 or p+7), false if you want big-endian format (exponent + * first, at p). + * Return value: 0 if all is OK, -1 if error (and an exception is + * set, most likely OverflowError). + * There are two problems on non-IEEE platforms: + * 1): What this does is undefined if x is a NaN or infinity. + * 2): -0.0 and +0.0 produce the same string. + */ +PyAPI_FUNC(int) _PyFloat_Pack2(double x, unsigned char* p, int le); +PyAPI_FUNC(int) _PyFloat_Pack4(double x, unsigned char* p, int le); +PyAPI_FUNC(int) _PyFloat_Pack8(double x, unsigned char* p, int le); + +/* Needed for the old way for marshal to store a floating point number. + Returns the string length copied into p, -1 on error. + */ +PyAPI_FUNC(int) _PyFloat_Repr(double x, char* p, size_t len); + +/* Used to get the important decimal digits of a double */ +PyAPI_FUNC(int) _PyFloat_Digits(char* buf, double v, int* signum); +PyAPI_FUNC(void) _PyFloat_DigitsInit(void); + +/* The unpack routines read 2, 4 or 8 bytes, starting at p. le is a bool + * argument, true if the string is in little-endian format (exponent + * last, at p+1, p+3 or p+7), false if big-endian (exponent first, at p). + * Return value: The unpacked double. On error, this is -1.0 and + * PyErr_Occurred() is true (and an exception is set, most likely + * OverflowError). Note that on a non-IEEE platform this will refuse + * to unpack a string that represents a NaN or infinity. + */ +PyAPI_FUNC(double) _PyFloat_Unpack2(const unsigned char* p, int le); +PyAPI_FUNC(double) _PyFloat_Unpack4(const unsigned char* p, int le); +PyAPI_FUNC(double) _PyFloat_Unpack8(const unsigned char* p, int le); + +/* free list api */ +PyAPI_FUNC(int) PyFloat_ClearFreeList(void); + +PyAPI_FUNC(void) _PyFloat_DebugMallocStats(FILE* out); + +/* Format the object based on the format_spec, as defined in PEP 3101 + (Advanced String Formatting). */ +PyAPI_FUNC(int) _PyFloat_FormatAdvancedWriter( + _PyUnicodeWriter* writer, + PyObject* obj, + PyObject* format_spec, + Py_ssize_t start, + Py_ssize_t end); +#endif /* Py_LIMITED_API */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_FLOATOBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/frameobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/frameobject.h new file mode 100644 index 0000000..19cd3de --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/frameobject.h @@ -0,0 +1,92 @@ + +/* Frame object interface */ + +#ifndef Py_LIMITED_API +#ifndef Py_FRAMEOBJECT_H +#define Py_FRAMEOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + int b_type; /* what kind of block this is */ + int b_handler; /* where to jump to find handler */ + int b_level; /* value stack level to pop to */ +} PyTryBlock; + +typedef struct _frame { + PyObject_VAR_HEAD struct _frame* f_back; /* previous frame, or NULL */ + PyCodeObject* f_code; /* code segment */ + PyObject* f_builtins; /* builtin symbol table (PyDictObject) */ + PyObject* f_globals; /* global symbol table (PyDictObject) */ + PyObject* f_locals; /* local symbol table (any mapping) */ + PyObject** f_valuestack; /* points after the last local */ + /* Next free slot in f_valuestack. Frame creation sets to f_valuestack. + Frame evaluation usually NULLs it, but a frame that yields sets it + to the current stack top. */ + PyObject** f_stacktop; + PyObject* f_trace; /* Trace function */ + + /* In a generator, we need to be able to swap between the exception + state inside the generator and the exception state of the calling + frame (which shouldn't be impacted when the generator "yields" + from an except handler). + These three fields exist exactly for that, and are unused for + non-generator frames. See the save_exc_state and swap_exc_state + functions in ceval.c for details of their use. */ + PyObject *f_exc_type, *f_exc_value, *f_exc_traceback; + /* Borrowed reference to a generator, or NULL */ + PyObject* f_gen; + + int f_lasti; /* Last instruction if called */ + /* Call PyFrame_GetLineNumber() instead of reading this field + directly. As of 2.3 f_lineno is only valid when tracing is + active (i.e. when f_trace is set). At other times we use + PyCode_Addr2Line to calculate the line from the current + bytecode index. */ + int f_lineno; /* Current line number */ + int f_iblock; /* index in f_blockstack */ + char f_executing; /* whether the frame is still executing */ + PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */ + PyObject* f_localsplus[1]; /* locals+stack, dynamically sized */ +} PyFrameObject; + +/* Standard object interface */ + +PyAPI_DATA(PyTypeObject) PyFrame_Type; + +#define PyFrame_Check(op) (Py_TYPE(op) == &PyFrame_Type) + +PyAPI_FUNC(PyFrameObject*) + PyFrame_New(PyThreadState*, PyCodeObject*, PyObject*, PyObject*); + +/* The rest of the interface is specific for frame objects */ + +/* Block management functions */ + +PyAPI_FUNC(void) PyFrame_BlockSetup(PyFrameObject*, int, int, int); +PyAPI_FUNC(PyTryBlock*) PyFrame_BlockPop(PyFrameObject*); + +/* Extend the value stack */ + +PyAPI_FUNC(PyObject**) PyFrame_ExtendStack(PyFrameObject*, int, int); + +/* Conversions between "fast locals" and locals in dictionary */ + +PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject*, int); + +PyAPI_FUNC(int) PyFrame_FastToLocalsWithError(PyFrameObject* f); +PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject*); + +PyAPI_FUNC(int) PyFrame_ClearFreeList(void); + +PyAPI_FUNC(void) _PyFrame_DebugMallocStats(FILE* out); + +/* Return the line of code the frame is currently executing. */ +PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject*); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_FRAMEOBJECT_H */ +#endif /* Py_LIMITED_API */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/funcobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/funcobject.h new file mode 100644 index 0000000..c91d2d8 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/funcobject.h @@ -0,0 +1,98 @@ + +/* Function object interface */ +#ifndef Py_LIMITED_API +#ifndef Py_FUNCOBJECT_H +#define Py_FUNCOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +/* Function objects and code objects should not be confused with each other: + * + * Function objects are created by the execution of the 'def' statement. + * They reference a code object in their __code__ attribute, which is a + * purely syntactic object, i.e. nothing more than a compiled version of some + * source code lines. There is one code object per source code "fragment", + * but each code object can be referenced by zero or many function objects + * depending only on how many times the 'def' statement in the source was + * executed so far. + */ + +typedef struct { + PyObject_HEAD PyObject* func_code; /* A code object, the __code__ attribute */ + PyObject* func_globals; /* A dictionary (other mappings won't do) */ + PyObject* func_defaults; /* NULL or a tuple */ + PyObject* func_kwdefaults; /* NULL or a dict */ + PyObject* func_closure; /* NULL or a tuple of cell objects */ + PyObject* func_doc; /* The __doc__ attribute, can be anything */ + PyObject* func_name; /* The __name__ attribute, a string object */ + PyObject* func_dict; /* The __dict__ attribute, a dict or NULL */ + PyObject* func_weakreflist; /* List of weak references */ + PyObject* func_module; /* The __module__ attribute, can be anything */ + PyObject* func_annotations; /* Annotations, a dict or NULL */ + PyObject* func_qualname; /* The qualified name */ + + /* Invariant: + * func_closure contains the bindings for func_code->co_freevars, so + * PyTuple_Size(func_closure) == PyCode_GetNumFree(func_code) + * (func_closure may be NULL if PyCode_GetNumFree(func_code) == 0). + */ +} PyFunctionObject; + +PyAPI_DATA(PyTypeObject) PyFunction_Type; + +#define PyFunction_Check(op) (Py_TYPE(op) == &PyFunction_Type) + +PyAPI_FUNC(PyObject*) PyFunction_New(PyObject*, PyObject*); +PyAPI_FUNC(PyObject*) + PyFunction_NewWithQualName(PyObject*, PyObject*, PyObject*); +PyAPI_FUNC(PyObject*) PyFunction_GetCode(PyObject*); +PyAPI_FUNC(PyObject*) PyFunction_GetGlobals(PyObject*); +PyAPI_FUNC(PyObject*) PyFunction_GetModule(PyObject*); +PyAPI_FUNC(PyObject*) PyFunction_GetDefaults(PyObject*); +PyAPI_FUNC(int) PyFunction_SetDefaults(PyObject*, PyObject*); +PyAPI_FUNC(PyObject*) PyFunction_GetKwDefaults(PyObject*); +PyAPI_FUNC(int) PyFunction_SetKwDefaults(PyObject*, PyObject*); +PyAPI_FUNC(PyObject*) PyFunction_GetClosure(PyObject*); +PyAPI_FUNC(int) PyFunction_SetClosure(PyObject*, PyObject*); +PyAPI_FUNC(PyObject*) PyFunction_GetAnnotations(PyObject*); +PyAPI_FUNC(int) PyFunction_SetAnnotations(PyObject*, PyObject*); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _PyFunction_FastCallDict( + PyObject* func, + PyObject** args, + Py_ssize_t nargs, + PyObject* kwargs); + +PyAPI_FUNC(PyObject*) _PyFunction_FastCallKeywords( + PyObject* func, + PyObject** stack, + Py_ssize_t nargs, + PyObject* kwnames); +#endif + +/* Macros for direct access to these values. Type checks are *not* + done, so use with care. */ +#define PyFunction_GET_CODE(func) (((PyFunctionObject*)func)->func_code) +#define PyFunction_GET_GLOBALS(func) (((PyFunctionObject*)func)->func_globals) +#define PyFunction_GET_MODULE(func) (((PyFunctionObject*)func)->func_module) +#define PyFunction_GET_DEFAULTS(func) (((PyFunctionObject*)func)->func_defaults) +#define PyFunction_GET_KW_DEFAULTS(func) \ + (((PyFunctionObject*)func)->func_kwdefaults) +#define PyFunction_GET_CLOSURE(func) (((PyFunctionObject*)func)->func_closure) +#define PyFunction_GET_ANNOTATIONS(func) \ + (((PyFunctionObject*)func)->func_annotations) + +/* The classmethod and staticmethod types lives here, too */ +PyAPI_DATA(PyTypeObject) PyClassMethod_Type; +PyAPI_DATA(PyTypeObject) PyStaticMethod_Type; + +PyAPI_FUNC(PyObject*) PyClassMethod_New(PyObject*); +PyAPI_FUNC(PyObject*) PyStaticMethod_New(PyObject*); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_FUNCOBJECT_H */ +#endif /* Py_LIMITED_API */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/genobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/genobject.h new file mode 100644 index 0000000..31b22f9 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/genobject.h @@ -0,0 +1,101 @@ + +/* Generator object interface */ + +#ifndef Py_LIMITED_API +#ifndef Py_GENOBJECT_H +#define Py_GENOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +struct _frame; /* Avoid including frameobject.h */ + +/* _PyGenObject_HEAD defines the initial segment of generator + and coroutine objects. */ +#define _PyGenObject_HEAD(prefix) \ + PyObject_HEAD /* Note: gi_frame can be NULL if the generator is "finished" \ + */ \ + struct _frame* prefix##_frame; \ + /* True if generator is being executed. */ \ + char prefix##_running; \ + /* The code object backing the generator */ \ + PyObject* prefix##_code; \ + /* List of weak reference. */ \ + PyObject* prefix##_weakreflist; \ + /* Name of the generator. */ \ + PyObject* prefix##_name; \ + /* Qualified name of the generator. */ \ + PyObject* prefix##_qualname; + +typedef struct { + /* The gi_ prefix is intended to remind of generator-iterator. */ + _PyGenObject_HEAD(gi) +} PyGenObject; + +PyAPI_DATA(PyTypeObject) PyGen_Type; + +#define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type) +#define PyGen_CheckExact(op) (Py_TYPE(op) == &PyGen_Type) + +PyAPI_FUNC(PyObject*) PyGen_New(struct _frame*); +PyAPI_FUNC(PyObject*) + PyGen_NewWithQualName(struct _frame*, PyObject* name, PyObject* qualname); +PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject*); +PyAPI_FUNC(int) _PyGen_SetStopIterationValue(PyObject*); +PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject**); +PyAPI_FUNC(PyObject*) _PyGen_Send(PyGenObject*, PyObject*); +PyObject* _PyGen_yf(PyGenObject*); +PyAPI_FUNC(void) _PyGen_Finalize(PyObject* self); + +#ifndef Py_LIMITED_API +typedef struct { _PyGenObject_HEAD(cr) } PyCoroObject; + +PyAPI_DATA(PyTypeObject) PyCoro_Type; +PyAPI_DATA(PyTypeObject) _PyCoroWrapper_Type; + +PyAPI_DATA(PyTypeObject) _PyAIterWrapper_Type; +PyObject* _PyAIterWrapper_New(PyObject* aiter); + +#define PyCoro_CheckExact(op) (Py_TYPE(op) == &PyCoro_Type) +PyObject* _PyCoro_GetAwaitableIter(PyObject* o); +PyAPI_FUNC(PyObject*) + PyCoro_New(struct _frame*, PyObject* name, PyObject* qualname); + +/* Asynchronous Generators */ + +typedef struct { + _PyGenObject_HEAD(ag) PyObject* ag_finalizer; + + /* Flag is set to 1 when hooks set up by sys.set_asyncgen_hooks + were called on the generator, to avoid calling them more + than once. */ + int ag_hooks_inited; + + /* Flag is set to 1 when aclose() is called for the first time, or + when a StopAsyncIteration exception is raised. */ + int ag_closed; +} PyAsyncGenObject; + +PyAPI_DATA(PyTypeObject) PyAsyncGen_Type; +PyAPI_DATA(PyTypeObject) _PyAsyncGenASend_Type; +PyAPI_DATA(PyTypeObject) _PyAsyncGenWrappedValue_Type; +PyAPI_DATA(PyTypeObject) _PyAsyncGenAThrow_Type; + +PyAPI_FUNC(PyObject*) + PyAsyncGen_New(struct _frame*, PyObject* name, PyObject* qualname); + +#define PyAsyncGen_CheckExact(op) (Py_TYPE(op) == &PyAsyncGen_Type) + +PyObject* _PyAsyncGenValueWrapperNew(PyObject*); + +int PyAsyncGen_ClearFreeLists(void); + +#endif + +#undef _PyGenObject_HEAD + +#ifdef __cplusplus +} +#endif +#endif /* !Py_GENOBJECT_H */ +#endif /* Py_LIMITED_API */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/graminit.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/graminit.h new file mode 100644 index 0000000..e9b4a93 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/graminit.h @@ -0,0 +1,88 @@ +/* Generated by Parser/pgen */ + +#define single_input 256 +#define file_input 257 +#define eval_input 258 +#define decorator 259 +#define decorators 260 +#define decorated 261 +#define async_funcdef 262 +#define funcdef 263 +#define parameters 264 +#define typedargslist 265 +#define tfpdef 266 +#define varargslist 267 +#define vfpdef 268 +#define stmt 269 +#define simple_stmt 270 +#define small_stmt 271 +#define expr_stmt 272 +#define annassign 273 +#define testlist_star_expr 274 +#define augassign 275 +#define del_stmt 276 +#define pass_stmt 277 +#define flow_stmt 278 +#define break_stmt 279 +#define continue_stmt 280 +#define return_stmt 281 +#define yield_stmt 282 +#define raise_stmt 283 +#define import_stmt 284 +#define import_name 285 +#define import_from 286 +#define import_as_name 287 +#define dotted_as_name 288 +#define import_as_names 289 +#define dotted_as_names 290 +#define dotted_name 291 +#define global_stmt 292 +#define nonlocal_stmt 293 +#define assert_stmt 294 +#define compound_stmt 295 +#define async_stmt 296 +#define if_stmt 297 +#define while_stmt 298 +#define for_stmt 299 +#define try_stmt 300 +#define with_stmt 301 +#define with_item 302 +#define except_clause 303 +#define suite 304 +#define test 305 +#define test_nocond 306 +#define lambdef 307 +#define lambdef_nocond 308 +#define or_test 309 +#define and_test 310 +#define not_test 311 +#define comparison 312 +#define comp_op 313 +#define star_expr 314 +#define expr 315 +#define xor_expr 316 +#define and_expr 317 +#define shift_expr 318 +#define arith_expr 319 +#define term 320 +#define factor 321 +#define power 322 +#define atom_expr 323 +#define atom 324 +#define testlist_comp 325 +#define trailer 326 +#define subscriptlist 327 +#define subscript 328 +#define sliceop 329 +#define exprlist 330 +#define testlist 331 +#define dictorsetmaker 332 +#define classdef 333 +#define arglist 334 +#define argument 335 +#define comp_iter 336 +#define comp_for 337 +#define comp_if 338 +#define encoding_decl 339 +#define yield_expr 340 +#define yield_arg 341 diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/grammar.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/grammar.h new file mode 100644 index 0000000..6787791 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/grammar.h @@ -0,0 +1,94 @@ + +/* Grammar interface */ + +#ifndef Py_GRAMMAR_H +#define Py_GRAMMAR_H +#ifdef __cplusplus +extern "C" { +#endif + +#include "bitset.h" /* Sigh... */ + +/* A label of an arc */ + +typedef struct { + int lb_type; + char* lb_str; +} label; + +#define EMPTY 0 /* Label number 0 is by definition the empty label */ + +/* A list of labels */ + +typedef struct { + int ll_nlabels; + label* ll_label; +} labellist; + +/* An arc from one state to another */ + +typedef struct { + short a_lbl; /* Label of this arc */ + short a_arrow; /* State where this arc goes to */ +} arc; + +/* A state in a DFA */ + +typedef struct { + int s_narcs; + arc* s_arc; /* Array of arcs */ + + /* Optional accelerators */ + int s_lower; /* Lowest label index */ + int s_upper; /* Highest label index */ + int* s_accel; /* Accelerator */ + int s_accept; /* Nonzero for accepting state */ +} state; + +/* A DFA */ + +typedef struct { + int d_type; /* Non-terminal this represents */ + char* d_name; /* For printing */ + int d_initial; /* Initial state */ + int d_nstates; + state* d_state; /* Array of states */ + bitset d_first; +} dfa; + +/* A grammar */ + +typedef struct { + int g_ndfas; + dfa* g_dfa; /* Array of DFAs */ + labellist g_ll; + int g_start; /* Start symbol of the grammar */ + int g_accel; /* Set if accelerators present */ +} grammar; + +/* FUNCTIONS */ + +grammar* newgrammar(int start); +void freegrammar(grammar* g); +dfa* adddfa(grammar* g, int type, const char* name); +int addstate(dfa* d); +void addarc(dfa* d, int from, int to, int lbl); +dfa* PyGrammar_FindDFA(grammar* g, int type); + +int addlabel(labellist* ll, int type, const char* str); +int findlabel(labellist* ll, int type, const char* str); +const char* PyGrammar_LabelRepr(label* lb); +void translatelabels(grammar* g); + +void addfirstsets(grammar* g); + +void PyGrammar_AddAccelerators(grammar* g); +void PyGrammar_RemoveAccelerators(grammar*); + +void printgrammar(grammar* g, FILE* fp); +void printnonterminals(grammar* g, FILE* fp); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_GRAMMAR_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/import.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/import.h new file mode 100644 index 0000000..e1f42fb --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/import.h @@ -0,0 +1,131 @@ + +/* Module definition and import interface */ + +#ifndef Py_IMPORT_H +#define Py_IMPORT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) _PyImportZip_Init(void); + +PyMODINIT_FUNC PyInit_imp(void); +#endif /* !Py_LIMITED_API */ +PyAPI_FUNC(long) PyImport_GetMagicNumber(void); +PyAPI_FUNC(const char*) PyImport_GetMagicTag(void); +PyAPI_FUNC(PyObject*) PyImport_ExecCodeModule( + const char* name, /* UTF-8 encoded string */ + PyObject* co); +PyAPI_FUNC(PyObject*) PyImport_ExecCodeModuleEx( + const char* name, /* UTF-8 encoded string */ + PyObject* co, + const char* pathname /* decoded from the filesystem encoding */ + ); +PyAPI_FUNC(PyObject*) PyImport_ExecCodeModuleWithPathnames( + const char* name, /* UTF-8 encoded string */ + PyObject* co, + const char* pathname, /* decoded from the filesystem encoding */ + const char* cpathname /* decoded from the filesystem encoding */ + ); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03030000 +PyAPI_FUNC(PyObject*) PyImport_ExecCodeModuleObject( + PyObject* name, + PyObject* co, + PyObject* pathname, + PyObject* cpathname); +#endif +PyAPI_FUNC(PyObject*) PyImport_GetModuleDict(void); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03030000 +PyAPI_FUNC(PyObject*) PyImport_AddModuleObject(PyObject* name); +#endif +PyAPI_FUNC(PyObject*) PyImport_AddModule( + const char* name /* UTF-8 encoded string */ + ); +PyAPI_FUNC(PyObject*) PyImport_ImportModule( + const char* name /* UTF-8 encoded string */ + ); +PyAPI_FUNC(PyObject*) PyImport_ImportModuleNoBlock( + const char* name /* UTF-8 encoded string */ + ); +PyAPI_FUNC(PyObject*) PyImport_ImportModuleLevel( + const char* name, /* UTF-8 encoded string */ + PyObject* globals, + PyObject* locals, + PyObject* fromlist, + int level); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03050000 +PyAPI_FUNC(PyObject*) PyImport_ImportModuleLevelObject( + PyObject* name, + PyObject* globals, + PyObject* locals, + PyObject* fromlist, + int level); +#endif + +#define PyImport_ImportModuleEx(n, g, l, f) \ + PyImport_ImportModuleLevel(n, g, l, f, 0) + +PyAPI_FUNC(PyObject*) PyImport_GetImporter(PyObject* path); +PyAPI_FUNC(PyObject*) PyImport_Import(PyObject* name); +PyAPI_FUNC(PyObject*) PyImport_ReloadModule(PyObject* m); +PyAPI_FUNC(void) PyImport_Cleanup(void); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03030000 +PyAPI_FUNC(int) PyImport_ImportFrozenModuleObject(PyObject* name); +#endif +PyAPI_FUNC(int) PyImport_ImportFrozenModule( + const char* name /* UTF-8 encoded string */ + ); + +#ifndef Py_LIMITED_API +#ifdef WITH_THREAD +PyAPI_FUNC(void) _PyImport_AcquireLock(void); +PyAPI_FUNC(int) _PyImport_ReleaseLock(void); +#else +#define _PyImport_AcquireLock() +#define _PyImport_ReleaseLock() 1 +#endif + +PyAPI_FUNC(void) _PyImport_ReInitLock(void); + +PyAPI_FUNC(PyObject*) _PyImport_FindBuiltin( + const char* name /* UTF-8 encoded string */ + ); +PyAPI_FUNC(PyObject*) _PyImport_FindExtensionObject(PyObject*, PyObject*); +PyAPI_FUNC(int) _PyImport_FixupBuiltin( + PyObject* mod, + const char* name /* UTF-8 encoded string */ + ); +PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject*, PyObject*); + +struct _inittab { + const char* name; /* ASCII encoded string */ + PyObject* (*initfunc)(void); +}; +PyAPI_DATA(struct _inittab*) PyImport_Inittab; +PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab* newtab); +#endif /* Py_LIMITED_API */ + +PyAPI_DATA(PyTypeObject) PyNullImporter_Type; + +PyAPI_FUNC(int) PyImport_AppendInittab( + const char* name, /* ASCII encoded string */ + PyObject* (*initfunc)(void)); + +#ifndef Py_LIMITED_API +struct _frozen { + const char* name; /* ASCII encoded string */ + const unsigned char* code; + int size; +}; + +/* Embedding apps may change this pointer to point to their favorite + collection of frozen modules: */ + +PyAPI_DATA(const struct _frozen*) PyImport_FrozenModules; +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_IMPORT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/intrcheck.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/intrcheck.h new file mode 100644 index 0000000..8fb96cf --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/intrcheck.h @@ -0,0 +1,24 @@ + +#ifndef Py_INTRCHECK_H +#define Py_INTRCHECK_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_FUNC(int) PyOS_InterruptOccurred(void); +PyAPI_FUNC(void) PyOS_InitInterrupts(void); +PyAPI_FUNC(void) PyOS_AfterFork(void); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _PyOS_IsMainThread(void); + +#ifdef MS_WINDOWS +/* windows.h is not included by Python.h so use void* instead of HANDLE */ +PyAPI_FUNC(void*) _PyOS_SigintEvent(void); +#endif +#endif /* !Py_LIMITED_API */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTRCHECK_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/iterobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/iterobject.h new file mode 100644 index 0000000..dc7a11f --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/iterobject.h @@ -0,0 +1,23 @@ +#ifndef Py_ITEROBJECT_H +#define Py_ITEROBJECT_H +/* Iterators (the basic kind, over a sequence) */ +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_DATA(PyTypeObject) PySeqIter_Type; +PyAPI_DATA(PyTypeObject) PyCallIter_Type; +PyAPI_DATA(PyTypeObject) PyCmpWrapper_Type; + +#define PySeqIter_Check(op) (Py_TYPE(op) == &PySeqIter_Type) + +PyAPI_FUNC(PyObject*) PySeqIter_New(PyObject*); + +#define PyCallIter_Check(op) (Py_TYPE(op) == &PyCallIter_Type) + +PyAPI_FUNC(PyObject*) PyCallIter_New(PyObject*, PyObject*); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_ITEROBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/listobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/listobject.h new file mode 100644 index 0000000..d935ddd --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/listobject.h @@ -0,0 +1,81 @@ + +/* List object interface */ + +/* +Another generally useful object type is a list of object pointers. +This is a mutable type: the list items can be changed, and items can be +added or removed. Out-of-range indices or non-list objects are ignored. + +*** WARNING *** PyList_SetItem does not increment the new item's reference +count, but does decrement the reference count of the item it replaces, +if not nil. It does *decrement* the reference count if it is *not* +inserted in the list. Similarly, PyList_GetItem does not increment the +returned item's reference count. +*/ + +#ifndef Py_LISTOBJECT_H +#define Py_LISTOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_LIMITED_API +typedef struct { + PyObject_VAR_HEAD + /* Vector of pointers to list elements. list[0] is ob_item[0], etc. */ + PyObject** ob_item; + + /* ob_item contains space for 'allocated' elements. The number + * currently in use is ob_size. + * Invariants: + * 0 <= ob_size <= allocated + * len(list) == ob_size + * ob_item == NULL implies ob_size == allocated == 0 + * list.sort() temporarily sets allocated to -1 to detect mutations. + * + * Items must normally not be NULL, except during construction when + * the list is not yet visible outside the function that builds it. + */ + Py_ssize_t allocated; +} PyListObject; +#endif + +PyAPI_DATA(PyTypeObject) PyList_Type; +PyAPI_DATA(PyTypeObject) PyListIter_Type; +PyAPI_DATA(PyTypeObject) PyListRevIter_Type; +PyAPI_DATA(PyTypeObject) PySortWrapper_Type; + +#define PyList_Check(op) \ + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS) +#define PyList_CheckExact(op) (Py_TYPE(op) == &PyList_Type) + +PyAPI_FUNC(PyObject*) PyList_New(Py_ssize_t size); +PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject*); +PyAPI_FUNC(PyObject*) PyList_GetItem(PyObject*, Py_ssize_t); +PyAPI_FUNC(int) PyList_SetItem(PyObject*, Py_ssize_t, PyObject*); +PyAPI_FUNC(int) PyList_Insert(PyObject*, Py_ssize_t, PyObject*); +PyAPI_FUNC(int) PyList_Append(PyObject*, PyObject*); +PyAPI_FUNC(PyObject*) PyList_GetSlice(PyObject*, Py_ssize_t, Py_ssize_t); +PyAPI_FUNC(int) PyList_SetSlice(PyObject*, Py_ssize_t, Py_ssize_t, PyObject*); +PyAPI_FUNC(int) PyList_Sort(PyObject*); +PyAPI_FUNC(int) PyList_Reverse(PyObject*); +PyAPI_FUNC(PyObject*) PyList_AsTuple(PyObject*); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _PyList_Extend(PyListObject*, PyObject*); + +PyAPI_FUNC(int) PyList_ClearFreeList(void); +PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE* out); +#endif + +/* Macro, trading safety for speed */ +#ifndef Py_LIMITED_API +#define PyList_GET_ITEM(op, i) (((PyListObject*)(op))->ob_item[i]) +#define PyList_SET_ITEM(op, i, v) (((PyListObject*)(op))->ob_item[i] = (v)) +#define PyList_GET_SIZE(op) Py_SIZE(op) +#define _PyList_ITEMS(op) (((PyListObject*)(op))->ob_item) +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_LISTOBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/longintrepr.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/longintrepr.h new file mode 100644 index 0000000..0793ab9 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/longintrepr.h @@ -0,0 +1,97 @@ +#ifndef Py_LIMITED_API +#ifndef Py_LONGINTREPR_H +#define Py_LONGINTREPR_H +#ifdef __cplusplus +extern "C" { +#endif + +/* This is published for the benefit of "friends" marshal.c and _decimal.c. */ + +/* Parameters of the integer representation. There are two different + sets of parameters: one set for 30-bit digits, stored in an unsigned 32-bit + integer type, and one set for 15-bit digits with each digit stored in an + unsigned short. The value of PYLONG_BITS_IN_DIGIT, defined either at + configure time or in pyport.h, is used to decide which digit size to use. + + Type 'digit' should be able to hold 2*PyLong_BASE-1, and type 'twodigits' + should be an unsigned integer type able to hold all integers up to + PyLong_BASE*PyLong_BASE-1. x_sub assumes that 'digit' is an unsigned type, + and that overflow is handled by taking the result modulo 2**N for some N > + PyLong_SHIFT. The majority of the code doesn't care about the precise + value of PyLong_SHIFT, but there are some notable exceptions: + + - long_pow() requires that PyLong_SHIFT be divisible by 5 + + - PyLong_{As,From}ByteArray require that PyLong_SHIFT be at least 8 + + - long_hash() requires that PyLong_SHIFT is *strictly* less than the number + of bits in an unsigned long, as do the PyLong <-> long (or unsigned long) + conversion functions + + - the Python int <-> size_t/Py_ssize_t conversion functions expect that + PyLong_SHIFT is strictly less than the number of bits in a size_t + + - the marshal code currently expects that PyLong_SHIFT is a multiple of 15 + + - NSMALLNEGINTS and NSMALLPOSINTS should be small enough to fit in a single + digit; with the current values this forces PyLong_SHIFT >= 9 + + The values 15 and 30 should fit all of the above requirements, on any + platform. +*/ + +#if PYLONG_BITS_IN_DIGIT == 30 +typedef uint32_t digit; +typedef int32_t sdigit; /* signed variant of digit */ +typedef uint64_t twodigits; +typedef int64_t stwodigits; /* signed variant of twodigits */ +#define PyLong_SHIFT 30 +#define _PyLong_DECIMAL_SHIFT 9 /* max(e such that 10**e fits in a digit) */ +#define _PyLong_DECIMAL_BASE ((digit)1000000000) /* 10 ** DECIMAL_SHIFT */ +#elif PYLONG_BITS_IN_DIGIT == 15 +typedef unsigned short digit; +typedef short sdigit; /* signed variant of digit */ +typedef unsigned long twodigits; +typedef long stwodigits; /* signed variant of twodigits */ +#define PyLong_SHIFT 15 +#define _PyLong_DECIMAL_SHIFT 4 /* max(e such that 10**e fits in a digit) */ +#define _PyLong_DECIMAL_BASE ((digit)10000) /* 10 ** DECIMAL_SHIFT */ +#else +#error "PYLONG_BITS_IN_DIGIT should be 15 or 30" +#endif +#define PyLong_BASE ((digit)1 << PyLong_SHIFT) +#define PyLong_MASK ((digit)(PyLong_BASE - 1)) + +#if PyLong_SHIFT % 5 != 0 +#error "longobject.c requires that PyLong_SHIFT be divisible by 5" +#endif + +/* Long integer representation. + The absolute value of a number is equal to + SUM(for i=0 through abs(ob_size)-1) ob_digit[i] * 2**(SHIFT*i) + Negative numbers are represented with ob_size < 0; + zero is represented by ob_size == 0. + In a normalized number, ob_digit[abs(ob_size)-1] (the most significant + digit) is never zero. Also, in all cases, for all valid i, + 0 <= ob_digit[i] <= MASK. + The allocation function takes care of allocating extra memory + so that ob_digit[0] ... ob_digit[abs(ob_size)-1] are actually available. + + CAUTION: Generic code manipulating subtypes of PyVarObject has to + aware that ints abuse ob_size's sign bit. +*/ + +struct _longobject { + PyObject_VAR_HEAD digit ob_digit[1]; +}; + +PyAPI_FUNC(PyLongObject*) _PyLong_New(Py_ssize_t); + +/* Return a copy of src. */ +PyAPI_FUNC(PyObject*) _PyLong_Copy(PyLongObject* src); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_LONGINTREPR_H */ +#endif /* Py_LIMITED_API */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/longobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/longobject.h new file mode 100644 index 0000000..e9b5181 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/longobject.h @@ -0,0 +1,218 @@ +#ifndef Py_LONGOBJECT_H +#define Py_LONGOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +/* Long (arbitrary precision) integer object interface */ + +typedef struct _longobject PyLongObject; /* Revealed in longintrepr.h */ + +PyAPI_DATA(PyTypeObject) PyLong_Type; + +#define PyLong_Check(op) \ + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS) +#define PyLong_CheckExact(op) (Py_TYPE(op) == &PyLong_Type) + +PyAPI_FUNC(PyObject*) PyLong_FromLong(long); +PyAPI_FUNC(PyObject*) PyLong_FromUnsignedLong(unsigned long); +PyAPI_FUNC(PyObject*) PyLong_FromSize_t(size_t); +PyAPI_FUNC(PyObject*) PyLong_FromSsize_t(Py_ssize_t); +PyAPI_FUNC(PyObject*) PyLong_FromDouble(double); +PyAPI_FUNC(long) PyLong_AsLong(PyObject*); +PyAPI_FUNC(long) PyLong_AsLongAndOverflow(PyObject*, int*); +PyAPI_FUNC(Py_ssize_t) PyLong_AsSsize_t(PyObject*); +PyAPI_FUNC(size_t) PyLong_AsSize_t(PyObject*); +PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject*); +PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLongMask(PyObject*); +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _PyLong_AsInt(PyObject*); +#endif +PyAPI_FUNC(PyObject*) PyLong_GetInfo(void); + +/* It may be useful in the future. I've added it in the PyInt -> PyLong + cleanup to keep the extra information. [CH] */ +#define PyLong_AS_LONG(op) PyLong_AsLong(op) + +/* Issue #1983: pid_t can be longer than a C long on some systems */ +#if !defined(SIZEOF_PID_T) || SIZEOF_PID_T == SIZEOF_INT +#define _Py_PARSE_PID "i" +#define PyLong_FromPid PyLong_FromLong +#define PyLong_AsPid PyLong_AsLong +#elif SIZEOF_PID_T == SIZEOF_LONG +#define _Py_PARSE_PID "l" +#define PyLong_FromPid PyLong_FromLong +#define PyLong_AsPid PyLong_AsLong +#elif defined(SIZEOF_LONG_LONG) && SIZEOF_PID_T == SIZEOF_LONG_LONG +#define _Py_PARSE_PID "L" +#define PyLong_FromPid PyLong_FromLongLong +#define PyLong_AsPid PyLong_AsLongLong +#else +#error "sizeof(pid_t) is neither sizeof(int), sizeof(long) or sizeof(long long)" +#endif /* SIZEOF_PID_T */ + +#if SIZEOF_VOID_P == SIZEOF_INT +#define _Py_PARSE_INTPTR "i" +#define _Py_PARSE_UINTPTR "I" +#elif SIZEOF_VOID_P == SIZEOF_LONG +#define _Py_PARSE_INTPTR "l" +#define _Py_PARSE_UINTPTR "k" +#elif defined(SIZEOF_LONG_LONG) && SIZEOF_VOID_P == SIZEOF_LONG_LONG +#define _Py_PARSE_INTPTR "L" +#define _Py_PARSE_UINTPTR "K" +#else +#error "void* different in size from int, long and long long" +#endif /* SIZEOF_VOID_P */ + +/* Used by Python/mystrtoul.c, _PyBytes_FromHex(), + _PyBytes_DecodeEscapeRecode(), etc. */ +#ifndef Py_LIMITED_API +PyAPI_DATA(unsigned char) _PyLong_DigitValue[256]; +#endif + +/* _PyLong_Frexp returns a double x and an exponent e such that the + true value is approximately equal to x * 2**e. e is >= 0. x is + 0.0 if and only if the input is 0 (in which case, e and x are both + zeroes); otherwise, 0.5 <= abs(x) < 1.0. On overflow, which is + possible if the number of bits doesn't fit into a Py_ssize_t, sets + OverflowError and returns -1.0 for x, 0 for e. */ +#ifndef Py_LIMITED_API +PyAPI_FUNC(double) _PyLong_Frexp(PyLongObject* a, Py_ssize_t* e); +#endif + +PyAPI_FUNC(double) PyLong_AsDouble(PyObject*); +PyAPI_FUNC(PyObject*) PyLong_FromVoidPtr(void*); +PyAPI_FUNC(void*) PyLong_AsVoidPtr(PyObject*); + +PyAPI_FUNC(PyObject*) PyLong_FromLongLong(long long); +PyAPI_FUNC(PyObject*) PyLong_FromUnsignedLongLong(unsigned long long); +PyAPI_FUNC(long long) PyLong_AsLongLong(PyObject*); +PyAPI_FUNC(unsigned long long) PyLong_AsUnsignedLongLong(PyObject*); +PyAPI_FUNC(unsigned long long) PyLong_AsUnsignedLongLongMask(PyObject*); +PyAPI_FUNC(long long) PyLong_AsLongLongAndOverflow(PyObject*, int*); + +PyAPI_FUNC(PyObject*) PyLong_FromString(const char*, char**, int); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int); +PyAPI_FUNC(PyObject*) PyLong_FromUnicodeObject(PyObject* u, int base); +PyAPI_FUNC(PyObject*) _PyLong_FromBytes(const char*, Py_ssize_t, int); +#endif + +#ifndef Py_LIMITED_API +/* _PyLong_Sign. Return 0 if v is 0, -1 if v < 0, +1 if v > 0. + v must not be NULL, and must be a normalized long. + There are no error cases. +*/ +PyAPI_FUNC(int) _PyLong_Sign(PyObject* v); + +/* _PyLong_NumBits. Return the number of bits needed to represent the + absolute value of a long. For example, this returns 1 for 1 and -1, 2 + for 2 and -2, and 2 for 3 and -3. It returns 0 for 0. + v must not be NULL, and must be a normalized long. + (size_t)-1 is returned and OverflowError set if the true result doesn't + fit in a size_t. +*/ +PyAPI_FUNC(size_t) _PyLong_NumBits(PyObject* v); + +/* _PyLong_DivmodNear. Given integers a and b, compute the nearest + integer q to the exact quotient a / b, rounding to the nearest even integer + in the case of a tie. Return (q, r), where r = a - q*b. The remainder r + will satisfy abs(r) <= abs(b)/2, with equality possible only if q is + even. +*/ +PyAPI_FUNC(PyObject*) _PyLong_DivmodNear(PyObject*, PyObject*); + +/* _PyLong_FromByteArray: View the n unsigned bytes as a binary integer in + base 256, and return a Python int with the same numeric value. + If n is 0, the integer is 0. Else: + If little_endian is 1/true, bytes[n-1] is the MSB and bytes[0] the LSB; + else (little_endian is 0/false) bytes[0] is the MSB and bytes[n-1] the + LSB. + If is_signed is 0/false, view the bytes as a non-negative integer. + If is_signed is 1/true, view the bytes as a 2's-complement integer, + non-negative if bit 0x80 of the MSB is clear, negative if set. + Error returns: + + Return NULL with the appropriate exception set if there's not + enough memory to create the Python int. +*/ +PyAPI_FUNC(PyObject*) _PyLong_FromByteArray( + const unsigned char* bytes, + size_t n, + int little_endian, + int is_signed); + +/* _PyLong_AsByteArray: Convert the least-significant 8*n bits of long + v to a base-256 integer, stored in array bytes. Normally return 0, + return -1 on error. + If little_endian is 1/true, store the MSB at bytes[n-1] and the LSB at + bytes[0]; else (little_endian is 0/false) store the MSB at bytes[0] and + the LSB at bytes[n-1]. + If is_signed is 0/false, it's an error if v < 0; else (v >= 0) n bytes + are filled and there's nothing special about bit 0x80 of the MSB. + If is_signed is 1/true, bytes is filled with the 2's-complement + representation of v's value. Bit 0x80 of the MSB is the sign bit. + Error returns (-1): + + is_signed is 0 and v < 0. TypeError is set in this case, and bytes + isn't altered. + + n isn't big enough to hold the full mathematical value of v. For + example, if is_signed is 0 and there are more digits in the v than + fit in n; or if is_signed is 1, v < 0, and n is just 1 bit shy of + being large enough to hold a sign bit. OverflowError is set in this + case, but bytes holds the least-significant n bytes of the true value. +*/ +PyAPI_FUNC(int) _PyLong_AsByteArray( + PyLongObject* v, + unsigned char* bytes, + size_t n, + int little_endian, + int is_signed); + +/* _PyLong_FromNbInt: Convert the given object to a PyLongObject + using the nb_int slot, if available. Raise TypeError if either the + nb_int slot is not available or the result of the call to nb_int + returns something not of type int. +*/ +PyAPI_FUNC(PyLongObject*) _PyLong_FromNbInt(PyObject*); + +/* _PyLong_Format: Convert the long to a string object with given base, + appending a base prefix of 0[box] if base is 2, 8 or 16. */ +PyAPI_FUNC(PyObject*) _PyLong_Format(PyObject* obj, int base); + +PyAPI_FUNC(int) _PyLong_FormatWriter( + _PyUnicodeWriter* writer, + PyObject* obj, + int base, + int alternate); + +PyAPI_FUNC(char*) _PyLong_FormatBytesWriter( + _PyBytesWriter* writer, + char* str, + PyObject* obj, + int base, + int alternate); + +/* Format the object based on the format_spec, as defined in PEP 3101 + (Advanced String Formatting). */ +PyAPI_FUNC(int) _PyLong_FormatAdvancedWriter( + _PyUnicodeWriter* writer, + PyObject* obj, + PyObject* format_spec, + Py_ssize_t start, + Py_ssize_t end); +#endif /* Py_LIMITED_API */ + +/* These aren't really part of the int object, but they're handy. The + functions are in Python/mystrtoul.c. + */ +PyAPI_FUNC(unsigned long) PyOS_strtoul(const char*, char**, int); +PyAPI_FUNC(long) PyOS_strtol(const char*, char**, int); + +#ifndef Py_LIMITED_API +/* For use by the gcd function in mathmodule.c */ +PyAPI_FUNC(PyObject*) _PyLong_GCD(PyObject*, PyObject*); +#endif /* !Py_LIMITED_API */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_LONGOBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/marshal.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/marshal.h new file mode 100644 index 0000000..9ef2115 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/marshal.h @@ -0,0 +1,27 @@ + +/* Interface for marshal.c */ + +#ifndef Py_MARSHAL_H +#define Py_MARSHAL_H +#ifdef __cplusplus +extern "C" { +#endif + +#define Py_MARSHAL_VERSION 4 + +PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE*, int); +PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject*, FILE*, int); +PyAPI_FUNC(PyObject*) PyMarshal_WriteObjectToString(PyObject*, int); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(long) PyMarshal_ReadLongFromFile(FILE*); +PyAPI_FUNC(int) PyMarshal_ReadShortFromFile(FILE*); +PyAPI_FUNC(PyObject*) PyMarshal_ReadObjectFromFile(FILE*); +PyAPI_FUNC(PyObject*) PyMarshal_ReadLastObjectFromFile(FILE*); +#endif +PyAPI_FUNC(PyObject*) PyMarshal_ReadObjectFromString(const char*, Py_ssize_t); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_MARSHAL_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/memoryobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/memoryobject.h new file mode 100644 index 0000000..479e3e7 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/memoryobject.h @@ -0,0 +1,67 @@ +/* Memory view object. In Python this is available as "memoryview". */ + +#ifndef Py_MEMORYOBJECT_H +#define Py_MEMORYOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_LIMITED_API +PyAPI_DATA(PyTypeObject) _PyManagedBuffer_Type; +#endif +PyAPI_DATA(PyTypeObject) PyMemoryView_Type; + +#define PyMemoryView_Check(op) (Py_TYPE(op) == &PyMemoryView_Type) + +#ifndef Py_LIMITED_API +/* Get a pointer to the memoryview's private copy of the exporter's buffer. */ +#define PyMemoryView_GET_BUFFER(op) (&((PyMemoryViewObject*)(op))->view) +/* Get a pointer to the exporting object (this may be NULL!). */ +#define PyMemoryView_GET_BASE(op) (((PyMemoryViewObject*)(op))->view.obj) +#endif + +PyAPI_FUNC(PyObject*) PyMemoryView_FromObject(PyObject* base); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03030000 +PyAPI_FUNC(PyObject*) + PyMemoryView_FromMemory(char* mem, Py_ssize_t size, int flags); +#endif +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) PyMemoryView_FromBuffer(Py_buffer* info); +#endif +PyAPI_FUNC(PyObject*) + PyMemoryView_GetContiguous(PyObject* base, int buffertype, char order); + +/* The structs are declared here so that macros can work, but they shouldn't + be considered public. Don't access their fields directly, use the macros + and functions instead! */ +#ifndef Py_LIMITED_API +#define _Py_MANAGED_BUFFER_RELEASED 0x001 /* access to exporter blocked */ +#define _Py_MANAGED_BUFFER_FREE_FORMAT 0x002 /* free format */ +typedef struct { + PyObject_HEAD int flags; /* state flags */ + Py_ssize_t exports; /* number of direct memoryview exports */ + Py_buffer master; /* snapshot buffer obtained from the original exporter */ +} _PyManagedBufferObject; + +/* memoryview state flags */ +#define _Py_MEMORYVIEW_RELEASED 0x001 /* access to master buffer blocked */ +#define _Py_MEMORYVIEW_C 0x002 /* C-contiguous layout */ +#define _Py_MEMORYVIEW_FORTRAN 0x004 /* Fortran contiguous layout */ +#define _Py_MEMORYVIEW_SCALAR 0x008 /* scalar: ndim = 0 */ +#define _Py_MEMORYVIEW_PIL 0x010 /* PIL-style layout */ + +typedef struct { + PyObject_VAR_HEAD _PyManagedBufferObject* mbuf; /* managed buffer */ + Py_hash_t hash; /* hash value for read-only views */ + int flags; /* state flags */ + Py_ssize_t exports; /* number of buffer re-exports */ + Py_buffer view; /* private copy of the exporter's view */ + PyObject* weakreflist; + Py_ssize_t ob_array[1]; /* shape, strides, suboffsets */ +} PyMemoryViewObject; +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_MEMORYOBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/metagrammar.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/metagrammar.h new file mode 100644 index 0000000..80527d1 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/metagrammar.h @@ -0,0 +1,17 @@ +#ifndef Py_METAGRAMMAR_H +#define Py_METAGRAMMAR_H +#ifdef __cplusplus +extern "C" { +#endif + +#define MSTART 256 +#define RULE 257 +#define RHS 258 +#define ALT 259 +#define ITEM 260 +#define ATOM 261 + +#ifdef __cplusplus +} +#endif +#endif /* !Py_METAGRAMMAR_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/methodobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/methodobject.h new file mode 100644 index 0000000..ddd7e4d --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/methodobject.h @@ -0,0 +1,112 @@ + +/* Method object interface */ + +#ifndef Py_METHODOBJECT_H +#define Py_METHODOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +/* This is about the type 'builtin_function_or_method', + not Python methods in user-defined classes. See classobject.h + for the latter. */ + +PyAPI_DATA(PyTypeObject) PyCFunction_Type; + +#define PyCFunction_Check(op) (Py_TYPE(op) == &PyCFunction_Type) + +typedef PyObject* (*PyCFunction)(PyObject*, PyObject*); +typedef PyObject* (*_PyCFunctionFast)( + PyObject* self, + PyObject** args, + Py_ssize_t nargs, + PyObject* kwnames); +typedef PyObject* (*PyCFunctionWithKeywords)(PyObject*, PyObject*, PyObject*); +typedef PyObject* (*PyNoArgsFunction)(PyObject*); + +PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject*); +PyAPI_FUNC(PyObject*) PyCFunction_GetSelf(PyObject*); +PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject*); + +/* Macros for direct access to these values. Type checks are *not* + done, so use with care. */ +#ifndef Py_LIMITED_API +#define PyCFunction_GET_FUNCTION(func) \ + (((PyCFunctionObject*)func)->m_ml->ml_meth) +#define PyCFunction_GET_SELF(func) \ + (((PyCFunctionObject*)func)->m_ml->ml_flags & METH_STATIC \ + ? NULL \ + : ((PyCFunctionObject*)func)->m_self) +#define PyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)func)->m_ml->ml_flags) +#endif +PyAPI_FUNC(PyObject*) PyCFunction_Call(PyObject*, PyObject*, PyObject*); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _PyCFunction_FastCallDict( + PyObject* func, + PyObject** args, + Py_ssize_t nargs, + PyObject* kwargs); + +PyAPI_FUNC(PyObject*) _PyCFunction_FastCallKeywords( + PyObject* func, + PyObject** stack, + Py_ssize_t nargs, + PyObject* kwnames); +#endif + +struct PyMethodDef { + const char* ml_name; /* The name of the built-in function/method */ + PyCFunction ml_meth; /* The C function that implements it */ + int ml_flags; /* Combination of METH_xxx flags, which mostly + describe the args expected by the C func */ + const char* ml_doc; /* The __doc__ attribute, or NULL */ +}; +typedef struct PyMethodDef PyMethodDef; + +#define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL) +PyAPI_FUNC(PyObject*) PyCFunction_NewEx(PyMethodDef*, PyObject*, PyObject*); + +/* Flag passed to newmethodobject */ +/* #define METH_OLDARGS 0x0000 -- unsupported now */ +#define METH_VARARGS 0x0001 +#define METH_KEYWORDS 0x0002 +/* METH_NOARGS and METH_O must not be combined with the flags above. */ +#define METH_NOARGS 0x0004 +#define METH_O 0x0008 + +/* METH_CLASS and METH_STATIC are a little different; these control + the construction of methods for a class. These cannot be used for + functions in modules. */ +#define METH_CLASS 0x0010 +#define METH_STATIC 0x0020 + +/* METH_COEXIST allows a method to be entered even though a slot has + already filled the entry. When defined, the flag allows a separate + method, "__contains__" for example, to coexist with a defined + slot like sq_contains. */ + +#define METH_COEXIST 0x0040 + +#ifndef Py_LIMITED_API +#define METH_FASTCALL 0x0080 + +typedef struct { + PyObject_HEAD PyMethodDef* m_ml; /* Description of the C function to call */ + PyObject* m_self; /* Passed as 'self' arg to the C func, can be NULL */ + PyObject* m_module; /* The __module__ attribute, can be anything */ + PyObject* m_weakreflist; /* List of weak references */ +} PyCFunctionObject; +#endif + +PyAPI_FUNC(int) PyCFunction_ClearFreeList(void); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) _PyCFunction_DebugMallocStats(FILE* out); +PyAPI_FUNC(void) _PyMethod_DebugMallocStats(FILE* out); +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_METHODOBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/modsupport.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/modsupport.h new file mode 100644 index 0000000..68476cb --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/modsupport.h @@ -0,0 +1,198 @@ + +#ifndef Py_MODSUPPORT_H +#define Py_MODSUPPORT_H +#ifdef __cplusplus +extern "C" { +#endif + +/* Module support interface */ + +#include + +/* If PY_SSIZE_T_CLEAN is defined, each functions treats #-specifier + to mean Py_ssize_t */ +#ifdef PY_SSIZE_T_CLEAN +#define PyArg_Parse _PyArg_Parse_SizeT +#define PyArg_ParseTuple _PyArg_ParseTuple_SizeT +#define PyArg_ParseTupleAndKeywords _PyArg_ParseTupleAndKeywords_SizeT +#define PyArg_VaParse _PyArg_VaParse_SizeT +#define PyArg_VaParseTupleAndKeywords _PyArg_VaParseTupleAndKeywords_SizeT +#define Py_BuildValue _Py_BuildValue_SizeT +#define Py_VaBuildValue _Py_VaBuildValue_SizeT +#else +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _Py_VaBuildValue_SizeT(const char*, va_list); +#endif /* !Py_LIMITED_API */ +#endif + +/* Due to a glitch in 3.2, the _SizeT versions weren't exported from the DLL. */ +#if !defined(PY_SSIZE_T_CLEAN) || !defined(Py_LIMITED_API) || \ + Py_LIMITED_API + 0 >= 0x03030000 +PyAPI_FUNC(int) PyArg_Parse(PyObject*, const char*, ...); +PyAPI_FUNC(int) PyArg_ParseTuple(PyObject*, const char*, ...); +PyAPI_FUNC(int) + PyArg_ParseTupleAndKeywords(PyObject*, PyObject*, const char*, char**, ...); +PyAPI_FUNC(int) PyArg_VaParse(PyObject*, const char*, va_list); +PyAPI_FUNC(int) PyArg_VaParseTupleAndKeywords( + PyObject*, + PyObject*, + const char*, + char**, + va_list); +#endif +PyAPI_FUNC(int) PyArg_ValidateKeywordArguments(PyObject*); +PyAPI_FUNC(int) + PyArg_UnpackTuple(PyObject*, const char*, Py_ssize_t, Py_ssize_t, ...); +PyAPI_FUNC(PyObject*) Py_BuildValue(const char*, ...); +PyAPI_FUNC(PyObject*) _Py_BuildValue_SizeT(const char*, ...); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _PyArg_NoKeywords(const char* funcname, PyObject* kw); +PyAPI_FUNC(int) _PyArg_NoPositional(const char* funcname, PyObject* args); +#endif +PyAPI_FUNC(PyObject*) Py_VaBuildValue(const char*, va_list); + +#ifndef Py_LIMITED_API +typedef struct _PyArg_Parser { + const char* format; + const char* const* keywords; + const char* fname; + const char* custom_msg; + int pos; /* number of positional-only arguments */ + int min; /* minimal number of arguments */ + int max; /* maximal number of positional arguments */ + PyObject* kwtuple; /* tuple of keyword parameter names */ + struct _PyArg_Parser* next; +} _PyArg_Parser; +#ifdef PY_SSIZE_T_CLEAN +#define _PyArg_ParseTupleAndKeywordsFast _PyArg_ParseTupleAndKeywordsFast_SizeT +#define _PyArg_ParseStack _PyArg_ParseStack_SizeT +#define _PyArg_VaParseTupleAndKeywordsFast \ + _PyArg_VaParseTupleAndKeywordsFast_SizeT +#endif +PyAPI_FUNC(int) _PyArg_ParseTupleAndKeywordsFast( + PyObject*, + PyObject*, + struct _PyArg_Parser*, + ...); +PyAPI_FUNC(int) _PyArg_ParseStack( + PyObject** args, + Py_ssize_t nargs, + PyObject* kwnames, + struct _PyArg_Parser*, + ...); +PyAPI_FUNC(int) _PyArg_VaParseTupleAndKeywordsFast( + PyObject*, + PyObject*, + struct _PyArg_Parser*, + va_list); +void _PyArg_Fini(void); +#endif + +PyAPI_FUNC(int) PyModule_AddObject(PyObject*, const char*, PyObject*); +PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject*, const char*, long); +PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject*, const char*, const char*); +#define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c) +#define PyModule_AddStringMacro(m, c) PyModule_AddStringConstant(m, #c, c) + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03050000 +/* New in 3.5 */ +PyAPI_FUNC(int) PyModule_SetDocString(PyObject*, const char*); +PyAPI_FUNC(int) PyModule_AddFunctions(PyObject*, PyMethodDef*); +PyAPI_FUNC(int) PyModule_ExecDef(PyObject* module, PyModuleDef* def); +#endif + +#define Py_CLEANUP_SUPPORTED 0x20000 + +#define PYTHON_API_VERSION 1013 +#define PYTHON_API_STRING "1013" +/* The API version is maintained (independently from the Python version) + so we can detect mismatches between the interpreter and dynamically + loaded modules. These are diagnosed by an error message but + the module is still loaded (because the mismatch can only be tested + after loading the module). The error message is intended to + explain the core dump a few seconds later. + + The symbol PYTHON_API_STRING defines the same value as a string + literal. *** PLEASE MAKE SURE THE DEFINITIONS MATCH. *** + + Please add a line or two to the top of this log for each API + version change: + + 22-Feb-2006 MvL 1013 PEP 353 - long indices for sequence lengths + + 19-Aug-2002 GvR 1012 Changes to string object struct for + interning changes, saving 3 bytes. + + 17-Jul-2001 GvR 1011 Descr-branch, just to be on the safe side + + 25-Jan-2001 FLD 1010 Parameters added to PyCode_New() and + PyFrame_New(); Python 2.1a2 + + 14-Mar-2000 GvR 1009 Unicode API added + + 3-Jan-1999 GvR 1007 Decided to change back! (Don't reuse 1008!) + + 3-Dec-1998 GvR 1008 Python 1.5.2b1 + + 18-Jan-1997 GvR 1007 string interning and other speedups + + 11-Oct-1996 GvR renamed Py_Ellipses to Py_Ellipsis :-( + + 30-Jul-1996 GvR Slice and ellipses syntax added + + 23-Jul-1996 GvR For 1.4 -- better safe than sorry this time :-) + + 7-Nov-1995 GvR Keyword arguments (should've been done at 1.3 :-( ) + + 10-Jan-1995 GvR Renamed globals to new naming scheme + + 9-Jan-1995 GvR Initial version (incompatible with older API) +*/ + +/* The PYTHON_ABI_VERSION is introduced in PEP 384. For the lifetime of + Python 3, it will stay at the value of 3; changes to the limited API + must be performed in a strictly backwards-compatible manner. */ +#define PYTHON_ABI_VERSION 3 +#define PYTHON_ABI_STRING "3" + +#ifdef Py_TRACE_REFS +/* When we are tracing reference counts, rename module creation functions so + modules compiled with incompatible settings will generate a + link-time error. */ +#define PyModule_Create2 PyModule_Create2TraceRefs +#define PyModule_FromDefAndSpec2 PyModule_FromDefAndSpec2TraceRefs +#endif + +PyAPI_FUNC(PyObject*) PyModule_Create2(struct PyModuleDef*, int apiver); + +#ifdef Py_LIMITED_API +#define PyModule_Create(module) PyModule_Create2(module, PYTHON_ABI_VERSION) +#else +#define PyModule_Create(module) PyModule_Create2(module, PYTHON_API_VERSION) +#endif + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03050000 +/* New in 3.5 */ +PyAPI_FUNC(PyObject*) PyModule_FromDefAndSpec2( + PyModuleDef* def, + PyObject* spec, + int module_api_version); + +#ifdef Py_LIMITED_API +#define PyModule_FromDefAndSpec(module, spec) \ + PyModule_FromDefAndSpec2(module, spec, PYTHON_ABI_VERSION) +#else +#define PyModule_FromDefAndSpec(module, spec) \ + PyModule_FromDefAndSpec2(module, spec, PYTHON_API_VERSION) +#endif /* Py_LIMITED_API */ +#endif /* New in 3.5 */ + +#ifndef Py_LIMITED_API +PyAPI_DATA(char*) _Py_PackageContext; +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_MODSUPPORT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/moduleobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/moduleobject.h new file mode 100644 index 0000000..ce861bf --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/moduleobject.h @@ -0,0 +1,86 @@ + +/* Module object interface */ + +#ifndef Py_MODULEOBJECT_H +#define Py_MODULEOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_DATA(PyTypeObject) PyModule_Type; + +#define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type) +#define PyModule_CheckExact(op) (Py_TYPE(op) == &PyModule_Type) + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03030000 +PyAPI_FUNC(PyObject*) PyModule_NewObject(PyObject* name); +#endif +PyAPI_FUNC(PyObject*) PyModule_New( + const char* name /* UTF-8 encoded string */ + ); +PyAPI_FUNC(PyObject*) PyModule_GetDict(PyObject*); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03030000 +PyAPI_FUNC(PyObject*) PyModule_GetNameObject(PyObject*); +#endif +PyAPI_FUNC(const char*) PyModule_GetName(PyObject*); +PyAPI_FUNC(const char*) PyModule_GetFilename(PyObject*); +PyAPI_FUNC(PyObject*) PyModule_GetFilenameObject(PyObject*); +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) _PyModule_Clear(PyObject*); +PyAPI_FUNC(void) _PyModule_ClearDict(PyObject*); +#endif +PyAPI_FUNC(struct PyModuleDef*) PyModule_GetDef(PyObject*); +PyAPI_FUNC(void*) PyModule_GetState(PyObject*); + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03050000 +/* New in 3.5 */ +PyAPI_FUNC(PyObject*) PyModuleDef_Init(struct PyModuleDef*); +PyAPI_DATA(PyTypeObject) PyModuleDef_Type; +#endif + +typedef struct PyModuleDef_Base { + PyObject_HEAD PyObject* (*m_init)(void); + Py_ssize_t m_index; + PyObject* m_copy; +} PyModuleDef_Base; + +#define PyModuleDef_HEAD_INIT \ + { \ + PyObject_HEAD_INIT(NULL) NULL, /* m_init */ \ + 0, /* m_index */ \ + NULL, /* m_copy */ \ + } + +struct PyModuleDef_Slot; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03050000 +/* New in 3.5 */ +typedef struct PyModuleDef_Slot { + int slot; + void* value; +} PyModuleDef_Slot; + +#define Py_mod_create 1 +#define Py_mod_exec 2 + +#ifndef Py_LIMITED_API +#define _Py_mod_LAST_SLOT 2 +#endif + +#endif /* New in 3.5 */ + +typedef struct PyModuleDef { + PyModuleDef_Base m_base; + const char* m_name; + const char* m_doc; + Py_ssize_t m_size; + PyMethodDef* m_methods; + struct PyModuleDef_Slot* m_slots; + traverseproc m_traverse; + inquiry m_clear; + freefunc m_free; +} PyModuleDef; + +#ifdef __cplusplus +} +#endif +#endif /* !Py_MODULEOBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/namespaceobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/namespaceobject.h new file mode 100644 index 0000000..00155d8 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/namespaceobject.h @@ -0,0 +1,19 @@ + +/* simple namespace object interface */ + +#ifndef NAMESPACEOBJECT_H +#define NAMESPACEOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_LIMITED_API +PyAPI_DATA(PyTypeObject) _PyNamespace_Type; + +PyAPI_FUNC(PyObject*) _PyNamespace_New(PyObject* kwds); +#endif /* !Py_LIMITED_API */ + +#ifdef __cplusplus +} +#endif +#endif /* !NAMESPACEOBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/node.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/node.h new file mode 100644 index 0000000..9559dc0 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/node.h @@ -0,0 +1,44 @@ + +/* Parse tree node interface */ + +#ifndef Py_NODE_H +#define Py_NODE_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _node { + short n_type; + char* n_str; + int n_lineno; + int n_col_offset; + int n_nchildren; + struct _node* n_child; +} node; + +PyAPI_FUNC(node*) PyNode_New(int type); +PyAPI_FUNC(int) + PyNode_AddChild(node* n, int type, char* str, int lineno, int col_offset); +PyAPI_FUNC(void) PyNode_Free(node* n); +#ifndef Py_LIMITED_API +PyAPI_FUNC(Py_ssize_t) _PyNode_SizeOf(node* n); +#endif + +/* Node access functions */ +#define NCH(n) ((n)->n_nchildren) + +#define CHILD(n, i) (&(n)->n_child[i]) +#define RCHILD(n, i) (CHILD(n, NCH(n) + i)) +#define TYPE(n) ((n)->n_type) +#define STR(n) ((n)->n_str) +#define LINENO(n) ((n)->n_lineno) + +/* Assert that the type of a node is what we expect */ +#define REQ(n, type) assert(TYPE(n) == (type)) + +PyAPI_FUNC(void) PyNode_ListTree(node*); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_NODE_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/object.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/object.h new file mode 100644 index 0000000..2b07dd2 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/object.h @@ -0,0 +1,1068 @@ +#ifndef Py_OBJECT_H +#define Py_OBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +/* Object and type object interface */ + +/* +Objects are structures allocated on the heap. Special rules apply to +the use of objects to ensure they are properly garbage-collected. +Objects are never allocated statically or on the stack; they must be +accessed through special macros and functions only. (Type objects are +exceptions to the first rule; the standard types are represented by +statically initialized type objects, although work on type/class unification +for Python 2.2 made it possible to have heap-allocated type objects too). + +An object has a 'reference count' that is increased or decreased when a +pointer to the object is copied or deleted; when the reference count +reaches zero there are no references to the object left and it can be +removed from the heap. + +An object has a 'type' that determines what it represents and what kind +of data it contains. An object's type is fixed when it is created. +Types themselves are represented as objects; an object contains a +pointer to the corresponding type object. The type itself has a type +pointer pointing to the object representing the type 'type', which +contains a pointer to itself!). + +Objects do not float around in memory; once allocated an object keeps +the same size and address. Objects that must hold variable-size data +can contain pointers to variable-size parts of the object. Not all +objects of the same type have the same size; but the size cannot change +after allocation. (These restrictions are made so a reference to an +object can be simply a pointer -- moving an object would require +updating all the pointers, and changing an object's size would require +moving it if there was another object right next to it.) + +Objects are always accessed through pointers of the type 'PyObject *'. +The type 'PyObject' is a structure that only contains the reference count +and the type pointer. The actual memory allocated for an object +contains other data that can only be accessed after casting the pointer +to a pointer to a longer structure type. This longer type must start +with the reference count and type fields; the macro PyObject_HEAD should be +used for this (to accommodate for future changes). The implementation +of a particular object type can cast the object pointer to the proper +type and back. + +A standard interface exists for objects that contain an array of items +whose size is determined when the object is allocated. +*/ + +/* Py_DEBUG implies Py_TRACE_REFS. */ +#if defined(Py_DEBUG) && !defined(Py_TRACE_REFS) +#define Py_TRACE_REFS +#endif + +/* Py_TRACE_REFS implies Py_REF_DEBUG. */ +#if defined(Py_TRACE_REFS) && !defined(Py_REF_DEBUG) +#define Py_REF_DEBUG +#endif + +#if defined(Py_LIMITED_API) && defined(Py_REF_DEBUG) +#error Py_LIMITED_API is incompatible with Py_DEBUG, Py_TRACE_REFS, and Py_REF_DEBUG +#endif + +#ifdef Py_TRACE_REFS +/* Define pointers to support a doubly-linked list of all live heap objects. */ +#define _PyObject_HEAD_EXTRA \ + struct _object* _ob_next; \ + struct _object* _ob_prev; + +#define _PyObject_EXTRA_INIT 0, 0, + +#else +#define _PyObject_HEAD_EXTRA +#define _PyObject_EXTRA_INIT +#endif + +/* PyObject_HEAD defines the initial segment of every PyObject. */ +#define PyObject_HEAD PyObject ob_base; + +#define PyObject_HEAD_INIT(type) {_PyObject_EXTRA_INIT 1, type}, + +#define PyVarObject_HEAD_INIT(type, size) {PyObject_HEAD_INIT(type) size}, + +/* PyObject_VAR_HEAD defines the initial segment of all variable-size + * container objects. These end with a declaration of an array with 1 + * element, but enough space is malloc'ed so that the array actually + * has room for ob_size elements. Note that ob_size is an element count, + * not necessarily a byte count. + */ +#define PyObject_VAR_HEAD PyVarObject ob_base; +#define Py_INVALID_SIZE (Py_ssize_t) - 1 + +/* Nothing is actually declared to be a PyObject, but every pointer to + * a Python object can be cast to a PyObject*. This is inheritance built + * by hand. Similarly every pointer to a variable-size Python object can, + * in addition, be cast to PyVarObject*. + */ +typedef struct _object { + _PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt; + struct _typeobject* ob_type; +} PyObject; + +typedef struct { + PyObject ob_base; + Py_ssize_t ob_size; /* Number of items in variable part */ +} PyVarObject; + +#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) +#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) +#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + +#ifndef Py_LIMITED_API +/********************* String Literals ****************************************/ +/* This structure helps managing static strings. The basic usage goes like this: + Instead of doing + + r = PyObject_CallMethod(o, "foo", "args", ...); + + do + + _Py_IDENTIFIER(foo); + ... + r = _PyObject_CallMethodId(o, &PyId_foo, "args", ...); + + PyId_foo is a static variable, either on block level or file level. On first + usage, the string "foo" is interned, and the structures are linked. On + interpreter + shutdown, all strings are released (through _PyUnicode_ClearStaticStrings). + + Alternatively, _Py_static_string allows choosing the variable name. + _PyUnicode_FromId returns a borrowed reference to the interned string. + _PyObject_{Get,Set,Has}AttrId are __getattr__ versions using _Py_Identifier*. +*/ +typedef struct _Py_Identifier { + struct _Py_Identifier* next; + const char* string; + PyObject* object; +} _Py_Identifier; + +#define _Py_static_string_init(value) \ + { .next = NULL, .string = value, .object = NULL } +#define _Py_static_string(varname, value) \ + static _Py_Identifier varname = _Py_static_string_init(value) +#define _Py_IDENTIFIER(varname) _Py_static_string(PyId_##varname, #varname) + +#endif /* !Py_LIMITED_API */ + +/* +Type objects contain a string containing the type name (to help somewhat +in debugging), the allocation parameters (see PyObject_New() and +PyObject_NewVar()), +and methods for accessing objects of the type. Methods are optional, a +nil pointer meaning that particular kind of access is not available for +this type. The Py_DECREF() macro uses the tp_dealloc method without +checking for a nil pointer; it should always be implemented except if +the implementation can guarantee that the reference count will never +reach zero (e.g., for statically allocated type objects). + +NB: the methods for certain type groups are now contained in separate +method blocks. +*/ + +typedef PyObject* (*unaryfunc)(PyObject*); +typedef PyObject* (*binaryfunc)(PyObject*, PyObject*); +typedef PyObject* (*ternaryfunc)(PyObject*, PyObject*, PyObject*); +typedef int (*inquiry)(PyObject*); +typedef Py_ssize_t (*lenfunc)(PyObject*); +typedef PyObject* (*ssizeargfunc)(PyObject*, Py_ssize_t); +typedef PyObject* (*ssizessizeargfunc)(PyObject*, Py_ssize_t, Py_ssize_t); +typedef int (*ssizeobjargproc)(PyObject*, Py_ssize_t, PyObject*); +typedef int ( + *ssizessizeobjargproc)(PyObject*, Py_ssize_t, Py_ssize_t, PyObject*); +typedef int (*objobjargproc)(PyObject*, PyObject*, PyObject*); + +#ifndef Py_LIMITED_API +/* buffer interface */ +typedef struct bufferinfo { + void* buf; + PyObject* obj; /* owned reference */ + Py_ssize_t len; + Py_ssize_t itemsize; /* This is Py_ssize_t so it can be + pointed to by strides in simple case.*/ + int readonly; + int ndim; + char* format; + Py_ssize_t* shape; + Py_ssize_t* strides; + Py_ssize_t* suboffsets; + void* internal; +} Py_buffer; + +typedef int (*getbufferproc)(PyObject*, Py_buffer*, int); +typedef void (*releasebufferproc)(PyObject*, Py_buffer*); + +/* Maximum number of dimensions */ +#define PyBUF_MAX_NDIM 64 + +/* Flags for getting buffers */ +#define PyBUF_SIMPLE 0 +#define PyBUF_WRITABLE 0x0001 +/* we used to include an E, backwards compatible alias */ +#define PyBUF_WRITEABLE PyBUF_WRITABLE +#define PyBUF_FORMAT 0x0004 +#define PyBUF_ND 0x0008 +#define PyBUF_STRIDES (0x0010 | PyBUF_ND) +#define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) +#define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) +#define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) +#define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#define PyBUF_CONTIG (PyBUF_ND | PyBUF_WRITABLE) +#define PyBUF_CONTIG_RO (PyBUF_ND) + +#define PyBUF_STRIDED (PyBUF_STRIDES | PyBUF_WRITABLE) +#define PyBUF_STRIDED_RO (PyBUF_STRIDES) + +#define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_WRITABLE | PyBUF_FORMAT) +#define PyBUF_RECORDS_RO (PyBUF_STRIDES | PyBUF_FORMAT) + +#define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_WRITABLE | PyBUF_FORMAT) +#define PyBUF_FULL_RO (PyBUF_INDIRECT | PyBUF_FORMAT) + +#define PyBUF_READ 0x100 +#define PyBUF_WRITE 0x200 + +/* End buffer interface */ +#endif /* Py_LIMITED_API */ + +typedef int (*objobjproc)(PyObject*, PyObject*); +typedef int (*visitproc)(PyObject*, void*); +typedef int (*traverseproc)(PyObject*, visitproc, void*); + +#ifndef Py_LIMITED_API +typedef struct { + /* Number implementations must check *both* + arguments for proper type and implement the necessary conversions + in the slot functions themselves. */ + + binaryfunc nb_add; + binaryfunc nb_subtract; + binaryfunc nb_multiply; + binaryfunc nb_remainder; + binaryfunc nb_divmod; + ternaryfunc nb_power; + unaryfunc nb_negative; + unaryfunc nb_positive; + unaryfunc nb_absolute; + inquiry nb_bool; + unaryfunc nb_invert; + binaryfunc nb_lshift; + binaryfunc nb_rshift; + binaryfunc nb_and; + binaryfunc nb_xor; + binaryfunc nb_or; + unaryfunc nb_int; + void* nb_reserved; /* the slot formerly known as nb_long */ + unaryfunc nb_float; + + binaryfunc nb_inplace_add; + binaryfunc nb_inplace_subtract; + binaryfunc nb_inplace_multiply; + binaryfunc nb_inplace_remainder; + ternaryfunc nb_inplace_power; + binaryfunc nb_inplace_lshift; + binaryfunc nb_inplace_rshift; + binaryfunc nb_inplace_and; + binaryfunc nb_inplace_xor; + binaryfunc nb_inplace_or; + + binaryfunc nb_floor_divide; + binaryfunc nb_true_divide; + binaryfunc nb_inplace_floor_divide; + binaryfunc nb_inplace_true_divide; + + unaryfunc nb_index; + + binaryfunc nb_matrix_multiply; + binaryfunc nb_inplace_matrix_multiply; +} PyNumberMethods; + +typedef struct { + lenfunc sq_length; + binaryfunc sq_concat; + ssizeargfunc sq_repeat; + ssizeargfunc sq_item; + void* was_sq_slice; + ssizeobjargproc sq_ass_item; + void* was_sq_ass_slice; + objobjproc sq_contains; + + binaryfunc sq_inplace_concat; + ssizeargfunc sq_inplace_repeat; +} PySequenceMethods; + +typedef struct { + lenfunc mp_length; + binaryfunc mp_subscript; + objobjargproc mp_ass_subscript; +} PyMappingMethods; + +typedef struct { + unaryfunc am_await; + unaryfunc am_aiter; + unaryfunc am_anext; +} PyAsyncMethods; + +typedef struct { + getbufferproc bf_getbuffer; + releasebufferproc bf_releasebuffer; +} PyBufferProcs; +#endif /* Py_LIMITED_API */ + +typedef void (*freefunc)(void*); +typedef void (*destructor)(PyObject*); +#ifndef Py_LIMITED_API +/* We can't provide a full compile-time check that limited-API + users won't implement tp_print. However, not defining printfunc + and making tp_print of a different function pointer type + should at least cause a warning in most cases. */ +typedef int (*printfunc)(PyObject*, FILE*, int); +#endif +typedef PyObject* (*getattrfunc)(PyObject*, char*); +typedef PyObject* (*getattrofunc)(PyObject*, PyObject*); +typedef int (*setattrfunc)(PyObject*, char*, PyObject*); +typedef int (*setattrofunc)(PyObject*, PyObject*, PyObject*); +typedef PyObject* (*reprfunc)(PyObject*); +typedef Py_hash_t (*hashfunc)(PyObject*); +typedef PyObject* (*richcmpfunc)(PyObject*, PyObject*, int); +typedef PyObject* (*getiterfunc)(PyObject*); +typedef PyObject* (*iternextfunc)(PyObject*); +typedef PyObject* (*descrgetfunc)(PyObject*, PyObject*, PyObject*); +typedef int (*descrsetfunc)(PyObject*, PyObject*, PyObject*); +typedef int (*initproc)(PyObject*, PyObject*, PyObject*); +typedef PyObject* (*newfunc)(struct _typeobject*, PyObject*, PyObject*); +typedef PyObject* (*allocfunc)(struct _typeobject*, Py_ssize_t); + +#ifdef Py_LIMITED_API +typedef struct _typeobject PyTypeObject; /* opaque */ +#else +typedef struct _typeobject { + PyObject_VAR_HEAD const char* + tp_name; /* For printing, in format "." */ + Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */ + + /* Methods to implement standard operations */ + + destructor tp_dealloc; + printfunc tp_print; + getattrfunc tp_getattr; + setattrfunc tp_setattr; + PyAsyncMethods* tp_as_async; /* formerly known as tp_compare (Python 2) + or tp_reserved (Python 3) */ + reprfunc tp_repr; + + /* Method suites for standard classes */ + + PyNumberMethods* tp_as_number; + PySequenceMethods* tp_as_sequence; + PyMappingMethods* tp_as_mapping; + + /* More standard operations (here for binary compatibility) */ + + hashfunc tp_hash; + ternaryfunc tp_call; + reprfunc tp_str; + getattrofunc tp_getattro; + setattrofunc tp_setattro; + + /* Functions to access object as input/output buffer */ + PyBufferProcs* tp_as_buffer; + + /* Flags to define presence of optional/expanded features */ + unsigned long tp_flags; + + const char* tp_doc; /* Documentation string */ + + /* Assigned meaning in release 2.0 */ + /* call function for all accessible objects */ + traverseproc tp_traverse; + + /* delete references to contained objects */ + inquiry tp_clear; + + /* Assigned meaning in release 2.1 */ + /* rich comparisons */ + richcmpfunc tp_richcompare; + + /* weak reference enabler */ + Py_ssize_t tp_weaklistoffset; + + /* Iterators */ + getiterfunc tp_iter; + iternextfunc tp_iternext; + + /* Attribute descriptor and subclassing stuff */ + struct PyMethodDef* tp_methods; + struct PyMemberDef* tp_members; + struct PyGetSetDef* tp_getset; + struct _typeobject* tp_base; + PyObject* tp_dict; + descrgetfunc tp_descr_get; + descrsetfunc tp_descr_set; + Py_ssize_t tp_dictoffset; + initproc tp_init; + allocfunc tp_alloc; + newfunc tp_new; + freefunc tp_free; /* Low-level free-memory routine */ + inquiry tp_is_gc; /* For PyObject_IS_GC */ + PyObject* tp_bases; + PyObject* tp_mro; /* method resolution order */ + PyObject* tp_cache; + PyObject* tp_subclasses; + PyObject* tp_weaklist; + destructor tp_del; + + /* Type attribute cache version tag. Added in version 2.6 */ + unsigned int tp_version_tag; + + destructor tp_finalize; + +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + Py_ssize_t tp_allocs; + Py_ssize_t tp_frees; + Py_ssize_t tp_maxalloc; + struct _typeobject* tp_prev; + struct _typeobject* tp_next; +#endif +} PyTypeObject; +#endif + +typedef struct { + int slot; /* slot id, see below */ + void* pfunc; /* function pointer */ +} PyType_Slot; + +typedef struct { + const char* name; + int basicsize; + int itemsize; + unsigned int flags; + PyType_Slot* slots; /* terminated by slot==0. */ +} PyType_Spec; + +PyAPI_FUNC(PyObject*) PyType_FromSpec(PyType_Spec*); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03030000 +PyAPI_FUNC(PyObject*) PyType_FromSpecWithBases(PyType_Spec*, PyObject*); +#endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03040000 +PyAPI_FUNC(void*) PyType_GetSlot(PyTypeObject*, int); +#endif + +#ifndef Py_LIMITED_API +/* The *real* layout of a type object when allocated on the heap */ +typedef struct _heaptypeobject { + /* Note: there's a dependency on the order of these members + in slotptr() in typeobject.c . */ + PyTypeObject ht_type; + PyAsyncMethods as_async; + PyNumberMethods as_number; + PyMappingMethods as_mapping; + PySequenceMethods as_sequence; /* as_sequence comes after as_mapping, + so that the mapping wins when both + the mapping and the sequence define + a given operator (e.g. __getitem__). + see add_operators() in typeobject.c . */ + PyBufferProcs as_buffer; + PyObject *ht_name, *ht_slots, *ht_qualname; + struct _dictkeysobject* ht_cached_keys; + /* here are optional user slots, followed by the members. */ +} PyHeapTypeObject; + +/* access macro to the members which are floating "behind" the object */ +#define PyHeapType_GET_MEMBERS(etype) \ + ((PyMemberDef*)(((char*)etype) + Py_TYPE(etype)->tp_basicsize)) +#endif + +/* Generic type check */ +PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject*, PyTypeObject*); +#define PyObject_TypeCheck(ob, tp) \ + (Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp))) + +PyAPI_DATA(PyTypeObject) PyType_Type; /* built-in 'type' */ +PyAPI_DATA(PyTypeObject) PyBaseObject_Type; /* built-in 'object' */ +PyAPI_DATA(PyTypeObject) PySuper_Type; /* built-in 'super' */ + +PyAPI_FUNC(unsigned long) PyType_GetFlags(PyTypeObject*); + +#define PyType_Check(op) \ + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TYPE_SUBCLASS) +#define PyType_CheckExact(op) (Py_TYPE(op) == &PyType_Type) + +PyAPI_FUNC(int) PyType_Ready(PyTypeObject*); +PyAPI_FUNC(PyObject*) PyType_GenericAlloc(PyTypeObject*, Py_ssize_t); +PyAPI_FUNC(PyObject*) PyType_GenericNew(PyTypeObject*, PyObject*, PyObject*); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _PyType_Lookup(PyTypeObject*, PyObject*); +PyAPI_FUNC(PyObject*) _PyType_LookupId(PyTypeObject*, _Py_Identifier*); +PyAPI_FUNC(PyObject*) _PyObject_LookupSpecial(PyObject*, _Py_Identifier*); +PyAPI_FUNC(PyTypeObject*) _PyType_CalculateMetaclass(PyTypeObject*, PyObject*); +#endif +PyAPI_FUNC(unsigned int) PyType_ClearCache(void); +PyAPI_FUNC(void) PyType_Modified(PyTypeObject*); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _PyType_GetDocFromInternalDoc(const char*, const char*); +PyAPI_FUNC(PyObject*) + _PyType_GetTextSignatureFromInternalDoc(const char*, const char*); +#endif + +/* Generic operations on objects */ +#ifndef Py_LIMITED_API +struct _Py_Identifier; +PyAPI_FUNC(int) PyObject_Print(PyObject*, FILE*, int); +PyAPI_FUNC(void) _Py_BreakPoint(void); +PyAPI_FUNC(void) _PyObject_Dump(PyObject*); +#endif +PyAPI_FUNC(PyObject*) PyObject_Repr(PyObject*); +PyAPI_FUNC(PyObject*) PyObject_Str(PyObject*); +PyAPI_FUNC(PyObject*) PyObject_ASCII(PyObject*); +PyAPI_FUNC(PyObject*) PyObject_Bytes(PyObject*); +PyAPI_FUNC(PyObject*) PyObject_RichCompare(PyObject*, PyObject*, int); +PyAPI_FUNC(int) PyObject_RichCompareBool(PyObject*, PyObject*, int); +PyAPI_FUNC(PyObject*) PyObject_GetAttrString(PyObject*, const char*); +PyAPI_FUNC(int) PyObject_SetAttrString(PyObject*, const char*, PyObject*); +PyAPI_FUNC(int) PyObject_HasAttrString(PyObject*, const char*); +PyAPI_FUNC(PyObject*) PyObject_GetAttr(PyObject*, PyObject*); +PyAPI_FUNC(int) PyObject_SetAttr(PyObject*, PyObject*, PyObject*); +PyAPI_FUNC(int) PyObject_HasAttr(PyObject*, PyObject*); +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _PyObject_IsAbstract(PyObject*); +PyAPI_FUNC(PyObject*) _PyObject_GetAttrId(PyObject*, struct _Py_Identifier*); +PyAPI_FUNC(int) + _PyObject_SetAttrId(PyObject*, struct _Py_Identifier*, PyObject*); +PyAPI_FUNC(int) _PyObject_HasAttrId(PyObject*, struct _Py_Identifier*); +PyAPI_FUNC(PyObject**) _PyObject_GetDictPtr(PyObject*); +#endif +PyAPI_FUNC(PyObject*) PyObject_SelfIter(PyObject*); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _PyObject_NextNotImplemented(PyObject*); +#endif +PyAPI_FUNC(PyObject*) PyObject_GenericGetAttr(PyObject*, PyObject*); +PyAPI_FUNC(int) PyObject_GenericSetAttr(PyObject*, PyObject*, PyObject*); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03030000 +PyAPI_FUNC(int) PyObject_GenericSetDict(PyObject*, PyObject*, void*); +#endif +PyAPI_FUNC(Py_hash_t) PyObject_Hash(PyObject*); +PyAPI_FUNC(Py_hash_t) PyObject_HashNotImplemented(PyObject*); +PyAPI_FUNC(int) PyObject_IsTrue(PyObject*); +PyAPI_FUNC(int) PyObject_Not(PyObject*); +PyAPI_FUNC(int) PyCallable_Check(PyObject*); + +PyAPI_FUNC(void) PyObject_ClearWeakRefs(PyObject*); +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) PyObject_CallFinalizer(PyObject*); +PyAPI_FUNC(int) PyObject_CallFinalizerFromDealloc(PyObject*); +#endif + +#ifndef Py_LIMITED_API +/* Same as PyObject_Generic{Get,Set}Attr, but passing the attributes + dict as the last parameter. */ +PyAPI_FUNC(PyObject*) + _PyObject_GenericGetAttrWithDict(PyObject*, PyObject*, PyObject*); +PyAPI_FUNC(int) _PyObject_GenericSetAttrWithDict( + PyObject*, + PyObject*, + PyObject*, + PyObject*); +#endif /* !Py_LIMITED_API */ + +/* Helper to look up a builtin object */ +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _PyObject_GetBuiltin(const char* name); +#endif + +/* PyObject_Dir(obj) acts like Python builtins.dir(obj), returning a + list of strings. PyObject_Dir(NULL) is like builtins.dir(), + returning the names of the current locals. In this case, if there are + no current locals, NULL is returned, and PyErr_Occurred() is false. +*/ +PyAPI_FUNC(PyObject*) PyObject_Dir(PyObject*); + +/* Helpers for printing recursive container types */ +PyAPI_FUNC(int) Py_ReprEnter(PyObject*); +PyAPI_FUNC(void) Py_ReprLeave(PyObject*); + +/* Flag bits for printing: */ +#define Py_PRINT_RAW 1 /* No string quotes etc. */ + +/* +`Type flags (tp_flags) + +These flags are used to extend the type structure in a backwards-compatible +fashion. Extensions can use the flags to indicate (and test) when a given +type structure contains a new feature. The Python core will use these when +introducing new functionality between major revisions (to avoid mid-version +changes in the PYTHON_API_VERSION). + +Arbitration of the flag bit positions will need to be coordinated among +all extension writers who publically release their extensions (this will +be fewer than you might expect!).. + +Most flags were removed as of Python 3.0 to make room for new flags. (Some +flags are not for backwards compatibility but to indicate the presence of an +optional feature; these flags remain of course.) + +Type definitions should use Py_TPFLAGS_DEFAULT for their tp_flags value. + +Code can use PyType_HasFeature(type_ob, flag_value) to test whether the +given type object has a specified feature. +*/ + +/* Set if the type object is dynamically allocated */ +#define Py_TPFLAGS_HEAPTYPE (1UL << 9) + +/* Set if the type allows subclassing */ +#define Py_TPFLAGS_BASETYPE (1UL << 10) + +/* Set if the type is 'ready' -- fully initialized */ +#define Py_TPFLAGS_READY (1UL << 12) + +/* Set while the type is being 'readied', to prevent recursive ready calls */ +#define Py_TPFLAGS_READYING (1UL << 13) + +/* Objects support garbage collection (see objimp.h) */ +#define Py_TPFLAGS_HAVE_GC (1UL << 14) + +/* These two bits are preserved for Stackless Python, next after this is 17 */ +#ifdef STACKLESS +#define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION (3UL << 15) +#else +#define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION 0 +#endif + +/* Objects support type attribute cache */ +#define Py_TPFLAGS_HAVE_VERSION_TAG (1UL << 18) +#define Py_TPFLAGS_VALID_VERSION_TAG (1UL << 19) + +/* Type is abstract and cannot be instantiated */ +#define Py_TPFLAGS_IS_ABSTRACT (1UL << 20) + +/* These flags are used to determine if a type is a subclass. */ +#define Py_TPFLAGS_LONG_SUBCLASS (1UL << 24) +#define Py_TPFLAGS_LIST_SUBCLASS (1UL << 25) +#define Py_TPFLAGS_TUPLE_SUBCLASS (1UL << 26) +#define Py_TPFLAGS_BYTES_SUBCLASS (1UL << 27) +#define Py_TPFLAGS_UNICODE_SUBCLASS (1UL << 28) +#define Py_TPFLAGS_DICT_SUBCLASS (1UL << 29) +#define Py_TPFLAGS_BASE_EXC_SUBCLASS (1UL << 30) +#define Py_TPFLAGS_TYPE_SUBCLASS (1UL << 31) + +#define Py_TPFLAGS_DEFAULT \ + (Py_TPFLAGS_HAVE_STACKLESS_EXTENSION | Py_TPFLAGS_HAVE_VERSION_TAG | 0) + +/* NOTE: The following flags reuse lower bits (removed as part of the + * Python 3.0 transition). */ + +/* Type structure has tp_finalize member (3.4) */ +#define Py_TPFLAGS_HAVE_FINALIZE (1UL << 0) + +#ifdef Py_LIMITED_API +#define PyType_HasFeature(t, f) ((PyType_GetFlags(t) & (f)) != 0) +#else +#define PyType_HasFeature(t, f) (((t)->tp_flags & (f)) != 0) +#endif +#define PyType_FastSubclass(t, f) PyType_HasFeature(t, f) + +/* +The macros Py_INCREF(op) and Py_DECREF(op) are used to increment or decrement +reference counts. Py_DECREF calls the object's deallocator function when +the refcount falls to 0; for +objects that don't contain references to other objects or heap memory +this can be the standard function free(). Both macros can be used +wherever a void expression is allowed. The argument must not be a +NULL pointer. If it may be NULL, use Py_XINCREF/Py_XDECREF instead. +The macro _Py_NewReference(op) initialize reference counts to 1, and +in special builds (Py_REF_DEBUG, Py_TRACE_REFS) performs additional +bookkeeping appropriate to the special build. + +We assume that the reference count field can never overflow; this can +be proven when the size of the field is the same as the pointer size, so +we ignore the possibility. Provided a C int is at least 32 bits (which +is implicitly assumed in many parts of this code), that's enough for +about 2**31 references to an object. + +XXX The following became out of date in Python 2.2, but I'm not sure +XXX what the full truth is now. Certainly, heap-allocated type objects +XXX can and should be deallocated. +Type objects should never be deallocated; the type pointer in an object +is not considered to be a reference to the type object, to save +complications in the deallocation function. (This is actually a +decision that's up to the implementer of each new type so if you want, +you can count such references to the type object.) +*/ + +/* First define a pile of simple helper macros, one set per special + * build symbol. These either expand to the obvious things, or to + * nothing at all when the special mode isn't in effect. The main + * macros can later be defined just once then, yet expand to different + * things depending on which special build options are and aren't in effect. + * Trust me : while painful, this is 20x easier to understand than, + * e.g, defining _Py_NewReference five different times in a maze of nested + * #ifdefs (we used to do that -- it was impenetrable). + */ +#ifdef Py_REF_DEBUG +PyAPI_DATA(Py_ssize_t) _Py_RefTotal; +PyAPI_FUNC(void) + _Py_NegativeRefcount(const char* fname, int lineno, PyObject* op); +PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void); +#define _Py_INC_REFTOTAL _Py_RefTotal++ +#define _Py_DEC_REFTOTAL _Py_RefTotal-- +#define _Py_REF_DEBUG_COMMA , +#define _Py_CHECK_REFCNT(OP) \ + { \ + if (((PyObject*)OP)->ob_refcnt < 0) \ + _Py_NegativeRefcount(__FILE__, __LINE__, (PyObject*)(OP)); \ + } +/* Py_REF_DEBUG also controls the display of refcounts and memory block + * allocations at the interactive prompt and at interpreter shutdown + */ +PyAPI_FUNC(void) _PyDebug_PrintTotalRefs(void); +#define _PY_DEBUG_PRINT_TOTAL_REFS() _PyDebug_PrintTotalRefs() +#else +#define _Py_INC_REFTOTAL +#define _Py_DEC_REFTOTAL +#define _Py_REF_DEBUG_COMMA +#define _Py_CHECK_REFCNT(OP) /* a semicolon */ ; +#define _PY_DEBUG_PRINT_TOTAL_REFS() +#endif /* Py_REF_DEBUG */ + +#ifdef COUNT_ALLOCS +PyAPI_FUNC(void) inc_count(PyTypeObject*); +PyAPI_FUNC(void) dec_count(PyTypeObject*); +#define _Py_INC_TPALLOCS(OP) inc_count(Py_TYPE(OP)) +#define _Py_INC_TPFREES(OP) dec_count(Py_TYPE(OP)) +#define _Py_DEC_TPFREES(OP) Py_TYPE(OP)->tp_frees-- +#define _Py_COUNT_ALLOCS_COMMA , +#else +#define _Py_INC_TPALLOCS(OP) +#define _Py_INC_TPFREES(OP) +#define _Py_DEC_TPFREES(OP) +#define _Py_COUNT_ALLOCS_COMMA +#endif /* COUNT_ALLOCS */ + +#ifdef Py_TRACE_REFS +/* Py_TRACE_REFS is such major surgery that we call external routines. */ +PyAPI_FUNC(void) _Py_NewReference(PyObject*); +PyAPI_FUNC(void) _Py_ForgetReference(PyObject*); +PyAPI_FUNC(void) _Py_Dealloc(PyObject*); +PyAPI_FUNC(void) _Py_PrintReferences(FILE*); +PyAPI_FUNC(void) _Py_PrintReferenceAddresses(FILE*); +PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject*, int force); + +#else +/* Without Py_TRACE_REFS, there's little enough to do that we expand code + * inline. + */ +#define _Py_NewReference(op) \ + (_Py_INC_TPALLOCS(op) \ + _Py_COUNT_ALLOCS_COMMA _Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA Py_REFCNT( \ + op) = 1) + +#define _Py_ForgetReference(op) _Py_INC_TPFREES(op) + +#ifdef Py_LIMITED_API +PyAPI_FUNC(void) _Py_Dealloc(PyObject*); +#else +#define _Py_Dealloc(op) \ + (_Py_INC_TPFREES(op) \ + _Py_COUNT_ALLOCS_COMMA(*Py_TYPE(op)->tp_dealloc)((PyObject*)(op))) +#endif +#endif /* !Py_TRACE_REFS */ + +#define Py_INCREF(op) \ + (_Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA((PyObject*)(op))->ob_refcnt++) + +#define Py_DECREF(op) \ + do { \ + PyObject* _py_decref_tmp = (PyObject*)(op); \ + if (_Py_DEC_REFTOTAL _Py_REF_DEBUG_COMMA--(_py_decref_tmp)->ob_refcnt != \ + 0) \ + _Py_CHECK_REFCNT(_py_decref_tmp) else _Py_Dealloc(_py_decref_tmp); \ + } while (0) + +/* Safely decref `op` and set `op` to NULL, especially useful in tp_clear + * and tp_dealloc implementations. + * + * Note that "the obvious" code can be deadly: + * + * Py_XDECREF(op); + * op = NULL; + * + * Typically, `op` is something like self->containee, and `self` is done + * using its `containee` member. In the code sequence above, suppose + * `containee` is non-NULL with a refcount of 1. Its refcount falls to + * 0 on the first line, which can trigger an arbitrary amount of code, + * possibly including finalizers (like __del__ methods or weakref callbacks) + * coded in Python, which in turn can release the GIL and allow other threads + * to run, etc. Such code may even invoke methods of `self` again, or cause + * cyclic gc to trigger, but-- oops! --self->containee still points to the + * object being torn down, and it may be in an insane state while being torn + * down. This has in fact been a rich historic source of miserable (rare & + * hard-to-diagnose) segfaulting (and other) bugs. + * + * The safe way is: + * + * Py_CLEAR(op); + * + * That arranges to set `op` to NULL _before_ decref'ing, so that any code + * triggered as a side-effect of `op` getting torn down no longer believes + * `op` points to a valid object. + * + * There are cases where it's safe to use the naive code, but they're brittle. + * For example, if `op` points to a Python integer, you know that destroying + * one of those can't cause problems -- but in part that relies on that + * Python integers aren't currently weakly referencable. Best practice is + * to use Py_CLEAR() even if you can't think of a reason for why you need to. + */ +#define Py_CLEAR(op) \ + do { \ + PyObject* _py_tmp = (PyObject*)(op); \ + if (_py_tmp != NULL) { \ + (op) = NULL; \ + Py_DECREF(_py_tmp); \ + } \ + } while (0) + +/* Macros to use in case the object pointer may be NULL: */ +#define Py_XINCREF(op) \ + do { \ + PyObject* _py_xincref_tmp = (PyObject*)(op); \ + if (_py_xincref_tmp != NULL) \ + Py_INCREF(_py_xincref_tmp); \ + } while (0) + +#define Py_XDECREF(op) \ + do { \ + PyObject* _py_xdecref_tmp = (PyObject*)(op); \ + if (_py_xdecref_tmp != NULL) \ + Py_DECREF(_py_xdecref_tmp); \ + } while (0) + +#ifndef Py_LIMITED_API +/* Safely decref `op` and set `op` to `op2`. + * + * As in case of Py_CLEAR "the obvious" code can be deadly: + * + * Py_DECREF(op); + * op = op2; + * + * The safe way is: + * + * Py_SETREF(op, op2); + * + * That arranges to set `op` to `op2` _before_ decref'ing, so that any code + * triggered as a side-effect of `op` getting torn down no longer believes + * `op` points to a valid object. + * + * Py_XSETREF is a variant of Py_SETREF that uses Py_XDECREF instead of + * Py_DECREF. + */ + +#define Py_SETREF(op, op2) \ + do { \ + PyObject* _py_tmp = (PyObject*)(op); \ + (op) = (op2); \ + Py_DECREF(_py_tmp); \ + } while (0) + +#define Py_XSETREF(op, op2) \ + do { \ + PyObject* _py_tmp = (PyObject*)(op); \ + (op) = (op2); \ + Py_XDECREF(_py_tmp); \ + } while (0) + +#endif /* ifndef Py_LIMITED_API */ + +/* +These are provided as conveniences to Python runtime embedders, so that +they can have object code that is not dependent on Python compilation flags. +*/ +PyAPI_FUNC(void) Py_IncRef(PyObject*); +PyAPI_FUNC(void) Py_DecRef(PyObject*); + +#ifndef Py_LIMITED_API +PyAPI_DATA(PyTypeObject) _PyNone_Type; +PyAPI_DATA(PyTypeObject) _PyNotImplemented_Type; +#endif /* !Py_LIMITED_API */ + +/* +_Py_NoneStruct is an object of undefined type which can be used in contexts +where NULL (nil) is not suitable (since NULL often means 'error'). + +Don't forget to apply Py_INCREF() when returning this value!!! +*/ +PyAPI_DATA(PyObject) _Py_NoneStruct; /* Don't use this directly */ +#define Py_None (&_Py_NoneStruct) + +/* Macro for returning Py_None from a function */ +#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None + +/* +Py_NotImplemented is a singleton used to signal that an operation is +not implemented for a given type combination. +*/ +PyAPI_DATA(PyObject) _Py_NotImplementedStruct; /* Don't use this directly */ +#define Py_NotImplemented (&_Py_NotImplementedStruct) + +/* Macro for returning Py_NotImplemented from a function */ +#define Py_RETURN_NOTIMPLEMENTED \ + return Py_INCREF(Py_NotImplemented), Py_NotImplemented + +/* Rich comparison opcodes */ +#define Py_LT 0 +#define Py_LE 1 +#define Py_EQ 2 +#define Py_NE 3 +#define Py_GT 4 +#define Py_GE 5 + +#ifndef Py_LIMITED_API +/* Maps Py_LT to Py_GT, ..., Py_GE to Py_LE. + * Defined in object.c. + */ +PyAPI_DATA(int) _Py_SwappedOp[]; +#endif /* !Py_LIMITED_API */ + +/* +More conventions +================ + +Argument Checking +----------------- + +Functions that take objects as arguments normally don't check for nil +arguments, but they do check the type of the argument, and return an +error if the function doesn't apply to the type. + +Failure Modes +------------- + +Functions may fail for a variety of reasons, including running out of +memory. This is communicated to the caller in two ways: an error string +is set (see errors.h), and the function result differs: functions that +normally return a pointer return NULL for failure, functions returning +an integer return -1 (which could be a legal return value too!), and +other functions return 0 for success and -1 for failure. +Callers should always check for errors before using the result. If +an error was set, the caller must either explicitly clear it, or pass +the error on to its caller. + +Reference Counts +---------------- + +It takes a while to get used to the proper usage of reference counts. + +Functions that create an object set the reference count to 1; such new +objects must be stored somewhere or destroyed again with Py_DECREF(). +Some functions that 'store' objects, such as PyTuple_SetItem() and +PyList_SetItem(), +don't increment the reference count of the object, since the most +frequent use is to store a fresh object. Functions that 'retrieve' +objects, such as PyTuple_GetItem() and PyDict_GetItemString(), also +don't increment +the reference count, since most frequently the object is only looked at +quickly. Thus, to retrieve an object and store it again, the caller +must call Py_INCREF() explicitly. + +NOTE: functions that 'consume' a reference count, like +PyList_SetItem(), consume the reference even if the object wasn't +successfully stored, to simplify error handling. + +It seems attractive to make other functions that take an object as +argument consume a reference count; however, this may quickly get +confusing (even the current practice is already confusing). Consider +it carefully, it may save lots of calls to Py_INCREF() and Py_DECREF() at +times. +*/ + +/* Trashcan mechanism, thanks to Christian Tismer. + +When deallocating a container object, it's possible to trigger an unbounded +chain of deallocations, as each Py_DECREF in turn drops the refcount on "the +next" object in the chain to 0. This can easily lead to stack faults, and +especially in threads (which typically have less stack space to work with). + +A container object that participates in cyclic gc can avoid this by +bracketing the body of its tp_dealloc function with a pair of macros: + +static void +mytype_dealloc(mytype *p) +{ + ... declarations go here ... + + PyObject_GC_UnTrack(p); // must untrack first + Py_TRASHCAN_SAFE_BEGIN(p) + ... The body of the deallocator goes here, including all calls ... + ... to Py_DECREF on contained objects. ... + Py_TRASHCAN_SAFE_END(p) +} + +CAUTION: Never return from the middle of the body! If the body needs to +"get out early", put a label immediately before the Py_TRASHCAN_SAFE_END +call, and goto it. Else the call-depth counter (see below) will stay +above 0 forever, and the trashcan will never get emptied. + +How it works: The BEGIN macro increments a call-depth counter. So long +as this counter is small, the body of the deallocator is run directly without +further ado. But if the counter gets large, it instead adds p to a list of +objects to be deallocated later, skips the body of the deallocator, and +resumes execution after the END macro. The tp_dealloc routine then returns +without deallocating anything (and so unbounded call-stack depth is avoided). + +When the call stack finishes unwinding again, code generated by the END macro +notices this, and calls another routine to deallocate all the objects that +may have been added to the list of deferred deallocations. In effect, a +chain of N deallocations is broken into N / PyTrash_UNWIND_LEVEL pieces, +with the call stack never exceeding a depth of PyTrash_UNWIND_LEVEL. +*/ + +#ifndef Py_LIMITED_API +/* This is the old private API, invoked by the macros before 3.2.4. + Kept for binary compatibility of extensions using the stable ABI. */ +PyAPI_FUNC(void) _PyTrash_deposit_object(PyObject*); +PyAPI_FUNC(void) _PyTrash_destroy_chain(void); +PyAPI_DATA(int) _PyTrash_delete_nesting; +PyAPI_DATA(PyObject*) _PyTrash_delete_later; +#endif /* !Py_LIMITED_API */ + +/* The new thread-safe private API, invoked by the macros below. */ +PyAPI_FUNC(void) _PyTrash_thread_deposit_object(PyObject*); +PyAPI_FUNC(void) _PyTrash_thread_destroy_chain(void); + +#define PyTrash_UNWIND_LEVEL 50 + +#define Py_TRASHCAN_SAFE_BEGIN(op) \ + do { \ + PyThreadState* _tstate = PyThreadState_GET(); \ + if (_tstate->trash_delete_nesting < PyTrash_UNWIND_LEVEL) { \ + ++_tstate->trash_delete_nesting; +/* The body of the deallocator is here. */ +#define Py_TRASHCAN_SAFE_END(op) \ + --_tstate->trash_delete_nesting; \ + if (_tstate->trash_delete_later && _tstate->trash_delete_nesting <= 0) \ + _PyTrash_thread_destroy_chain(); \ + } \ + else _PyTrash_thread_deposit_object((PyObject*)op); \ + } \ + while (0) \ + ; + +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) _PyDebugAllocatorStats( + FILE* out, + const char* block_name, + int num_blocks, + size_t sizeof_block); +PyAPI_FUNC(void) _PyObject_DebugTypeStats(FILE* out); +#endif /* ifndef Py_LIMITED_API */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_OBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/objimpl.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/objimpl.h new file mode 100644 index 0000000..525ff2f --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/objimpl.h @@ -0,0 +1,371 @@ +/* The PyObject_ memory family: high-level object memory interfaces. + See pymem.h for the low-level PyMem_ family. +*/ + +#ifndef Py_OBJIMPL_H +#define Py_OBJIMPL_H + +#include "pymem.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* BEWARE: + + Each interface exports both functions and macros. Extension modules should + use the functions, to ensure binary compatibility across Python versions. + Because the Python implementation is free to change internal details, and + the macros may (or may not) expose details for speed, if you do use the + macros you must recompile your extensions with each Python release. + + Never mix calls to PyObject_ memory functions with calls to the platform + malloc/realloc/ calloc/free, or with calls to PyMem_. +*/ + +/* +Functions and macros for modules that implement new object types. + + - PyObject_New(type, typeobj) allocates memory for a new object of the given + type, and initializes part of it. 'type' must be the C structure type used + to represent the object, and 'typeobj' the address of the corresponding + type object. Reference count and type pointer are filled in; the rest of + the bytes of the object are *undefined*! The resulting expression type is + 'type *'. The size of the object is determined by the tp_basicsize field + of the type object. + + - PyObject_NewVar(type, typeobj, n) is similar but allocates a variable-size + object with room for n items. In addition to the refcount and type pointer + fields, this also fills in the ob_size field. + + - PyObject_Del(op) releases the memory allocated for an object. It does not + run a destructor -- it only frees the memory. PyObject_Free is identical. + + - PyObject_Init(op, typeobj) and PyObject_InitVar(op, typeobj, n) don't + allocate memory. Instead of a 'type' parameter, they take a pointer to a + new object (allocated by an arbitrary allocator), and initialize its object + header fields. + +Note that objects created with PyObject_{New, NewVar} are allocated using the +specialized Python allocator (implemented in obmalloc.c), if WITH_PYMALLOC is +enabled. In addition, a special debugging allocator is used if PYMALLOC_DEBUG +is also #defined. + +In case a specific form of memory management is needed (for example, if you +must use the platform malloc heap(s), or shared memory, or C++ local storage or +operator new), you must first allocate the object with your custom allocator, +then pass its pointer to PyObject_{Init, InitVar} for filling in its Python- +specific fields: reference count, type pointer, possibly others. You should +be aware that Python has no control over these objects because they don't +cooperate with the Python memory manager. Such objects may not be eligible +for automatic garbage collection and you have to make sure that they are +released accordingly whenever their destructor gets called (cf. the specific +form of memory management you're using). + +Unless you have specific memory management requirements, use +PyObject_{New, NewVar, Del}. +*/ + +/* + * Raw object memory interface + * =========================== + */ + +/* Functions to call the same malloc/realloc/free as used by Python's + object allocator. If WITH_PYMALLOC is enabled, these may differ from + the platform malloc/realloc/free. The Python object allocator is + designed for fast, cache-conscious allocation of many "small" objects, + and with low hidden memory overhead. + + PyObject_Malloc(0) returns a unique non-NULL pointer if possible. + + PyObject_Realloc(NULL, n) acts like PyObject_Malloc(n). + PyObject_Realloc(p != NULL, 0) does not return NULL, or free the memory + at p. + + Returned pointers must be checked for NULL explicitly; no action is + performed on failure other than to return NULL (no warning it printed, no + exception is set, etc). + + For allocating objects, use PyObject_{New, NewVar} instead whenever + possible. The PyObject_{Malloc, Realloc, Free} family is exposed + so that you can exploit Python's small-block allocator for non-object + uses. If you must use these routines to allocate object memory, make sure + the object gets initialized via PyObject_{Init, InitVar} after obtaining + the raw memory. +*/ +PyAPI_FUNC(void*) PyObject_Malloc(size_t size); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03050000 +PyAPI_FUNC(void*) PyObject_Calloc(size_t nelem, size_t elsize); +#endif +PyAPI_FUNC(void*) PyObject_Realloc(void* ptr, size_t new_size); +PyAPI_FUNC(void) PyObject_Free(void* ptr); + +#ifndef Py_LIMITED_API +/* This function returns the number of allocated memory blocks, regardless of + * size */ +PyAPI_FUNC(Py_ssize_t) _Py_GetAllocatedBlocks(void); +#endif /* !Py_LIMITED_API */ + +/* Macros */ +#ifdef WITH_PYMALLOC +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) _PyObject_DebugMallocStats(FILE* out); +#endif /* #ifndef Py_LIMITED_API */ +#endif + +/* Macros */ +#define PyObject_MALLOC PyObject_Malloc +#define PyObject_REALLOC PyObject_Realloc +#define PyObject_FREE PyObject_Free +#define PyObject_Del PyObject_Free +#define PyObject_DEL PyObject_Free + +/* + * Generic object allocator interface + * ================================== + */ + +/* Functions */ +PyAPI_FUNC(PyObject*) PyObject_Init(PyObject*, PyTypeObject*); +PyAPI_FUNC(PyVarObject*) + PyObject_InitVar(PyVarObject*, PyTypeObject*, Py_ssize_t); +PyAPI_FUNC(PyObject*) _PyObject_New(PyTypeObject*); +PyAPI_FUNC(PyVarObject*) _PyObject_NewVar(PyTypeObject*, Py_ssize_t); + +#define PyObject_New(type, typeobj) ((type*)_PyObject_New(typeobj)) +#define PyObject_NewVar(type, typeobj, n) \ + ((type*)_PyObject_NewVar((typeobj), (n))) + +/* Macros trading binary compatibility for speed. See also pymem.h. + Note that these macros expect non-NULL object pointers.*/ +#define PyObject_INIT(op, typeobj) \ + (Py_TYPE(op) = (typeobj), _Py_NewReference((PyObject*)(op)), (op)) +#define PyObject_INIT_VAR(op, typeobj, size) \ + (Py_SIZE(op) = (size), PyObject_INIT((op), (typeobj))) + +#define _PyObject_SIZE(typeobj) ((typeobj)->tp_basicsize) + +/* _PyObject_VAR_SIZE returns the number of bytes (as size_t) allocated for a + vrbl-size object with nitems items, exclusive of gc overhead (if any). The + value is rounded up to the closest multiple of sizeof(void *), in order to + ensure that pointer fields at the end of the object are correctly aligned + for the platform (this is of special importance for subclasses of, e.g., + str or int, so that pointers can be stored after the embedded data). + + Note that there's no memory wastage in doing this, as malloc has to + return (at worst) pointer-aligned memory anyway. +*/ +#if ((SIZEOF_VOID_P - 1) & SIZEOF_VOID_P) != 0 +#error "_PyObject_VAR_SIZE requires SIZEOF_VOID_P be a power of 2" +#endif + +#define _PyObject_VAR_SIZE(typeobj, nitems) \ + _Py_SIZE_ROUND_UP( \ + (typeobj)->tp_basicsize + (nitems) * (typeobj)->tp_itemsize, \ + SIZEOF_VOID_P) + +#define PyObject_NEW(type, typeobj) \ + ((type*)PyObject_Init( \ + (PyObject*)PyObject_MALLOC(_PyObject_SIZE(typeobj)), (typeobj))) + +#define PyObject_NEW_VAR(type, typeobj, n) \ + ((type*)PyObject_InitVar( \ + (PyVarObject*)PyObject_MALLOC(_PyObject_VAR_SIZE((typeobj), (n))), \ + (typeobj), \ + (n))) + +/* This example code implements an object constructor with a custom + allocator, where PyObject_New is inlined, and shows the important + distinction between two steps (at least): + 1) the actual allocation of the object storage; + 2) the initialization of the Python specific fields + in this storage with PyObject_{Init, InitVar}. + + PyObject * + YourObject_New(...) + { + PyObject *op; + + op = (PyObject *) Your_Allocator(_PyObject_SIZE(YourTypeStruct)); + if (op == NULL) + return PyErr_NoMemory(); + + PyObject_Init(op, &YourTypeStruct); + + op->ob_field = value; + ... + return op; + } + + Note that in C++, the use of the new operator usually implies that + the 1st step is performed automatically for you, so in a C++ class + constructor you would start directly with PyObject_Init/InitVar +*/ + +#ifndef Py_LIMITED_API +typedef struct { + /* user context passed as the first argument to the 2 functions */ + void* ctx; + + /* allocate an arena of size bytes */ + void* (*alloc)(void* ctx, size_t size); + + /* free an arena */ + void (*free)(void* ctx, void* ptr, size_t size); +} PyObjectArenaAllocator; + +/* Get the arena allocator. */ +PyAPI_FUNC(void) PyObject_GetArenaAllocator(PyObjectArenaAllocator* allocator); + +/* Set the arena allocator. */ +PyAPI_FUNC(void) PyObject_SetArenaAllocator(PyObjectArenaAllocator* allocator); +#endif + +/* + * Garbage Collection Support + * ========================== + */ + +/* C equivalent of gc.collect() which ignores the state of gc.enabled. */ +PyAPI_FUNC(Py_ssize_t) PyGC_Collect(void); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(Py_ssize_t) _PyGC_CollectNoFail(void); +PyAPI_FUNC(Py_ssize_t) _PyGC_CollectIfEnabled(void); +#endif + +/* Test if a type has a GC head */ +#define PyType_IS_GC(t) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC) + +/* Test if an object has a GC head */ +#define PyObject_IS_GC(o) \ + (PyType_IS_GC(Py_TYPE(o)) && \ + (Py_TYPE(o)->tp_is_gc == NULL || Py_TYPE(o)->tp_is_gc(o))) + +PyAPI_FUNC(PyVarObject*) _PyObject_GC_Resize(PyVarObject*, Py_ssize_t); +#define PyObject_GC_Resize(type, op, n) \ + ((type*)_PyObject_GC_Resize((PyVarObject*)(op), (n))) + +/* GC information is stored BEFORE the object structure. */ +#ifndef Py_LIMITED_API +typedef union _gc_head { + struct { + union _gc_head* gc_next; + union _gc_head* gc_prev; + Py_ssize_t gc_refs; + } gc; + double dummy; /* force worst-case alignment */ +} PyGC_Head; + +extern PyGC_Head* _PyGC_generation0; + +#define _Py_AS_GC(o) ((PyGC_Head*)(o)-1) + +/* Bit 0 is set when tp_finalize is called */ +#define _PyGC_REFS_MASK_FINALIZED (1 << 0) +/* The (N-1) most significant bits contain the gc state / refcount */ +#define _PyGC_REFS_SHIFT (1) +#define _PyGC_REFS_MASK (((size_t)-1) << _PyGC_REFS_SHIFT) + +#define _PyGCHead_REFS(g) ((g)->gc.gc_refs >> _PyGC_REFS_SHIFT) +#define _PyGCHead_SET_REFS(g, v) \ + do { \ + (g)->gc.gc_refs = ((g)->gc.gc_refs & ~_PyGC_REFS_MASK) | \ + (((size_t)(v)) << _PyGC_REFS_SHIFT); \ + } while (0) +#define _PyGCHead_DECREF(g) ((g)->gc.gc_refs -= 1 << _PyGC_REFS_SHIFT) + +#define _PyGCHead_FINALIZED(g) \ + (((g)->gc.gc_refs & _PyGC_REFS_MASK_FINALIZED) != 0) +#define _PyGCHead_SET_FINALIZED(g, v) \ + do { \ + (g)->gc.gc_refs = \ + ((g)->gc.gc_refs & ~_PyGC_REFS_MASK_FINALIZED) | (v != 0); \ + } while (0) + +#define _PyGC_FINALIZED(o) _PyGCHead_FINALIZED(_Py_AS_GC(o)) +#define _PyGC_SET_FINALIZED(o, v) _PyGCHead_SET_FINALIZED(_Py_AS_GC(o), v) + +#define _PyGC_REFS(o) _PyGCHead_REFS(_Py_AS_GC(o)) + +#define _PyGC_REFS_UNTRACKED (-2) +#define _PyGC_REFS_REACHABLE (-3) +#define _PyGC_REFS_TENTATIVELY_UNREACHABLE (-4) + +/* Tell the GC to track this object. NB: While the object is tracked the + * collector it must be safe to call the ob_traverse method. */ +#define _PyObject_GC_TRACK(o) \ + do { \ + PyGC_Head* g = _Py_AS_GC(o); \ + if (_PyGCHead_REFS(g) != _PyGC_REFS_UNTRACKED) \ + Py_FatalError("GC object already tracked"); \ + _PyGCHead_SET_REFS(g, _PyGC_REFS_REACHABLE); \ + g->gc.gc_next = _PyGC_generation0; \ + g->gc.gc_prev = _PyGC_generation0->gc.gc_prev; \ + g->gc.gc_prev->gc.gc_next = g; \ + _PyGC_generation0->gc.gc_prev = g; \ + } while (0); + +/* Tell the GC to stop tracking this object. + * gc_next doesn't need to be set to NULL, but doing so is a good + * way to provoke memory errors if calling code is confused. + */ +#define _PyObject_GC_UNTRACK(o) \ + do { \ + PyGC_Head* g = _Py_AS_GC(o); \ + assert(_PyGCHead_REFS(g) != _PyGC_REFS_UNTRACKED); \ + _PyGCHead_SET_REFS(g, _PyGC_REFS_UNTRACKED); \ + g->gc.gc_prev->gc.gc_next = g->gc.gc_next; \ + g->gc.gc_next->gc.gc_prev = g->gc.gc_prev; \ + g->gc.gc_next = NULL; \ + } while (0); + +/* True if the object is currently tracked by the GC. */ +#define _PyObject_GC_IS_TRACKED(o) (_PyGC_REFS(o) != _PyGC_REFS_UNTRACKED) + +/* True if the object may be tracked by the GC in the future, or already is. + This can be useful to implement some optimizations. */ +#define _PyObject_GC_MAY_BE_TRACKED(obj) \ + (PyObject_IS_GC(obj) && \ + (!PyTuple_CheckExact(obj) || _PyObject_GC_IS_TRACKED(obj))) +#endif /* Py_LIMITED_API */ + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _PyObject_GC_Malloc(size_t size); +PyAPI_FUNC(PyObject*) _PyObject_GC_Calloc(size_t size); +#endif /* !Py_LIMITED_API */ +PyAPI_FUNC(PyObject*) _PyObject_GC_New(PyTypeObject*); +PyAPI_FUNC(PyVarObject*) _PyObject_GC_NewVar(PyTypeObject*, Py_ssize_t); +PyAPI_FUNC(void) PyObject_GC_Track(void*); +PyAPI_FUNC(void) PyObject_GC_UnTrack(void*); +PyAPI_FUNC(void) PyObject_GC_Del(void*); + +#define PyObject_GC_New(type, typeobj) ((type*)_PyObject_GC_New(typeobj)) +#define PyObject_GC_NewVar(type, typeobj, n) \ + ((type*)_PyObject_GC_NewVar((typeobj), (n))) + +/* Utility macro to help write tp_traverse functions. + * To use this macro, the tp_traverse function must name its arguments + * "visit" and "arg". This is intended to keep tp_traverse functions + * looking as much alike as possible. + */ +#define Py_VISIT(op) \ + do { \ + if (op) { \ + int vret = visit((PyObject*)(op), arg); \ + if (vret) \ + return vret; \ + } \ + } while (0) + +/* Test if a type supports weak references */ +#define PyType_SUPPORTS_WEAKREFS(t) ((t)->tp_weaklistoffset > 0) + +#define PyObject_GET_WEAKREFS_LISTPTR(o) \ + ((PyObject**)(((char*)(o)) + Py_TYPE(o)->tp_weaklistoffset)) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_OBJIMPL_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/odictobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/odictobject.h new file mode 100644 index 0000000..465f203 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/odictobject.h @@ -0,0 +1,41 @@ +#ifndef Py_ODICTOBJECT_H +#define Py_ODICTOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +/* OrderedDict */ +/* This API is optional and mostly redundant. */ + +#ifndef Py_LIMITED_API + +typedef struct _odictobject PyODictObject; + +PyAPI_DATA(PyTypeObject) PyODict_Type; +PyAPI_DATA(PyTypeObject) PyODictIter_Type; +PyAPI_DATA(PyTypeObject) PyODictKeys_Type; +PyAPI_DATA(PyTypeObject) PyODictItems_Type; +PyAPI_DATA(PyTypeObject) PyODictValues_Type; + +#define PyODict_Check(op) PyObject_TypeCheck(op, &PyODict_Type) +#define PyODict_CheckExact(op) (Py_TYPE(op) == &PyODict_Type) +#define PyODict_SIZE(op) ((PyDictObject*)op)->ma_used + +PyAPI_FUNC(PyObject*) PyODict_New(void); +PyAPI_FUNC(int) PyODict_SetItem(PyObject* od, PyObject* key, PyObject* item); +PyAPI_FUNC(int) PyODict_DelItem(PyObject* od, PyObject* key); + +/* wrappers around PyDict* functions */ +#define PyODict_GetItem(od, key) PyDict_GetItem((PyObject*)od, key) +#define PyODict_GetItemWithError(od, key) \ + PyDict_GetItemWithError((PyObject*)od, key) +#define PyODict_Contains(od, key) PyDict_Contains((PyObject*)od, key) +#define PyODict_Size(od) PyDict_Size((PyObject*)od) +#define PyODict_GetItemString(od, key) PyDict_GetItemString((PyObject*)od, key) + +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_ODICTOBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/opcode.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/opcode.h new file mode 100644 index 0000000..3d12faf --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/opcode.h @@ -0,0 +1,155 @@ +/* Auto-generated by Tools/scripts/generate_opcode_h.py */ +#ifndef Py_OPCODE_H +#define Py_OPCODE_H +#ifdef __cplusplus +extern "C" { +#endif + +/* Instruction opcodes for compiled code */ +#define POP_TOP 1 +#define ROT_TWO 2 +#define ROT_THREE 3 +#define DUP_TOP 4 +#define DUP_TOP_TWO 5 +#define NOP 9 +#define UNARY_POSITIVE 10 +#define UNARY_NEGATIVE 11 +#define UNARY_NOT 12 +#define UNARY_INVERT 15 +#define BINARY_MATRIX_MULTIPLY 16 +#define INPLACE_MATRIX_MULTIPLY 17 +#define BINARY_POWER 19 +#define BINARY_MULTIPLY 20 +#define BINARY_MODULO 22 +#define BINARY_ADD 23 +#define BINARY_SUBTRACT 24 +#define BINARY_SUBSCR 25 +#define BINARY_FLOOR_DIVIDE 26 +#define BINARY_TRUE_DIVIDE 27 +#define INPLACE_FLOOR_DIVIDE 28 +#define INPLACE_TRUE_DIVIDE 29 +#define GET_AITER 50 +#define GET_ANEXT 51 +#define BEFORE_ASYNC_WITH 52 +#define INPLACE_ADD 55 +#define INPLACE_SUBTRACT 56 +#define INPLACE_MULTIPLY 57 +#define INPLACE_MODULO 59 +#define STORE_SUBSCR 60 +#define DELETE_SUBSCR 61 +#define BINARY_LSHIFT 62 +#define BINARY_RSHIFT 63 +#define BINARY_AND 64 +#define BINARY_XOR 65 +#define BINARY_OR 66 +#define INPLACE_POWER 67 +#define GET_ITER 68 +#define GET_YIELD_FROM_ITER 69 +#define PRINT_EXPR 70 +#define LOAD_BUILD_CLASS 71 +#define YIELD_FROM 72 +#define GET_AWAITABLE 73 +#define INPLACE_LSHIFT 75 +#define INPLACE_RSHIFT 76 +#define INPLACE_AND 77 +#define INPLACE_XOR 78 +#define INPLACE_OR 79 +#define BREAK_LOOP 80 +#define WITH_CLEANUP_START 81 +#define WITH_CLEANUP_FINISH 82 +#define RETURN_VALUE 83 +#define IMPORT_STAR 84 +#define SETUP_ANNOTATIONS 85 +#define YIELD_VALUE 86 +#define POP_BLOCK 87 +#define END_FINALLY 88 +#define POP_EXCEPT 89 +#define HAVE_ARGUMENT 90 +#define STORE_NAME 90 +#define DELETE_NAME 91 +#define UNPACK_SEQUENCE 92 +#define FOR_ITER 93 +#define UNPACK_EX 94 +#define STORE_ATTR 95 +#define DELETE_ATTR 96 +#define STORE_GLOBAL 97 +#define DELETE_GLOBAL 98 +#define LOAD_CONST 100 +#define LOAD_NAME 101 +#define BUILD_TUPLE 102 +#define BUILD_LIST 103 +#define BUILD_SET 104 +#define BUILD_MAP 105 +#define LOAD_ATTR 106 +#define COMPARE_OP 107 +#define IMPORT_NAME 108 +#define IMPORT_FROM 109 +#define JUMP_FORWARD 110 +#define JUMP_IF_FALSE_OR_POP 111 +#define JUMP_IF_TRUE_OR_POP 112 +#define JUMP_ABSOLUTE 113 +#define POP_JUMP_IF_FALSE 114 +#define POP_JUMP_IF_TRUE 115 +#define LOAD_GLOBAL 116 +#define CONTINUE_LOOP 119 +#define SETUP_LOOP 120 +#define SETUP_EXCEPT 121 +#define SETUP_FINALLY 122 +#define LOAD_FAST 124 +#define STORE_FAST 125 +#define DELETE_FAST 126 +#define STORE_ANNOTATION 127 +#define RAISE_VARARGS 130 +#define CALL_FUNCTION 131 +#define MAKE_FUNCTION 132 +#define BUILD_SLICE 133 +#define LOAD_CLOSURE 135 +#define LOAD_DEREF 136 +#define STORE_DEREF 137 +#define DELETE_DEREF 138 +#define CALL_FUNCTION_KW 141 +#define CALL_FUNCTION_EX 142 +#define SETUP_WITH 143 +#define EXTENDED_ARG 144 +#define LIST_APPEND 145 +#define SET_ADD 146 +#define MAP_ADD 147 +#define LOAD_CLASSDEREF 148 +#define BUILD_LIST_UNPACK 149 +#define BUILD_MAP_UNPACK 150 +#define BUILD_MAP_UNPACK_WITH_CALL 151 +#define BUILD_TUPLE_UNPACK 152 +#define BUILD_SET_UNPACK 153 +#define SETUP_ASYNC_WITH 154 +#define FORMAT_VALUE 155 +#define BUILD_CONST_KEY_MAP 156 +#define BUILD_STRING 157 +#define BUILD_TUPLE_UNPACK_WITH_CALL 158 + +/* EXCEPT_HANDLER is a special, implicit block type which is created when + entering an except handler. It is not an opcode but we define it here + as we want it to be available to both frameobject.c and ceval.c, while + remaining private.*/ +#define EXCEPT_HANDLER 257 + +enum cmp_op { + PyCmp_LT = Py_LT, + PyCmp_LE = Py_LE, + PyCmp_EQ = Py_EQ, + PyCmp_NE = Py_NE, + PyCmp_GT = Py_GT, + PyCmp_GE = Py_GE, + PyCmp_IN, + PyCmp_NOT_IN, + PyCmp_IS, + PyCmp_IS_NOT, + PyCmp_EXC_MATCH, + PyCmp_BAD +}; + +#define HAS_ARG(op) ((op) >= HAVE_ARGUMENT) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_OPCODE_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/osdefs.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/osdefs.h new file mode 100644 index 0000000..056c84d --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/osdefs.h @@ -0,0 +1,46 @@ +#ifndef Py_OSDEFS_H +#define Py_OSDEFS_H +#ifdef __cplusplus +extern "C" { +#endif + +/* Operating system dependencies */ + +#ifdef MS_WINDOWS +#define SEP L'\\' +#define ALTSEP L'/' +#define MAXPATHLEN 256 +#define DELIM L';' +#endif + +/* Filename separator */ +#ifndef SEP +#define SEP L'/' +#endif + +/* Max pathname length */ +#ifdef __hpux +#include +#include +#ifndef PATH_MAX +#define PATH_MAX MAXPATHLEN +#endif +#endif + +#ifndef MAXPATHLEN +#if defined(PATH_MAX) && PATH_MAX > 1024 +#define MAXPATHLEN PATH_MAX +#else +#define MAXPATHLEN 1024 +#endif +#endif + +/* Search path entry delimiter */ +#ifndef DELIM +#define DELIM L':' +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_OSDEFS_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/osmodule.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/osmodule.h new file mode 100644 index 0000000..fcd1b48 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/osmodule.h @@ -0,0 +1,17 @@ + +/* os module interface */ + +#ifndef Py_OSMODULE_H +#define Py_OSMODULE_H +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03060000 +PyAPI_FUNC(PyObject*) PyOS_FSPath(PyObject* path); +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_OSMODULE_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/parsetok.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/parsetok.h new file mode 100644 index 0000000..c6578fa --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/parsetok.h @@ -0,0 +1,112 @@ + +/* Parser-tokenizer link interface */ +#ifndef Py_LIMITED_API +#ifndef Py_PARSETOK_H +#define Py_PARSETOK_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + int error; +#ifndef PGEN + /* The filename is useless for pgen, see comment in tok_state structure */ + PyObject* filename; +#endif + int lineno; + int offset; + char* text; /* UTF-8-encoded string */ + int token; + int expected; +} perrdetail; + +#if 0 +#define PyPARSE_YIELD_IS_KEYWORD 0x0001 +#endif + +#define PyPARSE_DONT_IMPLY_DEDENT 0x0002 + +#if 0 +#define PyPARSE_WITH_IS_KEYWORD 0x0003 +#define PyPARSE_PRINT_IS_FUNCTION 0x0004 +#define PyPARSE_UNICODE_LITERALS 0x0008 +#endif + +#define PyPARSE_IGNORE_COOKIE 0x0010 +#define PyPARSE_BARRY_AS_BDFL 0x0020 + +PyAPI_FUNC(node*) PyParser_ParseString(const char*, grammar*, int, perrdetail*); +PyAPI_FUNC(node*) PyParser_ParseFile( + FILE*, + const char*, + grammar*, + int, + const char*, + const char*, + perrdetail*); + +PyAPI_FUNC(node*) + PyParser_ParseStringFlags(const char*, grammar*, int, perrdetail*, int); +PyAPI_FUNC(node*) PyParser_ParseFileFlags( + FILE* fp, + const char* filename, /* decoded from the filesystem encoding */ + const char* enc, + grammar* g, + int start, + const char* ps1, + const char* ps2, + perrdetail* err_ret, + int flags); +PyAPI_FUNC(node*) PyParser_ParseFileFlagsEx( + FILE* fp, + const char* filename, /* decoded from the filesystem encoding */ + const char* enc, + grammar* g, + int start, + const char* ps1, + const char* ps2, + perrdetail* err_ret, + int* flags); +PyAPI_FUNC(node*) PyParser_ParseFileObject( + FILE* fp, + PyObject* filename, + const char* enc, + grammar* g, + int start, + const char* ps1, + const char* ps2, + perrdetail* err_ret, + int* flags); + +PyAPI_FUNC(node*) PyParser_ParseStringFlagsFilename( + const char* s, + const char* filename, /* decoded from the filesystem encoding */ + grammar* g, + int start, + perrdetail* err_ret, + int flags); +PyAPI_FUNC(node*) PyParser_ParseStringFlagsFilenameEx( + const char* s, + const char* filename, /* decoded from the filesystem encoding */ + grammar* g, + int start, + perrdetail* err_ret, + int* flags); +PyAPI_FUNC(node*) PyParser_ParseStringObject( + const char* s, + PyObject* filename, + grammar* g, + int start, + perrdetail* err_ret, + int* flags); + +/* Note that the following functions are defined in pythonrun.c, + not in parsetok.c */ +PyAPI_FUNC(void) PyParser_SetError(perrdetail*); +PyAPI_FUNC(void) PyParser_ClearError(perrdetail*); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_PARSETOK_H */ +#endif /* !Py_LIMITED_API */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/patchlevel.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/patchlevel.h new file mode 100644 index 0000000..73ddd97 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/patchlevel.h @@ -0,0 +1,34 @@ + +/* Python version identification scheme. + + When the major or minor version changes, the VERSION variable in + configure.ac must also be changed. + + There is also (independent) API version information in modsupport.h. +*/ + +/* Values for PY_RELEASE_LEVEL */ +#define PY_RELEASE_LEVEL_ALPHA 0xA +#define PY_RELEASE_LEVEL_BETA 0xB +#define PY_RELEASE_LEVEL_GAMMA 0xC /* For release candidates */ +#define PY_RELEASE_LEVEL_FINAL 0xF /* Serial should be 0 here */ +/* Higher for patch releases */ + +/* Version parsed out into numeric values */ +/*--start constants--*/ +#define PY_MAJOR_VERSION 3 +#define PY_MINOR_VERSION 6 +#define PY_MICRO_VERSION 5 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL +#define PY_RELEASE_SERIAL 0 + +/* Version as a string */ +#define PY_VERSION "3.6.5" +/*--end constants--*/ + +/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. + Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */ +#define PY_VERSION_HEX \ + ((PY_MAJOR_VERSION << 24) | (PY_MINOR_VERSION << 16) | \ + (PY_MICRO_VERSION << 8) | (PY_RELEASE_LEVEL << 4) | \ + (PY_RELEASE_SERIAL << 0)) diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pgen.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pgen.h new file mode 100644 index 0000000..3192525 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pgen.h @@ -0,0 +1,17 @@ +#ifndef Py_PGEN_H +#define Py_PGEN_H +#ifdef __cplusplus +extern "C" { +#endif + +/* Parser generator interface */ + +extern grammar* meta_grammar(void); + +struct _node; +extern grammar* pgen(struct _node*); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_PGEN_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pgenheaders.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pgenheaders.h new file mode 100644 index 0000000..297c6f2 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pgenheaders.h @@ -0,0 +1,42 @@ +#ifndef Py_PGENHEADERS_H +#define Py_PGENHEADERS_H +#ifdef __cplusplus +extern "C" { +#endif + +/* Include files and extern declarations used by most of the parser. */ + +#include "Python.h" + +PyAPI_FUNC(void) PySys_WriteStdout(const char* format, ...) + Py_GCC_ATTRIBUTE((format(printf, 1, 2))); +PyAPI_FUNC(void) PySys_WriteStderr(const char* format, ...) + Py_GCC_ATTRIBUTE((format(printf, 1, 2))); + +#define addarc _Py_addarc +#define addbit _Py_addbit +#define adddfa _Py_adddfa +#define addfirstsets _Py_addfirstsets +#define addlabel _Py_addlabel +#define addstate _Py_addstate +#define delbitset _Py_delbitset +#define dumptree _Py_dumptree +#define findlabel _Py_findlabel +#define freegrammar _Py_freegrammar +#define mergebitset _Py_mergebitset +#define meta_grammar _Py_meta_grammar +#define newbitset _Py_newbitset +#define newgrammar _Py_newgrammar +#define pgen _Py_pgen +#define printgrammar _Py_printgrammar +#define printnonterminals _Py_printnonterminals +#define printtree _Py_printtree +#define samebitset _Py_samebitset +#define showtree _Py_showtree +#define tok_dump _Py_tok_dump +#define translatelabels _Py_translatelabels + +#ifdef __cplusplus +} +#endif +#endif /* !Py_PGENHEADERS_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/py_curses.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/py_curses.h new file mode 100644 index 0000000..c93f542 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/py_curses.h @@ -0,0 +1,183 @@ + +#ifndef Py_CURSES_H +#define Py_CURSES_H + +#ifdef __APPLE__ +/* +** On Mac OS X 10.2 [n]curses.h and stdlib.h use different guards +** against multiple definition of wchar_t. +*/ +#ifdef _BSD_WCHAR_T_DEFINED_ +#define _WCHAR_T +#endif +#endif /* __APPLE__ */ + +#ifdef __FreeBSD__ +/* +** On FreeBSD, [n]curses.h and stdlib.h/wchar.h use different guards +** against multiple definition of wchar_t and wint_t. +*/ +#ifdef _XOPEN_SOURCE_EXTENDED +#ifndef __FreeBSD_version +#include +#endif +#if __FreeBSD_version >= 500000 +#ifndef __wchar_t +#define __wchar_t +#endif +#ifndef __wint_t +#define __wint_t +#endif +#else +#ifndef _WCHAR_T +#define _WCHAR_T +#endif +#ifndef _WINT_T +#define _WINT_T +#endif +#endif +#endif +#endif + +#if !defined(HAVE_CURSES_IS_PAD) && defined(WINDOW_HAS_FLAGS) +/* The following definition is necessary for ncurses 5.7; without it, + some of [n]curses.h set NCURSES_OPAQUE to 1, and then Python + can't get at the WINDOW flags field. */ +#define NCURSES_OPAQUE 0 +#endif + +#ifdef HAVE_NCURSES_H +#include +#else +#include +#endif + +#ifdef HAVE_NCURSES_H +/* configure was checking , but we will + use , which has some or all these features. */ +#if !defined(WINDOW_HAS_FLAGS) && !(NCURSES_OPAQUE + 0) +#define WINDOW_HAS_FLAGS 1 +#endif +#if !defined(HAVE_CURSES_IS_PAD) && NCURSES_VERSION_PATCH + 0 >= 20090906 +#define HAVE_CURSES_IS_PAD 1 +#endif +#ifndef MVWDELCH_IS_EXPRESSION +#define MVWDELCH_IS_EXPRESSION 1 +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define PyCurses_API_pointers 4 + +/* Type declarations */ + +typedef struct { + PyObject_HEAD WINDOW* win; + char* encoding; +} PyCursesWindowObject; + +#define PyCursesWindow_Check(v) (Py_TYPE(v) == &PyCursesWindow_Type) + +#define PyCurses_CAPSULE_NAME "_curses._C_API" + +#ifdef CURSES_MODULE +/* This section is used when compiling _cursesmodule.c */ + +#else +/* This section is used in modules that use the _cursesmodule API */ + +static void** PyCurses_API; + +#define PyCursesWindow_Type (*(PyTypeObject*)PyCurses_API[0]) +#define PyCursesSetupTermCalled \ + { \ + if (!((int (*)(void))PyCurses_API[1])()) \ + return NULL; \ + } +#define PyCursesInitialised \ + { \ + if (!((int (*)(void))PyCurses_API[2])()) \ + return NULL; \ + } +#define PyCursesInitialisedColor \ + { \ + if (!((int (*)(void))PyCurses_API[3])()) \ + return NULL; \ + } + +#define import_curses() \ + PyCurses_API = (void**)PyCapsule_Import(PyCurses_CAPSULE_NAME, 1); + +#endif + +/* general error messages */ +static const char catchall_ERR[] = "curses function returned ERR"; +static const char catchall_NULL[] = "curses function returned NULL"; + +/* Function Prototype Macros - They are ugly but very, very useful. ;-) + + X - function name + TYPE - parameter Type + ERGSTR - format string for construction of the return value + PARSESTR - format string for argument parsing + */ + +#define NoArgNoReturnFunction(X) \ + static PyObject* PyCurses_##X(PyObject* self) { \ + PyCursesInitialised return PyCursesCheckERR(X(), #X); \ + } + +#define NoArgOrFlagNoReturnFunction(X) \ + static PyObject* PyCurses_##X(PyObject* self, PyObject* args) { \ + int flag = 0; \ + PyCursesInitialised switch (PyTuple_Size(args)) { \ + case 0: \ + return PyCursesCheckERR(X(), #X); \ + case 1: \ + if (!PyArg_ParseTuple(args, "i;True(1) or False(0)", &flag)) \ + return NULL; \ + if (flag) \ + return PyCursesCheckERR(X(), #X); \ + else \ + return PyCursesCheckERR(no##X(), #X); \ + default: \ + PyErr_SetString(PyExc_TypeError, #X " requires 0 or 1 arguments"); \ + return NULL; \ + } \ + } + +#define NoArgReturnIntFunction(X) \ + static PyObject* PyCurses_##X(PyObject* self) { \ + PyCursesInitialised return PyLong_FromLong((long)X()); \ + } + +#define NoArgReturnStringFunction(X) \ + static PyObject* PyCurses_##X(PyObject* self) { \ + PyCursesInitialised return PyBytes_FromString(X()); \ + } + +#define NoArgTrueFalseFunction(X) \ + static PyObject* PyCurses_##X(PyObject* self) { \ + PyCursesInitialised if (X() == FALSE) { \ + Py_INCREF(Py_False); \ + return Py_False; \ + } \ + Py_INCREF(Py_True); \ + return Py_True; \ + } + +#define NoArgNoReturnVoidFunction(X) \ + static PyObject* PyCurses_##X(PyObject* self) { \ + PyCursesInitialised X(); \ + Py_INCREF(Py_None); \ + return Py_None; \ + } + +#ifdef __cplusplus +} +#endif + +#endif /* !defined(Py_CURSES_H) */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyarena.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyarena.h new file mode 100644 index 0000000..8d040f4 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyarena.h @@ -0,0 +1,64 @@ +/* An arena-like memory interface for the compiler. + */ + +#ifndef Py_LIMITED_API +#ifndef Py_PYARENA_H +#define Py_PYARENA_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _arena PyArena; + +/* PyArena_New() and PyArena_Free() create a new arena and free it, + respectively. Once an arena has been created, it can be used + to allocate memory via PyArena_Malloc(). Pointers to PyObject can + also be registered with the arena via PyArena_AddPyObject(), and the + arena will ensure that the PyObjects stay alive at least until + PyArena_Free() is called. When an arena is freed, all the memory it + allocated is freed, the arena releases internal references to registered + PyObject*, and none of its pointers are valid. + XXX (tim) What does "none of its pointers are valid" mean? Does it + XXX mean that pointers previously obtained via PyArena_Malloc() are + XXX no longer valid? (That's clearly true, but not sure that's what + XXX the text is trying to say.) + + PyArena_New() returns an arena pointer. On error, it + returns a negative number and sets an exception. + XXX (tim): Not true. On error, PyArena_New() actually returns NULL, + XXX and looks like it may or may not set an exception (e.g., if the + XXX internal PyList_New(0) returns NULL, PyArena_New() passes that on + XXX and an exception is set; OTOH, if the internal + XXX block_new(DEFAULT_BLOCK_SIZE) returns NULL, that's passed on but + XXX an exception is not set in that case). +*/ +PyAPI_FUNC(PyArena*) PyArena_New(void); +PyAPI_FUNC(void) PyArena_Free(PyArena*); + +/* Mostly like malloc(), return the address of a block of memory spanning + * `size` bytes, or return NULL (without setting an exception) if enough + * new memory can't be obtained. Unlike malloc(0), PyArena_Malloc() with + * size=0 does not guarantee to return a unique pointer (the pointer + * returned may equal one or more other pointers obtained from + * PyArena_Malloc()). + * Note that pointers obtained via PyArena_Malloc() must never be passed to + * the system free() or realloc(), or to any of Python's similar memory- + * management functions. PyArena_Malloc()-obtained pointers remain valid + * until PyArena_Free(ar) is called, at which point all pointers obtained + * from the arena `ar` become invalid simultaneously. + */ +PyAPI_FUNC(void*) PyArena_Malloc(PyArena*, size_t size); + +/* This routine isn't a proper arena allocation routine. It takes + * a PyObject* and records it so that it can be DECREFed when the + * arena is freed. + */ +PyAPI_FUNC(int) PyArena_AddPyObject(PyArena*, PyObject*); + +#ifdef __cplusplus +} +#endif + +#endif /* !Py_PYARENA_H */ +#endif /* Py_LIMITED_API */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyatomic.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyatomic.h new file mode 100644 index 0000000..03677a9 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyatomic.h @@ -0,0 +1,235 @@ +#ifndef Py_ATOMIC_H +#define Py_ATOMIC_H +#ifdef Py_BUILD_CORE + +#include "dynamic_annotations.h" + +#include "pyconfig.h" + +#if defined(HAVE_STD_ATOMIC) +#include +#endif + +/* This is modeled after the atomics interface from C1x, according to + * the draft at + * http://www.open-std.org/JTC1/SC22/wg14/www/docs/n1425.pdf. + * Operations and types are named the same except with a _Py_ prefix + * and have the same semantics. + * + * Beware, the implementations here are deep magic. + */ + +#if defined(HAVE_STD_ATOMIC) + +typedef enum _Py_memory_order { + _Py_memory_order_relaxed = memory_order_relaxed, + _Py_memory_order_acquire = memory_order_acquire, + _Py_memory_order_release = memory_order_release, + _Py_memory_order_acq_rel = memory_order_acq_rel, + _Py_memory_order_seq_cst = memory_order_seq_cst +} _Py_memory_order; + +typedef struct _Py_atomic_address { + atomic_uintptr_t _value; +} _Py_atomic_address; + +typedef struct _Py_atomic_int { atomic_int _value; } _Py_atomic_int; + +#define _Py_atomic_signal_fence(/*memory_order*/ ORDER) \ + atomic_signal_fence(ORDER) + +#define _Py_atomic_thread_fence(/*memory_order*/ ORDER) \ + atomic_thread_fence(ORDER) + +#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ + atomic_store_explicit(&(ATOMIC_VAL)->_value, NEW_VAL, ORDER) + +#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ + atomic_load_explicit(&(ATOMIC_VAL)->_value, ORDER) + +/* Use builtin atomic operations in GCC >= 4.7 */ +#elif defined(HAVE_BUILTIN_ATOMIC) + +typedef enum _Py_memory_order { + _Py_memory_order_relaxed = __ATOMIC_RELAXED, + _Py_memory_order_acquire = __ATOMIC_ACQUIRE, + _Py_memory_order_release = __ATOMIC_RELEASE, + _Py_memory_order_acq_rel = __ATOMIC_ACQ_REL, + _Py_memory_order_seq_cst = __ATOMIC_SEQ_CST +} _Py_memory_order; + +typedef struct _Py_atomic_address { uintptr_t _value; } _Py_atomic_address; + +typedef struct _Py_atomic_int { int _value; } _Py_atomic_int; + +#define _Py_atomic_signal_fence(/*memory_order*/ ORDER) \ + __atomic_signal_fence(ORDER) + +#define _Py_atomic_thread_fence(/*memory_order*/ ORDER) \ + __atomic_thread_fence(ORDER) + +#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ + (assert( \ + (ORDER) == __ATOMIC_RELAXED || (ORDER) == __ATOMIC_SEQ_CST || \ + (ORDER) == __ATOMIC_RELEASE), \ + __atomic_store_n(&(ATOMIC_VAL)->_value, NEW_VAL, ORDER)) + +#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ + (assert( \ + (ORDER) == __ATOMIC_RELAXED || (ORDER) == __ATOMIC_SEQ_CST || \ + (ORDER) == __ATOMIC_ACQUIRE || (ORDER) == __ATOMIC_CONSUME), \ + __atomic_load_n(&(ATOMIC_VAL)->_value, ORDER)) + +#else + +typedef enum _Py_memory_order { + _Py_memory_order_relaxed, + _Py_memory_order_acquire, + _Py_memory_order_release, + _Py_memory_order_acq_rel, + _Py_memory_order_seq_cst +} _Py_memory_order; + +typedef struct _Py_atomic_address { uintptr_t _value; } _Py_atomic_address; + +typedef struct _Py_atomic_int { int _value; } _Py_atomic_int; + +/* Only support GCC (for expression statements) and x86 (for simple + * atomic semantics) for now */ +#if defined(__GNUC__) && (defined(__i386__) || defined(__amd64)) + +static __inline__ void _Py_atomic_signal_fence(_Py_memory_order order) { + if (order != _Py_memory_order_relaxed) + __asm__ volatile("" ::: "memory"); +} + +static __inline__ void _Py_atomic_thread_fence(_Py_memory_order order) { + if (order != _Py_memory_order_relaxed) + __asm__ volatile("mfence" ::: "memory"); +} + +/* Tell the race checker about this operation's effects. */ +static __inline__ void _Py_ANNOTATE_MEMORY_ORDER( + const volatile void* address, + _Py_memory_order order) { + (void)address; /* shut up -Wunused-parameter */ + switch (order) { + case _Py_memory_order_release: + case _Py_memory_order_acq_rel: + case _Py_memory_order_seq_cst: + _Py_ANNOTATE_HAPPENS_BEFORE(address); + break; + case _Py_memory_order_relaxed: + case _Py_memory_order_acquire: + break; + } + switch (order) { + case _Py_memory_order_acquire: + case _Py_memory_order_acq_rel: + case _Py_memory_order_seq_cst: + _Py_ANNOTATE_HAPPENS_AFTER(address); + break; + case _Py_memory_order_relaxed: + case _Py_memory_order_release: + break; + } +} + +#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ + __extension__({ \ + __typeof__(ATOMIC_VAL) atomic_val = ATOMIC_VAL; \ + __typeof__(atomic_val->_value) new_val = NEW_VAL; \ + volatile __typeof__(new_val)* volatile_data = &atomic_val->_value; \ + _Py_memory_order order = ORDER; \ + _Py_ANNOTATE_MEMORY_ORDER(atomic_val, order); \ + \ + /* Perform the operation. */ \ + _Py_ANNOTATE_IGNORE_WRITES_BEGIN(); \ + switch (order) { \ + case _Py_memory_order_release: \ + _Py_atomic_signal_fence(_Py_memory_order_release); \ + /* fallthrough */ \ + case _Py_memory_order_relaxed: \ + *volatile_data = new_val; \ + break; \ + \ + case _Py_memory_order_acquire: \ + case _Py_memory_order_acq_rel: \ + case _Py_memory_order_seq_cst: \ + __asm__ volatile( \ + "xchg %0, %1" \ + : "+r"(new_val) \ + : "m"(atomic_val->_value) \ + : "memory"); \ + break; \ + } \ + _Py_ANNOTATE_IGNORE_WRITES_END(); \ + }) + +#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ + __extension__({ \ + __typeof__(ATOMIC_VAL) atomic_val = ATOMIC_VAL; \ + __typeof__(atomic_val->_value) result; \ + volatile __typeof__(result)* volatile_data = &atomic_val->_value; \ + _Py_memory_order order = ORDER; \ + _Py_ANNOTATE_MEMORY_ORDER(atomic_val, order); \ + \ + /* Perform the operation. */ \ + _Py_ANNOTATE_IGNORE_READS_BEGIN(); \ + switch (order) { \ + case _Py_memory_order_release: \ + case _Py_memory_order_acq_rel: \ + case _Py_memory_order_seq_cst: \ + /* Loads on x86 are not releases by default, so need a */ \ + /* thread fence. */ \ + _Py_atomic_thread_fence(_Py_memory_order_release); \ + break; \ + default: \ + /* No fence */ \ + break; \ + } \ + result = *volatile_data; \ + switch (order) { \ + case _Py_memory_order_acquire: \ + case _Py_memory_order_acq_rel: \ + case _Py_memory_order_seq_cst: \ + /* Loads on x86 are automatically acquire operations so */ \ + /* can get by with just a compiler fence. */ \ + _Py_atomic_signal_fence(_Py_memory_order_acquire); \ + break; \ + default: \ + /* No fence */ \ + break; \ + } \ + _Py_ANNOTATE_IGNORE_READS_END(); \ + result; \ + }) + +#else /* !gcc x86 */ +/* Fall back to other compilers and processors by assuming that simple + volatile accesses are atomic. This is false, so people should port + this. */ +#define _Py_atomic_signal_fence(/*memory_order*/ ORDER) ((void)0) +#define _Py_atomic_thread_fence(/*memory_order*/ ORDER) ((void)0) +#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ + ((ATOMIC_VAL)->_value = NEW_VAL) +#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) ((ATOMIC_VAL)->_value) + +#endif /* !gcc x86 */ +#endif + +/* Standardized shortcuts. */ +#define _Py_atomic_store(ATOMIC_VAL, NEW_VAL) \ + _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, _Py_memory_order_seq_cst) +#define _Py_atomic_load(ATOMIC_VAL) \ + _Py_atomic_load_explicit(ATOMIC_VAL, _Py_memory_order_seq_cst) + +/* Python-local extensions */ + +#define _Py_atomic_store_relaxed(ATOMIC_VAL, NEW_VAL) \ + _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, _Py_memory_order_relaxed) +#define _Py_atomic_load_relaxed(ATOMIC_VAL) \ + _Py_atomic_load_explicit(ATOMIC_VAL, _Py_memory_order_relaxed) + +#endif /* Py_BUILD_CORE */ +#endif /* Py_ATOMIC_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pycapsule.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pycapsule.h new file mode 100644 index 0000000..b1f3f80 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pycapsule.h @@ -0,0 +1,58 @@ + +/* Capsule objects let you wrap a C "void *" pointer in a Python + object. They're a way of passing data through the Python interpreter + without creating your own custom type. + + Capsules are used for communication between extension modules. + They provide a way for an extension module to export a C interface + to other extension modules, so that extension modules can use the + Python import mechanism to link to one another. + + For more information, please see "c-api/capsule.html" in the + documentation. +*/ + +#ifndef Py_CAPSULE_H +#define Py_CAPSULE_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_DATA(PyTypeObject) PyCapsule_Type; + +typedef void (*PyCapsule_Destructor)(PyObject*); + +#define PyCapsule_CheckExact(op) (Py_TYPE(op) == &PyCapsule_Type) + +PyAPI_FUNC(PyObject*) PyCapsule_New( + void* pointer, + const char* name, + PyCapsule_Destructor destructor); + +PyAPI_FUNC(void*) PyCapsule_GetPointer(PyObject* capsule, const char* name); + +PyAPI_FUNC(PyCapsule_Destructor) PyCapsule_GetDestructor(PyObject* capsule); + +PyAPI_FUNC(const char*) PyCapsule_GetName(PyObject* capsule); + +PyAPI_FUNC(void*) PyCapsule_GetContext(PyObject* capsule); + +PyAPI_FUNC(int) PyCapsule_IsValid(PyObject* capsule, const char* name); + +PyAPI_FUNC(int) PyCapsule_SetPointer(PyObject* capsule, void* pointer); + +PyAPI_FUNC(int) + PyCapsule_SetDestructor(PyObject* capsule, PyCapsule_Destructor destructor); + +PyAPI_FUNC(int) PyCapsule_SetName(PyObject* capsule, const char* name); + +PyAPI_FUNC(int) PyCapsule_SetContext(PyObject* capsule, void* context); + +PyAPI_FUNC(void*) PyCapsule_Import( + const char* name, /* UTF-8 encoded string */ + int no_block); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_CAPSULE_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyconfig.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyconfig.h new file mode 100644 index 0000000..7b15e48 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyconfig.h @@ -0,0 +1,1547 @@ +/* pyconfig.h. Generated from pyconfig.h.in by configure. */ +/* pyconfig.h.in. Generated from configure.ac by autoheader. */ + +#ifndef Py_PYCONFIG_H +#define Py_PYCONFIG_H + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* Define for AIX if your compiler is a genuine IBM xlC/xlC_r and you want + support for AIX C++ shared extension modules. */ +/* #undef AIX_GENUINE_CPLUSPLUS */ + +/* The Android API level. */ +/* #undef ANDROID_API_LEVEL */ + +/* Define if C doubles are 64-bit IEEE 754 binary format, stored in ARM + mixed-endian order (byte order 45670123) */ +/* #undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 */ + +/* Define if C doubles are 64-bit IEEE 754 binary format, stored with the most + significant byte first */ +/* #undef DOUBLE_IS_BIG_ENDIAN_IEEE754 */ + +/* Define if C doubles are 64-bit IEEE 754 binary format, stored with the + least significant byte first */ +#define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 1 + +/* Define if --enable-ipv6 is specified */ +#define ENABLE_IPV6 1 + +/* Define if flock needs to be linked with bsd library. */ +/* #undef FLOCK_NEEDS_LIBBSD */ + +/* Define if getpgrp() must be called as getpgrp(0). */ +/* #undef GETPGRP_HAVE_ARG */ + +/* Define if gettimeofday() does not have second (timezone) argument This is + the case on Motorola V4 (R40V4.2) */ +/* #undef GETTIMEOFDAY_NO_TZ */ + +/* Define to 1 if you have the `accept4' function. */ +#define HAVE_ACCEPT4 1 + +/* Define to 1 if you have the `acosh' function. */ +#define HAVE_ACOSH 1 + +/* struct addrinfo (netdb.h) */ +#define HAVE_ADDRINFO 1 + +/* Define to 1 if you have the `alarm' function. */ +#define HAVE_ALARM 1 + +/* Define if aligned memory access is required */ +/* #undef HAVE_ALIGNED_REQUIRED */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ALLOCA_H 1 + +/* Define this if your time.h defines altzone. */ +/* #undef HAVE_ALTZONE */ + +/* Define to 1 if you have the `asinh' function. */ +#define HAVE_ASINH 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ASM_TYPES_H 1 + +/* Define to 1 if you have the `atanh' function. */ +#define HAVE_ATANH 1 + +/* Define to 1 if you have the `bind_textdomain_codeset' function. */ +#define HAVE_BIND_TEXTDOMAIN_CODESET 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BLUETOOTH_BLUETOOTH_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BLUETOOTH_H */ + +/* Define if mbstowcs(NULL, "text", 0) does not return the number of wide + chars that would be converted. */ +/* #undef HAVE_BROKEN_MBSTOWCS */ + +/* Define if nice() returns success/failure instead of the new priority. */ +/* #undef HAVE_BROKEN_NICE */ + +/* Define if the system reports an invalid PIPE_BUF value. */ +/* #undef HAVE_BROKEN_PIPE_BUF */ + +/* Define if poll() sets errno on invalid file descriptors. */ +/* #undef HAVE_BROKEN_POLL */ + +/* Define if the Posix semaphores do not work on your system */ +/* #undef HAVE_BROKEN_POSIX_SEMAPHORES */ + +/* Define if pthread_sigmask() does not work on your system. */ +/* #undef HAVE_BROKEN_PTHREAD_SIGMASK */ + +/* define to 1 if your sem_getvalue is broken. */ +/* #undef HAVE_BROKEN_SEM_GETVALUE */ + +/* Define if `unsetenv` does not return an int. */ +/* #undef HAVE_BROKEN_UNSETENV */ + +/* Has builtin atomics */ +#define HAVE_BUILTIN_ATOMIC 1 + +/* Define to 1 if you have the 'chflags' function. */ +/* #undef HAVE_CHFLAGS */ + +/* Define to 1 if you have the `chown' function. */ +#define HAVE_CHOWN 1 + +/* Define if you have the 'chroot' function. */ +#define HAVE_CHROOT 1 + +/* Define to 1 if you have the `clock' function. */ +#define HAVE_CLOCK 1 + +/* Define to 1 if you have the `clock_getres' function. */ +#define HAVE_CLOCK_GETRES 1 + +/* Define to 1 if you have the `clock_gettime' function. */ +#define HAVE_CLOCK_GETTIME 1 + +/* Define to 1 if you have the `clock_settime' function. */ +#define HAVE_CLOCK_SETTIME 1 + +/* Define if the C compiler supports computed gotos. */ +#define HAVE_COMPUTED_GOTOS 1 + +/* Define to 1 if you have the `confstr' function. */ +#define HAVE_CONFSTR 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CONIO_H */ + +/* Define to 1 if you have the `copysign' function. */ +#define HAVE_COPYSIGN 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_CRYPT_H 1 + +/* Define to 1 if you have the `ctermid' function. */ +#define HAVE_CTERMID 1 + +/* Define if you have the 'ctermid_r' function. */ +/* #undef HAVE_CTERMID_R */ + +/* Define if you have the 'filter' function. */ +#define HAVE_CURSES_FILTER 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_CURSES_H 1 + +/* Define if you have the 'has_key' function. */ +#define HAVE_CURSES_HAS_KEY 1 + +/* Define if you have the 'immedok' function. */ +#define HAVE_CURSES_IMMEDOK 1 + +/* Define if you have the 'is_pad' function or macro. */ +#define HAVE_CURSES_IS_PAD 1 + +/* Define if you have the 'is_term_resized' function. */ +#define HAVE_CURSES_IS_TERM_RESIZED 1 + +/* Define if you have the 'resizeterm' function. */ +#define HAVE_CURSES_RESIZETERM 1 + +/* Define if you have the 'resize_term' function. */ +#define HAVE_CURSES_RESIZE_TERM 1 + +/* Define if you have the 'syncok' function. */ +#define HAVE_CURSES_SYNCOK 1 + +/* Define if you have the 'typeahead' function. */ +#define HAVE_CURSES_TYPEAHEAD 1 + +/* Define if you have the 'use_env' function. */ +#define HAVE_CURSES_USE_ENV 1 + +/* Define if you have the 'wchgat' function. */ +#define HAVE_CURSES_WCHGAT 1 + +/* Define to 1 if you have the declaration of `isfinite', and to 0 if you + don't. */ +#define HAVE_DECL_ISFINITE 1 + +/* Define to 1 if you have the declaration of `isinf', and to 0 if you don't. + */ +#define HAVE_DECL_ISINF 1 + +/* Define to 1 if you have the declaration of `isnan', and to 0 if you don't. + */ +#define HAVE_DECL_ISNAN 1 + +/* Define to 1 if you have the declaration of `RTLD_DEEPBIND', and to 0 if you + don't. */ +#define HAVE_DECL_RTLD_DEEPBIND 1 + +/* Define to 1 if you have the declaration of `RTLD_GLOBAL', and to 0 if you + don't. */ +#define HAVE_DECL_RTLD_GLOBAL 1 + +/* Define to 1 if you have the declaration of `RTLD_LAZY', and to 0 if you + don't. */ +#define HAVE_DECL_RTLD_LAZY 1 + +/* Define to 1 if you have the declaration of `RTLD_LOCAL', and to 0 if you + don't. */ +#define HAVE_DECL_RTLD_LOCAL 1 + +/* Define to 1 if you have the declaration of `RTLD_NODELETE', and to 0 if you + don't. */ +#define HAVE_DECL_RTLD_NODELETE 1 + +/* Define to 1 if you have the declaration of `RTLD_NOLOAD', and to 0 if you + don't. */ +#define HAVE_DECL_RTLD_NOLOAD 1 + +/* Define to 1 if you have the declaration of `RTLD_NOW', and to 0 if you + don't. */ +#define HAVE_DECL_RTLD_NOW 1 + +/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. + */ +/* #undef HAVE_DECL_TZNAME */ + +/* Define to 1 if you have the device macros. */ +#define HAVE_DEVICE_MACROS 1 + +/* Define to 1 if you have the /dev/ptc device file. */ +/* #undef HAVE_DEV_PTC */ + +/* Define to 1 if you have the /dev/ptmx device file. */ +#define HAVE_DEV_PTMX 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DIRECT_H */ + +/* Define to 1 if the dirent structure has a d_type field */ +#define HAVE_DIRENT_D_TYPE 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#define HAVE_DIRENT_H 1 + +/* Define if you have the 'dirfd' function or macro. */ +#define HAVE_DIRFD 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the `dlopen' function. */ +#define HAVE_DLOPEN 1 + +/* Define to 1 if you have the `dup2' function. */ +#define HAVE_DUP2 1 + +/* Define to 1 if you have the `dup3' function. */ +#define HAVE_DUP3 1 + +/* Defined when any dynamic module loading is enabled. */ +#define HAVE_DYNAMIC_LOADING 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ENDIAN_H 1 + +/* Define if you have the 'epoll' functions. */ +#define HAVE_EPOLL 1 + +/* Define if you have the 'epoll_create1' function. */ +#define HAVE_EPOLL_CREATE1 1 + +/* Define to 1 if you have the `erf' function. */ +#define HAVE_ERF 1 + +/* Define to 1 if you have the `erfc' function. */ +#define HAVE_ERFC 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the `execv' function. */ +#define HAVE_EXECV 1 + +/* Define to 1 if you have the `expm1' function. */ +#define HAVE_EXPM1 1 + +/* Define to 1 if you have the `faccessat' function. */ +#define HAVE_FACCESSAT 1 + +/* Define if you have the 'fchdir' function. */ +#define HAVE_FCHDIR 1 + +/* Define to 1 if you have the `fchmod' function. */ +#define HAVE_FCHMOD 1 + +/* Define to 1 if you have the `fchmodat' function. */ +#define HAVE_FCHMODAT 1 + +/* Define to 1 if you have the `fchown' function. */ +#define HAVE_FCHOWN 1 + +/* Define to 1 if you have the `fchownat' function. */ +#define HAVE_FCHOWNAT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define if you have the 'fdatasync' function. */ +#define HAVE_FDATASYNC 1 + +/* Define to 1 if you have the `fdopendir' function. */ +#define HAVE_FDOPENDIR 1 + +/* Define to 1 if you have the `fexecve' function. */ +#define HAVE_FEXECVE 1 + +/* Define to 1 if you have the `finite' function. */ +#define HAVE_FINITE 1 + +/* Define to 1 if you have the `flock' function. */ +#define HAVE_FLOCK 1 + +/* Define to 1 if you have the `fork' function. */ +#define HAVE_FORK 1 + +/* Define to 1 if you have the `forkpty' function. */ +#define HAVE_FORKPTY 1 + +/* Define to 1 if you have the `fpathconf' function. */ +#define HAVE_FPATHCONF 1 + +/* Define to 1 if you have the `fseek64' function. */ +/* #undef HAVE_FSEEK64 */ + +/* Define to 1 if you have the `fseeko' function. */ +#define HAVE_FSEEKO 1 + +/* Define to 1 if you have the `fstatat' function. */ +#define HAVE_FSTATAT 1 + +/* Define to 1 if you have the `fstatvfs' function. */ +#define HAVE_FSTATVFS 1 + +/* Define if you have the 'fsync' function. */ +#define HAVE_FSYNC 1 + +/* Define to 1 if you have the `ftell64' function. */ +/* #undef HAVE_FTELL64 */ + +/* Define to 1 if you have the `ftello' function. */ +#define HAVE_FTELLO 1 + +/* Define to 1 if you have the `ftime' function. */ +#define HAVE_FTIME 1 + +/* Define to 1 if you have the `ftruncate' function. */ +#define HAVE_FTRUNCATE 1 + +/* Define to 1 if you have the `futimens' function. */ +#define HAVE_FUTIMENS 1 + +/* Define to 1 if you have the `futimes' function. */ +#define HAVE_FUTIMES 1 + +/* Define to 1 if you have the `futimesat' function. */ +#define HAVE_FUTIMESAT 1 + +/* Define to 1 if you have the `gai_strerror' function. */ +#define HAVE_GAI_STRERROR 1 + +/* Define to 1 if you have the `gamma' function. */ +#define HAVE_GAMMA 1 + +/* Define if we can use gcc inline assembler to get and set mc68881 fpcr */ +/* #undef HAVE_GCC_ASM_FOR_MC68881 */ + +/* Define if we can use x64 gcc inline assembler */ +#define HAVE_GCC_ASM_FOR_X64 1 + +/* Define if we can use gcc inline assembler to get and set x87 control word + */ +#define HAVE_GCC_ASM_FOR_X87 1 + +/* Define if your compiler provides __uint128_t */ +#define HAVE_GCC_UINT128_T 1 + +/* Define if you have the getaddrinfo function. */ +#define HAVE_GETADDRINFO 1 + +/* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */ +#define HAVE_GETC_UNLOCKED 1 + +/* Define to 1 if you have the `getentropy' function. */ +/* #undef HAVE_GETENTROPY */ + +/* Define to 1 if you have the `getgrouplist' function. */ +#define HAVE_GETGROUPLIST 1 + +/* Define to 1 if you have the `getgroups' function. */ +#define HAVE_GETGROUPS 1 + +/* Define to 1 if you have the `gethostbyname' function. */ +/* #undef HAVE_GETHOSTBYNAME */ + +/* Define this if you have some version of gethostbyname_r() */ +#define HAVE_GETHOSTBYNAME_R 1 + +/* Define this if you have the 3-arg version of gethostbyname_r(). */ +/* #undef HAVE_GETHOSTBYNAME_R_3_ARG */ + +/* Define this if you have the 5-arg version of gethostbyname_r(). */ +/* #undef HAVE_GETHOSTBYNAME_R_5_ARG */ + +/* Define this if you have the 6-arg version of gethostbyname_r(). */ +#define HAVE_GETHOSTBYNAME_R_6_ARG 1 + +/* Define to 1 if you have the `getitimer' function. */ +#define HAVE_GETITIMER 1 + +/* Define to 1 if you have the `getloadavg' function. */ +#define HAVE_GETLOADAVG 1 + +/* Define to 1 if you have the `getlogin' function. */ +#define HAVE_GETLOGIN 1 + +/* Define to 1 if you have the `getnameinfo' function. */ +#define HAVE_GETNAMEINFO 1 + +/* Define if you have the 'getpagesize' function. */ +#define HAVE_GETPAGESIZE 1 + +/* Define to 1 if you have the `getpeername' function. */ +#define HAVE_GETPEERNAME 1 + +/* Define to 1 if you have the `getpgid' function. */ +#define HAVE_GETPGID 1 + +/* Define to 1 if you have the `getpgrp' function. */ +#define HAVE_GETPGRP 1 + +/* Define to 1 if you have the `getpid' function. */ +#define HAVE_GETPID 1 + +/* Define to 1 if you have the `getpriority' function. */ +#define HAVE_GETPRIORITY 1 + +/* Define to 1 if you have the `getpwent' function. */ +#define HAVE_GETPWENT 1 + +/* Define to 1 if the getrandom() function is available */ +/* #undef HAVE_GETRANDOM */ + +/* Define to 1 if the Linux getrandom() syscall is available */ +/* #undef HAVE_GETRANDOM_SYSCALL */ + +/* Define to 1 if you have the `getresgid' function. */ +#define HAVE_GETRESGID 1 + +/* Define to 1 if you have the `getresuid' function. */ +#define HAVE_GETRESUID 1 + +/* Define to 1 if you have the `getsid' function. */ +#define HAVE_GETSID 1 + +/* Define to 1 if you have the `getspent' function. */ +#define HAVE_GETSPENT 1 + +/* Define to 1 if you have the `getspnam' function. */ +#define HAVE_GETSPNAM 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the `getwd' function. */ +#define HAVE_GETWD 1 + +/* Define if glibc has incorrect _FORTIFY_SOURCE wrappers for memmove and + bcopy. */ +/* #undef HAVE_GLIBC_MEMMOVE_BUG */ + +/* Define to 1 if you have the header file. */ +#define HAVE_GRP_H 1 + +/* Define if you have the 'hstrerror' function. */ +#define HAVE_HSTRERROR 1 + +/* Define this if you have le64toh() */ +#define HAVE_HTOLE64 1 + +/* Define to 1 if you have the `hypot' function. */ +#define HAVE_HYPOT 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IEEEFP_H */ + +/* Define to 1 if you have the 'if_nameindex' function. */ +#define HAVE_IF_NAMEINDEX 1 + +/* Define if you have the 'inet_aton' function. */ +#define HAVE_INET_ATON 1 + +/* Define if you have the 'inet_pton' function. */ +#define HAVE_INET_PTON 1 + +/* Define to 1 if you have the `initgroups' function. */ +#define HAVE_INITGROUPS 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IO_H */ + +/* Define if gcc has the ipa-pure-const bug. */ +/* #undef HAVE_IPA_PURE_CONST_BUG */ + +/* Define to 1 if you have the `kill' function. */ +#define HAVE_KILL 1 + +/* Define to 1 if you have the `killpg' function. */ +#define HAVE_KILLPG 1 + +/* Define if you have the 'kqueue' functions. */ +/* #undef HAVE_KQUEUE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LANGINFO_H 1 + +/* Defined to enable large file support when an off_t is bigger than a long + and long long is available and at least as big as an off_t. You may need to + add some flags for configuration and compilation to enable this mode. (For + Solaris and Linux, the necessary defines are already defined.) */ +/* #undef HAVE_LARGEFILE_SUPPORT */ + +/* Define to 1 if you have the 'lchflags' function. */ +/* #undef HAVE_LCHFLAGS */ + +/* Define to 1 if you have the `lchmod' function. */ +/* #undef HAVE_LCHMOD */ + +/* Define to 1 if you have the `lchown' function. */ +#define HAVE_LCHOWN 1 + +/* Define to 1 if you have the `lgamma' function. */ +#define HAVE_LGAMMA 1 + +/* Define to 1 if you have the `dl' library (-ldl). */ +#define HAVE_LIBDL 1 + +/* Define to 1 if you have the `dld' library (-ldld). */ +/* #undef HAVE_LIBDLD */ + +/* Define to 1 if you have the `ieee' library (-lieee). */ +/* #undef HAVE_LIBIEEE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIBINTL_H 1 + +/* Define if you have the readline library (-lreadline). */ +#define HAVE_LIBREADLINE 1 + +/* Define to 1 if you have the `resolv' library (-lresolv). */ +/* #undef HAVE_LIBRESOLV */ + +/* Define to 1 if you have the `sendfile' library (-lsendfile). */ +/* #undef HAVE_LIBSENDFILE */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LIBUTIL_H */ + +/* Define if you have the 'link' function. */ +#define HAVE_LINK 1 + +/* Define to 1 if you have the `linkat' function. */ +#define HAVE_LINKAT 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_CAN_BCM_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_CAN_H 1 + +/* Define if compiling using Linux 3.6 or later. */ +/* #undef HAVE_LINUX_CAN_RAW_FD_FRAMES */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_CAN_RAW_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_NETLINK_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_RANDOM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_TIPC_H 1 + +/* Define to 1 if you have the 'lockf' function and the F_LOCK macro. */ +#define HAVE_LOCKF 1 + +/* Define to 1 if you have the `log1p' function. */ +#define HAVE_LOG1P 1 + +/* Define to 1 if you have the `log2' function. */ +#define HAVE_LOG2 1 + +/* Define this if you have the type long double. */ +#define HAVE_LONG_DOUBLE 1 + +/* Define to 1 if you have the `lstat' function. */ +#define HAVE_LSTAT 1 + +/* Define to 1 if you have the `lutimes' function. */ +#define HAVE_LUTIMES 1 + +/* Define this if you have the makedev macro. */ +#define HAVE_MAKEDEV 1 + +/* Define to 1 if you have the `mbrtowc' function. */ +#define HAVE_MBRTOWC 1 + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `memrchr' function. */ +#define HAVE_MEMRCHR 1 + +/* Define to 1 if you have the `mkdirat' function. */ +#define HAVE_MKDIRAT 1 + +/* Define to 1 if you have the `mkfifo' function. */ +#define HAVE_MKFIFO 1 + +/* Define to 1 if you have the `mkfifoat' function. */ +#define HAVE_MKFIFOAT 1 + +/* Define to 1 if you have the `mknod' function. */ +#define HAVE_MKNOD 1 + +/* Define to 1 if you have the `mknodat' function. */ +#define HAVE_MKNODAT 1 + +/* Define to 1 if you have the `mktime' function. */ +#define HAVE_MKTIME 1 + +/* Define to 1 if you have the `mmap' function. */ +#define HAVE_MMAP 1 + +/* Define to 1 if you have the `mremap' function. */ +#define HAVE_MREMAP 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NCURSES_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +/* #undef HAVE_NDIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_NETPACKET_PACKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NET_IF_H 1 + +/* Define to 1 if you have the `nice' function. */ +#define HAVE_NICE 1 + +/* Define to 1 if you have the `openat' function. */ +#define HAVE_OPENAT 1 + +/* Define to 1 if you have the `openpty' function. */ +#define HAVE_OPENPTY 1 + +/* Define to 1 if you have the `pathconf' function. */ +#define HAVE_PATHCONF 1 + +/* Define to 1 if you have the `pause' function. */ +#define HAVE_PAUSE 1 + +/* Define to 1 if you have the `pipe2' function. */ +#define HAVE_PIPE2 1 + +/* Define to 1 if you have the `plock' function. */ +/* #undef HAVE_PLOCK */ + +/* Define to 1 if you have the `poll' function. */ +#define HAVE_POLL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_POLL_H 1 + +/* Define to 1 if you have the `posix_fadvise' function. */ +#define HAVE_POSIX_FADVISE 1 + +/* Define to 1 if you have the `posix_fallocate' function. */ +#define HAVE_POSIX_FALLOCATE 1 + +/* Define to 1 if you have the `pread' function. */ +#define HAVE_PREAD 1 + +/* Define if you have the 'prlimit' functions. */ +/* #undef HAVE_PRLIMIT */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PROCESS_H */ + +/* Define if your compiler supports function prototype */ +#define HAVE_PROTOTYPES 1 + +/* Define to 1 if you have the `pthread_atfork' function. */ +#define HAVE_PTHREAD_ATFORK 1 + +/* Defined for Solaris 2.6 bug in pthread header. */ +/* #undef HAVE_PTHREAD_DESTRUCTOR */ + +/* Define to 1 if you have the header file. */ +#define HAVE_PTHREAD_H 1 + +/* Define to 1 if you have the `pthread_init' function. */ +/* #undef HAVE_PTHREAD_INIT */ + +/* Define to 1 if you have the `pthread_kill' function. */ +#define HAVE_PTHREAD_KILL 1 + +/* Define to 1 if you have the `pthread_sigmask' function. */ +#define HAVE_PTHREAD_SIGMASK 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_PTY_H 1 + +/* Define to 1 if you have the `putenv' function. */ +#define HAVE_PUTENV 1 + +/* Define to 1 if you have the `pwrite' function. */ +#define HAVE_PWRITE 1 + +/* Define to 1 if you have the `readlink' function. */ +#define HAVE_READLINK 1 + +/* Define to 1 if you have the `readlinkat' function. */ +#define HAVE_READLINKAT 1 + +/* Define to 1 if you have the `readv' function. */ +#define HAVE_READV 1 + +/* Define to 1 if you have the `realpath' function. */ +#define HAVE_REALPATH 1 + +/* Define to 1 if you have the `renameat' function. */ +#define HAVE_RENAMEAT 1 + +/* Define if readline supports append_history */ +#define HAVE_RL_APPEND_HISTORY 1 + +/* Define if you have readline 2.1 */ +#define HAVE_RL_CALLBACK 1 + +/* Define if you can turn off readline's signal handling. */ +#define HAVE_RL_CATCH_SIGNAL 1 + +/* Define if you have readline 2.2 */ +#define HAVE_RL_COMPLETION_APPEND_CHARACTER 1 + +/* Define if you have readline 4.0 */ +#define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1 + +/* Define if you have readline 4.2 */ +#define HAVE_RL_COMPLETION_MATCHES 1 + +/* Define if you have rl_completion_suppress_append */ +#define HAVE_RL_COMPLETION_SUPPRESS_APPEND 1 + +/* Define if you have readline 4.0 */ +#define HAVE_RL_PRE_INPUT_HOOK 1 + +/* Define if you have readline 4.0 */ +#define HAVE_RL_RESIZE_TERMINAL 1 + +/* Define to 1 if you have the `round' function. */ +#define HAVE_ROUND 1 + +/* Define to 1 if you have the `sched_get_priority_max' function. */ +#define HAVE_SCHED_GET_PRIORITY_MAX 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SCHED_H 1 + +/* Define to 1 if you have the `sched_rr_get_interval' function. */ +#define HAVE_SCHED_RR_GET_INTERVAL 1 + +/* Define to 1 if you have the `sched_setaffinity' function. */ +#define HAVE_SCHED_SETAFFINITY 1 + +/* Define to 1 if you have the `sched_setparam' function. */ +#define HAVE_SCHED_SETPARAM 1 + +/* Define to 1 if you have the `sched_setscheduler' function. */ +#define HAVE_SCHED_SETSCHEDULER 1 + +/* Define to 1 if you have the `select' function. */ +#define HAVE_SELECT 1 + +/* Define to 1 if you have the `sem_getvalue' function. */ +#define HAVE_SEM_GETVALUE 1 + +/* Define to 1 if you have the `sem_open' function. */ +#define HAVE_SEM_OPEN 1 + +/* Define to 1 if you have the `sem_timedwait' function. */ +#define HAVE_SEM_TIMEDWAIT 1 + +/* Define to 1 if you have the `sem_unlink' function. */ +#define HAVE_SEM_UNLINK 1 + +/* Define to 1 if you have the `sendfile' function. */ +#define HAVE_SENDFILE 1 + +/* Define to 1 if you have the `setegid' function. */ +#define HAVE_SETEGID 1 + +/* Define to 1 if you have the `seteuid' function. */ +#define HAVE_SETEUID 1 + +/* Define to 1 if you have the `setgid' function. */ +#define HAVE_SETGID 1 + +/* Define if you have the 'setgroups' function. */ +#define HAVE_SETGROUPS 1 + +/* Define to 1 if you have the `sethostname' function. */ +#define HAVE_SETHOSTNAME 1 + +/* Define to 1 if you have the `setitimer' function. */ +#define HAVE_SETITIMER 1 + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if you have the `setpgid' function. */ +#define HAVE_SETPGID 1 + +/* Define to 1 if you have the `setpgrp' function. */ +#define HAVE_SETPGRP 1 + +/* Define to 1 if you have the `setpriority' function. */ +#define HAVE_SETPRIORITY 1 + +/* Define to 1 if you have the `setregid' function. */ +#define HAVE_SETREGID 1 + +/* Define to 1 if you have the `setresgid' function. */ +#define HAVE_SETRESGID 1 + +/* Define to 1 if you have the `setresuid' function. */ +#define HAVE_SETRESUID 1 + +/* Define to 1 if you have the `setreuid' function. */ +#define HAVE_SETREUID 1 + +/* Define to 1 if you have the `setsid' function. */ +#define HAVE_SETSID 1 + +/* Define to 1 if you have the `setuid' function. */ +#define HAVE_SETUID 1 + +/* Define to 1 if you have the `setvbuf' function. */ +#define HAVE_SETVBUF 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SHADOW_H 1 + +/* Define to 1 if you have the `sigaction' function. */ +#define HAVE_SIGACTION 1 + +/* Define to 1 if you have the `sigaltstack' function. */ +#define HAVE_SIGALTSTACK 1 + +/* Define to 1 if you have the `siginterrupt' function. */ +#define HAVE_SIGINTERRUPT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SIGNAL_H 1 + +/* Define to 1 if you have the `sigpending' function. */ +#define HAVE_SIGPENDING 1 + +/* Define to 1 if you have the `sigrelse' function. */ +#define HAVE_SIGRELSE 1 + +/* Define to 1 if you have the `sigtimedwait' function. */ +#define HAVE_SIGTIMEDWAIT 1 + +/* Define to 1 if you have the `sigwait' function. */ +#define HAVE_SIGWAIT 1 + +/* Define to 1 if you have the `sigwaitinfo' function. */ +#define HAVE_SIGWAITINFO 1 + +/* Define to 1 if you have the `snprintf' function. */ +#define HAVE_SNPRINTF 1 + +/* struct sockaddr_alg (linux/if_alg.h) */ +/* #undef HAVE_SOCKADDR_ALG */ + +/* Define if sockaddr has sa_len member */ +/* #undef HAVE_SOCKADDR_SA_LEN */ + +/* struct sockaddr_storage (sys/socket.h) */ +#define HAVE_SOCKADDR_STORAGE 1 + +/* Define if you have the 'socketpair' function. */ +#define HAVE_SOCKETPAIR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SPAWN_H 1 + +/* Define if your compiler provides ssize_t */ +#define HAVE_SSIZE_T 1 + +/* Define to 1 if you have the `statvfs' function. */ +#define HAVE_STATVFS 1 + +/* Define if you have struct stat.st_mtim.tv_nsec */ +#define HAVE_STAT_TV_NSEC 1 + +/* Define if you have struct stat.st_mtimensec */ +/* #undef HAVE_STAT_TV_NSEC2 */ + +/* Define if your compiler supports variable length function prototypes (e.g. + void fprintf(FILE *, char *, ...);) *and* */ +#define HAVE_STDARG_PROTOTYPES 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Has stdatomic.h, atomic_int and _Atomic void* types work */ +#define HAVE_STD_ATOMIC 1 + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `strftime' function. */ +#define HAVE_STRFTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcpy' function. */ +/* #undef HAVE_STRLCPY */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STROPTS_H 1 + +/* Define to 1 if `pw_gecos' is a member of `struct passwd'. */ +#define HAVE_STRUCT_PASSWD_PW_GECOS 1 + +/* Define to 1 if `pw_passwd' is a member of `struct passwd'. */ +#define HAVE_STRUCT_PASSWD_PW_PASSWD 1 + +/* Define to 1 if `st_birthtime' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_BIRTHTIME */ + +/* Define to 1 if `st_blksize' is a member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 + +/* Define to 1 if `st_blocks' is a member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_BLOCKS 1 + +/* Define to 1 if `st_flags' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_FLAGS */ + +/* Define to 1 if `st_gen' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_GEN */ + +/* Define to 1 if `st_rdev' is a member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_RDEV 1 + +/* Define to 1 if `tm_zone' is a member of `struct tm'. */ +#define HAVE_STRUCT_TM_TM_ZONE 1 + +/* Define if you have the 'symlink' function. */ +#define HAVE_SYMLINK 1 + +/* Define to 1 if you have the `symlinkat' function. */ +#define HAVE_SYMLINKAT 1 + +/* Define to 1 if you have the `sync' function. */ +#define HAVE_SYNC 1 + +/* Define to 1 if you have the `sysconf' function. */ +#define HAVE_SYSCONF 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYSEXITS_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_AUDIOIO_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_BSDTTY_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_DEVPOLL_H */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_ENDIAN_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_EPOLL_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_EVENT_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_FILE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_KERN_CONTROL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_LOADAVG_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_LOCK_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MKDEV_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MODEM_H */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_POLL_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_RANDOM_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_RESOURCE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SENDFILE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STATVFS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SYSCALL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SYSMACROS_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SYS_DOMAIN_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_TERMIO_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIMES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UTSNAME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_XATTR_H 1 + +/* Define to 1 if you have the `tcgetpgrp' function. */ +#define HAVE_TCGETPGRP 1 + +/* Define to 1 if you have the `tcsetpgrp' function. */ +#define HAVE_TCSETPGRP 1 + +/* Define to 1 if you have the `tempnam' function. */ +#define HAVE_TEMPNAM 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TERMIOS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TERM_H 1 + +/* Define to 1 if you have the `tgamma' function. */ +#define HAVE_TGAMMA 1 + +/* Define to 1 if you have the `timegm' function. */ +#define HAVE_TIMEGM 1 + +/* Define to 1 if you have the `times' function. */ +#define HAVE_TIMES 1 + +/* Define to 1 if you have the `tmpfile' function. */ +#define HAVE_TMPFILE 1 + +/* Define to 1 if you have the `tmpnam' function. */ +#define HAVE_TMPNAM 1 + +/* Define to 1 if you have the `tmpnam_r' function. */ +#define HAVE_TMPNAM_R 1 + +/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use + `HAVE_STRUCT_TM_TM_ZONE' instead. */ +#define HAVE_TM_ZONE 1 + +/* Define to 1 if you have the `truncate' function. */ +#define HAVE_TRUNCATE 1 + +/* Define to 1 if you don't have `tm_zone' but do have the external array + `tzname'. */ +/* #undef HAVE_TZNAME */ + +/* Define this if you have tcl and TCL_UTF_MAX==6 */ +/* #undef HAVE_UCS4_TCL */ + +/* Define to 1 if you have the `uname' function. */ +#define HAVE_UNAME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `unlinkat' function. */ +#define HAVE_UNLINKAT 1 + +/* Define to 1 if you have the `unsetenv' function. */ +#define HAVE_UNSETENV 1 + +/* Define if you have a useable wchar_t type defined in wchar.h; useable means + wchar_t must be an unsigned type with at least 16 bits. (see + Include/unicodeobject.h). */ +/* #undef HAVE_USABLE_WCHAR_T */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_UTIL_H */ + +/* Define to 1 if you have the `utimensat' function. */ +#define HAVE_UTIMENSAT 1 + +/* Define to 1 if you have the `utimes' function. */ +#define HAVE_UTIMES 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UTIME_H 1 + +/* Define to 1 if you have the `wait3' function. */ +#define HAVE_WAIT3 1 + +/* Define to 1 if you have the `wait4' function. */ +#define HAVE_WAIT4 1 + +/* Define to 1 if you have the `waitid' function. */ +#define HAVE_WAITID 1 + +/* Define to 1 if you have the `waitpid' function. */ +#define HAVE_WAITPID 1 + +/* Define if the compiler provides a wchar.h header file. */ +#define HAVE_WCHAR_H 1 + +/* Define to 1 if you have the `wcscoll' function. */ +#define HAVE_WCSCOLL 1 + +/* Define to 1 if you have the `wcsftime' function. */ +#define HAVE_WCSFTIME 1 + +/* Define to 1 if you have the `wcsxfrm' function. */ +#define HAVE_WCSXFRM 1 + +/* Define to 1 if you have the `wmemcmp' function. */ +#define HAVE_WMEMCMP 1 + +/* Define if tzset() actually switches the local timezone in a meaningful way. + */ +#define HAVE_WORKING_TZSET 1 + +/* Define to 1 if you have the `writev' function. */ +#define HAVE_WRITEV 1 + +/* Define if the zlib library has inflateCopy */ +#define HAVE_ZLIB_COPY 1 + +/* Define to 1 if you have the `_getpty' function. */ +/* #undef HAVE__GETPTY */ + +/* Define if log1p(-0.) is 0. rather than -0. */ +/* #undef LOG1P_DROPS_ZERO_SIGN */ + +/* Define to 1 if `major', `minor', and `makedev' are declared in . + */ +/* #undef MAJOR_IN_MKDEV */ + +/* Define to 1 if `major', `minor', and `makedev' are declared in + . */ +/* #undef MAJOR_IN_SYSMACROS */ + +/* Define if mvwdelch in curses.h is an expression. */ +#define MVWDELCH_IS_EXPRESSION 1 + +/* 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 home page for this package. */ +/* #undef PACKAGE_URL */ + +/* Define to the version of this package. */ +/* #undef PACKAGE_VERSION */ + +/* Define if POSIX semaphores aren't enabled on your system */ +/* #undef POSIX_SEMAPHORES_NOT_ENABLED */ + +/* Defined if PTHREAD_SCOPE_SYSTEM supported. */ +#define PTHREAD_SYSTEM_SCHED_SUPPORTED 1 + +/* Define as the preferred size in bits of long digits */ +/* #undef PYLONG_BITS_IN_DIGIT */ + +/* Define to printf format modifier for Py_ssize_t */ +#define PY_FORMAT_SIZE_T "z" + +/* Define if you want to build an interpreter with many run-time checks. */ +/* #undef Py_DEBUG */ + +/* Defined if Python is built as a shared library. */ +/* #undef Py_ENABLE_SHARED */ + +/* Define hash algorithm for str, bytes and memoryview. SipHash24: 1, FNV: 2, + externally defined: 0 */ +/* #undef Py_HASH_ALGORITHM */ + +/* assume C89 semantics that RETSIGTYPE is always void */ +#define RETSIGTYPE void + +/* Define if setpgrp() must be called as setpgrp(0, 0). */ +/* #undef SETPGRP_HAVE_ARG */ + +/* Define if i>>j for signed int i does not extend the sign bit when i < 0 */ +/* #undef SIGNED_RIGHT_SHIFT_ZERO_FILLS */ + +/* The size of `double', as computed by sizeof. */ +#define SIZEOF_DOUBLE 8 + +/* The size of `float', as computed by sizeof. */ +#define SIZEOF_FLOAT 4 + +/* The size of `fpos_t', as computed by sizeof. */ +#define SIZEOF_FPOS_T 16 + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 8 + +/* The size of `long double', as computed by sizeof. */ +#define SIZEOF_LONG_DOUBLE 16 + +/* The size of `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* The size of `off_t', as computed by sizeof. */ +#define SIZEOF_OFF_T 8 + +/* The size of `pid_t', as computed by sizeof. */ +#define SIZEOF_PID_T 4 + +/* The size of `pthread_t', as computed by sizeof. */ +#define SIZEOF_PTHREAD_T 8 + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 8 + +/* The size of `time_t', as computed by sizeof. */ +#define SIZEOF_TIME_T 8 + +/* The size of `uintptr_t', as computed by sizeof. */ +#define SIZEOF_UINTPTR_T 8 + +/* The size of `void *', as computed by sizeof. */ +#define SIZEOF_VOID_P 8 + +/* The size of `wchar_t', as computed by sizeof. */ +#define SIZEOF_WCHAR_T 4 + +/* The size of `_Bool', as computed by sizeof. */ +#define SIZEOF__BOOL 1 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if you can safely include both and + (which you can't on SCO ODT 3.0). */ +#define SYS_SELECT_WITH_SYS_TIME 1 + +/* Define if tanh(-0.) is -0., or if platform doesn't have signed zeros */ +#define TANH_PRESERVES_ZERO_SIGN 1 + +/* Library needed by timemodule.c: librt may be needed for clock_gettime() */ +#define TIMEMODULE_LIB rt + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Define to 1 if your declares `struct tm'. */ +/* #undef TM_IN_SYS_TIME */ + +/* Define if you want to use computed gotos in ceval.c. */ +#define USE_COMPUTED_GOTOS 1 + +/* Define to use the C99 inline keyword. */ +#define USE_INLINE 1 + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +#define _ALL_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +#define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +#define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +#define __EXTENSIONS__ 1 +#endif + +/* Define if you want SIGFPE handled (see Include/pyfpe.h). */ +/* #undef WANT_SIGFPE_HANDLER */ + +/* Define if WINDOW in curses.h offers a field _flags. */ +#define WINDOW_HAS_FLAGS 1 + +/* Define if you want documentation strings in extension modules */ +#define WITH_DOC_STRINGS 1 + +/* Define if you want to compile in DTrace support */ +/* #undef WITH_DTRACE */ + +/* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) dynamic + linker (dyld) instead of the old-style (NextStep) dynamic linker (rld). + Dyld is necessary to support frameworks. */ +/* #undef WITH_DYLD */ + +/* Define to 1 if libintl is needed for locale functions. */ +/* #undef WITH_LIBINTL */ + +/* Define if you want to produce an OpenStep/Rhapsody framework (shared + library plus accessory files). */ +/* #undef WITH_NEXT_FRAMEWORK */ + +/* Define if you want to compile in Python-specific mallocs */ +#define WITH_PYMALLOC 1 + +/* Define if you want to compile in rudimentary thread support */ +#define WITH_THREAD 1 + +/* Define if you want pymalloc to be disabled when running under valgrind */ +/* #undef WITH_VALGRIND */ + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +#if defined __BIG_ENDIAN__ +#define WORDS_BIGENDIAN 1 +#endif +#else +#ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +#endif +#endif + +/* Define if arithmetic is subject to x87-style double rounding issue */ +/* #undef X87_DOUBLE_ROUNDING */ + +/* Define on OpenBSD to activate all library features */ +/* #undef _BSD_SOURCE */ + +/* Define on Irix to enable u_int */ +#define _BSD_TYPES 1 + +/* Define on Darwin to activate all library features */ +#define _DARWIN_C_SOURCE 1 + +/* This must be set to 64 on some systems to enable large file support. */ +#define _FILE_OFFSET_BITS 64 + +/* Define on Linux to activate all library features */ +#define _GNU_SOURCE 1 + +/* Define to include mbstate_t for mbrtowc */ +/* #undef _INCLUDE__STDC_A1_SOURCE */ + +/* This must be defined on some systems to enable large file support. */ +#define _LARGEFILE_SOURCE 1 + +/* This must be defined on AIX systems to enable large file support. */ +/* #undef _LARGE_FILES */ + +/* Define to 1 if on MINIX. */ +/* #undef _MINIX */ + +/* Define on NetBSD to activate all library features */ +#define _NETBSD_SOURCE 1 + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define to activate features from IEEE Stds 1003.1-2008 */ +#define _POSIX_C_SOURCE 200809L + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +/* #undef _POSIX_SOURCE */ + +/* Define if you have POSIX threads, and your system does not define that. */ +/* #undef _POSIX_THREADS */ + +/* Define to force use of thread-safe errno, h_errno, and other functions */ +/* #undef _REENTRANT */ + +/* Define to the level of X/Open that your system supports */ +#define _XOPEN_SOURCE 700 + +/* Define to activate Unix95-and-earlier features */ +#define _XOPEN_SOURCE_EXTENDED 1 + +/* Define on FreeBSD to activate all library features */ +#define __BSD_VISIBLE 1 + +/* Define to 1 if type `char' is unsigned and you are not using gcc. */ +#ifndef __CHAR_UNSIGNED__ +/* # undef __CHAR_UNSIGNED__ */ +#endif + +/* Define to 'long' if doesn't define. */ +/* #undef clock_t */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `int' if doesn't define. */ +/* #undef gid_t */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `int' if does not define. */ +/* #undef mode_t */ + +/* Define to `long int' if does not define. */ +/* #undef off_t */ + +/* Define to `int' if does not define. */ +/* #undef pid_t */ + +/* Define to empty if the keyword does not work. */ +/* #undef signed */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +/* Define to `int' if does not define. */ +/* #undef socklen_t */ + +/* Define to `int' if doesn't define. */ +/* #undef uid_t */ + +/* Define to empty if the keyword does not work. */ +/* #undef volatile */ + +/* Define the macros needed if on a UnixWare 7.x system. */ +#if defined(__USLC__) && defined(__SCO_VERSION__) +#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ +#endif + +#endif /*Py_PYCONFIG_H*/ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyctype.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyctype.h new file mode 100644 index 0000000..225d12a --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyctype.h @@ -0,0 +1,33 @@ +#ifndef Py_LIMITED_API +#ifndef PYCTYPE_H +#define PYCTYPE_H + +#define PY_CTF_LOWER 0x01 +#define PY_CTF_UPPER 0x02 +#define PY_CTF_ALPHA (PY_CTF_LOWER | PY_CTF_UPPER) +#define PY_CTF_DIGIT 0x04 +#define PY_CTF_ALNUM (PY_CTF_ALPHA | PY_CTF_DIGIT) +#define PY_CTF_SPACE 0x08 +#define PY_CTF_XDIGIT 0x10 + +PyAPI_DATA(const unsigned int) _Py_ctype_table[256]; + +/* Unlike their C counterparts, the following macros are not meant to + * handle an int with any of the values [EOF, 0-UCHAR_MAX]. The argument + * must be a signed/unsigned char. */ +#define Py_ISLOWER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_LOWER) +#define Py_ISUPPER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_UPPER) +#define Py_ISALPHA(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALPHA) +#define Py_ISDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_DIGIT) +#define Py_ISXDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_XDIGIT) +#define Py_ISALNUM(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALNUM) +#define Py_ISSPACE(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_SPACE) + +PyAPI_DATA(const unsigned char) _Py_ctype_tolower[256]; +PyAPI_DATA(const unsigned char) _Py_ctype_toupper[256]; + +#define Py_TOLOWER(c) (_Py_ctype_tolower[Py_CHARMASK(c)]) +#define Py_TOUPPER(c) (_Py_ctype_toupper[Py_CHARMASK(c)]) + +#endif /* !PYCTYPE_H */ +#endif /* !Py_LIMITED_API */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pydebug.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pydebug.h new file mode 100644 index 0000000..6e23a89 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pydebug.h @@ -0,0 +1,40 @@ +#ifndef Py_LIMITED_API +#ifndef Py_PYDEBUG_H +#define Py_PYDEBUG_H +#ifdef __cplusplus +extern "C" { +#endif + +/* These global variable are defined in pylifecycle.c */ +/* XXX (ncoghlan): move these declarations to pylifecycle.h? */ +PyAPI_DATA(int) Py_DebugFlag; +PyAPI_DATA(int) Py_VerboseFlag; +PyAPI_DATA(int) Py_QuietFlag; +PyAPI_DATA(int) Py_InteractiveFlag; +PyAPI_DATA(int) Py_InspectFlag; +PyAPI_DATA(int) Py_OptimizeFlag; +PyAPI_DATA(int) Py_NoSiteFlag; +PyAPI_DATA(int) Py_BytesWarningFlag; +PyAPI_DATA(int) Py_UseClassExceptionsFlag; +PyAPI_DATA(int) Py_FrozenFlag; +PyAPI_DATA(int) Py_IgnoreEnvironmentFlag; +PyAPI_DATA(int) Py_DontWriteBytecodeFlag; +PyAPI_DATA(int) Py_NoUserSiteDirectory; +PyAPI_DATA(int) Py_UnbufferedStdioFlag; +PyAPI_DATA(int) Py_HashRandomizationFlag; +PyAPI_DATA(int) Py_IsolatedFlag; + +#ifdef MS_WINDOWS +PyAPI_DATA(int) Py_LegacyWindowsStdioFlag; +#endif + +/* this is a wrapper around getenv() that pays attention to + Py_IgnoreEnvironmentFlag. It should be used for getting variables like + PYTHONPATH and PYTHONHOME from the environment */ +#define Py_GETENV(s) (Py_IgnoreEnvironmentFlag ? NULL : getenv(s)) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_PYDEBUG_H */ +#endif /* Py_LIMITED_API */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pydtrace.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pydtrace.h new file mode 100644 index 0000000..27311ac --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pydtrace.h @@ -0,0 +1,74 @@ +/* Static DTrace probes interface */ + +#ifndef Py_DTRACE_H +#define Py_DTRACE_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef WITH_DTRACE + +#include "pydtrace_probes.h" + +/* pydtrace_probes.h, on systems with DTrace, is auto-generated to include + `PyDTrace_{PROBE}` and `PyDTrace_{PROBE}_ENABLED()` macros for every probe + defined in pydtrace_provider.d. + + Calling these functions must be guarded by a `PyDTrace_{PROBE}_ENABLED()` + check to minimize performance impact when probing is off. For example: + + if (PyDTrace_FUNCTION_ENTRY_ENABLED()) + PyDTrace_FUNCTION_ENTRY(f); +*/ + +#else + +/* Without DTrace, compile to nothing. */ + +static inline void PyDTrace_LINE(const char* arg0, const char* arg1, int arg2) { +} +static inline void +PyDTrace_FUNCTION_ENTRY(const char* arg0, const char* arg1, int arg2) {} +static inline void +PyDTrace_FUNCTION_RETURN(const char* arg0, const char* arg1, int arg2) {} +static inline void PyDTrace_GC_START(int arg0) {} +static inline void PyDTrace_GC_DONE(int arg0) {} +static inline void PyDTrace_INSTANCE_NEW_START(int arg0) {} +static inline void PyDTrace_INSTANCE_NEW_DONE(int arg0) {} +static inline void PyDTrace_INSTANCE_DELETE_START(int arg0) {} +static inline void PyDTrace_INSTANCE_DELETE_DONE(int arg0) {} + +static inline int PyDTrace_LINE_ENABLED(void) { + return 0; +} +static inline int PyDTrace_FUNCTION_ENTRY_ENABLED(void) { + return 0; +} +static inline int PyDTrace_FUNCTION_RETURN_ENABLED(void) { + return 0; +} +static inline int PyDTrace_GC_START_ENABLED(void) { + return 0; +} +static inline int PyDTrace_GC_DONE_ENABLED(void) { + return 0; +} +static inline int PyDTrace_INSTANCE_NEW_START_ENABLED(void) { + return 0; +} +static inline int PyDTrace_INSTANCE_NEW_DONE_ENABLED(void) { + return 0; +} +static inline int PyDTrace_INSTANCE_DELETE_START_ENABLED(void) { + return 0; +} +static inline int PyDTrace_INSTANCE_DELETE_DONE_ENABLED(void) { + return 0; +} + +#endif /* !WITH_DTRACE */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_DTRACE_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyerrors.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyerrors.h new file mode 100644 index 0000000..b950b9e --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyerrors.h @@ -0,0 +1,487 @@ +#ifndef Py_ERRORS_H +#define Py_ERRORS_H +#ifdef __cplusplus +extern "C" { +#endif + +/* Error objects */ + +#ifndef Py_LIMITED_API +/* PyException_HEAD defines the initial segment of every exception class. */ +#define PyException_HEAD \ + PyObject_HEAD PyObject* dict; \ + PyObject* args; \ + PyObject* traceback; \ + PyObject* context; \ + PyObject* cause; \ + char suppress_context; + +typedef struct { PyException_HEAD } PyBaseExceptionObject; + +typedef struct { + PyException_HEAD PyObject* msg; + PyObject* filename; + PyObject* lineno; + PyObject* offset; + PyObject* text; + PyObject* print_file_and_line; +} PySyntaxErrorObject; + +typedef struct { + PyException_HEAD PyObject* msg; + PyObject* name; + PyObject* path; +} PyImportErrorObject; + +typedef struct { + PyException_HEAD PyObject* encoding; + PyObject* object; + Py_ssize_t start; + Py_ssize_t end; + PyObject* reason; +} PyUnicodeErrorObject; + +typedef struct { PyException_HEAD PyObject* code; } PySystemExitObject; + +typedef struct { + PyException_HEAD PyObject* myerrno; + PyObject* strerror; + PyObject* filename; + PyObject* filename2; +#ifdef MS_WINDOWS + PyObject* winerror; +#endif + Py_ssize_t written; /* only for BlockingIOError, -1 otherwise */ +} PyOSErrorObject; + +typedef struct { PyException_HEAD PyObject* value; } PyStopIterationObject; + +/* Compatibility typedefs */ +typedef PyOSErrorObject PyEnvironmentErrorObject; +#ifdef MS_WINDOWS +typedef PyOSErrorObject PyWindowsErrorObject; +#endif +#endif /* !Py_LIMITED_API */ + +/* Error handling definitions */ + +PyAPI_FUNC(void) PyErr_SetNone(PyObject*); +PyAPI_FUNC(void) PyErr_SetObject(PyObject*, PyObject*); +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) _PyErr_SetKeyError(PyObject*); +#endif +PyAPI_FUNC(void) PyErr_SetString( + PyObject* exception, + const char* string /* decoded from utf-8 */ + ); +PyAPI_FUNC(PyObject*) PyErr_Occurred(void); +PyAPI_FUNC(void) PyErr_Clear(void); +PyAPI_FUNC(void) PyErr_Fetch(PyObject**, PyObject**, PyObject**); +PyAPI_FUNC(void) PyErr_Restore(PyObject*, PyObject*, PyObject*); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03030000 +PyAPI_FUNC(void) PyErr_GetExcInfo(PyObject**, PyObject**, PyObject**); +PyAPI_FUNC(void) PyErr_SetExcInfo(PyObject*, PyObject*, PyObject*); +#endif + +#if defined(__clang__) || (defined(__GNUC_MAJOR__) && \ + ((__GNUC_MAJOR__ >= 3) || \ + (__GNUC_MAJOR__ == 2) && (__GNUC_MINOR__ >= 5))) +#define _Py_NO_RETURN __attribute__((__noreturn__)) +#else +#define _Py_NO_RETURN +#endif + +/* Defined in Python/pylifecycle.c */ +PyAPI_FUNC(void) Py_FatalError(const char* message) _Py_NO_RETURN; + +#if defined(Py_DEBUG) || defined(Py_LIMITED_API) +#define _PyErr_OCCURRED() PyErr_Occurred() +#else +#define _PyErr_OCCURRED() (PyThreadState_GET()->curexc_type) +#endif + +/* Error testing and normalization */ +PyAPI_FUNC(int) PyErr_GivenExceptionMatches(PyObject*, PyObject*); +PyAPI_FUNC(int) PyErr_ExceptionMatches(PyObject*); +PyAPI_FUNC(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**); + +/* Traceback manipulation (PEP 3134) */ +PyAPI_FUNC(int) PyException_SetTraceback(PyObject*, PyObject*); +PyAPI_FUNC(PyObject*) PyException_GetTraceback(PyObject*); + +/* Cause manipulation (PEP 3134) */ +PyAPI_FUNC(PyObject*) PyException_GetCause(PyObject*); +PyAPI_FUNC(void) PyException_SetCause(PyObject*, PyObject*); + +/* Context manipulation (PEP 3134) */ +PyAPI_FUNC(PyObject*) PyException_GetContext(PyObject*); +PyAPI_FUNC(void) PyException_SetContext(PyObject*, PyObject*); +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject*, PyObject*, PyObject*); +#endif + +/* */ + +#define PyExceptionClass_Check(x) \ + (PyType_Check((x)) && \ + PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS)) + +#define PyExceptionInstance_Check(x) \ + PyType_FastSubclass((x)->ob_type, Py_TPFLAGS_BASE_EXC_SUBCLASS) + +#define PyExceptionClass_Name(x) ((char*)(((PyTypeObject*)(x))->tp_name)) + +#define PyExceptionInstance_Class(x) ((PyObject*)((x)->ob_type)) + +/* Predefined exceptions */ + +PyAPI_DATA(PyObject*) PyExc_BaseException; +PyAPI_DATA(PyObject*) PyExc_Exception; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03050000 +PyAPI_DATA(PyObject*) PyExc_StopAsyncIteration; +#endif +PyAPI_DATA(PyObject*) PyExc_StopIteration; +PyAPI_DATA(PyObject*) PyExc_GeneratorExit; +PyAPI_DATA(PyObject*) PyExc_ArithmeticError; +PyAPI_DATA(PyObject*) PyExc_LookupError; + +PyAPI_DATA(PyObject*) PyExc_AssertionError; +PyAPI_DATA(PyObject*) PyExc_AttributeError; +PyAPI_DATA(PyObject*) PyExc_BufferError; +PyAPI_DATA(PyObject*) PyExc_EOFError; +PyAPI_DATA(PyObject*) PyExc_FloatingPointError; +PyAPI_DATA(PyObject*) PyExc_OSError; +PyAPI_DATA(PyObject*) PyExc_ImportError; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03060000 +PyAPI_DATA(PyObject*) PyExc_ModuleNotFoundError; +#endif +PyAPI_DATA(PyObject*) PyExc_IndexError; +PyAPI_DATA(PyObject*) PyExc_KeyError; +PyAPI_DATA(PyObject*) PyExc_KeyboardInterrupt; +PyAPI_DATA(PyObject*) PyExc_MemoryError; +PyAPI_DATA(PyObject*) PyExc_NameError; +PyAPI_DATA(PyObject*) PyExc_OverflowError; +PyAPI_DATA(PyObject*) PyExc_RuntimeError; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03050000 +PyAPI_DATA(PyObject*) PyExc_RecursionError; +#endif +PyAPI_DATA(PyObject*) PyExc_NotImplementedError; +PyAPI_DATA(PyObject*) PyExc_SyntaxError; +PyAPI_DATA(PyObject*) PyExc_IndentationError; +PyAPI_DATA(PyObject*) PyExc_TabError; +PyAPI_DATA(PyObject*) PyExc_ReferenceError; +PyAPI_DATA(PyObject*) PyExc_SystemError; +PyAPI_DATA(PyObject*) PyExc_SystemExit; +PyAPI_DATA(PyObject*) PyExc_TypeError; +PyAPI_DATA(PyObject*) PyExc_UnboundLocalError; +PyAPI_DATA(PyObject*) PyExc_UnicodeError; +PyAPI_DATA(PyObject*) PyExc_UnicodeEncodeError; +PyAPI_DATA(PyObject*) PyExc_UnicodeDecodeError; +PyAPI_DATA(PyObject*) PyExc_UnicodeTranslateError; +PyAPI_DATA(PyObject*) PyExc_ValueError; +PyAPI_DATA(PyObject*) PyExc_ZeroDivisionError; + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03030000 +PyAPI_DATA(PyObject*) PyExc_BlockingIOError; +PyAPI_DATA(PyObject*) PyExc_BrokenPipeError; +PyAPI_DATA(PyObject*) PyExc_ChildProcessError; +PyAPI_DATA(PyObject*) PyExc_ConnectionError; +PyAPI_DATA(PyObject*) PyExc_ConnectionAbortedError; +PyAPI_DATA(PyObject*) PyExc_ConnectionRefusedError; +PyAPI_DATA(PyObject*) PyExc_ConnectionResetError; +PyAPI_DATA(PyObject*) PyExc_FileExistsError; +PyAPI_DATA(PyObject*) PyExc_FileNotFoundError; +PyAPI_DATA(PyObject*) PyExc_InterruptedError; +PyAPI_DATA(PyObject*) PyExc_IsADirectoryError; +PyAPI_DATA(PyObject*) PyExc_NotADirectoryError; +PyAPI_DATA(PyObject*) PyExc_PermissionError; +PyAPI_DATA(PyObject*) PyExc_ProcessLookupError; +PyAPI_DATA(PyObject*) PyExc_TimeoutError; +#endif + +/* Compatibility aliases */ +PyAPI_DATA(PyObject*) PyExc_EnvironmentError; +PyAPI_DATA(PyObject*) PyExc_IOError; +#ifdef MS_WINDOWS +PyAPI_DATA(PyObject*) PyExc_WindowsError; +#endif + +/* Predefined warning categories */ +PyAPI_DATA(PyObject*) PyExc_Warning; +PyAPI_DATA(PyObject*) PyExc_UserWarning; +PyAPI_DATA(PyObject*) PyExc_DeprecationWarning; +PyAPI_DATA(PyObject*) PyExc_PendingDeprecationWarning; +PyAPI_DATA(PyObject*) PyExc_SyntaxWarning; +PyAPI_DATA(PyObject*) PyExc_RuntimeWarning; +PyAPI_DATA(PyObject*) PyExc_FutureWarning; +PyAPI_DATA(PyObject*) PyExc_ImportWarning; +PyAPI_DATA(PyObject*) PyExc_UnicodeWarning; +PyAPI_DATA(PyObject*) PyExc_BytesWarning; +PyAPI_DATA(PyObject*) PyExc_ResourceWarning; + +/* Convenience functions */ + +PyAPI_FUNC(int) PyErr_BadArgument(void); +PyAPI_FUNC(PyObject*) PyErr_NoMemory(void); +PyAPI_FUNC(PyObject*) PyErr_SetFromErrno(PyObject*); +PyAPI_FUNC(PyObject*) + PyErr_SetFromErrnoWithFilenameObject(PyObject*, PyObject*); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03040000 +PyAPI_FUNC(PyObject*) + PyErr_SetFromErrnoWithFilenameObjects(PyObject*, PyObject*, PyObject*); +#endif +PyAPI_FUNC(PyObject*) PyErr_SetFromErrnoWithFilename( + PyObject* exc, + const char* filename /* decoded from the filesystem encoding */ + ); +#if defined(MS_WINDOWS) && !defined(Py_LIMITED_API) +PyAPI_FUNC(PyObject*) + PyErr_SetFromErrnoWithUnicodeFilename(PyObject*, const Py_UNICODE*); +#endif /* MS_WINDOWS */ + +PyAPI_FUNC(PyObject*) PyErr_Format( + PyObject* exception, + const char* format, /* ASCII-encoded string */ + ...); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03050000 +PyAPI_FUNC(PyObject*) + PyErr_FormatV(PyObject* exception, const char* format, va_list vargs); +#endif + +#ifndef Py_LIMITED_API +/* Like PyErr_Format(), but saves current exception as __context__ and + __cause__. + */ +PyAPI_FUNC(PyObject*) _PyErr_FormatFromCause( + PyObject* exception, + const char* format, /* ASCII-encoded string */ + ...); +#endif + +#ifdef MS_WINDOWS +PyAPI_FUNC(PyObject*) PyErr_SetFromWindowsErrWithFilename( + int ierr, + const char* filename /* decoded from the filesystem encoding */ + ); +#ifndef Py_LIMITED_API +/* XXX redeclare to use WSTRING */ +PyAPI_FUNC(PyObject*) + PyErr_SetFromWindowsErrWithUnicodeFilename(int, const Py_UNICODE*); +#endif +PyAPI_FUNC(PyObject*) PyErr_SetFromWindowsErr(int); +PyAPI_FUNC(PyObject*) + PyErr_SetExcFromWindowsErrWithFilenameObject(PyObject*, int, PyObject*); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03040000 +PyAPI_FUNC(PyObject*) PyErr_SetExcFromWindowsErrWithFilenameObjects( + PyObject*, + int, + PyObject*, + PyObject*); +#endif +PyAPI_FUNC(PyObject*) PyErr_SetExcFromWindowsErrWithFilename( + PyObject* exc, + int ierr, + const char* filename /* decoded from the filesystem encoding */ + ); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) PyErr_SetExcFromWindowsErrWithUnicodeFilename( + PyObject*, + int, + const Py_UNICODE*); +#endif +PyAPI_FUNC(PyObject*) PyErr_SetExcFromWindowsErr(PyObject*, int); +#endif /* MS_WINDOWS */ + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03060000 +PyAPI_FUNC(PyObject*) + PyErr_SetImportErrorSubclass(PyObject*, PyObject*, PyObject*, PyObject*); +#endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03030000 +PyAPI_FUNC(PyObject*) PyErr_SetImportError(PyObject*, PyObject*, PyObject*); +#endif + +/* Export the old function so that the existing API remains available: */ +PyAPI_FUNC(void) PyErr_BadInternalCall(void); +PyAPI_FUNC(void) _PyErr_BadInternalCall(const char* filename, int lineno); +/* Mask the old API with a call to the new API for code compiled under + Python 2.0: */ +#define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__) + +/* Function to create a new exception */ +PyAPI_FUNC(PyObject*) + PyErr_NewException(const char* name, PyObject* base, PyObject* dict); +PyAPI_FUNC(PyObject*) PyErr_NewExceptionWithDoc( + const char* name, + const char* doc, + PyObject* base, + PyObject* dict); +PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject*); + +/* In exceptions.c */ +#ifndef Py_LIMITED_API +/* Helper that attempts to replace the current exception with one of the + * same type but with a prefix added to the exception text. The resulting + * exception description looks like: + * + * prefix (exc_type: original_exc_str) + * + * Only some exceptions can be safely replaced. If the function determines + * it isn't safe to perform the replacement, it will leave the original + * unmodified exception in place. + * + * Returns a borrowed reference to the new exception (if any), NULL if the + * existing exception was left in place. + */ +PyAPI_FUNC(PyObject*) _PyErr_TrySetFromCause( + const char* prefix_format, /* ASCII-encoded string */ + ...); +#endif + +/* In sigcheck.c or signalmodule.c */ +PyAPI_FUNC(int) PyErr_CheckSignals(void); +PyAPI_FUNC(void) PyErr_SetInterrupt(void); + +/* In signalmodule.c */ +#ifndef Py_LIMITED_API +int PySignal_SetWakeupFd(int fd); +#endif + +/* Support for adding program text to SyntaxErrors */ +PyAPI_FUNC(void) PyErr_SyntaxLocation( + const char* filename, /* decoded from the filesystem encoding */ + int lineno); +PyAPI_FUNC(void) PyErr_SyntaxLocationEx( + const char* filename, /* decoded from the filesystem encoding */ + int lineno, + int col_offset); +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) + PyErr_SyntaxLocationObject(PyObject* filename, int lineno, int col_offset); +#endif +PyAPI_FUNC(PyObject*) PyErr_ProgramText( + const char* filename, /* decoded from the filesystem encoding */ + int lineno); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) PyErr_ProgramTextObject(PyObject* filename, int lineno); +#endif + +/* The following functions are used to create and modify unicode + exceptions from C */ + +/* create a UnicodeDecodeError object */ +PyAPI_FUNC(PyObject*) PyUnicodeDecodeError_Create( + const char* encoding, /* UTF-8 encoded string */ + const char* object, + Py_ssize_t length, + Py_ssize_t start, + Py_ssize_t end, + const char* reason /* UTF-8 encoded string */ + ); + +/* create a UnicodeEncodeError object */ +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) PyUnicodeEncodeError_Create( + const char* encoding, /* UTF-8 encoded string */ + const Py_UNICODE* object, + Py_ssize_t length, + Py_ssize_t start, + Py_ssize_t end, + const char* reason /* UTF-8 encoded string */ + ); +#endif + +/* create a UnicodeTranslateError object */ +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) PyUnicodeTranslateError_Create( + const Py_UNICODE* object, + Py_ssize_t length, + Py_ssize_t start, + Py_ssize_t end, + const char* reason /* UTF-8 encoded string */ + ); +PyAPI_FUNC(PyObject*) _PyUnicodeTranslateError_Create( + PyObject* object, + Py_ssize_t start, + Py_ssize_t end, + const char* reason /* UTF-8 encoded string */ + ); +#endif + +/* get the encoding attribute */ +PyAPI_FUNC(PyObject*) PyUnicodeEncodeError_GetEncoding(PyObject*); +PyAPI_FUNC(PyObject*) PyUnicodeDecodeError_GetEncoding(PyObject*); + +/* get the object attribute */ +PyAPI_FUNC(PyObject*) PyUnicodeEncodeError_GetObject(PyObject*); +PyAPI_FUNC(PyObject*) PyUnicodeDecodeError_GetObject(PyObject*); +PyAPI_FUNC(PyObject*) PyUnicodeTranslateError_GetObject(PyObject*); + +/* get the value of the start attribute (the int * may not be NULL) + return 0 on success, -1 on failure */ +PyAPI_FUNC(int) PyUnicodeEncodeError_GetStart(PyObject*, Py_ssize_t*); +PyAPI_FUNC(int) PyUnicodeDecodeError_GetStart(PyObject*, Py_ssize_t*); +PyAPI_FUNC(int) PyUnicodeTranslateError_GetStart(PyObject*, Py_ssize_t*); + +/* assign a new value to the start attribute + return 0 on success, -1 on failure */ +PyAPI_FUNC(int) PyUnicodeEncodeError_SetStart(PyObject*, Py_ssize_t); +PyAPI_FUNC(int) PyUnicodeDecodeError_SetStart(PyObject*, Py_ssize_t); +PyAPI_FUNC(int) PyUnicodeTranslateError_SetStart(PyObject*, Py_ssize_t); + +/* get the value of the end attribute (the int *may not be NULL) + return 0 on success, -1 on failure */ +PyAPI_FUNC(int) PyUnicodeEncodeError_GetEnd(PyObject*, Py_ssize_t*); +PyAPI_FUNC(int) PyUnicodeDecodeError_GetEnd(PyObject*, Py_ssize_t*); +PyAPI_FUNC(int) PyUnicodeTranslateError_GetEnd(PyObject*, Py_ssize_t*); + +/* assign a new value to the end attribute + return 0 on success, -1 on failure */ +PyAPI_FUNC(int) PyUnicodeEncodeError_SetEnd(PyObject*, Py_ssize_t); +PyAPI_FUNC(int) PyUnicodeDecodeError_SetEnd(PyObject*, Py_ssize_t); +PyAPI_FUNC(int) PyUnicodeTranslateError_SetEnd(PyObject*, Py_ssize_t); + +/* get the value of the reason attribute */ +PyAPI_FUNC(PyObject*) PyUnicodeEncodeError_GetReason(PyObject*); +PyAPI_FUNC(PyObject*) PyUnicodeDecodeError_GetReason(PyObject*); +PyAPI_FUNC(PyObject*) PyUnicodeTranslateError_GetReason(PyObject*); + +/* assign a new value to the reason attribute + return 0 on success, -1 on failure */ +PyAPI_FUNC(int) PyUnicodeEncodeError_SetReason( + PyObject* exc, + const char* reason /* UTF-8 encoded string */ + ); +PyAPI_FUNC(int) PyUnicodeDecodeError_SetReason( + PyObject* exc, + const char* reason /* UTF-8 encoded string */ + ); +PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason( + PyObject* exc, + const char* reason /* UTF-8 encoded string */ + ); + +/* These APIs aren't really part of the error implementation, but + often needed to format error messages; the native C lib APIs are + not available on all platforms, which is why we provide emulations + for those platforms in Python/mysnprintf.c, + WARNING: The return value of snprintf varies across platforms; do + not rely on any particular behavior; eventually the C99 defn may + be reliable. +*/ +#if defined(MS_WIN32) && !defined(HAVE_SNPRINTF) +#define HAVE_SNPRINTF +#define snprintf _snprintf +#define vsnprintf _vsnprintf +#endif + +#include +PyAPI_FUNC(int) PyOS_snprintf(char* str, size_t size, const char* format, ...) + Py_GCC_ATTRIBUTE((format(printf, 3, 4))); +PyAPI_FUNC(int) + PyOS_vsnprintf(char* str, size_t size, const char* format, va_list va) + Py_GCC_ATTRIBUTE((format(printf, 3, 0))); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_ERRORS_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyexpat.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyexpat.h new file mode 100644 index 0000000..33c4125 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyexpat.h @@ -0,0 +1,59 @@ +/* Stuff to export relevant 'expat' entry points from pyexpat to other + * parser modules, such as cElementTree. */ + +/* note: you must import expat.h before importing this module! */ + +#define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.0" +#define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI" + +struct PyExpat_CAPI { + char* magic; /* set to PyExpat_CAPI_MAGIC */ + int size; /* set to sizeof(struct PyExpat_CAPI) */ + int MAJOR_VERSION; + int MINOR_VERSION; + int MICRO_VERSION; + /* pointers to selected expat functions. add new functions at + the end, if needed */ + const XML_LChar* (*ErrorString)(enum XML_Error code); + enum XML_Error (*GetErrorCode)(XML_Parser parser); + XML_Size (*GetErrorColumnNumber)(XML_Parser parser); + XML_Size (*GetErrorLineNumber)(XML_Parser parser); + enum XML_Status ( + *Parse)(XML_Parser parser, const char* s, int len, int isFinal); + XML_Parser (*ParserCreate_MM)( + const XML_Char* encoding, + const XML_Memory_Handling_Suite* memsuite, + const XML_Char* namespaceSeparator); + void (*ParserFree)(XML_Parser parser); + void (*SetCharacterDataHandler)( + XML_Parser parser, + XML_CharacterDataHandler handler); + void (*SetCommentHandler)(XML_Parser parser, XML_CommentHandler handler); + void ( + *SetDefaultHandlerExpand)(XML_Parser parser, XML_DefaultHandler handler); + void (*SetElementHandler)( + XML_Parser parser, + XML_StartElementHandler start, + XML_EndElementHandler end); + void (*SetNamespaceDeclHandler)( + XML_Parser parser, + XML_StartNamespaceDeclHandler start, + XML_EndNamespaceDeclHandler end); + void (*SetProcessingInstructionHandler)( + XML_Parser parser, + XML_ProcessingInstructionHandler handler); + void (*SetUnknownEncodingHandler)( + XML_Parser parser, + XML_UnknownEncodingHandler handler, + void* encodingHandlerData); + void (*SetUserData)(XML_Parser parser, void* userData); + void (*SetStartDoctypeDeclHandler)( + XML_Parser parser, + XML_StartDoctypeDeclHandler start); + enum XML_Status (*SetEncoding)(XML_Parser parser, const XML_Char* encoding); + int (*DefaultUnknownEncodingHandler)( + void* encodingHandlerData, + const XML_Char* name, + XML_Encoding* info); + /* always add new stuff to the end! */ +}; diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyfpe.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyfpe.h new file mode 100644 index 0000000..cd57868 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyfpe.h @@ -0,0 +1,176 @@ +#ifndef Py_PYFPE_H +#define Py_PYFPE_H +#ifdef __cplusplus +extern "C" { +#endif +/* + --------------------------------------------------------------------- + / Copyright (c) 1996. \ + | The Regents of the University of California. | + | All rights reserved. | + | | + | Permission to use, copy, modify, and distribute this software for | + | any purpose without fee is hereby granted, provided that this en- | + | tire notice is included in all copies of any software which is or | + | includes a copy or modification of this software and in all | + | copies of the supporting documentation for such software. | + | | + | This work was produced at the University of California, Lawrence | + | Livermore National Laboratory under contract no. W-7405-ENG-48 | + | between the U.S. Department of Energy and The Regents of the | + | University of California for the operation of UC LLNL. | + | | + | DISCLAIMER | + | | + | This software was prepared as an account of work sponsored by an | + | agency of the United States Government. Neither the United States | + | Government nor the University of California nor any of their em- | + | ployees, makes any warranty, express or implied, or assumes any | + | liability or responsibility for the accuracy, completeness, or | + | usefulness of any information, apparatus, product, or process | + | disclosed, or represents that its use would not infringe | + | privately-owned rights. Reference herein to any specific commer- | + | cial products, process, or service by trade name, trademark, | + | manufacturer, or otherwise, does not necessarily constitute or | + | imply its endorsement, recommendation, or favoring by the United | + | States Government or the University of California. The views and | + | opinions of authors expressed herein do not necessarily state or | + | reflect those of the United States Government or the University | + | of California, and shall not be used for advertising or product | + \ endorsement purposes. / + --------------------------------------------------------------------- +*/ + +/* + * Define macros for handling SIGFPE. + * Lee Busby, LLNL, November, 1996 + * busby1@llnl.gov + * + ********************************************* + * Overview of the system for handling SIGFPE: + * + * This file (Include/pyfpe.h) defines a couple of "wrapper" macros for + * insertion into your Python C code of choice. Their proper use is + * discussed below. The file Python/pyfpe.c defines a pair of global + * variables PyFPE_jbuf and PyFPE_counter which are used by the signal + * handler for SIGFPE to decide if a particular exception was protected + * by the macros. The signal handler itself, and code for enabling the + * generation of SIGFPE in the first place, is in a (new) Python module + * named fpectl. This module is standard in every respect. It can be loaded + * either statically or dynamically as you choose, and like any other + * Python module, has no effect until you import it. + * + * In the general case, there are three steps toward handling SIGFPE in any + * Python code: + * + * 1) Add the *_PROTECT macros to your C code as required to protect + * dangerous floating point sections. + * + * 2) Turn on the inclusion of the code by adding the ``--with-fpectl'' + * flag at the time you run configure. If the fpectl or other modules + * which use the *_PROTECT macros are to be dynamically loaded, be + * sure they are compiled with WANT_SIGFPE_HANDLER defined. + * + * 3) When python is built and running, import fpectl, and execute + * fpectl.turnon_sigfpe(). This sets up the signal handler and enables + * generation of SIGFPE whenever an exception occurs. From this point + * on, any properly trapped SIGFPE should result in the Python + * FloatingPointError exception. + * + * Step 1 has been done already for the Python kernel code, and should be + * done soon for the NumPy array package. Step 2 is usually done once at + * python install time. Python's behavior with respect to SIGFPE is not + * changed unless you also do step 3. Thus you can control this new + * facility at compile time, or run time, or both. + * + ******************************** + * Using the macros in your code: + * + * static PyObject *foobar(PyObject *self,PyObject *args) + * { + * .... + * PyFPE_START_PROTECT("Error in foobar", return 0) + * result = dangerous_op(somearg1, somearg2, ...); + * PyFPE_END_PROTECT(result) + * .... + * } + * + * If a floating point error occurs in dangerous_op, foobar returns 0 (NULL), + * after setting the associated value of the FloatingPointError exception to + * "Error in foobar". ``Dangerous_op'' can be a single operation, or a block + * of code, function calls, or any combination, so long as no alternate + * return is possible before the PyFPE_END_PROTECT macro is reached. + * + * The macros can only be used in a function context where an error return + * can be recognized as signaling a Python exception. (Generally, most + * functions that return a PyObject * will qualify.) + * + * Guido's original design suggestion for PyFPE_START_PROTECT and + * PyFPE_END_PROTECT had them open and close a local block, with a locally + * defined jmp_buf and jmp_buf pointer. This would allow recursive nesting + * of the macros. The Ansi C standard makes it clear that such local + * variables need to be declared with the "volatile" type qualifier to keep + * setjmp from corrupting their values. Some current implementations seem + * to be more restrictive. For example, the HPUX man page for setjmp says + * + * Upon the return from a setjmp() call caused by a longjmp(), the + * values of any non-static local variables belonging to the routine + * from which setjmp() was called are undefined. Code which depends on + * such values is not guaranteed to be portable. + * + * I therefore decided on a more limited form of nesting, using a counter + * variable (PyFPE_counter) to keep track of any recursion. If an exception + * occurs in an ``inner'' pair of macros, the return will apparently + * come from the outermost level. + * + */ + +#ifdef WANT_SIGFPE_HANDLER +#include +#include +#include +extern jmp_buf PyFPE_jbuf; +extern int PyFPE_counter; +extern double PyFPE_dummy(void*); + +#define PyFPE_START_PROTECT(err_string, leave_stmt) \ + if (!PyFPE_counter++ && setjmp(PyFPE_jbuf)) { \ + PyErr_SetString(PyExc_FloatingPointError, err_string); \ + PyFPE_counter = 0; \ + leave_stmt; \ + } + +/* + * This (following) is a heck of a way to decrement a counter. However, + * unless the macro argument is provided, code optimizers will sometimes move + * this statement so that it gets executed *before* the unsafe expression + * which we're trying to protect. That pretty well messes things up, + * of course. + * + * If the expression(s) you're trying to protect don't happen to return a + * value, you will need to manufacture a dummy result just to preserve the + * correct ordering of statements. Note that the macro passes the address + * of its argument (so you need to give it something which is addressable). + * If your expression returns multiple results, pass the last such result + * to PyFPE_END_PROTECT. + * + * Note that PyFPE_dummy returns a double, which is cast to int. + * This seeming insanity is to tickle the Floating Point Unit (FPU). + * If an exception has occurred in a preceding floating point operation, + * some architectures (notably Intel 80x86) will not deliver the interrupt + * until the *next* floating point operation. This is painful if you've + * already decremented PyFPE_counter. + */ +#define PyFPE_END_PROTECT(v) PyFPE_counter -= (int)PyFPE_dummy(&(v)); + +#else + +#define PyFPE_START_PROTECT(err_string, leave_stmt) +#define PyFPE_END_PROTECT(v) + +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_PYFPE_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pygetopt.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pygetopt.h new file mode 100644 index 0000000..b51720b --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pygetopt.h @@ -0,0 +1,21 @@ + +#ifndef Py_PYGETOPT_H +#define Py_PYGETOPT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_LIMITED_API +PyAPI_DATA(int) _PyOS_opterr; +PyAPI_DATA(int) _PyOS_optind; +PyAPI_DATA(wchar_t*) _PyOS_optarg; + +PyAPI_FUNC(void) _PyOS_ResetGetOpt(void); + +PyAPI_FUNC(int) _PyOS_GetOpt(int argc, wchar_t** argv, wchar_t* optstring); +#endif /* !Py_LIMITED_API */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_PYGETOPT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyhash.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyhash.h new file mode 100644 index 0000000..02da287 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyhash.h @@ -0,0 +1,142 @@ +#ifndef Py_HASH_H + +#define Py_HASH_H +#ifdef __cplusplus +extern "C" { +#endif + +/* Helpers for hash functions */ +#ifndef Py_LIMITED_API +PyAPI_FUNC(Py_hash_t) _Py_HashDouble(double); +PyAPI_FUNC(Py_hash_t) _Py_HashPointer(void*); +PyAPI_FUNC(Py_hash_t) _Py_HashBytes(const void*, Py_ssize_t); +#endif + +/* Prime multiplier used in string and various other hashes. */ +#define _PyHASH_MULTIPLIER 1000003UL /* 0xf4243 */ + +/* Parameters used for the numeric hash implementation. See notes for + _Py_HashDouble in Python/pyhash.c. Numeric hashes are based on + reduction modulo the prime 2**_PyHASH_BITS - 1. */ + +#if SIZEOF_VOID_P >= 8 +#define _PyHASH_BITS 61 +#else +#define _PyHASH_BITS 31 +#endif + +#define _PyHASH_MODULUS (((size_t)1 << _PyHASH_BITS) - 1) +#define _PyHASH_INF 314159 +#define _PyHASH_NAN 0 +#define _PyHASH_IMAG _PyHASH_MULTIPLIER + +/* hash secret + * + * memory layout on 64 bit systems + * cccccccc cccccccc cccccccc uc -- unsigned char[24] + * pppppppp ssssssss ........ fnv -- two Py_hash_t + * k0k0k0k0 k1k1k1k1 ........ siphash -- two uint64_t + * ........ ........ ssssssss djbx33a -- 16 bytes padding + one Py_hash_t + * ........ ........ eeeeeeee pyexpat XML hash salt + * + * memory layout on 32 bit systems + * cccccccc cccccccc cccccccc uc + * ppppssss ........ ........ fnv -- two Py_hash_t + * k0k0k0k0 k1k1k1k1 ........ siphash -- two uint64_t (*) + * ........ ........ ssss.... djbx33a -- 16 bytes padding + one Py_hash_t + * ........ ........ eeee.... pyexpat XML hash salt + * + * (*) The siphash member may not be available on 32 bit platforms without + * an unsigned int64 data type. + */ +#ifndef Py_LIMITED_API +typedef union { + /* ensure 24 bytes */ + unsigned char uc[24]; + /* two Py_hash_t for FNV */ + struct { + Py_hash_t prefix; + Py_hash_t suffix; + } fnv; + /* two uint64 for SipHash24 */ + struct { + uint64_t k0; + uint64_t k1; + } siphash; + /* a different (!) Py_hash_t for small string optimization */ + struct { + unsigned char padding[16]; + Py_hash_t suffix; + } djbx33a; + struct { + unsigned char padding[16]; + Py_hash_t hashsalt; + } expat; +} _Py_HashSecret_t; +PyAPI_DATA(_Py_HashSecret_t) _Py_HashSecret; +#endif + +#ifdef Py_DEBUG +PyAPI_DATA(int) _Py_HashSecret_Initialized; +#endif + +/* hash function definition */ +#ifndef Py_LIMITED_API +typedef struct { + Py_hash_t (*const hash)(const void*, Py_ssize_t); + const char* name; + const int hash_bits; + const int seed_bits; +} PyHash_FuncDef; + +PyAPI_FUNC(PyHash_FuncDef*) PyHash_GetFuncDef(void); +#endif + +/* cutoff for small string DJBX33A optimization in range [1, cutoff). + * + * About 50% of the strings in a typical Python application are smaller than + * 6 to 7 chars. However DJBX33A is vulnerable to hash collision attacks. + * NEVER use DJBX33A for long strings! + * + * A Py_HASH_CUTOFF of 0 disables small string optimization. 32 bit platforms + * should use a smaller cutoff because it is easier to create colliding + * strings. A cutoff of 7 on 64bit platforms and 5 on 32bit platforms should + * provide a decent safety margin. + */ +#ifndef Py_HASH_CUTOFF +#define Py_HASH_CUTOFF 0 +#elif (Py_HASH_CUTOFF > 7 || Py_HASH_CUTOFF < 0) +#error Py_HASH_CUTOFF must in range 0...7. +#endif /* Py_HASH_CUTOFF */ + +/* hash algorithm selection + * + * The values for Py_HASH_SIPHASH24 and Py_HASH_FNV are hard-coded in the + * configure script. + * + * - FNV is available on all platforms and architectures. + * - SIPHASH24 only works on plaforms that don't require aligned memory for + * integers. + * - With EXTERNAL embedders can provide an alternative implementation with:: + * + * PyHash_FuncDef PyHash_Func = {...}; + * + * XXX: Figure out __declspec() for extern PyHash_FuncDef. + */ +#define Py_HASH_EXTERNAL 0 +#define Py_HASH_SIPHASH24 1 +#define Py_HASH_FNV 2 + +#ifndef Py_HASH_ALGORITHM +#ifndef HAVE_ALIGNED_REQUIRED +#define Py_HASH_ALGORITHM Py_HASH_SIPHASH24 +#else +#define Py_HASH_ALGORITHM Py_HASH_FNV +#endif /* uint64_t && uint32_t && aligned */ +#endif /* Py_HASH_ALGORITHM */ + +#ifdef __cplusplus +} +#endif + +#endif /* !Py_HASH_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pylifecycle.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pylifecycle.h new file mode 100644 index 0000000..7448286 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pylifecycle.h @@ -0,0 +1,129 @@ + +/* Interfaces to configure, query, create & destroy the Python runtime */ + +#ifndef Py_PYLIFECYCLE_H +#define Py_PYLIFECYCLE_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_FUNC(void) Py_SetProgramName(wchar_t*); +PyAPI_FUNC(wchar_t*) Py_GetProgramName(void); + +PyAPI_FUNC(void) Py_SetPythonHome(wchar_t*); +PyAPI_FUNC(wchar_t*) Py_GetPythonHome(void); + +#ifndef Py_LIMITED_API +/* Only used by applications that embed the interpreter and need to + * override the standard encoding determination mechanism + */ +PyAPI_FUNC(int) + Py_SetStandardStreamEncoding(const char* encoding, const char* errors); +#endif + +PyAPI_FUNC(void) Py_Initialize(void); +PyAPI_FUNC(void) Py_InitializeEx(int); +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) _Py_InitializeEx_Private(int, int); +#endif +PyAPI_FUNC(void) Py_Finalize(void); +PyAPI_FUNC(int) Py_FinalizeEx(void); +PyAPI_FUNC(int) Py_IsInitialized(void); +PyAPI_FUNC(PyThreadState*) Py_NewInterpreter(void); +PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState*); + +/* Py_PyAtExit is for the atexit module, Py_AtExit is for low-level + * exit functions. + */ +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) _Py_PyAtExit(void (*func)(void)); +#endif +PyAPI_FUNC(int) Py_AtExit(void (*func)(void)); + +PyAPI_FUNC(void) Py_Exit(int); + +/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. */ +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) _Py_RestoreSignals(void); + +PyAPI_FUNC(int) Py_FdIsInteractive(FILE*, const char*); +#endif + +/* Bootstrap __main__ (defined in Modules/main.c) */ +PyAPI_FUNC(int) Py_Main(int argc, wchar_t** argv); + +/* In getpath.c */ +PyAPI_FUNC(wchar_t*) Py_GetProgramFullPath(void); +PyAPI_FUNC(wchar_t*) Py_GetPrefix(void); +PyAPI_FUNC(wchar_t*) Py_GetExecPrefix(void); +PyAPI_FUNC(wchar_t*) Py_GetPath(void); +PyAPI_FUNC(void) Py_SetPath(const wchar_t*); +#ifdef MS_WINDOWS +int _Py_CheckPython3(); +#endif + +/* In their own files */ +PyAPI_FUNC(const char*) Anaconda_GetVersion(void); +PyAPI_FUNC(const char*) Py_GetVersion(void); +PyAPI_FUNC(const char*) Py_GetPlatform(void); +PyAPI_FUNC(const char*) Py_GetCopyright(void); +PyAPI_FUNC(const char*) Py_GetCompiler(void); +PyAPI_FUNC(const char*) Py_GetBuildInfo(void); +#ifndef Py_LIMITED_API +PyAPI_FUNC(const char*) _Py_gitidentifier(void); +PyAPI_FUNC(const char*) _Py_gitversion(void); +#endif + +/* Internal -- various one-time initializations */ +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _PyBuiltin_Init(void); +PyAPI_FUNC(PyObject*) _PySys_Init(void); +PyAPI_FUNC(void) _PyImport_Init(void); +PyAPI_FUNC(void) _PyExc_Init(PyObject* bltinmod); +PyAPI_FUNC(void) _PyImportHooks_Init(void); +PyAPI_FUNC(int) _PyFrame_Init(void); +PyAPI_FUNC(int) _PyFloat_Init(void); +PyAPI_FUNC(int) PyByteArray_Init(void); +PyAPI_FUNC(void) _PyRandom_Init(void); +#endif + +/* Various internal finalizers */ +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) _PyExc_Fini(void); +PyAPI_FUNC(void) _PyImport_Fini(void); +PyAPI_FUNC(void) PyMethod_Fini(void); +PyAPI_FUNC(void) PyFrame_Fini(void); +PyAPI_FUNC(void) PyCFunction_Fini(void); +PyAPI_FUNC(void) PyDict_Fini(void); +PyAPI_FUNC(void) PyTuple_Fini(void); +PyAPI_FUNC(void) PyList_Fini(void); +PyAPI_FUNC(void) PySet_Fini(void); +PyAPI_FUNC(void) PyBytes_Fini(void); +PyAPI_FUNC(void) PyByteArray_Fini(void); +PyAPI_FUNC(void) PyFloat_Fini(void); +PyAPI_FUNC(void) PyOS_FiniInterrupts(void); +PyAPI_FUNC(void) _PyGC_DumpShutdownStats(void); +PyAPI_FUNC(void) _PyGC_Fini(void); +PyAPI_FUNC(void) PySlice_Fini(void); +PyAPI_FUNC(void) _PyType_Fini(void); +PyAPI_FUNC(void) _PyRandom_Fini(void); +PyAPI_FUNC(void) PyAsyncGen_Fini(void); + +PyAPI_DATA(PyThreadState*) _Py_Finalizing; +#endif + +/* Signals */ +typedef void (*PyOS_sighandler_t)(int); +PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int); +PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t); + +#ifndef Py_LIMITED_API +/* Random */ +PyAPI_FUNC(int) _PyOS_URandom(void* buffer, Py_ssize_t size); +PyAPI_FUNC(int) _PyOS_URandomNonblock(void* buffer, Py_ssize_t size); +#endif /* !Py_LIMITED_API */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_PYLIFECYCLE_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pymacconfig.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pymacconfig.h new file mode 100644 index 0000000..b00e42d --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pymacconfig.h @@ -0,0 +1,101 @@ +#ifndef PYMACCONFIG_H +#define PYMACCONFIG_H +/* + * This file moves some of the autoconf magic to compile-time + * when building on MacOSX. This is needed for building 4-way + * universal binaries and for 64-bit universal binaries because + * the values redefined below aren't configure-time constant but + * only compile-time constant in these scenarios. + */ + +#if defined(__APPLE__) + +#undef SIZEOF_LONG +#undef SIZEOF_PTHREAD_T +#undef SIZEOF_SIZE_T +#undef SIZEOF_TIME_T +#undef SIZEOF_VOID_P +#undef SIZEOF__BOOL +#undef SIZEOF_UINTPTR_T +#undef SIZEOF_PTHREAD_T +#undef WORDS_BIGENDIAN +#undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 +#undef DOUBLE_IS_BIG_ENDIAN_IEEE754 +#undef DOUBLE_IS_LITTLE_ENDIAN_IEEE754 +#undef HAVE_GCC_ASM_FOR_X87 + +#undef VA_LIST_IS_ARRAY +#if defined(__LP64__) && defined(__x86_64__) +#define VA_LIST_IS_ARRAY 1 +#endif + +#undef HAVE_LARGEFILE_SUPPORT +#ifndef __LP64__ +#define HAVE_LARGEFILE_SUPPORT 1 +#endif + +#undef SIZEOF_LONG +#ifdef __LP64__ +#define SIZEOF__BOOL 1 +#define SIZEOF__BOOL 1 +#define SIZEOF_LONG 8 +#define SIZEOF_PTHREAD_T 8 +#define SIZEOF_SIZE_T 8 +#define SIZEOF_TIME_T 8 +#define SIZEOF_VOID_P 8 +#define SIZEOF_UINTPTR_T 8 +#define SIZEOF_PTHREAD_T 8 +#else +#ifdef __ppc__ +#define SIZEOF__BOOL 4 +#else +#define SIZEOF__BOOL 1 +#endif +#define SIZEOF_LONG 4 +#define SIZEOF_PTHREAD_T 4 +#define SIZEOF_SIZE_T 4 +#define SIZEOF_TIME_T 4 +#define SIZEOF_VOID_P 4 +#define SIZEOF_UINTPTR_T 4 +#define SIZEOF_PTHREAD_T 4 +#endif + +#if defined(__LP64__) +/* MacOSX 10.4 (the first release to support 64-bit code + * at all) only supports 64-bit in the UNIX layer. + * Therefore suppress the toolbox-glue in 64-bit mode. + */ + +/* In 64-bit mode setpgrp always has no arguments, in 32-bit + * mode that depends on the compilation environment + */ +#undef SETPGRP_HAVE_ARG + +#endif + +#ifdef __BIG_ENDIAN__ +#define WORDS_BIGENDIAN 1 +#define DOUBLE_IS_BIG_ENDIAN_IEEE754 +#else +#define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 +#endif /* __BIG_ENDIAN */ + +#ifdef __i386__ +#define HAVE_GCC_ASM_FOR_X87 +#endif + +/* + * The definition in pyconfig.h is only valid on the OS release + * where configure ran on and not necessarily for all systems where + * the executable can be used on. + * + * Specifically: OSX 10.4 has limited supported for '%zd', while + * 10.5 has full support for '%zd'. A binary built on 10.5 won't + * work properly on 10.4 unless we suppress the definition + * of PY_FORMAT_SIZE_T + */ +#undef PY_FORMAT_SIZE_T + +#endif /* defined(_APPLE__) */ + +#endif /* PYMACCONFIG_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pymacro.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pymacro.h new file mode 100644 index 0000000..7bfd6f9 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pymacro.h @@ -0,0 +1,97 @@ +#ifndef Py_PYMACRO_H +#define Py_PYMACRO_H + +/* Minimum value between x and y */ +#define Py_MIN(x, y) (((x) > (y)) ? (y) : (x)) + +/* Maximum value between x and y */ +#define Py_MAX(x, y) (((x) > (y)) ? (x) : (y)) + +/* Absolute value of the number x */ +#define Py_ABS(x) ((x) < 0 ? -(x) : (x)) + +#define _Py_XSTRINGIFY(x) #x + +/* Convert the argument to a string. For example, Py_STRINGIFY(123) is replaced + with "123" by the preprocessor. Defines are also replaced by their value. + For example Py_STRINGIFY(__LINE__) is replaced by the line number, not + by "__LINE__". */ +#define Py_STRINGIFY(x) _Py_XSTRINGIFY(x) + +/* Get the size of a structure member in bytes */ +#define Py_MEMBER_SIZE(type, member) sizeof(((type*)0)->member) + +/* Argument must be a char or an int in [-128, 127] or [0, 255]. */ +#define Py_CHARMASK(c) ((unsigned char)((c)&0xff)) + +/* Assert a build-time dependency, as an expression. + + Your compile will fail if the condition isn't true, or can't be evaluated + by the compiler. This can be used in an expression: its value is 0. + + Example: + + #define foo_to_char(foo) \ + ((char *)(foo) \ + + Py_BUILD_ASSERT_EXPR(offsetof(struct foo, string) == 0)) + + Written by Rusty Russell, public domain, http://ccodearchive.net/ */ +#define Py_BUILD_ASSERT_EXPR(cond) (sizeof(char[1 - 2 * !(cond)]) - 1) + +#define Py_BUILD_ASSERT(cond) \ + do { \ + (void)Py_BUILD_ASSERT_EXPR(cond); \ + } while (0) + +/* Get the number of elements in a visible array + + This does not work on pointers, or arrays declared as [], or function + parameters. With correct compiler support, such usage will cause a build + error (see Py_BUILD_ASSERT_EXPR). + + Written by Rusty Russell, public domain, http://ccodearchive.net/ + + Requires at GCC 3.1+ */ +#if ( \ + defined(__GNUC__) && !defined(__STRICT_ANSI__) && \ + (((__GNUC__ == 3) && (__GNU_MINOR__ >= 1)) || (__GNUC__ >= 4))) +/* Two gcc extensions. + &a[0] degrades to a pointer: a different type from an array */ +#define Py_ARRAY_LENGTH(array) \ + (sizeof(array) / sizeof((array)[0]) + \ + Py_BUILD_ASSERT_EXPR( \ + !__builtin_types_compatible_p(typeof(array), typeof(&(array)[0])))) +#else +#define Py_ARRAY_LENGTH(array) (sizeof(array) / sizeof((array)[0])) +#endif + +/* Define macros for inline documentation. */ +#define PyDoc_VAR(name) static char name[] +#define PyDoc_STRVAR(name, str) PyDoc_VAR(name) = PyDoc_STR(str) +#ifdef WITH_DOC_STRINGS +#define PyDoc_STR(str) str +#else +#define PyDoc_STR(str) "" +#endif + +/* Below "a" is a power of 2. */ +/* Round down size "n" to be a multiple of "a". */ +#define _Py_SIZE_ROUND_DOWN(n, a) ((size_t)(n) & ~(size_t)((a)-1)) +/* Round up size "n" to be a multiple of "a". */ +#define _Py_SIZE_ROUND_UP(n, a) \ + (((size_t)(n) + (size_t)((a)-1)) & ~(size_t)((a)-1)) +/* Round pointer "p" down to the closest "a"-aligned address <= "p". */ +#define _Py_ALIGN_DOWN(p, a) ((void*)((uintptr_t)(p) & ~(uintptr_t)((a)-1))) +/* Round pointer "p" up to the closest "a"-aligned address >= "p". */ +#define _Py_ALIGN_UP(p, a) \ + ((void*)(((uintptr_t)(p) + (uintptr_t)((a)-1)) & ~(uintptr_t)((a)-1))) +/* Check if pointer "p" is aligned to "a"-bytes boundary. */ +#define _Py_IS_ALIGNED(p, a) (!((uintptr_t)(p) & (uintptr_t)((a)-1))) + +#ifdef __GNUC__ +#define Py_UNUSED(name) _unused_##name __attribute__((unused)) +#else +#define Py_UNUSED(name) _unused_##name +#endif + +#endif /* Py_PYMACRO_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pymath.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pymath.h new file mode 100644 index 0000000..92b5f1e --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pymath.h @@ -0,0 +1,235 @@ +#ifndef Py_PYMATH_H +#define Py_PYMATH_H + +#include "pyconfig.h" /* include for defines */ + +/************************************************************************** +Symbols and macros to supply platform-independent interfaces to mathematical +functions and constants +**************************************************************************/ + +/* Python provides implementations for copysign, round and hypot in + * Python/pymath.c just in case your math library doesn't provide the + * functions. + * + *Note: PC/pyconfig.h defines copysign as _copysign + */ +#ifndef HAVE_COPYSIGN +extern double copysign(double, double); +#endif + +#ifndef HAVE_ROUND +extern double round(double); +#endif + +#ifndef HAVE_HYPOT +extern double hypot(double, double); +#endif + +/* extra declarations */ +#ifndef _MSC_VER +#ifndef __STDC__ +extern double fmod(double, double); +extern double frexp(double, int*); +extern double ldexp(double, int); +extern double modf(double, double*); +extern double pow(double, double); +#endif /* __STDC__ */ +#endif /* _MSC_VER */ + +/* High precision definition of pi and e (Euler) + * The values are taken from libc6's math.h. + */ +#ifndef Py_MATH_PIl +#define Py_MATH_PIl 3.1415926535897932384626433832795029L +#endif +#ifndef Py_MATH_PI +#define Py_MATH_PI 3.14159265358979323846 +#endif + +#ifndef Py_MATH_El +#define Py_MATH_El 2.7182818284590452353602874713526625L +#endif + +#ifndef Py_MATH_E +#define Py_MATH_E 2.7182818284590452354 +#endif + +/* Tau (2pi) to 40 digits, taken from tauday.com/tau-digits. */ +#ifndef Py_MATH_TAU +#define Py_MATH_TAU 6.2831853071795864769252867665590057683943L +#endif + +/* On x86, Py_FORCE_DOUBLE forces a floating-point number out of an x87 FPU + register and into a 64-bit memory location, rounding from extended + precision to double precision in the process. On other platforms it does + nothing. */ + +/* we take double rounding as evidence of x87 usage */ +#ifndef Py_LIMITED_API +#ifndef Py_FORCE_DOUBLE +#ifdef X87_DOUBLE_ROUNDING +PyAPI_FUNC(double) _Py_force_double(double); +#define Py_FORCE_DOUBLE(X) (_Py_force_double(X)) +#else +#define Py_FORCE_DOUBLE(X) (X) +#endif +#endif +#endif + +#ifndef Py_LIMITED_API +#ifdef HAVE_GCC_ASM_FOR_X87 +PyAPI_FUNC(unsigned short) _Py_get_387controlword(void); +PyAPI_FUNC(void) _Py_set_387controlword(unsigned short); +#endif +#endif + +/* Py_IS_NAN(X) + * Return 1 if float or double arg is a NaN, else 0. + * Caution: + * X is evaluated more than once. + * This may not work on all platforms. Each platform has *some* + * way to spell this, though -- override in pyconfig.h if you have + * a platform where it doesn't work. + * Note: PC/pyconfig.h defines Py_IS_NAN as _isnan + */ +#ifndef Py_IS_NAN +#if defined HAVE_DECL_ISNAN && HAVE_DECL_ISNAN == 1 +#define Py_IS_NAN(X) isnan(X) +#else +#define Py_IS_NAN(X) ((X) != (X)) +#endif +#endif + +/* Py_IS_INFINITY(X) + * Return 1 if float or double arg is an infinity, else 0. + * Caution: + * X is evaluated more than once. + * This implementation may set the underflow flag if |X| is very small; + * it really can't be implemented correctly (& easily) before C99. + * Override in pyconfig.h if you have a better spelling on your platform. + * Py_FORCE_DOUBLE is used to avoid getting false negatives from a + * non-infinite value v sitting in an 80-bit x87 register such that + * v becomes infinite when spilled from the register to 64-bit memory. + * Note: PC/pyconfig.h defines Py_IS_INFINITY as _isinf + */ +#ifndef Py_IS_INFINITY +#if defined HAVE_DECL_ISINF && HAVE_DECL_ISINF == 1 +#define Py_IS_INFINITY(X) isinf(X) +#else +#define Py_IS_INFINITY(X) \ + ((X) && (Py_FORCE_DOUBLE(X) * 0.5 == Py_FORCE_DOUBLE(X))) +#endif +#endif + +/* Py_IS_FINITE(X) + * Return 1 if float or double arg is neither infinite nor NAN, else 0. + * Some compilers (e.g. VisualStudio) have intrisics for this, so a special + * macro for this particular test is useful + * Note: PC/pyconfig.h defines Py_IS_FINITE as _finite + */ +#ifndef Py_IS_FINITE +#if defined HAVE_DECL_ISFINITE && HAVE_DECL_ISFINITE == 1 +#define Py_IS_FINITE(X) isfinite(X) +#elif defined HAVE_FINITE +#define Py_IS_FINITE(X) finite(X) +#else +#define Py_IS_FINITE(X) (!Py_IS_INFINITY(X) && !Py_IS_NAN(X)) +#endif +#endif + +/* HUGE_VAL is supposed to expand to a positive double infinity. Python + * uses Py_HUGE_VAL instead because some platforms are broken in this + * respect. We used to embed code in pyport.h to try to worm around that, + * but different platforms are broken in conflicting ways. If you're on + * a platform where HUGE_VAL is defined incorrectly, fiddle your Python + * config to #define Py_HUGE_VAL to something that works on your platform. + */ +#ifndef Py_HUGE_VAL +#define Py_HUGE_VAL HUGE_VAL +#endif + +/* Py_NAN + * A value that evaluates to a NaN. On IEEE 754 platforms INF*0 or + * INF/INF works. Define Py_NO_NAN in pyconfig.h if your platform + * doesn't support NaNs. + */ +#if !defined(Py_NAN) && !defined(Py_NO_NAN) +#if !defined(__INTEL_COMPILER) +#define Py_NAN (Py_HUGE_VAL * 0.) +#else /* __INTEL_COMPILER */ +#if defined(ICC_NAN_STRICT) +#pragma float_control(push) +#pragma float_control(precise, on) +#pragma float_control(except, on) +#if defined(_MSC_VER) +__declspec(noinline) +#else /* Linux */ +__attribute__((noinline)) +#endif /* _MSC_VER */ + static double __icc_nan() { + return sqrt(-1.0); +} +#pragma float_control(pop) +#define Py_NAN __icc_nan() +#else /* ICC_NAN_RELAXED as default for Intel Compiler */ +static const union { + unsigned char buf[8]; + double __icc_nan; +} __nan_store = {0, 0, 0, 0, 0, 0, 0xf8, 0x7f}; +#define Py_NAN (__nan_store.__icc_nan) +#endif /* ICC_NAN_STRICT */ +#endif /* __INTEL_COMPILER */ +#endif + +/* Py_OVERFLOWED(X) + * Return 1 iff a libm function overflowed. Set errno to 0 before calling + * a libm function, and invoke this macro after, passing the function + * result. + * Caution: + * This isn't reliable. C99 no longer requires libm to set errno under + * any exceptional condition, but does require +- HUGE_VAL return + * values on overflow. A 754 box *probably* maps HUGE_VAL to a + * double infinity, and we're cool if that's so, unless the input + * was an infinity and an infinity is the expected result. A C89 + * system sets errno to ERANGE, so we check for that too. We're + * out of luck if a C99 754 box doesn't map HUGE_VAL to +Inf, or + * if the returned result is a NaN, or if a C89 box returns HUGE_VAL + * in non-overflow cases. + * X is evaluated more than once. + * Some platforms have better way to spell this, so expect some #ifdef'ery. + * + * OpenBSD uses 'isinf()' because a compiler bug on that platform causes + * the longer macro version to be mis-compiled. This isn't optimal, and + * should be removed once a newer compiler is available on that platform. + * The system that had the failure was running OpenBSD 3.2 on Intel, with + * gcc 2.95.3. + * + * According to Tim's checkin, the FreeBSD systems use isinf() to work + * around a FPE bug on that platform. + */ +#if defined(__FreeBSD__) || defined(__OpenBSD__) +#define Py_OVERFLOWED(X) isinf(X) +#else +#define Py_OVERFLOWED(X) \ + ((X) != 0.0 && (errno == ERANGE || (X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL)) +#endif + +/* Return whether integral type *type* is signed or not. */ +#define _Py_IntegralTypeSigned(type) ((type)(-1) < 0) +/* Return the maximum value of integral type *type*. */ +#define _Py_IntegralTypeMax(type) \ + ((_Py_IntegralTypeSigned(type)) \ + ? (((((type)1 << (sizeof(type) * CHAR_BIT - 2)) - 1) << 1) + 1) \ + : ~(type)0) +/* Return the minimum value of integral type *type*. */ +#define _Py_IntegralTypeMin(type) \ + ((_Py_IntegralTypeSigned(type)) ? -_Py_IntegralTypeMax(type) - 1 : 0) +/* Check whether *v* is in the range of integral type *type*. This is most + * useful if *v* is floating-point, since demoting a floating-point *v* to an + * integral type that cannot represent *v*'s integral part is undefined + * behavior. */ +#define _Py_InIntegralTypeRange(type, v) \ + (_Py_IntegralTypeMin(type) <= v && v <= _Py_IntegralTypeMax(type)) + +#endif /* Py_PYMATH_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pymem.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pymem.h new file mode 100644 index 0000000..dbea899 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pymem.h @@ -0,0 +1,236 @@ +/* The PyMem_ family: low-level memory allocation interfaces. + See objimpl.h for the PyObject_ memory family. +*/ + +#ifndef Py_PYMEM_H +#define Py_PYMEM_H + +#include "pyport.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_LIMITED_API +PyAPI_FUNC(void*) PyMem_RawMalloc(size_t size); +PyAPI_FUNC(void*) PyMem_RawCalloc(size_t nelem, size_t elsize); +PyAPI_FUNC(void*) PyMem_RawRealloc(void* ptr, size_t new_size); +PyAPI_FUNC(void) PyMem_RawFree(void* ptr); + +/* Configure the Python memory allocators. Pass NULL to use default + allocators. */ +PyAPI_FUNC(int) _PyMem_SetupAllocators(const char* opt); + +#ifdef WITH_PYMALLOC +PyAPI_FUNC(int) _PyMem_PymallocEnabled(void); +#endif + +/* Identifier of an address space (domain) in tracemalloc */ +typedef unsigned int _PyTraceMalloc_domain_t; + +/* Track an allocated memory block in the tracemalloc module. + Return 0 on success, return -1 on error (failed to allocate memory to store + the trace). + + Return -2 if tracemalloc is disabled. + + If memory block is already tracked, update the existing trace. */ +PyAPI_FUNC(int) _PyTraceMalloc_Track( + _PyTraceMalloc_domain_t domain, + uintptr_t ptr, + size_t size); + +/* Untrack an allocated memory block in the tracemalloc module. + Do nothing if the block was not tracked. + + Return -2 if tracemalloc is disabled, otherwise return 0. */ +PyAPI_FUNC(int) + _PyTraceMalloc_Untrack(_PyTraceMalloc_domain_t domain, uintptr_t ptr); + +/* Get the traceback where a memory block was allocated. + + Return a tuple of (filename: str, lineno: int) tuples. + + Return None if the tracemalloc module is disabled or if the memory block + is not tracked by tracemalloc. + + Raise an exception and return NULL on error. */ +PyAPI_FUNC(PyObject*) + _PyTraceMalloc_GetTraceback(_PyTraceMalloc_domain_t domain, uintptr_t ptr); +#endif /* !Py_LIMITED_API */ + +/* BEWARE: + + Each interface exports both functions and macros. Extension modules should + use the functions, to ensure binary compatibility across Python versions. + Because the Python implementation is free to change internal details, and + the macros may (or may not) expose details for speed, if you do use the + macros you must recompile your extensions with each Python release. + + Never mix calls to PyMem_ with calls to the platform malloc/realloc/ + calloc/free. For example, on Windows different DLLs may end up using + different heaps, and if you use PyMem_Malloc you'll get the memory from the + heap used by the Python DLL; it could be a disaster if you free()'ed that + directly in your own extension. Using PyMem_Free instead ensures Python + can return the memory to the proper heap. As another example, in + PYMALLOC_DEBUG mode, Python wraps all calls to all PyMem_ and PyObject_ + memory functions in special debugging wrappers that add additional + debugging info to dynamic memory blocks. The system routines have no idea + what to do with that stuff, and the Python wrappers have no idea what to do + with raw blocks obtained directly by the system routines then. + + The GIL must be held when using these APIs. +*/ + +/* + * Raw memory interface + * ==================== + */ + +/* Functions + + Functions supplying platform-independent semantics for malloc/realloc/ + free. These functions make sure that allocating 0 bytes returns a distinct + non-NULL pointer (whenever possible -- if we're flat out of memory, NULL + may be returned), even if the platform malloc and realloc don't. + Returned pointers must be checked for NULL explicitly. No action is + performed on failure (no exception is set, no warning is printed, etc). +*/ + +PyAPI_FUNC(void*) PyMem_Malloc(size_t size); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03050000 +PyAPI_FUNC(void*) PyMem_Calloc(size_t nelem, size_t elsize); +#endif +PyAPI_FUNC(void*) PyMem_Realloc(void* ptr, size_t new_size); +PyAPI_FUNC(void) PyMem_Free(void* ptr); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(char*) _PyMem_RawStrdup(const char* str); +PyAPI_FUNC(char*) _PyMem_Strdup(const char* str); +#endif + +/* Macros. */ + +/* PyMem_MALLOC(0) means malloc(1). Some systems would return NULL + for malloc(0), which would be treated as an error. Some platforms + would return a pointer with no memory behind it, which would break + pymalloc. To solve these problems, allocate an extra byte. */ +/* Returns NULL to indicate error if a negative size or size larger than + Py_ssize_t can represent is supplied. Helps prevents security holes. */ +#define PyMem_MALLOC(n) PyMem_Malloc(n) +#define PyMem_REALLOC(p, n) PyMem_Realloc(p, n) +#define PyMem_FREE(p) PyMem_Free(p) + +/* + * Type-oriented memory interface + * ============================== + * + * Allocate memory for n objects of the given type. Returns a new pointer + * or NULL if the request was too large or memory allocation failed. Use + * these macros rather than doing the multiplication yourself so that proper + * overflow checking is always done. + */ + +#define PyMem_New(type, n) \ + (((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) \ + ? NULL \ + : ((type*)PyMem_Malloc((n) * sizeof(type)))) +#define PyMem_NEW(type, n) \ + (((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) \ + ? NULL \ + : ((type*)PyMem_MALLOC((n) * sizeof(type)))) + +/* + * The value of (p) is always clobbered by this macro regardless of success. + * The caller MUST check if (p) is NULL afterwards and deal with the memory + * error if so. This means the original value of (p) MUST be saved for the + * caller's memory error handler to not lose track of it. + */ +#define PyMem_Resize(p, type, n) \ + ((p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) \ + ? NULL \ + : (type*)PyMem_Realloc((p), (n) * sizeof(type))) +#define PyMem_RESIZE(p, type, n) \ + ((p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) \ + ? NULL \ + : (type*)PyMem_REALLOC((p), (n) * sizeof(type))) + +/* PyMem{Del,DEL} are left over from ancient days, and shouldn't be used + * anymore. They're just confusing aliases for PyMem_{Free,FREE} now. + */ +#define PyMem_Del PyMem_Free +#define PyMem_DEL PyMem_FREE + +#ifndef Py_LIMITED_API +typedef enum { + /* PyMem_RawMalloc(), PyMem_RawRealloc() and PyMem_RawFree() */ + PYMEM_DOMAIN_RAW, + + /* PyMem_Malloc(), PyMem_Realloc() and PyMem_Free() */ + PYMEM_DOMAIN_MEM, + + /* PyObject_Malloc(), PyObject_Realloc() and PyObject_Free() */ + PYMEM_DOMAIN_OBJ +} PyMemAllocatorDomain; + +typedef struct { + /* user context passed as the first argument to the 4 functions */ + void* ctx; + + /* allocate a memory block */ + void* (*malloc)(void* ctx, size_t size); + + /* allocate a memory block initialized by zeros */ + void* (*calloc)(void* ctx, size_t nelem, size_t elsize); + + /* allocate or resize a memory block */ + void* (*realloc)(void* ctx, void* ptr, size_t new_size); + + /* release a memory block */ + void (*free)(void* ctx, void* ptr); +} PyMemAllocatorEx; + +/* Get the memory block allocator of the specified domain. */ +PyAPI_FUNC(void) PyMem_GetAllocator( + PyMemAllocatorDomain domain, + PyMemAllocatorEx* allocator); + +/* Set the memory block allocator of the specified domain. + + The new allocator must return a distinct non-NULL pointer when requesting + zero bytes. + + For the PYMEM_DOMAIN_RAW domain, the allocator must be thread-safe: the GIL + is not held when the allocator is called. + + If the new allocator is not a hook (don't call the previous allocator), the + PyMem_SetupDebugHooks() function must be called to reinstall the debug hooks + on top on the new allocator. */ +PyAPI_FUNC(void) PyMem_SetAllocator( + PyMemAllocatorDomain domain, + PyMemAllocatorEx* allocator); + +/* Setup hooks to detect bugs in the following Python memory allocator + functions: + + - PyMem_RawMalloc(), PyMem_RawRealloc(), PyMem_RawFree() + - PyMem_Malloc(), PyMem_Realloc(), PyMem_Free() + - PyObject_Malloc(), PyObject_Realloc() and PyObject_Free() + + Newly allocated memory is filled with the byte 0xCB, freed memory is filled + with the byte 0xDB. Additionnal checks: + + - detect API violations, ex: PyObject_Free() called on a buffer allocated + by PyMem_Malloc() + - detect write before the start of the buffer (buffer underflow) + - detect write after the end of the buffer (buffer overflow) + + The function does nothing if Python is not compiled is debug mode. */ +PyAPI_FUNC(void) PyMem_SetupDebugHooks(void); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* !Py_PYMEM_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyport.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyport.h new file mode 100644 index 0000000..6d67f00 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pyport.h @@ -0,0 +1,768 @@ +#ifndef Py_PYPORT_H +#define Py_PYPORT_H + +#include "pyconfig.h" /* include for defines */ + +#include + +/************************************************************************** +Symbols and macros to supply platform-independent interfaces to basic +C language & library operations whose spellings vary across platforms. + +Please try to make documentation here as clear as possible: by definition, +the stuff here is trying to illuminate C's darkest corners. + +Config #defines referenced here: + +SIGNED_RIGHT_SHIFT_ZERO_FILLS +Meaning: To be defined iff i>>j does not extend the sign bit when i is a + signed integral type and i < 0. +Used in: Py_ARITHMETIC_RIGHT_SHIFT + +Py_DEBUG +Meaning: Extra checks compiled in for debug mode. +Used in: Py_SAFE_DOWNCAST + +**************************************************************************/ + +/* typedefs for some C9X-defined synonyms for integral types. + * + * The names in Python are exactly the same as the C9X names, except with a + * Py_ prefix. Until C9X is universally implemented, this is the only way + * to ensure that Python gets reliable names that don't conflict with names + * in non-Python code that are playing their own tricks to define the C9X + * names. + * + * NOTE: don't go nuts here! Python has no use for *most* of the C9X + * integral synonyms. Only define the ones we actually need. + */ + +/* long long is required. Ensure HAVE_LONG_LONG is defined for compatibility. */ +#ifndef HAVE_LONG_LONG +#define HAVE_LONG_LONG 1 +#endif +#ifndef PY_LONG_LONG +#define PY_LONG_LONG long long +/* If LLONG_MAX is defined in limits.h, use that. */ +#define PY_LLONG_MIN LLONG_MIN +#define PY_LLONG_MAX LLONG_MAX +#define PY_ULLONG_MAX ULLONG_MAX +#endif + +#define PY_UINT32_T uint32_t +#define PY_UINT64_T uint64_t + +/* Signed variants of the above */ +#define PY_INT32_T int32_t +#define PY_INT64_T int64_t + +/* If PYLONG_BITS_IN_DIGIT is not defined then we'll use 30-bit digits if all + the necessary integer types are available, and we're on a 64-bit platform + (as determined by SIZEOF_VOID_P); otherwise we use 15-bit digits. */ + +#ifndef PYLONG_BITS_IN_DIGIT +#if SIZEOF_VOID_P >= 8 +#define PYLONG_BITS_IN_DIGIT 30 +#else +#define PYLONG_BITS_IN_DIGIT 15 +#endif +#endif + +/* uintptr_t is the C9X name for an unsigned integral type such that a + * legitimate void* can be cast to uintptr_t and then back to void* again + * without loss of information. Similarly for intptr_t, wrt a signed + * integral type. + */ +typedef uintptr_t Py_uintptr_t; +typedef intptr_t Py_intptr_t; + +/* Py_ssize_t is a signed integral type such that sizeof(Py_ssize_t) == + * sizeof(size_t). C99 doesn't define such a thing directly (size_t is an + * unsigned integral type). See PEP 353 for details. + */ +#ifdef HAVE_SSIZE_T +typedef ssize_t Py_ssize_t; +#elif SIZEOF_VOID_P == SIZEOF_SIZE_T +typedef Py_intptr_t Py_ssize_t; +#else +#error "Python needs a typedef for Py_ssize_t in pyport.h." +#endif + +/* Py_hash_t is the same size as a pointer. */ +#define SIZEOF_PY_HASH_T SIZEOF_SIZE_T +typedef Py_ssize_t Py_hash_t; +/* Py_uhash_t is the unsigned equivalent needed to calculate numeric hash. */ +#define SIZEOF_PY_UHASH_T SIZEOF_SIZE_T +typedef size_t Py_uhash_t; + +/* Only used for compatibility with code that may not be PY_SSIZE_T_CLEAN. */ +#ifdef PY_SSIZE_T_CLEAN +typedef Py_ssize_t Py_ssize_clean_t; +#else +typedef int Py_ssize_clean_t; +#endif + +/* Largest possible value of size_t. */ +#define PY_SIZE_MAX SIZE_MAX + +/* Largest positive value of type Py_ssize_t. */ +#define PY_SSIZE_T_MAX ((Py_ssize_t)(((size_t)-1) >> 1)) +/* Smallest negative value of type Py_ssize_t. */ +#define PY_SSIZE_T_MIN (-PY_SSIZE_T_MAX - 1) + +/* PY_FORMAT_SIZE_T is a platform-specific modifier for use in a printf + * format to convert an argument with the width of a size_t or Py_ssize_t. + * C99 introduced "z" for this purpose, but not all platforms support that; + * e.g., MS compilers use "I" instead. + * + * These "high level" Python format functions interpret "z" correctly on + * all platforms (Python interprets the format string itself, and does whatever + * the platform C requires to convert a size_t/Py_ssize_t argument): + * + * PyBytes_FromFormat + * PyErr_Format + * PyBytes_FromFormatV + * PyUnicode_FromFormatV + * + * Lower-level uses require that you interpolate the correct format modifier + * yourself (e.g., calling printf, fprintf, sprintf, PyOS_snprintf); for + * example, + * + * Py_ssize_t index; + * fprintf(stderr, "index %" PY_FORMAT_SIZE_T "d sucks\n", index); + * + * That will expand to %ld, or %Id, or to something else correct for a + * Py_ssize_t on the platform. + */ +#ifndef PY_FORMAT_SIZE_T +#if SIZEOF_SIZE_T == SIZEOF_INT && !defined(__APPLE__) +#define PY_FORMAT_SIZE_T "" +#elif SIZEOF_SIZE_T == SIZEOF_LONG +#define PY_FORMAT_SIZE_T "l" +#elif defined(MS_WINDOWS) +#define PY_FORMAT_SIZE_T "I" +#else +#error "This platform's pyconfig.h needs to define PY_FORMAT_SIZE_T" +#endif +#endif + +/* Py_LOCAL can be used instead of static to get the fastest possible calling + * convention for functions that are local to a given module. + * + * Py_LOCAL_INLINE does the same thing, and also explicitly requests inlining, + * for platforms that support that. + * + * If PY_LOCAL_AGGRESSIVE is defined before python.h is included, more + * "aggressive" inlining/optimization is enabled for the entire module. This + * may lead to code bloat, and may slow things down for those reasons. It may + * also lead to errors, if the code relies on pointer aliasing. Use with + * care. + * + * NOTE: You can only use this for functions that are entirely local to a + * module; functions that are exported via method tables, callbacks, etc, + * should keep using static. + */ + +#if defined(_MSC_VER) +#if defined(PY_LOCAL_AGGRESSIVE) +/* enable more aggressive optimization for visual studio */ +#pragma optimize("agtw", on) +#endif +/* ignore warnings if the compiler decides not to inline a function */ +#pragma warning(disable : 4710) +/* fastest possible local call under MSVC */ +#define Py_LOCAL(type) static type __fastcall +#define Py_LOCAL_INLINE(type) static __inline type __fastcall +#elif defined(USE_INLINE) +#define Py_LOCAL(type) static type +#define Py_LOCAL_INLINE(type) static inline type +#else +#define Py_LOCAL(type) static type +#define Py_LOCAL_INLINE(type) static type +#endif + +/* Py_MEMCPY is kept for backwards compatibility, + * see https://bugs.python.org/issue28126 */ +#define Py_MEMCPY memcpy + +#include + +#ifdef HAVE_IEEEFP_H +#include /* needed for 'finite' declaration on some platforms */ +#endif + +#include /* Moved here from the math section, before extern "C" */ + +/******************************************** + * WRAPPER FOR and/or * + ********************************************/ + +#ifdef TIME_WITH_SYS_TIME +#include +#include +#else /* !TIME_WITH_SYS_TIME */ +#ifdef HAVE_SYS_TIME_H +#include +#else /* !HAVE_SYS_TIME_H */ +#include +#endif /* !HAVE_SYS_TIME_H */ +#endif /* !TIME_WITH_SYS_TIME */ + +/****************************** + * WRAPPER FOR * + ******************************/ + +/* NB caller must include */ + +#ifdef HAVE_SYS_SELECT_H +#include +#endif /* !HAVE_SYS_SELECT_H */ + +/******************************* + * stat() and fstat() fiddling * + *******************************/ + +#ifdef HAVE_SYS_STAT_H +#include +#elif defined(HAVE_STAT_H) +#include +#endif + +#ifndef S_IFMT +/* VisualAge C/C++ Failed to Define MountType Field in sys/stat.h */ +#define S_IFMT 0170000 +#endif + +#ifndef S_IFLNK +/* Windows doesn't define S_IFLNK but posixmodule.c maps + * IO_REPARSE_TAG_SYMLINK to S_IFLNK */ +#define S_IFLNK 0120000 +#endif + +#ifndef S_ISREG +#define S_ISREG(x) (((x)&S_IFMT) == S_IFREG) +#endif + +#ifndef S_ISDIR +#define S_ISDIR(x) (((x)&S_IFMT) == S_IFDIR) +#endif + +#ifndef S_ISCHR +#define S_ISCHR(x) (((x)&S_IFMT) == S_IFCHR) +#endif + +#ifdef __cplusplus +/* Move this down here since some C++ #include's don't like to be included + inside an extern "C" */ +extern "C" { +#endif + +/* Py_ARITHMETIC_RIGHT_SHIFT + * C doesn't define whether a right-shift of a signed integer sign-extends + * or zero-fills. Here a macro to force sign extension: + * Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) + * Return I >> J, forcing sign extension. Arithmetically, return the + * floor of I/2**J. + * Requirements: + * I should have signed integer type. In the terminology of C99, this can + * be either one of the five standard signed integer types (signed char, + * short, int, long, long long) or an extended signed integer type. + * J is an integer >= 0 and strictly less than the number of bits in the + * type of I (because C doesn't define what happens for J outside that + * range either). + * TYPE used to specify the type of I, but is now ignored. It's been left + * in for backwards compatibility with versions <= 2.6 or 3.0. + * Caution: + * I may be evaluated more than once. + */ +#ifdef SIGNED_RIGHT_SHIFT_ZERO_FILLS +#define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) \ + ((I) < 0 ? -1 - ((-1 - (I)) >> (J)) : (I) >> (J)) +#else +#define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) ((I) >> (J)) +#endif + +/* Py_FORCE_EXPANSION(X) + * "Simply" returns its argument. However, macro expansions within the + * argument are evaluated. This unfortunate trickery is needed to get + * token-pasting to work as desired in some cases. + */ +#define Py_FORCE_EXPANSION(X) X + +/* Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) + * Cast VALUE to type NARROW from type WIDE. In Py_DEBUG mode, this + * assert-fails if any information is lost. + * Caution: + * VALUE may be evaluated more than once. + */ +#ifdef Py_DEBUG +#define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) \ + (assert((WIDE)(NARROW)(VALUE) == (VALUE)), (NARROW)(VALUE)) +#else +#define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) (NARROW)(VALUE) +#endif + +/* Py_SET_ERRNO_ON_MATH_ERROR(x) + * If a libm function did not set errno, but it looks like the result + * overflowed or not-a-number, set errno to ERANGE or EDOM. Set errno + * to 0 before calling a libm function, and invoke this macro after, + * passing the function result. + * Caution: + * This isn't reliable. See Py_OVERFLOWED comments. + * X is evaluated more than once. + */ +#if defined(__FreeBSD__) || defined(__OpenBSD__) || \ + (defined(__hpux) && defined(__ia64)) +#define _Py_SET_EDOM_FOR_NAN(X) \ + if (isnan(X)) \ + errno = EDOM; +#else +#define _Py_SET_EDOM_FOR_NAN(X) ; +#endif +#define Py_SET_ERRNO_ON_MATH_ERROR(X) \ + do { \ + if (errno == 0) { \ + if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \ + errno = ERANGE; \ + else \ + _Py_SET_EDOM_FOR_NAN(X) \ + } \ + } while (0) + +/* Py_SET_ERANGE_ON_OVERFLOW(x) + * An alias of Py_SET_ERRNO_ON_MATH_ERROR for backward-compatibility. + */ +#define Py_SET_ERANGE_IF_OVERFLOW(X) Py_SET_ERRNO_ON_MATH_ERROR(X) + +/* Py_ADJUST_ERANGE1(x) + * Py_ADJUST_ERANGE2(x, y) + * Set errno to 0 before calling a libm function, and invoke one of these + * macros after, passing the function result(s) (Py_ADJUST_ERANGE2 is useful + * for functions returning complex results). This makes two kinds of + * adjustments to errno: (A) If it looks like the platform libm set + * errno=ERANGE due to underflow, clear errno. (B) If it looks like the + * platform libm overflowed but didn't set errno, force errno to ERANGE. In + * effect, we're trying to force a useful implementation of C89 errno + * behavior. + * Caution: + * This isn't reliable. See Py_OVERFLOWED comments. + * X and Y may be evaluated more than once. + */ +#define Py_ADJUST_ERANGE1(X) \ + do { \ + if (errno == 0) { \ + if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \ + errno = ERANGE; \ + } else if (errno == ERANGE && (X) == 0.0) \ + errno = 0; \ + } while (0) + +#define Py_ADJUST_ERANGE2(X, Y) \ + do { \ + if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL || (Y) == Py_HUGE_VAL || \ + (Y) == -Py_HUGE_VAL) { \ + if (errno == 0) \ + errno = ERANGE; \ + } else if (errno == ERANGE) \ + errno = 0; \ + } while (0) + +/* The functions _Py_dg_strtod and _Py_dg_dtoa in Python/dtoa.c (which are + * required to support the short float repr introduced in Python 3.1) require + * that the floating-point unit that's being used for arithmetic operations + * on C doubles is set to use 53-bit precision. It also requires that the + * FPU rounding mode is round-half-to-even, but that's less often an issue. + * + * If your FPU isn't already set to 53-bit precision/round-half-to-even, and + * you want to make use of _Py_dg_strtod and _Py_dg_dtoa, then you should + * + * #define HAVE_PY_SET_53BIT_PRECISION 1 + * + * and also give appropriate definitions for the following three macros: + * + * _PY_SET_53BIT_PRECISION_START : store original FPU settings, and + * set FPU to 53-bit precision/round-half-to-even + * _PY_SET_53BIT_PRECISION_END : restore original FPU settings + * _PY_SET_53BIT_PRECISION_HEADER : any variable declarations needed to + * use the two macros above. + * + * The macros are designed to be used within a single C function: see + * Python/pystrtod.c for an example of their use. + */ + +/* get and set x87 control word for gcc/x86 */ +#ifdef HAVE_GCC_ASM_FOR_X87 +#define HAVE_PY_SET_53BIT_PRECISION 1 +/* _Py_get/set_387controlword functions are defined in Python/pymath.c */ +#define _Py_SET_53BIT_PRECISION_HEADER \ + unsigned short old_387controlword, new_387controlword +#define _Py_SET_53BIT_PRECISION_START \ + do { \ + old_387controlword = _Py_get_387controlword(); \ + new_387controlword = (old_387controlword & ~0x0f00) | 0x0200; \ + if (new_387controlword != old_387controlword) \ + _Py_set_387controlword(new_387controlword); \ + } while (0) +#define _Py_SET_53BIT_PRECISION_END \ + if (new_387controlword != old_387controlword) \ + _Py_set_387controlword(old_387controlword) +#endif + +/* get and set x87 control word for VisualStudio/x86 */ +#if defined(_MSC_VER) && !defined(_WIN64) /* x87 not supported in 64-bit */ +#define HAVE_PY_SET_53BIT_PRECISION 1 +#define _Py_SET_53BIT_PRECISION_HEADER \ + unsigned int old_387controlword, new_387controlword, out_387controlword +/* We use the __control87_2 function to set only the x87 control word. + The SSE control word is unaffected. */ +#define _Py_SET_53BIT_PRECISION_START \ + do { \ + __control87_2(0, 0, &old_387controlword, NULL); \ + new_387controlword = \ + (old_387controlword & ~(_MCW_PC | _MCW_RC)) | (_PC_53 | _RC_NEAR); \ + if (new_387controlword != old_387controlword) \ + __control87_2( \ + new_387controlword, _MCW_PC | _MCW_RC, &out_387controlword, NULL); \ + } while (0) +#define _Py_SET_53BIT_PRECISION_END \ + do { \ + if (new_387controlword != old_387controlword) \ + __control87_2( \ + old_387controlword, _MCW_PC | _MCW_RC, &out_387controlword, NULL); \ + } while (0) +#endif + +#ifdef HAVE_GCC_ASM_FOR_MC68881 +#define HAVE_PY_SET_53BIT_PRECISION 1 +#define _Py_SET_53BIT_PRECISION_HEADER unsigned int old_fpcr, new_fpcr +#define _Py_SET_53BIT_PRECISION_START \ + do { \ + __asm__("fmove.l %%fpcr,%0" : "=g"(old_fpcr)); \ + /* Set double precision / round to nearest. */ \ + new_fpcr = (old_fpcr & ~0xf0) | 0x80; \ + if (new_fpcr != old_fpcr) \ + __asm__ volatile("fmove.l %0,%%fpcr" : : "g"(new_fpcr)); \ + } while (0) +#define _Py_SET_53BIT_PRECISION_END \ + do { \ + if (new_fpcr != old_fpcr) \ + __asm__ volatile("fmove.l %0,%%fpcr" : : "g"(old_fpcr)); \ + } while (0) +#endif + +/* default definitions are empty */ +#ifndef HAVE_PY_SET_53BIT_PRECISION +#define _Py_SET_53BIT_PRECISION_HEADER +#define _Py_SET_53BIT_PRECISION_START +#define _Py_SET_53BIT_PRECISION_END +#endif + +/* If we can't guarantee 53-bit precision, don't use the code + in Python/dtoa.c, but fall back to standard code. This + means that repr of a float will be long (17 sig digits). + + Realistically, there are two things that could go wrong: + + (1) doubles aren't IEEE 754 doubles, or + (2) we're on x86 with the rounding precision set to 64-bits + (extended precision), and we don't know how to change + the rounding precision. + */ + +#if !defined(DOUBLE_IS_LITTLE_ENDIAN_IEEE754) && \ + !defined(DOUBLE_IS_BIG_ENDIAN_IEEE754) && \ + !defined(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754) +#define PY_NO_SHORT_FLOAT_REPR +#endif + +/* double rounding is symptomatic of use of extended precision on x86. If + we're seeing double rounding, and we don't have any mechanism available for + changing the FPU rounding precision, then don't use Python/dtoa.c. */ +#if defined(X87_DOUBLE_ROUNDING) && !defined(HAVE_PY_SET_53BIT_PRECISION) +#define PY_NO_SHORT_FLOAT_REPR +#endif + +/* Py_DEPRECATED(version) + * Declare a variable, type, or function deprecated. + * Usage: + * extern int old_var Py_DEPRECATED(2.3); + * typedef int T1 Py_DEPRECATED(2.4); + * extern int x() Py_DEPRECATED(2.5); + */ +#if defined(__GNUC__) && \ + ((__GNUC__ >= 4) || (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)) +#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__)) +#else +#define Py_DEPRECATED(VERSION_UNUSED) +#endif + +/************************************************************************** +Prototypes that are missing from the standard include files on some systems +(and possibly only some versions of such systems.) + +Please be conservative with adding new ones, document them and enclose them +in platform-specific #ifdefs. +**************************************************************************/ + +#ifdef SOLARIS +/* Unchecked */ +extern int gethostname(char*, int); +#endif + +#ifdef HAVE__GETPTY +#include /* we need to import mode_t */ +extern char* _getpty(int*, int, mode_t, int); +#endif + +/* On QNX 6, struct termio must be declared by including sys/termio.h + if TCGETA, TCSETA, TCSETAW, or TCSETAF are used. sys/termio.h must + be included before termios.h or it will generate an error. */ +#if defined(HAVE_SYS_TERMIO_H) && !defined(__hpux) +#include +#endif + +#if defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) +#if !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) +/* BSDI does not supply a prototype for the 'openpty' and 'forkpty' + functions, even though they are included in libutil. */ +#include +extern int openpty(int*, int*, char*, struct termios*, struct winsize*); +extern pid_t forkpty(int*, char*, struct termios*, struct winsize*); +#endif /* !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) */ +#endif /* defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) */ + +/* On 4.4BSD-descendants, ctype functions serves the whole range of + * wchar_t character set rather than single byte code points only. + * This characteristic can break some operations of string object + * including str.upper() and str.split() on UTF-8 locales. This + * workaround was provided by Tim Robbins of FreeBSD project. + */ + +#ifdef __FreeBSD__ +#include +#if (__FreeBSD_version >= 500040 && __FreeBSD_version < 602113) || \ + (__FreeBSD_version >= 700000 && __FreeBSD_version < 700054) || \ + (__FreeBSD_version >= 800000 && __FreeBSD_version < 800001) +#define _PY_PORT_CTYPE_UTF8_ISSUE +#endif +#endif + +#if defined(__APPLE__) +#define _PY_PORT_CTYPE_UTF8_ISSUE +#endif + +#ifdef _PY_PORT_CTYPE_UTF8_ISSUE +#ifndef __cplusplus +/* The workaround below is unsafe in C++ because + * the defines these symbols as real functions, + * with a slightly different signature. + * See issue #10910 + */ +#include +#include +#undef isalnum +#define isalnum(c) iswalnum(btowc(c)) +#undef isalpha +#define isalpha(c) iswalpha(btowc(c)) +#undef islower +#define islower(c) iswlower(btowc(c)) +#undef isspace +#define isspace(c) iswspace(btowc(c)) +#undef isupper +#define isupper(c) iswupper(btowc(c)) +#undef tolower +#define tolower(c) towlower(btowc(c)) +#undef toupper +#define toupper(c) towupper(btowc(c)) +#endif +#endif + +/* Declarations for symbol visibility. + + PyAPI_FUNC(type): Declares a public Python API function and return type + PyAPI_DATA(type): Declares public Python data and its type + PyMODINIT_FUNC: A Python module init function. If these functions are + inside the Python core, they are private to the core. + If in an extension module, it may be declared with + external linkage depending on the platform. + + As a number of platforms support/require "__declspec(dllimport/dllexport)", + we support a HAVE_DECLSPEC_DLL macro to save duplication. +*/ + +/* + All windows ports, except cygwin, are handled in PC/pyconfig.h. + + Cygwin is the only other autoconf platform requiring special + linkage handling and it uses __declspec(). +*/ +#if defined(__CYGWIN__) +#define HAVE_DECLSPEC_DLL +#endif + +/* only get special linkage if built as shared or platform is Cygwin */ +#if defined(Py_ENABLE_SHARED) || defined(__CYGWIN__) +#if defined(HAVE_DECLSPEC_DLL) +#ifdef Py_BUILD_CORE +#define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE +#define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE +/* module init functions inside the core need no external linkage */ +/* except for Cygwin to handle embedding */ +#if defined(__CYGWIN__) +#define PyMODINIT_FUNC __declspec(dllexport) PyObject* +#else /* __CYGWIN__ */ +#define PyMODINIT_FUNC PyObject* +#endif /* __CYGWIN__ */ +#else /* Py_BUILD_CORE */ +/* Building an extension module, or an embedded situation */ +/* public Python functions and data are imported */ +/* Under Cygwin, auto-import functions to prevent compilation */ +/* failures similar to those described at the bottom of 4.1: */ +/* http://docs.python.org/extending/windows.html#a-cookbook-approach */ +#if !defined(__CYGWIN__) +#define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE +#endif /* !__CYGWIN__ */ +#define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE +/* module init functions outside the core must be exported */ +#if defined(__cplusplus) +#define PyMODINIT_FUNC extern "C" __declspec(dllexport) PyObject* +#else /* __cplusplus */ +#define PyMODINIT_FUNC __declspec(dllexport) PyObject* +#endif /* __cplusplus */ +#endif /* Py_BUILD_CORE */ +#endif /* HAVE_DECLSPEC */ +#endif /* Py_ENABLE_SHARED */ + +/* If no external linkage macros defined by now, create defaults */ +#ifndef PyAPI_FUNC +#define PyAPI_FUNC(RTYPE) RTYPE +#endif +#ifndef PyAPI_DATA +#define PyAPI_DATA(RTYPE) extern RTYPE +#endif +#ifndef PyMODINIT_FUNC +#if defined(__cplusplus) +#define PyMODINIT_FUNC extern "C" PyObject* +#else /* __cplusplus */ +#define PyMODINIT_FUNC PyObject* +#endif /* __cplusplus */ +#endif + +/* limits.h constants that may be missing */ + +#ifndef INT_MAX +#define INT_MAX 2147483647 +#endif + +#ifndef LONG_MAX +#if SIZEOF_LONG == 4 +#define LONG_MAX 0X7FFFFFFFL +#elif SIZEOF_LONG == 8 +#define LONG_MAX 0X7FFFFFFFFFFFFFFFL +#else +#error "could not set LONG_MAX in pyport.h" +#endif +#endif + +#ifndef LONG_MIN +#define LONG_MIN (-LONG_MAX - 1) +#endif + +#ifndef LONG_BIT +#define LONG_BIT (8 * SIZEOF_LONG) +#endif + +#if LONG_BIT != 8 * SIZEOF_LONG +/* 04-Oct-2000 LONG_BIT is apparently (mis)defined as 64 on some recent + * 32-bit platforms using gcc. We try to catch that here at compile-time + * rather than waiting for integer multiplication to trigger bogus + * overflows. + */ +#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)." +#endif + +#ifdef __cplusplus +} +#endif + +/* + * Hide GCC attributes from compilers that don't support them. + */ +#if ( \ + !defined(__GNUC__) || __GNUC__ < 2 || \ + (__GNUC__ == 2 && __GNUC_MINOR__ < 7)) +#define Py_GCC_ATTRIBUTE(x) +#else +#define Py_GCC_ATTRIBUTE(x) __attribute__(x) +#endif + +/* + * Specify alignment on compilers that support it. + */ +#if defined(__GNUC__) && __GNUC__ >= 3 +#define Py_ALIGNED(x) __attribute__((aligned(x))) +#else +#define Py_ALIGNED(x) +#endif + +/* Eliminate end-of-loop code not reached warnings from SunPro C + * when using do{...}while(0) macros + */ +#ifdef __SUNPRO_C +#pragma error_messages(off, E_END_OF_LOOP_CODE_NOT_REACHED) +#endif + +#ifndef Py_LL +#define Py_LL(x) x##LL +#endif + +#ifndef Py_ULL +#define Py_ULL(x) Py_LL(x##U) +#endif + +#define Py_VA_COPY va_copy + +/* + * Convenient macros to deal with endianness of the platform. WORDS_BIGENDIAN is + * detected by configure and defined in pyconfig.h. The code in pyconfig.h + * also takes care of Apple's universal builds. + */ + +#ifdef WORDS_BIGENDIAN +#define PY_BIG_ENDIAN 1 +#define PY_LITTLE_ENDIAN 0 +#else +#define PY_BIG_ENDIAN 0 +#define PY_LITTLE_ENDIAN 1 +#endif + +#ifdef Py_BUILD_CORE +/* + * Macros to protect CRT calls against instant termination when passed an + * invalid parameter (issue23524). + */ +#if defined _MSC_VER && _MSC_VER >= 1900 + +extern _invalid_parameter_handler _Py_silent_invalid_parameter_handler; +#define _Py_BEGIN_SUPPRESS_IPH \ + { \ + _invalid_parameter_handler _Py_old_handler = \ + _set_thread_local_invalid_parameter_handler( \ + _Py_silent_invalid_parameter_handler); +#define _Py_END_SUPPRESS_IPH \ + _set_thread_local_invalid_parameter_handler(_Py_old_handler); \ + } + +#else + +#define _Py_BEGIN_SUPPRESS_IPH +#define _Py_END_SUPPRESS_IPH + +#endif /* _MSC_VER >= 1900 */ +#endif /* Py_BUILD_CORE */ + +#ifdef __ANDROID__ +#include +#endif + +#endif /* Py_PYPORT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pystate.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pystate.h new file mode 100644 index 0000000..58e7c9c --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pystate.h @@ -0,0 +1,318 @@ + +/* Thread and interpreter state structures and their interfaces */ + +#ifndef Py_PYSTATE_H +#define Py_PYSTATE_H +#ifdef __cplusplus +extern "C" { +#endif + +/* This limitation is for performance and simplicity. If needed it can be +removed (with effort). */ +#define MAX_CO_EXTRA_USERS 255 + +/* State shared between threads */ + +struct _ts; /* Forward */ +struct _is; /* Forward */ +struct _frame; /* Forward declaration for PyFrameObject. */ + +#ifdef Py_LIMITED_API +typedef struct _is PyInterpreterState; +#else +typedef PyObject* (*_PyFrameEvalFunction)(struct _frame*, int); + +typedef struct _is { + struct _is* next; + struct _ts* tstate_head; + + PyObject* modules; + PyObject* modules_by_index; + PyObject* sysdict; + PyObject* builtins; + PyObject* importlib; + + PyObject* codec_search_path; + PyObject* codec_search_cache; + PyObject* codec_error_registry; + int codecs_initialized; + int fscodec_initialized; + +#ifdef HAVE_DLOPEN + int dlopenflags; +#endif + + PyObject* builtins_copy; + PyObject* import_func; + /* Initialized to PyEval_EvalFrameDefault(). */ + _PyFrameEvalFunction eval_frame; +} PyInterpreterState; +#endif + +typedef struct _co_extra_state { + struct _co_extra_state* next; + PyInterpreterState* interp; + + Py_ssize_t co_extra_user_count; + freefunc co_extra_freefuncs[MAX_CO_EXTRA_USERS]; +} __PyCodeExtraState; + +/* This is temporary for backwards compat in 3.6 and will be removed in 3.7 */ +__PyCodeExtraState* __PyCodeExtraState_Get(void); + +/* State unique per thread */ + +#ifndef Py_LIMITED_API +/* Py_tracefunc return -1 when raising an exception, or 0 for success. */ +typedef int (*Py_tracefunc)(PyObject*, struct _frame*, int, PyObject*); + +/* The following values are used for 'what' for tracefunc functions: */ +#define PyTrace_CALL 0 +#define PyTrace_EXCEPTION 1 +#define PyTrace_LINE 2 +#define PyTrace_RETURN 3 +#define PyTrace_C_CALL 4 +#define PyTrace_C_EXCEPTION 5 +#define PyTrace_C_RETURN 6 +#endif + +#ifdef Py_LIMITED_API +typedef struct _ts PyThreadState; +#else +typedef struct _ts { + /* See Python/ceval.c for comments explaining most fields */ + + struct _ts* prev; + struct _ts* next; + PyInterpreterState* interp; + + struct _frame* frame; + int recursion_depth; + char overflowed; /* The stack has overflowed. Allow 50 more calls + to handle the runtime error. */ + char recursion_critical; /* The current calls must not cause + a stack overflow. */ + /* 'tracing' keeps track of the execution depth when tracing/profiling. + This is to prevent the actual trace/profile code from being recorded in + the trace/profile. */ + int tracing; + int use_tracing; + + Py_tracefunc c_profilefunc; + Py_tracefunc c_tracefunc; + PyObject* c_profileobj; + PyObject* c_traceobj; + + PyObject* curexc_type; + PyObject* curexc_value; + PyObject* curexc_traceback; + + PyObject* exc_type; + PyObject* exc_value; + PyObject* exc_traceback; + + PyObject* dict; /* Stores per-thread state */ + + int gilstate_counter; + + PyObject* async_exc; /* Asynchronous exception to raise */ + long thread_id; /* Thread id where this tstate was created */ + + int trash_delete_nesting; + PyObject* trash_delete_later; + + /* Called when a thread state is deleted normally, but not when it + * is destroyed after fork(). + * Pain: to prevent rare but fatal shutdown errors (issue 18808), + * Thread.join() must wait for the join'ed thread's tstate to be unlinked + * from the tstate chain. That happens at the end of a thread's life, + * in pystate.c. + * The obvious way doesn't quite work: create a lock which the tstate + * unlinking code releases, and have Thread.join() wait to acquire that + * lock. The problem is that we _are_ at the end of the thread's life: + * if the thread holds the last reference to the lock, decref'ing the + * lock will delete the lock, and that may trigger arbitrary Python code + * if there's a weakref, with a callback, to the lock. But by this time + * _PyThreadState_Current is already NULL, so only the simplest of C code + * can be allowed to run (in particular it must not be possible to + * release the GIL). + * So instead of holding the lock directly, the tstate holds a weakref to + * the lock: that's the value of on_delete_data below. Decref'ing a + * weakref is harmless. + * on_delete points to _threadmodule.c's static release_sentinel() function. + * After the tstate is unlinked, release_sentinel is called with the + * weakref-to-lock (on_delete_data) argument, and release_sentinel releases + * the indirectly held lock. + */ + void (*on_delete)(void*); + void* on_delete_data; + + PyObject* coroutine_wrapper; + int in_coroutine_wrapper; + + /* Now used from PyInterpreterState, kept here for ABI + compatibility with PyThreadState */ + Py_ssize_t _preserve_36_ABI_1; + freefunc _preserve_36_ABI_2[MAX_CO_EXTRA_USERS]; + + PyObject* async_gen_firstiter; + PyObject* async_gen_finalizer; + + /* XXX signal handlers should also be here */ + +} PyThreadState; +#endif + +PyAPI_FUNC(PyInterpreterState*) PyInterpreterState_New(void); +PyAPI_FUNC(void) PyInterpreterState_Clear(PyInterpreterState*); +PyAPI_FUNC(void) PyInterpreterState_Delete(PyInterpreterState*); +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _PyState_AddModule(PyObject*, struct PyModuleDef*); +#endif /* !Py_LIMITED_API */ +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03030000 +/* New in 3.3 */ +PyAPI_FUNC(int) PyState_AddModule(PyObject*, struct PyModuleDef*); +PyAPI_FUNC(int) PyState_RemoveModule(struct PyModuleDef*); +#endif +PyAPI_FUNC(PyObject*) PyState_FindModule(struct PyModuleDef*); +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) _PyState_ClearModules(void); +#endif + +PyAPI_FUNC(PyThreadState*) PyThreadState_New(PyInterpreterState*); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyThreadState*) _PyThreadState_Prealloc(PyInterpreterState*); +PyAPI_FUNC(void) _PyThreadState_Init(PyThreadState*); +#endif /* !Py_LIMITED_API */ +PyAPI_FUNC(void) PyThreadState_Clear(PyThreadState*); +PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState*); +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) _PyThreadState_DeleteExcept(PyThreadState* tstate); +#endif /* !Py_LIMITED_API */ +#ifdef WITH_THREAD +PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void); +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) _PyGILState_Reinit(void); +#endif /* !Py_LIMITED_API */ +#endif + +/* Return the current thread state. The global interpreter lock must be held. + * When the current thread state is NULL, this issues a fatal error (so that + * the caller needn't check for NULL). */ +PyAPI_FUNC(PyThreadState*) PyThreadState_Get(void); + +#ifndef Py_LIMITED_API +/* Similar to PyThreadState_Get(), but don't issue a fatal error + * if it is NULL. */ +PyAPI_FUNC(PyThreadState*) _PyThreadState_UncheckedGet(void); +#endif /* !Py_LIMITED_API */ + +PyAPI_FUNC(PyThreadState*) PyThreadState_Swap(PyThreadState*); +PyAPI_FUNC(PyObject*) PyThreadState_GetDict(void); +PyAPI_FUNC(int) PyThreadState_SetAsyncExc(long, PyObject*); + +/* Variable and macro for in-line access to current thread state */ + +/* Assuming the current thread holds the GIL, this is the + PyThreadState for the current thread. */ +#ifdef Py_BUILD_CORE +PyAPI_DATA(_Py_atomic_address) _PyThreadState_Current; +#define PyThreadState_GET() \ + ((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current)) +#else +#define PyThreadState_GET() PyThreadState_Get() +#endif + +typedef enum { PyGILState_LOCKED, PyGILState_UNLOCKED } PyGILState_STATE; + +#ifdef WITH_THREAD + +/* Ensure that the current thread is ready to call the Python + C API, regardless of the current state of Python, or of its + thread lock. This may be called as many times as desired + by a thread so long as each call is matched with a call to + PyGILState_Release(). In general, other thread-state APIs may + be used between _Ensure() and _Release() calls, so long as the + thread-state is restored to its previous state before the Release(). + For example, normal use of the Py_BEGIN_ALLOW_THREADS/ + Py_END_ALLOW_THREADS macros are acceptable. + + The return value is an opaque "handle" to the thread state when + PyGILState_Ensure() was called, and must be passed to + PyGILState_Release() to ensure Python is left in the same state. Even + though recursive calls are allowed, these handles can *not* be shared - + each unique call to PyGILState_Ensure must save the handle for its + call to PyGILState_Release. + + When the function returns, the current thread will hold the GIL. + + Failure is a fatal error. +*/ +PyAPI_FUNC(PyGILState_STATE) PyGILState_Ensure(void); + +/* Release any resources previously acquired. After this call, Python's + state will be the same as it was prior to the corresponding + PyGILState_Ensure() call (but generally this state will be unknown to + the caller, hence the use of the GILState API.) + + Every call to PyGILState_Ensure must be matched by a call to + PyGILState_Release on the same thread. +*/ +PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE); + +/* Helper/diagnostic function - get the current thread state for + this thread. May return NULL if no GILState API has been used + on the current thread. Note that the main thread always has such a + thread-state, even if no auto-thread-state call has been made + on the main thread. +*/ +PyAPI_FUNC(PyThreadState*) PyGILState_GetThisThreadState(void); + +#ifndef Py_LIMITED_API +/* Issue #26558: Flag to disable PyGILState_Check(). + If set to non-zero, PyGILState_Check() always return 1. */ +PyAPI_DATA(int) _PyGILState_check_enabled; + +/* Helper/diagnostic function - return 1 if the current thread + currently holds the GIL, 0 otherwise. + + The function returns 1 if _PyGILState_check_enabled is non-zero. */ +PyAPI_FUNC(int) PyGILState_Check(void); + +/* Unsafe function to get the single PyInterpreterState used by this process' + GILState implementation. + + Return NULL before _PyGILState_Init() is called and after _PyGILState_Fini() + is called. */ +PyAPI_FUNC(PyInterpreterState*) _PyGILState_GetInterpreterStateUnsafe(void); +#endif + +#endif /* #ifdef WITH_THREAD */ + +/* The implementation of sys._current_frames() Returns a dict mapping + thread id to that thread's current frame. +*/ +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _PyThread_CurrentFrames(void); +#endif + +/* Routines for advanced debuggers, requested by David Beazley. + Don't use unless you know what you are doing! */ +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyInterpreterState*) PyInterpreterState_Head(void); +PyAPI_FUNC(PyInterpreterState*) PyInterpreterState_Next(PyInterpreterState*); +PyAPI_FUNC(PyThreadState*) PyInterpreterState_ThreadHead(PyInterpreterState*); +PyAPI_FUNC(PyThreadState*) PyThreadState_Next(PyThreadState*); + +typedef struct _frame* (*PyThreadFrameGetter)(PyThreadState* self_); +#endif + +/* hook for PyEval_GetFrame(), requested for Psyco */ +#ifndef Py_LIMITED_API +PyAPI_DATA(PyThreadFrameGetter) _PyThreadState_GetFrame; +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_PYSTATE_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pystrcmp.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pystrcmp.h new file mode 100644 index 0000000..a16bec7 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pystrcmp.h @@ -0,0 +1,23 @@ +#ifndef Py_STRCMP_H +#define Py_STRCMP_H + +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_FUNC(int) PyOS_mystrnicmp(const char*, const char*, Py_ssize_t); +PyAPI_FUNC(int) PyOS_mystricmp(const char*, const char*); + +#ifdef MS_WINDOWS +#define PyOS_strnicmp strnicmp +#define PyOS_stricmp stricmp +#else +#define PyOS_strnicmp PyOS_mystrnicmp +#define PyOS_stricmp PyOS_mystricmp +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* !Py_STRCMP_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pystrhex.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pystrhex.h new file mode 100644 index 0000000..6963279 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pystrhex.h @@ -0,0 +1,20 @@ +#ifndef Py_STRHEX_H +#define Py_STRHEX_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_LIMITED_API +/* Returns a str() containing the hex representation of argbuf. */ +PyAPI_FUNC(PyObject*) _Py_strhex(const char* argbuf, const Py_ssize_t arglen); +/* Returns a bytes() containing the ASCII hex representation of argbuf. */ +PyAPI_FUNC(PyObject*) + _Py_strhex_bytes(const char* argbuf, const Py_ssize_t arglen); +#endif /* !Py_LIMITED_API */ + +#ifdef __cplusplus +} +#endif + +#endif /* !Py_STRHEX_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pystrtod.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pystrtod.h new file mode 100644 index 0000000..392baf7 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pystrtod.h @@ -0,0 +1,50 @@ +#ifndef Py_STRTOD_H +#define Py_STRTOD_H + +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_FUNC(double) PyOS_string_to_double( + const char* str, + char** endptr, + PyObject* overflow_exception); + +/* The caller is responsible for calling PyMem_Free to free the buffer + that's is returned. */ +PyAPI_FUNC(char*) PyOS_double_to_string( + double val, + char format_code, + int precision, + int flags, + int* type); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _Py_string_to_number_with_underscores( + const char* str, + Py_ssize_t len, + const char* what, + PyObject* obj, + void* arg, + PyObject* (*innerfunc)(const char*, Py_ssize_t, void*)); + +PyAPI_FUNC(double) _Py_parse_inf_or_nan(const char* p, char** endptr); +#endif + +/* PyOS_double_to_string's "flags" parameter can be set to 0 or more of: */ +#define Py_DTSF_SIGN 0x01 /* always add the sign */ +#define Py_DTSF_ADD_DOT_0 0x02 /* if the result is an integer add ".0" */ +#define Py_DTSF_ALT \ + 0x04 /* "alternate" formatting. it's format_code \ + specific */ + +/* PyOS_double_to_string's "type", if non-NULL, will be set to one of: */ +#define Py_DTST_FINITE 0 +#define Py_DTST_INFINITE 1 +#define Py_DTST_NAN 2 + +#ifdef __cplusplus +} +#endif + +#endif /* !Py_STRTOD_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pythonrun.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pythonrun.h new file mode 100644 index 0000000..c025251 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pythonrun.h @@ -0,0 +1,196 @@ + +/* Interfaces to parse and execute pieces of python code */ + +#ifndef Py_PYTHONRUN_H +#define Py_PYTHONRUN_H +#ifdef __cplusplus +extern "C" { +#endif + +#define PyCF_MASK \ + (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_WITH_STATEMENT | \ + CO_FUTURE_PRINT_FUNCTION | CO_FUTURE_UNICODE_LITERALS | \ + CO_FUTURE_BARRY_AS_BDFL | CO_FUTURE_GENERATOR_STOP) +#define PyCF_MASK_OBSOLETE (CO_NESTED) +#define PyCF_SOURCE_IS_UTF8 0x0100 +#define PyCF_DONT_IMPLY_DEDENT 0x0200 +#define PyCF_ONLY_AST 0x0400 +#define PyCF_IGNORE_COOKIE 0x0800 + +#ifndef Py_LIMITED_API +typedef struct { + int cf_flags; /* bitmask of CO_xxx flags relevant to future */ +} PyCompilerFlags; +#endif + +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char*, PyCompilerFlags*); +PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE*, const char*, PyCompilerFlags*); +PyAPI_FUNC(int) PyRun_AnyFileExFlags( + FILE* fp, + const char* filename, /* decoded from the filesystem encoding */ + int closeit, + PyCompilerFlags* flags); +PyAPI_FUNC(int) PyRun_SimpleFileExFlags( + FILE* fp, + const char* filename, /* decoded from the filesystem encoding */ + int closeit, + PyCompilerFlags* flags); +PyAPI_FUNC(int) PyRun_InteractiveOneFlags( + FILE* fp, + const char* filename, /* decoded from the filesystem encoding */ + PyCompilerFlags* flags); +PyAPI_FUNC(int) PyRun_InteractiveOneObject( + FILE* fp, + PyObject* filename, + PyCompilerFlags* flags); +PyAPI_FUNC(int) PyRun_InteractiveLoopFlags( + FILE* fp, + const char* filename, /* decoded from the filesystem encoding */ + PyCompilerFlags* flags); + +PyAPI_FUNC(struct _mod*) PyParser_ASTFromString( + const char* s, + const char* filename, /* decoded from the filesystem encoding */ + int start, + PyCompilerFlags* flags, + PyArena* arena); +PyAPI_FUNC(struct _mod*) PyParser_ASTFromStringObject( + const char* s, + PyObject* filename, + int start, + PyCompilerFlags* flags, + PyArena* arena); +PyAPI_FUNC(struct _mod*) PyParser_ASTFromFile( + FILE* fp, + const char* filename, /* decoded from the filesystem encoding */ + const char* enc, + int start, + const char* ps1, + const char* ps2, + PyCompilerFlags* flags, + int* errcode, + PyArena* arena); +PyAPI_FUNC(struct _mod*) PyParser_ASTFromFileObject( + FILE* fp, + PyObject* filename, + const char* enc, + int start, + const char* ps1, + const char* ps2, + PyCompilerFlags* flags, + int* errcode, + PyArena* arena); +#endif + +#ifndef PyParser_SimpleParseString +#define PyParser_SimpleParseString(S, B) \ + PyParser_SimpleParseStringFlags(S, B, 0) +#define PyParser_SimpleParseFile(FP, S, B) \ + PyParser_SimpleParseFileFlags(FP, S, B, 0) +#endif +PyAPI_FUNC(struct _node*) + PyParser_SimpleParseStringFlags(const char*, int, int); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03030000 +PyAPI_FUNC(struct _node*) + PyParser_SimpleParseStringFlagsFilename(const char*, const char*, int, int); +#endif +PyAPI_FUNC(struct _node*) + PyParser_SimpleParseFileFlags(FILE*, const char*, int, int); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) + PyRun_StringFlags(const char*, int, PyObject*, PyObject*, PyCompilerFlags*); + +PyAPI_FUNC(PyObject*) PyRun_FileExFlags( + FILE* fp, + const char* filename, /* decoded from the filesystem encoding */ + int start, + PyObject* globals, + PyObject* locals, + int closeit, + PyCompilerFlags* flags); +#endif + +#ifdef Py_LIMITED_API +PyAPI_FUNC(PyObject*) Py_CompileString(const char*, const char*, int); +#else +#define Py_CompileString(str, p, s) Py_CompileStringExFlags(str, p, s, NULL, -1) +#define Py_CompileStringFlags(str, p, s, f) \ + Py_CompileStringExFlags(str, p, s, f, -1) +PyAPI_FUNC(PyObject*) Py_CompileStringExFlags( + const char* str, + const char* filename, /* decoded from the filesystem encoding */ + int start, + PyCompilerFlags* flags, + int optimize); +PyAPI_FUNC(PyObject*) Py_CompileStringObject( + const char* str, + PyObject* filename, + int start, + PyCompilerFlags* flags, + int optimize); +#endif +PyAPI_FUNC(struct symtable*) Py_SymtableString( + const char* str, + const char* filename, /* decoded from the filesystem encoding */ + int start); +#ifndef Py_LIMITED_API +PyAPI_FUNC(struct symtable*) + Py_SymtableStringObject(const char* str, PyObject* filename, int start); +#endif + +PyAPI_FUNC(void) PyErr_Print(void); +PyAPI_FUNC(void) PyErr_PrintEx(int); +PyAPI_FUNC(void) PyErr_Display(PyObject*, PyObject*, PyObject*); + +#ifndef Py_LIMITED_API +/* Use macros for a bunch of old variants */ +#define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL) +#define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL) +#define PyRun_AnyFileEx(fp, name, closeit) \ + PyRun_AnyFileExFlags(fp, name, closeit, NULL) +#define PyRun_AnyFileFlags(fp, name, flags) \ + PyRun_AnyFileExFlags(fp, name, 0, flags) +#define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL) +#define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL) +#define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL) +#define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL) +#define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL) +#define PyRun_File(fp, p, s, g, l) PyRun_FileExFlags(fp, p, s, g, l, 0, NULL) +#define PyRun_FileEx(fp, p, s, g, l, c) \ + PyRun_FileExFlags(fp, p, s, g, l, c, NULL) +#define PyRun_FileFlags(fp, p, s, g, l, flags) \ + PyRun_FileExFlags(fp, p, s, g, l, 0, flags) +#endif + +/* Stuff with no proper home (yet) */ +#ifndef Py_LIMITED_API +PyAPI_FUNC(char*) PyOS_Readline(FILE*, FILE*, const char*); +#endif +PyAPI_DATA(int) (*PyOS_InputHook)(void); +PyAPI_DATA(char) * (*PyOS_ReadlineFunctionPointer)(FILE*, FILE*, const char*); +#ifndef Py_LIMITED_API +PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState; +#endif + +/* Stack size, in "pointers" (so we get extra safety margins + on 64-bit platforms). On a 32-bit platform, this translates + to an 8k margin. */ +#define PYOS_STACK_MARGIN 2048 + +#if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER) && \ + _MSC_VER >= 1300 +/* Enable stack checking under Microsoft C */ +#define USE_STACKCHECK +#endif + +#ifdef USE_STACKCHECK +/* Check that we aren't overflowing our stack */ +PyAPI_FUNC(int) PyOS_CheckStack(void); +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_PYTHONRUN_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pythread.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pythread.h new file mode 100644 index 0000000..27e978a --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pythread.h @@ -0,0 +1,91 @@ + +#ifndef Py_PYTHREAD_H +#define Py_PYTHREAD_H + +typedef void* PyThread_type_lock; +typedef void* PyThread_type_sema; + +#ifdef __cplusplus +extern "C" { +#endif + +/* Return status codes for Python lock acquisition. Chosen for maximum + * backwards compatibility, ie failure -> 0, success -> 1. */ +typedef enum PyLockStatus { + PY_LOCK_FAILURE = 0, + PY_LOCK_ACQUIRED = 1, + PY_LOCK_INTR +} PyLockStatus; + +PyAPI_FUNC(void) PyThread_init_thread(void); +PyAPI_FUNC(long) PyThread_start_new_thread(void (*)(void*), void*); +PyAPI_FUNC(void) PyThread_exit_thread(void); +PyAPI_FUNC(long) PyThread_get_thread_ident(void); + +PyAPI_FUNC(PyThread_type_lock) PyThread_allocate_lock(void); +PyAPI_FUNC(void) PyThread_free_lock(PyThread_type_lock); +PyAPI_FUNC(int) PyThread_acquire_lock(PyThread_type_lock, int); +#define WAIT_LOCK 1 +#define NOWAIT_LOCK 0 + +/* PY_TIMEOUT_T is the integral type used to specify timeouts when waiting + on a lock (see PyThread_acquire_lock_timed() below). + PY_TIMEOUT_MAX is the highest usable value (in microseconds) of that + type, and depends on the system threading API. + + NOTE: this isn't the same value as `_thread.TIMEOUT_MAX`. The _thread + module exposes a higher-level API, with timeouts expressed in seconds + and floating-point numbers allowed. +*/ +#define PY_TIMEOUT_T long long +#define PY_TIMEOUT_MAX PY_LLONG_MAX + +/* In the NT API, the timeout is a DWORD and is expressed in milliseconds */ +#if defined(NT_THREADS) +#if 0xFFFFFFFFLL * 1000 < PY_TIMEOUT_MAX +#undef PY_TIMEOUT_MAX +#define PY_TIMEOUT_MAX (0xFFFFFFFFLL * 1000) +#endif +#endif + +/* If microseconds == 0, the call is non-blocking: it returns immediately + even when the lock can't be acquired. + If microseconds > 0, the call waits up to the specified duration. + If microseconds < 0, the call waits until success (or abnormal failure) + + microseconds must be less than PY_TIMEOUT_MAX. Behaviour otherwise is + undefined. + + If intr_flag is true and the acquire is interrupted by a signal, then the + call will return PY_LOCK_INTR. The caller may reattempt to acquire the + lock. +*/ +PyAPI_FUNC(PyLockStatus) PyThread_acquire_lock_timed( + PyThread_type_lock, + PY_TIMEOUT_T microseconds, + int intr_flag); + +PyAPI_FUNC(void) PyThread_release_lock(PyThread_type_lock); + +PyAPI_FUNC(size_t) PyThread_get_stacksize(void); +PyAPI_FUNC(int) PyThread_set_stacksize(size_t); + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03030000 +PyAPI_FUNC(PyObject*) PyThread_GetInfo(void); +#endif + +/* Thread Local Storage (TLS) API */ +PyAPI_FUNC(int) PyThread_create_key(void); +PyAPI_FUNC(void) PyThread_delete_key(int); +PyAPI_FUNC(int) PyThread_set_key_value(int, void*); +PyAPI_FUNC(void*) PyThread_get_key_value(int); +PyAPI_FUNC(void) PyThread_delete_key_value(int key); + +/* Cleanup after a fork */ +PyAPI_FUNC(void) PyThread_ReInitTLS(void); + +#ifdef __cplusplus +} +#endif + +#endif /* !Py_PYTHREAD_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pytime.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pytime.h new file mode 100644 index 0000000..fd4bb0e --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/pytime.h @@ -0,0 +1,203 @@ +#ifndef Py_LIMITED_API +#ifndef Py_PYTIME_H +#define Py_PYTIME_H + +#include "object.h" +#include "pyconfig.h" /* include for defines */ + +/************************************************************************** +Symbols and macros to supply platform-independent interfaces to time related +functions and constants +**************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +/* _PyTime_t: Python timestamp with subsecond precision. It can be used to + store a duration, and so indirectly a date (related to another date, like + UNIX epoch). */ +typedef int64_t _PyTime_t; +#define _PyTime_MIN PY_LLONG_MIN +#define _PyTime_MAX PY_LLONG_MAX + +typedef enum { + /* Round towards minus infinity (-inf). + For example, used to read a clock. */ + _PyTime_ROUND_FLOOR = 0, + /* Round towards infinity (+inf). + For example, used for timeout to wait "at least" N seconds. */ + _PyTime_ROUND_CEILING = 1, + /* Round to nearest with ties going to nearest even integer. + For example, used to round from a Python float. */ + _PyTime_ROUND_HALF_EVEN = 2, + /* Round away from zero + For example, used for timeout. _PyTime_ROUND_CEILING rounds + -1e-9 to 0 milliseconds which causes bpo-31786 issue. + _PyTime_ROUND_UP rounds -1e-9 to -1 millisecond which keeps + the timeout sign as expected. select.poll(timeout) must block + for negative values." */ + _PyTime_ROUND_UP = 3, + /* _PyTime_ROUND_TIMEOUT (an alias for _PyTime_ROUND_UP) should be + used for timeouts. */ + _PyTime_ROUND_TIMEOUT = _PyTime_ROUND_UP +} _PyTime_round_t; + +/* Convert a time_t to a PyLong. */ +PyAPI_FUNC(PyObject*) _PyLong_FromTime_t(time_t sec); + +/* Convert a PyLong to a time_t. */ +PyAPI_FUNC(time_t) _PyLong_AsTime_t(PyObject* obj); + +/* Convert a number of seconds, int or float, to time_t. */ +PyAPI_FUNC(int) + _PyTime_ObjectToTime_t(PyObject* obj, time_t* sec, _PyTime_round_t); + +/* Convert a number of seconds, int or float, to a timeval structure. + usec is in the range [0; 999999] and rounded towards zero. + For example, -1.2 is converted to (-2, 800000). */ +PyAPI_FUNC(int) _PyTime_ObjectToTimeval( + PyObject* obj, + time_t* sec, + long* usec, + _PyTime_round_t); + +/* Convert a number of seconds, int or float, to a timespec structure. + nsec is in the range [0; 999999999] and rounded towards zero. + For example, -1.2 is converted to (-2, 800000000). */ +PyAPI_FUNC(int) _PyTime_ObjectToTimespec( + PyObject* obj, + time_t* sec, + long* nsec, + _PyTime_round_t); + +/* Create a timestamp from a number of seconds. */ +PyAPI_FUNC(_PyTime_t) _PyTime_FromSeconds(int seconds); + +/* Macro to create a timestamp from a number of seconds, no integer overflow. + Only use the macro for small values, prefer _PyTime_FromSeconds(). */ +#define _PYTIME_FROMSECONDS(seconds) \ + ((_PyTime_t)(seconds) * (1000 * 1000 * 1000)) + +/* Create a timestamp from a number of nanoseconds. */ +PyAPI_FUNC(_PyTime_t) _PyTime_FromNanoseconds(long long ns); + +/* Convert a number of seconds (Python float or int) to a timetamp. + Raise an exception and return -1 on error, return 0 on success. */ +PyAPI_FUNC(int) _PyTime_FromSecondsObject( + _PyTime_t* t, + PyObject* obj, + _PyTime_round_t round); + +/* Convert a number of milliseconds (Python float or int, 10^-3) to a timetamp. + Raise an exception and return -1 on error, return 0 on success. */ +PyAPI_FUNC(int) _PyTime_FromMillisecondsObject( + _PyTime_t* t, + PyObject* obj, + _PyTime_round_t round); + +/* Convert a timestamp to a number of seconds as a C double. */ +PyAPI_FUNC(double) _PyTime_AsSecondsDouble(_PyTime_t t); + +/* Convert timestamp to a number of milliseconds (10^-3 seconds). */ +PyAPI_FUNC(_PyTime_t) + _PyTime_AsMilliseconds(_PyTime_t t, _PyTime_round_t round); + +/* Convert timestamp to a number of microseconds (10^-6 seconds). */ +PyAPI_FUNC(_PyTime_t) + _PyTime_AsMicroseconds(_PyTime_t t, _PyTime_round_t round); + +/* Convert timestamp to a number of nanoseconds (10^-9 seconds) as a Python int + object. */ +PyAPI_FUNC(PyObject*) _PyTime_AsNanosecondsObject(_PyTime_t t); + +/* Convert a timestamp to a timeval structure (microsecond resolution). + tv_usec is always positive. + Raise an exception and return -1 if the conversion overflowed, + return 0 on success. */ +PyAPI_FUNC(int) + _PyTime_AsTimeval(_PyTime_t t, struct timeval* tv, _PyTime_round_t round); + +/* Similar to _PyTime_AsTimeval(), but don't raise an exception on error. */ +PyAPI_FUNC(int) _PyTime_AsTimeval_noraise( + _PyTime_t t, + struct timeval* tv, + _PyTime_round_t round); + +/* Convert a timestamp to a number of seconds (secs) and microseconds (us). + us is always positive. This function is similar to _PyTime_AsTimeval() + except that secs is always a time_t type, whereas the timeval structure + uses a C long for tv_sec on Windows. + Raise an exception and return -1 if the conversion overflowed, + return 0 on success. */ +PyAPI_FUNC(int) _PyTime_AsTimevalTime_t( + _PyTime_t t, + time_t* secs, + int* us, + _PyTime_round_t round); + +#if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_KQUEUE) +/* Convert a timestamp to a timespec structure (nanosecond resolution). + tv_nsec is always positive. + Raise an exception and return -1 on error, return 0 on success. */ +PyAPI_FUNC(int) _PyTime_AsTimespec(_PyTime_t t, struct timespec* ts); +#endif + +/* Get the current time from the system clock. + + The function cannot fail. _PyTime_Init() ensures that the system clock + works. */ +PyAPI_FUNC(_PyTime_t) _PyTime_GetSystemClock(void); + +/* Get the time of a monotonic clock, i.e. a clock that cannot go backwards. + The clock is not affected by system clock updates. The reference point of + the returned value is undefined, so that only the difference between the + results of consecutive calls is valid. + + The function cannot fail. _PyTime_Init() ensures that a monotonic clock + is available and works. */ +PyAPI_FUNC(_PyTime_t) _PyTime_GetMonotonicClock(void); + +/* Structure used by time.get_clock_info() */ +typedef struct { + const char* implementation; + int monotonic; + int adjustable; + double resolution; +} _Py_clock_info_t; + +/* Get the current time from the system clock. + * Fill clock information if info is not NULL. + * Raise an exception and return -1 on error, return 0 on success. + */ +PyAPI_FUNC(int) + _PyTime_GetSystemClockWithInfo(_PyTime_t* t, _Py_clock_info_t* info); + +/* Get the time of a monotonic clock, i.e. a clock that cannot go backwards. + The clock is not affected by system clock updates. The reference point of + the returned value is undefined, so that only the difference between the + results of consecutive calls is valid. + + Fill info (if set) with information of the function used to get the time. + + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) + _PyTime_GetMonotonicClockWithInfo(_PyTime_t* t, _Py_clock_info_t* info); + +/* Initialize time. + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) _PyTime_Init(void); + +/* Converts a timestamp to the Gregorian time, using the local time zone. + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) _PyTime_localtime(time_t t, struct tm* tm); + +/* Converts a timestamp to the Gregorian time, assuming UTC. + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) _PyTime_gmtime(time_t t, struct tm* tm); + +#ifdef __cplusplus +} +#endif + +#endif /* Py_PYTIME_H */ +#endif /* Py_LIMITED_API */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/rangeobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/rangeobject.h new file mode 100644 index 0000000..7e4dc28 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/rangeobject.h @@ -0,0 +1,27 @@ + +/* Range object interface */ + +#ifndef Py_RANGEOBJECT_H +#define Py_RANGEOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +/* +A range object represents an integer range. This is an immutable object; +a range cannot change its value after creation. + +Range objects behave like the corresponding tuple objects except that +they are represented by a start, stop, and step datamembers. +*/ + +PyAPI_DATA(PyTypeObject) PyRange_Type; +PyAPI_DATA(PyTypeObject) PyRangeIter_Type; +PyAPI_DATA(PyTypeObject) PyLongRangeIter_Type; + +#define PyRange_Check(op) (Py_TYPE(op) == &PyRange_Type) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_RANGEOBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/setobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/setobject.h new file mode 100644 index 0000000..29ddf76 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/setobject.h @@ -0,0 +1,111 @@ +/* Set object interface */ + +#ifndef Py_SETOBJECT_H +#define Py_SETOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_LIMITED_API + +/* There are three kinds of entries in the table: + +1. Unused: key == NULL and hash == 0 +2. Dummy: key == dummy and hash == -1 +3. Active: key != NULL and key != dummy and hash != -1 + +The hash field of Unused slots is always zero. + +The hash field of Dummy slots are set to -1 +meaning that dummy entries can be detected by +either entry->key==dummy or by entry->hash==-1. +*/ + +#define PySet_MINSIZE 8 + +typedef struct { + PyObject* key; + Py_hash_t hash; /* Cached hash code of the key */ +} setentry; + +/* The SetObject data structure is shared by set and frozenset objects. + +Invariant for sets: + - hash is -1 + +Invariants for frozensets: + - data is immutable. + - hash is the hash of the frozenset or -1 if not computed yet. + +*/ + +typedef struct { + PyObject_HEAD + + Py_ssize_t fill; /* Number active and dummy entries*/ + Py_ssize_t used; /* Number active entries */ + + /* The table contains mask + 1 slots, and that's a power of 2. + * We store the mask instead of the size because the mask is more + * frequently needed. + */ + Py_ssize_t mask; + + /* The table points to a fixed-size smalltable for small tables + * or to additional malloc'ed memory for bigger tables. + * The table pointer is never NULL which saves us from repeated + * runtime null-tests. + */ + setentry* table; + Py_hash_t hash; /* Only used by frozenset objects */ + Py_ssize_t finger; /* Search finger for pop() */ + + setentry smalltable[PySet_MINSIZE]; + PyObject* weakreflist; /* List of weak references */ +} PySetObject; + +#define PySet_GET_SIZE(so) (((PySetObject*)(so))->used) + +PyAPI_DATA(PyObject*) _PySet_Dummy; + +PyAPI_FUNC(int) _PySet_NextEntry( + PyObject* set, + Py_ssize_t* pos, + PyObject** key, + Py_hash_t* hash); +PyAPI_FUNC(int) _PySet_Update(PyObject* set, PyObject* iterable); +PyAPI_FUNC(int) PySet_ClearFreeList(void); + +#endif /* Section excluded by Py_LIMITED_API */ + +PyAPI_DATA(PyTypeObject) PySet_Type; +PyAPI_DATA(PyTypeObject) PyFrozenSet_Type; +PyAPI_DATA(PyTypeObject) PySetIter_Type; + +PyAPI_FUNC(PyObject*) PySet_New(PyObject*); +PyAPI_FUNC(PyObject*) PyFrozenSet_New(PyObject*); + +PyAPI_FUNC(int) PySet_Add(PyObject* set, PyObject* key); +PyAPI_FUNC(int) PySet_Clear(PyObject* set); +PyAPI_FUNC(int) PySet_Contains(PyObject* anyset, PyObject* key); +PyAPI_FUNC(int) PySet_Discard(PyObject* set, PyObject* key); +PyAPI_FUNC(PyObject*) PySet_Pop(PyObject* set); +PyAPI_FUNC(Py_ssize_t) PySet_Size(PyObject* anyset); + +#define PyFrozenSet_CheckExact(ob) (Py_TYPE(ob) == &PyFrozenSet_Type) +#define PyAnySet_CheckExact(ob) \ + (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type) +#define PyAnySet_Check(ob) \ + (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type || \ + PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \ + PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type)) +#define PySet_Check(ob) \ + (Py_TYPE(ob) == &PySet_Type || PyType_IsSubtype(Py_TYPE(ob), &PySet_Type)) +#define PyFrozenSet_Check(ob) \ + (Py_TYPE(ob) == &PyFrozenSet_Type || \ + PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type)) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_SETOBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/sliceobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/sliceobject.h new file mode 100644 index 0000000..8f202b0 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/sliceobject.h @@ -0,0 +1,83 @@ +#ifndef Py_SLICEOBJECT_H +#define Py_SLICEOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +/* The unique ellipsis object "..." */ + +PyAPI_DATA(PyObject) _Py_EllipsisObject; /* Don't use this directly */ + +#define Py_Ellipsis (&_Py_EllipsisObject) + +/* Slice object interface */ + +/* + +A slice object containing start, stop, and step data members (the +names are from range). After much talk with Guido, it was decided to +let these be any arbitrary python type. Py_None stands for omitted values. +*/ +#ifndef Py_LIMITED_API +typedef struct { + PyObject_HEAD PyObject *start, *stop, *step; /* not NULL */ +} PySliceObject; +#endif + +PyAPI_DATA(PyTypeObject) PySlice_Type; +PyAPI_DATA(PyTypeObject) PyEllipsis_Type; + +#define PySlice_Check(op) (Py_TYPE(op) == &PySlice_Type) + +PyAPI_FUNC(PyObject*) + PySlice_New(PyObject* start, PyObject* stop, PyObject* step); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop); +PyAPI_FUNC(int) _PySlice_GetLongIndices( + PySliceObject* self, + PyObject* length, + PyObject** start_ptr, + PyObject** stop_ptr, + PyObject** step_ptr); +#endif +PyAPI_FUNC(int) PySlice_GetIndices( + PyObject* r, + Py_ssize_t length, + Py_ssize_t* start, + Py_ssize_t* stop, + Py_ssize_t* step); +PyAPI_FUNC(int) PySlice_GetIndicesEx( + PyObject* r, + Py_ssize_t length, + Py_ssize_t* start, + Py_ssize_t* stop, + Py_ssize_t* step, + Py_ssize_t* slicelength); + +#if !defined(Py_LIMITED_API) || \ + (Py_LIMITED_API + 0 >= 0x03050400 && Py_LIMITED_API + 0 < 0x03060000) || \ + Py_LIMITED_API + 0 >= 0x03060100 +#ifdef Py_LIMITED_API +#define PySlice_GetIndicesEx(slice, length, start, stop, step, slicelen) \ + (PySlice_Unpack((slice), (start), (stop), (step)) < 0 \ + ? ((*(slicelen) = 0), -1) \ + : ((*(slicelen) = \ + PySlice_AdjustIndices((length), (start), (stop), *(step))), \ + 0)) +#endif +PyAPI_FUNC(int) PySlice_Unpack( + PyObject* slice, + Py_ssize_t* start, + Py_ssize_t* stop, + Py_ssize_t* step); +PyAPI_FUNC(Py_ssize_t) PySlice_AdjustIndices( + Py_ssize_t length, + Py_ssize_t* start, + Py_ssize_t* stop, + Py_ssize_t step); +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_SLICEOBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/structmember.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/structmember.h new file mode 100644 index 0000000..5f90115 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/structmember.h @@ -0,0 +1,71 @@ +#ifndef Py_STRUCTMEMBER_H +#define Py_STRUCTMEMBER_H +#ifdef __cplusplus +extern "C" { +#endif + +/* Interface to map C struct members to Python object attributes */ + +#include /* For offsetof */ + +/* An array of PyMemberDef structures defines the name, type and offset + of selected members of a C structure. These can be read by + PyMember_GetOne() and set by PyMember_SetOne() (except if their READONLY + flag is set). The array must be terminated with an entry whose name + pointer is NULL. */ + +typedef struct PyMemberDef { + char* name; + int type; + Py_ssize_t offset; + int flags; + char* doc; +} PyMemberDef; + +/* Types */ +#define T_SHORT 0 +#define T_INT 1 +#define T_LONG 2 +#define T_FLOAT 3 +#define T_DOUBLE 4 +#define T_STRING 5 +#define T_OBJECT 6 +/* XXX the ordering here is weird for binary compatibility */ +#define T_CHAR 7 /* 1-character string */ +#define T_BYTE 8 /* 8-bit signed int */ +/* unsigned variants: */ +#define T_UBYTE 9 +#define T_USHORT 10 +#define T_UINT 11 +#define T_ULONG 12 + +/* Added by Jack: strings contained in the structure */ +#define T_STRING_INPLACE 13 + +/* Added by Lillo: bools contained in the structure (assumed char) */ +#define T_BOOL 14 + +#define T_OBJECT_EX \ + 16 /* Like T_OBJECT, but raises AttributeError \ + when the value is NULL, instead of \ + converting to None. */ +#define T_LONGLONG 17 +#define T_ULONGLONG 18 + +#define T_PYSSIZET 19 /* Py_ssize_t */ +#define T_NONE 20 /* Value is always None */ + +/* Flags */ +#define READONLY 1 +#define READ_RESTRICTED 2 +#define PY_WRITE_RESTRICTED 4 +#define RESTRICTED (READ_RESTRICTED | PY_WRITE_RESTRICTED) + +/* Current API, use this */ +PyAPI_FUNC(PyObject*) PyMember_GetOne(const char*, struct PyMemberDef*); +PyAPI_FUNC(int) PyMember_SetOne(char*, struct PyMemberDef*, PyObject*); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_STRUCTMEMBER_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/structseq.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/structseq.h new file mode 100644 index 0000000..ebd47ea --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/structseq.h @@ -0,0 +1,49 @@ + +/* Named tuple object interface */ + +#ifndef Py_STRUCTSEQ_H +#define Py_STRUCTSEQ_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct PyStructSequence_Field { + char* name; + char* doc; +} PyStructSequence_Field; + +typedef struct PyStructSequence_Desc { + char* name; + char* doc; + struct PyStructSequence_Field* fields; + int n_in_sequence; +} PyStructSequence_Desc; + +extern char* PyStructSequence_UnnamedField; + +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) + PyStructSequence_InitType(PyTypeObject* type, PyStructSequence_Desc* desc); +PyAPI_FUNC(int) + PyStructSequence_InitType2(PyTypeObject* type, PyStructSequence_Desc* desc); +#endif +PyAPI_FUNC(PyTypeObject*) PyStructSequence_NewType(PyStructSequence_Desc* desc); + +PyAPI_FUNC(PyObject*) PyStructSequence_New(PyTypeObject* type); + +#ifndef Py_LIMITED_API +typedef PyTupleObject PyStructSequence; + +/* Macro, *only* to be used to fill in brand new objects */ +#define PyStructSequence_SET_ITEM(op, i, v) PyTuple_SET_ITEM(op, i, v) + +#define PyStructSequence_GET_ITEM(op, i) PyTuple_GET_ITEM(op, i) +#endif + +PyAPI_FUNC(void) PyStructSequence_SetItem(PyObject*, Py_ssize_t, PyObject*); +PyAPI_FUNC(PyObject*) PyStructSequence_GetItem(PyObject*, Py_ssize_t); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_STRUCTSEQ_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/symtable.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/symtable.h new file mode 100644 index 0000000..9e7d051 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/symtable.h @@ -0,0 +1,121 @@ +#ifndef Py_LIMITED_API +#ifndef Py_SYMTABLE_H +#define Py_SYMTABLE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* XXX(ncoghlan): This is a weird mix of public names and interpreter internal + * names. + */ + +typedef enum _block_type { + FunctionBlock, + ClassBlock, + ModuleBlock +} _Py_block_ty; + +struct _symtable_entry; + +struct symtable { + PyObject* st_filename; /* name of file being compiled, + decoded from the filesystem encoding */ + struct _symtable_entry* st_cur; /* current symbol table entry */ + struct _symtable_entry* st_top; /* symbol table entry for module */ + PyObject* st_blocks; /* dict: map AST node addresses + * to symbol table entries */ + PyObject* st_stack; /* list: stack of namespace info */ + PyObject* st_global; /* borrowed ref to st_top->ste_symbols */ + int st_nblocks; /* number of blocks used. kept for + consistency with the corresponding + compiler structure */ + PyObject* st_private; /* name of current class or NULL */ + PyFutureFeatures* st_future; /* module's future features that affect + the symbol table */ + int recursion_depth; /* current recursion depth */ + int recursion_limit; /* recursion limit */ +}; + +typedef struct _symtable_entry { + PyObject_HEAD PyObject* ste_id; /* int: key in ste_table->st_blocks */ + PyObject* ste_symbols; /* dict: variable names to flags */ + PyObject* ste_name; /* string: name of current block */ + PyObject* ste_varnames; /* list of function parameters */ + PyObject* ste_children; /* list of child blocks */ + PyObject* ste_directives; /* locations of global and nonlocal statements */ + _Py_block_ty ste_type; /* module, class, or function */ + int ste_nested; /* true if block is nested */ + unsigned ste_free : 1; /* true if block has free variables */ + unsigned ste_child_free : 1; /* true if a child block has free vars, + including free refs to globals */ + unsigned ste_generator : 1; /* true if namespace is a generator */ + unsigned ste_coroutine : 1; /* true if namespace is a coroutine */ + unsigned ste_varargs : 1; /* true if block has varargs */ + unsigned ste_varkeywords : 1; /* true if block has varkeywords */ + unsigned ste_returns_value : 1; /* true if namespace uses return with + an argument */ + unsigned ste_needs_class_closure : 1; /* for class scopes, true if a + closure over __class__ + should be created */ + int ste_lineno; /* first line of block */ + int ste_col_offset; /* offset of first line of block */ + int ste_opt_lineno; /* lineno of last exec or import * */ + int ste_opt_col_offset; /* offset of last exec or import * */ + int ste_tmpname; /* counter for listcomp temp vars */ + struct symtable* ste_table; +} PySTEntryObject; + +PyAPI_DATA(PyTypeObject) PySTEntry_Type; + +#define PySTEntry_Check(op) (Py_TYPE(op) == &PySTEntry_Type) + +PyAPI_FUNC(int) PyST_GetScope(PySTEntryObject*, PyObject*); + +PyAPI_FUNC(struct symtable*) PySymtable_Build( + mod_ty mod, + const char* filename, /* decoded from the filesystem encoding */ + PyFutureFeatures* future); +PyAPI_FUNC(struct symtable*) PySymtable_BuildObject( + mod_ty mod, + PyObject* filename, + PyFutureFeatures* future); +PyAPI_FUNC(PySTEntryObject*) PySymtable_Lookup(struct symtable*, void*); + +PyAPI_FUNC(void) PySymtable_Free(struct symtable*); + +/* Flags for def-use information */ + +#define DEF_GLOBAL 1 /* global stmt */ +#define DEF_LOCAL 2 /* assignment in code block */ +#define DEF_PARAM 2 << 1 /* formal parameter */ +#define DEF_NONLOCAL 2 << 2 /* nonlocal stmt */ +#define USE 2 << 3 /* name is used */ +#define DEF_FREE 2 << 4 /* name used but not defined in nested block */ +#define DEF_FREE_CLASS 2 << 5 /* free variable from class's method */ +#define DEF_IMPORT 2 << 6 /* assignment occurred via import */ +#define DEF_ANNOT 2 << 7 /* this name is annotated */ + +#define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT) + +/* GLOBAL_EXPLICIT and GLOBAL_IMPLICIT are used internally by the symbol + table. GLOBAL is returned from PyST_GetScope() for either of them. + It is stored in ste_symbols at bits 12-15. +*/ +#define SCOPE_OFFSET 11 +#define SCOPE_MASK (DEF_GLOBAL | DEF_LOCAL | DEF_PARAM | DEF_NONLOCAL) + +#define LOCAL 1 +#define GLOBAL_EXPLICIT 2 +#define GLOBAL_IMPLICIT 3 +#define FREE 4 +#define CELL 5 + +#define GENERATOR 1 +#define GENERATOR_EXPRESSION 2 + +#ifdef __cplusplus +} +#endif +#endif /* !Py_SYMTABLE_H */ +#endif /* Py_LIMITED_API */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/sysmodule.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/sysmodule.h new file mode 100644 index 0000000..2c3e3b7 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/sysmodule.h @@ -0,0 +1,43 @@ + +/* System module interface */ + +#ifndef Py_SYSMODULE_H +#define Py_SYSMODULE_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_FUNC(PyObject*) PySys_GetObject(const char*); +PyAPI_FUNC(int) PySys_SetObject(const char*, PyObject*); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _PySys_GetObjectId(_Py_Identifier* key); +PyAPI_FUNC(int) _PySys_SetObjectId(_Py_Identifier* key, PyObject*); +#endif + +PyAPI_FUNC(void) PySys_SetArgv(int, wchar_t**); +PyAPI_FUNC(void) PySys_SetArgvEx(int, wchar_t**, int); +PyAPI_FUNC(void) PySys_SetPath(const wchar_t*); + +PyAPI_FUNC(void) PySys_WriteStdout(const char* format, ...) + Py_GCC_ATTRIBUTE((format(printf, 1, 2))); +PyAPI_FUNC(void) PySys_WriteStderr(const char* format, ...) + Py_GCC_ATTRIBUTE((format(printf, 1, 2))); +PyAPI_FUNC(void) PySys_FormatStdout(const char* format, ...); +PyAPI_FUNC(void) PySys_FormatStderr(const char* format, ...); + +PyAPI_FUNC(void) PySys_ResetWarnOptions(void); +PyAPI_FUNC(void) PySys_AddWarnOption(const wchar_t*); +PyAPI_FUNC(void) PySys_AddWarnOptionUnicode(PyObject*); +PyAPI_FUNC(int) PySys_HasWarnOptions(void); + +PyAPI_FUNC(void) PySys_AddXOption(const wchar_t*); +PyAPI_FUNC(PyObject*) PySys_GetXOptions(void); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(size_t) _PySys_GetSizeOf(PyObject*); +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_SYSMODULE_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/token.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/token.h new file mode 100644 index 0000000..7b5b9e5 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/token.h @@ -0,0 +1,90 @@ + +/* Token types */ +#ifndef Py_LIMITED_API +#ifndef Py_TOKEN_H +#define Py_TOKEN_H +#ifdef __cplusplus +extern "C" { +#endif + +#undef TILDE /* Prevent clash of our definition with system macro. Ex AIX, \ + ioctl.h */ + +#define ENDMARKER 0 +#define NAME 1 +#define NUMBER 2 +#define STRING 3 +#define NEWLINE 4 +#define INDENT 5 +#define DEDENT 6 +#define LPAR 7 +#define RPAR 8 +#define LSQB 9 +#define RSQB 10 +#define COLON 11 +#define COMMA 12 +#define SEMI 13 +#define PLUS 14 +#define MINUS 15 +#define STAR 16 +#define SLASH 17 +#define VBAR 18 +#define AMPER 19 +#define LESS 20 +#define GREATER 21 +#define EQUAL 22 +#define DOT 23 +#define PERCENT 24 +#define LBRACE 25 +#define RBRACE 26 +#define EQEQUAL 27 +#define NOTEQUAL 28 +#define LESSEQUAL 29 +#define GREATEREQUAL 30 +#define TILDE 31 +#define CIRCUMFLEX 32 +#define LEFTSHIFT 33 +#define RIGHTSHIFT 34 +#define DOUBLESTAR 35 +#define PLUSEQUAL 36 +#define MINEQUAL 37 +#define STAREQUAL 38 +#define SLASHEQUAL 39 +#define PERCENTEQUAL 40 +#define AMPEREQUAL 41 +#define VBAREQUAL 42 +#define CIRCUMFLEXEQUAL 43 +#define LEFTSHIFTEQUAL 44 +#define RIGHTSHIFTEQUAL 45 +#define DOUBLESTAREQUAL 46 +#define DOUBLESLASH 47 +#define DOUBLESLASHEQUAL 48 +#define AT 49 +#define ATEQUAL 50 +#define RARROW 51 +#define ELLIPSIS 52 +/* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */ +#define OP 53 +#define AWAIT 54 +#define ASYNC 55 +#define ERRORTOKEN 56 +#define N_TOKENS 57 + +/* Special definitions for cooperation with parser */ + +#define NT_OFFSET 256 + +#define ISTERMINAL(x) ((x) < NT_OFFSET) +#define ISNONTERMINAL(x) ((x) >= NT_OFFSET) +#define ISEOF(x) ((x) == ENDMARKER) + +PyAPI_DATA(const char*) _PyParser_TokenNames[]; /* Token names */ +PyAPI_FUNC(int) PyToken_OneChar(int); +PyAPI_FUNC(int) PyToken_TwoChars(int, int); +PyAPI_FUNC(int) PyToken_ThreeChars(int, int, int); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_TOKEN_H */ +#endif /* Py_LIMITED_API */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/traceback.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/traceback.h new file mode 100644 index 0000000..b5eb05e --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/traceback.h @@ -0,0 +1,112 @@ + +#ifndef Py_TRACEBACK_H +#define Py_TRACEBACK_H +#ifdef __cplusplus +extern "C" { +#endif + +#include "pystate.h" + +struct _frame; + +/* Traceback interface */ +#ifndef Py_LIMITED_API +typedef struct _traceback { + PyObject_HEAD struct _traceback* tb_next; + struct _frame* tb_frame; + int tb_lasti; + int tb_lineno; +} PyTracebackObject; +#endif + +PyAPI_FUNC(int) PyTraceBack_Here(struct _frame*); +PyAPI_FUNC(int) PyTraceBack_Print(PyObject*, PyObject*); +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject*, PyObject*, int, int); +PyAPI_FUNC(void) _PyTraceback_Add(const char*, const char*, int); +#endif + +/* Reveal traceback type so we can typecheck traceback objects */ +PyAPI_DATA(PyTypeObject) PyTraceBack_Type; +#define PyTraceBack_Check(v) (Py_TYPE(v) == &PyTraceBack_Type) + +#ifndef Py_LIMITED_API +/* Write the Python traceback into the file 'fd'. For example: + + Traceback (most recent call first): + File "xxx", line xxx in + File "xxx", line xxx in + ... + File "xxx", line xxx in + + This function is written for debug purpose only, to dump the traceback in + the worst case: after a segmentation fault, at fatal error, etc. That's why, + it is very limited. Strings are truncated to 100 characters and encoded to + ASCII with backslashreplace. It doesn't write the source code, only the + function name, filename and line number of each frame. Write only the first + 100 frames: if the traceback is truncated, write the line " ...". + + This function is signal safe. */ + +PyAPI_FUNC(void) _Py_DumpTraceback(int fd, PyThreadState* tstate); + +/* Write the traceback of all threads into the file 'fd'. current_thread can be + NULL. + + Return NULL on success, or an error message on error. + + This function is written for debug purpose only. It calls + _Py_DumpTraceback() for each thread, and so has the same limitations. It + only write the traceback of the first 100 threads: write "..." if there are + more threads. + + If current_tstate is NULL, the function tries to get the Python thread state + of the current thread. It is not an error if the function is unable to get + the current Python thread state. + + If interp is NULL, the function tries to get the interpreter state from + the current Python thread state, or from + _PyGILState_GetInterpreterStateUnsafe() in last resort. + + It is better to pass NULL to interp and current_tstate, the function tries + different options to retrieve these informations. + + This function is signal safe. */ + +PyAPI_FUNC(const char*) _Py_DumpTracebackThreads( + int fd, + PyInterpreterState* interp, + PyThreadState* current_tstate); +#endif /* !Py_LIMITED_API */ + +#ifndef Py_LIMITED_API + +/* Write a Unicode object into the file descriptor fd. Encode the string to + ASCII using the backslashreplace error handler. + + Do nothing if text is not a Unicode object. The function accepts Unicode + string which is not ready (PyUnicode_WCHAR_KIND). + + This function is signal safe. */ +PyAPI_FUNC(void) _Py_DumpASCII(int fd, PyObject* text); + +/* Format an integer as decimal into the file descriptor fd. + + This function is signal safe. */ +PyAPI_FUNC(void) _Py_DumpDecimal(int fd, unsigned long value); + +/* Format an integer as hexadecimal into the file descriptor fd with at least + width digits. + + The maximum width is sizeof(unsigned long)*2 digits. + + This function is signal safe. */ +PyAPI_FUNC(void) + _Py_DumpHexadecimal(int fd, unsigned long value, Py_ssize_t width); + +#endif /* !Py_LIMITED_API */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_TRACEBACK_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/tupleobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/tupleobject.h new file mode 100644 index 0000000..8b8fcdd --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/tupleobject.h @@ -0,0 +1,72 @@ + +/* Tuple object interface */ + +#ifndef Py_TUPLEOBJECT_H +#define Py_TUPLEOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +/* +Another generally useful object type is a tuple of object pointers. +For Python, this is an immutable type. C code can change the tuple items +(but not their number), and even use tuples are general-purpose arrays of +object references, but in general only brand new tuples should be mutated, +not ones that might already have been exposed to Python code. + +*** WARNING *** PyTuple_SetItem does not increment the new item's reference +count, but does decrement the reference count of the item it replaces, +if not nil. It does *decrement* the reference count if it is *not* +inserted in the tuple. Similarly, PyTuple_GetItem does not increment the +returned item's reference count. +*/ + +#ifndef Py_LIMITED_API +typedef struct { + PyObject_VAR_HEAD PyObject* ob_item[1]; + + /* ob_item contains space for 'ob_size' elements. + * Items must normally not be NULL, except during construction when + * the tuple is not yet visible outside the function that builds it. + */ +} PyTupleObject; +#endif + +PyAPI_DATA(PyTypeObject) PyTuple_Type; +PyAPI_DATA(PyTypeObject) PyTupleIter_Type; + +#define PyTuple_Check(op) \ + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS) +#define PyTuple_CheckExact(op) (Py_TYPE(op) == &PyTuple_Type) + +PyAPI_FUNC(PyObject*) PyTuple_New(Py_ssize_t size); +PyAPI_FUNC(Py_ssize_t) PyTuple_Size(PyObject*); +PyAPI_FUNC(PyObject*) PyTuple_GetItem(PyObject*, Py_ssize_t); +PyAPI_FUNC(int) PyTuple_SetItem(PyObject*, Py_ssize_t, PyObject*); +PyAPI_FUNC(PyObject*) PyTuple_GetSlice(PyObject*, Py_ssize_t, Py_ssize_t); +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _PyTuple_Resize(PyObject**, Py_ssize_t); +#endif +PyAPI_FUNC(PyObject*) PyTuple_Pack(Py_ssize_t, ...); +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject*); +#endif + +/* Macro, trading safety for speed */ +#ifndef Py_LIMITED_API +#define PyTuple_GET_ITEM(op, i) (((PyTupleObject*)(op))->ob_item[i]) +#define PyTuple_GET_SIZE(op) Py_SIZE(op) + +/* Macro, *only* to be used to fill in brand new tuples */ +#define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject*)(op))->ob_item[i] = v) +#endif + +PyAPI_FUNC(int) PyTuple_ClearFreeList(void); +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) _PyTuple_DebugMallocStats(FILE* out); +#endif /* Py_LIMITED_API */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_TUPLEOBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/typeslots.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/typeslots.h new file mode 100644 index 0000000..b9f1970 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/typeslots.h @@ -0,0 +1,85 @@ +/* Do not renumber the file; these numbers are part of the stable ABI. */ +/* Disabled, see #10181 */ +#undef Py_bf_getbuffer +#undef Py_bf_releasebuffer +#define Py_mp_ass_subscript 3 +#define Py_mp_length 4 +#define Py_mp_subscript 5 +#define Py_nb_absolute 6 +#define Py_nb_add 7 +#define Py_nb_and 8 +#define Py_nb_bool 9 +#define Py_nb_divmod 10 +#define Py_nb_float 11 +#define Py_nb_floor_divide 12 +#define Py_nb_index 13 +#define Py_nb_inplace_add 14 +#define Py_nb_inplace_and 15 +#define Py_nb_inplace_floor_divide 16 +#define Py_nb_inplace_lshift 17 +#define Py_nb_inplace_multiply 18 +#define Py_nb_inplace_or 19 +#define Py_nb_inplace_power 20 +#define Py_nb_inplace_remainder 21 +#define Py_nb_inplace_rshift 22 +#define Py_nb_inplace_subtract 23 +#define Py_nb_inplace_true_divide 24 +#define Py_nb_inplace_xor 25 +#define Py_nb_int 26 +#define Py_nb_invert 27 +#define Py_nb_lshift 28 +#define Py_nb_multiply 29 +#define Py_nb_negative 30 +#define Py_nb_or 31 +#define Py_nb_positive 32 +#define Py_nb_power 33 +#define Py_nb_remainder 34 +#define Py_nb_rshift 35 +#define Py_nb_subtract 36 +#define Py_nb_true_divide 37 +#define Py_nb_xor 38 +#define Py_sq_ass_item 39 +#define Py_sq_concat 40 +#define Py_sq_contains 41 +#define Py_sq_inplace_concat 42 +#define Py_sq_inplace_repeat 43 +#define Py_sq_item 44 +#define Py_sq_length 45 +#define Py_sq_repeat 46 +#define Py_tp_alloc 47 +#define Py_tp_base 48 +#define Py_tp_bases 49 +#define Py_tp_call 50 +#define Py_tp_clear 51 +#define Py_tp_dealloc 52 +#define Py_tp_del 53 +#define Py_tp_descr_get 54 +#define Py_tp_descr_set 55 +#define Py_tp_doc 56 +#define Py_tp_getattr 57 +#define Py_tp_getattro 58 +#define Py_tp_hash 59 +#define Py_tp_init 60 +#define Py_tp_is_gc 61 +#define Py_tp_iter 62 +#define Py_tp_iternext 63 +#define Py_tp_methods 64 +#define Py_tp_new 65 +#define Py_tp_repr 66 +#define Py_tp_richcompare 67 +#define Py_tp_setattr 68 +#define Py_tp_setattro 69 +#define Py_tp_str 70 +#define Py_tp_traverse 71 +#define Py_tp_members 72 +#define Py_tp_getset 73 +#define Py_tp_free 74 +#define Py_nb_matrix_multiply 75 +#define Py_nb_inplace_matrix_multiply 76 +#define Py_am_await 77 +#define Py_am_aiter 78 +#define Py_am_anext 79 +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03050000 +/* New in 3.5 */ +#define Py_tp_finalize 80 +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/ucnhash.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/ucnhash.h new file mode 100644 index 0000000..16731d1 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/ucnhash.h @@ -0,0 +1,43 @@ +/* Unicode name database interface */ +#ifndef Py_LIMITED_API +#ifndef Py_UCNHASH_H +#define Py_UCNHASH_H +#ifdef __cplusplus +extern "C" { +#endif + +/* revised ucnhash CAPI interface (exported through a "wrapper") */ + +#define PyUnicodeData_CAPSULE_NAME "unicodedata.ucnhash_CAPI" + +typedef struct { + /* Size of this struct */ + int size; + + /* Get name for a given character code. Returns non-zero if + success, zero if not. Does not set Python exceptions. + If self is NULL, data come from the default version of the database. + If it is not NULL, it should be a unicodedata.ucd_X_Y_Z object */ + int (*getname)( + PyObject* self, + Py_UCS4 code, + char* buffer, + int buflen, + int with_alias_and_seq); + + /* Get character code for a given name. Same error handling + as for getname. */ + int (*getcode)( + PyObject* self, + const char* name, + int namelen, + Py_UCS4* code, + int with_named_seq); + +} _PyUnicode_Name_CAPI; + +#ifdef __cplusplus +} +#endif +#endif /* !Py_UCNHASH_H */ +#endif /* !Py_LIMITED_API */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/unicodeobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/unicodeobject.h new file mode 100644 index 0000000..c44f967 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/unicodeobject.h @@ -0,0 +1,2260 @@ +#ifndef Py_UNICODEOBJECT_H +#define Py_UNICODEOBJECT_H + +#include + +/* + +Unicode implementation based on original code by Fredrik Lundh, +modified by Marc-Andre Lemburg (mal@lemburg.com) according to the +Unicode Integration Proposal. (See +http://www.egenix.com/files/python/unicode-proposal.txt). + +Copyright (c) Corporation for National Research Initiatives. + + + Original header: + -------------------------------------------------------------------- + + * Yet another Unicode string type for Python. This type supports the + * 16-bit Basic Multilingual Plane (BMP) only. + * + * Written by Fredrik Lundh, January 1999. + * + * Copyright (c) 1999 by Secret Labs AB. + * Copyright (c) 1999 by Fredrik Lundh. + * + * fredrik@pythonware.com + * http://www.pythonware.com + * + * -------------------------------------------------------------------- + * This Unicode String Type is + * + * Copyright (c) 1999 by Secret Labs AB + * Copyright (c) 1999 by Fredrik Lundh + * + * By obtaining, using, and/or copying this software and/or its + * associated documentation, you agree that you have read, understood, + * and will comply with the following terms and conditions: + * + * Permission to use, copy, modify, and distribute this software and its + * associated documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appears in all + * copies, and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of Secret Labs + * AB or the author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. + * + * SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * -------------------------------------------------------------------- */ + +#include + +/* === Internal API ======================================================= */ + +/* --- Internal Unicode Format -------------------------------------------- */ + +/* Python 3.x requires unicode */ +#define Py_USING_UNICODE + +#ifndef SIZEOF_WCHAR_T +#error Must define SIZEOF_WCHAR_T +#endif + +#define Py_UNICODE_SIZE SIZEOF_WCHAR_T + +/* If wchar_t can be used for UCS-4 storage, set Py_UNICODE_WIDE. + Otherwise, Unicode strings are stored as UCS-2 (with limited support + for UTF-16) */ + +#if Py_UNICODE_SIZE >= 4 +#define Py_UNICODE_WIDE +#endif + +/* Set these flags if the platform has "wchar.h" and the + wchar_t type is a 16-bit unsigned type */ +/* #define HAVE_WCHAR_H */ +/* #define HAVE_USABLE_WCHAR_T */ + +/* Py_UNICODE was the native Unicode storage format (code unit) used by + Python and represents a single Unicode element in the Unicode type. + With PEP 393, Py_UNICODE is deprecated and replaced with a + typedef to wchar_t. */ + +#ifndef Py_LIMITED_API +#define PY_UNICODE_TYPE wchar_t +typedef wchar_t Py_UNICODE; +#endif + +/* If the compiler provides a wchar_t type we try to support it + through the interface functions PyUnicode_FromWideChar(), + PyUnicode_AsWideChar() and PyUnicode_AsWideCharString(). */ + +#ifdef HAVE_USABLE_WCHAR_T +#ifndef HAVE_WCHAR_H +#define HAVE_WCHAR_H +#endif +#endif + +#ifdef HAVE_WCHAR_H +/* Work around a cosmetic bug in BSDI 4.x wchar.h; thanks to Thomas Wouters */ +#ifdef _HAVE_BSDI +#include +#endif +#include +#endif + +/* Py_UCS4 and Py_UCS2 are typedefs for the respective + unicode representations. */ +typedef uint32_t Py_UCS4; +typedef uint16_t Py_UCS2; +typedef uint8_t Py_UCS1; + +/* --- Internal Unicode Operations ---------------------------------------- */ + +/* Since splitting on whitespace is an important use case, and + whitespace in most situations is solely ASCII whitespace, we + optimize for the common case by using a quick look-up table + _Py_ascii_whitespace (see below) with an inlined check. + + */ +#ifndef Py_LIMITED_API +#define Py_UNICODE_ISSPACE(ch) \ + ((ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch)) + +#define Py_UNICODE_ISLOWER(ch) _PyUnicode_IsLowercase(ch) +#define Py_UNICODE_ISUPPER(ch) _PyUnicode_IsUppercase(ch) +#define Py_UNICODE_ISTITLE(ch) _PyUnicode_IsTitlecase(ch) +#define Py_UNICODE_ISLINEBREAK(ch) _PyUnicode_IsLinebreak(ch) + +#define Py_UNICODE_TOLOWER(ch) _PyUnicode_ToLowercase(ch) +#define Py_UNICODE_TOUPPER(ch) _PyUnicode_ToUppercase(ch) +#define Py_UNICODE_TOTITLE(ch) _PyUnicode_ToTitlecase(ch) + +#define Py_UNICODE_ISDECIMAL(ch) _PyUnicode_IsDecimalDigit(ch) +#define Py_UNICODE_ISDIGIT(ch) _PyUnicode_IsDigit(ch) +#define Py_UNICODE_ISNUMERIC(ch) _PyUnicode_IsNumeric(ch) +#define Py_UNICODE_ISPRINTABLE(ch) _PyUnicode_IsPrintable(ch) + +#define Py_UNICODE_TODECIMAL(ch) _PyUnicode_ToDecimalDigit(ch) +#define Py_UNICODE_TODIGIT(ch) _PyUnicode_ToDigit(ch) +#define Py_UNICODE_TONUMERIC(ch) _PyUnicode_ToNumeric(ch) + +#define Py_UNICODE_ISALPHA(ch) _PyUnicode_IsAlpha(ch) + +#define Py_UNICODE_ISALNUM(ch) \ + (Py_UNICODE_ISALPHA(ch) || Py_UNICODE_ISDECIMAL(ch) || \ + Py_UNICODE_ISDIGIT(ch) || Py_UNICODE_ISNUMERIC(ch)) + +#define Py_UNICODE_COPY(target, source, length) \ + memcpy((target), (source), (length) * sizeof(Py_UNICODE)) + +#define Py_UNICODE_FILL(target, value, length) \ + do { \ + Py_ssize_t i_; \ + Py_UNICODE* t_ = (target); \ + Py_UNICODE v_ = (value); \ + for (i_ = 0; i_ < (length); i_++) \ + t_[i_] = v_; \ + } while (0) + +/* macros to work with surrogates */ +#define Py_UNICODE_IS_SURROGATE(ch) (0xD800 <= (ch) && (ch) <= 0xDFFF) +#define Py_UNICODE_IS_HIGH_SURROGATE(ch) (0xD800 <= (ch) && (ch) <= 0xDBFF) +#define Py_UNICODE_IS_LOW_SURROGATE(ch) (0xDC00 <= (ch) && (ch) <= 0xDFFF) +/* Join two surrogate characters and return a single Py_UCS4 value. */ +#define Py_UNICODE_JOIN_SURROGATES(high, low) \ + (((((Py_UCS4)(high)&0x03FF) << 10) | ((Py_UCS4)(low)&0x03FF)) + 0x10000) +/* high surrogate = top 10 bits added to D800 */ +#define Py_UNICODE_HIGH_SURROGATE(ch) (0xD800 - (0x10000 >> 10) + ((ch) >> 10)) +/* low surrogate = bottom 10 bits added to DC00 */ +#define Py_UNICODE_LOW_SURROGATE(ch) (0xDC00 + ((ch)&0x3FF)) + +/* Check if substring matches at given offset. The offset must be + valid, and the substring must not be empty. */ + +#define Py_UNICODE_MATCH(string, offset, substring) \ + ((*((string)->wstr + (offset)) == *((substring)->wstr)) && \ + ((*((string)->wstr + (offset) + (substring)->wstr_length - 1) == \ + *((substring)->wstr + (substring)->wstr_length - 1))) && \ + !memcmp( \ + (string)->wstr + (offset), \ + (substring)->wstr, \ + (substring)->wstr_length * sizeof(Py_UNICODE))) + +#endif /* Py_LIMITED_API */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* --- Unicode Type ------------------------------------------------------- */ + +#ifndef Py_LIMITED_API + +/* ASCII-only strings created through PyUnicode_New use the PyASCIIObject + structure. state.ascii and state.compact are set, and the data + immediately follow the structure. utf8_length and wstr_length can be found + in the length field; the utf8 pointer is equal to the data pointer. */ +typedef struct { + /* There are 4 forms of Unicode strings: + + - compact ascii: + + * structure = PyASCIIObject + * test: PyUnicode_IS_COMPACT_ASCII(op) + * kind = PyUnicode_1BYTE_KIND + * compact = 1 + * ascii = 1 + * ready = 1 + * (length is the length of the utf8 and wstr strings) + * (data starts just after the structure) + * (since ASCII is decoded from UTF-8, the utf8 string are the data) + + - compact: + + * structure = PyCompactUnicodeObject + * test: PyUnicode_IS_COMPACT(op) && !PyUnicode_IS_ASCII(op) + * kind = PyUnicode_1BYTE_KIND, PyUnicode_2BYTE_KIND or + PyUnicode_4BYTE_KIND + * compact = 1 + * ready = 1 + * ascii = 0 + * utf8 is not shared with data + * utf8_length = 0 if utf8 is NULL + * wstr is shared with data and wstr_length=length + if kind=PyUnicode_2BYTE_KIND and sizeof(wchar_t)=2 + or if kind=PyUnicode_4BYTE_KIND and sizeof(wchar_t)=4 + * wstr_length = 0 if wstr is NULL + * (data starts just after the structure) + + - legacy string, not ready: + + * structure = PyUnicodeObject + * test: kind == PyUnicode_WCHAR_KIND + * length = 0 (use wstr_length) + * hash = -1 + * kind = PyUnicode_WCHAR_KIND + * compact = 0 + * ascii = 0 + * ready = 0 + * interned = SSTATE_NOT_INTERNED + * wstr is not NULL + * data.any is NULL + * utf8 is NULL + * utf8_length = 0 + + - legacy string, ready: + + * structure = PyUnicodeObject structure + * test: !PyUnicode_IS_COMPACT(op) && kind != PyUnicode_WCHAR_KIND + * kind = PyUnicode_1BYTE_KIND, PyUnicode_2BYTE_KIND or + PyUnicode_4BYTE_KIND + * compact = 0 + * ready = 1 + * data.any is not NULL + * utf8 is shared and utf8_length = length with data.any if ascii = 1 + * utf8_length = 0 if utf8 is NULL + * wstr is shared with data.any and wstr_length = length + if kind=PyUnicode_2BYTE_KIND and sizeof(wchar_t)=2 + or if kind=PyUnicode_4BYTE_KIND and sizeof(wchar_4)=4 + * wstr_length = 0 if wstr is NULL + + Compact strings use only one memory block (structure + characters), + whereas legacy strings use one block for the structure and one block + for characters. + + Legacy strings are created by PyUnicode_FromUnicode() and + PyUnicode_FromStringAndSize(NULL, size) functions. They become ready + when PyUnicode_READY() is called. + + See also _PyUnicode_CheckConsistency(). + */ + PyObject_HEAD Py_ssize_t length; /* Number of code points in the string */ + Py_hash_t hash; /* Hash value; -1 if not set */ + struct { + /* + SSTATE_NOT_INTERNED (0) + SSTATE_INTERNED_MORTAL (1) + SSTATE_INTERNED_IMMORTAL (2) + + If interned != SSTATE_NOT_INTERNED, the two references from the + dictionary to this object are *not* counted in ob_refcnt. + */ + unsigned int interned : 2; + /* Character size: + + - PyUnicode_WCHAR_KIND (0): + + * character type = wchar_t (16 or 32 bits, depending on the + platform) + + - PyUnicode_1BYTE_KIND (1): + + * character type = Py_UCS1 (8 bits, unsigned) + * all characters are in the range U+0000-U+00FF (latin1) + * if ascii is set, all characters are in the range U+0000-U+007F + (ASCII), otherwise at least one character is in the range + U+0080-U+00FF + + - PyUnicode_2BYTE_KIND (2): + + * character type = Py_UCS2 (16 bits, unsigned) + * all characters are in the range U+0000-U+FFFF (BMP) + * at least one character is in the range U+0100-U+FFFF + + - PyUnicode_4BYTE_KIND (4): + + * character type = Py_UCS4 (32 bits, unsigned) + * all characters are in the range U+0000-U+10FFFF + * at least one character is in the range U+10000-U+10FFFF + */ + unsigned int kind : 3; + /* Compact is with respect to the allocation scheme. Compact unicode + objects only require one memory block while non-compact objects use + one block for the PyUnicodeObject struct and another for its data + buffer. */ + unsigned int compact : 1; + /* The string only contains characters in the range U+0000-U+007F (ASCII) + and the kind is PyUnicode_1BYTE_KIND. If ascii is set and compact is + set, use the PyASCIIObject structure. */ + unsigned int ascii : 1; + /* The ready flag indicates whether the object layout is initialized + completely. This means that this is either a compact object, or + the data pointer is filled out. The bit is redundant, and helps + to minimize the test in PyUnicode_IS_READY(). */ + unsigned int ready : 1; + /* Padding to ensure that PyUnicode_DATA() is always aligned to + 4 bytes (see issue #19537 on m68k). */ + unsigned int : 24; + } state; + wchar_t* wstr; /* wchar_t representation (null-terminated) */ +} PyASCIIObject; + +/* Non-ASCII strings allocated through PyUnicode_New use the + PyCompactUnicodeObject structure. state.compact is set, and the data + immediately follow the structure. */ +typedef struct { + PyASCIIObject _base; + Py_ssize_t utf8_length; /* Number of bytes in utf8, excluding the + * terminating \0. */ + char* utf8; /* UTF-8 representation (null-terminated) */ + Py_ssize_t wstr_length; /* Number of code points in wstr, possible + * surrogates count as two code points. */ +} PyCompactUnicodeObject; + +/* Strings allocated through PyUnicode_FromUnicode(NULL, len) use the + PyUnicodeObject structure. The actual string data is initially in the wstr + block, and copied into the data block using _PyUnicode_Ready. */ +typedef struct { + PyCompactUnicodeObject _base; + union { + void* any; + Py_UCS1* latin1; + Py_UCS2* ucs2; + Py_UCS4* ucs4; + } data; /* Canonical, smallest-form Unicode buffer */ +} PyUnicodeObject; +#endif + +PyAPI_DATA(PyTypeObject) PyUnicode_Type; +PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type; + +#define PyUnicode_Check(op) \ + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS) +#define PyUnicode_CheckExact(op) (Py_TYPE(op) == &PyUnicode_Type) + +/* Fast access macros */ +#ifndef Py_LIMITED_API + +#define PyUnicode_WSTR_LENGTH(op) \ + (PyUnicode_IS_COMPACT_ASCII(op) \ + ? ((PyASCIIObject*)op)->length \ + : ((PyCompactUnicodeObject*)op)->wstr_length) + +/* Returns the deprecated Py_UNICODE representation's size in code units + (this includes surrogate pairs as 2 units). + If the Py_UNICODE representation is not available, it will be computed + on request. Use PyUnicode_GET_LENGTH() for the length in code points. */ + +#define PyUnicode_GET_SIZE(op) \ + (assert(PyUnicode_Check(op)), \ + (((PyASCIIObject*)(op))->wstr) \ + ? PyUnicode_WSTR_LENGTH(op) \ + : ((void)PyUnicode_AsUnicode((PyObject*)(op)), \ + assert(((PyASCIIObject*)(op))->wstr), \ + PyUnicode_WSTR_LENGTH(op))) + +#define PyUnicode_GET_DATA_SIZE(op) (PyUnicode_GET_SIZE(op) * Py_UNICODE_SIZE) + +/* Alias for PyUnicode_AsUnicode(). This will create a wchar_t/Py_UNICODE + representation on demand. Using this macro is very inefficient now, + try to port your code to use the new PyUnicode_*BYTE_DATA() macros or + use PyUnicode_WRITE() and PyUnicode_READ(). */ + +#define PyUnicode_AS_UNICODE(op) \ + (assert(PyUnicode_Check(op)), \ + (((PyASCIIObject*)(op))->wstr) ? (((PyASCIIObject*)(op))->wstr) \ + : PyUnicode_AsUnicode((PyObject*)(op))) + +#define PyUnicode_AS_DATA(op) ((const char*)(PyUnicode_AS_UNICODE(op))) + +/* --- Flexible String Representation Helper Macros (PEP 393) -------------- */ + +/* Values for PyASCIIObject.state: */ + +/* Interning state. */ +#define SSTATE_NOT_INTERNED 0 +#define SSTATE_INTERNED_MORTAL 1 +#define SSTATE_INTERNED_IMMORTAL 2 + +/* Return true if the string contains only ASCII characters, or 0 if not. The + string may be compact (PyUnicode_IS_COMPACT_ASCII) or not, but must be + ready. */ +#define PyUnicode_IS_ASCII(op) \ + (assert(PyUnicode_Check(op)), \ + assert(PyUnicode_IS_READY(op)), \ + ((PyASCIIObject*)op)->state.ascii) + +/* Return true if the string is compact or 0 if not. + No type checks or Ready calls are performed. */ +#define PyUnicode_IS_COMPACT(op) (((PyASCIIObject*)(op))->state.compact) + +/* Return true if the string is a compact ASCII string (use PyASCIIObject + structure), or 0 if not. No type checks or Ready calls are performed. */ +#define PyUnicode_IS_COMPACT_ASCII(op) \ + (((PyASCIIObject*)op)->state.ascii && PyUnicode_IS_COMPACT(op)) + +enum PyUnicode_Kind { + /* String contains only wstr byte characters. This is only possible + when the string was created with a legacy API and _PyUnicode_Ready() + has not been called yet. */ + PyUnicode_WCHAR_KIND = 0, + /* Return values of the PyUnicode_KIND() macro: */ + PyUnicode_1BYTE_KIND = 1, + PyUnicode_2BYTE_KIND = 2, + PyUnicode_4BYTE_KIND = 4 +}; + +/* Return pointers to the canonical representation cast to unsigned char, + Py_UCS2, or Py_UCS4 for direct character access. + No checks are performed, use PyUnicode_KIND() before to ensure + these will work correctly. */ + +#define PyUnicode_1BYTE_DATA(op) ((Py_UCS1*)PyUnicode_DATA(op)) +#define PyUnicode_2BYTE_DATA(op) ((Py_UCS2*)PyUnicode_DATA(op)) +#define PyUnicode_4BYTE_DATA(op) ((Py_UCS4*)PyUnicode_DATA(op)) + +/* Return one of the PyUnicode_*_KIND values defined above. */ +#define PyUnicode_KIND(op) \ + (assert(PyUnicode_Check(op)), \ + assert(PyUnicode_IS_READY(op)), \ + ((PyASCIIObject*)(op))->state.kind) + +/* Return a void pointer to the raw unicode buffer. */ +#define _PyUnicode_COMPACT_DATA(op) \ + (PyUnicode_IS_ASCII(op) ? ((void*)((PyASCIIObject*)(op) + 1)) \ + : ((void*)((PyCompactUnicodeObject*)(op) + 1))) + +#define _PyUnicode_NONCOMPACT_DATA(op) \ + (assert(((PyUnicodeObject*)(op))->data.any), \ + ((((PyUnicodeObject*)(op))->data.any))) + +#define PyUnicode_DATA(op) \ + (assert(PyUnicode_Check(op)), \ + PyUnicode_IS_COMPACT(op) ? _PyUnicode_COMPACT_DATA(op) \ + : _PyUnicode_NONCOMPACT_DATA(op)) + +/* In the access macros below, "kind" may be evaluated more than once. + All other macro parameters are evaluated exactly once, so it is safe + to put side effects into them (such as increasing the index). */ + +/* Write into the canonical representation, this macro does not do any sanity + checks and is intended for usage in loops. The caller should cache the + kind and data pointers obtained from other macro calls. + index is the index in the string (starts at 0) and value is the new + code point value which should be written to that location. */ +#define PyUnicode_WRITE(kind, data, index, value) \ + do { \ + switch ((kind)) { \ + case PyUnicode_1BYTE_KIND: { \ + ((Py_UCS1*)(data))[(index)] = (Py_UCS1)(value); \ + break; \ + } \ + case PyUnicode_2BYTE_KIND: { \ + ((Py_UCS2*)(data))[(index)] = (Py_UCS2)(value); \ + break; \ + } \ + default: { \ + assert((kind) == PyUnicode_4BYTE_KIND); \ + ((Py_UCS4*)(data))[(index)] = (Py_UCS4)(value); \ + } \ + } \ + } while (0) + +/* Read a code point from the string's canonical representation. No checks + or ready calls are performed. */ +#define PyUnicode_READ(kind, data, index) \ + ((Py_UCS4)( \ + (kind) == PyUnicode_1BYTE_KIND \ + ? ((const Py_UCS1*)(data))[(index)] \ + : ((kind) == PyUnicode_2BYTE_KIND \ + ? ((const Py_UCS2*)(data))[(index)] \ + : ((const Py_UCS4*)(data))[(index)]))) + +/* PyUnicode_READ_CHAR() is less efficient than PyUnicode_READ() because it + calls PyUnicode_KIND() and might call it twice. For single reads, use + PyUnicode_READ_CHAR, for multiple consecutive reads callers should + cache kind and use PyUnicode_READ instead. */ +#define PyUnicode_READ_CHAR(unicode, index) \ + (assert(PyUnicode_Check(unicode)), \ + assert(PyUnicode_IS_READY(unicode)), \ + (Py_UCS4)( \ + PyUnicode_KIND((unicode)) == PyUnicode_1BYTE_KIND \ + ? ((const Py_UCS1*)(PyUnicode_DATA((unicode))))[(index)] \ + : (PyUnicode_KIND((unicode)) == PyUnicode_2BYTE_KIND \ + ? ((const Py_UCS2*)(PyUnicode_DATA((unicode))))[(index)] \ + : ((const Py_UCS4*)(PyUnicode_DATA((unicode))))[(index)]))) + +/* Returns the length of the unicode string. The caller has to make sure that + the string has it's canonical representation set before calling + this macro. Call PyUnicode_(FAST_)Ready to ensure that. */ +#define PyUnicode_GET_LENGTH(op) \ + (assert(PyUnicode_Check(op)), \ + assert(PyUnicode_IS_READY(op)), \ + ((PyASCIIObject*)(op))->length) + +/* Fast check to determine whether an object is ready. Equivalent to + PyUnicode_IS_COMPACT(op) || ((PyUnicodeObject*)(op))->data.any) */ + +#define PyUnicode_IS_READY(op) (((PyASCIIObject*)op)->state.ready) + +/* PyUnicode_READY() does less work than _PyUnicode_Ready() in the best + case. If the canonical representation is not yet set, it will still call + _PyUnicode_Ready(). + Returns 0 on success and -1 on errors. */ +#define PyUnicode_READY(op) \ + (assert(PyUnicode_Check(op)), \ + (PyUnicode_IS_READY(op) ? 0 : _PyUnicode_Ready((PyObject*)(op)))) + +/* Return a maximum character value which is suitable for creating another + string based on op. This is always an approximation but more efficient + than iterating over the string. */ +#define PyUnicode_MAX_CHAR_VALUE(op) \ + (assert(PyUnicode_IS_READY(op)), \ + (PyUnicode_IS_ASCII(op) \ + ? (0x7f) \ + : (PyUnicode_KIND(op) == PyUnicode_1BYTE_KIND \ + ? (0xffU) \ + : (PyUnicode_KIND(op) == PyUnicode_2BYTE_KIND ? (0xffffU) \ + : (0x10ffffU))))) + +#endif + +/* --- Constants ---------------------------------------------------------- */ + +/* This Unicode character will be used as replacement character during + decoding if the errors argument is set to "replace". Note: the + Unicode character U+FFFD is the official REPLACEMENT CHARACTER in + Unicode 3.0. */ + +#define Py_UNICODE_REPLACEMENT_CHARACTER ((Py_UCS4)0xFFFD) + +/* === Public API ========================================================= */ + +/* --- Plain Py_UNICODE --------------------------------------------------- */ + +/* With PEP 393, this is the recommended way to allocate a new unicode object. + This function will allocate the object and its buffer in a single memory + block. Objects created using this function are not resizable. */ +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) PyUnicode_New( + Py_ssize_t size, /* Number of code points in the new string */ + Py_UCS4 maxchar /* maximum code point value in the string */ + ); +#endif + +/* Initializes the canonical string representation from the deprecated + wstr/Py_UNICODE representation. This function is used to convert Unicode + objects which were created using the old API to the new flexible format + introduced with PEP 393. + + Don't call this function directly, use the public PyUnicode_READY() macro + instead. */ +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _PyUnicode_Ready( + PyObject* unicode /* Unicode object */ + ); +#endif + +/* Get a copy of a Unicode string. */ +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _PyUnicode_Copy(PyObject* unicode); +#endif + +/* Copy character from one unicode object into another, this function performs + character conversion when necessary and falls back to memcpy() if possible. + + Fail if to is too small (smaller than *how_many* or smaller than + len(from)-from_start), or if kind(from[from_start:from_start+how_many]) > + kind(to), or if *to* has more than 1 reference. + + Return the number of written character, or return -1 and raise an exception + on error. + + Pseudo-code: + + how_many = min(how_many, len(from) - from_start) + to[to_start:to_start+how_many] = from[from_start:from_start+how_many] + return how_many + + Note: The function doesn't write a terminating null character. + */ +#ifndef Py_LIMITED_API +PyAPI_FUNC(Py_ssize_t) PyUnicode_CopyCharacters( + PyObject* to, + Py_ssize_t to_start, + PyObject* from, + Py_ssize_t from_start, + Py_ssize_t how_many); + +/* Unsafe version of PyUnicode_CopyCharacters(): don't check arguments and so + may crash if parameters are invalid (e.g. if the output string + is too short). */ +PyAPI_FUNC(void) _PyUnicode_FastCopyCharacters( + PyObject* to, + Py_ssize_t to_start, + PyObject* from, + Py_ssize_t from_start, + Py_ssize_t how_many); +#endif + +#ifndef Py_LIMITED_API +/* Fill a string with a character: write fill_char into + unicode[start:start+length]. + + Fail if fill_char is bigger than the string maximum character, or if the + string has more than 1 reference. + + Return the number of written character, or return -1 and raise an exception + on error. */ +PyAPI_FUNC(Py_ssize_t) PyUnicode_Fill( + PyObject* unicode, + Py_ssize_t start, + Py_ssize_t length, + Py_UCS4 fill_char); + +/* Unsafe version of PyUnicode_Fill(): don't check arguments and so may crash + if parameters are invalid (e.g. if length is longer than the string). */ +PyAPI_FUNC(void) _PyUnicode_FastFill( + PyObject* unicode, + Py_ssize_t start, + Py_ssize_t length, + Py_UCS4 fill_char); +#endif + +/* Create a Unicode Object from the Py_UNICODE buffer u of the given + size. + + u may be NULL which causes the contents to be undefined. It is the + user's responsibility to fill in the needed data afterwards. Note + that modifying the Unicode object contents after construction is + only allowed if u was set to NULL. + + The buffer is copied into the new object. */ + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode( + const Py_UNICODE* u, /* Unicode buffer */ + Py_ssize_t size /* size of buffer */ + ); +#endif + +/* Similar to PyUnicode_FromUnicode(), but u points to UTF-8 encoded bytes */ +PyAPI_FUNC(PyObject*) PyUnicode_FromStringAndSize( + const char* u, /* UTF-8 encoded string */ + Py_ssize_t size /* size of buffer */ + ); + +/* Similar to PyUnicode_FromUnicode(), but u points to null-terminated + UTF-8 encoded bytes. The size is determined with strlen(). */ +PyAPI_FUNC(PyObject*) PyUnicode_FromString( + const char* u /* UTF-8 encoded string */ + ); + +#ifndef Py_LIMITED_API +/* Create a new string from a buffer of Py_UCS1, Py_UCS2 or Py_UCS4 characters. + Scan the string to find the maximum character. */ +PyAPI_FUNC(PyObject*) + PyUnicode_FromKindAndData(int kind, const void* buffer, Py_ssize_t size); + +/* Create a new string from a buffer of ASCII characters. + WARNING: Don't check if the string contains any non-ASCII character. */ +PyAPI_FUNC(PyObject*) _PyUnicode_FromASCII(const char* buffer, Py_ssize_t size); +#endif + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03030000 +PyAPI_FUNC(PyObject*) + PyUnicode_Substring(PyObject* str, Py_ssize_t start, Py_ssize_t end); +#endif + +#ifndef Py_LIMITED_API +/* Compute the maximum character of the substring unicode[start:end]. + Return 127 for an empty string. */ +PyAPI_FUNC(Py_UCS4) + _PyUnicode_FindMaxChar(PyObject* unicode, Py_ssize_t start, Py_ssize_t end); +#endif + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03030000 +/* Copy the string into a UCS4 buffer including the null character if copy_null + is set. Return NULL and raise an exception on error. Raise a SystemError if + the buffer is smaller than the string. Return buffer on success. + + buflen is the length of the buffer in (Py_UCS4) characters. */ +PyAPI_FUNC(Py_UCS4*) PyUnicode_AsUCS4( + PyObject* unicode, + Py_UCS4* buffer, + Py_ssize_t buflen, + int copy_null); + +/* Copy the string into a UCS4 buffer. A new buffer is allocated using + * PyMem_Malloc; if this fails, NULL is returned with a memory error + exception set. */ +PyAPI_FUNC(Py_UCS4*) PyUnicode_AsUCS4Copy(PyObject* unicode); +#endif + +#ifndef Py_LIMITED_API +/* Return a read-only pointer to the Unicode object's internal + Py_UNICODE buffer. + If the wchar_t/Py_UNICODE representation is not yet available, this + function will calculate it. */ + +PyAPI_FUNC(Py_UNICODE*) PyUnicode_AsUnicode( + PyObject* unicode /* Unicode object */ + ); + +/* Similar to PyUnicode_AsUnicode(), but raises a ValueError if the string + contains null characters. */ +PyAPI_FUNC(const Py_UNICODE*) _PyUnicode_AsUnicode( + PyObject* unicode /* Unicode object */ + ); + +/* Return a read-only pointer to the Unicode object's internal + Py_UNICODE buffer and save the length at size. + If the wchar_t/Py_UNICODE representation is not yet available, this + function will calculate it. */ + +PyAPI_FUNC(Py_UNICODE*) PyUnicode_AsUnicodeAndSize( + PyObject* unicode, /* Unicode object */ + Py_ssize_t* size /* location where to save the length */ + ); +#endif + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03030000 +/* Get the length of the Unicode object. */ + +PyAPI_FUNC(Py_ssize_t) PyUnicode_GetLength(PyObject* unicode); +#endif + +/* Get the number of Py_UNICODE units in the + string representation. */ + +PyAPI_FUNC(Py_ssize_t) PyUnicode_GetSize( + PyObject* unicode /* Unicode object */ + ); + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03030000 +/* Read a character from the string. */ + +PyAPI_FUNC(Py_UCS4) PyUnicode_ReadChar(PyObject* unicode, Py_ssize_t index); + +/* Write a character to the string. The string must have been created through + PyUnicode_New, must not be shared, and must not have been hashed yet. + + Return 0 on success, -1 on error. */ + +PyAPI_FUNC(int) + PyUnicode_WriteChar(PyObject* unicode, Py_ssize_t index, Py_UCS4 character); +#endif + +#ifndef Py_LIMITED_API +/* Get the maximum ordinal for a Unicode character. */ +PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void); +#endif + +/* Resize a Unicode object. The length is the number of characters, except + if the kind of the string is PyUnicode_WCHAR_KIND: in this case, the length + is the number of Py_UNICODE characters. + + *unicode is modified to point to the new (resized) object and 0 + returned on success. + + Try to resize the string in place (which is usually faster than allocating + a new string and copy characters), or create a new string. + + Error handling is implemented as follows: an exception is set, -1 + is returned and *unicode left untouched. + + WARNING: The function doesn't check string content, the result may not be a + string in canonical representation. */ + +PyAPI_FUNC(int) PyUnicode_Resize( + PyObject** unicode, /* Pointer to the Unicode object */ + Py_ssize_t length /* New length */ + ); + +/* Decode obj to a Unicode object. + + bytes, bytearray and other bytes-like objects are decoded according to the + given encoding and error handler. The encoding and error handler can be + NULL to have the interface use UTF-8 and "strict". + + All other objects (including Unicode objects) raise an exception. + + The API returns NULL in case of an error. The caller is responsible + for decref'ing the returned objects. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_FromEncodedObject( + PyObject* obj, /* Object */ + const char* encoding, /* encoding */ + const char* errors /* error handling */ + ); + +/* Copy an instance of a Unicode subtype to a new true Unicode object if + necessary. If obj is already a true Unicode object (not a subtype), return + the reference with *incremented* refcount. + + The API returns NULL in case of an error. The caller is responsible + for decref'ing the returned objects. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_FromObject( + PyObject* obj /* Object */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_FromFormatV( + const char* format, /* ASCII-encoded string */ + va_list vargs); +PyAPI_FUNC(PyObject*) PyUnicode_FromFormat( + const char* format, /* ASCII-encoded string */ + ...); + +#ifndef Py_LIMITED_API +typedef struct { + PyObject* buffer; + void* data; + enum PyUnicode_Kind kind; + Py_UCS4 maxchar; + Py_ssize_t size; + Py_ssize_t pos; + + /* minimum number of allocated characters (default: 0) */ + Py_ssize_t min_length; + + /* minimum character (default: 127, ASCII) */ + Py_UCS4 min_char; + + /* If non-zero, overallocate the buffer (default: 0). */ + unsigned char overallocate; + + /* If readonly is 1, buffer is a shared string (cannot be modified) + and size is set to 0. */ + unsigned char readonly; +} _PyUnicodeWriter; + +/* Initialize a Unicode writer. + * + * By default, the minimum buffer size is 0 character and overallocation is + * disabled. Set min_length, min_char and overallocate attributes to control + * the allocation of the buffer. */ +PyAPI_FUNC(void) _PyUnicodeWriter_Init(_PyUnicodeWriter* writer); + +/* Prepare the buffer to write 'length' characters + with the specified maximum character. + + Return 0 on success, raise an exception and return -1 on error. */ +#define _PyUnicodeWriter_Prepare(WRITER, LENGTH, MAXCHAR) \ + (((MAXCHAR) <= (WRITER)->maxchar && \ + (LENGTH) <= (WRITER)->size - (WRITER)->pos) \ + ? 0 \ + : (((LENGTH) == 0) ? 0 : _PyUnicodeWriter_PrepareInternal( \ + (WRITER), (LENGTH), (MAXCHAR)))) + +/* Don't call this function directly, use the _PyUnicodeWriter_Prepare() macro + instead. */ +PyAPI_FUNC(int) _PyUnicodeWriter_PrepareInternal( + _PyUnicodeWriter* writer, + Py_ssize_t length, + Py_UCS4 maxchar); + +/* Prepare the buffer to have at least the kind KIND. + For example, kind=PyUnicode_2BYTE_KIND ensures that the writer will + support characters in range U+000-U+FFFF. + + Return 0 on success, raise an exception and return -1 on error. */ +#define _PyUnicodeWriter_PrepareKind(WRITER, KIND) \ + (assert((KIND) != PyUnicode_WCHAR_KIND), \ + (KIND) <= (WRITER)->kind ? 0 : _PyUnicodeWriter_PrepareKindInternal( \ + (WRITER), (KIND))) + +/* Don't call this function directly, use the _PyUnicodeWriter_PrepareKind() + macro instead. */ +PyAPI_FUNC(int) _PyUnicodeWriter_PrepareKindInternal( + _PyUnicodeWriter* writer, + enum PyUnicode_Kind kind); + +/* Append a Unicode character. + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) + _PyUnicodeWriter_WriteChar(_PyUnicodeWriter* writer, Py_UCS4 ch); + +/* Append a Unicode string. + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) _PyUnicodeWriter_WriteStr( + _PyUnicodeWriter* writer, + PyObject* str /* Unicode string */ + ); + +/* Append a substring of a Unicode string. + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) _PyUnicodeWriter_WriteSubstring( + _PyUnicodeWriter* writer, + PyObject* str, /* Unicode string */ + Py_ssize_t start, + Py_ssize_t end); + +/* Append an ASCII-encoded byte string. + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) _PyUnicodeWriter_WriteASCIIString( + _PyUnicodeWriter* writer, + const char* str, /* ASCII-encoded byte string */ + Py_ssize_t len /* number of bytes, or -1 if unknown */ + ); + +/* Append a latin1-encoded byte string. + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) _PyUnicodeWriter_WriteLatin1String( + _PyUnicodeWriter* writer, + const char* str, /* latin1-encoded byte string */ + Py_ssize_t len /* length in bytes */ + ); + +/* Get the value of the writer as a Unicode string. Clear the + buffer of the writer. Raise an exception and return NULL + on error. */ +PyAPI_FUNC(PyObject*) _PyUnicodeWriter_Finish(_PyUnicodeWriter* writer); + +/* Deallocate memory of a writer (clear its internal buffer). */ +PyAPI_FUNC(void) _PyUnicodeWriter_Dealloc(_PyUnicodeWriter* writer); +#endif + +#ifndef Py_LIMITED_API +/* Format the object based on the format_spec, as defined in PEP 3101 + (Advanced String Formatting). */ +PyAPI_FUNC(int) _PyUnicode_FormatAdvancedWriter( + _PyUnicodeWriter* writer, + PyObject* obj, + PyObject* format_spec, + Py_ssize_t start, + Py_ssize_t end); +#endif + +PyAPI_FUNC(void) PyUnicode_InternInPlace(PyObject**); +PyAPI_FUNC(void) PyUnicode_InternImmortal(PyObject**); +PyAPI_FUNC(PyObject*) PyUnicode_InternFromString( + const char* u /* UTF-8 encoded string */ + ); +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) _Py_ReleaseInternedUnicodeStrings(void); +#endif + +/* Use only if you know it's a string */ +#define PyUnicode_CHECK_INTERNED(op) (((PyASCIIObject*)(op))->state.interned) + +/* --- wchar_t support for platforms which support it --------------------- */ + +#ifdef HAVE_WCHAR_H + +/* Create a Unicode Object from the wchar_t buffer w of the given + size. + + The buffer is copied into the new object. */ + +PyAPI_FUNC(PyObject*) PyUnicode_FromWideChar( + const wchar_t* w, /* wchar_t buffer */ + Py_ssize_t size /* size of buffer */ + ); + +/* Copies the Unicode Object contents into the wchar_t buffer w. At + most size wchar_t characters are copied. + + Note that the resulting wchar_t string may or may not be + 0-terminated. It is the responsibility of the caller to make sure + that the wchar_t string is 0-terminated in case this is required by + the application. + + Returns the number of wchar_t characters copied (excluding a + possibly trailing 0-termination character) or -1 in case of an + error. */ + +PyAPI_FUNC(Py_ssize_t) PyUnicode_AsWideChar( + PyObject* unicode, /* Unicode object */ + wchar_t* w, /* wchar_t buffer */ + Py_ssize_t size /* size of buffer */ + ); + +/* Convert the Unicode object to a wide character string. The output string + always ends with a nul character. If size is not NULL, write the number of + wide characters (excluding the null character) into *size. + + Returns a buffer allocated by PyMem_Malloc() (use PyMem_Free() to free it) + on success. On error, returns NULL, *size is undefined and raises a + MemoryError. */ + +PyAPI_FUNC(wchar_t*) PyUnicode_AsWideCharString( + PyObject* unicode, /* Unicode object */ + Py_ssize_t* size /* number of characters of the result */ + ); + +#ifndef Py_LIMITED_API +/* Similar to PyUnicode_AsWideCharString(unicode, NULL), but check if + the string contains null characters. */ +PyAPI_FUNC(wchar_t*) _PyUnicode_AsWideCharString( + PyObject* unicode /* Unicode object */ + ); + +PyAPI_FUNC(void*) _PyUnicode_AsKind(PyObject* s, unsigned int kind); +#endif + +#endif + +/* --- Unicode ordinals --------------------------------------------------- */ + +/* Create a Unicode Object from the given Unicode code point ordinal. + + The ordinal must be in range(0x110000). A ValueError is + raised in case it is not. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_FromOrdinal(int ordinal); + +/* --- Free-list management ----------------------------------------------- */ + +/* Clear the free list used by the Unicode implementation. + + This can be used to release memory used for objects on the free + list back to the Python memory allocator. + +*/ + +PyAPI_FUNC(int) PyUnicode_ClearFreeList(void); + +/* === Builtin Codecs ===================================================== + + Many of these APIs take two arguments encoding and errors. These + parameters encoding and errors have the same semantics as the ones + of the builtin str() API. + + Setting encoding to NULL causes the default encoding (UTF-8) to be used. + + Error handling is set by errors which may also be set to NULL + meaning to use the default handling defined for the codec. Default + error handling for all builtin codecs is "strict" (ValueErrors are + raised). + + The codecs all use a similar interface. Only deviation from the + generic ones are documented. + +*/ + +/* --- Manage the default encoding ---------------------------------------- */ + +/* Returns a pointer to the default encoding (UTF-8) of the + Unicode object unicode and the size of the encoded representation + in bytes stored in *size. + + In case of an error, no *size is set. + + This function caches the UTF-8 encoded string in the unicodeobject + and subsequent calls will return the same string. The memory is released + when the unicodeobject is deallocated. + + _PyUnicode_AsStringAndSize is a #define for PyUnicode_AsUTF8AndSize to + support the previous internal function with the same behaviour. + + *** This API is for interpreter INTERNAL USE ONLY and will likely + *** be removed or changed in the future. + + *** If you need to access the Unicode object as UTF-8 bytes string, + *** please use PyUnicode_AsUTF8String() instead. +*/ + +#ifndef Py_LIMITED_API +PyAPI_FUNC(char*) PyUnicode_AsUTF8AndSize(PyObject* unicode, Py_ssize_t* size); +#define _PyUnicode_AsStringAndSize PyUnicode_AsUTF8AndSize +#endif + +/* Returns a pointer to the default encoding (UTF-8) of the + Unicode object unicode. + + Like PyUnicode_AsUTF8AndSize(), this also caches the UTF-8 representation + in the unicodeobject. + + _PyUnicode_AsString is a #define for PyUnicode_AsUTF8 to + support the previous internal function with the same behaviour. + + Use of this API is DEPRECATED since no size information can be + extracted from the returned data. + + *** This API is for interpreter INTERNAL USE ONLY and will likely + *** be removed or changed for Python 3.1. + + *** If you need to access the Unicode object as UTF-8 bytes string, + *** please use PyUnicode_AsUTF8String() instead. + +*/ + +#ifndef Py_LIMITED_API +PyAPI_FUNC(char*) PyUnicode_AsUTF8(PyObject* unicode); +#define _PyUnicode_AsString PyUnicode_AsUTF8 +#endif + +/* Returns "utf-8". */ + +PyAPI_FUNC(const char*) PyUnicode_GetDefaultEncoding(void); + +/* --- Generic Codecs ----------------------------------------------------- */ + +/* Create a Unicode object by decoding the encoded string s of the + given size. */ + +PyAPI_FUNC(PyObject*) PyUnicode_Decode( + const char* s, /* encoded string */ + Py_ssize_t size, /* size of buffer */ + const char* encoding, /* encoding */ + const char* errors /* error handling */ + ); + +/* Decode a Unicode object unicode and return the result as Python + object. + + This API is DEPRECATED. The only supported standard encoding is rot13. + Use PyCodec_Decode() to decode with rot13 and non-standard codecs + that decode from str. */ + +PyAPI_FUNC(PyObject*) PyUnicode_AsDecodedObject( + PyObject* unicode, /* Unicode object */ + const char* encoding, /* encoding */ + const char* errors /* error handling */ + ) Py_DEPRECATED(3.6); + +/* Decode a Unicode object unicode and return the result as Unicode + object. + + This API is DEPRECATED. The only supported standard encoding is rot13. + Use PyCodec_Decode() to decode with rot13 and non-standard codecs + that decode from str to str. */ + +PyAPI_FUNC(PyObject*) PyUnicode_AsDecodedUnicode( + PyObject* unicode, /* Unicode object */ + const char* encoding, /* encoding */ + const char* errors /* error handling */ + ) Py_DEPRECATED(3.6); + +/* Encodes a Py_UNICODE buffer of the given size and returns a + Python string object. */ + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) PyUnicode_Encode( + const Py_UNICODE* s, /* Unicode char buffer */ + Py_ssize_t size, /* number of Py_UNICODE chars to encode */ + const char* encoding, /* encoding */ + const char* errors /* error handling */ + ); +#endif + +/* Encodes a Unicode object and returns the result as Python + object. + + This API is DEPRECATED. It is superceeded by PyUnicode_AsEncodedString() + since all standard encodings (except rot13) encode str to bytes. + Use PyCodec_Encode() for encoding with rot13 and non-standard codecs + that encode form str to non-bytes. */ + +PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedObject( + PyObject* unicode, /* Unicode object */ + const char* encoding, /* encoding */ + const char* errors /* error handling */ + ) Py_DEPRECATED(3.6); + +/* Encodes a Unicode object and returns the result as Python string + object. */ + +PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedString( + PyObject* unicode, /* Unicode object */ + const char* encoding, /* encoding */ + const char* errors /* error handling */ + ); + +/* Encodes a Unicode object and returns the result as Unicode + object. + + This API is DEPRECATED. The only supported standard encodings is rot13. + Use PyCodec_Encode() to encode with rot13 and non-standard codecs + that encode from str to str. */ + +PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedUnicode( + PyObject* unicode, /* Unicode object */ + const char* encoding, /* encoding */ + const char* errors /* error handling */ + ) Py_DEPRECATED(3.6); + +/* Build an encoding map. */ + +PyAPI_FUNC(PyObject*) PyUnicode_BuildEncodingMap( + PyObject* string /* 256 character map */ + ); + +/* --- UTF-7 Codecs ------------------------------------------------------- */ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7( + const char* string, /* UTF-7 encoded string */ + Py_ssize_t length, /* size of string */ + const char* errors /* error handling */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7Stateful( + const char* string, /* UTF-7 encoded string */ + Py_ssize_t length, /* size of string */ + const char* errors, /* error handling */ + Py_ssize_t* consumed /* bytes consumed */ + ); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF7( + const Py_UNICODE* data, /* Unicode char buffer */ + Py_ssize_t length, /* number of Py_UNICODE chars to encode */ + int base64SetO, /* Encode RFC2152 Set O characters in base64 */ + int base64WhiteSpace, /* Encode whitespace (sp, ht, nl, cr) in base64 */ + const char* errors /* error handling */ + ); +PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF7( + PyObject* unicode, /* Unicode object */ + int base64SetO, /* Encode RFC2152 Set O characters in base64 */ + int base64WhiteSpace, /* Encode whitespace (sp, ht, nl, cr) in base64 */ + const char* errors /* error handling */ + ); +#endif + +/* --- UTF-8 Codecs ------------------------------------------------------- */ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8( + const char* string, /* UTF-8 encoded string */ + Py_ssize_t length, /* size of string */ + const char* errors /* error handling */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8Stateful( + const char* string, /* UTF-8 encoded string */ + Py_ssize_t length, /* size of string */ + const char* errors, /* error handling */ + Py_ssize_t* consumed /* bytes consumed */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_AsUTF8String( + PyObject* unicode /* Unicode object */ + ); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) + _PyUnicode_AsUTF8String(PyObject* unicode, const char* errors); + +PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8( + const Py_UNICODE* data, /* Unicode char buffer */ + Py_ssize_t length, /* number of Py_UNICODE chars to encode */ + const char* errors /* error handling */ + ); +#endif + +/* --- UTF-32 Codecs ------------------------------------------------------ */ + +/* Decodes length bytes from a UTF-32 encoded buffer string and returns + the corresponding Unicode object. + + errors (if non-NULL) defines the error handling. It defaults + to "strict". + + If byteorder is non-NULL, the decoder starts decoding using the + given byte order: + + *byteorder == -1: little endian + *byteorder == 0: native order + *byteorder == 1: big endian + + In native mode, the first four bytes of the stream are checked for a + BOM mark. If found, the BOM mark is analysed, the byte order + adjusted and the BOM skipped. In the other modes, no BOM mark + interpretation is done. After completion, *byteorder is set to the + current byte order at the end of input data. + + If byteorder is NULL, the codec starts in native order mode. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32( + const char* string, /* UTF-32 encoded string */ + Py_ssize_t length, /* size of string */ + const char* errors, /* error handling */ + int* byteorder /* pointer to byteorder to use + 0=native;-1=LE,1=BE; updated on + exit */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32Stateful( + const char* string, /* UTF-32 encoded string */ + Py_ssize_t length, /* size of string */ + const char* errors, /* error handling */ + int* byteorder, /* pointer to byteorder to use + 0=native;-1=LE,1=BE; updated on + exit */ + Py_ssize_t* consumed /* bytes consumed */ + ); + +/* Returns a Python string using the UTF-32 encoding in native byte + order. The string always starts with a BOM mark. */ + +PyAPI_FUNC(PyObject*) PyUnicode_AsUTF32String( + PyObject* unicode /* Unicode object */ + ); + +/* Returns a Python string object holding the UTF-32 encoded value of + the Unicode data. + + If byteorder is not 0, output is written according to the following + byte order: + + byteorder == -1: little endian + byteorder == 0: native byte order (writes a BOM mark) + byteorder == 1: big endian + + If byteorder is 0, the output string will always start with the + Unicode BOM mark (U+FEFF). In the other two modes, no BOM mark is + prepended. + +*/ + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF32( + const Py_UNICODE* data, /* Unicode char buffer */ + Py_ssize_t length, /* number of Py_UNICODE chars to encode */ + const char* errors, /* error handling */ + int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ + ); +PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF32( + PyObject* object, /* Unicode object */ + const char* errors, /* error handling */ + int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ + ); +#endif + +/* --- UTF-16 Codecs ------------------------------------------------------ */ + +/* Decodes length bytes from a UTF-16 encoded buffer string and returns + the corresponding Unicode object. + + errors (if non-NULL) defines the error handling. It defaults + to "strict". + + If byteorder is non-NULL, the decoder starts decoding using the + given byte order: + + *byteorder == -1: little endian + *byteorder == 0: native order + *byteorder == 1: big endian + + In native mode, the first two bytes of the stream are checked for a + BOM mark. If found, the BOM mark is analysed, the byte order + adjusted and the BOM skipped. In the other modes, no BOM mark + interpretation is done. After completion, *byteorder is set to the + current byte order at the end of input data. + + If byteorder is NULL, the codec starts in native order mode. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16( + const char* string, /* UTF-16 encoded string */ + Py_ssize_t length, /* size of string */ + const char* errors, /* error handling */ + int* byteorder /* pointer to byteorder to use + 0=native;-1=LE,1=BE; updated on + exit */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16Stateful( + const char* string, /* UTF-16 encoded string */ + Py_ssize_t length, /* size of string */ + const char* errors, /* error handling */ + int* byteorder, /* pointer to byteorder to use + 0=native;-1=LE,1=BE; updated on + exit */ + Py_ssize_t* consumed /* bytes consumed */ + ); + +/* Returns a Python string using the UTF-16 encoding in native byte + order. The string always starts with a BOM mark. */ + +PyAPI_FUNC(PyObject*) PyUnicode_AsUTF16String( + PyObject* unicode /* Unicode object */ + ); + +/* Returns a Python string object holding the UTF-16 encoded value of + the Unicode data. + + If byteorder is not 0, output is written according to the following + byte order: + + byteorder == -1: little endian + byteorder == 0: native byte order (writes a BOM mark) + byteorder == 1: big endian + + If byteorder is 0, the output string will always start with the + Unicode BOM mark (U+FEFF). In the other two modes, no BOM mark is + prepended. + + Note that Py_UNICODE data is being interpreted as UTF-16 reduced to + UCS-2. This trick makes it possible to add full UTF-16 capabilities + at a later point without compromising the APIs. + +*/ + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF16( + const Py_UNICODE* data, /* Unicode char buffer */ + Py_ssize_t length, /* number of Py_UNICODE chars to encode */ + const char* errors, /* error handling */ + int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ + ); +PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF16( + PyObject* unicode, /* Unicode object */ + const char* errors, /* error handling */ + int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ + ); +#endif + +/* --- Unicode-Escape Codecs ---------------------------------------------- */ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUnicodeEscape( + const char* string, /* Unicode-Escape encoded string */ + Py_ssize_t length, /* size of string */ + const char* errors /* error handling */ + ); + +#ifndef Py_LIMITED_API +/* Helper for PyUnicode_DecodeUnicodeEscape that detects invalid escape + chars. */ +PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscape( + const char* string, /* Unicode-Escape encoded string */ + Py_ssize_t length, /* size of string */ + const char* errors, /* error handling */ + const char** first_invalid_escape /* on return, points to first + invalid escaped char in + string. */ + ); +#endif + +PyAPI_FUNC(PyObject*) PyUnicode_AsUnicodeEscapeString( + PyObject* unicode /* Unicode object */ + ); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) PyUnicode_EncodeUnicodeEscape( + const Py_UNICODE* data, /* Unicode char buffer */ + Py_ssize_t length /* Number of Py_UNICODE chars to encode */ + ); +#endif + +/* --- Raw-Unicode-Escape Codecs ------------------------------------------ */ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeRawUnicodeEscape( + const char* string, /* Raw-Unicode-Escape encoded string */ + Py_ssize_t length, /* size of string */ + const char* errors /* error handling */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_AsRawUnicodeEscapeString( + PyObject* unicode /* Unicode object */ + ); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) PyUnicode_EncodeRawUnicodeEscape( + const Py_UNICODE* data, /* Unicode char buffer */ + Py_ssize_t length /* Number of Py_UNICODE chars to encode */ + ); +#endif + +/* --- Unicode Internal Codec --------------------------------------------- + + Only for internal use in _codecsmodule.c */ + +#ifndef Py_LIMITED_API +PyObject* _PyUnicode_DecodeUnicodeInternal( + const char* string, + Py_ssize_t length, + const char* errors); +#endif + +/* --- Latin-1 Codecs ----------------------------------------------------- + + Note: Latin-1 corresponds to the first 256 Unicode ordinals. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeLatin1( + const char* string, /* Latin-1 encoded string */ + Py_ssize_t length, /* size of string */ + const char* errors /* error handling */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_AsLatin1String( + PyObject* unicode /* Unicode object */ + ); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) + _PyUnicode_AsLatin1String(PyObject* unicode, const char* errors); + +PyAPI_FUNC(PyObject*) PyUnicode_EncodeLatin1( + const Py_UNICODE* data, /* Unicode char buffer */ + Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ + const char* errors /* error handling */ + ); +#endif + +/* --- ASCII Codecs ------------------------------------------------------- + + Only 7-bit ASCII data is excepted. All other codes generate errors. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeASCII( + const char* string, /* ASCII encoded string */ + Py_ssize_t length, /* size of string */ + const char* errors /* error handling */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_AsASCIIString( + PyObject* unicode /* Unicode object */ + ); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) + _PyUnicode_AsASCIIString(PyObject* unicode, const char* errors); + +PyAPI_FUNC(PyObject*) PyUnicode_EncodeASCII( + const Py_UNICODE* data, /* Unicode char buffer */ + Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ + const char* errors /* error handling */ + ); +#endif + +/* --- Character Map Codecs ----------------------------------------------- + + This codec uses mappings to encode and decode characters. + + Decoding mappings must map byte ordinals (integers in the range from 0 to + 255) to Unicode strings, integers (which are then interpreted as Unicode + ordinals) or None. Unmapped data bytes (ones which cause a LookupError) + as well as mapped to None, 0xFFFE or '\ufffe' are treated as "undefined + mapping" and cause an error. + + Encoding mappings must map Unicode ordinal integers to bytes objects, + integers in the range from 0 to 255 or None. Unmapped character + ordinals (ones which cause a LookupError) as well as mapped to + None are treated as "undefined mapping" and cause an error. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeCharmap( + const char* string, /* Encoded string */ + Py_ssize_t length, /* size of string */ + PyObject* mapping, /* decoding mapping */ + const char* errors /* error handling */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_AsCharmapString( + PyObject* unicode, /* Unicode object */ + PyObject* mapping /* encoding mapping */ + ); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) PyUnicode_EncodeCharmap( + const Py_UNICODE* data, /* Unicode char buffer */ + Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ + PyObject* mapping, /* encoding mapping */ + const char* errors /* error handling */ + ); +PyAPI_FUNC(PyObject*) _PyUnicode_EncodeCharmap( + PyObject* unicode, /* Unicode object */ + PyObject* mapping, /* encoding mapping */ + const char* errors /* error handling */ + ); +#endif + +/* Translate a Py_UNICODE buffer of the given length by applying a + character mapping table to it and return the resulting Unicode + object. + + The mapping table must map Unicode ordinal integers to Unicode strings, + Unicode ordinal integers or None (causing deletion of the character). + + Mapping tables may be dictionaries or sequences. Unmapped character + ordinals (ones which cause a LookupError) are left untouched and + are copied as-is. + +*/ + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) PyUnicode_TranslateCharmap( + const Py_UNICODE* data, /* Unicode char buffer */ + Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ + PyObject* table, /* Translate table */ + const char* errors /* error handling */ + ); +#endif + +#ifdef MS_WINDOWS + +/* --- MBCS codecs for Windows -------------------------------------------- */ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeMBCS( + const char* string, /* MBCS encoded string */ + Py_ssize_t length, /* size of string */ + const char* errors /* error handling */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeMBCSStateful( + const char* string, /* MBCS encoded string */ + Py_ssize_t length, /* size of string */ + const char* errors, /* error handling */ + Py_ssize_t* consumed /* bytes consumed */ + ); + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03030000 +PyAPI_FUNC(PyObject*) PyUnicode_DecodeCodePageStateful( + int code_page, /* code page number */ + const char* string, /* encoded string */ + Py_ssize_t length, /* size of string */ + const char* errors, /* error handling */ + Py_ssize_t* consumed /* bytes consumed */ + ); +#endif + +PyAPI_FUNC(PyObject*) PyUnicode_AsMBCSString( + PyObject* unicode /* Unicode object */ + ); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) PyUnicode_EncodeMBCS( + const Py_UNICODE* data, /* Unicode char buffer */ + Py_ssize_t length, /* number of Py_UNICODE chars to encode */ + const char* errors /* error handling */ + ); +#endif + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03030000 +PyAPI_FUNC(PyObject*) PyUnicode_EncodeCodePage( + int code_page, /* code page number */ + PyObject* unicode, /* Unicode object */ + const char* errors /* error handling */ + ); +#endif + +#endif /* MS_WINDOWS */ + +/* --- Decimal Encoder ---------------------------------------------------- */ + +/* Takes a Unicode string holding a decimal value and writes it into + an output buffer using standard ASCII digit codes. + + The output buffer has to provide at least length+1 bytes of storage + area. The output string is 0-terminated. + + The encoder converts whitespace to ' ', decimal characters to their + corresponding ASCII digit and all other Latin-1 characters except + \0 as-is. Characters outside this range (Unicode ordinals 1-256) + are treated as errors. This includes embedded NULL bytes. + + Error handling is defined by the errors argument: + + NULL or "strict": raise a ValueError + "ignore": ignore the wrong characters (these are not copied to the + output buffer) + "replace": replaces illegal characters with '?' + + Returns 0 on success, -1 on failure. + +*/ + +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) PyUnicode_EncodeDecimal( + Py_UNICODE* s, /* Unicode buffer */ + Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ + char* output, /* Output buffer; must have size >= length */ + const char* errors /* error handling */ + ); +#endif + +/* Transforms code points that have decimal digit property to the + corresponding ASCII digit code points. + + Returns a new Unicode string on success, NULL on failure. +*/ + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) PyUnicode_TransformDecimalToASCII( + Py_UNICODE* s, /* Unicode buffer */ + Py_ssize_t length /* Number of Py_UNICODE chars to transform */ + ); +#endif + +/* Similar to PyUnicode_TransformDecimalToASCII(), but takes a PyObject + as argument instead of a raw buffer and length. This function additionally + transforms spaces to ASCII because this is what the callers in longobject, + floatobject, and complexobject did anyways. */ + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _PyUnicode_TransformDecimalAndSpaceToASCII( + PyObject* unicode /* Unicode object */ + ); +#endif + +/* --- Locale encoding --------------------------------------------------- */ + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03030000 +/* Decode a string from the current locale encoding. The decoder is strict if + *surrogateescape* is equal to zero, otherwise it uses the 'surrogateescape' + error handler (PEP 383) to escape undecodable bytes. If a byte sequence can + be decoded as a surrogate character and *surrogateescape* is not equal to + zero, the byte sequence is escaped using the 'surrogateescape' error handler + instead of being decoded. *str* must end with a null character but cannot + contain embedded null characters. */ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeLocaleAndSize( + const char* str, + Py_ssize_t len, + const char* errors); + +/* Similar to PyUnicode_DecodeLocaleAndSize(), but compute the string + length using strlen(). */ + +PyAPI_FUNC(PyObject*) + PyUnicode_DecodeLocale(const char* str, const char* errors); + +/* Encode a Unicode object to the current locale encoding. The encoder is + strict is *surrogateescape* is equal to zero, otherwise the + "surrogateescape" error handler is used. Return a bytes object. The string + cannot contain embedded null characters. */ + +PyAPI_FUNC(PyObject*) + PyUnicode_EncodeLocale(PyObject* unicode, const char* errors); +#endif + +/* --- File system encoding ---------------------------------------------- */ + +/* ParseTuple converter: encode str objects to bytes using + PyUnicode_EncodeFSDefault(); bytes objects are output as-is. */ + +PyAPI_FUNC(int) PyUnicode_FSConverter(PyObject*, void*); + +/* ParseTuple converter: decode bytes objects to unicode using + PyUnicode_DecodeFSDefaultAndSize(); str objects are output as-is. */ + +PyAPI_FUNC(int) PyUnicode_FSDecoder(PyObject*, void*); + +/* Decode a null-terminated string using Py_FileSystemDefaultEncoding + and the "surrogateescape" error handler. + + If Py_FileSystemDefaultEncoding is not set, fall back to the locale + encoding. + + Use PyUnicode_DecodeFSDefaultAndSize() if the string length is known. +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeFSDefault( + const char* s /* encoded string */ + ); + +/* Decode a string using Py_FileSystemDefaultEncoding + and the "surrogateescape" error handler. + + If Py_FileSystemDefaultEncoding is not set, fall back to the locale + encoding. +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeFSDefaultAndSize( + const char* s, /* encoded string */ + Py_ssize_t size /* size */ + ); + +/* Encode a Unicode object to Py_FileSystemDefaultEncoding with the + "surrogateescape" error handler, and return bytes. + + If Py_FileSystemDefaultEncoding is not set, fall back to the locale + encoding. +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_EncodeFSDefault(PyObject* unicode); + +/* --- Methods & Slots ---------------------------------------------------- + + These are capable of handling Unicode objects and strings on input + (we refer to them as strings in the descriptions) and return + Unicode objects or integers as appropriate. */ + +/* Concat two strings giving a new Unicode string. */ + +PyAPI_FUNC(PyObject*) PyUnicode_Concat( + PyObject* left, /* Left string */ + PyObject* right /* Right string */ + ); + +/* Concat two strings and put the result in *pleft + (sets *pleft to NULL on error) */ + +PyAPI_FUNC(void) PyUnicode_Append( + PyObject** pleft, /* Pointer to left string */ + PyObject* right /* Right string */ + ); + +/* Concat two strings, put the result in *pleft and drop the right object + (sets *pleft to NULL on error) */ + +PyAPI_FUNC(void) PyUnicode_AppendAndDel( + PyObject** pleft, /* Pointer to left string */ + PyObject* right /* Right string */ + ); + +/* Split a string giving a list of Unicode strings. + + If sep is NULL, splitting will be done at all whitespace + substrings. Otherwise, splits occur at the given separator. + + At most maxsplit splits will be done. If negative, no limit is set. + + Separators are not included in the resulting list. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_Split( + PyObject* s, /* String to split */ + PyObject* sep, /* String separator */ + Py_ssize_t maxsplit /* Maxsplit count */ + ); + +/* Dito, but split at line breaks. + + CRLF is considered to be one line break. Line breaks are not + included in the resulting list. */ + +PyAPI_FUNC(PyObject*) PyUnicode_Splitlines( + PyObject* s, /* String to split */ + int keepends /* If true, line end markers are included */ + ); + +/* Partition a string using a given separator. */ + +PyAPI_FUNC(PyObject*) PyUnicode_Partition( + PyObject* s, /* String to partition */ + PyObject* sep /* String separator */ + ); + +/* Partition a string using a given separator, searching from the end of the + string. */ + +PyAPI_FUNC(PyObject*) PyUnicode_RPartition( + PyObject* s, /* String to partition */ + PyObject* sep /* String separator */ + ); + +/* Split a string giving a list of Unicode strings. + + If sep is NULL, splitting will be done at all whitespace + substrings. Otherwise, splits occur at the given separator. + + At most maxsplit splits will be done. But unlike PyUnicode_Split + PyUnicode_RSplit splits from the end of the string. If negative, + no limit is set. + + Separators are not included in the resulting list. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_RSplit( + PyObject* s, /* String to split */ + PyObject* sep, /* String separator */ + Py_ssize_t maxsplit /* Maxsplit count */ + ); + +/* Translate a string by applying a character mapping table to it and + return the resulting Unicode object. + + The mapping table must map Unicode ordinal integers to Unicode strings, + Unicode ordinal integers or None (causing deletion of the character). + + Mapping tables may be dictionaries or sequences. Unmapped character + ordinals (ones which cause a LookupError) are left untouched and + are copied as-is. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_Translate( + PyObject* str, /* String */ + PyObject* table, /* Translate table */ + const char* errors /* error handling */ + ); + +/* Join a sequence of strings using the given separator and return + the resulting Unicode string. */ + +PyAPI_FUNC(PyObject*) PyUnicode_Join( + PyObject* separator, /* Separator string */ + PyObject* seq /* Sequence object */ + ); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _PyUnicode_JoinArray( + PyObject* separator, + PyObject** items, + Py_ssize_t seqlen); +#endif /* Py_LIMITED_API */ + +/* Return 1 if substr matches str[start:end] at the given tail end, 0 + otherwise. */ + +PyAPI_FUNC(Py_ssize_t) PyUnicode_Tailmatch( + PyObject* str, /* String */ + PyObject* substr, /* Prefix or Suffix string */ + Py_ssize_t start, /* Start index */ + Py_ssize_t end, /* Stop index */ + int direction /* Tail end: -1 prefix, +1 suffix */ + ); + +/* Return the first position of substr in str[start:end] using the + given search direction or -1 if not found. -2 is returned in case + an error occurred and an exception is set. */ + +PyAPI_FUNC(Py_ssize_t) PyUnicode_Find( + PyObject* str, /* String */ + PyObject* substr, /* Substring to find */ + Py_ssize_t start, /* Start index */ + Py_ssize_t end, /* Stop index */ + int direction /* Find direction: +1 forward, -1 backward */ + ); + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03030000 +/* Like PyUnicode_Find, but search for single character only. */ +PyAPI_FUNC(Py_ssize_t) PyUnicode_FindChar( + PyObject* str, + Py_UCS4 ch, + Py_ssize_t start, + Py_ssize_t end, + int direction); +#endif + +/* Count the number of occurrences of substr in str[start:end]. */ + +PyAPI_FUNC(Py_ssize_t) PyUnicode_Count( + PyObject* str, /* String */ + PyObject* substr, /* Substring to count */ + Py_ssize_t start, /* Start index */ + Py_ssize_t end /* Stop index */ + ); + +/* Replace at most maxcount occurrences of substr in str with replstr + and return the resulting Unicode object. */ + +PyAPI_FUNC(PyObject*) PyUnicode_Replace( + PyObject* str, /* String */ + PyObject* substr, /* Substring to find */ + PyObject* replstr, /* Substring to replace */ + Py_ssize_t maxcount /* Max. number of replacements to apply; + -1 = all */ + ); + +/* Compare two strings and return -1, 0, 1 for less than, equal, + greater than resp. + Raise an exception and return -1 on error. */ + +PyAPI_FUNC(int) PyUnicode_Compare( + PyObject* left, /* Left string */ + PyObject* right /* Right string */ + ); + +#ifndef Py_LIMITED_API +/* Test whether a unicode is equal to ASCII identifier. Return 1 if true, + 0 otherwise. The right argument must be ASCII identifier. + Any error occurs inside will be cleared before return. */ + +PyAPI_FUNC(int) _PyUnicode_EqualToASCIIId( + PyObject* left, /* Left string */ + _Py_Identifier* right /* Right identifier */ + ); +#endif + +/* Compare a Unicode object with C string and return -1, 0, 1 for less than, + equal, and greater than, respectively. It is best to pass only + ASCII-encoded strings, but the function interprets the input string as + ISO-8859-1 if it contains non-ASCII characters. + This function does not raise exceptions. */ + +PyAPI_FUNC(int) PyUnicode_CompareWithASCIIString( + PyObject* left, + const char* right /* ASCII-encoded string */ + ); + +#ifndef Py_LIMITED_API +/* Test whether a unicode is equal to ASCII string. Return 1 if true, + 0 otherwise. The right argument must be ASCII-encoded string. + Any error occurs inside will be cleared before return. */ + +PyAPI_FUNC(int) _PyUnicode_EqualToASCIIString( + PyObject* left, + const char* right /* ASCII-encoded string */ + ); +#endif + +/* Rich compare two strings and return one of the following: + + - NULL in case an exception was raised + - Py_True or Py_False for successful comparisons + - Py_NotImplemented in case the type combination is unknown + + Possible values for op: + + Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_RichCompare( + PyObject* left, /* Left string */ + PyObject* right, /* Right string */ + int op /* Operation: Py_EQ, Py_NE, Py_GT, etc. */ + ); + +/* Apply an argument tuple or dictionary to a format string and return + the resulting Unicode string. */ + +PyAPI_FUNC(PyObject*) PyUnicode_Format( + PyObject* format, /* Format string */ + PyObject* args /* Argument tuple or dictionary */ + ); + +/* Checks whether element is contained in container and return 1/0 + accordingly. + + element has to coerce to a one element Unicode string. -1 is + returned in case of an error. */ + +PyAPI_FUNC(int) PyUnicode_Contains( + PyObject* container, /* Container string */ + PyObject* element /* Element string */ + ); + +/* Checks whether argument is a valid identifier. */ + +PyAPI_FUNC(int) PyUnicode_IsIdentifier(PyObject* s); + +#ifndef Py_LIMITED_API +/* Externally visible for str.strip(unicode) */ +PyAPI_FUNC(PyObject*) + _PyUnicode_XStrip(PyObject* self, int striptype, PyObject* sepobj); +#endif + +/* Using explicit passed-in values, insert the thousands grouping + into the string pointed to by buffer. For the argument descriptions, + see Objects/stringlib/localeutil.h */ +#ifndef Py_LIMITED_API +PyAPI_FUNC(Py_ssize_t) _PyUnicode_InsertThousandsGrouping( + PyObject* unicode, + Py_ssize_t index, + Py_ssize_t n_buffer, + void* digits, + Py_ssize_t n_digits, + Py_ssize_t min_width, + const char* grouping, + PyObject* thousands_sep, + Py_UCS4* maxchar); +#endif +/* === Characters Type APIs =============================================== */ + +/* Helper array used by Py_UNICODE_ISSPACE(). */ + +#ifndef Py_LIMITED_API +PyAPI_DATA(const unsigned char) _Py_ascii_whitespace[]; + +/* These should not be used directly. Use the Py_UNICODE_IS* and + Py_UNICODE_TO* macros instead. + + These APIs are implemented in Objects/unicodectype.c. + +*/ + +PyAPI_FUNC(int) _PyUnicode_IsLowercase( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsUppercase( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsTitlecase( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsXidStart( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsXidContinue( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsWhitespace( + const Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsLinebreak( + const Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(Py_UCS4) _PyUnicode_ToLowercase( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(Py_UCS4) _PyUnicode_ToUppercase( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(Py_UCS4) _PyUnicode_ToTitlecase( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_ToLowerFull( + Py_UCS4 ch, /* Unicode character */ + Py_UCS4* res); + +PyAPI_FUNC(int) _PyUnicode_ToTitleFull( + Py_UCS4 ch, /* Unicode character */ + Py_UCS4* res); + +PyAPI_FUNC(int) _PyUnicode_ToUpperFull( + Py_UCS4 ch, /* Unicode character */ + Py_UCS4* res); + +PyAPI_FUNC(int) _PyUnicode_ToFoldedFull( + Py_UCS4 ch, /* Unicode character */ + Py_UCS4* res); + +PyAPI_FUNC(int) _PyUnicode_IsCaseIgnorable( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsCased( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_ToDecimalDigit( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_ToDigit( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(double) _PyUnicode_ToNumeric( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsDecimalDigit( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsDigit( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsNumeric( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsPrintable( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsAlpha( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(size_t) Py_UNICODE_strlen(const Py_UNICODE* u); + +PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strcpy(Py_UNICODE* s1, const Py_UNICODE* s2); + +PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strcat(Py_UNICODE* s1, const Py_UNICODE* s2); + +PyAPI_FUNC(Py_UNICODE*) + Py_UNICODE_strncpy(Py_UNICODE* s1, const Py_UNICODE* s2, size_t n); + +PyAPI_FUNC(int) Py_UNICODE_strcmp(const Py_UNICODE* s1, const Py_UNICODE* s2); + +PyAPI_FUNC(int) + Py_UNICODE_strncmp(const Py_UNICODE* s1, const Py_UNICODE* s2, size_t n); + +PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strchr(const Py_UNICODE* s, Py_UNICODE c); + +PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strrchr(const Py_UNICODE* s, Py_UNICODE c); + +PyAPI_FUNC(PyObject*) _PyUnicode_FormatLong(PyObject*, int, int, int); + +/* Create a copy of a unicode string ending with a nul character. Return NULL + and raise a MemoryError exception on memory allocation failure, otherwise + return a new allocated buffer (use PyMem_Free() to free the buffer). */ + +PyAPI_FUNC(Py_UNICODE*) PyUnicode_AsUnicodeCopy(PyObject* unicode); +#endif /* Py_LIMITED_API */ + +#if defined(Py_DEBUG) && !defined(Py_LIMITED_API) +PyAPI_FUNC(int) _PyUnicode_CheckConsistency(PyObject* op, int check_content); +#elif !defined(NDEBUG) +/* For asserts that call _PyUnicode_CheckConsistency(), which would + * otherwise be a problem when building with asserts but without Py_DEBUG. */ +#define _PyUnicode_CheckConsistency(op, check_content) PyUnicode_Check(op) +#endif + +#ifndef Py_LIMITED_API +/* Return an interned Unicode object for an Identifier; may fail if there is no + * memory.*/ +PyAPI_FUNC(PyObject*) _PyUnicode_FromId(_Py_Identifier*); +/* Clear all static strings. */ +PyAPI_FUNC(void) _PyUnicode_ClearStaticStrings(void); + +/* Fast equality check when the inputs are known to be exact unicode types + and where the hash values are equal (i.e. a very probable match) */ +PyAPI_FUNC(int) _PyUnicode_EQ(PyObject*, PyObject*); +#endif /* !Py_LIMITED_API */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_UNICODEOBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/warnings.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/warnings.h new file mode 100644 index 0000000..4ed4c20 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/warnings.h @@ -0,0 +1,65 @@ +#ifndef Py_WARNINGS_H +#define Py_WARNINGS_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject*) _PyWarnings_Init(void); +#endif + +PyAPI_FUNC(int) PyErr_WarnEx( + PyObject* category, + const char* message, /* UTF-8 encoded string */ + Py_ssize_t stack_level); +PyAPI_FUNC(int) PyErr_WarnFormat( + PyObject* category, + Py_ssize_t stack_level, + const char* format, /* ASCII-encoded string */ + ...); + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API + 0 >= 0x03060000 +/* Emit a ResourceWarning warning */ +PyAPI_FUNC(int) PyErr_ResourceWarning( + PyObject* source, + Py_ssize_t stack_level, + const char* format, /* ASCII-encoded string */ + ...); +#endif +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) PyErr_WarnExplicitObject( + PyObject* category, + PyObject* message, + PyObject* filename, + int lineno, + PyObject* module, + PyObject* registry); +#endif +PyAPI_FUNC(int) PyErr_WarnExplicit( + PyObject* category, + const char* message, /* UTF-8 encoded string */ + const char* filename, /* decoded from the filesystem encoding */ + int lineno, + const char* module, /* UTF-8 encoded string */ + PyObject* registry); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) PyErr_WarnExplicitFormat( + PyObject* category, + const char* filename, + int lineno, + const char* module, + PyObject* registry, + const char* format, + ...); +#endif + +/* DEPRECATED: Use PyErr_WarnEx() instead. */ +#ifndef Py_LIMITED_API +#define PyErr_Warn(category, msg) PyErr_WarnEx(category, msg, 1) +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_WARNINGS_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/weakrefobject.h b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/weakrefobject.h new file mode 100644 index 0000000..81d59ac --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/python3.6m/weakrefobject.h @@ -0,0 +1,79 @@ +/* Weak references objects for Python. */ + +#ifndef Py_WEAKREFOBJECT_H +#define Py_WEAKREFOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _PyWeakReference PyWeakReference; + +/* PyWeakReference is the base struct for the Python ReferenceType, ProxyType, + * and CallableProxyType. + */ +#ifndef Py_LIMITED_API +struct _PyWeakReference { + PyObject_HEAD + + /* The object to which this is a weak reference, or Py_None if none. + * Note that this is a stealth reference: wr_object's refcount is + * not incremented to reflect this pointer. + */ + PyObject* wr_object; + + /* A callable to invoke when wr_object dies, or NULL if none. */ + PyObject* wr_callback; + + /* A cache for wr_object's hash code. As usual for hashes, this is -1 + * if the hash code isn't known yet. + */ + Py_hash_t hash; + + /* If wr_object is weakly referenced, wr_object has a doubly-linked NULL- + * terminated list of weak references to it. These are the list pointers. + * If wr_object goes away, wr_object is set to Py_None, and these pointers + * have no meaning then. + */ + PyWeakReference* wr_prev; + PyWeakReference* wr_next; +}; +#endif + +PyAPI_DATA(PyTypeObject) _PyWeakref_RefType; +PyAPI_DATA(PyTypeObject) _PyWeakref_ProxyType; +PyAPI_DATA(PyTypeObject) _PyWeakref_CallableProxyType; + +#define PyWeakref_CheckRef(op) PyObject_TypeCheck(op, &_PyWeakref_RefType) +#define PyWeakref_CheckRefExact(op) (Py_TYPE(op) == &_PyWeakref_RefType) +#define PyWeakref_CheckProxy(op) \ + ((Py_TYPE(op) == &_PyWeakref_ProxyType) || \ + (Py_TYPE(op) == &_PyWeakref_CallableProxyType)) + +#define PyWeakref_Check(op) (PyWeakref_CheckRef(op) || PyWeakref_CheckProxy(op)) + +PyAPI_FUNC(PyObject*) PyWeakref_NewRef(PyObject* ob, PyObject* callback); +PyAPI_FUNC(PyObject*) PyWeakref_NewProxy(PyObject* ob, PyObject* callback); +PyAPI_FUNC(PyObject*) PyWeakref_GetObject(PyObject* ref); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(Py_ssize_t) _PyWeakref_GetWeakrefCount(PyWeakReference* head); + +PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference* self); +#endif + +/* Explanation for the Py_REFCNT() check: when a weakref's target is part + of a long chain of deallocations which triggers the trashcan mechanism, + clearing the weakrefs can be delayed long after the target's refcount + has dropped to zero. In the meantime, code accessing the weakref will + be able to "see" the target object even though it is supposed to be + unreachable. See issue #16602. */ + +#define PyWeakref_GET_OBJECT(ref) \ + (Py_REFCNT(((PyWeakReference*)(ref))->wr_object) > 0 \ + ? ((PyWeakReference*)(ref))->wr_object \ + : Py_None) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_WEAKREFOBJECT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/readline/chardefs.h b/src_cpp/elfgames/tasks/elf2codingenv/include/readline/chardefs.h new file mode 100644 index 0000000..4c3f470 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/readline/chardefs.h @@ -0,0 +1,166 @@ +/* chardefs.h -- Character definitions for readline. */ + +/* Copyright (C) 1994-2015 Free Software Foundation, Inc. + + This file is part of the GNU Readline Library (Readline), a library + for reading lines of text with interactive input and history editing. + + Readline is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Readline 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 Readline. If not, see . +*/ + +#ifndef _CHARDEFS_H_ +#define _CHARDEFS_H_ + +#include + +#if defined(HAVE_CONFIG_H) +#if defined(HAVE_STRING_H) +#if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) +#include +#endif +#include +#endif /* HAVE_STRING_H */ +#if defined(HAVE_STRINGS_H) +#include +#endif /* HAVE_STRINGS_H */ +#else +#include +#endif /* !HAVE_CONFIG_H */ + +#ifndef whitespace +#define whitespace(c) (((c) == ' ') || ((c) == '\t')) +#endif + +#ifdef CTRL +#undef CTRL +#endif +#ifdef UNCTRL +#undef UNCTRL +#endif + +/* Some character stuff. */ +#define control_character_threshold 0x020 /* Smaller than this is control. */ +#define control_character_mask 0x1f /* 0x20 - 1 */ +#define meta_character_threshold 0x07f /* Larger than this is Meta. */ +#define control_character_bit 0x40 /* 0x000000, must be off. */ +#define meta_character_bit 0x080 /* x0000000, must be on. */ +#define largest_char 255 /* Largest character value. */ + +#define CTRL_CHAR(c) ((c) < control_character_threshold && (((c)&0x80) == 0)) +#define META_CHAR(c) ((c) > meta_character_threshold && (c) <= largest_char) + +#define CTRL(c) ((c)&control_character_mask) +#define META(c) ((c) | meta_character_bit) + +#define UNMETA(c) ((c) & (~meta_character_bit)) +#define UNCTRL(c) _rl_to_upper(((c) | control_character_bit)) + +#if defined STDC_HEADERS || (!defined(isascii) && !defined(HAVE_ISASCII)) +#define IN_CTYPE_DOMAIN(c) 1 +#else +#define IN_CTYPE_DOMAIN(c) isascii(c) +#endif + +#if !defined(isxdigit) && !defined(HAVE_ISXDIGIT) && !defined(__cplusplus) +#define isxdigit(c) \ + (isdigit((unsigned char)(c)) || ((c) >= 'a' && (c) <= 'f') || \ + ((c) >= 'A' && (c) <= 'F')) +#endif + +#if defined(CTYPE_NON_ASCII) +#define NON_NEGATIVE(c) 1 +#else +#define NON_NEGATIVE(c) ((unsigned char)(c) == (c)) +#endif + +/* Some systems define these; we want our definitions. */ +#undef ISPRINT + +/* Beware: these only work with single-byte ASCII characters. */ + +#define ISALNUM(c) (IN_CTYPE_DOMAIN(c) && isalnum((unsigned char)c)) +#define ISALPHA(c) (IN_CTYPE_DOMAIN(c) && isalpha((unsigned char)c)) +#define ISDIGIT(c) (IN_CTYPE_DOMAIN(c) && isdigit((unsigned char)c)) +#define ISLOWER(c) (IN_CTYPE_DOMAIN(c) && islower((unsigned char)c)) +#define ISPRINT(c) (IN_CTYPE_DOMAIN(c) && isprint((unsigned char)c)) +#define ISUPPER(c) (IN_CTYPE_DOMAIN(c) && isupper((unsigned char)c)) +#define ISXDIGIT(c) (IN_CTYPE_DOMAIN(c) && isxdigit((unsigned char)c)) + +#define _rl_lowercase_p(c) (NON_NEGATIVE(c) && ISLOWER(c)) +#define _rl_uppercase_p(c) (NON_NEGATIVE(c) && ISUPPER(c)) +#define _rl_digit_p(c) ((c) >= '0' && (c) <= '9') + +#define _rl_pure_alphabetic(c) (NON_NEGATIVE(c) && ISALPHA(c)) +#define ALPHABETIC(c) (NON_NEGATIVE(c) && ISALNUM(c)) + +#ifndef _rl_to_upper +#define _rl_to_upper(c) (_rl_lowercase_p(c) ? toupper((unsigned char)c) : (c)) +#define _rl_to_lower(c) (_rl_uppercase_p(c) ? tolower((unsigned char)c) : (c)) +#endif + +#ifndef _rl_digit_value +#define _rl_digit_value(x) ((x) - '0') +#endif + +#ifndef _rl_isident +#define _rl_isident(c) (ISALNUM(c) || (c) == '_') +#endif + +#ifndef ISOCTAL +#define ISOCTAL(c) ((c) >= '0' && (c) <= '7') +#endif +#define OCTVALUE(c) ((c) - '0') + +#define HEXVALUE(c) \ + (((c) >= 'a' && (c) <= 'f') ? (c) - 'a' + 10 : (c) >= 'A' && (c) <= 'F' \ + ? (c) - 'A' + 10 \ + : (c) - '0') + +#ifndef NEWLINE +#define NEWLINE '\n' +#endif + +#ifndef RETURN +#define RETURN CTRL('M') +#endif + +#ifndef RUBOUT +#define RUBOUT 0x7f +#endif + +#ifndef TAB +#define TAB '\t' +#endif + +#ifdef ABORT_CHAR +#undef ABORT_CHAR +#endif +#define ABORT_CHAR CTRL('G') + +#ifdef PAGE +#undef PAGE +#endif +#define PAGE CTRL('L') + +#ifdef SPACE +#undef SPACE +#endif +#define SPACE ' ' /* XXX - was 0x20 */ + +#ifdef ESC +#undef ESC +#endif +#define ESC CTRL('[') + +#endif /* _CHARDEFS_H_ */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/readline/history.h b/src_cpp/elfgames/tasks/elf2codingenv/include/readline/history.h new file mode 100644 index 0000000..6a9a9c1 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/readline/history.h @@ -0,0 +1,282 @@ +/* history.h -- the names of functions that you can call in history. */ + +/* Copyright (C) 1989-2015 Free Software Foundation, Inc. + + This file contains the GNU History Library (History), a set of + routines for managing the text of previously typed lines. + + History is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + History 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 History. If not, see . +*/ + +#ifndef _HISTORY_H_ +#define _HISTORY_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include /* XXX - for history timestamp code */ + +#if defined READLINE_LIBRARY +#include "rlstdc.h" +#include "rltypedefs.h" +#else +#include +#include +#endif + +#ifdef __STDC__ +typedef void* histdata_t; +#else +typedef char* histdata_t; +#endif + +/* The structure used to store a history entry. */ +typedef struct _hist_entry { + char* line; + char* timestamp; /* char * rather than time_t for read/write */ + histdata_t data; +} HIST_ENTRY; + +/* Size of the history-library-managed space in history entry HS. */ +#define HISTENT_BYTES(hs) (strlen((hs)->line) + strlen((hs)->timestamp)) + +/* A structure used to pass the current state of the history stuff around. */ +typedef struct _hist_state { + HIST_ENTRY** entries; /* Pointer to the entries themselves. */ + int offset; /* The location pointer within this array. */ + int length; /* Number of elements within this array. */ + int size; /* Number of slots allocated to this array. */ + int flags; +} HISTORY_STATE; + +/* Flag values for the `flags' member of HISTORY_STATE. */ +#define HS_STIFLED 0x01 + +/* Initialization and state management. */ + +/* Begin a session in which the history functions might be used. This + just initializes the interactive variables. */ +extern void using_history PARAMS((void)); + +/* Return the current HISTORY_STATE of the history. */ +extern HISTORY_STATE* history_get_history_state PARAMS((void)); + +/* Set the state of the current history array to STATE. */ +extern void history_set_history_state PARAMS((HISTORY_STATE*)); + +/* Manage the history list. */ + +/* Place STRING at the end of the history list. + The associated data field (if any) is set to NULL. */ +extern void add_history PARAMS((const char*)); + +/* Change the timestamp associated with the most recent history entry to + STRING. */ +extern void add_history_time PARAMS((const char*)); + +/* A reasonably useless function, only here for completeness. WHICH + is the magic number that tells us which element to delete. The + elements are numbered from 0. */ +extern HIST_ENTRY* remove_history PARAMS((int)); + +/* Allocate a history entry consisting of STRING and TIMESTAMP and return + a pointer to it. */ +extern HIST_ENTRY* alloc_history_entry PARAMS((char*, char*)); + +/* Copy the history entry H, but not the (opaque) data pointer */ +extern HIST_ENTRY* copy_history_entry PARAMS((HIST_ENTRY*)); + +/* Free the history entry H and return any application-specific data + associated with it. */ +extern histdata_t free_history_entry PARAMS((HIST_ENTRY*)); + +/* Make the history entry at WHICH have LINE and DATA. This returns + the old entry so you can dispose of the data. In the case of an + invalid WHICH, a NULL pointer is returned. */ +extern HIST_ENTRY* replace_history_entry PARAMS((int, const char*, histdata_t)); + +/* Clear the history list and start over. */ +extern void clear_history PARAMS((void)); + +/* Stifle the history list, remembering only MAX number of entries. */ +extern void stifle_history PARAMS((int)); + +/* Stop stifling the history. This returns the previous amount the + history was stifled by. The value is positive if the history was + stifled, negative if it wasn't. */ +extern int unstifle_history PARAMS((void)); + +/* Return 1 if the history is stifled, 0 if it is not. */ +extern int history_is_stifled PARAMS((void)); + +/* Information about the history list. */ + +/* Return a NULL terminated array of HIST_ENTRY which is the current input + history. Element 0 of this list is the beginning of time. If there + is no history, return NULL. */ +extern HIST_ENTRY** history_list PARAMS((void)); + +/* Returns the number which says what history element we are now + looking at. */ +extern int where_history PARAMS((void)); + +/* Return the history entry at the current position, as determined by + history_offset. If there is no entry there, return a NULL pointer. */ +extern HIST_ENTRY* current_history PARAMS((void)); + +/* Return the history entry which is logically at OFFSET in the history + array. OFFSET is relative to history_base. */ +extern HIST_ENTRY* history_get PARAMS((int)); + +/* Return the timestamp associated with the HIST_ENTRY * passed as an + argument */ +extern time_t history_get_time PARAMS((HIST_ENTRY*)); + +/* Return the number of bytes that the primary history entries are using. + This just adds up the lengths of the_history->lines. */ +extern int history_total_bytes PARAMS((void)); + +/* Moving around the history list. */ + +/* Set the position in the history list to POS. */ +extern int history_set_pos PARAMS((int)); + +/* Back up history_offset to the previous history entry, and return + a pointer to that entry. If there is no previous entry, return + a NULL pointer. */ +extern HIST_ENTRY* previous_history PARAMS((void)); + +/* Move history_offset forward to the next item in the input_history, + and return the a pointer to that entry. If there is no next entry, + return a NULL pointer. */ +extern HIST_ENTRY* next_history PARAMS((void)); + +/* Searching the history list. */ + +/* Search the history for STRING, starting at history_offset. + If DIRECTION < 0, then the search is through previous entries, + else through subsequent. If the string is found, then + current_history () is the history entry, and the value of this function + is the offset in the line of that history entry that the string was + found in. Otherwise, nothing is changed, and a -1 is returned. */ +extern int history_search PARAMS((const char*, int)); + +/* Search the history for STRING, starting at history_offset. + The search is anchored: matching lines must begin with string. + DIRECTION is as in history_search(). */ +extern int history_search_prefix PARAMS((const char*, int)); + +/* Search for STRING in the history list, starting at POS, an + absolute index into the list. DIR, if negative, says to search + backwards from POS, else forwards. + Returns the absolute index of the history element where STRING + was found, or -1 otherwise. */ +extern int history_search_pos PARAMS((const char*, int, int)); + +/* Managing the history file. */ + +/* Add the contents of FILENAME to the history list, a line at a time. + If FILENAME is NULL, then read from ~/.history. Returns 0 if + successful, or errno if not. */ +extern int read_history PARAMS((const char*)); + +/* Read a range of lines from FILENAME, adding them to the history list. + Start reading at the FROM'th line and end at the TO'th. If FROM + is zero, start at the beginning. If TO is less than FROM, read + until the end of the file. If FILENAME is NULL, then read from + ~/.history. Returns 0 if successful, or errno if not. */ +extern int read_history_range PARAMS((const char*, int, int)); + +/* Write the current history to FILENAME. If FILENAME is NULL, + then write the history list to ~/.history. Values returned + are as in read_history (). */ +extern int write_history PARAMS((const char*)); + +/* Append NELEMENT entries to FILENAME. The entries appended are from + the end of the list minus NELEMENTs up to the end of the list. */ +extern int append_history PARAMS((int, const char*)); + +/* Truncate the history file, leaving only the last NLINES lines. */ +extern int history_truncate_file PARAMS((const char*, int)); + +/* History expansion. */ + +/* Expand the string STRING, placing the result into OUTPUT, a pointer + to a string. Returns: + + 0) If no expansions took place (or, if the only change in + the text was the de-slashifying of the history expansion + character) + 1) If expansions did take place + -1) If there was an error in expansion. + 2) If the returned line should just be printed. + + If an error occurred in expansion, then OUTPUT contains a descriptive + error message. */ +extern int history_expand PARAMS((char*, char**)); + +/* Extract a string segment consisting of the FIRST through LAST + arguments present in STRING. Arguments are broken up as in + the shell. */ +extern char* history_arg_extract PARAMS((int, int, const char*)); + +/* Return the text of the history event beginning at the current + offset into STRING. Pass STRING with *INDEX equal to the + history_expansion_char that begins this specification. + DELIMITING_QUOTE is a character that is allowed to end the string + specification for what to search for in addition to the normal + characters `:', ` ', `\t', `\n', and sometimes `?'. */ +extern char* get_history_event PARAMS((const char*, int*, int)); + +/* Return an array of tokens, much as the shell might. The tokens are + parsed out of STRING. */ +extern char** history_tokenize PARAMS((const char*)); + +/* Exported history variables. */ +extern int history_base; +extern int history_length; +extern int history_max_entries; +extern int history_offset; + +extern int history_lines_read_from_file; +extern int history_lines_written_to_file; + +extern char history_expansion_char; +extern char history_subst_char; +extern char* history_word_delimiters; +extern char history_comment_char; +extern char* history_no_expand_chars; +extern char* history_search_delimiter_chars; +extern int history_quotes_inhibit_expansion; + +extern int history_write_timestamps; + +/* These two are undocumented; the second is reserved for future use */ +extern int history_multiline_entries; +extern int history_file_version; + +/* Backwards compatibility */ +extern int max_input_history; + +/* If set, this function is called to decide whether or not a particular + history expansion should be treated as a special case for the calling + application and not expanded. */ +extern rl_linebuf_func_t* history_inhibit_expansion_function; + +#ifdef __cplusplus +} +#endif + +#endif /* !_HISTORY_H_ */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/readline/keymaps.h b/src_cpp/elfgames/tasks/elf2codingenv/include/readline/keymaps.h new file mode 100644 index 0000000..2bbefea --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/readline/keymaps.h @@ -0,0 +1,98 @@ +/* keymaps.h -- Manipulation of readline keymaps. */ + +/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc. + + This file is part of the GNU Readline Library (Readline), a library + for reading lines of text with interactive input and history editing. + + Readline is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Readline 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 Readline. If not, see . +*/ + +#ifndef _KEYMAPS_H_ +#define _KEYMAPS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(READLINE_LIBRARY) +#include "chardefs.h" +#include "rlstdc.h" +#include "rltypedefs.h" +#else +#include +#include +#include +#endif + +/* A keymap contains one entry for each key in the ASCII set. + Each entry consists of a type and a pointer. + FUNCTION is the address of a function to run, or the + address of a keymap to indirect through. + TYPE says which kind of thing FUNCTION is. */ +typedef struct _keymap_entry { + char type; + rl_command_func_t* function; +} KEYMAP_ENTRY; + +/* This must be large enough to hold bindings for all of the characters + in a desired character set (e.g, 128 for ASCII, 256 for ISO Latin-x, + and so on) plus one for subsequence matching. */ +#define KEYMAP_SIZE 257 +#define ANYOTHERKEY KEYMAP_SIZE - 1 + +typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE]; +typedef KEYMAP_ENTRY* Keymap; + +/* The values that TYPE can have in a keymap entry. */ +#define ISFUNC 0 +#define ISKMAP 1 +#define ISMACR 2 + +extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, + emacs_ctlx_keymap; +extern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap; + +/* Return a new, empty keymap. + Free it with free() when you are done. */ +extern Keymap rl_make_bare_keymap PARAMS((void)); + +/* Return a new keymap which is a copy of MAP. */ +extern Keymap rl_copy_keymap PARAMS((Keymap)); + +/* Return a new keymap with the printing characters bound to rl_insert, + the lowercase Meta characters bound to run their equivalents, and + the Meta digits bound to produce numeric arguments. */ +extern Keymap rl_make_keymap PARAMS((void)); + +/* Free the storage associated with a keymap. */ +extern void rl_discard_keymap PARAMS((Keymap)); + +/* These functions actually appear in bind.c */ + +/* Return the keymap corresponding to a given name. Names look like + `emacs' or `emacs-meta' or `vi-insert'. */ +extern Keymap rl_get_keymap_by_name PARAMS((const char*)); + +/* Return the current keymap. */ +extern Keymap rl_get_keymap PARAMS((void)); + +/* Set the current keymap to MAP. */ +extern void rl_set_keymap PARAMS((Keymap)); + +#ifdef __cplusplus +} +#endif + +#endif /* _KEYMAPS_H_ */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/readline/readline.h b/src_cpp/elfgames/tasks/elf2codingenv/include/readline/readline.h new file mode 100644 index 0000000..190d48e --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/readline/readline.h @@ -0,0 +1,958 @@ +/* Readline.h -- the names of functions callable from within readline. */ + +/* Copyright (C) 1987-2016 Free Software Foundation, Inc. + + This file is part of the GNU Readline Library (Readline), a library + for reading lines of text with interactive input and history editing. + + Readline is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Readline 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 Readline. If not, see . +*/ + +#if !defined(_READLINE_H_) +#define _READLINE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(READLINE_LIBRARY) +#include "keymaps.h" +#include "rlstdc.h" +#include "rltypedefs.h" +#include "tilde.h" +#else +#include +#include +#include +#include +#endif + +/* Hex-encoded Readline version number. */ +#define RL_READLINE_VERSION 0x0700 /* Readline 7.0 */ +#define RL_VERSION_MAJOR 7 +#define RL_VERSION_MINOR 0 + +/* Readline data structures. */ + +/* Maintaining the state of undo. We remember individual deletes and inserts + on a chain of things to do. */ + +/* The actions that undo knows how to undo. Notice that UNDO_DELETE means + to insert some text, and UNDO_INSERT means to delete some text. I.e., + the code tells undo what to undo, not how to undo it. */ +enum undo_code { UNDO_DELETE, UNDO_INSERT, UNDO_BEGIN, UNDO_END }; + +/* What an element of THE_UNDO_LIST looks like. */ +typedef struct undo_list { + struct undo_list* next; + int start, end; /* Where the change took place. */ + char* text; /* The text to insert, if undoing a delete. */ + enum undo_code what; /* Delete, Insert, Begin, End. */ +} UNDO_LIST; + +/* The current undo list for RL_LINE_BUFFER. */ +extern UNDO_LIST* rl_undo_list; + +/* The data structure for mapping textual names to code addresses. */ +typedef struct _funmap { + const char* name; + rl_command_func_t* function; +} FUNMAP; + +extern FUNMAP** funmap; + +/* **************************************************************** */ +/* */ +/* Functions available to bind to key sequences */ +/* */ +/* **************************************************************** */ + +/* Bindable commands for numeric arguments. */ +extern int rl_digit_argument PARAMS((int, int)); +extern int rl_universal_argument PARAMS((int, int)); + +/* Bindable commands for moving the cursor. */ +extern int rl_forward_byte PARAMS((int, int)); +extern int rl_forward_char PARAMS((int, int)); +extern int rl_forward PARAMS((int, int)); +extern int rl_backward_byte PARAMS((int, int)); +extern int rl_backward_char PARAMS((int, int)); +extern int rl_backward PARAMS((int, int)); +extern int rl_beg_of_line PARAMS((int, int)); +extern int rl_end_of_line PARAMS((int, int)); +extern int rl_forward_word PARAMS((int, int)); +extern int rl_backward_word PARAMS((int, int)); +extern int rl_refresh_line PARAMS((int, int)); +extern int rl_clear_screen PARAMS((int, int)); +extern int rl_skip_csi_sequence PARAMS((int, int)); +extern int rl_arrow_keys PARAMS((int, int)); + +/* Bindable commands for inserting and deleting text. */ +extern int rl_insert PARAMS((int, int)); +extern int rl_quoted_insert PARAMS((int, int)); +extern int rl_tab_insert PARAMS((int, int)); +extern int rl_newline PARAMS((int, int)); +extern int rl_do_lowercase_version PARAMS((int, int)); +extern int rl_rubout PARAMS((int, int)); +extern int rl_delete PARAMS((int, int)); +extern int rl_rubout_or_delete PARAMS((int, int)); +extern int rl_delete_horizontal_space PARAMS((int, int)); +extern int rl_delete_or_show_completions PARAMS((int, int)); +extern int rl_insert_comment PARAMS((int, int)); + +/* Bindable commands for changing case. */ +extern int rl_upcase_word PARAMS((int, int)); +extern int rl_downcase_word PARAMS((int, int)); +extern int rl_capitalize_word PARAMS((int, int)); + +/* Bindable commands for transposing characters and words. */ +extern int rl_transpose_words PARAMS((int, int)); +extern int rl_transpose_chars PARAMS((int, int)); + +/* Bindable commands for searching within a line. */ +extern int rl_char_search PARAMS((int, int)); +extern int rl_backward_char_search PARAMS((int, int)); + +/* Bindable commands for readline's interface to the command history. */ +extern int rl_beginning_of_history PARAMS((int, int)); +extern int rl_end_of_history PARAMS((int, int)); +extern int rl_get_next_history PARAMS((int, int)); +extern int rl_get_previous_history PARAMS((int, int)); + +/* Bindable commands for managing the mark and region. */ +extern int rl_set_mark PARAMS((int, int)); +extern int rl_exchange_point_and_mark PARAMS((int, int)); + +/* Bindable commands to set the editing mode (emacs or vi). */ +extern int rl_vi_editing_mode PARAMS((int, int)); +extern int rl_emacs_editing_mode PARAMS((int, int)); + +/* Bindable commands to change the insert mode (insert or overwrite) */ +extern int rl_overwrite_mode PARAMS((int, int)); + +/* Bindable commands for managing key bindings. */ +extern int rl_re_read_init_file PARAMS((int, int)); +extern int rl_dump_functions PARAMS((int, int)); +extern int rl_dump_macros PARAMS((int, int)); +extern int rl_dump_variables PARAMS((int, int)); + +/* Bindable commands for word completion. */ +extern int rl_complete PARAMS((int, int)); +extern int rl_possible_completions PARAMS((int, int)); +extern int rl_insert_completions PARAMS((int, int)); +extern int rl_old_menu_complete PARAMS((int, int)); +extern int rl_menu_complete PARAMS((int, int)); +extern int rl_backward_menu_complete PARAMS((int, int)); + +/* Bindable commands for killing and yanking text, and managing the kill ring. + */ +extern int rl_kill_word PARAMS((int, int)); +extern int rl_backward_kill_word PARAMS((int, int)); +extern int rl_kill_line PARAMS((int, int)); +extern int rl_backward_kill_line PARAMS((int, int)); +extern int rl_kill_full_line PARAMS((int, int)); +extern int rl_unix_word_rubout PARAMS((int, int)); +extern int rl_unix_filename_rubout PARAMS((int, int)); +extern int rl_unix_line_discard PARAMS((int, int)); +extern int rl_copy_region_to_kill PARAMS((int, int)); +extern int rl_kill_region PARAMS((int, int)); +extern int rl_copy_forward_word PARAMS((int, int)); +extern int rl_copy_backward_word PARAMS((int, int)); +extern int rl_yank PARAMS((int, int)); +extern int rl_yank_pop PARAMS((int, int)); +extern int rl_yank_nth_arg PARAMS((int, int)); +extern int rl_yank_last_arg PARAMS((int, int)); +extern int rl_bracketed_paste_begin PARAMS((int, int)); +/* Not available unless _WIN32 is defined. */ +#if defined(_WIN32) +extern int rl_paste_from_clipboard PARAMS((int, int)); +#endif + +/* Bindable commands for incremental searching. */ +extern int rl_reverse_search_history PARAMS((int, int)); +extern int rl_forward_search_history PARAMS((int, int)); + +/* Bindable keyboard macro commands. */ +extern int rl_start_kbd_macro PARAMS((int, int)); +extern int rl_end_kbd_macro PARAMS((int, int)); +extern int rl_call_last_kbd_macro PARAMS((int, int)); +extern int rl_print_last_kbd_macro PARAMS((int, int)); + +/* Bindable undo commands. */ +extern int rl_revert_line PARAMS((int, int)); +extern int rl_undo_command PARAMS((int, int)); + +/* Bindable tilde expansion commands. */ +extern int rl_tilde_expand PARAMS((int, int)); + +/* Bindable terminal control commands. */ +extern int rl_restart_output PARAMS((int, int)); +extern int rl_stop_output PARAMS((int, int)); + +/* Miscellaneous bindable commands. */ +extern int rl_abort PARAMS((int, int)); +extern int rl_tty_status PARAMS((int, int)); + +/* Bindable commands for incremental and non-incremental history searching. */ +extern int rl_history_search_forward PARAMS((int, int)); +extern int rl_history_search_backward PARAMS((int, int)); +extern int rl_history_substr_search_forward PARAMS((int, int)); +extern int rl_history_substr_search_backward PARAMS((int, int)); +extern int rl_noninc_forward_search PARAMS((int, int)); +extern int rl_noninc_reverse_search PARAMS((int, int)); +extern int rl_noninc_forward_search_again PARAMS((int, int)); +extern int rl_noninc_reverse_search_again PARAMS((int, int)); + +/* Bindable command used when inserting a matching close character. */ +extern int rl_insert_close PARAMS((int, int)); + +/* Not available unless READLINE_CALLBACKS is defined. */ +extern void rl_callback_handler_install PARAMS((const char*, rl_vcpfunc_t*)); +extern void rl_callback_read_char PARAMS((void)); +extern void rl_callback_handler_remove PARAMS((void)); +extern void rl_callback_sigcleanup PARAMS((void)); + +/* Things for vi mode. Not available unless readline is compiled -DVI_MODE. */ +/* VI-mode bindable commands. */ +extern int rl_vi_redo PARAMS((int, int)); +extern int rl_vi_undo PARAMS((int, int)); +extern int rl_vi_yank_arg PARAMS((int, int)); +extern int rl_vi_fetch_history PARAMS((int, int)); +extern int rl_vi_search_again PARAMS((int, int)); +extern int rl_vi_search PARAMS((int, int)); +extern int rl_vi_complete PARAMS((int, int)); +extern int rl_vi_tilde_expand PARAMS((int, int)); +extern int rl_vi_prev_word PARAMS((int, int)); +extern int rl_vi_next_word PARAMS((int, int)); +extern int rl_vi_end_word PARAMS((int, int)); +extern int rl_vi_insert_beg PARAMS((int, int)); +extern int rl_vi_append_mode PARAMS((int, int)); +extern int rl_vi_append_eol PARAMS((int, int)); +extern int rl_vi_eof_maybe PARAMS((int, int)); +extern int rl_vi_insertion_mode PARAMS((int, int)); +extern int rl_vi_insert_mode PARAMS((int, int)); +extern int rl_vi_movement_mode PARAMS((int, int)); +extern int rl_vi_arg_digit PARAMS((int, int)); +extern int rl_vi_change_case PARAMS((int, int)); +extern int rl_vi_put PARAMS((int, int)); +extern int rl_vi_column PARAMS((int, int)); +extern int rl_vi_delete_to PARAMS((int, int)); +extern int rl_vi_change_to PARAMS((int, int)); +extern int rl_vi_yank_to PARAMS((int, int)); +extern int rl_vi_yank_pop PARAMS((int, int)); +extern int rl_vi_rubout PARAMS((int, int)); +extern int rl_vi_delete PARAMS((int, int)); +extern int rl_vi_back_to_indent PARAMS((int, int)); +extern int rl_vi_unix_word_rubout PARAMS((int, int)); +extern int rl_vi_first_print PARAMS((int, int)); +extern int rl_vi_char_search PARAMS((int, int)); +extern int rl_vi_match PARAMS((int, int)); +extern int rl_vi_change_char PARAMS((int, int)); +extern int rl_vi_subst PARAMS((int, int)); +extern int rl_vi_overstrike PARAMS((int, int)); +extern int rl_vi_overstrike_delete PARAMS((int, int)); +extern int rl_vi_replace PARAMS((int, int)); +extern int rl_vi_set_mark PARAMS((int, int)); +extern int rl_vi_goto_mark PARAMS((int, int)); + +/* VI-mode utility functions. */ +extern int rl_vi_check PARAMS((void)); +extern int rl_vi_domove PARAMS((int, int*)); +extern int rl_vi_bracktype PARAMS((int)); + +extern void rl_vi_start_inserting PARAMS((int, int, int)); + +/* VI-mode pseudo-bindable commands, used as utility functions. */ +extern int rl_vi_fWord PARAMS((int, int)); +extern int rl_vi_bWord PARAMS((int, int)); +extern int rl_vi_eWord PARAMS((int, int)); +extern int rl_vi_fword PARAMS((int, int)); +extern int rl_vi_bword PARAMS((int, int)); +extern int rl_vi_eword PARAMS((int, int)); + +/* **************************************************************** */ +/* */ +/* Well Published Functions */ +/* */ +/* **************************************************************** */ + +/* Readline functions. */ +/* Read a line of input. Prompt with PROMPT. A NULL PROMPT means none. */ +extern char* readline PARAMS((const char*)); + +extern int rl_set_prompt PARAMS((const char*)); +extern int rl_expand_prompt PARAMS((char*)); + +extern int rl_initialize PARAMS((void)); + +/* Undocumented; unused by readline */ +extern int rl_discard_argument PARAMS((void)); + +/* Utility functions to bind keys to readline commands. */ +extern int rl_add_defun PARAMS((const char*, rl_command_func_t*, int)); +extern int rl_bind_key PARAMS((int, rl_command_func_t*)); +extern int rl_bind_key_in_map PARAMS((int, rl_command_func_t*, Keymap)); +extern int rl_unbind_key PARAMS((int)); +extern int rl_unbind_key_in_map PARAMS((int, Keymap)); +extern int rl_bind_key_if_unbound PARAMS((int, rl_command_func_t*)); +extern int rl_bind_key_if_unbound_in_map +PARAMS((int, rl_command_func_t*, Keymap)); +extern int rl_unbind_function_in_map PARAMS((rl_command_func_t*, Keymap)); +extern int rl_unbind_command_in_map PARAMS((const char*, Keymap)); +extern int rl_bind_keyseq PARAMS((const char*, rl_command_func_t*)); +extern int rl_bind_keyseq_in_map +PARAMS((const char*, rl_command_func_t*, Keymap)); +extern int rl_bind_keyseq_if_unbound PARAMS((const char*, rl_command_func_t*)); +extern int rl_bind_keyseq_if_unbound_in_map +PARAMS((const char*, rl_command_func_t*, Keymap)); +extern int rl_generic_bind PARAMS((int, const char*, char*, Keymap)); + +extern char* rl_variable_value PARAMS((const char*)); +extern int rl_variable_bind PARAMS((const char*, const char*)); + +/* Backwards compatibility, use rl_bind_keyseq_in_map instead. */ +extern int rl_set_key PARAMS((const char*, rl_command_func_t*, Keymap)); + +/* Backwards compatibility, use rl_generic_bind instead. */ +extern int rl_macro_bind PARAMS((const char*, const char*, Keymap)); + +/* Undocumented in the texinfo manual; not really useful to programs. */ +extern int rl_translate_keyseq PARAMS((const char*, char*, int*)); +extern char* rl_untranslate_keyseq PARAMS((int)); + +extern rl_command_func_t* rl_named_function PARAMS((const char*)); +extern rl_command_func_t* rl_function_of_keyseq +PARAMS((const char*, Keymap, int*)); + +extern void rl_list_funmap_names PARAMS((void)); +extern char** rl_invoking_keyseqs_in_map PARAMS((rl_command_func_t*, Keymap)); +extern char** rl_invoking_keyseqs PARAMS((rl_command_func_t*)); + +extern void rl_function_dumper PARAMS((int)); +extern void rl_macro_dumper PARAMS((int)); +extern void rl_variable_dumper PARAMS((int)); + +extern int rl_read_init_file PARAMS((const char*)); +extern int rl_parse_and_bind PARAMS((char*)); + +/* Functions for manipulating keymaps. */ +extern Keymap rl_make_bare_keymap PARAMS((void)); +extern Keymap rl_copy_keymap PARAMS((Keymap)); +extern Keymap rl_make_keymap PARAMS((void)); +extern void rl_discard_keymap PARAMS((Keymap)); +extern void rl_free_keymap PARAMS((Keymap)); + +extern Keymap rl_get_keymap_by_name PARAMS((const char*)); +extern char* rl_get_keymap_name PARAMS((Keymap)); +extern void rl_set_keymap PARAMS((Keymap)); +extern Keymap rl_get_keymap PARAMS((void)); +/* Undocumented; used internally only. */ +extern void rl_set_keymap_from_edit_mode PARAMS((void)); +extern char* rl_get_keymap_name_from_edit_mode PARAMS((void)); + +/* Functions for manipulating the funmap, which maps command names to functions. + */ +extern int rl_add_funmap_entry PARAMS((const char*, rl_command_func_t*)); +extern const char** rl_funmap_names PARAMS((void)); +/* Undocumented, only used internally -- there is only one funmap, and this + function may be called only once. */ +extern void rl_initialize_funmap PARAMS((void)); + +/* Utility functions for managing keyboard macros. */ +extern void rl_push_macro_input PARAMS((char*)); + +/* Functions for undoing, from undo.c */ +extern void rl_add_undo PARAMS((enum undo_code, int, int, char*)); +extern void rl_free_undo_list PARAMS((void)); +extern int rl_do_undo PARAMS((void)); +extern int rl_begin_undo_group PARAMS((void)); +extern int rl_end_undo_group PARAMS((void)); +extern int rl_modifying PARAMS((int, int)); + +/* Functions for redisplay. */ +extern void rl_redisplay PARAMS((void)); +extern int rl_on_new_line PARAMS((void)); +extern int rl_on_new_line_with_prompt PARAMS((void)); +extern int rl_forced_update_display PARAMS((void)); +extern int rl_clear_visible_line PARAMS((void)); +extern int rl_clear_message PARAMS((void)); +extern int rl_reset_line_state PARAMS((void)); +extern int rl_crlf PARAMS((void)); + +#if defined(USE_VARARGS) && defined(PREFER_STDARG) +extern int rl_message(const char*, ...) + __attribute__((__format__(printf, 1, 2))); +#else +extern int rl_message(); +#endif + +extern int rl_show_char PARAMS((int)); + +/* Undocumented in texinfo manual. */ +extern int rl_character_len PARAMS((int, int)); +extern void rl_redraw_prompt_last_line PARAMS((void)); + +/* Save and restore internal prompt redisplay information. */ +extern void rl_save_prompt PARAMS((void)); +extern void rl_restore_prompt PARAMS((void)); + +/* Modifying text. */ +extern void rl_replace_line PARAMS((const char*, int)); +extern int rl_insert_text PARAMS((const char*)); +extern int rl_delete_text PARAMS((int, int)); +extern int rl_kill_text PARAMS((int, int)); +extern char* rl_copy_text PARAMS((int, int)); + +/* Terminal and tty mode management. */ +extern void rl_prep_terminal PARAMS((int)); +extern void rl_deprep_terminal PARAMS((void)); +extern void rl_tty_set_default_bindings PARAMS((Keymap)); +extern void rl_tty_unset_default_bindings PARAMS((Keymap)); + +extern int rl_reset_terminal PARAMS((const char*)); +extern void rl_resize_terminal PARAMS((void)); +extern void rl_set_screen_size PARAMS((int, int)); +extern void rl_get_screen_size PARAMS((int*, int*)); +extern void rl_reset_screen_size PARAMS((void)); + +extern char* rl_get_termcap PARAMS((const char*)); + +/* Functions for character input. */ +extern int rl_stuff_char PARAMS((int)); +extern int rl_execute_next PARAMS((int)); +extern int rl_clear_pending_input PARAMS((void)); +extern int rl_read_key PARAMS((void)); +extern int rl_getc PARAMS((FILE*)); +extern int rl_set_keyboard_input_timeout PARAMS((int)); + +/* `Public' utility functions . */ +extern void rl_extend_line_buffer PARAMS((int)); +extern int rl_ding PARAMS((void)); +extern int rl_alphabetic PARAMS((int)); +extern void rl_free PARAMS((void*)); + +/* Readline signal handling, from signals.c */ +extern int rl_set_signals PARAMS((void)); +extern int rl_clear_signals PARAMS((void)); +extern void rl_cleanup_after_signal PARAMS((void)); +extern void rl_reset_after_signal PARAMS((void)); +extern void rl_free_line_state PARAMS((void)); + +extern int rl_pending_signal PARAMS((void)); + +extern void rl_echo_signal_char PARAMS((int)); + +extern int rl_set_paren_blink_timeout PARAMS((int)); + +/* History management functions. */ + +extern void rl_clear_history PARAMS((void)); + +/* Undocumented. */ +extern int rl_maybe_save_line PARAMS((void)); +extern int rl_maybe_unsave_line PARAMS((void)); +extern int rl_maybe_replace_line PARAMS((void)); + +/* Completion functions. */ +extern int rl_complete_internal PARAMS((int)); +extern void rl_display_match_list PARAMS((char**, int, int)); + +extern char** rl_completion_matches PARAMS((const char*, rl_compentry_func_t*)); +extern char* rl_username_completion_function PARAMS((const char*, int)); +extern char* rl_filename_completion_function PARAMS((const char*, int)); + +extern int rl_completion_mode PARAMS((rl_command_func_t*)); + +#if 0 +/* Backwards compatibility (compat.c). These will go away sometime. */ +extern void free_undo_list PARAMS((void)); +extern int maybe_save_line PARAMS((void)); +extern int maybe_unsave_line PARAMS((void)); +extern int maybe_replace_line PARAMS((void)); + +extern int ding PARAMS((void)); +extern int alphabetic PARAMS((int)); +extern int crlf PARAMS((void)); + +extern char **completion_matches PARAMS((char *, rl_compentry_func_t *)); +extern char *username_completion_function PARAMS((const char *, int)); +extern char *filename_completion_function PARAMS((const char *, int)); +#endif + +/* **************************************************************** */ +/* */ +/* Well Published Variables */ +/* */ +/* **************************************************************** */ + +/* The version of this incarnation of the readline library. */ +extern const char* rl_library_version; /* e.g., "4.2" */ +extern int rl_readline_version; /* e.g., 0x0402 */ + +/* True if this is real GNU readline. */ +extern int rl_gnu_readline_p; + +/* Flags word encapsulating the current readline state. */ +extern unsigned long rl_readline_state; + +/* Says which editing mode readline is currently using. 1 means emacs mode; + 0 means vi mode. */ +extern int rl_editing_mode; + +/* Insert or overwrite mode for emacs mode. 1 means insert mode; 0 means + overwrite mode. Reset to insert mode on each input line. */ +extern int rl_insert_mode; + +/* The name of the calling program. You should initialize this to + whatever was in argv[0]. It is used when parsing conditionals. */ +extern const char* rl_readline_name; + +/* The prompt readline uses. This is set from the argument to + readline (), and should not be assigned to directly. */ +extern char* rl_prompt; + +/* The prompt string that is actually displayed by rl_redisplay. Public so + applications can more easily supply their own redisplay functions. */ +extern char* rl_display_prompt; + +/* The line buffer that is in use. */ +extern char* rl_line_buffer; + +/* The location of point, and end. */ +extern int rl_point; +extern int rl_end; + +/* The mark, or saved cursor position. */ +extern int rl_mark; + +/* Flag to indicate that readline has finished with the current input + line and should return it. */ +extern int rl_done; + +/* If set to a character value, that will be the next keystroke read. */ +extern int rl_pending_input; + +/* Non-zero if we called this function from _rl_dispatch(). It's present + so functions can find out whether they were called from a key binding + or directly from an application. */ +extern int rl_dispatching; + +/* Non-zero if the user typed a numeric argument before executing the + current function. */ +extern int rl_explicit_arg; + +/* The current value of the numeric argument specified by the user. */ +extern int rl_numeric_arg; + +/* The address of the last command function Readline executed. */ +extern rl_command_func_t* rl_last_func; + +/* The name of the terminal to use. */ +extern const char* rl_terminal_name; + +/* The input and output streams. */ +extern FILE* rl_instream; +extern FILE* rl_outstream; + +/* If non-zero, Readline gives values of LINES and COLUMNS from the environment + greater precedence than values fetched from the kernel when computing the + screen dimensions. */ +extern int rl_prefer_env_winsize; + +/* If non-zero, then this is the address of a function to call just + before readline_internal () prints the first prompt. */ +extern rl_hook_func_t* rl_startup_hook; + +/* If non-zero, this is the address of a function to call just before + readline_internal_setup () returns and readline_internal starts + reading input characters. */ +extern rl_hook_func_t* rl_pre_input_hook; + +/* The address of a function to call periodically while Readline is + awaiting character input, or NULL, for no event handling. */ +extern rl_hook_func_t* rl_event_hook; + +/* The address of a function to call if a read is interrupted by a signal. */ +extern rl_hook_func_t* rl_signal_event_hook; + +/* The address of a function to call if Readline needs to know whether or not + there is data available from the current input source. */ +extern rl_hook_func_t* rl_input_available_hook; + +/* The address of the function to call to fetch a character from the current + Readline input stream */ +extern rl_getc_func_t* rl_getc_function; + +extern rl_voidfunc_t* rl_redisplay_function; + +extern rl_vintfunc_t* rl_prep_term_function; +extern rl_voidfunc_t* rl_deprep_term_function; + +/* Dispatch variables. */ +extern Keymap rl_executing_keymap; +extern Keymap rl_binding_keymap; + +extern int rl_executing_key; +extern char* rl_executing_keyseq; +extern int rl_key_sequence_length; + +/* Display variables. */ +/* If non-zero, readline will erase the entire line, including any prompt, + if the only thing typed on an otherwise-blank line is something bound to + rl_newline. */ +extern int rl_erase_empty_line; + +/* If non-zero, the application has already printed the prompt (rl_prompt) + before calling readline, so readline should not output it the first time + redisplay is done. */ +extern int rl_already_prompted; + +/* A non-zero value means to read only this many characters rather than + up to a character bound to accept-line. */ +extern int rl_num_chars_to_read; + +/* The text of a currently-executing keyboard macro. */ +extern char* rl_executing_macro; + +/* Variables to control readline signal handling. */ +/* If non-zero, readline will install its own signal handlers for + SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP, SIGTTIN, and SIGTTOU. */ +extern int rl_catch_signals; + +/* If non-zero, readline will install a signal handler for SIGWINCH + that also attempts to call any calling application's SIGWINCH signal + handler. Note that the terminal is not cleaned up before the + application's signal handler is called; use rl_cleanup_after_signal() + to do that. */ +extern int rl_catch_sigwinch; + +/* If non-zero, the readline SIGWINCH handler will modify LINES and + COLUMNS in the environment. */ +extern int rl_change_environment; + +/* Completion variables. */ +/* Pointer to the generator function for completion_matches (). + NULL means to use rl_filename_completion_function (), the default + filename completer. */ +extern rl_compentry_func_t* rl_completion_entry_function; + +/* Optional generator for menu completion. Default is + rl_completion_entry_function (rl_filename_completion_function). */ +extern rl_compentry_func_t* rl_menu_completion_entry_function; + +/* If rl_ignore_some_completions_function is non-NULL it is the address + of a function to call after all of the possible matches have been + generated, but before the actual completion is done to the input line. + The function is called with one argument; a NULL terminated array + of (char *). If your function removes any of the elements, they + must be free()'ed. */ +extern rl_compignore_func_t* rl_ignore_some_completions_function; + +/* Pointer to alternative function to create matches. + Function is called with TEXT, START, and END. + START and END are indices in RL_LINE_BUFFER saying what the boundaries + of TEXT are. + If this function exists and returns NULL then call the value of + rl_completion_entry_function to try to match, otherwise use the + array of strings returned. */ +extern rl_completion_func_t* rl_attempted_completion_function; + +/* The basic list of characters that signal a break between words for the + completer routine. The initial contents of this variable is what + breaks words in the shell, i.e. "n\"\\'`@$>". */ +extern const char* rl_basic_word_break_characters; + +/* The list of characters that signal a break between words for + rl_complete_internal. The default list is the contents of + rl_basic_word_break_characters. */ +extern /*const*/ char* rl_completer_word_break_characters; + +/* Hook function to allow an application to set the completion word + break characters before readline breaks up the line. Allows + position-dependent word break characters. */ +extern rl_cpvfunc_t* rl_completion_word_break_hook; + +/* List of characters which can be used to quote a substring of the line. + Completion occurs on the entire substring, and within the substring + rl_completer_word_break_characters are treated as any other character, + unless they also appear within this list. */ +extern const char* rl_completer_quote_characters; + +/* List of quote characters which cause a word break. */ +extern const char* rl_basic_quote_characters; + +/* List of characters that need to be quoted in filenames by the completer. */ +extern const char* rl_filename_quote_characters; + +/* List of characters that are word break characters, but should be left + in TEXT when it is passed to the completion function. The shell uses + this to help determine what kind of completing to do. */ +extern const char* rl_special_prefixes; + +/* If non-zero, then this is the address of a function to call when + completing on a directory name. The function is called with + the address of a string (the current directory name) as an arg. It + changes what is displayed when the possible completions are printed + or inserted. The directory completion hook should perform + any necessary dequoting. This function should return 1 if it modifies + the directory name pointer passed as an argument. If the directory + completion hook returns 0, it should not modify the directory name + pointer passed as an argument. */ +extern rl_icppfunc_t* rl_directory_completion_hook; + +/* If non-zero, this is the address of a function to call when completing + a directory name. This function takes the address of the directory name + to be modified as an argument. Unlike rl_directory_completion_hook, it + only modifies the directory name used in opendir(2), not what is displayed + when the possible completions are printed or inserted. If set, it takes + precedence over rl_directory_completion_hook. The directory rewrite + hook should perform any necessary dequoting. This function has the same + return value properties as the directory_completion_hook. + + I'm not happy with how this works yet, so it's undocumented. I'm trying + it in bash to see how well it goes. */ +extern rl_icppfunc_t* rl_directory_rewrite_hook; + +/* If non-zero, this is the address of a function for the completer to call + before deciding which character to append to a completed name. It should + modify the directory name passed as an argument if appropriate, and return + non-zero if it modifies the name. This should not worry about dequoting + the filename; that has already happened by the time it gets here. */ +extern rl_icppfunc_t* rl_filename_stat_hook; + +/* If non-zero, this is the address of a function to call when reading + directory entries from the filesystem for completion and comparing + them to the partial word to be completed. The function should + either return its first argument (if no conversion takes place) or + newly-allocated memory. This can, for instance, convert filenames + between character sets for comparison against what's typed at the + keyboard. The returned value is what is added to the list of + matches. The second argument is the length of the filename to be + converted. */ +extern rl_dequote_func_t* rl_filename_rewrite_hook; + +/* Backwards compatibility with previous versions of readline. */ +#define rl_symbolic_link_hook rl_directory_completion_hook + +/* If non-zero, then this is the address of a function to call when + completing a word would normally display the list of possible matches. + This function is called instead of actually doing the display. + It takes three arguments: (char **matches, int num_matches, int max_length) + where MATCHES is the array of strings that matched, NUM_MATCHES is the + number of strings in that array, and MAX_LENGTH is the length of the + longest string in that array. */ +extern rl_compdisp_func_t* rl_completion_display_matches_hook; + +/* Non-zero means that the results of the matches are to be treated + as filenames. This is ALWAYS zero on entry, and can only be changed + within a completion entry finder function. */ +extern int rl_filename_completion_desired; + +/* Non-zero means that the results of the matches are to be quoted using + double quotes (or an application-specific quoting mechanism) if the + filename contains any characters in rl_word_break_chars. This is + ALWAYS non-zero on entry, and can only be changed within a completion + entry finder function. */ +extern int rl_filename_quoting_desired; + +/* Set to a function to quote a filename in an application-specific fashion. + Called with the text to quote, the type of match found (single or multiple) + and a pointer to the quoting character to be used, which the function can + reset if desired. */ +extern rl_quote_func_t* rl_filename_quoting_function; + +/* Function to call to remove quoting characters from a filename. Called + before completion is attempted, so the embedded quotes do not interfere + with matching names in the file system. */ +extern rl_dequote_func_t* rl_filename_dequoting_function; + +/* Function to call to decide whether or not a word break character is + quoted. If a character is quoted, it does not break words for the + completer. */ +extern rl_linebuf_func_t* rl_char_is_quoted_p; + +/* Non-zero means to suppress normal filename completion after the + user-specified completion function has been called. */ +extern int rl_attempted_completion_over; + +/* Set to a character describing the type of completion being attempted by + rl_complete_internal; available for use by application completion + functions. */ +extern int rl_completion_type; + +/* Set to the last key used to invoke one of the completion functions */ +extern int rl_completion_invoking_key; + +/* Up to this many items will be displayed in response to a + possible-completions call. After that, we ask the user if she + is sure she wants to see them all. The default value is 100. */ +extern int rl_completion_query_items; + +/* Character appended to completed words when at the end of the line. The + default is a space. Nothing is added if this is '\0'. */ +extern int rl_completion_append_character; + +/* If set to non-zero by an application completion function, + rl_completion_append_character will not be appended. */ +extern int rl_completion_suppress_append; + +/* Set to any quote character readline thinks it finds before any application + completion function is called. */ +extern int rl_completion_quote_character; + +/* Set to a non-zero value if readline found quoting anywhere in the word to + be completed; set before any application completion function is called. */ +extern int rl_completion_found_quote; + +/* If non-zero, the completion functions don't append any closing quote. + This is set to 0 by rl_complete_internal and may be changed by an + application-specific completion function. */ +extern int rl_completion_suppress_quote; + +/* If non-zero, readline will sort the completion matches. On by default. */ +extern int rl_sort_completion_matches; + +/* If non-zero, a slash will be appended to completed filenames that are + symbolic links to directory names, subject to the value of the + mark-directories variable (which is user-settable). This exists so + that application completion functions can override the user's preference + (set via the mark-symlinked-directories variable) if appropriate. + It's set to the value of _rl_complete_mark_symlink_dirs in + rl_complete_internal before any application-specific completion + function is called, so without that function doing anything, the user's + preferences are honored. */ +extern int rl_completion_mark_symlink_dirs; + +/* If non-zero, then disallow duplicates in the matches. */ +extern int rl_ignore_completion_duplicates; + +/* If this is non-zero, completion is (temporarily) inhibited, and the + completion character will be inserted as any other. */ +extern int rl_inhibit_completion; + +/* Applications can set this to non-zero to have readline's signal handlers + installed during the entire duration of reading a complete line, as in + readline-6.2. This should be used with care, because it can result in + readline receiving signals and not handling them until it's called again + via rl_callback_read_char, thereby stealing them from the application. + By default, signal handlers are only active while readline is active. */ +extern int rl_persistent_signal_handlers; + +/* Input error; can be returned by (*rl_getc_function) if readline is reading + a top-level command (RL_ISSTATE (RL_STATE_READCMD)). */ +#define READERR (-2) + +/* Definitions available for use by readline clients. */ +#define RL_PROMPT_START_IGNORE '\001' +#define RL_PROMPT_END_IGNORE '\002' + +/* Possible values for do_replace argument to rl_filename_quoting_function, + called by rl_complete_internal. */ +#define NO_MATCH 0 +#define SINGLE_MATCH 1 +#define MULT_MATCH 2 + +/* Possible state values for rl_readline_state */ +#define RL_STATE_NONE 0x000000 /* no state; before first call */ + +#define RL_STATE_INITIALIZING 0x0000001 /* initializing */ +#define RL_STATE_INITIALIZED 0x0000002 /* initialization done */ +#define RL_STATE_TERMPREPPED 0x0000004 /* terminal is prepped */ +#define RL_STATE_READCMD 0x0000008 /* reading a command key */ +#define RL_STATE_METANEXT 0x0000010 /* reading input after ESC */ +#define RL_STATE_DISPATCHING 0x0000020 /* dispatching to a command */ +#define RL_STATE_MOREINPUT \ + 0x0000040 /* reading more input in a command function */ +#define RL_STATE_ISEARCH 0x0000080 /* doing incremental search */ +#define RL_STATE_NSEARCH 0x0000100 /* doing non-inc search */ +#define RL_STATE_SEARCH 0x0000200 /* doing a history search */ +#define RL_STATE_NUMERICARG 0x0000400 /* reading numeric argument */ +#define RL_STATE_MACROINPUT 0x0000800 /* getting input from a macro */ +#define RL_STATE_MACRODEF 0x0001000 /* defining keyboard macro */ +#define RL_STATE_OVERWRITE 0x0002000 /* overwrite mode */ +#define RL_STATE_COMPLETING 0x0004000 /* doing completion */ +#define RL_STATE_SIGHANDLER 0x0008000 /* in readline sighandler */ +#define RL_STATE_UNDOING 0x0010000 /* doing an undo */ +#define RL_STATE_INPUTPENDING 0x0020000 /* rl_execute_next called */ +#define RL_STATE_TTYCSAVED 0x0040000 /* tty special chars saved */ +#define RL_STATE_CALLBACK 0x0080000 /* using the callback interface */ +#define RL_STATE_VIMOTION 0x0100000 /* reading vi motion arg */ +#define RL_STATE_MULTIKEY 0x0200000 /* reading multiple-key command */ +#define RL_STATE_VICMDONCE 0x0400000 /* entered vi command mode at least once \ + */ +#define RL_STATE_CHARSEARCH 0x0800000 /* vi mode char search */ +#define RL_STATE_REDISPLAYING 0x1000000 /* updating terminal display */ + +#define RL_STATE_DONE 0x2000000 /* done; accepted line */ + +#define RL_SETSTATE(x) (rl_readline_state |= (x)) +#define RL_UNSETSTATE(x) (rl_readline_state &= ~(x)) +#define RL_ISSTATE(x) (rl_readline_state & (x)) + +struct readline_state { + /* line state */ + int point; + int end; + int mark; + int buflen; + char* buffer; + UNDO_LIST* ul; + char* prompt; + + /* global state */ + int rlstate; + int done; + Keymap kmap; + + /* input state */ + rl_command_func_t* lastfunc; + int insmode; + int edmode; + char* kseq; + int kseqlen; + + int pendingin; + FILE* inf; + FILE* outf; + char* macro; + + /* signal state */ + int catchsigs; + int catchsigwinch; + + /* search state */ + + /* completion state */ + rl_compentry_func_t* entryfunc; + rl_compentry_func_t* menuentryfunc; + rl_compignore_func_t* ignorefunc; + rl_completion_func_t* attemptfunc; + char* wordbreakchars; + + /* options state */ + + /* hook state */ + + /* reserved for future expansion, so the struct size doesn't change */ + char reserved[64]; +}; + +extern int rl_save_state PARAMS((struct readline_state*)); +extern int rl_restore_state PARAMS((struct readline_state*)); + +#ifdef __cplusplus +} +#endif + +#endif /* _READLINE_H_ */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/readline/rlconf.h b/src_cpp/elfgames/tasks/elf2codingenv/include/readline/rlconf.h new file mode 100644 index 0000000..3ab697b --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/readline/rlconf.h @@ -0,0 +1,79 @@ +/* rlconf.h -- readline configuration definitions */ + +/* Copyright (C) 1992-2015 Free Software Foundation, Inc. + + This file is part of the GNU Readline Library (Readline), a library + for reading lines of text with interactive input and history editing. + + Readline is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Readline 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 Readline. If not, see . +*/ + +#if !defined(_RLCONF_H_) +#define _RLCONF_H_ + +/* Define this if you want the vi-mode editing available. */ +#define VI_MODE + +/* Define this to get an indication of file type when listing completions. */ +#define VISIBLE_STATS + +/* Define this to get support for colors when listing completions and in + other places. */ +#define COLOR_SUPPORT + +/* This definition is needed by readline.c, rltty.c, and signals.c. */ +/* If on, then readline handles signals in a way that doesn't suck. */ +#define HANDLE_SIGNALS + +/* Ugly but working hack for binding prefix meta. */ +#define PREFIX_META_HACK + +/* The next-to-last-ditch effort file name for a user-specific init file. */ +#define DEFAULT_INPUTRC "~/.inputrc" + +/* The ultimate last-ditch filenname for an init file -- system-wide. */ +#define SYS_INPUTRC "/etc/inputrc" + +/* If defined, expand tabs to spaces. */ +#define DISPLAY_TABS + +/* If defined, use the terminal escape sequence to move the cursor forward + over a character when updating the line rather than rewriting it. */ +/* #define HACK_TERMCAP_MOTION */ + +/* The string inserted by the `insert comment' command. */ +#define RL_COMMENT_BEGIN_DEFAULT "#" + +/* Define this if you want code that allows readline to be used in an + X `callback' style. */ +#define READLINE_CALLBACKS + +/* Define this if you want the cursor to indicate insert or overwrite mode. */ +/* #define CURSOR_MODE */ + +/* Define this if you want to enable code that talks to the Linux kernel + tty auditing system. */ +/* #define ENABLE_TTY_AUDIT_SUPPORT */ + +/* Defaults for the various editing mode indicators, inserted at the beginning + of the last (maybe only) line of the prompt if show-mode-in-prompt is on */ +#define RL_EMACS_MODESTR_DEFAULT "@" +#define RL_EMACS_MODESTR_DEFLEN 1 + +#define RL_VI_INS_MODESTR_DEFAULT "(ins)" +#define RL_VI_INS_MODESTR_DEFLEN 5 +#define RL_VI_CMD_MODESTR_DEFAULT "(cmd)" +#define RL_VI_CMD_MODESTR_DEFLEN 5 + +#endif /* _RLCONF_H_ */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/readline/rlstdc.h b/src_cpp/elfgames/tasks/elf2codingenv/include/readline/rlstdc.h new file mode 100644 index 0000000..22e523e --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/readline/rlstdc.h @@ -0,0 +1,58 @@ +/* stdc.h -- macros to make source compile on both ANSI C and K&R C compilers. + */ + +/* Copyright (C) 1993-2009 Free Software Foundation, Inc. + + This file is part of the GNU Readline Library (Readline), a library + for reading lines of text with interactive input and history editing. + + Readline is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Readline 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 Readline. If not, see . +*/ + +#if !defined(_RL_STDC_H_) +#define _RL_STDC_H_ + +/* Adapted from BSD /usr/include/sys/cdefs.h. */ + +/* A function can be defined using prototypes and compile on both ANSI C + and traditional C compilers with something like this: + extern char *func PARAMS((char *, char *, int)); */ + +#if !defined(PARAMS) +#if defined(__STDC__) || defined(__GNUC__) || defined(__cplusplus) +#define PARAMS(protos) protos +#else +#define PARAMS(protos) () +#endif +#endif + +#ifndef __attribute__ +#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) +#define __attribute__(x) +#endif +#endif + +/* Moved from config.h.in because readline.h:rl_message depends on these + defines. */ +#if defined(__STDC__) && defined(HAVE_STDARG_H) +#define PREFER_STDARG +#define USE_VARARGS +#else +#if defined(HAVE_VARARGS_H) +#define PREFER_VARARGS +#define USE_VARARGS +#endif +#endif + +#endif /* !_RL_STDC_H_ */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/readline/rltypedefs.h b/src_cpp/elfgames/tasks/elf2codingenv/include/readline/rltypedefs.h new file mode 100644 index 0000000..48c2320 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/readline/rltypedefs.h @@ -0,0 +1,100 @@ +/* rltypedefs.h -- Type declarations for readline functions. */ + +/* Copyright (C) 2000-2011 Free Software Foundation, Inc. + + This file is part of the GNU Readline Library (Readline), a library + for reading lines of text with interactive input and history editing. + + Readline is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Readline 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 Readline. If not, see . +*/ + +#ifndef _RL_TYPEDEFS_H_ +#define _RL_TYPEDEFS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Old-style, attempt to mark as deprecated in some way people will notice. */ + +#if !defined(_FUNCTION_DEF) +#define _FUNCTION_DEF + +#if defined(__GNUC__) || defined(__clang__) +typedef int Function() __attribute__((deprecated)); +typedef void VFunction() __attribute__((deprecated)); +typedef char* CPFunction() __attribute__((deprecated)); +typedef char** CPPFunction() __attribute__((deprecated)); +#else +typedef int Function(); +typedef void VFunction(); +typedef char* CPFunction(); +typedef char** CPPFunction(); +#endif + +#endif /* _FUNCTION_DEF */ + +/* New style. */ + +#if !defined(_RL_FUNCTION_TYPEDEF) +#define _RL_FUNCTION_TYPEDEF + +/* Bindable functions */ +typedef int rl_command_func_t PARAMS((int, int)); + +/* Typedefs for the completion system */ +typedef char* rl_compentry_func_t PARAMS((const char*, int)); +typedef char** rl_completion_func_t PARAMS((const char*, int, int)); + +typedef char* rl_quote_func_t PARAMS((char*, int, char*)); +typedef char* rl_dequote_func_t PARAMS((char*, int)); + +typedef int rl_compignore_func_t PARAMS((char**)); + +typedef void rl_compdisp_func_t PARAMS((char**, int, int)); + +/* Type for input and pre-read hook functions like rl_event_hook */ +typedef int rl_hook_func_t PARAMS((void)); + +/* Input function type */ +typedef int rl_getc_func_t PARAMS((FILE*)); + +/* Generic function that takes a character buffer (which could be the readline + line buffer) and an index into it (which could be rl_point) and returns + an int. */ +typedef int rl_linebuf_func_t PARAMS((char*, int)); + +/* `Generic' function pointer typedefs */ +typedef int rl_intfunc_t PARAMS((int)); +#define rl_ivoidfunc_t rl_hook_func_t +typedef int rl_icpfunc_t PARAMS((char*)); +typedef int rl_icppfunc_t PARAMS((char**)); + +typedef void rl_voidfunc_t PARAMS((void)); +typedef void rl_vintfunc_t PARAMS((int)); +typedef void rl_vcpfunc_t PARAMS((char*)); +typedef void rl_vcppfunc_t PARAMS((char**)); + +typedef char* rl_cpvfunc_t PARAMS((void)); +typedef char* rl_cpifunc_t PARAMS((int)); +typedef char* rl_cpcpfunc_t PARAMS((char*)); +typedef char* rl_cpcppfunc_t PARAMS((char**)); + +#endif /* _RL_FUNCTION_TYPEDEF */ + +#ifdef __cplusplus +} +#endif + +#endif /* _RL_TYPEDEFS_H_ */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/readline/tilde.h b/src_cpp/elfgames/tasks/elf2codingenv/include/readline/tilde.h new file mode 100644 index 0000000..4a833ad --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/readline/tilde.h @@ -0,0 +1,80 @@ +/* tilde.h: Externally available variables and function in libtilde.a. */ + +/* Copyright (C) 1992-2009 Free Software Foundation, Inc. + + This file contains the Readline Library (Readline), a set of + routines for providing Emacs style line input to programs that ask + for it. + + Readline is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Readline 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 Readline. If not, see . +*/ + +#if !defined(_TILDE_H_) +#define _TILDE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* A function can be defined using prototypes and compile on both ANSI C + and traditional C compilers with something like this: + extern char *func PARAMS((char *, char *, int)); */ + +#if !defined(PARAMS) +#if defined(__STDC__) || defined(__GNUC__) || defined(__cplusplus) +#define PARAMS(protos) protos +#else +#define PARAMS(protos) () +#endif +#endif + +typedef char* tilde_hook_func_t PARAMS((char*)); + +/* If non-null, this contains the address of a function that the application + wants called before trying the standard tilde expansions. The function + is called with the text sans tilde, and returns a malloc()'ed string + which is the expansion, or a NULL pointer if the expansion fails. */ +extern tilde_hook_func_t* tilde_expansion_preexpansion_hook; + +/* If non-null, this contains the address of a function to call if the + standard meaning for expanding a tilde fails. The function is called + with the text (sans tilde, as in "foo"), and returns a malloc()'ed string + which is the expansion, or a NULL pointer if there is no expansion. */ +extern tilde_hook_func_t* tilde_expansion_failure_hook; + +/* When non-null, this is a NULL terminated array of strings which + are duplicates for a tilde prefix. Bash uses this to expand + `=~' and `:~'. */ +extern char** tilde_additional_prefixes; + +/* When non-null, this is a NULL terminated array of strings which match + the end of a username, instead of just "/". Bash sets this to + `:' and `=~'. */ +extern char** tilde_additional_suffixes; + +/* Return a new string which is the result of tilde expanding STRING. */ +extern char* tilde_expand PARAMS((const char*)); + +/* Do the work of tilde expansion on FILENAME. FILENAME starts with a + tilde. If there is no expansion, call tilde_expansion_failure_hook. */ +extern char* tilde_expand_word PARAMS((const char*)); + +/* Find the portion of the string beginning with ~ that should be expanded. */ +extern char* tilde_find_word PARAMS((const char*, int, int*)); + +#ifdef __cplusplus +} +#endif + +#endif /* _TILDE_H_ */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/sqlite3.h b/src_cpp/elfgames/tasks/elf2codingenv/include/sqlite3.h new file mode 100644 index 0000000..eaae7fc --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/sqlite3.h @@ -0,0 +1,11203 @@ +/* +** 2001-09-15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This header file defines the interface that the SQLite library +** presents to client programs. If a C-function, structure, datatype, +** or constant definition does not appear in this file, then it is +** not a published API of SQLite, is subject to change without +** notice, and should not be referenced by programs that use SQLite. +** +** Some of the definitions that are in this file are marked as +** "experimental". Experimental interfaces are normally new +** features recently added to SQLite. We do not anticipate changes +** to experimental interfaces but reserve the right to make minor changes +** if experience from use "in the wild" suggest such changes are prudent. +** +** The official C-language API documentation for SQLite is derived +** from comments in this file. This file is the authoritative source +** on how SQLite interfaces are supposed to operate. +** +** The name of this file under configuration management is "sqlite.h.in". +** The makefile makes some minor changes to this file (such as inserting +** the version number) and changes its name to "sqlite3.h" as +** part of the build process. +*/ +#ifndef SQLITE3_H +#define SQLITE3_H +#include /* Needed for the definition of va_list */ + +/* +** Make sure we can call this stuff from C++. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Provide the ability to override linkage features of the interface. +*/ +#ifndef SQLITE_EXTERN +#define SQLITE_EXTERN extern +#endif +#ifndef SQLITE_API +#define SQLITE_API +#endif +#ifndef SQLITE_CDECL +#define SQLITE_CDECL +#endif +#ifndef SQLITE_APICALL +#define SQLITE_APICALL +#endif +#ifndef SQLITE_STDCALL +#define SQLITE_STDCALL SQLITE_APICALL +#endif +#ifndef SQLITE_CALLBACK +#define SQLITE_CALLBACK +#endif +#ifndef SQLITE_SYSAPI +#define SQLITE_SYSAPI +#endif + +/* +** These no-op macros are used in front of interfaces to mark those +** interfaces as either deprecated or experimental. New applications +** should not use deprecated interfaces - they are supported for backwards +** compatibility only. Application writers should be aware that +** experimental interfaces are subject to change in point releases. +** +** These macros used to resolve to various kinds of compiler magic that +** would generate warning messages when they were used. But that +** compiler magic ended up generating such a flurry of bug reports +** that we have taken it all out and gone back to using simple +** noop macros. +*/ +#define SQLITE_DEPRECATED +#define SQLITE_EXPERIMENTAL + +/* +** Ensure these symbols were not defined by some previous header file. +*/ +#ifdef SQLITE_VERSION +#undef SQLITE_VERSION +#endif +#ifdef SQLITE_VERSION_NUMBER +#undef SQLITE_VERSION_NUMBER +#endif + +/* +** CAPI3REF: Compile-Time Library Version Numbers +** +** ^(The [SQLITE_VERSION] C preprocessor macro in the sqlite3.h header +** evaluates to a string literal that is the SQLite version in the +** format "X.Y.Z" where X is the major version number (always 3 for +** SQLite3) and Y is the minor version number and Z is the release number.)^ +** ^(The [SQLITE_VERSION_NUMBER] C preprocessor macro resolves to an integer +** with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same +** numbers used in [SQLITE_VERSION].)^ +** The SQLITE_VERSION_NUMBER for any given release of SQLite will also +** be larger than the release from which it is derived. Either Y will +** be held constant and Z will be incremented or else Y will be incremented +** and Z will be reset to zero. +** +** Since [version 3.6.18] ([dateof:3.6.18]), +** SQLite source code has been stored in the +** Fossil configuration management +** system. ^The SQLITE_SOURCE_ID macro evaluates to +** a string which identifies a particular check-in of SQLite +** within its configuration management system. ^The SQLITE_SOURCE_ID +** string contains the date and time of the check-in (UTC) and a SHA1 +** or SHA3-256 hash of the entire source tree. If the source code has +** been edited in any way since it was last checked in, then the last +** four hexadecimal digits of the hash may be modified. +** +** See also: [sqlite3_libversion()], +** [sqlite3_libversion_number()], [sqlite3_sourceid()], +** [sqlite_version()] and [sqlite_source_id()]. +*/ +#define SQLITE_VERSION "3.23.1" +#define SQLITE_VERSION_NUMBER 3023001 +#define SQLITE_SOURCE_ID \ + "2018-04-10 17:39:29 " \ + "4bb2294022060e61de7da5c227a69ccd846ba330e31626ebcd59a94efd148b3b" + +/* +** CAPI3REF: Run-Time Library Version Numbers +** KEYWORDS: sqlite3_version sqlite3_sourceid +** +** These interfaces provide the same information as the [SQLITE_VERSION], +** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros +** but are associated with the library instead of the header file. ^(Cautious +** programmers might include assert() statements in their application to +** verify that values returned by these interfaces match the macros in +** the header, and thus ensure that the application is +** compiled with matching library and header files. +** +**
+** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );
+** assert( strncmp(sqlite3_sourceid(),SQLITE_SOURCE_ID,80)==0 );
+** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );
+** 
)^ +** +** ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION] +** macro. ^The sqlite3_libversion() function returns a pointer to the +** to the sqlite3_version[] string constant. The sqlite3_libversion() +** function is provided for use in DLLs since DLL users usually do not have +** direct access to string constants within the DLL. ^The +** sqlite3_libversion_number() function returns an integer equal to +** [SQLITE_VERSION_NUMBER]. ^(The sqlite3_sourceid() function returns +** a pointer to a string constant whose value is the same as the +** [SQLITE_SOURCE_ID] C preprocessor macro. Except if SQLite is built +** using an edited copy of [the amalgamation], then the last four characters +** of the hash might be different from [SQLITE_SOURCE_ID].)^ +** +** See also: [sqlite_version()] and [sqlite_source_id()]. +*/ +SQLITE_API SQLITE_EXTERN const char sqlite3_version[]; +SQLITE_API const char* sqlite3_libversion(void); +SQLITE_API const char* sqlite3_sourceid(void); +SQLITE_API int sqlite3_libversion_number(void); + +/* +** CAPI3REF: Run-Time Library Compilation Options Diagnostics +** +** ^The sqlite3_compileoption_used() function returns 0 or 1 +** indicating whether the specified option was defined at +** compile time. ^The SQLITE_ prefix may be omitted from the +** option name passed to sqlite3_compileoption_used(). +** +** ^The sqlite3_compileoption_get() function allows iterating +** over the list of options that were defined at compile time by +** returning the N-th compile time option string. ^If N is out of range, +** sqlite3_compileoption_get() returns a NULL pointer. ^The SQLITE_ +** prefix is omitted from any strings returned by +** sqlite3_compileoption_get(). +** +** ^Support for the diagnostic functions sqlite3_compileoption_used() +** and sqlite3_compileoption_get() may be omitted by specifying the +** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time. +** +** See also: SQL functions [sqlite_compileoption_used()] and +** [sqlite_compileoption_get()] and the [compile_options pragma]. +*/ +#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS +SQLITE_API int sqlite3_compileoption_used(const char* zOptName); +SQLITE_API const char* sqlite3_compileoption_get(int N); +#endif + +/* +** CAPI3REF: Test To See If The Library Is Threadsafe +** +** ^The sqlite3_threadsafe() function returns zero if and only if +** SQLite was compiled with mutexing code omitted due to the +** [SQLITE_THREADSAFE] compile-time option being set to 0. +** +** SQLite can be compiled with or without mutexes. When +** the [SQLITE_THREADSAFE] C preprocessor macro is 1 or 2, mutexes +** are enabled and SQLite is threadsafe. When the +** [SQLITE_THREADSAFE] macro is 0, +** the mutexes are omitted. Without the mutexes, it is not safe +** to use SQLite concurrently from more than one thread. +** +** Enabling mutexes incurs a measurable performance penalty. +** So if speed is of utmost importance, it makes sense to disable +** the mutexes. But for maximum safety, mutexes should be enabled. +** ^The default behavior is for mutexes to be enabled. +** +** This interface can be used by an application to make sure that the +** version of SQLite that it is linking against was compiled with +** the desired setting of the [SQLITE_THREADSAFE] macro. +** +** This interface only reports on the compile-time mutex setting +** of the [SQLITE_THREADSAFE] flag. If SQLite is compiled with +** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but +** can be fully or partially disabled using a call to [sqlite3_config()] +** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD], +** or [SQLITE_CONFIG_SERIALIZED]. ^(The return value of the +** sqlite3_threadsafe() function shows only the compile-time setting of +** thread safety, not any run-time changes to that setting made by +** sqlite3_config(). In other words, the return value from sqlite3_threadsafe() +** is unchanged by calls to sqlite3_config().)^ +** +** See the [threading mode] documentation for additional information. +*/ +SQLITE_API int sqlite3_threadsafe(void); + +/* +** CAPI3REF: Database Connection Handle +** KEYWORDS: {database connection} {database connections} +** +** Each open SQLite database is represented by a pointer to an instance of +** the opaque structure named "sqlite3". It is useful to think of an sqlite3 +** pointer as an object. The [sqlite3_open()], [sqlite3_open16()], and +** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()] +** and [sqlite3_close_v2()] are its destructors. There are many other +** interfaces (such as +** [sqlite3_prepare_v2()], [sqlite3_create_function()], and +** [sqlite3_busy_timeout()] to name but three) that are methods on an +** sqlite3 object. +*/ +typedef struct sqlite3 sqlite3; + +/* +** CAPI3REF: 64-Bit Integer Types +** KEYWORDS: sqlite_int64 sqlite_uint64 +** +** Because there is no cross-platform way to specify 64-bit integer types +** SQLite includes typedefs for 64-bit signed and unsigned integers. +** +** The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions. +** The sqlite_int64 and sqlite_uint64 types are supported for backwards +** compatibility only. +** +** ^The sqlite3_int64 and sqlite_int64 types can store integer values +** between -9223372036854775808 and +9223372036854775807 inclusive. ^The +** sqlite3_uint64 and sqlite_uint64 types can store integer values +** between 0 and +18446744073709551615 inclusive. +*/ +#ifdef SQLITE_INT64_TYPE +typedef SQLITE_INT64_TYPE sqlite_int64; +#ifdef SQLITE_UINT64_TYPE +typedef SQLITE_UINT64_TYPE sqlite_uint64; +#else +typedef unsigned SQLITE_INT64_TYPE sqlite_uint64; +#endif +#elif defined(_MSC_VER) || defined(__BORLANDC__) +typedef __int64 sqlite_int64; +typedef unsigned __int64 sqlite_uint64; +#else +typedef long long int sqlite_int64; +typedef unsigned long long int sqlite_uint64; +#endif +typedef sqlite_int64 sqlite3_int64; +typedef sqlite_uint64 sqlite3_uint64; + +/* +** If compiling for a processor that lacks floating point support, +** substitute integer for floating-point. +*/ +#ifdef SQLITE_OMIT_FLOATING_POINT +#define double sqlite3_int64 +#endif + +/* +** CAPI3REF: Closing A Database Connection +** DESTRUCTOR: sqlite3 +** +** ^The sqlite3_close() and sqlite3_close_v2() routines are destructors +** for the [sqlite3] object. +** ^Calls to sqlite3_close() and sqlite3_close_v2() return [SQLITE_OK] if +** the [sqlite3] object is successfully destroyed and all associated +** resources are deallocated. +** +** ^If the database connection is associated with unfinalized prepared +** statements or unfinished sqlite3_backup objects then sqlite3_close() +** will leave the database connection open and return [SQLITE_BUSY]. +** ^If sqlite3_close_v2() is called with unfinalized prepared statements +** and/or unfinished sqlite3_backups, then the database connection becomes +** an unusable "zombie" which will automatically be deallocated when the +** last prepared statement is finalized or the last sqlite3_backup is +** finished. The sqlite3_close_v2() interface is intended for use with +** host languages that are garbage collected, and where the order in which +** destructors are called is arbitrary. +** +** Applications should [sqlite3_finalize | finalize] all [prepared statements], +** [sqlite3_blob_close | close] all [BLOB handles], and +** [sqlite3_backup_finish | finish] all [sqlite3_backup] objects associated +** with the [sqlite3] object prior to attempting to close the object. ^If +** sqlite3_close_v2() is called on a [database connection] that still has +** outstanding [prepared statements], [BLOB handles], and/or +** [sqlite3_backup] objects then it returns [SQLITE_OK] and the deallocation +** of resources is deferred until all [prepared statements], [BLOB handles], +** and [sqlite3_backup] objects are also destroyed. +** +** ^If an [sqlite3] object is destroyed while a transaction is open, +** the transaction is automatically rolled back. +** +** The C parameter to [sqlite3_close(C)] and [sqlite3_close_v2(C)] +** must be either a NULL +** pointer or an [sqlite3] object pointer obtained +** from [sqlite3_open()], [sqlite3_open16()], or +** [sqlite3_open_v2()], and not previously closed. +** ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer +** argument is a harmless no-op. +*/ +SQLITE_API int sqlite3_close(sqlite3*); +SQLITE_API int sqlite3_close_v2(sqlite3*); + +/* +** The type for a callback function. +** This is legacy and deprecated. It is included for historical +** compatibility and is not documented. +*/ +typedef int (*sqlite3_callback)(void*, int, char**, char**); + +/* +** CAPI3REF: One-Step Query Execution Interface +** METHOD: sqlite3 +** +** The sqlite3_exec() interface is a convenience wrapper around +** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()], +** that allows an application to run multiple statements of SQL +** without having to use a lot of C code. +** +** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded, +** semicolon-separate SQL statements passed into its 2nd argument, +** in the context of the [database connection] passed in as its 1st +** argument. ^If the callback function of the 3rd argument to +** sqlite3_exec() is not NULL, then it is invoked for each result row +** coming out of the evaluated SQL statements. ^The 4th argument to +** sqlite3_exec() is relayed through to the 1st argument of each +** callback invocation. ^If the callback pointer to sqlite3_exec() +** is NULL, then no callback is ever invoked and result rows are +** ignored. +** +** ^If an error occurs while evaluating the SQL statements passed into +** sqlite3_exec(), then execution of the current statement stops and +** subsequent statements are skipped. ^If the 5th parameter to sqlite3_exec() +** is not NULL then any error message is written into memory obtained +** from [sqlite3_malloc()] and passed back through the 5th parameter. +** To avoid memory leaks, the application should invoke [sqlite3_free()] +** on error message strings returned through the 5th parameter of +** sqlite3_exec() after the error message string is no longer needed. +** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors +** occur, then sqlite3_exec() sets the pointer in its 5th parameter to +** NULL before returning. +** +** ^If an sqlite3_exec() callback returns non-zero, the sqlite3_exec() +** routine returns SQLITE_ABORT without invoking the callback again and +** without running any subsequent SQL statements. +** +** ^The 2nd argument to the sqlite3_exec() callback function is the +** number of columns in the result. ^The 3rd argument to the sqlite3_exec() +** callback is an array of pointers to strings obtained as if from +** [sqlite3_column_text()], one for each column. ^If an element of a +** result row is NULL then the corresponding string pointer for the +** sqlite3_exec() callback is a NULL pointer. ^The 4th argument to the +** sqlite3_exec() callback is an array of pointers to strings where each +** entry represents the name of corresponding result column as obtained +** from [sqlite3_column_name()]. +** +** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer +** to an empty string, or a pointer that contains only whitespace and/or +** SQL comments, then no SQL statements are evaluated and the database +** is not changed. +** +** Restrictions: +** +**
    +**
  • The application must ensure that the 1st parameter to sqlite3_exec() +** is a valid and open [database connection]. +**
  • The application must not close the [database connection] specified by +** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running. +**
  • The application must not modify the SQL statement text passed into +** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running. +**
+*/ +SQLITE_API int sqlite3_exec( + sqlite3*, /* An open database */ + const char* sql, /* SQL to be evaluated */ + int (*callback)(void*, int, char**, char**), /* Callback function */ + void*, /* 1st argument to callback */ + char** errmsg /* Error msg written here */ + ); + +/* +** CAPI3REF: Result Codes +** KEYWORDS: {result code definitions} +** +** Many SQLite functions return an integer result code from the set shown +** here in order to indicate success or failure. +** +** New error codes may be added in future versions of SQLite. +** +** See also: [extended result code definitions] +*/ +#define SQLITE_OK 0 /* Successful result */ +/* beginning-of-error-codes */ +#define SQLITE_ERROR 1 /* Generic error */ +#define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */ +#define SQLITE_PERM 3 /* Access permission denied */ +#define SQLITE_ABORT 4 /* Callback routine requested an abort */ +#define SQLITE_BUSY 5 /* The database file is locked */ +#define SQLITE_LOCKED 6 /* A table in the database is locked */ +#define SQLITE_NOMEM 7 /* A malloc() failed */ +#define SQLITE_READONLY 8 /* Attempt to write a readonly database */ +#define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite3_interrupt()*/ +#define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */ +#define SQLITE_CORRUPT 11 /* The database disk image is malformed */ +#define SQLITE_NOTFOUND 12 /* Unknown opcode in sqlite3_file_control() */ +#define SQLITE_FULL 13 /* Insertion failed because database is full */ +#define SQLITE_CANTOPEN 14 /* Unable to open the database file */ +#define SQLITE_PROTOCOL 15 /* Database lock protocol error */ +#define SQLITE_EMPTY 16 /* Internal use only */ +#define SQLITE_SCHEMA 17 /* The database schema changed */ +#define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */ +#define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */ +#define SQLITE_MISMATCH 20 /* Data type mismatch */ +#define SQLITE_MISUSE 21 /* Library used incorrectly */ +#define SQLITE_NOLFS 22 /* Uses OS features not supported on host */ +#define SQLITE_AUTH 23 /* Authorization denied */ +#define SQLITE_FORMAT 24 /* Not used */ +#define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */ +#define SQLITE_NOTADB 26 /* File opened that is not a database file */ +#define SQLITE_NOTICE 27 /* Notifications from sqlite3_log() */ +#define SQLITE_WARNING 28 /* Warnings from sqlite3_log() */ +#define SQLITE_ROW 100 /* sqlite3_step() has another row ready */ +#define SQLITE_DONE 101 /* sqlite3_step() has finished executing */ +/* end-of-error-codes */ + +/* +** CAPI3REF: Extended Result Codes +** KEYWORDS: {extended result code definitions} +** +** In its default configuration, SQLite API routines return one of 30 integer +** [result codes]. However, experience has shown that many of +** these result codes are too coarse-grained. They do not provide as +** much information about problems as programmers might like. In an effort to +** address this, newer versions of SQLite (version 3.3.8 [dateof:3.3.8] +** and later) include +** support for additional result codes that provide more detailed information +** about errors. These [extended result codes] are enabled or disabled +** on a per database connection basis using the +** [sqlite3_extended_result_codes()] API. Or, the extended code for +** the most recent error can be obtained using +** [sqlite3_extended_errcode()]. +*/ +#define SQLITE_ERROR_MISSING_COLLSEQ (SQLITE_ERROR | (1 << 8)) +#define SQLITE_ERROR_RETRY (SQLITE_ERROR | (2 << 8)) +#define SQLITE_IOERR_READ (SQLITE_IOERR | (1 << 8)) +#define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2 << 8)) +#define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3 << 8)) +#define SQLITE_IOERR_FSYNC (SQLITE_IOERR | (4 << 8)) +#define SQLITE_IOERR_DIR_FSYNC (SQLITE_IOERR | (5 << 8)) +#define SQLITE_IOERR_TRUNCATE (SQLITE_IOERR | (6 << 8)) +#define SQLITE_IOERR_FSTAT (SQLITE_IOERR | (7 << 8)) +#define SQLITE_IOERR_UNLOCK (SQLITE_IOERR | (8 << 8)) +#define SQLITE_IOERR_RDLOCK (SQLITE_IOERR | (9 << 8)) +#define SQLITE_IOERR_DELETE (SQLITE_IOERR | (10 << 8)) +#define SQLITE_IOERR_BLOCKED (SQLITE_IOERR | (11 << 8)) +#define SQLITE_IOERR_NOMEM (SQLITE_IOERR | (12 << 8)) +#define SQLITE_IOERR_ACCESS (SQLITE_IOERR | (13 << 8)) +#define SQLITE_IOERR_CHECKRESERVEDLOCK (SQLITE_IOERR | (14 << 8)) +#define SQLITE_IOERR_LOCK (SQLITE_IOERR | (15 << 8)) +#define SQLITE_IOERR_CLOSE (SQLITE_IOERR | (16 << 8)) +#define SQLITE_IOERR_DIR_CLOSE (SQLITE_IOERR | (17 << 8)) +#define SQLITE_IOERR_SHMOPEN (SQLITE_IOERR | (18 << 8)) +#define SQLITE_IOERR_SHMSIZE (SQLITE_IOERR | (19 << 8)) +#define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20 << 8)) +#define SQLITE_IOERR_SHMMAP (SQLITE_IOERR | (21 << 8)) +#define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22 << 8)) +#define SQLITE_IOERR_DELETE_NOENT (SQLITE_IOERR | (23 << 8)) +#define SQLITE_IOERR_MMAP (SQLITE_IOERR | (24 << 8)) +#define SQLITE_IOERR_GETTEMPPATH (SQLITE_IOERR | (25 << 8)) +#define SQLITE_IOERR_CONVPATH (SQLITE_IOERR | (26 << 8)) +#define SQLITE_IOERR_VNODE (SQLITE_IOERR | (27 << 8)) +#define SQLITE_IOERR_AUTH (SQLITE_IOERR | (28 << 8)) +#define SQLITE_IOERR_BEGIN_ATOMIC (SQLITE_IOERR | (29 << 8)) +#define SQLITE_IOERR_COMMIT_ATOMIC (SQLITE_IOERR | (30 << 8)) +#define SQLITE_IOERR_ROLLBACK_ATOMIC (SQLITE_IOERR | (31 << 8)) +#define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1 << 8)) +#define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1 << 8)) +#define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2 << 8)) +#define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1 << 8)) +#define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2 << 8)) +#define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3 << 8)) +#define SQLITE_CANTOPEN_CONVPATH (SQLITE_CANTOPEN | (4 << 8)) +#define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1 << 8)) +#define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1 << 8)) +#define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2 << 8)) +#define SQLITE_READONLY_ROLLBACK (SQLITE_READONLY | (3 << 8)) +#define SQLITE_READONLY_DBMOVED (SQLITE_READONLY | (4 << 8)) +#define SQLITE_READONLY_CANTINIT (SQLITE_READONLY | (5 << 8)) +#define SQLITE_READONLY_DIRECTORY (SQLITE_READONLY | (6 << 8)) +#define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2 << 8)) +#define SQLITE_CONSTRAINT_CHECK (SQLITE_CONSTRAINT | (1 << 8)) +#define SQLITE_CONSTRAINT_COMMITHOOK (SQLITE_CONSTRAINT | (2 << 8)) +#define SQLITE_CONSTRAINT_FOREIGNKEY (SQLITE_CONSTRAINT | (3 << 8)) +#define SQLITE_CONSTRAINT_FUNCTION (SQLITE_CONSTRAINT | (4 << 8)) +#define SQLITE_CONSTRAINT_NOTNULL (SQLITE_CONSTRAINT | (5 << 8)) +#define SQLITE_CONSTRAINT_PRIMARYKEY (SQLITE_CONSTRAINT | (6 << 8)) +#define SQLITE_CONSTRAINT_TRIGGER (SQLITE_CONSTRAINT | (7 << 8)) +#define SQLITE_CONSTRAINT_UNIQUE (SQLITE_CONSTRAINT | (8 << 8)) +#define SQLITE_CONSTRAINT_VTAB (SQLITE_CONSTRAINT | (9 << 8)) +#define SQLITE_CONSTRAINT_ROWID (SQLITE_CONSTRAINT | (10 << 8)) +#define SQLITE_NOTICE_RECOVER_WAL (SQLITE_NOTICE | (1 << 8)) +#define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2 << 8)) +#define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1 << 8)) +#define SQLITE_AUTH_USER (SQLITE_AUTH | (1 << 8)) +#define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1 << 8)) + +/* +** CAPI3REF: Flags For File Open Operations +** +** These bit values are intended for use in the +** 3rd parameter to the [sqlite3_open_v2()] interface and +** in the 4th parameter to the [sqlite3_vfs.xOpen] method. +*/ +#define SQLITE_OPEN_READONLY 0x00000001 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_READWRITE 0x00000002 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_CREATE 0x00000004 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_DELETEONCLOSE 0x00000008 /* VFS only */ +#define SQLITE_OPEN_EXCLUSIVE 0x00000010 /* VFS only */ +#define SQLITE_OPEN_AUTOPROXY 0x00000020 /* VFS only */ +#define SQLITE_OPEN_URI 0x00000040 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_MEMORY 0x00000080 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_MAIN_DB 0x00000100 /* VFS only */ +#define SQLITE_OPEN_TEMP_DB 0x00000200 /* VFS only */ +#define SQLITE_OPEN_TRANSIENT_DB 0x00000400 /* VFS only */ +#define SQLITE_OPEN_MAIN_JOURNAL 0x00000800 /* VFS only */ +#define SQLITE_OPEN_TEMP_JOURNAL 0x00001000 /* VFS only */ +#define SQLITE_OPEN_SUBJOURNAL 0x00002000 /* VFS only */ +#define SQLITE_OPEN_MASTER_JOURNAL 0x00004000 /* VFS only */ +#define SQLITE_OPEN_NOMUTEX 0x00008000 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_FULLMUTEX 0x00010000 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_SHAREDCACHE 0x00020000 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_WAL 0x00080000 /* VFS only */ + +/* Reserved: 0x00F00000 */ + +/* +** CAPI3REF: Device Characteristics +** +** The xDeviceCharacteristics method of the [sqlite3_io_methods] +** object returns an integer which is a vector of these +** bit values expressing I/O characteristics of the mass storage +** device that holds the file that the [sqlite3_io_methods] +** refers to. +** +** The SQLITE_IOCAP_ATOMIC property means that all writes of +** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values +** mean that writes of blocks that are nnn bytes in size and +** are aligned to an address which is an integer multiple of +** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means +** that when data is appended to a file, the data is appended +** first then the size of the file is extended, never the other +** way around. The SQLITE_IOCAP_SEQUENTIAL property means that +** information is written to disk in the same order as calls +** to xWrite(). The SQLITE_IOCAP_POWERSAFE_OVERWRITE property means that +** after reboot following a crash or power loss, the only bytes in a +** file that were written at the application level might have changed +** and that adjacent bytes, even bytes within the same sector are +** guaranteed to be unchanged. The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN +** flag indicates that a file cannot be deleted when open. The +** SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on +** read-only media and cannot be changed even by processes with +** elevated privileges. +** +** The SQLITE_IOCAP_BATCH_ATOMIC property means that the underlying +** filesystem supports doing multiple write operations atomically when those +** write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and +** [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]. +*/ +#define SQLITE_IOCAP_ATOMIC 0x00000001 +#define SQLITE_IOCAP_ATOMIC512 0x00000002 +#define SQLITE_IOCAP_ATOMIC1K 0x00000004 +#define SQLITE_IOCAP_ATOMIC2K 0x00000008 +#define SQLITE_IOCAP_ATOMIC4K 0x00000010 +#define SQLITE_IOCAP_ATOMIC8K 0x00000020 +#define SQLITE_IOCAP_ATOMIC16K 0x00000040 +#define SQLITE_IOCAP_ATOMIC32K 0x00000080 +#define SQLITE_IOCAP_ATOMIC64K 0x00000100 +#define SQLITE_IOCAP_SAFE_APPEND 0x00000200 +#define SQLITE_IOCAP_SEQUENTIAL 0x00000400 +#define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800 +#define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000 +#define SQLITE_IOCAP_IMMUTABLE 0x00002000 +#define SQLITE_IOCAP_BATCH_ATOMIC 0x00004000 + +/* +** CAPI3REF: File Locking Levels +** +** SQLite uses one of these integer values as the second +** argument to calls it makes to the xLock() and xUnlock() methods +** of an [sqlite3_io_methods] object. +*/ +#define SQLITE_LOCK_NONE 0 +#define SQLITE_LOCK_SHARED 1 +#define SQLITE_LOCK_RESERVED 2 +#define SQLITE_LOCK_PENDING 3 +#define SQLITE_LOCK_EXCLUSIVE 4 + +/* +** CAPI3REF: Synchronization Type Flags +** +** When SQLite invokes the xSync() method of an +** [sqlite3_io_methods] object it uses a combination of +** these integer values as the second argument. +** +** When the SQLITE_SYNC_DATAONLY flag is used, it means that the +** sync operation only needs to flush data to mass storage. Inode +** information need not be flushed. If the lower four bits of the flag +** equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics. +** If the lower four bits equal SQLITE_SYNC_FULL, that means +** to use Mac OS X style fullsync instead of fsync(). +** +** Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags +** with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL +** settings. The [synchronous pragma] determines when calls to the +** xSync VFS method occur and applies uniformly across all platforms. +** The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how +** energetic or rigorous or forceful the sync operations are and +** only make a difference on Mac OSX for the default SQLite code. +** (Third-party VFS implementations might also make the distinction +** between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the +** operating systems natively supported by SQLite, only Mac OSX +** cares about the difference.) +*/ +#define SQLITE_SYNC_NORMAL 0x00002 +#define SQLITE_SYNC_FULL 0x00003 +#define SQLITE_SYNC_DATAONLY 0x00010 + +/* +** CAPI3REF: OS Interface Open File Handle +** +** An [sqlite3_file] object represents an open file in the +** [sqlite3_vfs | OS interface layer]. Individual OS interface +** implementations will +** want to subclass this object by appending additional fields +** for their own use. The pMethods entry is a pointer to an +** [sqlite3_io_methods] object that defines methods for performing +** I/O operations on the open file. +*/ +typedef struct sqlite3_file sqlite3_file; +struct sqlite3_file { + const struct sqlite3_io_methods* pMethods; /* Methods for an open file */ +}; + +/* +** CAPI3REF: OS Interface File Virtual Methods Object +** +** Every file opened by the [sqlite3_vfs.xOpen] method populates an +** [sqlite3_file] object (or, more commonly, a subclass of the +** [sqlite3_file] object) with a pointer to an instance of this object. +** This object defines the methods used to perform various operations +** against the open file represented by the [sqlite3_file] object. +** +** If the [sqlite3_vfs.xOpen] method sets the sqlite3_file.pMethods element +** to a non-NULL pointer, then the sqlite3_io_methods.xClose method +** may be invoked even if the [sqlite3_vfs.xOpen] reported that it failed. The +** only way to prevent a call to xClose following a failed [sqlite3_vfs.xOpen] +** is for the [sqlite3_vfs.xOpen] to set the sqlite3_file.pMethods element +** to NULL. +** +** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or +** [SQLITE_SYNC_FULL]. The first choice is the normal fsync(). +** The second choice is a Mac OS X style fullsync. The [SQLITE_SYNC_DATAONLY] +** flag may be ORed in to indicate that only the data of the file +** and not its inode needs to be synced. +** +** The integer values to xLock() and xUnlock() are one of +**
    +**
  • [SQLITE_LOCK_NONE], +**
  • [SQLITE_LOCK_SHARED], +**
  • [SQLITE_LOCK_RESERVED], +**
  • [SQLITE_LOCK_PENDING], or +**
  • [SQLITE_LOCK_EXCLUSIVE]. +**
+** xLock() increases the lock. xUnlock() decreases the lock. +** The xCheckReservedLock() method checks whether any database connection, +** either in this process or in some other process, is holding a RESERVED, +** PENDING, or EXCLUSIVE lock on the file. It returns true +** if such a lock exists and false otherwise. +** +** The xFileControl() method is a generic interface that allows custom +** VFS implementations to directly control an open file using the +** [sqlite3_file_control()] interface. The second "op" argument is an +** integer opcode. The third argument is a generic pointer intended to +** point to a structure that may contain arguments or space in which to +** write return values. Potential uses for xFileControl() might be +** functions to enable blocking locks with timeouts, to change the +** locking strategy (for example to use dot-file locks), to inquire +** about the status of a lock, or to break stale locks. The SQLite +** core reserves all opcodes less than 100 for its own use. +** A [file control opcodes | list of opcodes] less than 100 is available. +** Applications that define a custom xFileControl method should use opcodes +** greater than 100 to avoid conflicts. VFS implementations should +** return [SQLITE_NOTFOUND] for file control opcodes that they do not +** recognize. +** +** The xSectorSize() method returns the sector size of the +** device that underlies the file. The sector size is the +** minimum write that can be performed without disturbing +** other bytes in the file. The xDeviceCharacteristics() +** method returns a bit vector describing behaviors of the +** underlying device: +** +**
    +**
  • [SQLITE_IOCAP_ATOMIC] +**
  • [SQLITE_IOCAP_ATOMIC512] +**
  • [SQLITE_IOCAP_ATOMIC1K] +**
  • [SQLITE_IOCAP_ATOMIC2K] +**
  • [SQLITE_IOCAP_ATOMIC4K] +**
  • [SQLITE_IOCAP_ATOMIC8K] +**
  • [SQLITE_IOCAP_ATOMIC16K] +**
  • [SQLITE_IOCAP_ATOMIC32K] +**
  • [SQLITE_IOCAP_ATOMIC64K] +**
  • [SQLITE_IOCAP_SAFE_APPEND] +**
  • [SQLITE_IOCAP_SEQUENTIAL] +**
  • [SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN] +**
  • [SQLITE_IOCAP_POWERSAFE_OVERWRITE] +**
  • [SQLITE_IOCAP_IMMUTABLE] +**
  • [SQLITE_IOCAP_BATCH_ATOMIC] +**
+** +** The SQLITE_IOCAP_ATOMIC property means that all writes of +** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values +** mean that writes of blocks that are nnn bytes in size and +** are aligned to an address which is an integer multiple of +** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means +** that when data is appended to a file, the data is appended +** first then the size of the file is extended, never the other +** way around. The SQLITE_IOCAP_SEQUENTIAL property means that +** information is written to disk in the same order as calls +** to xWrite(). +** +** If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill +** in the unread portions of the buffer with zeros. A VFS that +** fails to zero-fill short reads might seem to work. However, +** failure to zero-fill short reads will eventually lead to +** database corruption. +*/ +typedef struct sqlite3_io_methods sqlite3_io_methods; +struct sqlite3_io_methods { + int iVersion; + int (*xClose)(sqlite3_file*); + int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst); + int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst); + int (*xTruncate)(sqlite3_file*, sqlite3_int64 size); + int (*xSync)(sqlite3_file*, int flags); + int (*xFileSize)(sqlite3_file*, sqlite3_int64* pSize); + int (*xLock)(sqlite3_file*, int); + int (*xUnlock)(sqlite3_file*, int); + int (*xCheckReservedLock)(sqlite3_file*, int* pResOut); + int (*xFileControl)(sqlite3_file*, int op, void* pArg); + int (*xSectorSize)(sqlite3_file*); + int (*xDeviceCharacteristics)(sqlite3_file*); + /* Methods above are valid for version 1 */ + int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, void volatile**); + int (*xShmLock)(sqlite3_file*, int offset, int n, int flags); + void (*xShmBarrier)(sqlite3_file*); + int (*xShmUnmap)(sqlite3_file*, int deleteFlag); + /* Methods above are valid for version 2 */ + int (*xFetch)(sqlite3_file*, sqlite3_int64 iOfst, int iAmt, void** pp); + int (*xUnfetch)(sqlite3_file*, sqlite3_int64 iOfst, void* p); + /* Methods above are valid for version 3 */ + /* Additional methods may be added in future releases */ +}; + +/* +** CAPI3REF: Standard File Control Opcodes +** KEYWORDS: {file control opcodes} {file control opcode} +** +** These integer constants are opcodes for the xFileControl method +** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()] +** interface. +** +**
    +**
  • [[SQLITE_FCNTL_LOCKSTATE]] +** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging. This +** opcode causes the xFileControl method to write the current state of +** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED], +** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE]) +** into an integer that the pArg argument points to. This capability +** is used during testing and is only available when the SQLITE_TEST +** compile-time option is used. +** +**
  • [[SQLITE_FCNTL_SIZE_HINT]] +** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS +** layer a hint of how large the database file will grow to be during the +** current transaction. This hint is not guaranteed to be accurate but it +** is often close. The underlying VFS might choose to preallocate database +** file space based on this hint in order to help writes to the database +** file run faster. +** +**
  • [[SQLITE_FCNTL_CHUNK_SIZE]] +** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS +** extends and truncates the database file in chunks of a size specified +** by the user. The fourth argument to [sqlite3_file_control()] should +** point to an integer (type int) containing the new chunk-size to use +** for the nominated database. Allocating database file space in large +** chunks (say 1MB at a time), may reduce file-system fragmentation and +** improve performance on some systems. +** +**
  • [[SQLITE_FCNTL_FILE_POINTER]] +** The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer +** to the [sqlite3_file] object associated with a particular database +** connection. See also [SQLITE_FCNTL_JOURNAL_POINTER]. +** +**
  • [[SQLITE_FCNTL_JOURNAL_POINTER]] +** The [SQLITE_FCNTL_JOURNAL_POINTER] opcode is used to obtain a pointer +** to the [sqlite3_file] object associated with the journal file (either +** the [rollback journal] or the [write-ahead log]) for a particular database +** connection. See also [SQLITE_FCNTL_FILE_POINTER]. +** +**
  • [[SQLITE_FCNTL_SYNC_OMITTED]] +** No longer in use. +** +**
  • [[SQLITE_FCNTL_SYNC]] +** The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and +** sent to the VFS immediately before the xSync method is invoked on a +** database file descriptor. Or, if the xSync method is not invoked +** because the user has configured SQLite with +** [PRAGMA synchronous | PRAGMA synchronous=OFF] it is invoked in place +** of the xSync method. In most cases, the pointer argument passed with +** this file-control is NULL. However, if the database file is being synced +** as part of a multi-database commit, the argument points to a nul-terminated +** string containing the transactions master-journal file name. VFSes that +** do not need this signal should silently ignore this opcode. Applications +** should not call [sqlite3_file_control()] with this opcode as doing so may +** disrupt the operation of the specialized VFSes that do require it. +** +**
  • [[SQLITE_FCNTL_COMMIT_PHASETWO]] +** The [SQLITE_FCNTL_COMMIT_PHASETWO] opcode is generated internally by SQLite +** and sent to the VFS after a transaction has been committed immediately +** but before the database is unlocked. VFSes that do not need this signal +** should silently ignore this opcode. Applications should not call +** [sqlite3_file_control()] with this opcode as doing so may disrupt the +** operation of the specialized VFSes that do require it. +** +**
  • [[SQLITE_FCNTL_WIN32_AV_RETRY]] +** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic +** retry counts and intervals for certain disk I/O operations for the +** windows [VFS] in order to provide robustness in the presence of +** anti-virus programs. By default, the windows VFS will retry file read, +** file write, and file delete operations up to 10 times, with a delay +** of 25 milliseconds before the first retry and with the delay increasing +** by an additional 25 milliseconds with each subsequent retry. This +** opcode allows these two values (10 retries and 25 milliseconds of delay) +** to be adjusted. The values are changed for all database connections +** within the same process. The argument is a pointer to an array of two +** integers where the first integer is the new retry count and the second +** integer is the delay. If either integer is negative, then the setting +** is not changed but instead the prior value of that setting is written +** into the array entry, allowing the current retry settings to be +** interrogated. The zDbName parameter is ignored. +** +**
  • [[SQLITE_FCNTL_PERSIST_WAL]] +** ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the +** persistent [WAL | Write Ahead Log] setting. By default, the auxiliary +** write ahead log and shared memory files used for transaction control +** are automatically deleted when the latest connection to the database +** closes. Setting persistent WAL mode causes those files to persist after +** close. Persisting the files is useful when other processes that do not +** have write permission on the directory containing the database file want +** to read the database file, as the WAL and shared memory files must exist +** in order for the database to be readable. The fourth parameter to +** [sqlite3_file_control()] for this opcode should be a pointer to an integer. +** That integer is 0 to disable persistent WAL mode or 1 to enable persistent +** WAL mode. If the integer is -1, then it is overwritten with the current +** WAL persistence setting. +** +**
  • [[SQLITE_FCNTL_POWERSAFE_OVERWRITE]] +** ^The [SQLITE_FCNTL_POWERSAFE_OVERWRITE] opcode is used to set or query the +** persistent "powersafe-overwrite" or "PSOW" setting. The PSOW setting +** determines the [SQLITE_IOCAP_POWERSAFE_OVERWRITE] bit of the +** xDeviceCharacteristics methods. The fourth parameter to +** [sqlite3_file_control()] for this opcode should be a pointer to an integer. +** That integer is 0 to disable zero-damage mode or 1 to enable zero-damage +** mode. If the integer is -1, then it is overwritten with the current +** zero-damage mode setting. +** +**
  • [[SQLITE_FCNTL_OVERWRITE]] +** ^The [SQLITE_FCNTL_OVERWRITE] opcode is invoked by SQLite after opening +** a write transaction to indicate that, unless it is rolled back for some +** reason, the entire database file will be overwritten by the current +** transaction. This is used by VACUUM operations. +** +**
  • [[SQLITE_FCNTL_VFSNAME]] +** ^The [SQLITE_FCNTL_VFSNAME] opcode can be used to obtain the names of +** all [VFSes] in the VFS stack. The names are of all VFS shims and the +** final bottom-level VFS are written into memory obtained from +** [sqlite3_malloc()] and the result is stored in the char* variable +** that the fourth parameter of [sqlite3_file_control()] points to. +** The caller is responsible for freeing the memory when done. As with +** all file-control actions, there is no guarantee that this will actually +** do anything. Callers should initialize the char* variable to a NULL +** pointer in case this file-control is not implemented. This file-control +** is intended for diagnostic use only. +** +**
  • [[SQLITE_FCNTL_VFS_POINTER]] +** ^The [SQLITE_FCNTL_VFS_POINTER] opcode finds a pointer to the top-level +** [VFSes] currently in use. ^(The argument X in +** sqlite3_file_control(db,SQLITE_FCNTL_VFS_POINTER,X) must be +** of type "[sqlite3_vfs] **". This opcodes will set *X +** to a pointer to the top-level VFS.)^ +** ^When there are multiple VFS shims in the stack, this opcode finds the +** upper-most shim only. +** +**
  • [[SQLITE_FCNTL_PRAGMA]] +** ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA] +** file control is sent to the open [sqlite3_file] object corresponding +** to the database file to which the pragma statement refers. ^The argument +** to the [SQLITE_FCNTL_PRAGMA] file control is an array of +** pointers to strings (char**) in which the second element of the array +** is the name of the pragma and the third element is the argument to the +** pragma or NULL if the pragma has no argument. ^The handler for an +** [SQLITE_FCNTL_PRAGMA] file control can optionally make the first element +** of the char** argument point to a string obtained from [sqlite3_mprintf()] +** or the equivalent and that string will become the result of the pragma or +** the error message if the pragma fails. ^If the +** [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal +** [PRAGMA] processing continues. ^If the [SQLITE_FCNTL_PRAGMA] +** file control returns [SQLITE_OK], then the parser assumes that the +** VFS has handled the PRAGMA itself and the parser generates a no-op +** prepared statement if result string is NULL, or that returns a copy +** of the result string if the string is non-NULL. +** ^If the [SQLITE_FCNTL_PRAGMA] file control returns +** any result code other than [SQLITE_OK] or [SQLITE_NOTFOUND], that means +** that the VFS encountered an error while handling the [PRAGMA] and the +** compilation of the PRAGMA fails with an error. ^The [SQLITE_FCNTL_PRAGMA] +** file control occurs at the beginning of pragma statement analysis and so +** it is able to override built-in [PRAGMA] statements. +** +**
  • [[SQLITE_FCNTL_BUSYHANDLER]] +** ^The [SQLITE_FCNTL_BUSYHANDLER] +** file-control may be invoked by SQLite on the database file handle +** shortly after it is opened in order to provide a custom VFS with access +** to the connections busy-handler callback. The argument is of type (void **) +** - an array of two (void *) values. The first (void *) actually points +** to a function of type (int (*)(void *)). In order to invoke the connections +** busy-handler, this function should be invoked with the second (void *) in +** the array as the only argument. If it returns non-zero, then the operation +** should be retried. If it returns zero, the custom VFS should abandon the +** current operation. +** +**
  • [[SQLITE_FCNTL_TEMPFILENAME]] +** ^Application can invoke the [SQLITE_FCNTL_TEMPFILENAME] file-control +** to have SQLite generate a +** temporary filename using the same algorithm that is followed to generate +** temporary filenames for TEMP tables and other internal uses. The +** argument should be a char** which will be filled with the filename +** written into memory obtained from [sqlite3_malloc()]. The caller should +** invoke [sqlite3_free()] on the result to avoid a memory leak. +** +**
  • [[SQLITE_FCNTL_MMAP_SIZE]] +** The [SQLITE_FCNTL_MMAP_SIZE] file control is used to query or set the +** maximum number of bytes that will be used for memory-mapped I/O. +** The argument is a pointer to a value of type sqlite3_int64 that +** is an advisory maximum number of bytes in the file to memory map. The +** pointer is overwritten with the old value. The limit is not changed if +** the value originally pointed to is negative, and so the current limit +** can be queried by passing in a pointer to a negative number. This +** file-control is used internally to implement [PRAGMA mmap_size]. +** +**
  • [[SQLITE_FCNTL_TRACE]] +** The [SQLITE_FCNTL_TRACE] file control provides advisory information +** to the VFS about what the higher layers of the SQLite stack are doing. +** This file control is used by some VFS activity tracing [shims]. +** The argument is a zero-terminated string. Higher layers in the +** SQLite stack may generate instances of this file control if +** the [SQLITE_USE_FCNTL_TRACE] compile-time option is enabled. +** +**
  • [[SQLITE_FCNTL_HAS_MOVED]] +** The [SQLITE_FCNTL_HAS_MOVED] file control interprets its argument as a +** pointer to an integer and it writes a boolean into that integer depending +** on whether or not the file has been renamed, moved, or deleted since it +** was first opened. +** +**
  • [[SQLITE_FCNTL_WIN32_GET_HANDLE]] +** The [SQLITE_FCNTL_WIN32_GET_HANDLE] opcode can be used to obtain the +** underlying native file handle associated with a file handle. This file +** control interprets its argument as a pointer to a native file handle and +** writes the resulting value there. +** +**
  • [[SQLITE_FCNTL_WIN32_SET_HANDLE]] +** The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging. This +** opcode causes the xFileControl method to swap the file handle with the one +** pointed to by the pArg argument. This capability is used during testing +** and only needs to be supported when SQLITE_TEST is defined. +** +**
  • [[SQLITE_FCNTL_WAL_BLOCK]] +** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might +** be advantageous to block on the next WAL lock if the lock is not immediately +** available. The WAL subsystem issues this signal during rare +** circumstances in order to fix a problem with priority inversion. +** Applications should not use this file-control. +** +**
  • [[SQLITE_FCNTL_ZIPVFS]] +** The [SQLITE_FCNTL_ZIPVFS] opcode is implemented by zipvfs only. All other +** VFS should return SQLITE_NOTFOUND for this opcode. +** +**
  • [[SQLITE_FCNTL_RBU]] +** The [SQLITE_FCNTL_RBU] opcode is implemented by the special VFS used by +** the RBU extension only. All other VFS should return SQLITE_NOTFOUND for +** this opcode. +** +**
  • [[SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]] +** If the [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] opcode returns SQLITE_OK, then +** the file descriptor is placed in "batch write mode", which +** means all subsequent write operations will be deferred and done +** atomically at the next [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]. Systems +** that do not support batch atomic writes will return SQLITE_NOTFOUND. +** ^Following a successful SQLITE_FCNTL_BEGIN_ATOMIC_WRITE and prior to +** the closing [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] or +** [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE], SQLite will make +** no VFS interface calls on the same [sqlite3_file] file descriptor +** except for calls to the xWrite method and the xFileControl method +** with [SQLITE_FCNTL_SIZE_HINT]. +** +**
  • [[SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]] +** The [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] opcode causes all write +** operations since the previous successful call to +** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be performed atomically. +** This file control returns [SQLITE_OK] if and only if the writes were +** all performed successfully and have been committed to persistent storage. +** ^Regardless of whether or not it is successful, this file control takes +** the file descriptor out of batch write mode so that all subsequent +** write operations are independent. +** ^SQLite will never invoke SQLITE_FCNTL_COMMIT_ATOMIC_WRITE without +** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]. +** +**
  • [[SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE]] +** The [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE] opcode causes all write +** operations since the previous successful call to +** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be rolled back. +** ^This file control takes the file descriptor out of batch write mode +** so that all subsequent write operations are independent. +** ^SQLite will never invoke SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE without +** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]. +** +**
  • [[SQLITE_FCNTL_LOCK_TIMEOUT]] +** The [SQLITE_FCNTL_LOCK_TIMEOUT] opcode causes attempts to obtain +** a file lock using the xLock or xShmLock methods of the VFS to wait +** for up to M milliseconds before failing, where M is the single +** unsigned integer parameter. +**
+*/ +#define SQLITE_FCNTL_LOCKSTATE 1 +#define SQLITE_FCNTL_GET_LOCKPROXYFILE 2 +#define SQLITE_FCNTL_SET_LOCKPROXYFILE 3 +#define SQLITE_FCNTL_LAST_ERRNO 4 +#define SQLITE_FCNTL_SIZE_HINT 5 +#define SQLITE_FCNTL_CHUNK_SIZE 6 +#define SQLITE_FCNTL_FILE_POINTER 7 +#define SQLITE_FCNTL_SYNC_OMITTED 8 +#define SQLITE_FCNTL_WIN32_AV_RETRY 9 +#define SQLITE_FCNTL_PERSIST_WAL 10 +#define SQLITE_FCNTL_OVERWRITE 11 +#define SQLITE_FCNTL_VFSNAME 12 +#define SQLITE_FCNTL_POWERSAFE_OVERWRITE 13 +#define SQLITE_FCNTL_PRAGMA 14 +#define SQLITE_FCNTL_BUSYHANDLER 15 +#define SQLITE_FCNTL_TEMPFILENAME 16 +#define SQLITE_FCNTL_MMAP_SIZE 18 +#define SQLITE_FCNTL_TRACE 19 +#define SQLITE_FCNTL_HAS_MOVED 20 +#define SQLITE_FCNTL_SYNC 21 +#define SQLITE_FCNTL_COMMIT_PHASETWO 22 +#define SQLITE_FCNTL_WIN32_SET_HANDLE 23 +#define SQLITE_FCNTL_WAL_BLOCK 24 +#define SQLITE_FCNTL_ZIPVFS 25 +#define SQLITE_FCNTL_RBU 26 +#define SQLITE_FCNTL_VFS_POINTER 27 +#define SQLITE_FCNTL_JOURNAL_POINTER 28 +#define SQLITE_FCNTL_WIN32_GET_HANDLE 29 +#define SQLITE_FCNTL_PDB 30 +#define SQLITE_FCNTL_BEGIN_ATOMIC_WRITE 31 +#define SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32 +#define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33 +#define SQLITE_FCNTL_LOCK_TIMEOUT 34 + +/* deprecated names */ +#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE +#define SQLITE_SET_LOCKPROXYFILE SQLITE_FCNTL_SET_LOCKPROXYFILE +#define SQLITE_LAST_ERRNO SQLITE_FCNTL_LAST_ERRNO + +/* +** CAPI3REF: Mutex Handle +** +** The mutex module within SQLite defines [sqlite3_mutex] to be an +** abstract type for a mutex object. The SQLite core never looks +** at the internal representation of an [sqlite3_mutex]. It only +** deals with pointers to the [sqlite3_mutex] object. +** +** Mutexes are created using [sqlite3_mutex_alloc()]. +*/ +typedef struct sqlite3_mutex sqlite3_mutex; + +/* +** CAPI3REF: Loadable Extension Thunk +** +** A pointer to the opaque sqlite3_api_routines structure is passed as +** the third parameter to entry points of [loadable extensions]. This +** structure must be typedefed in order to work around compiler warnings +** on some platforms. +*/ +typedef struct sqlite3_api_routines sqlite3_api_routines; + +/* +** CAPI3REF: OS Interface Object +** +** An instance of the sqlite3_vfs object defines the interface between +** the SQLite core and the underlying operating system. The "vfs" +** in the name of the object stands for "virtual file system". See +** the [VFS | VFS documentation] for further information. +** +** The VFS interface is sometimes extended by adding new methods onto +** the end. Each time such an extension occurs, the iVersion field +** is incremented. The iVersion value started out as 1 in +** SQLite [version 3.5.0] on [dateof:3.5.0], then increased to 2 +** with SQLite [version 3.7.0] on [dateof:3.7.0], and then increased +** to 3 with SQLite [version 3.7.6] on [dateof:3.7.6]. Additional fields +** may be appended to the sqlite3_vfs object and the iVersion value +** may increase again in future versions of SQLite. +** Note that the structure +** of the sqlite3_vfs object changes in the transition from +** SQLite [version 3.5.9] to [version 3.6.0] on [dateof:3.6.0] +** and yet the iVersion field was not modified. +** +** The szOsFile field is the size of the subclassed [sqlite3_file] +** structure used by this VFS. mxPathname is the maximum length of +** a pathname in this VFS. +** +** Registered sqlite3_vfs objects are kept on a linked list formed by +** the pNext pointer. The [sqlite3_vfs_register()] +** and [sqlite3_vfs_unregister()] interfaces manage this list +** in a thread-safe way. The [sqlite3_vfs_find()] interface +** searches the list. Neither the application code nor the VFS +** implementation should use the pNext pointer. +** +** The pNext field is the only field in the sqlite3_vfs +** structure that SQLite will ever modify. SQLite will only access +** or modify this field while holding a particular static mutex. +** The application should never modify anything within the sqlite3_vfs +** object once the object has been registered. +** +** The zName field holds the name of the VFS module. The name must +** be unique across all VFS modules. +** +** [[sqlite3_vfs.xOpen]] +** ^SQLite guarantees that the zFilename parameter to xOpen +** is either a NULL pointer or string obtained +** from xFullPathname() with an optional suffix added. +** ^If a suffix is added to the zFilename parameter, it will +** consist of a single "-" character followed by no more than +** 11 alphanumeric and/or "-" characters. +** ^SQLite further guarantees that +** the string will be valid and unchanged until xClose() is +** called. Because of the previous sentence, +** the [sqlite3_file] can safely store a pointer to the +** filename if it needs to remember the filename for some reason. +** If the zFilename parameter to xOpen is a NULL pointer then xOpen +** must invent its own temporary name for the file. ^Whenever the +** xFilename parameter is NULL it will also be the case that the +** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE]. +** +** The flags argument to xOpen() includes all bits set in +** the flags argument to [sqlite3_open_v2()]. Or if [sqlite3_open()] +** or [sqlite3_open16()] is used, then flags includes at least +** [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]. +** If xOpen() opens a file read-only then it sets *pOutFlags to +** include [SQLITE_OPEN_READONLY]. Other bits in *pOutFlags may be set. +** +** ^(SQLite will also add one of the following flags to the xOpen() +** call, depending on the object being opened: +** +**
    +**
  • [SQLITE_OPEN_MAIN_DB] +**
  • [SQLITE_OPEN_MAIN_JOURNAL] +**
  • [SQLITE_OPEN_TEMP_DB] +**
  • [SQLITE_OPEN_TEMP_JOURNAL] +**
  • [SQLITE_OPEN_TRANSIENT_DB] +**
  • [SQLITE_OPEN_SUBJOURNAL] +**
  • [SQLITE_OPEN_MASTER_JOURNAL] +**
  • [SQLITE_OPEN_WAL] +**
)^ +** +** The file I/O implementation can use the object type flags to +** change the way it deals with files. For example, an application +** that does not care about crash recovery or rollback might make +** the open of a journal file a no-op. Writes to this journal would +** also be no-ops, and any attempt to read the journal would return +** SQLITE_IOERR. Or the implementation might recognize that a database +** file will be doing page-aligned sector reads and writes in a random +** order and set up its I/O subsystem accordingly. +** +** SQLite might also add one of the following flags to the xOpen method: +** +**
    +**
  • [SQLITE_OPEN_DELETEONCLOSE] +**
  • [SQLITE_OPEN_EXCLUSIVE] +**
+** +** The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be +** deleted when it is closed. ^The [SQLITE_OPEN_DELETEONCLOSE] +** will be set for TEMP databases and their journals, transient +** databases, and subjournals. +** +** ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction +** with the [SQLITE_OPEN_CREATE] flag, which are both directly +** analogous to the O_EXCL and O_CREAT flags of the POSIX open() +** API. The SQLITE_OPEN_EXCLUSIVE flag, when paired with the +** SQLITE_OPEN_CREATE, is used to indicate that file should always +** be created, and that it is an error if it already exists. +** It is not used to indicate the file should be opened +** for exclusive access. +** +** ^At least szOsFile bytes of memory are allocated by SQLite +** to hold the [sqlite3_file] structure passed as the third +** argument to xOpen. The xOpen method does not have to +** allocate the structure; it should just fill it in. Note that +** the xOpen method must set the sqlite3_file.pMethods to either +** a valid [sqlite3_io_methods] object or to NULL. xOpen must do +** this even if the open fails. SQLite expects that the sqlite3_file.pMethods +** element will be valid after xOpen returns regardless of the success +** or failure of the xOpen call. +** +** [[sqlite3_vfs.xAccess]] +** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS] +** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to +** test whether a file is readable and writable, or [SQLITE_ACCESS_READ] +** to test whether a file is at least readable. The file can be a +** directory. +** +** ^SQLite will always allocate at least mxPathname+1 bytes for the +** output buffer xFullPathname. The exact size of the output buffer +** is also passed as a parameter to both methods. If the output buffer +** is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is +** handled as a fatal error by SQLite, vfs implementations should endeavor +** to prevent this by setting mxPathname to a sufficiently large value. +** +** The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64() +** interfaces are not strictly a part of the filesystem, but they are +** included in the VFS structure for completeness. +** The xRandomness() function attempts to return nBytes bytes +** of good-quality randomness into zOut. The return value is +** the actual number of bytes of randomness obtained. +** The xSleep() method causes the calling thread to sleep for at +** least the number of microseconds given. ^The xCurrentTime() +** method returns a Julian Day Number for the current date and time as +** a floating point value. +** ^The xCurrentTimeInt64() method returns, as an integer, the Julian +** Day Number multiplied by 86400000 (the number of milliseconds in +** a 24-hour day). +** ^SQLite will use the xCurrentTimeInt64() method to get the current +** date and time if that method is available (if iVersion is 2 or +** greater and the function pointer is not NULL) and will fall back +** to xCurrentTime() if xCurrentTimeInt64() is unavailable. +** +** ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces +** are not used by the SQLite core. These optional interfaces are provided +** by some VFSes to facilitate testing of the VFS code. By overriding +** system calls with functions under its control, a test program can +** simulate faults and error conditions that would otherwise be difficult +** or impossible to induce. The set of system calls that can be overridden +** varies from one VFS to another, and from one version of the same VFS to the +** next. Applications that use these interfaces must be prepared for any +** or all of these interfaces to be NULL or for their behavior to change +** from one release to the next. Applications must not attempt to access +** any of these methods if the iVersion of the VFS is less than 3. +*/ +typedef struct sqlite3_vfs sqlite3_vfs; +typedef void (*sqlite3_syscall_ptr)(void); +struct sqlite3_vfs { + int iVersion; /* Structure version number (currently 3) */ + int szOsFile; /* Size of subclassed sqlite3_file */ + int mxPathname; /* Maximum file pathname length */ + sqlite3_vfs* pNext; /* Next registered VFS */ + const char* zName; /* Name of this virtual file system */ + void* pAppData; /* Pointer to application-specific data */ + int (*xOpen)( + sqlite3_vfs*, + const char* zName, + sqlite3_file*, + int flags, + int* pOutFlags); + int (*xDelete)(sqlite3_vfs*, const char* zName, int syncDir); + int (*xAccess)(sqlite3_vfs*, const char* zName, int flags, int* pResOut); + int (*xFullPathname)(sqlite3_vfs*, const char* zName, int nOut, char* zOut); + void* (*xDlOpen)(sqlite3_vfs*, const char* zFilename); + void (*xDlError)(sqlite3_vfs*, int nByte, char* zErrMsg); + void (*(*xDlSym)(sqlite3_vfs*, void*, const char* zSymbol))(void); + void (*xDlClose)(sqlite3_vfs*, void*); + int (*xRandomness)(sqlite3_vfs*, int nByte, char* zOut); + int (*xSleep)(sqlite3_vfs*, int microseconds); + int (*xCurrentTime)(sqlite3_vfs*, double*); + int (*xGetLastError)(sqlite3_vfs*, int, char*); + /* + ** The methods above are in version 1 of the sqlite_vfs object + ** definition. Those that follow are added in version 2 or later + */ + int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*); + /* + ** The methods above are in versions 1 and 2 of the sqlite_vfs object. + ** Those below are for version 3 and greater. + */ + int (*xSetSystemCall)(sqlite3_vfs*, const char* zName, sqlite3_syscall_ptr); + sqlite3_syscall_ptr (*xGetSystemCall)(sqlite3_vfs*, const char* zName); + const char* (*xNextSystemCall)(sqlite3_vfs*, const char* zName); + /* + ** The methods above are in versions 1 through 3 of the sqlite_vfs object. + ** New fields may be appended in future versions. The iVersion + ** value will increment whenever this happens. + */ +}; + +/* +** CAPI3REF: Flags for the xAccess VFS method +** +** These integer constants can be used as the third parameter to +** the xAccess method of an [sqlite3_vfs] object. They determine +** what kind of permissions the xAccess method is looking for. +** With SQLITE_ACCESS_EXISTS, the xAccess method +** simply checks whether the file exists. +** With SQLITE_ACCESS_READWRITE, the xAccess method +** checks whether the named directory is both readable and writable +** (in other words, if files can be added, removed, and renamed within +** the directory). +** The SQLITE_ACCESS_READWRITE constant is currently used only by the +** [temp_store_directory pragma], though this could change in a future +** release of SQLite. +** With SQLITE_ACCESS_READ, the xAccess method +** checks whether the file is readable. The SQLITE_ACCESS_READ constant is +** currently unused, though it might be used in a future release of +** SQLite. +*/ +#define SQLITE_ACCESS_EXISTS 0 +#define SQLITE_ACCESS_READWRITE 1 /* Used by PRAGMA temp_store_directory */ +#define SQLITE_ACCESS_READ 2 /* Unused */ + +/* +** CAPI3REF: Flags for the xShmLock VFS method +** +** These integer constants define the various locking operations +** allowed by the xShmLock method of [sqlite3_io_methods]. The +** following are the only legal combinations of flags to the +** xShmLock method: +** +**
    +**
  • SQLITE_SHM_LOCK | SQLITE_SHM_SHARED +**
  • SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE +**
  • SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED +**
  • SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE +**
+** +** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as +** was given on the corresponding lock. +** +** The xShmLock method can transition between unlocked and SHARED or +** between unlocked and EXCLUSIVE. It cannot transition between SHARED +** and EXCLUSIVE. +*/ +#define SQLITE_SHM_UNLOCK 1 +#define SQLITE_SHM_LOCK 2 +#define SQLITE_SHM_SHARED 4 +#define SQLITE_SHM_EXCLUSIVE 8 + +/* +** CAPI3REF: Maximum xShmLock index +** +** The xShmLock method on [sqlite3_io_methods] may use values +** between 0 and this upper bound as its "offset" argument. +** The SQLite core will never attempt to acquire or release a +** lock outside of this range +*/ +#define SQLITE_SHM_NLOCK 8 + +/* +** CAPI3REF: Initialize The SQLite Library +** +** ^The sqlite3_initialize() routine initializes the +** SQLite library. ^The sqlite3_shutdown() routine +** deallocates any resources that were allocated by sqlite3_initialize(). +** These routines are designed to aid in process initialization and +** shutdown on embedded systems. Workstation applications using +** SQLite normally do not need to invoke either of these routines. +** +** A call to sqlite3_initialize() is an "effective" call if it is +** the first time sqlite3_initialize() is invoked during the lifetime of +** the process, or if it is the first time sqlite3_initialize() is invoked +** following a call to sqlite3_shutdown(). ^(Only an effective call +** of sqlite3_initialize() does any initialization. All other calls +** are harmless no-ops.)^ +** +** A call to sqlite3_shutdown() is an "effective" call if it is the first +** call to sqlite3_shutdown() since the last sqlite3_initialize(). ^(Only +** an effective call to sqlite3_shutdown() does any deinitialization. +** All other valid calls to sqlite3_shutdown() are harmless no-ops.)^ +** +** The sqlite3_initialize() interface is threadsafe, but sqlite3_shutdown() +** is not. The sqlite3_shutdown() interface must only be called from a +** single thread. All open [database connections] must be closed and all +** other SQLite resources must be deallocated prior to invoking +** sqlite3_shutdown(). +** +** Among other things, ^sqlite3_initialize() will invoke +** sqlite3_os_init(). Similarly, ^sqlite3_shutdown() +** will invoke sqlite3_os_end(). +** +** ^The sqlite3_initialize() routine returns [SQLITE_OK] on success. +** ^If for some reason, sqlite3_initialize() is unable to initialize +** the library (perhaps it is unable to allocate a needed resource such +** as a mutex) it returns an [error code] other than [SQLITE_OK]. +** +** ^The sqlite3_initialize() routine is called internally by many other +** SQLite interfaces so that an application usually does not need to +** invoke sqlite3_initialize() directly. For example, [sqlite3_open()] +** calls sqlite3_initialize() so the SQLite library will be automatically +** initialized when [sqlite3_open()] is called if it has not be initialized +** already. ^However, if SQLite is compiled with the [SQLITE_OMIT_AUTOINIT] +** compile-time option, then the automatic calls to sqlite3_initialize() +** are omitted and the application must call sqlite3_initialize() directly +** prior to using any other SQLite interface. For maximum portability, +** it is recommended that applications always invoke sqlite3_initialize() +** directly prior to using any other SQLite interface. Future releases +** of SQLite may require this. In other words, the behavior exhibited +** when SQLite is compiled with [SQLITE_OMIT_AUTOINIT] might become the +** default behavior in some future release of SQLite. +** +** The sqlite3_os_init() routine does operating-system specific +** initialization of the SQLite library. The sqlite3_os_end() +** routine undoes the effect of sqlite3_os_init(). Typical tasks +** performed by these routines include allocation or deallocation +** of static resources, initialization of global variables, +** setting up a default [sqlite3_vfs] module, or setting up +** a default configuration using [sqlite3_config()]. +** +** The application should never invoke either sqlite3_os_init() +** or sqlite3_os_end() directly. The application should only invoke +** sqlite3_initialize() and sqlite3_shutdown(). The sqlite3_os_init() +** interface is called automatically by sqlite3_initialize() and +** sqlite3_os_end() is called by sqlite3_shutdown(). Appropriate +** implementations for sqlite3_os_init() and sqlite3_os_end() +** are built into SQLite when it is compiled for Unix, Windows, or OS/2. +** When [custom builds | built for other platforms] +** (using the [SQLITE_OS_OTHER=1] compile-time +** option) the application must supply a suitable implementation for +** sqlite3_os_init() and sqlite3_os_end(). An application-supplied +** implementation of sqlite3_os_init() or sqlite3_os_end() +** must return [SQLITE_OK] on success and some other [error code] upon +** failure. +*/ +SQLITE_API int sqlite3_initialize(void); +SQLITE_API int sqlite3_shutdown(void); +SQLITE_API int sqlite3_os_init(void); +SQLITE_API int sqlite3_os_end(void); + +/* +** CAPI3REF: Configuring The SQLite Library +** +** The sqlite3_config() interface is used to make global configuration +** changes to SQLite in order to tune SQLite to the specific needs of +** the application. The default configuration is recommended for most +** applications and so this routine is usually not necessary. It is +** provided to support rare applications with unusual needs. +** +** The sqlite3_config() interface is not threadsafe. The application +** must ensure that no other SQLite interfaces are invoked by other +** threads while sqlite3_config() is running. +** +** The sqlite3_config() interface +** may only be invoked prior to library initialization using +** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()]. +** ^If sqlite3_config() is called after [sqlite3_initialize()] and before +** [sqlite3_shutdown()] then it will return SQLITE_MISUSE. +** Note, however, that ^sqlite3_config() can be called as part of the +** implementation of an application-defined [sqlite3_os_init()]. +** +** The first argument to sqlite3_config() is an integer +** [configuration option] that determines +** what property of SQLite is to be configured. Subsequent arguments +** vary depending on the [configuration option] +** in the first argument. +** +** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK]. +** ^If the option is unknown or SQLite is unable to set the option +** then this routine returns a non-zero [error code]. +*/ +SQLITE_API int sqlite3_config(int, ...); + +/* +** CAPI3REF: Configure database connections +** METHOD: sqlite3 +** +** The sqlite3_db_config() interface is used to make configuration +** changes to a [database connection]. The interface is similar to +** [sqlite3_config()] except that the changes apply to a single +** [database connection] (specified in the first argument). +** +** The second argument to sqlite3_db_config(D,V,...) is the +** [SQLITE_DBCONFIG_LOOKASIDE | configuration verb] - an integer code +** that indicates what aspect of the [database connection] is being configured. +** Subsequent arguments vary depending on the configuration verb. +** +** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if +** the call is considered successful. +*/ +SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...); + +/* +** CAPI3REF: Memory Allocation Routines +** +** An instance of this object defines the interface between SQLite +** and low-level memory allocation routines. +** +** This object is used in only one place in the SQLite interface. +** A pointer to an instance of this object is the argument to +** [sqlite3_config()] when the configuration option is +** [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC]. +** By creating an instance of this object +** and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC]) +** during configuration, an application can specify an alternative +** memory allocation subsystem for SQLite to use for all of its +** dynamic memory needs. +** +** Note that SQLite comes with several [built-in memory allocators] +** that are perfectly adequate for the overwhelming majority of applications +** and that this object is only useful to a tiny minority of applications +** with specialized memory allocation requirements. This object is +** also used during testing of SQLite in order to specify an alternative +** memory allocator that simulates memory out-of-memory conditions in +** order to verify that SQLite recovers gracefully from such +** conditions. +** +** The xMalloc, xRealloc, and xFree methods must work like the +** malloc(), realloc() and free() functions from the standard C library. +** ^SQLite guarantees that the second argument to +** xRealloc is always a value returned by a prior call to xRoundup. +** +** xSize should return the allocated size of a memory allocation +** previously obtained from xMalloc or xRealloc. The allocated size +** is always at least as big as the requested size but may be larger. +** +** The xRoundup method returns what would be the allocated size of +** a memory allocation given a particular requested size. Most memory +** allocators round up memory allocations at least to the next multiple +** of 8. Some allocators round up to a larger multiple or to a power of 2. +** Every memory allocation request coming in through [sqlite3_malloc()] +** or [sqlite3_realloc()] first calls xRoundup. If xRoundup returns 0, +** that causes the corresponding memory allocation to fail. +** +** The xInit method initializes the memory allocator. For example, +** it might allocate any require mutexes or initialize internal data +** structures. The xShutdown method is invoked (indirectly) by +** [sqlite3_shutdown()] and should deallocate any resources acquired +** by xInit. The pAppData pointer is used as the only parameter to +** xInit and xShutdown. +** +** SQLite holds the [SQLITE_MUTEX_STATIC_MASTER] mutex when it invokes +** the xInit method, so the xInit method need not be threadsafe. The +** xShutdown method is only called from [sqlite3_shutdown()] so it does +** not need to be threadsafe either. For all other methods, SQLite +** holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the +** [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which +** it is by default) and so the methods are automatically serialized. +** However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other +** methods must be threadsafe or else make their own arrangements for +** serialization. +** +** SQLite will never invoke xInit() more than once without an intervening +** call to xShutdown(). +*/ +typedef struct sqlite3_mem_methods sqlite3_mem_methods; +struct sqlite3_mem_methods { + void* (*xMalloc)(int); /* Memory allocation function */ + void (*xFree)(void*); /* Free a prior allocation */ + void* (*xRealloc)(void*, int); /* Resize an allocation */ + int (*xSize)(void*); /* Return the size of an allocation */ + int (*xRoundup)(int); /* Round up request size to allocation size */ + int (*xInit)(void*); /* Initialize the memory allocator */ + void (*xShutdown)(void*); /* Deinitialize the memory allocator */ + void* pAppData; /* Argument to xInit() and xShutdown() */ +}; + +/* +** CAPI3REF: Configuration Options +** KEYWORDS: {configuration option} +** +** These constants are the available integer configuration options that +** can be passed as the first argument to the [sqlite3_config()] interface. +** +** New configuration options may be added in future releases of SQLite. +** Existing configuration options might be discontinued. Applications +** should check the return code from [sqlite3_config()] to make sure that +** the call worked. The [sqlite3_config()] interface will return a +** non-zero [error code] if a discontinued or unsupported configuration option +** is invoked. +** +**
+** [[SQLITE_CONFIG_SINGLETHREAD]]
SQLITE_CONFIG_SINGLETHREAD
+**
There are no arguments to this option. ^This option sets the +** [threading mode] to Single-thread. In other words, it disables +** all mutexing and puts SQLite into a mode where it can only be used +** by a single thread. ^If SQLite is compiled with +** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then +** it is not possible to change the [threading mode] from its default +** value of Single-thread and so [sqlite3_config()] will return +** [SQLITE_ERROR] if called with the SQLITE_CONFIG_SINGLETHREAD +** configuration option.
+** +** [[SQLITE_CONFIG_MULTITHREAD]]
SQLITE_CONFIG_MULTITHREAD
+**
There are no arguments to this option. ^This option sets the +** [threading mode] to Multi-thread. In other words, it disables +** mutexing on [database connection] and [prepared statement] objects. +** The application is responsible for serializing access to +** [database connections] and [prepared statements]. But other mutexes +** are enabled so that SQLite will be safe to use in a multi-threaded +** environment as long as no two threads attempt to use the same +** [database connection] at the same time. ^If SQLite is compiled with +** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then +** it is not possible to set the Multi-thread [threading mode] and +** [sqlite3_config()] will return [SQLITE_ERROR] if called with the +** SQLITE_CONFIG_MULTITHREAD configuration option.
+** +** [[SQLITE_CONFIG_SERIALIZED]]
SQLITE_CONFIG_SERIALIZED
+**
There are no arguments to this option. ^This option sets the +** [threading mode] to Serialized. In other words, this option enables +** all mutexes including the recursive +** mutexes on [database connection] and [prepared statement] objects. +** In this mode (which is the default when SQLite is compiled with +** [SQLITE_THREADSAFE=1]) the SQLite library will itself serialize access +** to [database connections] and [prepared statements] so that the +** application is free to use the same [database connection] or the +** same [prepared statement] in different threads at the same time. +** ^If SQLite is compiled with +** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then +** it is not possible to set the Serialized [threading mode] and +** [sqlite3_config()] will return [SQLITE_ERROR] if called with the +** SQLITE_CONFIG_SERIALIZED configuration option.
+** +** [[SQLITE_CONFIG_MALLOC]]
SQLITE_CONFIG_MALLOC
+**
^(The SQLITE_CONFIG_MALLOC option takes a single argument which is +** a pointer to an instance of the [sqlite3_mem_methods] structure. +** The argument specifies +** alternative low-level memory allocation routines to be used in place of +** the memory allocation routines built into SQLite.)^ ^SQLite makes +** its own private copy of the content of the [sqlite3_mem_methods] structure +** before the [sqlite3_config()] call returns.
+** +** [[SQLITE_CONFIG_GETMALLOC]]
SQLITE_CONFIG_GETMALLOC
+**
^(The SQLITE_CONFIG_GETMALLOC option takes a single argument which +** is a pointer to an instance of the [sqlite3_mem_methods] structure. +** The [sqlite3_mem_methods] +** structure is filled with the currently defined memory allocation routines.)^ +** This option can be used to overload the default memory allocation +** routines with a wrapper that simulations memory allocation failure or +** tracks memory usage, for example.
+** +** [[SQLITE_CONFIG_SMALL_MALLOC]]
SQLITE_CONFIG_SMALL_MALLOC
+**
^The SQLITE_CONFIG_SMALL_MALLOC option takes single argument of +** type int, interpreted as a boolean, which if true provides a hint to +** SQLite that it should avoid large memory allocations if possible. +** SQLite will run faster if it is free to make large memory allocations, +** but some application might prefer to run slower in exchange for +** guarantees about memory fragmentation that are possible if large +** allocations are avoided. This hint is normally off. +**
+** +** [[SQLITE_CONFIG_MEMSTATUS]]
SQLITE_CONFIG_MEMSTATUS
+**
^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int, +** interpreted as a boolean, which enables or disables the collection of +** memory allocation statistics. ^(When memory allocation statistics are +** disabled, the following SQLite interfaces become non-operational: +**
    +**
  • [sqlite3_memory_used()] +**
  • [sqlite3_memory_highwater()] +**
  • [sqlite3_soft_heap_limit64()] +**
  • [sqlite3_status64()] +**
)^ +** ^Memory allocation statistics are enabled by default unless SQLite is +** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory +** allocation statistics are disabled by default. +**
+** +** [[SQLITE_CONFIG_SCRATCH]]
SQLITE_CONFIG_SCRATCH
+**
The SQLITE_CONFIG_SCRATCH option is no longer used. +**
+** +** [[SQLITE_CONFIG_PAGECACHE]]
SQLITE_CONFIG_PAGECACHE
+**
^The SQLITE_CONFIG_PAGECACHE option specifies a memory pool +** that SQLite can use for the database page cache with the default page +** cache implementation. +** This configuration option is a no-op if an application-define page +** cache implementation is loaded using the [SQLITE_CONFIG_PCACHE2]. +** ^There are three arguments to SQLITE_CONFIG_PAGECACHE: A pointer to +** 8-byte aligned memory (pMem), the size of each page cache line (sz), +** and the number of cache lines (N). +** The sz argument should be the size of the largest database page +** (a power of two between 512 and 65536) plus some extra bytes for each +** page header. ^The number of extra bytes needed by the page header +** can be determined using [SQLITE_CONFIG_PCACHE_HDRSZ]. +** ^It is harmless, apart from the wasted memory, +** for the sz parameter to be larger than necessary. The pMem +** argument must be either a NULL pointer or a pointer to an 8-byte +** aligned block of memory of at least sz*N bytes, otherwise +** subsequent behavior is undefined. +** ^When pMem is not NULL, SQLite will strive to use the memory provided +** to satisfy page cache needs, falling back to [sqlite3_malloc()] if +** a page cache line is larger than sz bytes or if all of the pMem buffer +** is exhausted. +** ^If pMem is NULL and N is non-zero, then each database connection +** does an initial bulk allocation for page cache memory +** from [sqlite3_malloc()] sufficient for N cache lines if N is positive or +** of -1024*N bytes if N is negative, . ^If additional +** page cache memory is needed beyond what is provided by the initial +** allocation, then SQLite goes to [sqlite3_malloc()] separately for each +** additional cache line.
+** +** [[SQLITE_CONFIG_HEAP]]
SQLITE_CONFIG_HEAP
+**
^The SQLITE_CONFIG_HEAP option specifies a static memory buffer +** that SQLite will use for all of its dynamic memory allocation needs +** beyond those provided for by [SQLITE_CONFIG_PAGECACHE]. +** ^The SQLITE_CONFIG_HEAP option is only available if SQLite is compiled +** with either [SQLITE_ENABLE_MEMSYS3] or [SQLITE_ENABLE_MEMSYS5] and returns +** [SQLITE_ERROR] if invoked otherwise. +** ^There are three arguments to SQLITE_CONFIG_HEAP: +** An 8-byte aligned pointer to the memory, +** the number of bytes in the memory buffer, and the minimum allocation size. +** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts +** to using its default memory allocator (the system malloc() implementation), +** undoing any prior invocation of [SQLITE_CONFIG_MALLOC]. ^If the +** memory pointer is not NULL then the alternative memory +** allocator is engaged to handle all of SQLites memory allocation needs. +** The first pointer (the memory pointer) must be aligned to an 8-byte +** boundary or subsequent behavior of SQLite will be undefined. +** The minimum allocation size is capped at 2**12. Reasonable values +** for the minimum allocation size are 2**5 through 2**8.
+** +** [[SQLITE_CONFIG_MUTEX]]
SQLITE_CONFIG_MUTEX
+**
^(The SQLITE_CONFIG_MUTEX option takes a single argument which is a +** pointer to an instance of the [sqlite3_mutex_methods] structure. +** The argument specifies alternative low-level mutex routines to be used +** in place the mutex routines built into SQLite.)^ ^SQLite makes a copy of +** the content of the [sqlite3_mutex_methods] structure before the call to +** [sqlite3_config()] returns. ^If SQLite is compiled with +** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then +** the entire mutexing subsystem is omitted from the build and hence calls to +** [sqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will +** return [SQLITE_ERROR].
+** +** [[SQLITE_CONFIG_GETMUTEX]]
SQLITE_CONFIG_GETMUTEX
+**
^(The SQLITE_CONFIG_GETMUTEX option takes a single argument which +** is a pointer to an instance of the [sqlite3_mutex_methods] structure. The +** [sqlite3_mutex_methods] +** structure is filled with the currently defined mutex routines.)^ +** This option can be used to overload the default mutex allocation +** routines with a wrapper used to track mutex usage for performance +** profiling or testing, for example. ^If SQLite is compiled with +** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then +** the entire mutexing subsystem is omitted from the build and hence calls to +** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will +** return [SQLITE_ERROR].
+** +** [[SQLITE_CONFIG_LOOKASIDE]]
SQLITE_CONFIG_LOOKASIDE
+**
^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine +** the default size of lookaside memory on each [database connection]. +** The first argument is the +** size of each lookaside buffer slot and the second is the number of +** slots allocated to each database connection.)^ ^(SQLITE_CONFIG_LOOKASIDE +** sets the default lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE] +** option to [sqlite3_db_config()] can be used to change the lookaside +** configuration on individual connections.)^
+** +** [[SQLITE_CONFIG_PCACHE2]]
SQLITE_CONFIG_PCACHE2
+**
^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is +** a pointer to an [sqlite3_pcache_methods2] object. This object specifies +** the interface to a custom page cache implementation.)^ +** ^SQLite makes a copy of the [sqlite3_pcache_methods2] object.
+** +** [[SQLITE_CONFIG_GETPCACHE2]]
SQLITE_CONFIG_GETPCACHE2
+**
^(The SQLITE_CONFIG_GETPCACHE2 option takes a single argument which +** is a pointer to an [sqlite3_pcache_methods2] object. SQLite copies of +** the current page cache implementation into that object.)^
+** +** [[SQLITE_CONFIG_LOG]]
SQLITE_CONFIG_LOG
+**
The SQLITE_CONFIG_LOG option is used to configure the SQLite +** global [error log]. +** (^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a +** function with a call signature of void(*)(void*,int,const char*), +** and a pointer to void. ^If the function pointer is not NULL, it is +** invoked by [sqlite3_log()] to process each logging event. ^If the +** function pointer is NULL, the [sqlite3_log()] interface becomes a no-op. +** ^The void pointer that is the second argument to SQLITE_CONFIG_LOG is +** passed through as the first parameter to the application-defined logger +** function whenever that function is invoked. ^The second parameter to +** the logger function is a copy of the first parameter to the corresponding +** [sqlite3_log()] call and is intended to be a [result code] or an +** [extended result code]. ^The third parameter passed to the logger is +** log message after formatting via [sqlite3_snprintf()]. +** The SQLite logging interface is not reentrant; the logger function +** supplied by the application must not invoke any SQLite interface. +** In a multi-threaded application, the application-defined logger +** function must be threadsafe.
+** +** [[SQLITE_CONFIG_URI]]
SQLITE_CONFIG_URI +**
^(The SQLITE_CONFIG_URI option takes a single argument of type int. +** If non-zero, then URI handling is globally enabled. If the parameter is zero, +** then URI handling is globally disabled.)^ ^If URI handling is globally +** enabled, all filenames passed to [sqlite3_open()], [sqlite3_open_v2()], +** [sqlite3_open16()] or +** specified as part of [ATTACH] commands are interpreted as URIs, regardless +** of whether or not the [SQLITE_OPEN_URI] flag is set when the database +** connection is opened. ^If it is globally disabled, filenames are +** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the +** database connection is opened. ^(By default, URI handling is globally +** disabled. The default value may be changed by compiling with the +** [SQLITE_USE_URI] symbol defined.)^ +** +** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]]
SQLITE_CONFIG_COVERING_INDEX_SCAN +**
^The SQLITE_CONFIG_COVERING_INDEX_SCAN option takes a single integer +** argument which is interpreted as a boolean in order to enable or disable +** the use of covering indices for full table scans in the query optimizer. +** ^The default setting is determined +** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on" +** if that compile-time option is omitted. +** The ability to disable the use of covering indices for full table scans +** is because some incorrectly coded legacy applications might malfunction +** when the optimization is enabled. Providing the ability to +** disable the optimization allows the older, buggy application code to work +** without change even with newer versions of SQLite. +** +** [[SQLITE_CONFIG_PCACHE]] [[SQLITE_CONFIG_GETPCACHE]] +**
SQLITE_CONFIG_PCACHE and SQLITE_CONFIG_GETPCACHE +**
These options are obsolete and should not be used by new code. +** They are retained for backwards compatibility but are now no-ops. +**
+** +** [[SQLITE_CONFIG_SQLLOG]] +**
SQLITE_CONFIG_SQLLOG +**
This option is only available if sqlite is compiled with the +** [SQLITE_ENABLE_SQLLOG] pre-processor macro defined. The first argument should +** be a pointer to a function of type void(*)(void*,sqlite3*,const char*, int). +** The second should be of type (void*). The callback is invoked by the library +** in three separate circumstances, identified by the value passed as the +** fourth parameter. If the fourth parameter is 0, then the database connection +** passed as the second argument has just been opened. The third argument +** points to a buffer containing the name of the main database file. If the +** fourth parameter is 1, then the SQL statement that the third parameter +** points to has just been executed. Or, if the fourth parameter is 2, then +** the connection being passed as the second parameter is being closed. The +** third parameter is passed NULL In this case. An example of using this +** configuration option can be seen in the "test_sqllog.c" source file in +** the canonical SQLite source tree.
+** +** [[SQLITE_CONFIG_MMAP_SIZE]] +**
SQLITE_CONFIG_MMAP_SIZE +**
^SQLITE_CONFIG_MMAP_SIZE takes two 64-bit integer (sqlite3_int64) values +** that are the default mmap size limit (the default setting for +** [PRAGMA mmap_size]) and the maximum allowed mmap size limit. +** ^The default setting can be overridden by each database connection using +** either the [PRAGMA mmap_size] command, or by using the +** [SQLITE_FCNTL_MMAP_SIZE] file control. ^(The maximum allowed mmap size +** will be silently truncated if necessary so that it does not exceed the +** compile-time maximum mmap size set by the +** [SQLITE_MAX_MMAP_SIZE] compile-time option.)^ +** ^If either argument to this option is negative, then that argument is +** changed to its compile-time default. +** +** [[SQLITE_CONFIG_WIN32_HEAPSIZE]] +**
SQLITE_CONFIG_WIN32_HEAPSIZE +**
^The SQLITE_CONFIG_WIN32_HEAPSIZE option is only available if SQLite is +** compiled for Windows with the [SQLITE_WIN32_MALLOC] pre-processor macro +** defined. ^SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value +** that specifies the maximum size of the created heap. +** +** [[SQLITE_CONFIG_PCACHE_HDRSZ]] +**
SQLITE_CONFIG_PCACHE_HDRSZ +**
^The SQLITE_CONFIG_PCACHE_HDRSZ option takes a single parameter which +** is a pointer to an integer and writes into that integer the number of extra +** bytes per page required for each page in [SQLITE_CONFIG_PAGECACHE]. +** The amount of extra space required can change depending on the compiler, +** target platform, and SQLite version. +** +** [[SQLITE_CONFIG_PMASZ]] +**
SQLITE_CONFIG_PMASZ +**
^The SQLITE_CONFIG_PMASZ option takes a single parameter which +** is an unsigned integer and sets the "Minimum PMA Size" for the multithreaded +** sorter to that integer. The default minimum PMA Size is set by the +** [SQLITE_SORTER_PMASZ] compile-time option. New threads are launched +** to help with sort operations when multithreaded sorting +** is enabled (using the [PRAGMA threads] command) and the amount of content +** to be sorted exceeds the page size times the minimum of the +** [PRAGMA cache_size] setting and this value. +** +** [[SQLITE_CONFIG_STMTJRNL_SPILL]] +**
SQLITE_CONFIG_STMTJRNL_SPILL +**
^The SQLITE_CONFIG_STMTJRNL_SPILL option takes a single parameter which +** becomes the [statement journal] spill-to-disk threshold. +** [Statement journals] are held in memory until their size (in bytes) +** exceeds this threshold, at which point they are written to disk. +** Or if the threshold is -1, statement journals are always held +** exclusively in memory. +** Since many statement journals never become large, setting the spill +** threshold to a value such as 64KiB can greatly reduce the amount of +** I/O required to support statement rollback. +** The default value for this setting is controlled by the +** [SQLITE_STMTJRNL_SPILL] compile-time option. +**
+*/ +#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ +#define SQLITE_CONFIG_MULTITHREAD 2 /* nil */ +#define SQLITE_CONFIG_SERIALIZED 3 /* nil */ +#define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */ +#define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */ +#define SQLITE_CONFIG_SCRATCH 6 /* No longer used */ +#define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */ +#define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */ +#define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */ +#define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */ +#define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */ +/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */ +#define SQLITE_CONFIG_LOOKASIDE 13 /* int int */ +#define SQLITE_CONFIG_PCACHE 14 /* no-op */ +#define SQLITE_CONFIG_GETPCACHE 15 /* no-op */ +#define SQLITE_CONFIG_LOG 16 /* xFunc, void* */ +#define SQLITE_CONFIG_URI 17 /* int */ +#define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */ +#define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */ +#define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */ +#define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */ +#define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */ +#define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */ +#define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */ +#define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */ +#define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */ +#define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */ + +/* +** CAPI3REF: Database Connection Configuration Options +** +** These constants are the available integer configuration options that +** can be passed as the second argument to the [sqlite3_db_config()] interface. +** +** New configuration options may be added in future releases of SQLite. +** Existing configuration options might be discontinued. Applications +** should check the return code from [sqlite3_db_config()] to make sure that +** the call worked. ^The [sqlite3_db_config()] interface will return a +** non-zero [error code] if a discontinued or unsupported configuration option +** is invoked. +** +**
+**
SQLITE_DBCONFIG_LOOKASIDE
+**
^This option takes three additional arguments that determine the +** [lookaside memory allocator] configuration for the [database connection]. +** ^The first argument (the third parameter to [sqlite3_db_config()] is a +** pointer to a memory buffer to use for lookaside memory. +** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb +** may be NULL in which case SQLite will allocate the +** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the +** size of each lookaside buffer slot. ^The third argument is the number of +** slots. The size of the buffer in the first argument must be greater than +** or equal to the product of the second and third arguments. The buffer +** must be aligned to an 8-byte boundary. ^If the second argument to +** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally +** rounded down to the next smaller multiple of 8. ^(The lookaside memory +** configuration for a database connection can only be changed when that +** connection is not currently using lookaside memory, or in other words +** when the "current value" returned by +** [sqlite3_db_status](D,[SQLITE_CONFIG_LOOKASIDE],...) is zero. +** Any attempt to change the lookaside memory configuration when lookaside +** memory is in use leaves the configuration unchanged and returns +** [SQLITE_BUSY].)^
+** +**
SQLITE_DBCONFIG_ENABLE_FKEY
+**
^This option is used to enable or disable the enforcement of +** [foreign key constraints]. There should be two additional arguments. +** The first argument is an integer which is 0 to disable FK enforcement, +** positive to enable FK enforcement or negative to leave FK enforcement +** unchanged. The second parameter is a pointer to an integer into which +** is written 0 or 1 to indicate whether FK enforcement is off or on +** following this call. The second parameter may be a NULL pointer, in +** which case the FK enforcement setting is not reported back.
+** +**
SQLITE_DBCONFIG_ENABLE_TRIGGER
+**
^This option is used to enable or disable [CREATE TRIGGER | triggers]. +** There should be two additional arguments. +** The first argument is an integer which is 0 to disable triggers, +** positive to enable triggers or negative to leave the setting unchanged. +** The second parameter is a pointer to an integer into which +** is written 0 or 1 to indicate whether triggers are disabled or enabled +** following this call. The second parameter may be a NULL pointer, in +** which case the trigger setting is not reported back.
+** +**
SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER
+**
^This option is used to enable or disable the two-argument +** version of the [fts3_tokenizer()] function which is part of the +** [FTS3] full-text search engine extension. +** There should be two additional arguments. +** The first argument is an integer which is 0 to disable fts3_tokenizer() or +** positive to enable fts3_tokenizer() or negative to leave the setting +** unchanged. +** The second parameter is a pointer to an integer into which +** is written 0 or 1 to indicate whether fts3_tokenizer is disabled or enabled +** following this call. The second parameter may be a NULL pointer, in +** which case the new setting is not reported back.
+** +**
SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION
+**
^This option is used to enable or disable the [sqlite3_load_extension()] +** interface independently of the [load_extension()] SQL function. +** The [sqlite3_enable_load_extension()] API enables or disables both the +** C-API [sqlite3_load_extension()] and the SQL function [load_extension()]. +** There should be two additional arguments. +** When the first argument to this interface is 1, then only the C-API is +** enabled and the SQL function remains disabled. If the first argument to +** this interface is 0, then both the C-API and the SQL function are disabled. +** If the first argument is -1, then no changes are made to state of either the +** C-API or the SQL function. +** The second parameter is a pointer to an integer into which +** is written 0 or 1 to indicate whether [sqlite3_load_extension()] interface +** is disabled or enabled following this call. The second parameter may +** be a NULL pointer, in which case the new setting is not reported back. +**
+** +**
SQLITE_DBCONFIG_MAINDBNAME
+**
^This option is used to change the name of the "main" database +** schema. ^The sole argument is a pointer to a constant UTF8 string +** which will become the new schema name in place of "main". ^SQLite +** does not make a copy of the new main schema name string, so the application +** must ensure that the argument passed into this DBCONFIG option is unchanged +** until after the database connection closes. +**
+** +**
SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE
+**
Usually, when a database in wal mode is closed or detached from a +** database handle, SQLite checks if this will mean that there are now no +** connections at all to the database. If so, it performs a checkpoint +** operation before closing the connection. This option may be used to +** override this behaviour. The first parameter passed to this operation +** is an integer - positive to disable checkpoints-on-close, or zero (the +** default) to enable them, and negative to leave the setting unchanged. +** The second parameter is a pointer to an integer +** into which is written 0 or 1 to indicate whether checkpoints-on-close +** have been disabled - 0 if they are not disabled, 1 if they are. +**
+** +**
SQLITE_DBCONFIG_ENABLE_QPSG
+**
^(The SQLITE_DBCONFIG_ENABLE_QPSG option activates or deactivates +** the [query planner stability guarantee] (QPSG). When the QPSG is active, +** a single SQL query statement will always use the same algorithm regardless +** of values of [bound parameters].)^ The QPSG disables some query optimizations +** that look at the values of bound parameters, which can make some queries +** slower. But the QPSG has the advantage of more predictable behavior. With +** the QPSG active, SQLite will always use the same query plan in the field as +** was used during testing in the lab. +** The first argument to this setting is an integer which is 0 to disable +** the QPSG, positive to enable QPSG, or negative to leave the setting +** unchanged. The second parameter is a pointer to an integer into which +** is written 0 or 1 to indicate whether the QPSG is disabled or enabled +** following this call. +**
+** +**
SQLITE_DBCONFIG_TRIGGER_EQP
+**
By default, the output of EXPLAIN QUERY PLAN commands does not +** include output for any operations performed by trigger programs. This +** option is used to set or clear (the default) a flag that governs this +** behavior. The first parameter passed to this operation is an integer - +** positive to enable output for trigger programs, or zero to disable it, +** or negative to leave the setting unchanged. +** The second parameter is a pointer to an integer into which is written +** 0 or 1 to indicate whether output-for-triggers has been disabled - 0 if +** it is not disabled, 1 if it is. +**
+**
+*/ +#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */ +#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ +#define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ +#define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */ +#define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */ +#define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */ +#define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 /* int int* */ +#define SQLITE_DBCONFIG_ENABLE_QPSG 1007 /* int int* */ +#define SQLITE_DBCONFIG_TRIGGER_EQP 1008 /* int int* */ +#define SQLITE_DBCONFIG_MAX 1008 /* Largest DBCONFIG */ + +/* +** CAPI3REF: Enable Or Disable Extended Result Codes +** METHOD: sqlite3 +** +** ^The sqlite3_extended_result_codes() routine enables or disables the +** [extended result codes] feature of SQLite. ^The extended result +** codes are disabled by default for historical compatibility. +*/ +SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff); + +/* +** CAPI3REF: Last Insert Rowid +** METHOD: sqlite3 +** +** ^Each entry in most SQLite tables (except for [WITHOUT ROWID] tables) +** has a unique 64-bit signed +** integer key called the [ROWID | "rowid"]. ^The rowid is always available +** as an undeclared column named ROWID, OID, or _ROWID_ as long as those +** names are not also used by explicitly declared columns. ^If +** the table has a column of type [INTEGER PRIMARY KEY] then that column +** is another alias for the rowid. +** +** ^The sqlite3_last_insert_rowid(D) interface usually returns the [rowid] of +** the most recent successful [INSERT] into a rowid table or [virtual table] +** on database connection D. ^Inserts into [WITHOUT ROWID] tables are not +** recorded. ^If no successful [INSERT]s into rowid tables have ever occurred +** on the database connection D, then sqlite3_last_insert_rowid(D) returns +** zero. +** +** As well as being set automatically as rows are inserted into database +** tables, the value returned by this function may be set explicitly by +** [sqlite3_set_last_insert_rowid()] +** +** Some virtual table implementations may INSERT rows into rowid tables as +** part of committing a transaction (e.g. to flush data accumulated in memory +** to disk). In this case subsequent calls to this function return the rowid +** associated with these internal INSERT operations, which leads to +** unintuitive results. Virtual table implementations that do write to rowid +** tables in this way can avoid this problem by restoring the original +** rowid value using [sqlite3_set_last_insert_rowid()] before returning +** control to the user. +** +** ^(If an [INSERT] occurs within a trigger then this routine will +** return the [rowid] of the inserted row as long as the trigger is +** running. Once the trigger program ends, the value returned +** by this routine reverts to what it was before the trigger was fired.)^ +** +** ^An [INSERT] that fails due to a constraint violation is not a +** successful [INSERT] and does not change the value returned by this +** routine. ^Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK, +** and INSERT OR ABORT make no changes to the return value of this +** routine when their insertion fails. ^(When INSERT OR REPLACE +** encounters a constraint violation, it does not fail. The +** INSERT continues to completion after deleting rows that caused +** the constraint problem so INSERT OR REPLACE will always change +** the return value of this interface.)^ +** +** ^For the purposes of this routine, an [INSERT] is considered to +** be successful even if it is subsequently rolled back. +** +** This function is accessible to SQL statements via the +** [last_insert_rowid() SQL function]. +** +** If a separate thread performs a new [INSERT] on the same +** database connection while the [sqlite3_last_insert_rowid()] +** function is running and thus changes the last insert [rowid], +** then the value returned by [sqlite3_last_insert_rowid()] is +** unpredictable and might not equal either the old or the new +** last insert [rowid]. +*/ +SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*); + +/* +** CAPI3REF: Set the Last Insert Rowid value. +** METHOD: sqlite3 +** +** The sqlite3_set_last_insert_rowid(D, R) method allows the application to +** set the value returned by calling sqlite3_last_insert_rowid(D) to R +** without inserting a row into the database. +*/ +SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3*, sqlite3_int64); + +/* +** CAPI3REF: Count The Number Of Rows Modified +** METHOD: sqlite3 +** +** ^This function returns the number of rows modified, inserted or +** deleted by the most recently completed INSERT, UPDATE or DELETE +** statement on the database connection specified by the only parameter. +** ^Executing any other type of SQL statement does not modify the value +** returned by this function. +** +** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are +** considered - auxiliary changes caused by [CREATE TRIGGER | triggers], +** [foreign key actions] or [REPLACE] constraint resolution are not counted. +** +** Changes to a view that are intercepted by +** [INSTEAD OF trigger | INSTEAD OF triggers] are not counted. ^The value +** returned by sqlite3_changes() immediately after an INSERT, UPDATE or +** DELETE statement run on a view is always zero. Only changes made to real +** tables are counted. +** +** Things are more complicated if the sqlite3_changes() function is +** executed while a trigger program is running. This may happen if the +** program uses the [changes() SQL function], or if some other callback +** function invokes sqlite3_changes() directly. Essentially: +** +**
    +**
  • ^(Before entering a trigger program the value returned by +** sqlite3_changes() function is saved. After the trigger program +** has finished, the original value is restored.)^ +** +**
  • ^(Within a trigger program each INSERT, UPDATE and DELETE +** statement sets the value returned by sqlite3_changes() +** upon completion as normal. Of course, this value will not include +** any changes performed by sub-triggers, as the sqlite3_changes() +** value will be saved and restored after each sub-trigger has run.)^ +**
+** +** ^This means that if the changes() SQL function (or similar) is used +** by the first INSERT, UPDATE or DELETE statement within a trigger, it +** returns the value as set when the calling statement began executing. +** ^If it is used by the second or subsequent such statement within a trigger +** program, the value returned reflects the number of rows modified by the +** previous INSERT, UPDATE or DELETE statement within the same trigger. +** +** See also the [sqlite3_total_changes()] interface, the +** [count_changes pragma], and the [changes() SQL function]. +** +** If a separate thread makes changes on the same database connection +** while [sqlite3_changes()] is running then the value returned +** is unpredictable and not meaningful. +*/ +SQLITE_API int sqlite3_changes(sqlite3*); + +/* +** CAPI3REF: Total Number Of Rows Modified +** METHOD: sqlite3 +** +** ^This function returns the total number of rows inserted, modified or +** deleted by all [INSERT], [UPDATE] or [DELETE] statements completed +** since the database connection was opened, including those executed as +** part of trigger programs. ^Executing any other type of SQL statement +** does not affect the value returned by sqlite3_total_changes(). +** +** ^Changes made as part of [foreign key actions] are included in the +** count, but those made as part of REPLACE constraint resolution are +** not. ^Changes to a view that are intercepted by INSTEAD OF triggers +** are not counted. +** +** See also the [sqlite3_changes()] interface, the +** [count_changes pragma], and the [total_changes() SQL function]. +** +** If a separate thread makes changes on the same database connection +** while [sqlite3_total_changes()] is running then the value +** returned is unpredictable and not meaningful. +*/ +SQLITE_API int sqlite3_total_changes(sqlite3*); + +/* +** CAPI3REF: Interrupt A Long-Running Query +** METHOD: sqlite3 +** +** ^This function causes any pending database operation to abort and +** return at its earliest opportunity. This routine is typically +** called in response to a user action such as pressing "Cancel" +** or Ctrl-C where the user wants a long query operation to halt +** immediately. +** +** ^It is safe to call this routine from a thread different from the +** thread that is currently running the database operation. But it +** is not safe to call this routine with a [database connection] that +** is closed or might close before sqlite3_interrupt() returns. +** +** ^If an SQL operation is very nearly finished at the time when +** sqlite3_interrupt() is called, then it might not have an opportunity +** to be interrupted and might continue to completion. +** +** ^An SQL operation that is interrupted will return [SQLITE_INTERRUPT]. +** ^If the interrupted SQL operation is an INSERT, UPDATE, or DELETE +** that is inside an explicit transaction, then the entire transaction +** will be rolled back automatically. +** +** ^The sqlite3_interrupt(D) call is in effect until all currently running +** SQL statements on [database connection] D complete. ^Any new SQL statements +** that are started after the sqlite3_interrupt() call and before the +** running statements reaches zero are interrupted as if they had been +** running prior to the sqlite3_interrupt() call. ^New SQL statements +** that are started after the running statement count reaches zero are +** not effected by the sqlite3_interrupt(). +** ^A call to sqlite3_interrupt(D) that occurs when there are no running +** SQL statements is a no-op and has no effect on SQL statements +** that are started after the sqlite3_interrupt() call returns. +*/ +SQLITE_API void sqlite3_interrupt(sqlite3*); + +/* +** CAPI3REF: Determine If An SQL Statement Is Complete +** +** These routines are useful during command-line input to determine if the +** currently entered text seems to form a complete SQL statement or +** if additional input is needed before sending the text into +** SQLite for parsing. ^These routines return 1 if the input string +** appears to be a complete SQL statement. ^A statement is judged to be +** complete if it ends with a semicolon token and is not a prefix of a +** well-formed CREATE TRIGGER statement. ^Semicolons that are embedded within +** string literals or quoted identifier names or comments are not +** independent tokens (they are part of the token in which they are +** embedded) and thus do not count as a statement terminator. ^Whitespace +** and comments that follow the final semicolon are ignored. +** +** ^These routines return 0 if the statement is incomplete. ^If a +** memory allocation fails, then SQLITE_NOMEM is returned. +** +** ^These routines do not parse the SQL statements thus +** will not detect syntactically incorrect SQL. +** +** ^(If SQLite has not been initialized using [sqlite3_initialize()] prior +** to invoking sqlite3_complete16() then sqlite3_initialize() is invoked +** automatically by sqlite3_complete16(). If that initialization fails, +** then the return value from sqlite3_complete16() will be non-zero +** regardless of whether or not the input SQL is complete.)^ +** +** The input to [sqlite3_complete()] must be a zero-terminated +** UTF-8 string. +** +** The input to [sqlite3_complete16()] must be a zero-terminated +** UTF-16 string in native byte order. +*/ +SQLITE_API int sqlite3_complete(const char* sql); +SQLITE_API int sqlite3_complete16(const void* sql); + +/* +** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors +** KEYWORDS: {busy-handler callback} {busy handler} +** METHOD: sqlite3 +** +** ^The sqlite3_busy_handler(D,X,P) routine sets a callback function X +** that might be invoked with argument P whenever +** an attempt is made to access a database table associated with +** [database connection] D when another thread +** or process has the table locked. +** The sqlite3_busy_handler() interface is used to implement +** [sqlite3_busy_timeout()] and [PRAGMA busy_timeout]. +** +** ^If the busy callback is NULL, then [SQLITE_BUSY] +** is returned immediately upon encountering the lock. ^If the busy callback +** is not NULL, then the callback might be invoked with two arguments. +** +** ^The first argument to the busy handler is a copy of the void* pointer which +** is the third argument to sqlite3_busy_handler(). ^The second argument to +** the busy handler callback is the number of times that the busy handler has +** been invoked previously for the same locking event. ^If the +** busy callback returns 0, then no additional attempts are made to +** access the database and [SQLITE_BUSY] is returned +** to the application. +** ^If the callback returns non-zero, then another attempt +** is made to access the database and the cycle repeats. +** +** The presence of a busy handler does not guarantee that it will be invoked +** when there is lock contention. ^If SQLite determines that invoking the busy +** handler could result in a deadlock, it will go ahead and return [SQLITE_BUSY] +** to the application instead of invoking the +** busy handler. +** Consider a scenario where one process is holding a read lock that +** it is trying to promote to a reserved lock and +** a second process is holding a reserved lock that it is trying +** to promote to an exclusive lock. The first process cannot proceed +** because it is blocked by the second and the second process cannot +** proceed because it is blocked by the first. If both processes +** invoke the busy handlers, neither will make any progress. Therefore, +** SQLite returns [SQLITE_BUSY] for the first process, hoping that this +** will induce the first process to release its read lock and allow +** the second process to proceed. +** +** ^The default busy callback is NULL. +** +** ^(There can only be a single busy handler defined for each +** [database connection]. Setting a new busy handler clears any +** previously set handler.)^ ^Note that calling [sqlite3_busy_timeout()] +** or evaluating [PRAGMA busy_timeout=N] will change the +** busy handler and thus clear any previously set busy handler. +** +** The busy callback should not take any actions which modify the +** database connection that invoked the busy handler. In other words, +** the busy handler is not reentrant. Any such actions +** result in undefined behavior. +** +** A busy handler must not close the database connection +** or [prepared statement] that invoked the busy handler. +*/ +SQLITE_API int sqlite3_busy_handler(sqlite3*, int (*)(void*, int), void*); + +/* +** CAPI3REF: Set A Busy Timeout +** METHOD: sqlite3 +** +** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps +** for a specified amount of time when a table is locked. ^The handler +** will sleep multiple times until at least "ms" milliseconds of sleeping +** have accumulated. ^After at least "ms" milliseconds of sleeping, +** the handler returns 0 which causes [sqlite3_step()] to return +** [SQLITE_BUSY]. +** +** ^Calling this routine with an argument less than or equal to zero +** turns off all busy handlers. +** +** ^(There can only be a single busy handler for a particular +** [database connection] at any given moment. If another busy handler +** was defined (using [sqlite3_busy_handler()]) prior to calling +** this routine, that other busy handler is cleared.)^ +** +** See also: [PRAGMA busy_timeout] +*/ +SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms); + +/* +** CAPI3REF: Convenience Routines For Running Queries +** METHOD: sqlite3 +** +** This is a legacy interface that is preserved for backwards compatibility. +** Use of this interface is not recommended. +** +** Definition: A result table is memory data structure created by the +** [sqlite3_get_table()] interface. A result table records the +** complete query results from one or more queries. +** +** The table conceptually has a number of rows and columns. But +** these numbers are not part of the result table itself. These +** numbers are obtained separately. Let N be the number of rows +** and M be the number of columns. +** +** A result table is an array of pointers to zero-terminated UTF-8 strings. +** There are (N+1)*M elements in the array. The first M pointers point +** to zero-terminated strings that contain the names of the columns. +** The remaining entries all point to query results. NULL values result +** in NULL pointers. All other values are in their UTF-8 zero-terminated +** string representation as returned by [sqlite3_column_text()]. +** +** A result table might consist of one or more memory allocations. +** It is not safe to pass a result table directly to [sqlite3_free()]. +** A result table should be deallocated using [sqlite3_free_table()]. +** +** ^(As an example of the result table format, suppose a query result +** is as follows: +** +**
+**        Name        | Age
+**        -----------------------
+**        Alice       | 43
+**        Bob         | 28
+**        Cindy       | 21
+** 
+** +** There are two column (M==2) and three rows (N==3). Thus the +** result table has 8 entries. Suppose the result table is stored +** in an array names azResult. Then azResult holds this content: +** +**
+**        azResult[0] = "Name";
+**        azResult[1] = "Age";
+**        azResult[2] = "Alice";
+**        azResult[3] = "43";
+**        azResult[4] = "Bob";
+**        azResult[5] = "28";
+**        azResult[6] = "Cindy";
+**        azResult[7] = "21";
+** 
)^ +** +** ^The sqlite3_get_table() function evaluates one or more +** semicolon-separated SQL statements in the zero-terminated UTF-8 +** string of its 2nd parameter and returns a result table to the +** pointer given in its 3rd parameter. +** +** After the application has finished with the result from sqlite3_get_table(), +** it must pass the result table pointer to sqlite3_free_table() in order to +** release the memory that was malloced. Because of the way the +** [sqlite3_malloc()] happens within sqlite3_get_table(), the calling +** function must not try to call [sqlite3_free()] directly. Only +** [sqlite3_free_table()] is able to release the memory properly and safely. +** +** The sqlite3_get_table() interface is implemented as a wrapper around +** [sqlite3_exec()]. The sqlite3_get_table() routine does not have access +** to any internal data structures of SQLite. It uses only the public +** interface defined here. As a consequence, errors that occur in the +** wrapper layer outside of the internal [sqlite3_exec()] call are not +** reflected in subsequent calls to [sqlite3_errcode()] or +** [sqlite3_errmsg()]. +*/ +SQLITE_API int sqlite3_get_table( + sqlite3* db, /* An open database */ + const char* zSql, /* SQL to be evaluated */ + char*** pazResult, /* Results of the query */ + int* pnRow, /* Number of result rows written here */ + int* pnColumn, /* Number of result columns written here */ + char** pzErrmsg /* Error msg written here */ + ); +SQLITE_API void sqlite3_free_table(char** result); + +/* +** CAPI3REF: Formatted String Printing Functions +** +** These routines are work-alikes of the "printf()" family of functions +** from the standard C library. +** These routines understand most of the common formatting options from +** the standard library printf() +** plus some additional non-standard formats ([%q], [%Q], [%w], and [%z]). +** See the [built-in printf()] documentation for details. +** +** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their +** results into memory obtained from [sqlite3_malloc64()]. +** The strings returned by these two routines should be +** released by [sqlite3_free()]. ^Both routines return a +** NULL pointer if [sqlite3_malloc64()] is unable to allocate enough +** memory to hold the resulting string. +** +** ^(The sqlite3_snprintf() routine is similar to "snprintf()" from +** the standard C library. The result is written into the +** buffer supplied as the second parameter whose size is given by +** the first parameter. Note that the order of the +** first two parameters is reversed from snprintf().)^ This is an +** historical accident that cannot be fixed without breaking +** backwards compatibility. ^(Note also that sqlite3_snprintf() +** returns a pointer to its buffer instead of the number of +** characters actually written into the buffer.)^ We admit that +** the number of characters written would be a more useful return +** value but we cannot change the implementation of sqlite3_snprintf() +** now without breaking compatibility. +** +** ^As long as the buffer size is greater than zero, sqlite3_snprintf() +** guarantees that the buffer is always zero-terminated. ^The first +** parameter "n" is the total size of the buffer, including space for +** the zero terminator. So the longest string that can be completely +** written will be n-1 characters. +** +** ^The sqlite3_vsnprintf() routine is a varargs version of sqlite3_snprintf(). +** +** See also: [built-in printf()], [printf() SQL function] +*/ +SQLITE_API char* sqlite3_mprintf(const char*, ...); +SQLITE_API char* sqlite3_vmprintf(const char*, va_list); +SQLITE_API char* sqlite3_snprintf(int, char*, const char*, ...); +SQLITE_API char* sqlite3_vsnprintf(int, char*, const char*, va_list); + +/* +** CAPI3REF: Memory Allocation Subsystem +** +** The SQLite core uses these three routines for all of its own +** internal memory allocation needs. "Core" in the previous sentence +** does not include operating-system specific VFS implementation. The +** Windows VFS uses native malloc() and free() for some operations. +** +** ^The sqlite3_malloc() routine returns a pointer to a block +** of memory at least N bytes in length, where N is the parameter. +** ^If sqlite3_malloc() is unable to obtain sufficient free +** memory, it returns a NULL pointer. ^If the parameter N to +** sqlite3_malloc() is zero or negative then sqlite3_malloc() returns +** a NULL pointer. +** +** ^The sqlite3_malloc64(N) routine works just like +** sqlite3_malloc(N) except that N is an unsigned 64-bit integer instead +** of a signed 32-bit integer. +** +** ^Calling sqlite3_free() with a pointer previously returned +** by sqlite3_malloc() or sqlite3_realloc() releases that memory so +** that it might be reused. ^The sqlite3_free() routine is +** a no-op if is called with a NULL pointer. Passing a NULL pointer +** to sqlite3_free() is harmless. After being freed, memory +** should neither be read nor written. Even reading previously freed +** memory might result in a segmentation fault or other severe error. +** Memory corruption, a segmentation fault, or other severe error +** might result if sqlite3_free() is called with a non-NULL pointer that +** was not obtained from sqlite3_malloc() or sqlite3_realloc(). +** +** ^The sqlite3_realloc(X,N) interface attempts to resize a +** prior memory allocation X to be at least N bytes. +** ^If the X parameter to sqlite3_realloc(X,N) +** is a NULL pointer then its behavior is identical to calling +** sqlite3_malloc(N). +** ^If the N parameter to sqlite3_realloc(X,N) is zero or +** negative then the behavior is exactly the same as calling +** sqlite3_free(X). +** ^sqlite3_realloc(X,N) returns a pointer to a memory allocation +** of at least N bytes in size or NULL if insufficient memory is available. +** ^If M is the size of the prior allocation, then min(N,M) bytes +** of the prior allocation are copied into the beginning of buffer returned +** by sqlite3_realloc(X,N) and the prior allocation is freed. +** ^If sqlite3_realloc(X,N) returns NULL and N is positive, then the +** prior allocation is not freed. +** +** ^The sqlite3_realloc64(X,N) interfaces works the same as +** sqlite3_realloc(X,N) except that N is a 64-bit unsigned integer instead +** of a 32-bit signed integer. +** +** ^If X is a memory allocation previously obtained from sqlite3_malloc(), +** sqlite3_malloc64(), sqlite3_realloc(), or sqlite3_realloc64(), then +** sqlite3_msize(X) returns the size of that memory allocation in bytes. +** ^The value returned by sqlite3_msize(X) might be larger than the number +** of bytes requested when X was allocated. ^If X is a NULL pointer then +** sqlite3_msize(X) returns zero. If X points to something that is not +** the beginning of memory allocation, or if it points to a formerly +** valid memory allocation that has now been freed, then the behavior +** of sqlite3_msize(X) is undefined and possibly harmful. +** +** ^The memory returned by sqlite3_malloc(), sqlite3_realloc(), +** sqlite3_malloc64(), and sqlite3_realloc64() +** is always aligned to at least an 8 byte boundary, or to a +** 4 byte boundary if the [SQLITE_4_BYTE_ALIGNED_MALLOC] compile-time +** option is used. +** +** In SQLite version 3.5.0 and 3.5.1, it was possible to define +** the SQLITE_OMIT_MEMORY_ALLOCATION which would cause the built-in +** implementation of these routines to be omitted. That capability +** is no longer provided. Only built-in memory allocators can be used. +** +** Prior to SQLite version 3.7.10, the Windows OS interface layer called +** the system malloc() and free() directly when converting +** filenames between the UTF-8 encoding used by SQLite +** and whatever filename encoding is used by the particular Windows +** installation. Memory allocation errors were detected, but +** they were reported back as [SQLITE_CANTOPEN] or +** [SQLITE_IOERR] rather than [SQLITE_NOMEM]. +** +** The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()] +** must be either NULL or else pointers obtained from a prior +** invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have +** not yet been released. +** +** The application must not read or write any part of +** a block of memory after it has been released using +** [sqlite3_free()] or [sqlite3_realloc()]. +*/ +SQLITE_API void* sqlite3_malloc(int); +SQLITE_API void* sqlite3_malloc64(sqlite3_uint64); +SQLITE_API void* sqlite3_realloc(void*, int); +SQLITE_API void* sqlite3_realloc64(void*, sqlite3_uint64); +SQLITE_API void sqlite3_free(void*); +SQLITE_API sqlite3_uint64 sqlite3_msize(void*); + +/* +** CAPI3REF: Memory Allocator Statistics +** +** SQLite provides these two interfaces for reporting on the status +** of the [sqlite3_malloc()], [sqlite3_free()], and [sqlite3_realloc()] +** routines, which form the built-in memory allocation subsystem. +** +** ^The [sqlite3_memory_used()] routine returns the number of bytes +** of memory currently outstanding (malloced but not freed). +** ^The [sqlite3_memory_highwater()] routine returns the maximum +** value of [sqlite3_memory_used()] since the high-water mark +** was last reset. ^The values returned by [sqlite3_memory_used()] and +** [sqlite3_memory_highwater()] include any overhead +** added by SQLite in its implementation of [sqlite3_malloc()], +** but not overhead added by the any underlying system library +** routines that [sqlite3_malloc()] may call. +** +** ^The memory high-water mark is reset to the current value of +** [sqlite3_memory_used()] if and only if the parameter to +** [sqlite3_memory_highwater()] is true. ^The value returned +** by [sqlite3_memory_highwater(1)] is the high-water mark +** prior to the reset. +*/ +SQLITE_API sqlite3_int64 sqlite3_memory_used(void); +SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag); + +/* +** CAPI3REF: Pseudo-Random Number Generator +** +** SQLite contains a high-quality pseudo-random number generator (PRNG) used to +** select random [ROWID | ROWIDs] when inserting new records into a table that +** already uses the largest possible [ROWID]. The PRNG is also used for +** the build-in random() and randomblob() SQL functions. This interface allows +** applications to access the same PRNG for other purposes. +** +** ^A call to this routine stores N bytes of randomness into buffer P. +** ^The P parameter can be a NULL pointer. +** +** ^If this routine has not been previously called or if the previous +** call had N less than one or a NULL pointer for P, then the PRNG is +** seeded using randomness obtained from the xRandomness method of +** the default [sqlite3_vfs] object. +** ^If the previous call to this routine had an N of 1 or more and a +** non-NULL P then the pseudo-randomness is generated +** internally and without recourse to the [sqlite3_vfs] xRandomness +** method. +*/ +SQLITE_API void sqlite3_randomness(int N, void* P); + +/* +** CAPI3REF: Compile-Time Authorization Callbacks +** METHOD: sqlite3 +** KEYWORDS: {authorizer callback} +** +** ^This routine registers an authorizer callback with a particular +** [database connection], supplied in the first argument. +** ^The authorizer callback is invoked as SQL statements are being compiled +** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()], +** [sqlite3_prepare_v3()], [sqlite3_prepare16()], [sqlite3_prepare16_v2()], +** and [sqlite3_prepare16_v3()]. ^At various +** points during the compilation process, as logic is being created +** to perform various actions, the authorizer callback is invoked to +** see if those actions are allowed. ^The authorizer callback should +** return [SQLITE_OK] to allow the action, [SQLITE_IGNORE] to disallow the +** specific action but allow the SQL statement to continue to be +** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be +** rejected with an error. ^If the authorizer callback returns +** any value other than [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY] +** then the [sqlite3_prepare_v2()] or equivalent call that triggered +** the authorizer will fail with an error message. +** +** When the callback returns [SQLITE_OK], that means the operation +** requested is ok. ^When the callback returns [SQLITE_DENY], the +** [sqlite3_prepare_v2()] or equivalent call that triggered the +** authorizer will fail with an error message explaining that +** access is denied. +** +** ^The first parameter to the authorizer callback is a copy of the third +** parameter to the sqlite3_set_authorizer() interface. ^The second parameter +** to the callback is an integer [SQLITE_COPY | action code] that specifies +** the particular action to be authorized. ^The third through sixth parameters +** to the callback are either NULL pointers or zero-terminated strings +** that contain additional details about the action to be authorized. +** Applications must always be prepared to encounter a NULL pointer in any +** of the third through the sixth parameters of the authorization callback. +** +** ^If the action code is [SQLITE_READ] +** and the callback returns [SQLITE_IGNORE] then the +** [prepared statement] statement is constructed to substitute +** a NULL value in place of the table column that would have +** been read if [SQLITE_OK] had been returned. The [SQLITE_IGNORE] +** return can be used to deny an untrusted user access to individual +** columns of a table. +** ^When a table is referenced by a [SELECT] but no column values are +** extracted from that table (for example in a query like +** "SELECT count(*) FROM tab") then the [SQLITE_READ] authorizer callback +** is invoked once for that table with a column name that is an empty string. +** ^If the action code is [SQLITE_DELETE] and the callback returns +** [SQLITE_IGNORE] then the [DELETE] operation proceeds but the +** [truncate optimization] is disabled and all rows are deleted individually. +** +** An authorizer is used when [sqlite3_prepare | preparing] +** SQL statements from an untrusted source, to ensure that the SQL statements +** do not try to access data they are not allowed to see, or that they do not +** try to execute malicious statements that damage the database. For +** example, an application may allow a user to enter arbitrary +** SQL queries for evaluation by a database. But the application does +** not want the user to be able to make arbitrary changes to the +** database. An authorizer could then be put in place while the +** user-entered SQL is being [sqlite3_prepare | prepared] that +** disallows everything except [SELECT] statements. +** +** Applications that need to process SQL from untrusted sources +** might also consider lowering resource limits using [sqlite3_limit()] +** and limiting database size using the [max_page_count] [PRAGMA] +** in addition to using an authorizer. +** +** ^(Only a single authorizer can be in place on a database connection +** at a time. Each call to sqlite3_set_authorizer overrides the +** previous call.)^ ^Disable the authorizer by installing a NULL callback. +** The authorizer is disabled by default. +** +** The authorizer callback must not do anything that will modify +** the database connection that invoked the authorizer callback. +** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their +** database connections for the meaning of "modify" in this paragraph. +** +** ^When [sqlite3_prepare_v2()] is used to prepare a statement, the +** statement might be re-prepared during [sqlite3_step()] due to a +** schema change. Hence, the application should ensure that the +** correct authorizer callback remains in place during the [sqlite3_step()]. +** +** ^Note that the authorizer callback is invoked only during +** [sqlite3_prepare()] or its variants. Authorization is not +** performed during statement evaluation in [sqlite3_step()], unless +** as stated in the previous paragraph, sqlite3_step() invokes +** sqlite3_prepare_v2() to reprepare a statement after a schema change. +*/ +SQLITE_API int sqlite3_set_authorizer( + sqlite3*, + int ( + *xAuth)(void*, int, const char*, const char*, const char*, const char*), + void* pUserData); + +/* +** CAPI3REF: Authorizer Return Codes +** +** The [sqlite3_set_authorizer | authorizer callback function] must +** return either [SQLITE_OK] or one of these two constants in order +** to signal SQLite whether or not the action is permitted. See the +** [sqlite3_set_authorizer | authorizer documentation] for additional +** information. +** +** Note that SQLITE_IGNORE is also used as a [conflict resolution mode] +** returned from the [sqlite3_vtab_on_conflict()] interface. +*/ +#define SQLITE_DENY 1 /* Abort the SQL statement with an error */ +#define SQLITE_IGNORE 2 /* Don't allow access, but don't generate an error */ + +/* +** CAPI3REF: Authorizer Action Codes +** +** The [sqlite3_set_authorizer()] interface registers a callback function +** that is invoked to authorize certain SQL statement actions. The +** second parameter to the callback is an integer code that specifies +** what action is being authorized. These are the integer action codes that +** the authorizer callback may be passed. +** +** These action code values signify what kind of operation is to be +** authorized. The 3rd and 4th parameters to the authorization +** callback function will be parameters or NULL depending on which of these +** codes is used as the second parameter. ^(The 5th parameter to the +** authorizer callback is the name of the database ("main", "temp", +** etc.) if applicable.)^ ^The 6th parameter to the authorizer callback +** is the name of the inner-most trigger or view that is responsible for +** the access attempt or NULL if this access attempt is directly from +** top-level SQL code. +*/ +/******************************************* 3rd ************ 4th ***********/ +#define SQLITE_CREATE_INDEX 1 /* Index Name Table Name */ +#define SQLITE_CREATE_TABLE 2 /* Table Name NULL */ +#define SQLITE_CREATE_TEMP_INDEX 3 /* Index Name Table Name */ +#define SQLITE_CREATE_TEMP_TABLE 4 /* Table Name NULL */ +#define SQLITE_CREATE_TEMP_TRIGGER 5 /* Trigger Name Table Name */ +#define SQLITE_CREATE_TEMP_VIEW 6 /* View Name NULL */ +#define SQLITE_CREATE_TRIGGER 7 /* Trigger Name Table Name */ +#define SQLITE_CREATE_VIEW 8 /* View Name NULL */ +#define SQLITE_DELETE 9 /* Table Name NULL */ +#define SQLITE_DROP_INDEX 10 /* Index Name Table Name */ +#define SQLITE_DROP_TABLE 11 /* Table Name NULL */ +#define SQLITE_DROP_TEMP_INDEX 12 /* Index Name Table Name */ +#define SQLITE_DROP_TEMP_TABLE 13 /* Table Name NULL */ +#define SQLITE_DROP_TEMP_TRIGGER 14 /* Trigger Name Table Name */ +#define SQLITE_DROP_TEMP_VIEW 15 /* View Name NULL */ +#define SQLITE_DROP_TRIGGER 16 /* Trigger Name Table Name */ +#define SQLITE_DROP_VIEW 17 /* View Name NULL */ +#define SQLITE_INSERT 18 /* Table Name NULL */ +#define SQLITE_PRAGMA 19 /* Pragma Name 1st arg or NULL */ +#define SQLITE_READ 20 /* Table Name Column Name */ +#define SQLITE_SELECT 21 /* NULL NULL */ +#define SQLITE_TRANSACTION 22 /* Operation NULL */ +#define SQLITE_UPDATE 23 /* Table Name Column Name */ +#define SQLITE_ATTACH 24 /* Filename NULL */ +#define SQLITE_DETACH 25 /* Database Name NULL */ +#define SQLITE_ALTER_TABLE 26 /* Database Name Table Name */ +#define SQLITE_REINDEX 27 /* Index Name NULL */ +#define SQLITE_ANALYZE 28 /* Table Name NULL */ +#define SQLITE_CREATE_VTABLE 29 /* Table Name Module Name */ +#define SQLITE_DROP_VTABLE 30 /* Table Name Module Name */ +#define SQLITE_FUNCTION 31 /* NULL Function Name */ +#define SQLITE_SAVEPOINT 32 /* Operation Savepoint Name */ +#define SQLITE_COPY 0 /* No longer used */ +#define SQLITE_RECURSIVE 33 /* NULL NULL */ + +/* +** CAPI3REF: Tracing And Profiling Functions +** METHOD: sqlite3 +** +** These routines are deprecated. Use the [sqlite3_trace_v2()] interface +** instead of the routines described here. +** +** These routines register callback functions that can be used for +** tracing and profiling the execution of SQL statements. +** +** ^The callback function registered by sqlite3_trace() is invoked at +** various times when an SQL statement is being run by [sqlite3_step()]. +** ^The sqlite3_trace() callback is invoked with a UTF-8 rendering of the +** SQL statement text as the statement first begins executing. +** ^(Additional sqlite3_trace() callbacks might occur +** as each triggered subprogram is entered. The callbacks for triggers +** contain a UTF-8 SQL comment that identifies the trigger.)^ +** +** The [SQLITE_TRACE_SIZE_LIMIT] compile-time option can be used to limit +** the length of [bound parameter] expansion in the output of sqlite3_trace(). +** +** ^The callback function registered by sqlite3_profile() is invoked +** as each SQL statement finishes. ^The profile callback contains +** the original statement text and an estimate of wall-clock time +** of how long that statement took to run. ^The profile callback +** time is in units of nanoseconds, however the current implementation +** is only capable of millisecond resolution so the six least significant +** digits in the time are meaningless. Future versions of SQLite +** might provide greater resolution on the profiler callback. The +** sqlite3_profile() function is considered experimental and is +** subject to change in future versions of SQLite. +*/ +SQLITE_API SQLITE_DEPRECATED void* +sqlite3_trace(sqlite3*, void (*xTrace)(void*, const char*), void*); +SQLITE_API SQLITE_DEPRECATED void* sqlite3_profile( + sqlite3*, + void (*xProfile)(void*, const char*, sqlite3_uint64), + void*); + +/* +** CAPI3REF: SQL Trace Event Codes +** KEYWORDS: SQLITE_TRACE +** +** These constants identify classes of events that can be monitored +** using the [sqlite3_trace_v2()] tracing logic. The M argument +** to [sqlite3_trace_v2(D,M,X,P)] is an OR-ed combination of one or more of +** the following constants. ^The first argument to the trace callback +** is one of the following constants. +** +** New tracing constants may be added in future releases. +** +** ^A trace callback has four arguments: xCallback(T,C,P,X). +** ^The T argument is one of the integer type codes above. +** ^The C argument is a copy of the context pointer passed in as the +** fourth argument to [sqlite3_trace_v2()]. +** The P and X arguments are pointers whose meanings depend on T. +** +**
+** [[SQLITE_TRACE_STMT]]
SQLITE_TRACE_STMT
+**
^An SQLITE_TRACE_STMT callback is invoked when a prepared statement +** first begins running and possibly at other times during the +** execution of the prepared statement, such as at the start of each +** trigger subprogram. ^The P argument is a pointer to the +** [prepared statement]. ^The X argument is a pointer to a string which +** is the unexpanded SQL text of the prepared statement or an SQL comment +** that indicates the invocation of a trigger. ^The callback can compute +** the same text that would have been returned by the legacy [sqlite3_trace()] +** interface by using the X argument when X begins with "--" and invoking +** [sqlite3_expanded_sql(P)] otherwise. +** +** [[SQLITE_TRACE_PROFILE]]
SQLITE_TRACE_PROFILE
+**
^An SQLITE_TRACE_PROFILE callback provides approximately the same +** information as is provided by the [sqlite3_profile()] callback. +** ^The P argument is a pointer to the [prepared statement] and the +** X argument points to a 64-bit integer which is the estimated of +** the number of nanosecond that the prepared statement took to run. +** ^The SQLITE_TRACE_PROFILE callback is invoked when the statement finishes. +** +** [[SQLITE_TRACE_ROW]]
SQLITE_TRACE_ROW
+**
^An SQLITE_TRACE_ROW callback is invoked whenever a prepared +** statement generates a single row of result. +** ^The P argument is a pointer to the [prepared statement] and the +** X argument is unused. +** +** [[SQLITE_TRACE_CLOSE]]
SQLITE_TRACE_CLOSE
+**
^An SQLITE_TRACE_CLOSE callback is invoked when a database +** connection closes. +** ^The P argument is a pointer to the [database connection] object +** and the X argument is unused. +**
+*/ +#define SQLITE_TRACE_STMT 0x01 +#define SQLITE_TRACE_PROFILE 0x02 +#define SQLITE_TRACE_ROW 0x04 +#define SQLITE_TRACE_CLOSE 0x08 + +/* +** CAPI3REF: SQL Trace Hook +** METHOD: sqlite3 +** +** ^The sqlite3_trace_v2(D,M,X,P) interface registers a trace callback +** function X against [database connection] D, using property mask M +** and context pointer P. ^If the X callback is +** NULL or if the M mask is zero, then tracing is disabled. The +** M argument should be the bitwise OR-ed combination of +** zero or more [SQLITE_TRACE] constants. +** +** ^Each call to either sqlite3_trace() or sqlite3_trace_v2() overrides +** (cancels) any prior calls to sqlite3_trace() or sqlite3_trace_v2(). +** +** ^The X callback is invoked whenever any of the events identified by +** mask M occur. ^The integer return value from the callback is currently +** ignored, though this may change in future releases. Callback +** implementations should return zero to ensure future compatibility. +** +** ^A trace callback is invoked with four arguments: callback(T,C,P,X). +** ^The T argument is one of the [SQLITE_TRACE] +** constants to indicate why the callback was invoked. +** ^The C argument is a copy of the context pointer. +** The P and X arguments are pointers whose meanings depend on T. +** +** The sqlite3_trace_v2() interface is intended to replace the legacy +** interfaces [sqlite3_trace()] and [sqlite3_profile()], both of which +** are deprecated. +*/ +SQLITE_API int sqlite3_trace_v2( + sqlite3*, + unsigned uMask, + int (*xCallback)(unsigned, void*, void*, void*), + void* pCtx); + +/* +** CAPI3REF: Query Progress Callbacks +** METHOD: sqlite3 +** +** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback +** function X to be invoked periodically during long running calls to +** [sqlite3_exec()], [sqlite3_step()] and [sqlite3_get_table()] for +** database connection D. An example use for this +** interface is to keep a GUI updated during a large query. +** +** ^The parameter P is passed through as the only parameter to the +** callback function X. ^The parameter N is the approximate number of +** [virtual machine instructions] that are evaluated between successive +** invocations of the callback X. ^If N is less than one then the progress +** handler is disabled. +** +** ^Only a single progress handler may be defined at one time per +** [database connection]; setting a new progress handler cancels the +** old one. ^Setting parameter X to NULL disables the progress handler. +** ^The progress handler is also disabled by setting N to a value less +** than 1. +** +** ^If the progress callback returns non-zero, the operation is +** interrupted. This feature can be used to implement a +** "Cancel" button on a GUI progress dialog box. +** +** The progress handler callback must not do anything that will modify +** the database connection that invoked the progress handler. +** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their +** database connections for the meaning of "modify" in this paragraph. +** +*/ +SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int (*)(void*), void*); + +/* +** CAPI3REF: Opening A New Database Connection +** CONSTRUCTOR: sqlite3 +** +** ^These routines open an SQLite database file as specified by the +** filename argument. ^The filename argument is interpreted as UTF-8 for +** sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte +** order for sqlite3_open16(). ^(A [database connection] handle is usually +** returned in *ppDb, even if an error occurs. The only exception is that +** if SQLite is unable to allocate memory to hold the [sqlite3] object, +** a NULL will be written into *ppDb instead of a pointer to the [sqlite3] +** object.)^ ^(If the database is opened (and/or created) successfully, then +** [SQLITE_OK] is returned. Otherwise an [error code] is returned.)^ ^The +** [sqlite3_errmsg()] or [sqlite3_errmsg16()] routines can be used to obtain +** an English language description of the error following a failure of any +** of the sqlite3_open() routines. +** +** ^The default encoding will be UTF-8 for databases created using +** sqlite3_open() or sqlite3_open_v2(). ^The default encoding for databases +** created using sqlite3_open16() will be UTF-16 in the native byte order. +** +** Whether or not an error occurs when it is opened, resources +** associated with the [database connection] handle should be released by +** passing it to [sqlite3_close()] when it is no longer required. +** +** The sqlite3_open_v2() interface works like sqlite3_open() +** except that it accepts two additional parameters for additional control +** over the new database connection. ^(The flags parameter to +** sqlite3_open_v2() can take one of +** the following three values, optionally combined with the +** [SQLITE_OPEN_NOMUTEX], [SQLITE_OPEN_FULLMUTEX], [SQLITE_OPEN_SHAREDCACHE], +** [SQLITE_OPEN_PRIVATECACHE], and/or [SQLITE_OPEN_URI] flags:)^ +** +**
+** ^(
[SQLITE_OPEN_READONLY]
+**
The database is opened in read-only mode. If the database does not +** already exist, an error is returned.
)^ +** +** ^(
[SQLITE_OPEN_READWRITE]
+**
The database is opened for reading and writing if possible, or reading +** only if the file is write protected by the operating system. In either +** case the database must already exist, otherwise an error is returned.
)^ +** +** ^(
[SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]
+**
The database is opened for reading and writing, and is created if +** it does not already exist. This is the behavior that is always used for +** sqlite3_open() and sqlite3_open16().
)^ +**
+** +** If the 3rd parameter to sqlite3_open_v2() is not one of the +** combinations shown above optionally combined with other +** [SQLITE_OPEN_READONLY | SQLITE_OPEN_* bits] +** then the behavior is undefined. +** +** ^If the [SQLITE_OPEN_NOMUTEX] flag is set, then the database connection +** opens in the multi-thread [threading mode] as long as the single-thread +** mode has not been set at compile-time or start-time. ^If the +** [SQLITE_OPEN_FULLMUTEX] flag is set then the database connection opens +** in the serialized [threading mode] unless single-thread was +** previously selected at compile-time or start-time. +** ^The [SQLITE_OPEN_SHAREDCACHE] flag causes the database connection to be +** eligible to use [shared cache mode], regardless of whether or not shared +** cache is enabled using [sqlite3_enable_shared_cache()]. ^The +** [SQLITE_OPEN_PRIVATECACHE] flag causes the database connection to not +** participate in [shared cache mode] even if it is enabled. +** +** ^The fourth parameter to sqlite3_open_v2() is the name of the +** [sqlite3_vfs] object that defines the operating system interface that +** the new database connection should use. ^If the fourth parameter is +** a NULL pointer then the default [sqlite3_vfs] object is used. +** +** ^If the filename is ":memory:", then a private, temporary in-memory database +** is created for the connection. ^This in-memory database will vanish when +** the database connection is closed. Future versions of SQLite might +** make use of additional special filenames that begin with the ":" character. +** It is recommended that when a database filename actually does begin with +** a ":" character you should prefix the filename with a pathname such as +** "./" to avoid ambiguity. +** +** ^If the filename is an empty string, then a private, temporary +** on-disk database will be created. ^This private database will be +** automatically deleted as soon as the database connection is closed. +** +** [[URI filenames in sqlite3_open()]]

URI Filenames

+** +** ^If [URI filename] interpretation is enabled, and the filename argument +** begins with "file:", then the filename is interpreted as a URI. ^URI +** filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is +** set in the third argument to sqlite3_open_v2(), or if it has +** been enabled globally using the [SQLITE_CONFIG_URI] option with the +** [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option. +** URI filename interpretation is turned off +** by default, but future releases of SQLite might enable URI filename +** interpretation by default. See "[URI filenames]" for additional +** information. +** +** URI filenames are parsed according to RFC 3986. ^If the URI contains an +** authority, then it must be either an empty string or the string +** "localhost". ^If the authority is not an empty string or "localhost", an +** error is returned to the caller. ^The fragment component of a URI, if +** present, is ignored. +** +** ^SQLite uses the path component of the URI as the name of the disk file +** which contains the database. ^If the path begins with a '/' character, +** then it is interpreted as an absolute path. ^If the path does not begin +** with a '/' (meaning that the authority section is omitted from the URI) +** then the path is interpreted as a relative path. +** ^(On windows, the first component of an absolute path +** is a drive specification (e.g. "C:").)^ +** +** [[core URI query parameters]] +** The query component of a URI may contain parameters that are interpreted +** either by SQLite itself, or by a [VFS | custom VFS implementation]. +** SQLite and its built-in [VFSes] interpret the +** following query parameters: +** +**
    +**
  • vfs: ^The "vfs" parameter may be used to specify the name of +** a VFS object that provides the operating system interface that should +** be used to access the database file on disk. ^If this option is set to +** an empty string the default VFS object is used. ^Specifying an unknown +** VFS is an error. ^If sqlite3_open_v2() is used and the vfs option is +** present, then the VFS specified by the option takes precedence over +** the value passed as the fourth parameter to sqlite3_open_v2(). +** +**
  • mode: ^(The mode parameter may be set to either "ro", "rw", +** "rwc", or "memory". Attempting to set it to any other value is +** an error)^. +** ^If "ro" is specified, then the database is opened for read-only +** access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the +** third argument to sqlite3_open_v2(). ^If the mode option is set to +** "rw", then the database is opened for read-write (but not create) +** access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had +** been set. ^Value "rwc" is equivalent to setting both +** SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE. ^If the mode option is +** set to "memory" then a pure [in-memory database] that never reads +** or writes from disk is used. ^It is an error to specify a value for +** the mode parameter that is less restrictive than that specified by +** the flags passed in the third parameter to sqlite3_open_v2(). +** +**
  • cache: ^The cache parameter may be set to either "shared" or +** "private". ^Setting it to "shared" is equivalent to setting the +** SQLITE_OPEN_SHAREDCACHE bit in the flags argument passed to +** sqlite3_open_v2(). ^Setting the cache parameter to "private" is +** equivalent to setting the SQLITE_OPEN_PRIVATECACHE bit. +** ^If sqlite3_open_v2() is used and the "cache" parameter is present in +** a URI filename, its value overrides any behavior requested by setting +** SQLITE_OPEN_PRIVATECACHE or SQLITE_OPEN_SHAREDCACHE flag. +** +**
  • psow: ^The psow parameter indicates whether or not the +** [powersafe overwrite] property does or does not apply to the +** storage media on which the database file resides. +** +**
  • nolock: ^The nolock parameter is a boolean query parameter +** which if set disables file locking in rollback journal modes. This +** is useful for accessing a database on a filesystem that does not +** support locking. Caution: Database corruption might result if two +** or more processes write to the same database and any one of those +** processes uses nolock=1. +** +**
  • immutable: ^The immutable parameter is a boolean query +** parameter that indicates that the database file is stored on +** read-only media. ^When immutable is set, SQLite assumes that the +** database file cannot be changed, even by a process with higher +** privilege, and so the database is opened read-only and all locking +** and change detection is disabled. Caution: Setting the immutable +** property on a database file that does in fact change can result +** in incorrect query results and/or [SQLITE_CORRUPT] errors. +** See also: [SQLITE_IOCAP_IMMUTABLE]. +** +**
+** +** ^Specifying an unknown parameter in the query component of a URI is not an +** error. Future versions of SQLite might understand additional query +** parameters. See "[query parameters with special meaning to SQLite]" for +** additional information. +** +** [[URI filename examples]]

URI filename examples

+** +** +**
URI filenames Results +**
file:data.db +** Open the file "data.db" in the current directory. +**
file:/home/fred/data.db
+** file:///home/fred/data.db
+** file://localhost/home/fred/data.db
+** Open the database file "/home/fred/data.db". +**
file://darkstar/home/fred/data.db +** An error. "darkstar" is not a recognized authority. +**
+** file:///C:/Documents%20and%20Settings/fred/Desktop/data.db +** Windows only: Open the file "data.db" on fred's desktop on drive +** C:. Note that the %20 escaping in this example is not strictly +** necessary - space characters can be used literally +** in URI filenames. +**
file:data.db?mode=ro&cache=private +** Open file "data.db" in the current directory for read-only access. +** Regardless of whether or not shared-cache mode is enabled by +** default, use a private cache. +**
file:/home/fred/data.db?vfs=unix-dotfile +** Open file "/home/fred/data.db". Use the special VFS "unix-dotfile" +** that uses dot-files in place of posix advisory locking. +**
file:data.db?mode=readonly +** An error. "readonly" is not a valid option for the "mode" parameter. +**
+** +** ^URI hexadecimal escape sequences (%HH) are supported within the path and +** query components of a URI. A hexadecimal escape sequence consists of a +** percent sign - "%" - followed by exactly two hexadecimal digits +** specifying an octet value. ^Before the path or query components of a +** URI filename are interpreted, they are encoded using UTF-8 and all +** hexadecimal escape sequences replaced by a single byte containing the +** corresponding octet. If this process generates an invalid UTF-8 encoding, +** the results are undefined. +** +** Note to Windows users: The encoding used for the filename argument +** of sqlite3_open() and sqlite3_open_v2() must be UTF-8, not whatever +** codepage is currently defined. Filenames containing international +** characters must be converted to UTF-8 prior to passing them into +** sqlite3_open() or sqlite3_open_v2(). +** +** Note to Windows Runtime users: The temporary directory must be set +** prior to calling sqlite3_open() or sqlite3_open_v2(). Otherwise, various +** features that require the use of temporary files may fail. +** +** See also: [sqlite3_temp_directory] +*/ +SQLITE_API int sqlite3_open( + const char* filename, /* Database filename (UTF-8) */ + sqlite3** ppDb /* OUT: SQLite db handle */ + ); +SQLITE_API int sqlite3_open16( + const void* filename, /* Database filename (UTF-16) */ + sqlite3** ppDb /* OUT: SQLite db handle */ + ); +SQLITE_API int sqlite3_open_v2( + const char* filename, /* Database filename (UTF-8) */ + sqlite3** ppDb, /* OUT: SQLite db handle */ + int flags, /* Flags */ + const char* zVfs /* Name of VFS module to use */ + ); + +/* +** CAPI3REF: Obtain Values For URI Parameters +** +** These are utility routines, useful to VFS implementations, that check +** to see if a database file was a URI that contained a specific query +** parameter, and if so obtains the value of that query parameter. +** +** If F is the database filename pointer passed into the xOpen() method of +** a VFS implementation when the flags parameter to xOpen() has one or +** more of the [SQLITE_OPEN_URI] or [SQLITE_OPEN_MAIN_DB] bits set and +** P is the name of the query parameter, then +** sqlite3_uri_parameter(F,P) returns the value of the P +** parameter if it exists or a NULL pointer if P does not appear as a +** query parameter on F. If P is a query parameter of F +** has no explicit value, then sqlite3_uri_parameter(F,P) returns +** a pointer to an empty string. +** +** The sqlite3_uri_boolean(F,P,B) routine assumes that P is a boolean +** parameter and returns true (1) or false (0) according to the value +** of P. The sqlite3_uri_boolean(F,P,B) routine returns true (1) if the +** value of query parameter P is one of "yes", "true", or "on" in any +** case or if the value begins with a non-zero number. The +** sqlite3_uri_boolean(F,P,B) routines returns false (0) if the value of +** query parameter P is one of "no", "false", or "off" in any case or +** if the value begins with a numeric zero. If P is not a query +** parameter on F or if the value of P is does not match any of the +** above, then sqlite3_uri_boolean(F,P,B) returns (B!=0). +** +** The sqlite3_uri_int64(F,P,D) routine converts the value of P into a +** 64-bit signed integer and returns that integer, or D if P does not +** exist. If the value of P is something other than an integer, then +** zero is returned. +** +** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and +** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and +** is not a database file pathname pointer that SQLite passed into the xOpen +** VFS method, then the behavior of this routine is undefined and probably +** undesirable. +*/ +SQLITE_API const char* sqlite3_uri_parameter( + const char* zFilename, + const char* zParam); +SQLITE_API int +sqlite3_uri_boolean(const char* zFile, const char* zParam, int bDefault); +SQLITE_API sqlite3_int64 +sqlite3_uri_int64(const char*, const char*, sqlite3_int64); + +/* +** CAPI3REF: Error Codes And Messages +** METHOD: sqlite3 +** +** ^If the most recent sqlite3_* API call associated with +** [database connection] D failed, then the sqlite3_errcode(D) interface +** returns the numeric [result code] or [extended result code] for that +** API call. +** If the most recent API call was successful, +** then the return value from sqlite3_errcode() is undefined. +** ^The sqlite3_extended_errcode() +** interface is the same except that it always returns the +** [extended result code] even when extended result codes are +** disabled. +** +** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language +** text that describes the error, as either UTF-8 or UTF-16 respectively. +** ^(Memory to hold the error message string is managed internally. +** The application does not need to worry about freeing the result. +** However, the error string might be overwritten or deallocated by +** subsequent calls to other SQLite interface functions.)^ +** +** ^The sqlite3_errstr() interface returns the English-language text +** that describes the [result code], as UTF-8. +** ^(Memory to hold the error message string is managed internally +** and must not be freed by the application)^. +** +** When the serialized [threading mode] is in use, it might be the +** case that a second error occurs on a separate thread in between +** the time of the first error and the call to these interfaces. +** When that happens, the second error will be reported since these +** interfaces always report the most recent result. To avoid +** this, each thread can obtain exclusive use of the [database connection] D +** by invoking [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning +** to use D and invoking [sqlite3_mutex_leave]([sqlite3_db_mutex](D)) after +** all calls to the interfaces listed here are completed. +** +** If an interface fails with SQLITE_MISUSE, that means the interface +** was invoked incorrectly by the application. In that case, the +** error code and message may or may not be set. +*/ +SQLITE_API int sqlite3_errcode(sqlite3* db); +SQLITE_API int sqlite3_extended_errcode(sqlite3* db); +SQLITE_API const char* sqlite3_errmsg(sqlite3*); +SQLITE_API const void* sqlite3_errmsg16(sqlite3*); +SQLITE_API const char* sqlite3_errstr(int); + +/* +** CAPI3REF: Prepared Statement Object +** KEYWORDS: {prepared statement} {prepared statements} +** +** An instance of this object represents a single SQL statement that +** has been compiled into binary form and is ready to be evaluated. +** +** Think of each SQL statement as a separate computer program. The +** original SQL text is source code. A prepared statement object +** is the compiled object code. All SQL must be converted into a +** prepared statement before it can be run. +** +** The life-cycle of a prepared statement object usually goes like this: +** +**
    +**
  1. Create the prepared statement object using [sqlite3_prepare_v2()]. +**
  2. Bind values to [parameters] using the sqlite3_bind_*() +** interfaces. +**
  3. Run the SQL by calling [sqlite3_step()] one or more times. +**
  4. Reset the prepared statement using [sqlite3_reset()] then go back +** to step 2. Do this zero or more times. +**
  5. Destroy the object using [sqlite3_finalize()]. +**
+*/ +typedef struct sqlite3_stmt sqlite3_stmt; + +/* +** CAPI3REF: Run-time Limits +** METHOD: sqlite3 +** +** ^(This interface allows the size of various constructs to be limited +** on a connection by connection basis. The first parameter is the +** [database connection] whose limit is to be set or queried. The +** second parameter is one of the [limit categories] that define a +** class of constructs to be size limited. The third parameter is the +** new limit for that construct.)^ +** +** ^If the new limit is a negative number, the limit is unchanged. +** ^(For each limit category SQLITE_LIMIT_NAME there is a +** [limits | hard upper bound] +** set at compile-time by a C preprocessor macro called +** [limits | SQLITE_MAX_NAME]. +** (The "_LIMIT_" in the name is changed to "_MAX_".))^ +** ^Attempts to increase a limit above its hard upper bound are +** silently truncated to the hard upper bound. +** +** ^Regardless of whether or not the limit was changed, the +** [sqlite3_limit()] interface returns the prior value of the limit. +** ^Hence, to find the current value of a limit without changing it, +** simply invoke this interface with the third parameter set to -1. +** +** Run-time limits are intended for use in applications that manage +** both their own internal database and also databases that are controlled +** by untrusted external sources. An example application might be a +** web browser that has its own databases for storing history and +** separate databases controlled by JavaScript applications downloaded +** off the Internet. The internal databases can be given the +** large, default limits. Databases managed by external sources can +** be given much smaller limits designed to prevent a denial of service +** attack. Developers might also want to use the [sqlite3_set_authorizer()] +** interface to further control untrusted SQL. The size of the database +** created by an untrusted script can be contained using the +** [max_page_count] [PRAGMA]. +** +** New run-time limit categories may be added in future releases. +*/ +SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal); + +/* +** CAPI3REF: Run-Time Limit Categories +** KEYWORDS: {limit category} {*limit categories} +** +** These constants define various performance limits +** that can be lowered at run-time using [sqlite3_limit()]. +** The synopsis of the meanings of the various limits is shown below. +** Additional information is available at [limits | Limits in SQLite]. +** +**
+** [[SQLITE_LIMIT_LENGTH]] ^(
SQLITE_LIMIT_LENGTH
+**
The maximum size of any string or BLOB or table row, in bytes.
)^ +** +** [[SQLITE_LIMIT_SQL_LENGTH]] ^(
SQLITE_LIMIT_SQL_LENGTH
+**
The maximum length of an SQL statement, in bytes.
)^ +** +** [[SQLITE_LIMIT_COLUMN]] ^(
SQLITE_LIMIT_COLUMN
+**
The maximum number of columns in a table definition or in the +** result set of a [SELECT] or the maximum number of columns in an index +** or in an ORDER BY or GROUP BY clause.
)^ +** +** [[SQLITE_LIMIT_EXPR_DEPTH]] ^(
SQLITE_LIMIT_EXPR_DEPTH
+**
The maximum depth of the parse tree on any expression.
)^ +** +** [[SQLITE_LIMIT_COMPOUND_SELECT]] ^(
SQLITE_LIMIT_COMPOUND_SELECT
+**
The maximum number of terms in a compound SELECT statement.
)^ +** +** [[SQLITE_LIMIT_VDBE_OP]] ^(
SQLITE_LIMIT_VDBE_OP
+**
The maximum number of instructions in a virtual machine program +** used to implement an SQL statement. If [sqlite3_prepare_v2()] or +** the equivalent tries to allocate space for more than this many opcodes +** in a single prepared statement, an SQLITE_NOMEM error is returned.
)^ +** +** [[SQLITE_LIMIT_FUNCTION_ARG]] ^(
SQLITE_LIMIT_FUNCTION_ARG
+**
The maximum number of arguments on a function.
)^ +** +** [[SQLITE_LIMIT_ATTACHED]] ^(
SQLITE_LIMIT_ATTACHED
+**
The maximum number of [ATTACH | attached databases].)^
+** +** [[SQLITE_LIMIT_LIKE_PATTERN_LENGTH]] +** ^(
SQLITE_LIMIT_LIKE_PATTERN_LENGTH
+**
The maximum length of the pattern argument to the [LIKE] or +** [GLOB] operators.
)^ +** +** [[SQLITE_LIMIT_VARIABLE_NUMBER]] +** ^(
SQLITE_LIMIT_VARIABLE_NUMBER
+**
The maximum index number of any [parameter] in an SQL statement.)^ +** +** [[SQLITE_LIMIT_TRIGGER_DEPTH]] ^(
SQLITE_LIMIT_TRIGGER_DEPTH
+**
The maximum depth of recursion for triggers.
)^ +** +** [[SQLITE_LIMIT_WORKER_THREADS]] ^(
SQLITE_LIMIT_WORKER_THREADS
+**
The maximum number of auxiliary worker threads that a single +** [prepared statement] may start.
)^ +**
+*/ +#define SQLITE_LIMIT_LENGTH 0 +#define SQLITE_LIMIT_SQL_LENGTH 1 +#define SQLITE_LIMIT_COLUMN 2 +#define SQLITE_LIMIT_EXPR_DEPTH 3 +#define SQLITE_LIMIT_COMPOUND_SELECT 4 +#define SQLITE_LIMIT_VDBE_OP 5 +#define SQLITE_LIMIT_FUNCTION_ARG 6 +#define SQLITE_LIMIT_ATTACHED 7 +#define SQLITE_LIMIT_LIKE_PATTERN_LENGTH 8 +#define SQLITE_LIMIT_VARIABLE_NUMBER 9 +#define SQLITE_LIMIT_TRIGGER_DEPTH 10 +#define SQLITE_LIMIT_WORKER_THREADS 11 + +/* +** CAPI3REF: Prepare Flags +** +** These constants define various flags that can be passed into +** "prepFlags" parameter of the [sqlite3_prepare_v3()] and +** [sqlite3_prepare16_v3()] interfaces. +** +** New flags may be added in future releases of SQLite. +** +**
+** [[SQLITE_PREPARE_PERSISTENT]] ^(
SQLITE_PREPARE_PERSISTENT
+**
The SQLITE_PREPARE_PERSISTENT flag is a hint to the query planner +** that the prepared statement will be retained for a long time and +** probably reused many times.)^ ^Without this flag, [sqlite3_prepare_v3()] +** and [sqlite3_prepare16_v3()] assume that the prepared statement will +** be used just once or at most a few times and then destroyed using +** [sqlite3_finalize()] relatively soon. The current implementation acts +** on this hint by avoiding the use of [lookaside memory] so as not to +** deplete the limited store of lookaside memory. Future versions of +** SQLite may act on this hint differently. +**
+*/ +#define SQLITE_PREPARE_PERSISTENT 0x01 + +/* +** CAPI3REF: Compiling An SQL Statement +** KEYWORDS: {SQL statement compiler} +** METHOD: sqlite3 +** CONSTRUCTOR: sqlite3_stmt +** +** To execute an SQL statement, it must first be compiled into a byte-code +** program using one of these routines. Or, in other words, these routines +** are constructors for the [prepared statement] object. +** +** The preferred routine to use is [sqlite3_prepare_v2()]. The +** [sqlite3_prepare()] interface is legacy and should be avoided. +** [sqlite3_prepare_v3()] has an extra "prepFlags" option that is used +** for special purposes. +** +** The use of the UTF-8 interfaces is preferred, as SQLite currently +** does all parsing using UTF-8. The UTF-16 interfaces are provided +** as a convenience. The UTF-16 interfaces work by converting the +** input text into UTF-8, then invoking the corresponding UTF-8 interface. +** +** The first argument, "db", is a [database connection] obtained from a +** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or +** [sqlite3_open16()]. The database connection must not have been closed. +** +** The second argument, "zSql", is the statement to be compiled, encoded +** as either UTF-8 or UTF-16. The sqlite3_prepare(), sqlite3_prepare_v2(), +** and sqlite3_prepare_v3() +** interfaces use UTF-8, and sqlite3_prepare16(), sqlite3_prepare16_v2(), +** and sqlite3_prepare16_v3() use UTF-16. +** +** ^If the nByte argument is negative, then zSql is read up to the +** first zero terminator. ^If nByte is positive, then it is the +** number of bytes read from zSql. ^If nByte is zero, then no prepared +** statement is generated. +** If the caller knows that the supplied string is nul-terminated, then +** there is a small performance advantage to passing an nByte parameter that +** is the number of bytes in the input string including +** the nul-terminator. +** +** ^If pzTail is not NULL then *pzTail is made to point to the first byte +** past the end of the first SQL statement in zSql. These routines only +** compile the first statement in zSql, so *pzTail is left pointing to +** what remains uncompiled. +** +** ^*ppStmt is left pointing to a compiled [prepared statement] that can be +** executed using [sqlite3_step()]. ^If there is an error, *ppStmt is set +** to NULL. ^If the input text contains no SQL (if the input is an empty +** string or a comment) then *ppStmt is set to NULL. +** The calling procedure is responsible for deleting the compiled +** SQL statement using [sqlite3_finalize()] after it has finished with it. +** ppStmt may not be NULL. +** +** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK]; +** otherwise an [error code] is returned. +** +** The sqlite3_prepare_v2(), sqlite3_prepare_v3(), sqlite3_prepare16_v2(), +** and sqlite3_prepare16_v3() interfaces are recommended for all new programs. +** The older interfaces (sqlite3_prepare() and sqlite3_prepare16()) +** are retained for backwards compatibility, but their use is discouraged. +** ^In the "vX" interfaces, the prepared statement +** that is returned (the [sqlite3_stmt] object) contains a copy of the +** original SQL text. This causes the [sqlite3_step()] interface to +** behave differently in three ways: +** +**
    +**
  1. +** ^If the database schema changes, instead of returning [SQLITE_SCHEMA] as it +** always used to do, [sqlite3_step()] will automatically recompile the SQL +** statement and try to run it again. As many as [SQLITE_MAX_SCHEMA_RETRY] +** retries will occur before sqlite3_step() gives up and returns an error. +**
  2. +** +**
  3. +** ^When an error occurs, [sqlite3_step()] will return one of the detailed +** [error codes] or [extended error codes]. ^The legacy behavior was that +** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code +** and the application would have to make a second call to [sqlite3_reset()] +** in order to find the underlying cause of the problem. With the "v2" prepare +** interfaces, the underlying reason for the error is returned immediately. +**
  4. +** +**
  5. +** ^If the specific value bound to [parameter | host parameter] in the +** WHERE clause might influence the choice of query plan for a statement, +** then the statement will be automatically recompiled, as if there had been +** a schema change, on the first [sqlite3_step()] call following any change +** to the [sqlite3_bind_text | bindings] of that [parameter]. +** ^The specific value of WHERE-clause [parameter] might influence the +** choice of query plan if the parameter is the left-hand side of a [LIKE] +** or [GLOB] operator or if the parameter is compared to an indexed column +** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled. +**
  6. +**
+** +**

^sqlite3_prepare_v3() differs from sqlite3_prepare_v2() only in having +** the extra prepFlags parameter, which is a bit array consisting of zero or +** more of the [SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_*] flags. ^The +** sqlite3_prepare_v2() interface works exactly the same as +** sqlite3_prepare_v3() with a zero prepFlags parameter. +*/ +SQLITE_API int sqlite3_prepare( + sqlite3* db, /* Database handle */ + const char* zSql, /* SQL statement, UTF-8 encoded */ + int nByte, /* Maximum length of zSql in bytes. */ + sqlite3_stmt** ppStmt, /* OUT: Statement handle */ + const char** pzTail /* OUT: Pointer to unused portion of zSql */ + ); +SQLITE_API int sqlite3_prepare_v2( + sqlite3* db, /* Database handle */ + const char* zSql, /* SQL statement, UTF-8 encoded */ + int nByte, /* Maximum length of zSql in bytes. */ + sqlite3_stmt** ppStmt, /* OUT: Statement handle */ + const char** pzTail /* OUT: Pointer to unused portion of zSql */ + ); +SQLITE_API int sqlite3_prepare_v3( + sqlite3* db, /* Database handle */ + const char* zSql, /* SQL statement, UTF-8 encoded */ + int nByte, /* Maximum length of zSql in bytes. */ + unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_ flags */ + sqlite3_stmt** ppStmt, /* OUT: Statement handle */ + const char** pzTail /* OUT: Pointer to unused portion of zSql */ + ); +SQLITE_API int sqlite3_prepare16( + sqlite3* db, /* Database handle */ + const void* zSql, /* SQL statement, UTF-16 encoded */ + int nByte, /* Maximum length of zSql in bytes. */ + sqlite3_stmt** ppStmt, /* OUT: Statement handle */ + const void** pzTail /* OUT: Pointer to unused portion of zSql */ + ); +SQLITE_API int sqlite3_prepare16_v2( + sqlite3* db, /* Database handle */ + const void* zSql, /* SQL statement, UTF-16 encoded */ + int nByte, /* Maximum length of zSql in bytes. */ + sqlite3_stmt** ppStmt, /* OUT: Statement handle */ + const void** pzTail /* OUT: Pointer to unused portion of zSql */ + ); +SQLITE_API int sqlite3_prepare16_v3( + sqlite3* db, /* Database handle */ + const void* zSql, /* SQL statement, UTF-16 encoded */ + int nByte, /* Maximum length of zSql in bytes. */ + unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_ flags */ + sqlite3_stmt** ppStmt, /* OUT: Statement handle */ + const void** pzTail /* OUT: Pointer to unused portion of zSql */ + ); + +/* +** CAPI3REF: Retrieving Statement SQL +** METHOD: sqlite3_stmt +** +** ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8 +** SQL text used to create [prepared statement] P if P was +** created by [sqlite3_prepare_v2()], [sqlite3_prepare_v3()], +** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()]. +** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8 +** string containing the SQL text of prepared statement P with +** [bound parameters] expanded. +** +** ^(For example, if a prepared statement is created using the SQL +** text "SELECT $abc,:xyz" and if parameter $abc is bound to integer 2345 +** and parameter :xyz is unbound, then sqlite3_sql() will return +** the original string, "SELECT $abc,:xyz" but sqlite3_expanded_sql() +** will return "SELECT 2345,NULL".)^ +** +** ^The sqlite3_expanded_sql() interface returns NULL if insufficient memory +** is available to hold the result, or if the result would exceed the +** the maximum string length determined by the [SQLITE_LIMIT_LENGTH]. +** +** ^The [SQLITE_TRACE_SIZE_LIMIT] compile-time option limits the size of +** bound parameter expansions. ^The [SQLITE_OMIT_TRACE] compile-time +** option causes sqlite3_expanded_sql() to always return NULL. +** +** ^The string returned by sqlite3_sql(P) is managed by SQLite and is +** automatically freed when the prepared statement is finalized. +** ^The string returned by sqlite3_expanded_sql(P), on the other hand, +** is obtained from [sqlite3_malloc()] and must be free by the application +** by passing it to [sqlite3_free()]. +*/ +SQLITE_API const char* sqlite3_sql(sqlite3_stmt* pStmt); +SQLITE_API char* sqlite3_expanded_sql(sqlite3_stmt* pStmt); + +/* +** CAPI3REF: Determine If An SQL Statement Writes The Database +** METHOD: sqlite3_stmt +** +** ^The sqlite3_stmt_readonly(X) interface returns true (non-zero) if +** and only if the [prepared statement] X makes no direct changes to +** the content of the database file. +** +** Note that [application-defined SQL functions] or +** [virtual tables] might change the database indirectly as a side effect. +** ^(For example, if an application defines a function "eval()" that +** calls [sqlite3_exec()], then the following SQL statement would +** change the database file through side-effects: +** +**

+**    SELECT eval('DELETE FROM t1') FROM t2;
+** 
+** +** But because the [SELECT] statement does not change the database file +** directly, sqlite3_stmt_readonly() would still return true.)^ +** +** ^Transaction control statements such as [BEGIN], [COMMIT], [ROLLBACK], +** [SAVEPOINT], and [RELEASE] cause sqlite3_stmt_readonly() to return true, +** since the statements themselves do not actually modify the database but +** rather they control the timing of when other statements modify the +** database. ^The [ATTACH] and [DETACH] statements also cause +** sqlite3_stmt_readonly() to return true since, while those statements +** change the configuration of a database connection, they do not make +** changes to the content of the database files on disk. +** ^The sqlite3_stmt_readonly() interface returns true for [BEGIN] since +** [BEGIN] merely sets internal flags, but the [BEGIN|BEGIN IMMEDIATE] and +** [BEGIN|BEGIN EXCLUSIVE] commands do touch the database and so +** sqlite3_stmt_readonly() returns false for those commands. +*/ +SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt* pStmt); + +/* +** CAPI3REF: Determine If A Prepared Statement Has Been Reset +** METHOD: sqlite3_stmt +** +** ^The sqlite3_stmt_busy(S) interface returns true (non-zero) if the +** [prepared statement] S has been stepped at least once using +** [sqlite3_step(S)] but has neither run to completion (returned +** [SQLITE_DONE] from [sqlite3_step(S)]) nor +** been reset using [sqlite3_reset(S)]. ^The sqlite3_stmt_busy(S) +** interface returns false if S is a NULL pointer. If S is not a +** NULL pointer and is not a pointer to a valid [prepared statement] +** object, then the behavior is undefined and probably undesirable. +** +** This interface can be used in combination [sqlite3_next_stmt()] +** to locate all prepared statements associated with a database +** connection that are in need of being reset. This can be used, +** for example, in diagnostic routines to search for prepared +** statements that are holding a transaction open. +*/ +SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*); + +/* +** CAPI3REF: Dynamically Typed Value Object +** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value} +** +** SQLite uses the sqlite3_value object to represent all values +** that can be stored in a database table. SQLite uses dynamic typing +** for the values it stores. ^Values stored in sqlite3_value objects +** can be integers, floating point values, strings, BLOBs, or NULL. +** +** An sqlite3_value object may be either "protected" or "unprotected". +** Some interfaces require a protected sqlite3_value. Other interfaces +** will accept either a protected or an unprotected sqlite3_value. +** Every interface that accepts sqlite3_value arguments specifies +** whether or not it requires a protected sqlite3_value. The +** [sqlite3_value_dup()] interface can be used to construct a new +** protected sqlite3_value from an unprotected sqlite3_value. +** +** The terms "protected" and "unprotected" refer to whether or not +** a mutex is held. An internal mutex is held for a protected +** sqlite3_value object but no mutex is held for an unprotected +** sqlite3_value object. If SQLite is compiled to be single-threaded +** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0) +** or if SQLite is run in one of reduced mutex modes +** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD] +** then there is no distinction between protected and unprotected +** sqlite3_value objects and they can be used interchangeably. However, +** for maximum code portability it is recommended that applications +** still make the distinction between protected and unprotected +** sqlite3_value objects even when not strictly required. +** +** ^The sqlite3_value objects that are passed as parameters into the +** implementation of [application-defined SQL functions] are protected. +** ^The sqlite3_value object returned by +** [sqlite3_column_value()] is unprotected. +** Unprotected sqlite3_value objects may only be used as arguments +** to [sqlite3_result_value()], [sqlite3_bind_value()], and +** [sqlite3_value_dup()]. +** The [sqlite3_value_blob | sqlite3_value_type()] family of +** interfaces require protected sqlite3_value objects. +*/ +typedef struct sqlite3_value sqlite3_value; + +/* +** CAPI3REF: SQL Function Context Object +** +** The context in which an SQL function executes is stored in an +** sqlite3_context object. ^A pointer to an sqlite3_context object +** is always first parameter to [application-defined SQL functions]. +** The application-defined SQL function implementation will pass this +** pointer through into calls to [sqlite3_result_int | sqlite3_result()], +** [sqlite3_aggregate_context()], [sqlite3_user_data()], +** [sqlite3_context_db_handle()], [sqlite3_get_auxdata()], +** and/or [sqlite3_set_auxdata()]. +*/ +typedef struct sqlite3_context sqlite3_context; + +/* +** CAPI3REF: Binding Values To Prepared Statements +** KEYWORDS: {host parameter} {host parameters} {host parameter name} +** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding} +** METHOD: sqlite3_stmt +** +** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants, +** literals may be replaced by a [parameter] that matches one of following +** templates: +** +**
    +**
  • ? +**
  • ?NNN +**
  • :VVV +**
  • @VVV +**
  • $VVV +**
+** +** In the templates above, NNN represents an integer literal, +** and VVV represents an alphanumeric identifier.)^ ^The values of these +** parameters (also called "host parameter names" or "SQL parameters") +** can be set using the sqlite3_bind_*() routines defined here. +** +** ^The first argument to the sqlite3_bind_*() routines is always +** a pointer to the [sqlite3_stmt] object returned from +** [sqlite3_prepare_v2()] or its variants. +** +** ^The second argument is the index of the SQL parameter to be set. +** ^The leftmost SQL parameter has an index of 1. ^When the same named +** SQL parameter is used more than once, second and subsequent +** occurrences have the same index as the first occurrence. +** ^The index for named parameters can be looked up using the +** [sqlite3_bind_parameter_index()] API if desired. ^The index +** for "?NNN" parameters is the value of NNN. +** ^The NNN value must be between 1 and the [sqlite3_limit()] +** parameter [SQLITE_LIMIT_VARIABLE_NUMBER] (default value: 999). +** +** ^The third argument is the value to bind to the parameter. +** ^If the third parameter to sqlite3_bind_text() or sqlite3_bind_text16() +** or sqlite3_bind_blob() is a NULL pointer then the fourth parameter +** is ignored and the end result is the same as sqlite3_bind_null(). +** +** ^(In those routines that have a fourth argument, its value is the +** number of bytes in the parameter. To be clear: the value is the +** number of bytes in the value, not the number of characters.)^ +** ^If the fourth parameter to sqlite3_bind_text() or sqlite3_bind_text16() +** is negative, then the length of the string is +** the number of bytes up to the first zero terminator. +** If the fourth parameter to sqlite3_bind_blob() is negative, then +** the behavior is undefined. +** If a non-negative fourth parameter is provided to sqlite3_bind_text() +** or sqlite3_bind_text16() or sqlite3_bind_text64() then +** that parameter must be the byte offset +** where the NUL terminator would occur assuming the string were NUL +** terminated. If any NUL characters occur at byte offsets less than +** the value of the fourth parameter then the resulting string value will +** contain embedded NULs. The result of expressions involving strings +** with embedded NULs is undefined. +** +** ^The fifth argument to the BLOB and string binding interfaces +** is a destructor used to dispose of the BLOB or +** string after SQLite has finished with it. ^The destructor is called +** to dispose of the BLOB or string even if the call to bind API fails. +** ^If the fifth argument is +** the special value [SQLITE_STATIC], then SQLite assumes that the +** information is in static, unmanaged space and does not need to be freed. +** ^If the fifth argument has the value [SQLITE_TRANSIENT], then +** SQLite makes its own private copy of the data immediately, before +** the sqlite3_bind_*() routine returns. +** +** ^The sixth argument to sqlite3_bind_text64() must be one of +** [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE] +** to specify the encoding of the text in the third parameter. If +** the sixth argument to sqlite3_bind_text64() is not one of the +** allowed values shown above, or if the text encoding is different +** from the encoding specified by the sixth parameter, then the behavior +** is undefined. +** +** ^The sqlite3_bind_zeroblob() routine binds a BLOB of length N that +** is filled with zeroes. ^A zeroblob uses a fixed amount of memory +** (just an integer to hold its size) while it is being processed. +** Zeroblobs are intended to serve as placeholders for BLOBs whose +** content is later written using +** [sqlite3_blob_open | incremental BLOB I/O] routines. +** ^A negative value for the zeroblob results in a zero-length BLOB. +** +** ^The sqlite3_bind_pointer(S,I,P,T,D) routine causes the I-th parameter in +** [prepared statement] S to have an SQL value of NULL, but to also be +** associated with the pointer P of type T. ^D is either a NULL pointer or +** a pointer to a destructor function for P. ^SQLite will invoke the +** destructor D with a single argument of P when it is finished using +** P. The T parameter should be a static string, preferably a string +** literal. The sqlite3_bind_pointer() routine is part of the +** [pointer passing interface] added for SQLite 3.20.0. +** +** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer +** for the [prepared statement] or with a prepared statement for which +** [sqlite3_step()] has been called more recently than [sqlite3_reset()], +** then the call will return [SQLITE_MISUSE]. If any sqlite3_bind_() +** routine is passed a [prepared statement] that has been finalized, the +** result is undefined and probably harmful. +** +** ^Bindings are not cleared by the [sqlite3_reset()] routine. +** ^Unbound parameters are interpreted as NULL. +** +** ^The sqlite3_bind_* routines return [SQLITE_OK] on success or an +** [error code] if anything goes wrong. +** ^[SQLITE_TOOBIG] might be returned if the size of a string or BLOB +** exceeds limits imposed by [sqlite3_limit]([SQLITE_LIMIT_LENGTH]) or +** [SQLITE_MAX_LENGTH]. +** ^[SQLITE_RANGE] is returned if the parameter +** index is out of range. ^[SQLITE_NOMEM] is returned if malloc() fails. +** +** See also: [sqlite3_bind_parameter_count()], +** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()]. +*/ +SQLITE_API int +sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void (*)(void*)); +SQLITE_API int sqlite3_bind_blob64( + sqlite3_stmt*, + int, + const void*, + sqlite3_uint64, + void (*)(void*)); +SQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double); +SQLITE_API int sqlite3_bind_int(sqlite3_stmt*, int, int); +SQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64); +SQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int); +SQLITE_API int +sqlite3_bind_text(sqlite3_stmt*, int, const char*, int, void (*)(void*)); +SQLITE_API int +sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void (*)(void*)); +SQLITE_API int sqlite3_bind_text64( + sqlite3_stmt*, + int, + const char*, + sqlite3_uint64, + void (*)(void*), + unsigned char encoding); +SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*); +SQLITE_API int +sqlite3_bind_pointer(sqlite3_stmt*, int, void*, const char*, void (*)(void*)); +SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n); +SQLITE_API int sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64); + +/* +** CAPI3REF: Number Of SQL Parameters +** METHOD: sqlite3_stmt +** +** ^This routine can be used to find the number of [SQL parameters] +** in a [prepared statement]. SQL parameters are tokens of the +** form "?", "?NNN", ":AAA", "$AAA", or "@AAA" that serve as +** placeholders for values that are [sqlite3_bind_blob | bound] +** to the parameters at a later time. +** +** ^(This routine actually returns the index of the largest (rightmost) +** parameter. For all forms except ?NNN, this will correspond to the +** number of unique parameters. If parameters of the ?NNN form are used, +** there may be gaps in the list.)^ +** +** See also: [sqlite3_bind_blob|sqlite3_bind()], +** [sqlite3_bind_parameter_name()], and +** [sqlite3_bind_parameter_index()]. +*/ +SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*); + +/* +** CAPI3REF: Name Of A Host Parameter +** METHOD: sqlite3_stmt +** +** ^The sqlite3_bind_parameter_name(P,N) interface returns +** the name of the N-th [SQL parameter] in the [prepared statement] P. +** ^(SQL parameters of the form "?NNN" or ":AAA" or "@AAA" or "$AAA" +** have a name which is the string "?NNN" or ":AAA" or "@AAA" or "$AAA" +** respectively. +** In other words, the initial ":" or "$" or "@" or "?" +** is included as part of the name.)^ +** ^Parameters of the form "?" without a following integer have no name +** and are referred to as "nameless" or "anonymous parameters". +** +** ^The first host parameter has an index of 1, not 0. +** +** ^If the value N is out of range or if the N-th parameter is +** nameless, then NULL is returned. ^The returned string is +** always in UTF-8 encoding even if the named parameter was +** originally specified as UTF-16 in [sqlite3_prepare16()], +** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()]. +** +** See also: [sqlite3_bind_blob|sqlite3_bind()], +** [sqlite3_bind_parameter_count()], and +** [sqlite3_bind_parameter_index()]. +*/ +SQLITE_API const char* sqlite3_bind_parameter_name(sqlite3_stmt*, int); + +/* +** CAPI3REF: Index Of A Parameter With A Given Name +** METHOD: sqlite3_stmt +** +** ^Return the index of an SQL parameter given its name. ^The +** index value returned is suitable for use as the second +** parameter to [sqlite3_bind_blob|sqlite3_bind()]. ^A zero +** is returned if no matching parameter is found. ^The parameter +** name must be given in UTF-8 even if the original statement +** was prepared from UTF-16 text using [sqlite3_prepare16_v2()] or +** [sqlite3_prepare16_v3()]. +** +** See also: [sqlite3_bind_blob|sqlite3_bind()], +** [sqlite3_bind_parameter_count()], and +** [sqlite3_bind_parameter_name()]. +*/ +SQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt*, const char* zName); + +/* +** CAPI3REF: Reset All Bindings On A Prepared Statement +** METHOD: sqlite3_stmt +** +** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset +** the [sqlite3_bind_blob | bindings] on a [prepared statement]. +** ^Use this routine to reset all host parameters to NULL. +*/ +SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*); + +/* +** CAPI3REF: Number Of Columns In A Result Set +** METHOD: sqlite3_stmt +** +** ^Return the number of columns in the result set returned by the +** [prepared statement]. ^If this routine returns 0, that means the +** [prepared statement] returns no data (for example an [UPDATE]). +** ^However, just because this routine returns a positive number does not +** mean that one or more rows of data will be returned. ^A SELECT statement +** will always have a positive sqlite3_column_count() but depending on the +** WHERE clause constraints and the table content, it might return no rows. +** +** See also: [sqlite3_data_count()] +*/ +SQLITE_API int sqlite3_column_count(sqlite3_stmt* pStmt); + +/* +** CAPI3REF: Column Names In A Result Set +** METHOD: sqlite3_stmt +** +** ^These routines return the name assigned to a particular column +** in the result set of a [SELECT] statement. ^The sqlite3_column_name() +** interface returns a pointer to a zero-terminated UTF-8 string +** and sqlite3_column_name16() returns a pointer to a zero-terminated +** UTF-16 string. ^The first parameter is the [prepared statement] +** that implements the [SELECT] statement. ^The second parameter is the +** column number. ^The leftmost column is number 0. +** +** ^The returned string pointer is valid until either the [prepared statement] +** is destroyed by [sqlite3_finalize()] or until the statement is automatically +** reprepared by the first call to [sqlite3_step()] for a particular run +** or until the next call to +** sqlite3_column_name() or sqlite3_column_name16() on the same column. +** +** ^If sqlite3_malloc() fails during the processing of either routine +** (for example during a conversion from UTF-8 to UTF-16) then a +** NULL pointer is returned. +** +** ^The name of a result column is the value of the "AS" clause for +** that column, if there is an AS clause. If there is no AS clause +** then the name of the column is unspecified and may change from +** one release of SQLite to the next. +*/ +SQLITE_API const char* sqlite3_column_name(sqlite3_stmt*, int N); +SQLITE_API const void* sqlite3_column_name16(sqlite3_stmt*, int N); + +/* +** CAPI3REF: Source Of Data In A Query Result +** METHOD: sqlite3_stmt +** +** ^These routines provide a means to determine the database, table, and +** table column that is the origin of a particular result column in +** [SELECT] statement. +** ^The name of the database or table or column can be returned as +** either a UTF-8 or UTF-16 string. ^The _database_ routines return +** the database name, the _table_ routines return the table name, and +** the origin_ routines return the column name. +** ^The returned string is valid until the [prepared statement] is destroyed +** using [sqlite3_finalize()] or until the statement is automatically +** reprepared by the first call to [sqlite3_step()] for a particular run +** or until the same information is requested +** again in a different encoding. +** +** ^The names returned are the original un-aliased names of the +** database, table, and column. +** +** ^The first argument to these interfaces is a [prepared statement]. +** ^These functions return information about the Nth result column returned by +** the statement, where N is the second function argument. +** ^The left-most column is column 0 for these routines. +** +** ^If the Nth column returned by the statement is an expression or +** subquery and is not a column value, then all of these functions return +** NULL. ^These routine might also return NULL if a memory allocation error +** occurs. ^Otherwise, they return the name of the attached database, table, +** or column that query result column was extracted from. +** +** ^As with all other SQLite APIs, those whose names end with "16" return +** UTF-16 encoded strings and the other functions return UTF-8. +** +** ^These APIs are only available if the library was compiled with the +** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol. +** +** If two or more threads call one or more of these routines against the same +** prepared statement and column at the same time then the results are +** undefined. +** +** If two or more threads call one or more +** [sqlite3_column_database_name | column metadata interfaces] +** for the same [prepared statement] and result column +** at the same time then the results are undefined. +*/ +SQLITE_API const char* sqlite3_column_database_name(sqlite3_stmt*, int); +SQLITE_API const void* sqlite3_column_database_name16(sqlite3_stmt*, int); +SQLITE_API const char* sqlite3_column_table_name(sqlite3_stmt*, int); +SQLITE_API const void* sqlite3_column_table_name16(sqlite3_stmt*, int); +SQLITE_API const char* sqlite3_column_origin_name(sqlite3_stmt*, int); +SQLITE_API const void* sqlite3_column_origin_name16(sqlite3_stmt*, int); + +/* +** CAPI3REF: Declared Datatype Of A Query Result +** METHOD: sqlite3_stmt +** +** ^(The first parameter is a [prepared statement]. +** If this statement is a [SELECT] statement and the Nth column of the +** returned result set of that [SELECT] is a table column (not an +** expression or subquery) then the declared type of the table +** column is returned.)^ ^If the Nth column of the result set is an +** expression or subquery, then a NULL pointer is returned. +** ^The returned string is always UTF-8 encoded. +** +** ^(For example, given the database schema: +** +** CREATE TABLE t1(c1 VARIANT); +** +** and the following statement to be compiled: +** +** SELECT c1 + 1, c1 FROM t1; +** +** this routine would return the string "VARIANT" for the second result +** column (i==1), and a NULL pointer for the first result column (i==0).)^ +** +** ^SQLite uses dynamic run-time typing. ^So just because a column +** is declared to contain a particular type does not mean that the +** data stored in that column is of the declared type. SQLite is +** strongly typed, but the typing is dynamic not static. ^Type +** is associated with individual values, not with the containers +** used to hold those values. +*/ +SQLITE_API const char* sqlite3_column_decltype(sqlite3_stmt*, int); +SQLITE_API const void* sqlite3_column_decltype16(sqlite3_stmt*, int); + +/* +** CAPI3REF: Evaluate An SQL Statement +** METHOD: sqlite3_stmt +** +** After a [prepared statement] has been prepared using any of +** [sqlite3_prepare_v2()], [sqlite3_prepare_v3()], [sqlite3_prepare16_v2()], +** or [sqlite3_prepare16_v3()] or one of the legacy +** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function +** must be called one or more times to evaluate the statement. +** +** The details of the behavior of the sqlite3_step() interface depend +** on whether the statement was prepared using the newer "vX" interfaces +** [sqlite3_prepare_v3()], [sqlite3_prepare_v2()], [sqlite3_prepare16_v3()], +** [sqlite3_prepare16_v2()] or the older legacy +** interfaces [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the +** new "vX" interface is recommended for new applications but the legacy +** interface will continue to be supported. +** +** ^In the legacy interface, the return value will be either [SQLITE_BUSY], +** [SQLITE_DONE], [SQLITE_ROW], [SQLITE_ERROR], or [SQLITE_MISUSE]. +** ^With the "v2" interface, any of the other [result codes] or +** [extended result codes] might be returned as well. +** +** ^[SQLITE_BUSY] means that the database engine was unable to acquire the +** database locks it needs to do its job. ^If the statement is a [COMMIT] +** or occurs outside of an explicit transaction, then you can retry the +** statement. If the statement is not a [COMMIT] and occurs within an +** explicit transaction then you should rollback the transaction before +** continuing. +** +** ^[SQLITE_DONE] means that the statement has finished executing +** successfully. sqlite3_step() should not be called again on this virtual +** machine without first calling [sqlite3_reset()] to reset the virtual +** machine back to its initial state. +** +** ^If the SQL statement being executed returns any data, then [SQLITE_ROW] +** is returned each time a new row of data is ready for processing by the +** caller. The values may be accessed using the [column access functions]. +** sqlite3_step() is called again to retrieve the next row of data. +** +** ^[SQLITE_ERROR] means that a run-time error (such as a constraint +** violation) has occurred. sqlite3_step() should not be called again on +** the VM. More information may be found by calling [sqlite3_errmsg()]. +** ^With the legacy interface, a more specific error code (for example, +** [SQLITE_INTERRUPT], [SQLITE_SCHEMA], [SQLITE_CORRUPT], and so forth) +** can be obtained by calling [sqlite3_reset()] on the +** [prepared statement]. ^In the "v2" interface, +** the more specific error code is returned directly by sqlite3_step(). +** +** [SQLITE_MISUSE] means that the this routine was called inappropriately. +** Perhaps it was called on a [prepared statement] that has +** already been [sqlite3_finalize | finalized] or on one that had +** previously returned [SQLITE_ERROR] or [SQLITE_DONE]. Or it could +** be the case that the same database connection is being used by two or +** more threads at the same moment in time. +** +** For all versions of SQLite up to and including 3.6.23.1, a call to +** [sqlite3_reset()] was required after sqlite3_step() returned anything +** other than [SQLITE_ROW] before any subsequent invocation of +** sqlite3_step(). Failure to reset the prepared statement using +** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from +** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1], +** sqlite3_step() began +** calling [sqlite3_reset()] automatically in this circumstance rather +** than returning [SQLITE_MISUSE]. This is not considered a compatibility +** break because any application that ever receives an SQLITE_MISUSE error +** is broken by definition. The [SQLITE_OMIT_AUTORESET] compile-time option +** can be used to restore the legacy behavior. +** +** Goofy Interface Alert: In the legacy interface, the sqlite3_step() +** API always returns a generic error code, [SQLITE_ERROR], following any +** error other than [SQLITE_BUSY] and [SQLITE_MISUSE]. You must call +** [sqlite3_reset()] or [sqlite3_finalize()] in order to find one of the +** specific [error codes] that better describes the error. +** We admit that this is a goofy design. The problem has been fixed +** with the "v2" interface. If you prepare all of your SQL statements +** using [sqlite3_prepare_v3()] or [sqlite3_prepare_v2()] +** or [sqlite3_prepare16_v2()] or [sqlite3_prepare16_v3()] instead +** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces, +** then the more specific [error codes] are returned directly +** by sqlite3_step(). The use of the "vX" interfaces is recommended. +*/ +SQLITE_API int sqlite3_step(sqlite3_stmt*); + +/* +** CAPI3REF: Number of columns in a result set +** METHOD: sqlite3_stmt +** +** ^The sqlite3_data_count(P) interface returns the number of columns in the +** current row of the result set of [prepared statement] P. +** ^If prepared statement P does not have results ready to return +** (via calls to the [sqlite3_column_int | sqlite3_column_*()] of +** interfaces) then sqlite3_data_count(P) returns 0. +** ^The sqlite3_data_count(P) routine also returns 0 if P is a NULL pointer. +** ^The sqlite3_data_count(P) routine returns 0 if the previous call to +** [sqlite3_step](P) returned [SQLITE_DONE]. ^The sqlite3_data_count(P) +** will return non-zero if previous call to [sqlite3_step](P) returned +** [SQLITE_ROW], except in the case of the [PRAGMA incremental_vacuum] +** where it always returns zero since each step of that multi-step +** pragma returns 0 columns of data. +** +** See also: [sqlite3_column_count()] +*/ +SQLITE_API int sqlite3_data_count(sqlite3_stmt* pStmt); + +/* +** CAPI3REF: Fundamental Datatypes +** KEYWORDS: SQLITE_TEXT +** +** ^(Every value in SQLite has one of five fundamental datatypes: +** +**
    +**
  • 64-bit signed integer +**
  • 64-bit IEEE floating point number +**
  • string +**
  • BLOB +**
  • NULL +**
)^ +** +** These constants are codes for each of those types. +** +** Note that the SQLITE_TEXT constant was also used in SQLite version 2 +** for a completely different meaning. Software that links against both +** SQLite version 2 and SQLite version 3 should use SQLITE3_TEXT, not +** SQLITE_TEXT. +*/ +#define SQLITE_INTEGER 1 +#define SQLITE_FLOAT 2 +#define SQLITE_BLOB 4 +#define SQLITE_NULL 5 +#ifdef SQLITE_TEXT +#undef SQLITE_TEXT +#else +#define SQLITE_TEXT 3 +#endif +#define SQLITE3_TEXT 3 + +/* +** CAPI3REF: Result Values From A Query +** KEYWORDS: {column access functions} +** METHOD: sqlite3_stmt +** +** Summary: +**
+**
sqlite3_column_blobBLOB result +**
sqlite3_column_doubleREAL result +**
sqlite3_column_int32-bit INTEGER result +**
sqlite3_column_int6464-bit INTEGER result +**
sqlite3_column_textUTF-8 TEXT result +**
sqlite3_column_text16UTF-16 TEXT result +**
sqlite3_column_valueThe result as an +** [sqlite3_value|unprotected sqlite3_value] object. +**
    +**
sqlite3_column_bytesSize of a BLOB +** or a UTF-8 TEXT result in bytes +**
sqlite3_column_bytes16   +** →  Size of UTF-16 +** TEXT in bytes +**
sqlite3_column_typeDefault +** datatype of the result +**
+** +** Details: +** +** ^These routines return information about a single column of the current +** result row of a query. ^In every case the first argument is a pointer +** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*] +** that was returned from [sqlite3_prepare_v2()] or one of its variants) +** and the second argument is the index of the column for which information +** should be returned. ^The leftmost column of the result set has the index 0. +** ^The number of columns in the result can be determined using +** [sqlite3_column_count()]. +** +** If the SQL statement does not currently point to a valid row, or if the +** column index is out of range, the result is undefined. +** These routines may only be called when the most recent call to +** [sqlite3_step()] has returned [SQLITE_ROW] and neither +** [sqlite3_reset()] nor [sqlite3_finalize()] have been called subsequently. +** If any of these routines are called after [sqlite3_reset()] or +** [sqlite3_finalize()] or after [sqlite3_step()] has returned +** something other than [SQLITE_ROW], the results are undefined. +** If [sqlite3_step()] or [sqlite3_reset()] or [sqlite3_finalize()] +** are called from a different thread while any of these routines +** are pending, then the results are undefined. +** +** The first six interfaces (_blob, _double, _int, _int64, _text, and _text16) +** each return the value of a result column in a specific data format. If +** the result column is not initially in the requested format (for example, +** if the query returns an integer but the sqlite3_column_text() interface +** is used to extract the value) then an automatic type conversion is performed. +** +** ^The sqlite3_column_type() routine returns the +** [SQLITE_INTEGER | datatype code] for the initial data type +** of the result column. ^The returned value is one of [SQLITE_INTEGER], +** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL]. +** The return value of sqlite3_column_type() can be used to decide which +** of the first six interface should be used to extract the column value. +** The value returned by sqlite3_column_type() is only meaningful if no +** automatic type conversions have occurred for the value in question. +** After a type conversion, the result of calling sqlite3_column_type() +** is undefined, though harmless. Future +** versions of SQLite may change the behavior of sqlite3_column_type() +** following a type conversion. +** +** If the result is a BLOB or a TEXT string, then the sqlite3_column_bytes() +** or sqlite3_column_bytes16() interfaces can be used to determine the size +** of that BLOB or string. +** +** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes() +** routine returns the number of bytes in that BLOB or string. +** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts +** the string to UTF-8 and then returns the number of bytes. +** ^If the result is a numeric value then sqlite3_column_bytes() uses +** [sqlite3_snprintf()] to convert that value to a UTF-8 string and returns +** the number of bytes in that string. +** ^If the result is NULL, then sqlite3_column_bytes() returns zero. +** +** ^If the result is a BLOB or UTF-16 string then the sqlite3_column_bytes16() +** routine returns the number of bytes in that BLOB or string. +** ^If the result is a UTF-8 string, then sqlite3_column_bytes16() converts +** the string to UTF-16 and then returns the number of bytes. +** ^If the result is a numeric value then sqlite3_column_bytes16() uses +** [sqlite3_snprintf()] to convert that value to a UTF-16 string and returns +** the number of bytes in that string. +** ^If the result is NULL, then sqlite3_column_bytes16() returns zero. +** +** ^The values returned by [sqlite3_column_bytes()] and +** [sqlite3_column_bytes16()] do not include the zero terminators at the end +** of the string. ^For clarity: the values returned by +** [sqlite3_column_bytes()] and [sqlite3_column_bytes16()] are the number of +** bytes in the string, not the number of characters. +** +** ^Strings returned by sqlite3_column_text() and sqlite3_column_text16(), +** even empty strings, are always zero-terminated. ^The return +** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer. +** +** Warning: ^The object returned by [sqlite3_column_value()] is an +** [unprotected sqlite3_value] object. In a multithreaded environment, +** an unprotected sqlite3_value object may only be used safely with +** [sqlite3_bind_value()] and [sqlite3_result_value()]. +** If the [unprotected sqlite3_value] object returned by +** [sqlite3_column_value()] is used in any other way, including calls +** to routines like [sqlite3_value_int()], [sqlite3_value_text()], +** or [sqlite3_value_bytes()], the behavior is not threadsafe. +** Hence, the sqlite3_column_value() interface +** is normally only useful within the implementation of +** [application-defined SQL functions] or [virtual tables], not within +** top-level application code. +** +** The these routines may attempt to convert the datatype of the result. +** ^For example, if the internal representation is FLOAT and a text result +** is requested, [sqlite3_snprintf()] is used internally to perform the +** conversion automatically. ^(The following table details the conversions +** that are applied: +** +**
+** +**
Internal
Type
Requested
Type
Conversion +** +**
NULL INTEGER Result is 0 +**
NULL FLOAT Result is 0.0 +**
NULL TEXT Result is a NULL pointer +**
NULL BLOB Result is a NULL pointer +**
INTEGER FLOAT Convert from integer to float +**
INTEGER TEXT ASCII rendering of the integer +**
INTEGER BLOB Same as INTEGER->TEXT +**
FLOAT INTEGER [CAST] to INTEGER +**
FLOAT TEXT ASCII rendering of the float +**
FLOAT BLOB [CAST] to BLOB +**
TEXT INTEGER [CAST] to INTEGER +**
TEXT FLOAT [CAST] to REAL +**
TEXT BLOB No change +**
BLOB INTEGER [CAST] to INTEGER +**
BLOB FLOAT [CAST] to REAL +**
BLOB TEXT Add a zero terminator if needed +**
+**
)^ +** +** Note that when type conversions occur, pointers returned by prior +** calls to sqlite3_column_blob(), sqlite3_column_text(), and/or +** sqlite3_column_text16() may be invalidated. +** Type conversions and pointer invalidations might occur +** in the following cases: +** +**
    +**
  • The initial content is a BLOB and sqlite3_column_text() or +** sqlite3_column_text16() is called. A zero-terminator might +** need to be added to the string.
  • +**
  • The initial content is UTF-8 text and sqlite3_column_bytes16() or +** sqlite3_column_text16() is called. The content must be converted +** to UTF-16.
  • +**
  • The initial content is UTF-16 text and sqlite3_column_bytes() or +** sqlite3_column_text() is called. The content must be converted +** to UTF-8.
  • +**
+** +** ^Conversions between UTF-16be and UTF-16le are always done in place and do +** not invalidate a prior pointer, though of course the content of the buffer +** that the prior pointer references will have been modified. Other kinds +** of conversion are done in place when it is possible, but sometimes they +** are not possible and in those cases prior pointers are invalidated. +** +** The safest policy is to invoke these routines +** in one of the following ways: +** +**
    +**
  • sqlite3_column_text() followed by sqlite3_column_bytes()
  • +**
  • sqlite3_column_blob() followed by sqlite3_column_bytes()
  • +**
  • sqlite3_column_text16() followed by sqlite3_column_bytes16()
  • +**
+** +** In other words, you should call sqlite3_column_text(), +** sqlite3_column_blob(), or sqlite3_column_text16() first to force the result +** into the desired format, then invoke sqlite3_column_bytes() or +** sqlite3_column_bytes16() to find the size of the result. Do not mix calls +** to sqlite3_column_text() or sqlite3_column_blob() with calls to +** sqlite3_column_bytes16(), and do not mix calls to sqlite3_column_text16() +** with calls to sqlite3_column_bytes(). +** +** ^The pointers returned are valid until a type conversion occurs as +** described above, or until [sqlite3_step()] or [sqlite3_reset()] or +** [sqlite3_finalize()] is called. ^The memory space used to hold strings +** and BLOBs is freed automatically. Do not pass the pointers returned +** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into +** [sqlite3_free()]. +** +** ^(If a memory allocation error occurs during the evaluation of any +** of these routines, a default value is returned. The default value +** is either the integer 0, the floating point number 0.0, or a NULL +** pointer. Subsequent calls to [sqlite3_errcode()] will return +** [SQLITE_NOMEM].)^ +*/ +SQLITE_API const void* sqlite3_column_blob(sqlite3_stmt*, int iCol); +SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol); +SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol); +SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol); +SQLITE_API const unsigned char* sqlite3_column_text(sqlite3_stmt*, int iCol); +SQLITE_API const void* sqlite3_column_text16(sqlite3_stmt*, int iCol); +SQLITE_API sqlite3_value* sqlite3_column_value(sqlite3_stmt*, int iCol); +SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol); +SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol); +SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol); + +/* +** CAPI3REF: Destroy A Prepared Statement Object +** DESTRUCTOR: sqlite3_stmt +** +** ^The sqlite3_finalize() function is called to delete a [prepared statement]. +** ^If the most recent evaluation of the statement encountered no errors +** or if the statement is never been evaluated, then sqlite3_finalize() returns +** SQLITE_OK. ^If the most recent evaluation of statement S failed, then +** sqlite3_finalize(S) returns the appropriate [error code] or +** [extended error code]. +** +** ^The sqlite3_finalize(S) routine can be called at any point during +** the life cycle of [prepared statement] S: +** before statement S is ever evaluated, after +** one or more calls to [sqlite3_reset()], or after any call +** to [sqlite3_step()] regardless of whether or not the statement has +** completed execution. +** +** ^Invoking sqlite3_finalize() on a NULL pointer is a harmless no-op. +** +** The application must finalize every [prepared statement] in order to avoid +** resource leaks. It is a grievous error for the application to try to use +** a prepared statement after it has been finalized. Any use of a prepared +** statement after it has been finalized can result in undefined and +** undesirable behavior such as segfaults and heap corruption. +*/ +SQLITE_API int sqlite3_finalize(sqlite3_stmt* pStmt); + +/* +** CAPI3REF: Reset A Prepared Statement Object +** METHOD: sqlite3_stmt +** +** The sqlite3_reset() function is called to reset a [prepared statement] +** object back to its initial state, ready to be re-executed. +** ^Any SQL statement variables that had values bound to them using +** the [sqlite3_bind_blob | sqlite3_bind_*() API] retain their values. +** Use [sqlite3_clear_bindings()] to reset the bindings. +** +** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S +** back to the beginning of its program. +** +** ^If the most recent call to [sqlite3_step(S)] for the +** [prepared statement] S returned [SQLITE_ROW] or [SQLITE_DONE], +** or if [sqlite3_step(S)] has never before been called on S, +** then [sqlite3_reset(S)] returns [SQLITE_OK]. +** +** ^If the most recent call to [sqlite3_step(S)] for the +** [prepared statement] S indicated an error, then +** [sqlite3_reset(S)] returns an appropriate [error code]. +** +** ^The [sqlite3_reset(S)] interface does not change the values +** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S. +*/ +SQLITE_API int sqlite3_reset(sqlite3_stmt* pStmt); + +/* +** CAPI3REF: Create Or Redefine SQL Functions +** KEYWORDS: {function creation routines} +** KEYWORDS: {application-defined SQL function} +** KEYWORDS: {application-defined SQL functions} +** METHOD: sqlite3 +** +** ^These functions (collectively known as "function creation routines") +** are used to add SQL functions or aggregates or to redefine the behavior +** of existing SQL functions or aggregates. The only differences between +** these routines are the text encoding expected for +** the second parameter (the name of the function being created) +** and the presence or absence of a destructor callback for +** the application data pointer. +** +** ^The first parameter is the [database connection] to which the SQL +** function is to be added. ^If an application uses more than one database +** connection then application-defined SQL functions must be added +** to each database connection separately. +** +** ^The second parameter is the name of the SQL function to be created or +** redefined. ^The length of the name is limited to 255 bytes in a UTF-8 +** representation, exclusive of the zero-terminator. ^Note that the name +** length limit is in UTF-8 bytes, not characters nor UTF-16 bytes. +** ^Any attempt to create a function with a longer name +** will result in [SQLITE_MISUSE] being returned. +** +** ^The third parameter (nArg) +** is the number of arguments that the SQL function or +** aggregate takes. ^If this parameter is -1, then the SQL function or +** aggregate may take any number of arguments between 0 and the limit +** set by [sqlite3_limit]([SQLITE_LIMIT_FUNCTION_ARG]). If the third +** parameter is less than -1 or greater than 127 then the behavior is +** undefined. +** +** ^The fourth parameter, eTextRep, specifies what +** [SQLITE_UTF8 | text encoding] this SQL function prefers for +** its parameters. The application should set this parameter to +** [SQLITE_UTF16LE] if the function implementation invokes +** [sqlite3_value_text16le()] on an input, or [SQLITE_UTF16BE] if the +** implementation invokes [sqlite3_value_text16be()] on an input, or +** [SQLITE_UTF16] if [sqlite3_value_text16()] is used, or [SQLITE_UTF8] +** otherwise. ^The same SQL function may be registered multiple times using +** different preferred text encodings, with different implementations for +** each encoding. +** ^When multiple implementations of the same function are available, SQLite +** will pick the one that involves the least amount of data conversion. +** +** ^The fourth parameter may optionally be ORed with [SQLITE_DETERMINISTIC] +** to signal that the function will always return the same result given +** the same inputs within a single SQL statement. Most SQL functions are +** deterministic. The built-in [random()] SQL function is an example of a +** function that is not deterministic. The SQLite query planner is able to +** perform additional optimizations on deterministic functions, so use +** of the [SQLITE_DETERMINISTIC] flag is recommended where possible. +** +** ^(The fifth parameter is an arbitrary pointer. The implementation of the +** function can gain access to this pointer using [sqlite3_user_data()].)^ +** +** ^The sixth, seventh and eighth parameters, xFunc, xStep and xFinal, are +** pointers to C-language functions that implement the SQL function or +** aggregate. ^A scalar SQL function requires an implementation of the xFunc +** callback only; NULL pointers must be passed as the xStep and xFinal +** parameters. ^An aggregate SQL function requires an implementation of xStep +** and xFinal and NULL pointer must be passed for xFunc. ^To delete an existing +** SQL function or aggregate, pass NULL pointers for all three function +** callbacks. +** +** ^(If the ninth parameter to sqlite3_create_function_v2() is not NULL, +** then it is destructor for the application data pointer. +** The destructor is invoked when the function is deleted, either by being +** overloaded or when the database connection closes.)^ +** ^The destructor is also invoked if the call to +** sqlite3_create_function_v2() fails. +** ^When the destructor callback of the tenth parameter is invoked, it +** is passed a single argument which is a copy of the application data +** pointer which was the fifth parameter to sqlite3_create_function_v2(). +** +** ^It is permitted to register multiple implementations of the same +** functions with the same name but with either differing numbers of +** arguments or differing preferred text encodings. ^SQLite will use +** the implementation that most closely matches the way in which the +** SQL function is used. ^A function implementation with a non-negative +** nArg parameter is a better match than a function implementation with +** a negative nArg. ^A function where the preferred text encoding +** matches the database encoding is a better +** match than a function where the encoding is different. +** ^A function where the encoding difference is between UTF16le and UTF16be +** is a closer match than a function where the encoding difference is +** between UTF8 and UTF16. +** +** ^Built-in functions may be overloaded by new application-defined functions. +** +** ^An application-defined function is permitted to call other +** SQLite interfaces. However, such calls must not +** close the database connection nor finalize or reset the prepared +** statement in which the function is running. +*/ +SQLITE_API int sqlite3_create_function( + sqlite3* db, + const char* zFunctionName, + int nArg, + int eTextRep, + void* pApp, + void (*xFunc)(sqlite3_context*, int, sqlite3_value**), + void (*xStep)(sqlite3_context*, int, sqlite3_value**), + void (*xFinal)(sqlite3_context*)); +SQLITE_API int sqlite3_create_function16( + sqlite3* db, + const void* zFunctionName, + int nArg, + int eTextRep, + void* pApp, + void (*xFunc)(sqlite3_context*, int, sqlite3_value**), + void (*xStep)(sqlite3_context*, int, sqlite3_value**), + void (*xFinal)(sqlite3_context*)); +SQLITE_API int sqlite3_create_function_v2( + sqlite3* db, + const char* zFunctionName, + int nArg, + int eTextRep, + void* pApp, + void (*xFunc)(sqlite3_context*, int, sqlite3_value**), + void (*xStep)(sqlite3_context*, int, sqlite3_value**), + void (*xFinal)(sqlite3_context*), + void (*xDestroy)(void*)); + +/* +** CAPI3REF: Text Encodings +** +** These constant define integer codes that represent the various +** text encodings supported by SQLite. +*/ +#define SQLITE_UTF8 1 /* IMP: R-37514-35566 */ +#define SQLITE_UTF16LE 2 /* IMP: R-03371-37637 */ +#define SQLITE_UTF16BE 3 /* IMP: R-51971-34154 */ +#define SQLITE_UTF16 4 /* Use native byte order */ +#define SQLITE_ANY 5 /* Deprecated */ +#define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */ + +/* +** CAPI3REF: Function Flags +** +** These constants may be ORed together with the +** [SQLITE_UTF8 | preferred text encoding] as the fourth argument +** to [sqlite3_create_function()], [sqlite3_create_function16()], or +** [sqlite3_create_function_v2()]. +*/ +#define SQLITE_DETERMINISTIC 0x800 + +/* +** CAPI3REF: Deprecated Functions +** DEPRECATED +** +** These functions are [deprecated]. In order to maintain +** backwards compatibility with older code, these functions continue +** to be supported. However, new applications should avoid +** the use of these functions. To encourage programmers to avoid +** these functions, we will not explain what they do. +*/ +#ifndef SQLITE_OMIT_DEPRECATED +SQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*); +SQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*); +SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings( + sqlite3_stmt*, + sqlite3_stmt*); +SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void); +SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void); +SQLITE_API SQLITE_DEPRECATED int +sqlite3_memory_alarm(void (*)(void*, sqlite3_int64, int), void*, sqlite3_int64); +#endif + +/* +** CAPI3REF: Obtaining SQL Values +** METHOD: sqlite3_value +** +** Summary: +**
+**
sqlite3_value_blobBLOB value +**
sqlite3_value_doubleREAL value +**
sqlite3_value_int32-bit INTEGER value +**
sqlite3_value_int6464-bit INTEGER value +**
sqlite3_value_pointerPointer value +**
sqlite3_value_textUTF-8 TEXT value +**
sqlite3_value_text16UTF-16 TEXT value in +** the native byteorder +**
sqlite3_value_text16beUTF-16be TEXT value +**
sqlite3_value_text16leUTF-16le TEXT value +**
    +**
sqlite3_value_bytesSize of a BLOB +** or a UTF-8 TEXT in bytes +**
sqlite3_value_bytes16   +** →  Size of UTF-16 +** TEXT in bytes +**
sqlite3_value_typeDefault +** datatype of the value +**
sqlite3_value_numeric_type   +** →  Best numeric datatype of the value +**
sqlite3_value_nochange   +** →  True if the column is unchanged in an UPDATE +** against a virtual table. +**
+** +** Details: +** +** These routines extract type, size, and content information from +** [protected sqlite3_value] objects. Protected sqlite3_value objects +** are used to pass parameter information into implementation of +** [application-defined SQL functions] and [virtual tables]. +** +** These routines work only with [protected sqlite3_value] objects. +** Any attempt to use these routines on an [unprotected sqlite3_value] +** is not threadsafe. +** +** ^These routines work just like the corresponding [column access functions] +** except that these routines take a single [protected sqlite3_value] object +** pointer instead of a [sqlite3_stmt*] pointer and an integer column number. +** +** ^The sqlite3_value_text16() interface extracts a UTF-16 string +** in the native byte-order of the host machine. ^The +** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces +** extract UTF-16 strings as big-endian and little-endian respectively. +** +** ^If [sqlite3_value] object V was initialized +** using [sqlite3_bind_pointer(S,I,P,X,D)] or [sqlite3_result_pointer(C,P,X,D)] +** and if X and Y are strings that compare equal according to strcmp(X,Y), +** then sqlite3_value_pointer(V,Y) will return the pointer P. ^Otherwise, +** sqlite3_value_pointer(V,Y) returns a NULL. The sqlite3_bind_pointer() +** routine is part of the [pointer passing interface] added for SQLite 3.20.0. +** +** ^(The sqlite3_value_type(V) interface returns the +** [SQLITE_INTEGER | datatype code] for the initial datatype of the +** [sqlite3_value] object V. The returned value is one of [SQLITE_INTEGER], +** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].)^ +** Other interfaces might change the datatype for an sqlite3_value object. +** For example, if the datatype is initially SQLITE_INTEGER and +** sqlite3_value_text(V) is called to extract a text value for that +** integer, then subsequent calls to sqlite3_value_type(V) might return +** SQLITE_TEXT. Whether or not a persistent internal datatype conversion +** occurs is undefined and may change from one release of SQLite to the next. +** +** ^(The sqlite3_value_numeric_type() interface attempts to apply +** numeric affinity to the value. This means that an attempt is +** made to convert the value to an integer or floating point. If +** such a conversion is possible without loss of information (in other +** words, if the value is a string that looks like a number) +** then the conversion is performed. Otherwise no conversion occurs. +** The [SQLITE_INTEGER | datatype] after conversion is returned.)^ +** +** ^Within the [xUpdate] method of a [virtual table], the +** sqlite3_value_nochange(X) interface returns true if and only if +** the column corresponding to X is unchanged by the UPDATE operation +** that the xUpdate method call was invoked to implement and if +** and the prior [xColumn] method call that was invoked to extracted +** the value for that column returned without setting a result (probably +** because it queried [sqlite3_vtab_nochange()] and found that the column +** was unchanging). ^Within an [xUpdate] method, any value for which +** sqlite3_value_nochange(X) is true will in all other respects appear +** to be a NULL value. If sqlite3_value_nochange(X) is invoked anywhere other +** than within an [xUpdate] method call for an UPDATE statement, then +** the return value is arbitrary and meaningless. +** +** Please pay particular attention to the fact that the pointer returned +** from [sqlite3_value_blob()], [sqlite3_value_text()], or +** [sqlite3_value_text16()] can be invalidated by a subsequent call to +** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()], +** or [sqlite3_value_text16()]. +** +** These routines must be called from the same thread as +** the SQL function that supplied the [sqlite3_value*] parameters. +*/ +SQLITE_API const void* sqlite3_value_blob(sqlite3_value*); +SQLITE_API double sqlite3_value_double(sqlite3_value*); +SQLITE_API int sqlite3_value_int(sqlite3_value*); +SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*); +SQLITE_API void* sqlite3_value_pointer(sqlite3_value*, const char*); +SQLITE_API const unsigned char* sqlite3_value_text(sqlite3_value*); +SQLITE_API const void* sqlite3_value_text16(sqlite3_value*); +SQLITE_API const void* sqlite3_value_text16le(sqlite3_value*); +SQLITE_API const void* sqlite3_value_text16be(sqlite3_value*); +SQLITE_API int sqlite3_value_bytes(sqlite3_value*); +SQLITE_API int sqlite3_value_bytes16(sqlite3_value*); +SQLITE_API int sqlite3_value_type(sqlite3_value*); +SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*); +SQLITE_API int sqlite3_value_nochange(sqlite3_value*); + +/* +** CAPI3REF: Finding The Subtype Of SQL Values +** METHOD: sqlite3_value +** +** The sqlite3_value_subtype(V) function returns the subtype for +** an [application-defined SQL function] argument V. The subtype +** information can be used to pass a limited amount of context from +** one SQL function to another. Use the [sqlite3_result_subtype()] +** routine to set the subtype for the return value of an SQL function. +*/ +SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*); + +/* +** CAPI3REF: Copy And Free SQL Values +** METHOD: sqlite3_value +** +** ^The sqlite3_value_dup(V) interface makes a copy of the [sqlite3_value] +** object D and returns a pointer to that copy. ^The [sqlite3_value] returned +** is a [protected sqlite3_value] object even if the input is not. +** ^The sqlite3_value_dup(V) interface returns NULL if V is NULL or if a +** memory allocation fails. +** +** ^The sqlite3_value_free(V) interface frees an [sqlite3_value] object +** previously obtained from [sqlite3_value_dup()]. ^If V is a NULL pointer +** then sqlite3_value_free(V) is a harmless no-op. +*/ +SQLITE_API sqlite3_value* sqlite3_value_dup(const sqlite3_value*); +SQLITE_API void sqlite3_value_free(sqlite3_value*); + +/* +** CAPI3REF: Obtain Aggregate Function Context +** METHOD: sqlite3_context +** +** Implementations of aggregate SQL functions use this +** routine to allocate memory for storing their state. +** +** ^The first time the sqlite3_aggregate_context(C,N) routine is called +** for a particular aggregate function, SQLite +** allocates N of memory, zeroes out that memory, and returns a pointer +** to the new memory. ^On second and subsequent calls to +** sqlite3_aggregate_context() for the same aggregate function instance, +** the same buffer is returned. Sqlite3_aggregate_context() is normally +** called once for each invocation of the xStep callback and then one +** last time when the xFinal callback is invoked. ^(When no rows match +** an aggregate query, the xStep() callback of the aggregate function +** implementation is never called and xFinal() is called exactly once. +** In those cases, sqlite3_aggregate_context() might be called for the +** first time from within xFinal().)^ +** +** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer +** when first called if N is less than or equal to zero or if a memory +** allocate error occurs. +** +** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is +** determined by the N parameter on first successful call. Changing the +** value of N in subsequent call to sqlite3_aggregate_context() within +** the same aggregate function instance will not resize the memory +** allocation.)^ Within the xFinal callback, it is customary to set +** N=0 in calls to sqlite3_aggregate_context(C,N) so that no +** pointless memory allocations occur. +** +** ^SQLite automatically frees the memory allocated by +** sqlite3_aggregate_context() when the aggregate query concludes. +** +** The first parameter must be a copy of the +** [sqlite3_context | SQL function context] that is the first parameter +** to the xStep or xFinal callback routine that implements the aggregate +** function. +** +** This routine must be called from the same thread in which +** the aggregate SQL function is running. +*/ +SQLITE_API void* sqlite3_aggregate_context(sqlite3_context*, int nBytes); + +/* +** CAPI3REF: User Data For Functions +** METHOD: sqlite3_context +** +** ^The sqlite3_user_data() interface returns a copy of +** the pointer that was the pUserData parameter (the 5th parameter) +** of the [sqlite3_create_function()] +** and [sqlite3_create_function16()] routines that originally +** registered the application defined function. +** +** This routine must be called from the same thread in which +** the application-defined function is running. +*/ +SQLITE_API void* sqlite3_user_data(sqlite3_context*); + +/* +** CAPI3REF: Database Connection For Functions +** METHOD: sqlite3_context +** +** ^The sqlite3_context_db_handle() interface returns a copy of +** the pointer to the [database connection] (the 1st parameter) +** of the [sqlite3_create_function()] +** and [sqlite3_create_function16()] routines that originally +** registered the application defined function. +*/ +SQLITE_API sqlite3* sqlite3_context_db_handle(sqlite3_context*); + +/* +** CAPI3REF: Function Auxiliary Data +** METHOD: sqlite3_context +** +** These functions may be used by (non-aggregate) SQL functions to +** associate metadata with argument values. If the same value is passed to +** multiple invocations of the same SQL function during query execution, under +** some circumstances the associated metadata may be preserved. An example +** of where this might be useful is in a regular-expression matching +** function. The compiled version of the regular expression can be stored as +** metadata associated with the pattern string. +** Then as long as the pattern string remains the same, +** the compiled regular expression can be reused on multiple +** invocations of the same function. +** +** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the metadata +** associated by the sqlite3_set_auxdata(C,N,P,X) function with the Nth argument +** value to the application-defined function. ^N is zero for the left-most +** function argument. ^If there is no metadata +** associated with the function argument, the sqlite3_get_auxdata(C,N) interface +** returns a NULL pointer. +** +** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as metadata for the N-th +** argument of the application-defined function. ^Subsequent +** calls to sqlite3_get_auxdata(C,N) return P from the most recent +** sqlite3_set_auxdata(C,N,P,X) call if the metadata is still valid or +** NULL if the metadata has been discarded. +** ^After each call to sqlite3_set_auxdata(C,N,P,X) where X is not NULL, +** SQLite will invoke the destructor function X with parameter P exactly +** once, when the metadata is discarded. +** SQLite is free to discard the metadata at any time, including:
    +**
  • ^(when the corresponding function parameter changes)^, or +**
  • ^(when [sqlite3_reset()] or [sqlite3_finalize()] is called for the +** SQL statement)^, or +**
  • ^(when sqlite3_set_auxdata() is invoked again on the same +** parameter)^, or +**
  • ^(during the original sqlite3_set_auxdata() call when a memory +** allocation error occurs.)^
+** +** Note the last bullet in particular. The destructor X in +** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the +** sqlite3_set_auxdata() interface even returns. Hence sqlite3_set_auxdata() +** should be called near the end of the function implementation and the +** function implementation should not make any use of P after +** sqlite3_set_auxdata() has been called. +** +** ^(In practice, metadata is preserved between function calls for +** function parameters that are compile-time constants, including literal +** values and [parameters] and expressions composed from the same.)^ +** +** The value of the N parameter to these interfaces should be non-negative. +** Future enhancements may make use of negative N values to define new +** kinds of function caching behavior. +** +** These routines must be called from the same thread in which +** the SQL function is running. +*/ +SQLITE_API void* sqlite3_get_auxdata(sqlite3_context*, int N); +SQLITE_API void +sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*)); + +/* +** CAPI3REF: Constants Defining Special Destructor Behavior +** +** These are special values for the destructor that is passed in as the +** final argument to routines like [sqlite3_result_blob()]. ^If the destructor +** argument is SQLITE_STATIC, it means that the content pointer is constant +** and will never change. It does not need to be destroyed. ^The +** SQLITE_TRANSIENT value means that the content will likely change in +** the near future and that SQLite should make its own private copy of +** the content before returning. +** +** The typedef is necessary to work around problems in certain +** C++ compilers. +*/ +typedef void (*sqlite3_destructor_type)(void*); +#define SQLITE_STATIC ((sqlite3_destructor_type)0) +#define SQLITE_TRANSIENT ((sqlite3_destructor_type)-1) + +/* +** CAPI3REF: Setting The Result Of An SQL Function +** METHOD: sqlite3_context +** +** These routines are used by the xFunc or xFinal callbacks that +** implement SQL functions and aggregates. See +** [sqlite3_create_function()] and [sqlite3_create_function16()] +** for additional information. +** +** These functions work very much like the [parameter binding] family of +** functions used to bind values to host parameters in prepared statements. +** Refer to the [SQL parameter] documentation for additional information. +** +** ^The sqlite3_result_blob() interface sets the result from +** an application-defined function to be the BLOB whose content is pointed +** to by the second parameter and which is N bytes long where N is the +** third parameter. +** +** ^The sqlite3_result_zeroblob(C,N) and sqlite3_result_zeroblob64(C,N) +** interfaces set the result of the application-defined function to be +** a BLOB containing all zero bytes and N bytes in size. +** +** ^The sqlite3_result_double() interface sets the result from +** an application-defined function to be a floating point value specified +** by its 2nd argument. +** +** ^The sqlite3_result_error() and sqlite3_result_error16() functions +** cause the implemented SQL function to throw an exception. +** ^SQLite uses the string pointed to by the +** 2nd parameter of sqlite3_result_error() or sqlite3_result_error16() +** as the text of an error message. ^SQLite interprets the error +** message string from sqlite3_result_error() as UTF-8. ^SQLite +** interprets the string from sqlite3_result_error16() as UTF-16 in native +** byte order. ^If the third parameter to sqlite3_result_error() +** or sqlite3_result_error16() is negative then SQLite takes as the error +** message all text up through the first zero character. +** ^If the third parameter to sqlite3_result_error() or +** sqlite3_result_error16() is non-negative then SQLite takes that many +** bytes (not characters) from the 2nd parameter as the error message. +** ^The sqlite3_result_error() and sqlite3_result_error16() +** routines make a private copy of the error message text before +** they return. Hence, the calling function can deallocate or +** modify the text after they return without harm. +** ^The sqlite3_result_error_code() function changes the error code +** returned by SQLite as a result of an error in a function. ^By default, +** the error code is SQLITE_ERROR. ^A subsequent call to sqlite3_result_error() +** or sqlite3_result_error16() resets the error code to SQLITE_ERROR. +** +** ^The sqlite3_result_error_toobig() interface causes SQLite to throw an +** error indicating that a string or BLOB is too long to represent. +** +** ^The sqlite3_result_error_nomem() interface causes SQLite to throw an +** error indicating that a memory allocation failed. +** +** ^The sqlite3_result_int() interface sets the return value +** of the application-defined function to be the 32-bit signed integer +** value given in the 2nd argument. +** ^The sqlite3_result_int64() interface sets the return value +** of the application-defined function to be the 64-bit signed integer +** value given in the 2nd argument. +** +** ^The sqlite3_result_null() interface sets the return value +** of the application-defined function to be NULL. +** +** ^The sqlite3_result_text(), sqlite3_result_text16(), +** sqlite3_result_text16le(), and sqlite3_result_text16be() interfaces +** set the return value of the application-defined function to be +** a text string which is represented as UTF-8, UTF-16 native byte order, +** UTF-16 little endian, or UTF-16 big endian, respectively. +** ^The sqlite3_result_text64() interface sets the return value of an +** application-defined function to be a text string in an encoding +** specified by the fifth (and last) parameter, which must be one +** of [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE]. +** ^SQLite takes the text result from the application from +** the 2nd parameter of the sqlite3_result_text* interfaces. +** ^If the 3rd parameter to the sqlite3_result_text* interfaces +** is negative, then SQLite takes result text from the 2nd parameter +** through the first zero character. +** ^If the 3rd parameter to the sqlite3_result_text* interfaces +** is non-negative, then as many bytes (not characters) of the text +** pointed to by the 2nd parameter are taken as the application-defined +** function result. If the 3rd parameter is non-negative, then it +** must be the byte offset into the string where the NUL terminator would +** appear if the string where NUL terminated. If any NUL characters occur +** in the string at a byte offset that is less than the value of the 3rd +** parameter, then the resulting string will contain embedded NULs and the +** result of expressions operating on strings with embedded NULs is undefined. +** ^If the 4th parameter to the sqlite3_result_text* interfaces +** or sqlite3_result_blob is a non-NULL pointer, then SQLite calls that +** function as the destructor on the text or BLOB result when it has +** finished using that result. +** ^If the 4th parameter to the sqlite3_result_text* interfaces or to +** sqlite3_result_blob is the special constant SQLITE_STATIC, then SQLite +** assumes that the text or BLOB result is in constant space and does not +** copy the content of the parameter nor call a destructor on the content +** when it has finished using that result. +** ^If the 4th parameter to the sqlite3_result_text* interfaces +** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT +** then SQLite makes a copy of the result into space obtained +** from [sqlite3_malloc()] before it returns. +** +** ^The sqlite3_result_value() interface sets the result of +** the application-defined function to be a copy of the +** [unprotected sqlite3_value] object specified by the 2nd parameter. ^The +** sqlite3_result_value() interface makes a copy of the [sqlite3_value] +** so that the [sqlite3_value] specified in the parameter may change or +** be deallocated after sqlite3_result_value() returns without harm. +** ^A [protected sqlite3_value] object may always be used where an +** [unprotected sqlite3_value] object is required, so either +** kind of [sqlite3_value] object can be used with this interface. +** +** ^The sqlite3_result_pointer(C,P,T,D) interface sets the result to an +** SQL NULL value, just like [sqlite3_result_null(C)], except that it +** also associates the host-language pointer P or type T with that +** NULL value such that the pointer can be retrieved within an +** [application-defined SQL function] using [sqlite3_value_pointer()]. +** ^If the D parameter is not NULL, then it is a pointer to a destructor +** for the P parameter. ^SQLite invokes D with P as its only argument +** when SQLite is finished with P. The T parameter should be a static +** string and preferably a string literal. The sqlite3_result_pointer() +** routine is part of the [pointer passing interface] added for SQLite 3.20.0. +** +** If these routines are called from within the different thread +** than the one containing the application-defined function that received +** the [sqlite3_context] pointer, the results are undefined. +*/ +SQLITE_API void +sqlite3_result_blob(sqlite3_context*, const void*, int, void (*)(void*)); +SQLITE_API void sqlite3_result_blob64( + sqlite3_context*, + const void*, + sqlite3_uint64, + void (*)(void*)); +SQLITE_API void sqlite3_result_double(sqlite3_context*, double); +SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int); +SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int); +SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*); +SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*); +SQLITE_API void sqlite3_result_error_code(sqlite3_context*, int); +SQLITE_API void sqlite3_result_int(sqlite3_context*, int); +SQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64); +SQLITE_API void sqlite3_result_null(sqlite3_context*); +SQLITE_API void +sqlite3_result_text(sqlite3_context*, const char*, int, void (*)(void*)); +SQLITE_API void sqlite3_result_text64( + sqlite3_context*, + const char*, + sqlite3_uint64, + void (*)(void*), + unsigned char encoding); +SQLITE_API void +sqlite3_result_text16(sqlite3_context*, const void*, int, void (*)(void*)); +SQLITE_API void +sqlite3_result_text16le(sqlite3_context*, const void*, int, void (*)(void*)); +SQLITE_API void +sqlite3_result_text16be(sqlite3_context*, const void*, int, void (*)(void*)); +SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*); +SQLITE_API void +sqlite3_result_pointer(sqlite3_context*, void*, const char*, void (*)(void*)); +SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n); +SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n); + +/* +** CAPI3REF: Setting The Subtype Of An SQL Function +** METHOD: sqlite3_context +** +** The sqlite3_result_subtype(C,T) function causes the subtype of +** the result from the [application-defined SQL function] with +** [sqlite3_context] C to be the value T. Only the lower 8 bits +** of the subtype T are preserved in current versions of SQLite; +** higher order bits are discarded. +** The number of subtype bytes preserved by SQLite might increase +** in future releases of SQLite. +*/ +SQLITE_API void sqlite3_result_subtype(sqlite3_context*, unsigned int); + +/* +** CAPI3REF: Define New Collating Sequences +** METHOD: sqlite3 +** +** ^These functions add, remove, or modify a [collation] associated +** with the [database connection] specified as the first argument. +** +** ^The name of the collation is a UTF-8 string +** for sqlite3_create_collation() and sqlite3_create_collation_v2() +** and a UTF-16 string in native byte order for sqlite3_create_collation16(). +** ^Collation names that compare equal according to [sqlite3_strnicmp()] are +** considered to be the same name. +** +** ^(The third argument (eTextRep) must be one of the constants: +**
    +**
  • [SQLITE_UTF8], +**
  • [SQLITE_UTF16LE], +**
  • [SQLITE_UTF16BE], +**
  • [SQLITE_UTF16], or +**
  • [SQLITE_UTF16_ALIGNED]. +**
)^ +** ^The eTextRep argument determines the encoding of strings passed +** to the collating function callback, xCallback. +** ^The [SQLITE_UTF16] and [SQLITE_UTF16_ALIGNED] values for eTextRep +** force strings to be UTF16 with native byte order. +** ^The [SQLITE_UTF16_ALIGNED] value for eTextRep forces strings to begin +** on an even byte address. +** +** ^The fourth argument, pArg, is an application data pointer that is passed +** through as the first argument to the collating function callback. +** +** ^The fifth argument, xCallback, is a pointer to the collating function. +** ^Multiple collating functions can be registered using the same name but +** with different eTextRep parameters and SQLite will use whichever +** function requires the least amount of data transformation. +** ^If the xCallback argument is NULL then the collating function is +** deleted. ^When all collating functions having the same name are deleted, +** that collation is no longer usable. +** +** ^The collating function callback is invoked with a copy of the pArg +** application data pointer and with two strings in the encoding specified +** by the eTextRep argument. The collating function must return an +** integer that is negative, zero, or positive +** if the first string is less than, equal to, or greater than the second, +** respectively. A collating function must always return the same answer +** given the same inputs. If two or more collating functions are registered +** to the same collation name (using different eTextRep values) then all +** must give an equivalent answer when invoked with equivalent strings. +** The collating function must obey the following properties for all +** strings A, B, and C: +** +**
    +**
  1. If A==B then B==A. +**
  2. If A==B and B==C then A==C. +**
  3. If A<B THEN B>A. +**
  4. If A<B and B<C then A<C. +**
+** +** If a collating function fails any of the above constraints and that +** collating function is registered and used, then the behavior of SQLite +** is undefined. +** +** ^The sqlite3_create_collation_v2() works like sqlite3_create_collation() +** with the addition that the xDestroy callback is invoked on pArg when +** the collating function is deleted. +** ^Collating functions are deleted when they are overridden by later +** calls to the collation creation functions or when the +** [database connection] is closed using [sqlite3_close()]. +** +** ^The xDestroy callback is not called if the +** sqlite3_create_collation_v2() function fails. Applications that invoke +** sqlite3_create_collation_v2() with a non-NULL xDestroy argument should +** check the return code and dispose of the application data pointer +** themselves rather than expecting SQLite to deal with it for them. +** This is different from every other SQLite interface. The inconsistency +** is unfortunate but cannot be changed without breaking backwards +** compatibility. +** +** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()]. +*/ +SQLITE_API int sqlite3_create_collation( + sqlite3*, + const char* zName, + int eTextRep, + void* pArg, + int (*xCompare)(void*, int, const void*, int, const void*)); +SQLITE_API int sqlite3_create_collation_v2( + sqlite3*, + const char* zName, + int eTextRep, + void* pArg, + int (*xCompare)(void*, int, const void*, int, const void*), + void (*xDestroy)(void*)); +SQLITE_API int sqlite3_create_collation16( + sqlite3*, + const void* zName, + int eTextRep, + void* pArg, + int (*xCompare)(void*, int, const void*, int, const void*)); + +/* +** CAPI3REF: Collation Needed Callbacks +** METHOD: sqlite3 +** +** ^To avoid having to register all collation sequences before a database +** can be used, a single callback function may be registered with the +** [database connection] to be invoked whenever an undefined collation +** sequence is required. +** +** ^If the function is registered using the sqlite3_collation_needed() API, +** then it is passed the names of undefined collation sequences as strings +** encoded in UTF-8. ^If sqlite3_collation_needed16() is used, +** the names are passed as UTF-16 in machine native byte order. +** ^A call to either function replaces the existing collation-needed callback. +** +** ^(When the callback is invoked, the first argument passed is a copy +** of the second argument to sqlite3_collation_needed() or +** sqlite3_collation_needed16(). The second argument is the database +** connection. The third argument is one of [SQLITE_UTF8], [SQLITE_UTF16BE], +** or [SQLITE_UTF16LE], indicating the most desirable form of the collation +** sequence function required. The fourth parameter is the name of the +** required collation sequence.)^ +** +** The callback function should register the desired collation using +** [sqlite3_create_collation()], [sqlite3_create_collation16()], or +** [sqlite3_create_collation_v2()]. +*/ +SQLITE_API int sqlite3_collation_needed( + sqlite3*, + void*, + void (*)(void*, sqlite3*, int eTextRep, const char*)); +SQLITE_API int sqlite3_collation_needed16( + sqlite3*, + void*, + void (*)(void*, sqlite3*, int eTextRep, const void*)); + +#ifdef SQLITE_HAS_CODEC +/* +** Specify the key for an encrypted database. This routine should be +** called right after sqlite3_open(). +** +** The code to implement this API is not available in the public release +** of SQLite. +*/ +SQLITE_API int sqlite3_key( + sqlite3* db, /* Database to be rekeyed */ + const void* pKey, + int nKey /* The key */ + ); +SQLITE_API int sqlite3_key_v2( + sqlite3* db, /* Database to be rekeyed */ + const char* zDbName, /* Name of the database */ + const void* pKey, + int nKey /* The key */ + ); + +/* +** Change the key on an open database. If the current database is not +** encrypted, this routine will encrypt it. If pNew==0 or nNew==0, the +** database is decrypted. +** +** The code to implement this API is not available in the public release +** of SQLite. +*/ +SQLITE_API int sqlite3_rekey( + sqlite3* db, /* Database to be rekeyed */ + const void* pKey, + int nKey /* The new key */ + ); +SQLITE_API int sqlite3_rekey_v2( + sqlite3* db, /* Database to be rekeyed */ + const char* zDbName, /* Name of the database */ + const void* pKey, + int nKey /* The new key */ + ); + +/* +** Specify the activation key for a SEE database. Unless +** activated, none of the SEE routines will work. +*/ +SQLITE_API void sqlite3_activate_see( + const char* zPassPhrase /* Activation phrase */ + ); +#endif + +#ifdef SQLITE_ENABLE_CEROD +/* +** Specify the activation key for a CEROD database. Unless +** activated, none of the CEROD routines will work. +*/ +SQLITE_API void sqlite3_activate_cerod( + const char* zPassPhrase /* Activation phrase */ + ); +#endif + +/* +** CAPI3REF: Suspend Execution For A Short Time +** +** The sqlite3_sleep() function causes the current thread to suspend execution +** for at least a number of milliseconds specified in its parameter. +** +** If the operating system does not support sleep requests with +** millisecond time resolution, then the time will be rounded up to +** the nearest second. The number of milliseconds of sleep actually +** requested from the operating system is returned. +** +** ^SQLite implements this interface by calling the xSleep() +** method of the default [sqlite3_vfs] object. If the xSleep() method +** of the default VFS is not implemented correctly, or not implemented at +** all, then the behavior of sqlite3_sleep() may deviate from the description +** in the previous paragraphs. +*/ +SQLITE_API int sqlite3_sleep(int); + +/* +** CAPI3REF: Name Of The Folder Holding Temporary Files +** +** ^(If this global variable is made to point to a string which is +** the name of a folder (a.k.a. directory), then all temporary files +** created by SQLite when using a built-in [sqlite3_vfs | VFS] +** will be placed in that directory.)^ ^If this variable +** is a NULL pointer, then SQLite performs a search for an appropriate +** temporary file directory. +** +** Applications are strongly discouraged from using this global variable. +** It is required to set a temporary folder on Windows Runtime (WinRT). +** But for all other platforms, it is highly recommended that applications +** neither read nor write this variable. This global variable is a relic +** that exists for backwards compatibility of legacy applications and should +** be avoided in new projects. +** +** It is not safe to read or modify this variable in more than one +** thread at a time. It is not safe to read or modify this variable +** if a [database connection] is being used at the same time in a separate +** thread. +** It is intended that this variable be set once +** as part of process initialization and before any SQLite interface +** routines have been called and that this variable remain unchanged +** thereafter. +** +** ^The [temp_store_directory pragma] may modify this variable and cause +** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore, +** the [temp_store_directory pragma] always assumes that any string +** that this variable points to is held in memory obtained from +** [sqlite3_malloc] and the pragma may attempt to free that memory +** using [sqlite3_free]. +** Hence, if this variable is modified directly, either it should be +** made NULL or made to point to memory obtained from [sqlite3_malloc] +** or else the use of the [temp_store_directory pragma] should be avoided. +** Except when requested by the [temp_store_directory pragma], SQLite +** does not free the memory that sqlite3_temp_directory points to. If +** the application wants that memory to be freed, it must do +** so itself, taking care to only do so after all [database connection] +** objects have been destroyed. +** +** Note to Windows Runtime users: The temporary directory must be set +** prior to calling [sqlite3_open] or [sqlite3_open_v2]. Otherwise, various +** features that require the use of temporary files may fail. Here is an +** example of how to do this using C++ with the Windows Runtime: +** +**
+** LPCWSTR zPath = Windows::Storage::ApplicationData::Current->
+**       TemporaryFolder->Path->Data();
+** char zPathBuf[MAX_PATH + 1];
+** memset(zPathBuf, 0, sizeof(zPathBuf));
+** WideCharToMultiByte(CP_UTF8, 0, zPath, -1, zPathBuf, sizeof(zPathBuf),
+**       NULL, NULL);
+** sqlite3_temp_directory = sqlite3_mprintf("%s", zPathBuf);
+** 
+*/ +SQLITE_API SQLITE_EXTERN char* sqlite3_temp_directory; + +/* +** CAPI3REF: Name Of The Folder Holding Database Files +** +** ^(If this global variable is made to point to a string which is +** the name of a folder (a.k.a. directory), then all database files +** specified with a relative pathname and created or accessed by +** SQLite when using a built-in windows [sqlite3_vfs | VFS] will be assumed +** to be relative to that directory.)^ ^If this variable is a NULL +** pointer, then SQLite assumes that all database files specified +** with a relative pathname are relative to the current directory +** for the process. Only the windows VFS makes use of this global +** variable; it is ignored by the unix VFS. +** +** Changing the value of this variable while a database connection is +** open can result in a corrupt database. +** +** It is not safe to read or modify this variable in more than one +** thread at a time. It is not safe to read or modify this variable +** if a [database connection] is being used at the same time in a separate +** thread. +** It is intended that this variable be set once +** as part of process initialization and before any SQLite interface +** routines have been called and that this variable remain unchanged +** thereafter. +** +** ^The [data_store_directory pragma] may modify this variable and cause +** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore, +** the [data_store_directory pragma] always assumes that any string +** that this variable points to is held in memory obtained from +** [sqlite3_malloc] and the pragma may attempt to free that memory +** using [sqlite3_free]. +** Hence, if this variable is modified directly, either it should be +** made NULL or made to point to memory obtained from [sqlite3_malloc] +** or else the use of the [data_store_directory pragma] should be avoided. +*/ +SQLITE_API SQLITE_EXTERN char* sqlite3_data_directory; + +/* +** CAPI3REF: Test For Auto-Commit Mode +** KEYWORDS: {autocommit mode} +** METHOD: sqlite3 +** +** ^The sqlite3_get_autocommit() interface returns non-zero or +** zero if the given database connection is or is not in autocommit mode, +** respectively. ^Autocommit mode is on by default. +** ^Autocommit mode is disabled by a [BEGIN] statement. +** ^Autocommit mode is re-enabled by a [COMMIT] or [ROLLBACK]. +** +** If certain kinds of errors occur on a statement within a multi-statement +** transaction (errors including [SQLITE_FULL], [SQLITE_IOERR], +** [SQLITE_NOMEM], [SQLITE_BUSY], and [SQLITE_INTERRUPT]) then the +** transaction might be rolled back automatically. The only way to +** find out whether SQLite automatically rolled back the transaction after +** an error is to use this function. +** +** If another thread changes the autocommit status of the database +** connection while this routine is running, then the return value +** is undefined. +*/ +SQLITE_API int sqlite3_get_autocommit(sqlite3*); + +/* +** CAPI3REF: Find The Database Handle Of A Prepared Statement +** METHOD: sqlite3_stmt +** +** ^The sqlite3_db_handle interface returns the [database connection] handle +** to which a [prepared statement] belongs. ^The [database connection] +** returned by sqlite3_db_handle is the same [database connection] +** that was the first argument +** to the [sqlite3_prepare_v2()] call (or its variants) that was used to +** create the statement in the first place. +*/ +SQLITE_API sqlite3* sqlite3_db_handle(sqlite3_stmt*); + +/* +** CAPI3REF: Return The Filename For A Database Connection +** METHOD: sqlite3 +** +** ^The sqlite3_db_filename(D,N) interface returns a pointer to a filename +** associated with database N of connection D. ^The main database file +** has the name "main". If there is no attached database N on the database +** connection D, or if database N is a temporary or in-memory database, then +** a NULL pointer is returned. +** +** ^The filename returned by this function is the output of the +** xFullPathname method of the [VFS]. ^In other words, the filename +** will be an absolute pathname, even if the filename used +** to open the database originally was a URI or relative pathname. +*/ +SQLITE_API const char* sqlite3_db_filename(sqlite3* db, const char* zDbName); + +/* +** CAPI3REF: Determine if a database is read-only +** METHOD: sqlite3 +** +** ^The sqlite3_db_readonly(D,N) interface returns 1 if the database N +** of connection D is read-only, 0 if it is read/write, or -1 if N is not +** the name of a database on connection D. +*/ +SQLITE_API int sqlite3_db_readonly(sqlite3* db, const char* zDbName); + +/* +** CAPI3REF: Find the next prepared statement +** METHOD: sqlite3 +** +** ^This interface returns a pointer to the next [prepared statement] after +** pStmt associated with the [database connection] pDb. ^If pStmt is NULL +** then this interface returns a pointer to the first prepared statement +** associated with the database connection pDb. ^If no prepared statement +** satisfies the conditions of this routine, it returns NULL. +** +** The [database connection] pointer D in a call to +** [sqlite3_next_stmt(D,S)] must refer to an open database +** connection and in particular must not be a NULL pointer. +*/ +SQLITE_API sqlite3_stmt* sqlite3_next_stmt(sqlite3* pDb, sqlite3_stmt* pStmt); + +/* +** CAPI3REF: Commit And Rollback Notification Callbacks +** METHOD: sqlite3 +** +** ^The sqlite3_commit_hook() interface registers a callback +** function to be invoked whenever a transaction is [COMMIT | committed]. +** ^Any callback set by a previous call to sqlite3_commit_hook() +** for the same database connection is overridden. +** ^The sqlite3_rollback_hook() interface registers a callback +** function to be invoked whenever a transaction is [ROLLBACK | rolled back]. +** ^Any callback set by a previous call to sqlite3_rollback_hook() +** for the same database connection is overridden. +** ^The pArg argument is passed through to the callback. +** ^If the callback on a commit hook function returns non-zero, +** then the commit is converted into a rollback. +** +** ^The sqlite3_commit_hook(D,C,P) and sqlite3_rollback_hook(D,C,P) functions +** return the P argument from the previous call of the same function +** on the same [database connection] D, or NULL for +** the first call for each function on D. +** +** The commit and rollback hook callbacks are not reentrant. +** The callback implementation must not do anything that will modify +** the database connection that invoked the callback. Any actions +** to modify the database connection must be deferred until after the +** completion of the [sqlite3_step()] call that triggered the commit +** or rollback hook in the first place. +** Note that running any other SQL statements, including SELECT statements, +** or merely calling [sqlite3_prepare_v2()] and [sqlite3_step()] will modify +** the database connections for the meaning of "modify" in this paragraph. +** +** ^Registering a NULL function disables the callback. +** +** ^When the commit hook callback routine returns zero, the [COMMIT] +** operation is allowed to continue normally. ^If the commit hook +** returns non-zero, then the [COMMIT] is converted into a [ROLLBACK]. +** ^The rollback hook is invoked on a rollback that results from a commit +** hook returning non-zero, just as it would be with any other rollback. +** +** ^For the purposes of this API, a transaction is said to have been +** rolled back if an explicit "ROLLBACK" statement is executed, or +** an error or constraint causes an implicit rollback to occur. +** ^The rollback callback is not invoked if a transaction is +** automatically rolled back because the database connection is closed. +** +** See also the [sqlite3_update_hook()] interface. +*/ +SQLITE_API void* sqlite3_commit_hook(sqlite3*, int (*)(void*), void*); +SQLITE_API void* sqlite3_rollback_hook(sqlite3*, void (*)(void*), void*); + +/* +** CAPI3REF: Data Change Notification Callbacks +** METHOD: sqlite3 +** +** ^The sqlite3_update_hook() interface registers a callback function +** with the [database connection] identified by the first argument +** to be invoked whenever a row is updated, inserted or deleted in +** a [rowid table]. +** ^Any callback set by a previous call to this function +** for the same database connection is overridden. +** +** ^The second argument is a pointer to the function to invoke when a +** row is updated, inserted or deleted in a rowid table. +** ^The first argument to the callback is a copy of the third argument +** to sqlite3_update_hook(). +** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE], +** or [SQLITE_UPDATE], depending on the operation that caused the callback +** to be invoked. +** ^The third and fourth arguments to the callback contain pointers to the +** database and table name containing the affected row. +** ^The final callback parameter is the [rowid] of the row. +** ^In the case of an update, this is the [rowid] after the update takes place. +** +** ^(The update hook is not invoked when internal system tables are +** modified (i.e. sqlite_master and sqlite_sequence).)^ +** ^The update hook is not invoked when [WITHOUT ROWID] tables are modified. +** +** ^In the current implementation, the update hook +** is not invoked when conflicting rows are deleted because of an +** [ON CONFLICT | ON CONFLICT REPLACE] clause. ^Nor is the update hook +** invoked when rows are deleted using the [truncate optimization]. +** The exceptions defined in this paragraph might change in a future +** release of SQLite. +** +** The update hook implementation must not do anything that will modify +** the database connection that invoked the update hook. Any actions +** to modify the database connection must be deferred until after the +** completion of the [sqlite3_step()] call that triggered the update hook. +** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their +** database connections for the meaning of "modify" in this paragraph. +** +** ^The sqlite3_update_hook(D,C,P) function +** returns the P argument from the previous call +** on the same [database connection] D, or NULL for +** the first call on D. +** +** See also the [sqlite3_commit_hook()], [sqlite3_rollback_hook()], +** and [sqlite3_preupdate_hook()] interfaces. +*/ +SQLITE_API void* sqlite3_update_hook( + sqlite3*, + void (*)(void*, int, char const*, char const*, sqlite3_int64), + void*); + +/* +** CAPI3REF: Enable Or Disable Shared Pager Cache +** +** ^(This routine enables or disables the sharing of the database cache +** and schema data structures between [database connection | connections] +** to the same database. Sharing is enabled if the argument is true +** and disabled if the argument is false.)^ +** +** ^Cache sharing is enabled and disabled for an entire process. +** This is a change as of SQLite [version 3.5.0] ([dateof:3.5.0]). +** In prior versions of SQLite, +** sharing was enabled or disabled for each thread separately. +** +** ^(The cache sharing mode set by this interface effects all subsequent +** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()]. +** Existing database connections continue use the sharing mode +** that was in effect at the time they were opened.)^ +** +** ^(This routine returns [SQLITE_OK] if shared cache was enabled or disabled +** successfully. An [error code] is returned otherwise.)^ +** +** ^Shared cache is disabled by default. But this might change in +** future releases of SQLite. Applications that care about shared +** cache setting should set it explicitly. +** +** Note: This method is disabled on MacOS X 10.7 and iOS version 5.0 +** and will always return SQLITE_MISUSE. On those systems, +** shared cache mode should be enabled per-database connection via +** [sqlite3_open_v2()] with [SQLITE_OPEN_SHAREDCACHE]. +** +** This interface is threadsafe on processors where writing a +** 32-bit integer is atomic. +** +** See Also: [SQLite Shared-Cache Mode] +*/ +SQLITE_API int sqlite3_enable_shared_cache(int); + +/* +** CAPI3REF: Attempt To Free Heap Memory +** +** ^The sqlite3_release_memory() interface attempts to free N bytes +** of heap memory by deallocating non-essential memory allocations +** held by the database library. Memory used to cache database +** pages to improve performance is an example of non-essential memory. +** ^sqlite3_release_memory() returns the number of bytes actually freed, +** which might be more or less than the amount requested. +** ^The sqlite3_release_memory() routine is a no-op returning zero +** if SQLite is not compiled with [SQLITE_ENABLE_MEMORY_MANAGEMENT]. +** +** See also: [sqlite3_db_release_memory()] +*/ +SQLITE_API int sqlite3_release_memory(int); + +/* +** CAPI3REF: Free Memory Used By A Database Connection +** METHOD: sqlite3 +** +** ^The sqlite3_db_release_memory(D) interface attempts to free as much heap +** memory as possible from database connection D. Unlike the +** [sqlite3_release_memory()] interface, this interface is in effect even +** when the [SQLITE_ENABLE_MEMORY_MANAGEMENT] compile-time option is +** omitted. +** +** See also: [sqlite3_release_memory()] +*/ +SQLITE_API int sqlite3_db_release_memory(sqlite3*); + +/* +** CAPI3REF: Impose A Limit On Heap Size +** +** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the +** soft limit on the amount of heap memory that may be allocated by SQLite. +** ^SQLite strives to keep heap memory utilization below the soft heap +** limit by reducing the number of pages held in the page cache +** as heap memory usages approaches the limit. +** ^The soft heap limit is "soft" because even though SQLite strives to stay +** below the limit, it will exceed the limit rather than generate +** an [SQLITE_NOMEM] error. In other words, the soft heap limit +** is advisory only. +** +** ^The return value from sqlite3_soft_heap_limit64() is the size of +** the soft heap limit prior to the call, or negative in the case of an +** error. ^If the argument N is negative +** then no change is made to the soft heap limit. Hence, the current +** size of the soft heap limit can be determined by invoking +** sqlite3_soft_heap_limit64() with a negative argument. +** +** ^If the argument N is zero then the soft heap limit is disabled. +** +** ^(The soft heap limit is not enforced in the current implementation +** if one or more of following conditions are true: +** +**
    +**
  • The soft heap limit is set to zero. +**
  • Memory accounting is disabled using a combination of the +** [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and +** the [SQLITE_DEFAULT_MEMSTATUS] compile-time option. +**
  • An alternative page cache implementation is specified using +** [sqlite3_config]([SQLITE_CONFIG_PCACHE2],...). +**
  • The page cache allocates from its own memory pool supplied +** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than +** from the heap. +**
)^ +** +** Beginning with SQLite [version 3.7.3] ([dateof:3.7.3]), +** the soft heap limit is enforced +** regardless of whether or not the [SQLITE_ENABLE_MEMORY_MANAGEMENT] +** compile-time option is invoked. With [SQLITE_ENABLE_MEMORY_MANAGEMENT], +** the soft heap limit is enforced on every memory allocation. Without +** [SQLITE_ENABLE_MEMORY_MANAGEMENT], the soft heap limit is only enforced +** when memory is allocated by the page cache. Testing suggests that because +** the page cache is the predominate memory user in SQLite, most +** applications will achieve adequate soft heap limit enforcement without +** the use of [SQLITE_ENABLE_MEMORY_MANAGEMENT]. +** +** The circumstances under which SQLite will enforce the soft heap limit may +** changes in future releases of SQLite. +*/ +SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N); + +/* +** CAPI3REF: Deprecated Soft Heap Limit Interface +** DEPRECATED +** +** This is a deprecated version of the [sqlite3_soft_heap_limit64()] +** interface. This routine is provided for historical compatibility +** only. All new applications should use the +** [sqlite3_soft_heap_limit64()] interface rather than this one. +*/ +SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N); + +/* +** CAPI3REF: Extract Metadata About A Column Of A Table +** METHOD: sqlite3 +** +** ^(The sqlite3_table_column_metadata(X,D,T,C,....) routine returns +** information about column C of table T in database D +** on [database connection] X.)^ ^The sqlite3_table_column_metadata() +** interface returns SQLITE_OK and fills in the non-NULL pointers in +** the final five arguments with appropriate values if the specified +** column exists. ^The sqlite3_table_column_metadata() interface returns +** SQLITE_ERROR and if the specified column does not exist. +** ^If the column-name parameter to sqlite3_table_column_metadata() is a +** NULL pointer, then this routine simply checks for the existence of the +** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it +** does not. If the table name parameter T in a call to +** sqlite3_table_column_metadata(X,D,T,C,...) is NULL then the result is +** undefined behavior. +** +** ^The column is identified by the second, third and fourth parameters to +** this function. ^(The second parameter is either the name of the database +** (i.e. "main", "temp", or an attached database) containing the specified +** table or NULL.)^ ^If it is NULL, then all attached databases are searched +** for the table using the same algorithm used by the database engine to +** resolve unqualified table references. +** +** ^The third and fourth parameters to this function are the table and column +** name of the desired column, respectively. +** +** ^Metadata is returned by writing to the memory locations passed as the 5th +** and subsequent parameters to this function. ^Any of these arguments may be +** NULL, in which case the corresponding element of metadata is omitted. +** +** ^(
+** +**
Parameter Output
Type
Description +** +**
5th const char* Data type +**
6th const char* Name of default collation sequence +**
7th int True if column has a NOT NULL constraint +**
8th int True if column is part of the PRIMARY KEY +**
9th int True if column is [AUTOINCREMENT] +**
+**
)^ +** +** ^The memory pointed to by the character pointers returned for the +** declaration type and collation sequence is valid until the next +** call to any SQLite API function. +** +** ^If the specified table is actually a view, an [error code] is returned. +** +** ^If the specified column is "rowid", "oid" or "_rowid_" and the table +** is not a [WITHOUT ROWID] table and an +** [INTEGER PRIMARY KEY] column has been explicitly declared, then the output +** parameters are set for the explicitly declared column. ^(If there is no +** [INTEGER PRIMARY KEY] column, then the outputs +** for the [rowid] are set as follows: +** +**
+**     data type: "INTEGER"
+**     collation sequence: "BINARY"
+**     not null: 0
+**     primary key: 1
+**     auto increment: 0
+** 
)^ +** +** ^This function causes all database schemas to be read from disk and +** parsed, if that has not already been done, and returns an error if +** any errors are encountered while loading the schema. +*/ +SQLITE_API int sqlite3_table_column_metadata( + sqlite3* db, /* Connection handle */ + const char* zDbName, /* Database name or NULL */ + const char* zTableName, /* Table name */ + const char* zColumnName, /* Column name */ + char const** pzDataType, /* OUTPUT: Declared data type */ + char const** pzCollSeq, /* OUTPUT: Collation sequence name */ + int* pNotNull, /* OUTPUT: True if NOT NULL constraint exists */ + int* pPrimaryKey, /* OUTPUT: True if column part of PK */ + int* pAutoinc /* OUTPUT: True if column is auto-increment */ + ); + +/* +** CAPI3REF: Load An Extension +** METHOD: sqlite3 +** +** ^This interface loads an SQLite extension library from the named file. +** +** ^The sqlite3_load_extension() interface attempts to load an +** [SQLite extension] library contained in the file zFile. If +** the file cannot be loaded directly, attempts are made to load +** with various operating-system specific extensions added. +** So for example, if "samplelib" cannot be loaded, then names like +** "samplelib.so" or "samplelib.dylib" or "samplelib.dll" might +** be tried also. +** +** ^The entry point is zProc. +** ^(zProc may be 0, in which case SQLite will try to come up with an +** entry point name on its own. It first tries "sqlite3_extension_init". +** If that does not work, it constructs a name "sqlite3_X_init" where the +** X is consists of the lower-case equivalent of all ASCII alphabetic +** characters in the filename from the last "/" to the first following +** "." and omitting any initial "lib".)^ +** ^The sqlite3_load_extension() interface returns +** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong. +** ^If an error occurs and pzErrMsg is not 0, then the +** [sqlite3_load_extension()] interface shall attempt to +** fill *pzErrMsg with error message text stored in memory +** obtained from [sqlite3_malloc()]. The calling function +** should free this memory by calling [sqlite3_free()]. +** +** ^Extension loading must be enabled using +** [sqlite3_enable_load_extension()] or +** [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],1,NULL) +** prior to calling this API, +** otherwise an error will be returned. +** +** Security warning: It is recommended that the +** [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method be used to enable only this +** interface. The use of the [sqlite3_enable_load_extension()] interface +** should be avoided. This will keep the SQL function [load_extension()] +** disabled and prevent SQL injections from giving attackers +** access to extension loading capabilities. +** +** See also the [load_extension() SQL function]. +*/ +SQLITE_API int sqlite3_load_extension( + sqlite3* db, /* Load the extension into this database connection */ + const char* zFile, /* Name of the shared library containing extension */ + const char* zProc, /* Entry point. Derived from zFile if 0 */ + char** pzErrMsg /* Put error message here if not 0 */ + ); + +/* +** CAPI3REF: Enable Or Disable Extension Loading +** METHOD: sqlite3 +** +** ^So as not to open security holes in older applications that are +** unprepared to deal with [extension loading], and as a means of disabling +** [extension loading] while evaluating user-entered SQL, the following API +** is provided to turn the [sqlite3_load_extension()] mechanism on and off. +** +** ^Extension loading is off by default. +** ^Call the sqlite3_enable_load_extension() routine with onoff==1 +** to turn extension loading on and call it with onoff==0 to turn +** it back off again. +** +** ^This interface enables or disables both the C-API +** [sqlite3_load_extension()] and the SQL function [load_extension()]. +** ^(Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..) +** to enable or disable only the C-API.)^ +** +** Security warning: It is recommended that extension loading +** be disabled using the [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method +** rather than this interface, so the [load_extension()] SQL function +** remains disabled. This will prevent SQL injections from giving attackers +** access to extension loading capabilities. +*/ +SQLITE_API int sqlite3_enable_load_extension(sqlite3* db, int onoff); + +/* +** CAPI3REF: Automatically Load Statically Linked Extensions +** +** ^This interface causes the xEntryPoint() function to be invoked for +** each new [database connection] that is created. The idea here is that +** xEntryPoint() is the entry point for a statically linked [SQLite extension] +** that is to be automatically loaded into all new database connections. +** +** ^(Even though the function prototype shows that xEntryPoint() takes +** no arguments and returns void, SQLite invokes xEntryPoint() with three +** arguments and expects an integer result as if the signature of the +** entry point where as follows: +** +**
+**    int xEntryPoint(
+**      sqlite3 *db,
+**      const char **pzErrMsg,
+**      const struct sqlite3_api_routines *pThunk
+**    );
+** 
)^ +** +** If the xEntryPoint routine encounters an error, it should make *pzErrMsg +** point to an appropriate error message (obtained from [sqlite3_mprintf()]) +** and return an appropriate [error code]. ^SQLite ensures that *pzErrMsg +** is NULL before calling the xEntryPoint(). ^SQLite will invoke +** [sqlite3_free()] on *pzErrMsg after xEntryPoint() returns. ^If any +** xEntryPoint() returns an error, the [sqlite3_open()], [sqlite3_open16()], +** or [sqlite3_open_v2()] call that provoked the xEntryPoint() will fail. +** +** ^Calling sqlite3_auto_extension(X) with an entry point X that is already +** on the list of automatic extensions is a harmless no-op. ^No entry point +** will be called more than once for each database connection that is opened. +** +** See also: [sqlite3_reset_auto_extension()] +** and [sqlite3_cancel_auto_extension()] +*/ +SQLITE_API int sqlite3_auto_extension(void (*xEntryPoint)(void)); + +/* +** CAPI3REF: Cancel Automatic Extension Loading +** +** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the +** initialization routine X that was registered using a prior call to +** [sqlite3_auto_extension(X)]. ^The [sqlite3_cancel_auto_extension(X)] +** routine returns 1 if initialization routine X was successfully +** unregistered and it returns 0 if X was not on the list of initialization +** routines. +*/ +SQLITE_API int sqlite3_cancel_auto_extension(void (*xEntryPoint)(void)); + +/* +** CAPI3REF: Reset Automatic Extension Loading +** +** ^This interface disables all automatic extensions previously +** registered using [sqlite3_auto_extension()]. +*/ +SQLITE_API void sqlite3_reset_auto_extension(void); + +/* +** The interface to the virtual-table mechanism is currently considered +** to be experimental. The interface might change in incompatible ways. +** If this is a problem for you, do not use the interface at this time. +** +** When the virtual-table mechanism stabilizes, we will declare the +** interface fixed, support it indefinitely, and remove this comment. +*/ + +/* +** Structures used by the virtual table interface +*/ +typedef struct sqlite3_vtab sqlite3_vtab; +typedef struct sqlite3_index_info sqlite3_index_info; +typedef struct sqlite3_vtab_cursor sqlite3_vtab_cursor; +typedef struct sqlite3_module sqlite3_module; + +/* +** CAPI3REF: Virtual Table Object +** KEYWORDS: sqlite3_module {virtual table module} +** +** This structure, sometimes called a "virtual table module", +** defines the implementation of a [virtual tables]. +** This structure consists mostly of methods for the module. +** +** ^A virtual table module is created by filling in a persistent +** instance of this structure and passing a pointer to that instance +** to [sqlite3_create_module()] or [sqlite3_create_module_v2()]. +** ^The registration remains valid until it is replaced by a different +** module or until the [database connection] closes. The content +** of this structure must not change while it is registered with +** any database connection. +*/ +struct sqlite3_module { + int iVersion; + int (*xCreate)( + sqlite3*, + void* pAux, + int argc, + const char* const* argv, + sqlite3_vtab** ppVTab, + char**); + int (*xConnect)( + sqlite3*, + void* pAux, + int argc, + const char* const* argv, + sqlite3_vtab** ppVTab, + char**); + int (*xBestIndex)(sqlite3_vtab* pVTab, sqlite3_index_info*); + int (*xDisconnect)(sqlite3_vtab* pVTab); + int (*xDestroy)(sqlite3_vtab* pVTab); + int (*xOpen)(sqlite3_vtab* pVTab, sqlite3_vtab_cursor** ppCursor); + int (*xClose)(sqlite3_vtab_cursor*); + int (*xFilter)( + sqlite3_vtab_cursor*, + int idxNum, + const char* idxStr, + int argc, + sqlite3_value** argv); + int (*xNext)(sqlite3_vtab_cursor*); + int (*xEof)(sqlite3_vtab_cursor*); + int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int); + int (*xRowid)(sqlite3_vtab_cursor*, sqlite3_int64* pRowid); + int (*xUpdate)(sqlite3_vtab*, int, sqlite3_value**, sqlite3_int64*); + int (*xBegin)(sqlite3_vtab* pVTab); + int (*xSync)(sqlite3_vtab* pVTab); + int (*xCommit)(sqlite3_vtab* pVTab); + int (*xRollback)(sqlite3_vtab* pVTab); + int (*xFindFunction)( + sqlite3_vtab* pVtab, + int nArg, + const char* zName, + void (**pxFunc)(sqlite3_context*, int, sqlite3_value**), + void** ppArg); + int (*xRename)(sqlite3_vtab* pVtab, const char* zNew); + /* The methods above are in version 1 of the sqlite_module object. Those + ** below are for version 2 and greater. */ + int (*xSavepoint)(sqlite3_vtab* pVTab, int); + int (*xRelease)(sqlite3_vtab* pVTab, int); + int (*xRollbackTo)(sqlite3_vtab* pVTab, int); +}; + +/* +** CAPI3REF: Virtual Table Indexing Information +** KEYWORDS: sqlite3_index_info +** +** The sqlite3_index_info structure and its substructures is used as part +** of the [virtual table] interface to +** pass information into and receive the reply from the [xBestIndex] +** method of a [virtual table module]. The fields under **Inputs** are the +** inputs to xBestIndex and are read-only. xBestIndex inserts its +** results into the **Outputs** fields. +** +** ^(The aConstraint[] array records WHERE clause constraints of the form: +** +**
column OP expr
+** +** where OP is =, <, <=, >, or >=.)^ ^(The particular operator is +** stored in aConstraint[].op using one of the +** [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^ +** ^(The index of the column is stored in +** aConstraint[].iColumn.)^ ^(aConstraint[].usable is TRUE if the +** expr on the right-hand side can be evaluated (and thus the constraint +** is usable) and false if it cannot.)^ +** +** ^The optimizer automatically inverts terms of the form "expr OP column" +** and makes other simplifications to the WHERE clause in an attempt to +** get as many WHERE clause terms into the form shown above as possible. +** ^The aConstraint[] array only reports WHERE clause terms that are +** relevant to the particular virtual table being queried. +** +** ^Information about the ORDER BY clause is stored in aOrderBy[]. +** ^Each term of aOrderBy records a column of the ORDER BY clause. +** +** The colUsed field indicates which columns of the virtual table may be +** required by the current scan. Virtual table columns are numbered from +** zero in the order in which they appear within the CREATE TABLE statement +** passed to sqlite3_declare_vtab(). For the first 63 columns (columns 0-62), +** the corresponding bit is set within the colUsed mask if the column may be +** required by SQLite. If the table has at least 64 columns and any column +** to the right of the first 63 is required, then bit 63 of colUsed is also +** set. In other words, column iCol may be required if the expression +** (colUsed & ((sqlite3_uint64)1 << (iCol>=63 ? 63 : iCol))) evaluates to +** non-zero. +** +** The [xBestIndex] method must fill aConstraintUsage[] with information +** about what parameters to pass to xFilter. ^If argvIndex>0 then +** the right-hand side of the corresponding aConstraint[] is evaluated +** and becomes the argvIndex-th entry in argv. ^(If aConstraintUsage[].omit +** is true, then the constraint is assumed to be fully handled by the +** virtual table and is not checked again by SQLite.)^ +** +** ^The idxNum and idxPtr values are recorded and passed into the +** [xFilter] method. +** ^[sqlite3_free()] is used to free idxPtr if and only if +** needToFreeIdxPtr is true. +** +** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in +** the correct order to satisfy the ORDER BY clause so that no separate +** sorting step is required. +** +** ^The estimatedCost value is an estimate of the cost of a particular +** strategy. A cost of N indicates that the cost of the strategy is similar +** to a linear scan of an SQLite table with N rows. A cost of log(N) +** indicates that the expense of the operation is similar to that of a +** binary search on a unique indexed field of an SQLite table with N rows. +** +** ^The estimatedRows value is an estimate of the number of rows that +** will be returned by the strategy. +** +** The xBestIndex method may optionally populate the idxFlags field with a +** mask of SQLITE_INDEX_SCAN_* flags. Currently there is only one such flag - +** SQLITE_INDEX_SCAN_UNIQUE. If the xBestIndex method sets this flag, SQLite +** assumes that the strategy may visit at most one row. +** +** Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then +** SQLite also assumes that if a call to the xUpdate() method is made as +** part of the same statement to delete or update a virtual table row and the +** implementation returns SQLITE_CONSTRAINT, then there is no need to rollback +** any database changes. In other words, if the xUpdate() returns +** SQLITE_CONSTRAINT, the database contents must be exactly as they were +** before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not +** set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by +** the xUpdate method are automatically rolled back by SQLite. +** +** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info +** structure for SQLite [version 3.8.2] ([dateof:3.8.2]). +** If a virtual table extension is +** used with an SQLite version earlier than 3.8.2, the results of attempting +** to read or write the estimatedRows field are undefined (but are likely +** to included crashing the application). The estimatedRows field should +** therefore only be used if [sqlite3_libversion_number()] returns a +** value greater than or equal to 3008002. Similarly, the idxFlags field +** was added for [version 3.9.0] ([dateof:3.9.0]). +** It may therefore only be used if +** sqlite3_libversion_number() returns a value greater than or equal to +** 3009000. +*/ +struct sqlite3_index_info { + /* Inputs */ + int nConstraint; /* Number of entries in aConstraint */ + struct sqlite3_index_constraint { + int iColumn; /* Column constrained. -1 for ROWID */ + unsigned char op; /* Constraint operator */ + unsigned char usable; /* True if this constraint is usable */ + int iTermOffset; /* Used internally - xBestIndex should ignore */ + } * aConstraint; /* Table of WHERE clause constraints */ + int nOrderBy; /* Number of terms in the ORDER BY clause */ + struct sqlite3_index_orderby { + int iColumn; /* Column number */ + unsigned char desc; /* True for DESC. False for ASC. */ + } * aOrderBy; /* The ORDER BY clause */ + /* Outputs */ + struct sqlite3_index_constraint_usage { + int argvIndex; /* if >0, constraint is part of argv to xFilter */ + unsigned char omit; /* Do not code a test for this constraint */ + } * aConstraintUsage; + int idxNum; /* Number used to identify the index */ + char* idxStr; /* String, possibly obtained from sqlite3_malloc */ + int needToFreeIdxStr; /* Free idxStr using sqlite3_free() if true */ + int orderByConsumed; /* True if output is already ordered */ + double estimatedCost; /* Estimated cost of using this index */ + /* Fields below are only available in SQLite 3.8.2 and later */ + sqlite3_int64 estimatedRows; /* Estimated number of rows returned */ + /* Fields below are only available in SQLite 3.9.0 and later */ + int idxFlags; /* Mask of SQLITE_INDEX_SCAN_* flags */ + /* Fields below are only available in SQLite 3.10.0 and later */ + sqlite3_uint64 colUsed; /* Input: Mask of columns used by statement */ +}; + +/* +** CAPI3REF: Virtual Table Scan Flags +*/ +#define SQLITE_INDEX_SCAN_UNIQUE 1 /* Scan visits at most 1 row */ + +/* +** CAPI3REF: Virtual Table Constraint Operator Codes +** +** These macros defined the allowed values for the +** [sqlite3_index_info].aConstraint[].op field. Each value represents +** an operator that is part of a constraint term in the wHERE clause of +** a query that uses a [virtual table]. +*/ +#define SQLITE_INDEX_CONSTRAINT_EQ 2 +#define SQLITE_INDEX_CONSTRAINT_GT 4 +#define SQLITE_INDEX_CONSTRAINT_LE 8 +#define SQLITE_INDEX_CONSTRAINT_LT 16 +#define SQLITE_INDEX_CONSTRAINT_GE 32 +#define SQLITE_INDEX_CONSTRAINT_MATCH 64 +#define SQLITE_INDEX_CONSTRAINT_LIKE 65 +#define SQLITE_INDEX_CONSTRAINT_GLOB 66 +#define SQLITE_INDEX_CONSTRAINT_REGEXP 67 +#define SQLITE_INDEX_CONSTRAINT_NE 68 +#define SQLITE_INDEX_CONSTRAINT_ISNOT 69 +#define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70 +#define SQLITE_INDEX_CONSTRAINT_ISNULL 71 +#define SQLITE_INDEX_CONSTRAINT_IS 72 + +/* +** CAPI3REF: Register A Virtual Table Implementation +** METHOD: sqlite3 +** +** ^These routines are used to register a new [virtual table module] name. +** ^Module names must be registered before +** creating a new [virtual table] using the module and before using a +** preexisting [virtual table] for the module. +** +** ^The module name is registered on the [database connection] specified +** by the first parameter. ^The name of the module is given by the +** second parameter. ^The third parameter is a pointer to +** the implementation of the [virtual table module]. ^The fourth +** parameter is an arbitrary client data pointer that is passed through +** into the [xCreate] and [xConnect] methods of the virtual table module +** when a new virtual table is be being created or reinitialized. +** +** ^The sqlite3_create_module_v2() interface has a fifth parameter which +** is a pointer to a destructor for the pClientData. ^SQLite will +** invoke the destructor function (if it is not NULL) when SQLite +** no longer needs the pClientData pointer. ^The destructor will also +** be invoked if the call to sqlite3_create_module_v2() fails. +** ^The sqlite3_create_module() +** interface is equivalent to sqlite3_create_module_v2() with a NULL +** destructor. +*/ +SQLITE_API int sqlite3_create_module( + sqlite3* db, /* SQLite connection to register module with */ + const char* zName, /* Name of the module */ + const sqlite3_module* p, /* Methods for the module */ + void* pClientData /* Client data for xCreate/xConnect */ + ); +SQLITE_API int sqlite3_create_module_v2( + sqlite3* db, /* SQLite connection to register module with */ + const char* zName, /* Name of the module */ + const sqlite3_module* p, /* Methods for the module */ + void* pClientData, /* Client data for xCreate/xConnect */ + void (*xDestroy)(void*) /* Module destructor function */ + ); + +/* +** CAPI3REF: Virtual Table Instance Object +** KEYWORDS: sqlite3_vtab +** +** Every [virtual table module] implementation uses a subclass +** of this object to describe a particular instance +** of the [virtual table]. Each subclass will +** be tailored to the specific needs of the module implementation. +** The purpose of this superclass is to define certain fields that are +** common to all module implementations. +** +** ^Virtual tables methods can set an error message by assigning a +** string obtained from [sqlite3_mprintf()] to zErrMsg. The method should +** take care that any prior string is freed by a call to [sqlite3_free()] +** prior to assigning a new string to zErrMsg. ^After the error message +** is delivered up to the client application, the string will be automatically +** freed by sqlite3_free() and the zErrMsg field will be zeroed. +*/ +struct sqlite3_vtab { + const sqlite3_module* pModule; /* The module for this virtual table */ + int nRef; /* Number of open cursors */ + char* zErrMsg; /* Error message from sqlite3_mprintf() */ + /* Virtual table implementations will typically add additional fields */ +}; + +/* +** CAPI3REF: Virtual Table Cursor Object +** KEYWORDS: sqlite3_vtab_cursor {virtual table cursor} +** +** Every [virtual table module] implementation uses a subclass of the +** following structure to describe cursors that point into the +** [virtual table] and are used +** to loop through the virtual table. Cursors are created using the +** [sqlite3_module.xOpen | xOpen] method of the module and are destroyed +** by the [sqlite3_module.xClose | xClose] method. Cursors are used +** by the [xFilter], [xNext], [xEof], [xColumn], and [xRowid] methods +** of the module. Each module implementation will define +** the content of a cursor structure to suit its own needs. +** +** This superclass exists in order to define fields of the cursor that +** are common to all implementations. +*/ +struct sqlite3_vtab_cursor { + sqlite3_vtab* pVtab; /* Virtual table of this cursor */ + /* Virtual table implementations will typically add additional fields */ +}; + +/* +** CAPI3REF: Declare The Schema Of A Virtual Table +** +** ^The [xCreate] and [xConnect] methods of a +** [virtual table module] call this interface +** to declare the format (the names and datatypes of the columns) of +** the virtual tables they implement. +*/ +SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char* zSQL); + +/* +** CAPI3REF: Overload A Function For A Virtual Table +** METHOD: sqlite3 +** +** ^(Virtual tables can provide alternative implementations of functions +** using the [xFindFunction] method of the [virtual table module]. +** But global versions of those functions +** must exist in order to be overloaded.)^ +** +** ^(This API makes sure a global version of a function with a particular +** name and number of parameters exists. If no such function exists +** before this API is called, a new function is created.)^ ^The implementation +** of the new function always causes an exception to be thrown. So +** the new function is not good for anything by itself. Its only +** purpose is to be a placeholder function that can be overloaded +** by a [virtual table]. +*/ +SQLITE_API int +sqlite3_overload_function(sqlite3*, const char* zFuncName, int nArg); + +/* +** The interface to the virtual-table mechanism defined above (back up +** to a comment remarkably similar to this one) is currently considered +** to be experimental. The interface might change in incompatible ways. +** If this is a problem for you, do not use the interface at this time. +** +** When the virtual-table mechanism stabilizes, we will declare the +** interface fixed, support it indefinitely, and remove this comment. +*/ + +/* +** CAPI3REF: A Handle To An Open BLOB +** KEYWORDS: {BLOB handle} {BLOB handles} +** +** An instance of this object represents an open BLOB on which +** [sqlite3_blob_open | incremental BLOB I/O] can be performed. +** ^Objects of this type are created by [sqlite3_blob_open()] +** and destroyed by [sqlite3_blob_close()]. +** ^The [sqlite3_blob_read()] and [sqlite3_blob_write()] interfaces +** can be used to read or write small subsections of the BLOB. +** ^The [sqlite3_blob_bytes()] interface returns the size of the BLOB in bytes. +*/ +typedef struct sqlite3_blob sqlite3_blob; + +/* +** CAPI3REF: Open A BLOB For Incremental I/O +** METHOD: sqlite3 +** CONSTRUCTOR: sqlite3_blob +** +** ^(This interfaces opens a [BLOB handle | handle] to the BLOB located +** in row iRow, column zColumn, table zTable in database zDb; +** in other words, the same BLOB that would be selected by: +** +**
+**     SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
+** 
)^ +** +** ^(Parameter zDb is not the filename that contains the database, but +** rather the symbolic name of the database. For attached databases, this is +** the name that appears after the AS keyword in the [ATTACH] statement. +** For the main database file, the database name is "main". For TEMP +** tables, the database name is "temp".)^ +** +** ^If the flags parameter is non-zero, then the BLOB is opened for read +** and write access. ^If the flags parameter is zero, the BLOB is opened for +** read-only access. +** +** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is stored +** in *ppBlob. Otherwise an [error code] is returned and, unless the error +** code is SQLITE_MISUSE, *ppBlob is set to NULL.)^ ^This means that, provided +** the API is not misused, it is always safe to call [sqlite3_blob_close()] +** on *ppBlob after this function it returns. +** +** This function fails with SQLITE_ERROR if any of the following are true: +**
    +**
  • ^(Database zDb does not exist)^, +**
  • ^(Table zTable does not exist within database zDb)^, +**
  • ^(Table zTable is a WITHOUT ROWID table)^, +**
  • ^(Column zColumn does not exist)^, +**
  • ^(Row iRow is not present in the table)^, +**
  • ^(The specified column of row iRow contains a value that is not +** a TEXT or BLOB value)^, +**
  • ^(Column zColumn is part of an index, PRIMARY KEY or UNIQUE +** constraint and the blob is being opened for read/write access)^, +**
  • ^([foreign key constraints | Foreign key constraints] are enabled, +** column zColumn is part of a [child key] definition and the blob is +** being opened for read/write access)^. +**
+** +** ^Unless it returns SQLITE_MISUSE, this function sets the +** [database connection] error code and message accessible via +** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions. +** +** A BLOB referenced by sqlite3_blob_open() may be read using the +** [sqlite3_blob_read()] interface and modified by using +** [sqlite3_blob_write()]. The [BLOB handle] can be moved to a +** different row of the same table using the [sqlite3_blob_reopen()] +** interface. However, the column, table, or database of a [BLOB handle] +** cannot be changed after the [BLOB handle] is opened. +** +** ^(If the row that a BLOB handle points to is modified by an +** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects +** then the BLOB handle is marked as "expired". +** This is true if any column of the row is changed, even a column +** other than the one the BLOB handle is open on.)^ +** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for +** an expired BLOB handle fail with a return code of [SQLITE_ABORT]. +** ^(Changes written into a BLOB prior to the BLOB expiring are not +** rolled back by the expiration of the BLOB. Such changes will eventually +** commit if the transaction continues to completion.)^ +** +** ^Use the [sqlite3_blob_bytes()] interface to determine the size of +** the opened blob. ^The size of a blob may not be changed by this +** interface. Use the [UPDATE] SQL command to change the size of a +** blob. +** +** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces +** and the built-in [zeroblob] SQL function may be used to create a +** zero-filled blob to read or write using the incremental-blob interface. +** +** To avoid a resource leak, every open [BLOB handle] should eventually +** be released by a call to [sqlite3_blob_close()]. +** +** See also: [sqlite3_blob_close()], +** [sqlite3_blob_reopen()], [sqlite3_blob_read()], +** [sqlite3_blob_bytes()], [sqlite3_blob_write()]. +*/ +SQLITE_API int sqlite3_blob_open( + sqlite3*, + const char* zDb, + const char* zTable, + const char* zColumn, + sqlite3_int64 iRow, + int flags, + sqlite3_blob** ppBlob); + +/* +** CAPI3REF: Move a BLOB Handle to a New Row +** METHOD: sqlite3_blob +** +** ^This function is used to move an existing [BLOB handle] so that it points +** to a different row of the same database table. ^The new row is identified +** by the rowid value passed as the second argument. Only the row can be +** changed. ^The database, table and column on which the blob handle is open +** remain the same. Moving an existing [BLOB handle] to a new row is +** faster than closing the existing handle and opening a new one. +** +** ^(The new row must meet the same criteria as for [sqlite3_blob_open()] - +** it must exist and there must be either a blob or text value stored in +** the nominated column.)^ ^If the new row is not present in the table, or if +** it does not contain a blob or text value, or if another error occurs, an +** SQLite error code is returned and the blob handle is considered aborted. +** ^All subsequent calls to [sqlite3_blob_read()], [sqlite3_blob_write()] or +** [sqlite3_blob_reopen()] on an aborted blob handle immediately return +** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle +** always returns zero. +** +** ^This function sets the database handle error code and message. +*/ +SQLITE_API int sqlite3_blob_reopen(sqlite3_blob*, sqlite3_int64); + +/* +** CAPI3REF: Close A BLOB Handle +** DESTRUCTOR: sqlite3_blob +** +** ^This function closes an open [BLOB handle]. ^(The BLOB handle is closed +** unconditionally. Even if this routine returns an error code, the +** handle is still closed.)^ +** +** ^If the blob handle being closed was opened for read-write access, and if +** the database is in auto-commit mode and there are no other open read-write +** blob handles or active write statements, the current transaction is +** committed. ^If an error occurs while committing the transaction, an error +** code is returned and the transaction rolled back. +** +** Calling this function with an argument that is not a NULL pointer or an +** open blob handle results in undefined behaviour. ^Calling this routine +** with a null pointer (such as would be returned by a failed call to +** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function +** is passed a valid open blob handle, the values returned by the +** sqlite3_errcode() and sqlite3_errmsg() functions are set before returning. +*/ +SQLITE_API int sqlite3_blob_close(sqlite3_blob*); + +/* +** CAPI3REF: Return The Size Of An Open BLOB +** METHOD: sqlite3_blob +** +** ^Returns the size in bytes of the BLOB accessible via the +** successfully opened [BLOB handle] in its only argument. ^The +** incremental blob I/O routines can only read or overwriting existing +** blob content; they cannot change the size of a blob. +** +** This routine only works on a [BLOB handle] which has been created +** by a prior successful call to [sqlite3_blob_open()] and which has not +** been closed by [sqlite3_blob_close()]. Passing any other pointer in +** to this routine results in undefined and probably undesirable behavior. +*/ +SQLITE_API int sqlite3_blob_bytes(sqlite3_blob*); + +/* +** CAPI3REF: Read Data From A BLOB Incrementally +** METHOD: sqlite3_blob +** +** ^(This function is used to read data from an open [BLOB handle] into a +** caller-supplied buffer. N bytes of data are copied into buffer Z +** from the open BLOB, starting at offset iOffset.)^ +** +** ^If offset iOffset is less than N bytes from the end of the BLOB, +** [SQLITE_ERROR] is returned and no data is read. ^If N or iOffset is +** less than zero, [SQLITE_ERROR] is returned and no data is read. +** ^The size of the blob (and hence the maximum value of N+iOffset) +** can be determined using the [sqlite3_blob_bytes()] interface. +** +** ^An attempt to read from an expired [BLOB handle] fails with an +** error code of [SQLITE_ABORT]. +** +** ^(On success, sqlite3_blob_read() returns SQLITE_OK. +** Otherwise, an [error code] or an [extended error code] is returned.)^ +** +** This routine only works on a [BLOB handle] which has been created +** by a prior successful call to [sqlite3_blob_open()] and which has not +** been closed by [sqlite3_blob_close()]. Passing any other pointer in +** to this routine results in undefined and probably undesirable behavior. +** +** See also: [sqlite3_blob_write()]. +*/ +SQLITE_API int sqlite3_blob_read(sqlite3_blob*, void* Z, int N, int iOffset); + +/* +** CAPI3REF: Write Data Into A BLOB Incrementally +** METHOD: sqlite3_blob +** +** ^(This function is used to write data into an open [BLOB handle] from a +** caller-supplied buffer. N bytes of data are copied from the buffer Z +** into the open BLOB, starting at offset iOffset.)^ +** +** ^(On success, sqlite3_blob_write() returns SQLITE_OK. +** Otherwise, an [error code] or an [extended error code] is returned.)^ +** ^Unless SQLITE_MISUSE is returned, this function sets the +** [database connection] error code and message accessible via +** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions. +** +** ^If the [BLOB handle] passed as the first argument was not opened for +** writing (the flags parameter to [sqlite3_blob_open()] was zero), +** this function returns [SQLITE_READONLY]. +** +** This function may only modify the contents of the BLOB; it is +** not possible to increase the size of a BLOB using this API. +** ^If offset iOffset is less than N bytes from the end of the BLOB, +** [SQLITE_ERROR] is returned and no data is written. The size of the +** BLOB (and hence the maximum value of N+iOffset) can be determined +** using the [sqlite3_blob_bytes()] interface. ^If N or iOffset are less +** than zero [SQLITE_ERROR] is returned and no data is written. +** +** ^An attempt to write to an expired [BLOB handle] fails with an +** error code of [SQLITE_ABORT]. ^Writes to the BLOB that occurred +** before the [BLOB handle] expired are not rolled back by the +** expiration of the handle, though of course those changes might +** have been overwritten by the statement that expired the BLOB handle +** or by other independent statements. +** +** This routine only works on a [BLOB handle] which has been created +** by a prior successful call to [sqlite3_blob_open()] and which has not +** been closed by [sqlite3_blob_close()]. Passing any other pointer in +** to this routine results in undefined and probably undesirable behavior. +** +** See also: [sqlite3_blob_read()]. +*/ +SQLITE_API int +sqlite3_blob_write(sqlite3_blob*, const void* z, int n, int iOffset); + +/* +** CAPI3REF: Virtual File System Objects +** +** A virtual filesystem (VFS) is an [sqlite3_vfs] object +** that SQLite uses to interact +** with the underlying operating system. Most SQLite builds come with a +** single default VFS that is appropriate for the host computer. +** New VFSes can be registered and existing VFSes can be unregistered. +** The following interfaces are provided. +** +** ^The sqlite3_vfs_find() interface returns a pointer to a VFS given its name. +** ^Names are case sensitive. +** ^Names are zero-terminated UTF-8 strings. +** ^If there is no match, a NULL pointer is returned. +** ^If zVfsName is NULL then the default VFS is returned. +** +** ^New VFSes are registered with sqlite3_vfs_register(). +** ^Each new VFS becomes the default VFS if the makeDflt flag is set. +** ^The same VFS can be registered multiple times without injury. +** ^To make an existing VFS into the default VFS, register it again +** with the makeDflt flag set. If two different VFSes with the +** same name are registered, the behavior is undefined. If a +** VFS is registered with a name that is NULL or an empty string, +** then the behavior is undefined. +** +** ^Unregister a VFS with the sqlite3_vfs_unregister() interface. +** ^(If the default VFS is unregistered, another VFS is chosen as +** the default. The choice for the new VFS is arbitrary.)^ +*/ +SQLITE_API sqlite3_vfs* sqlite3_vfs_find(const char* zVfsName); +SQLITE_API int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt); +SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*); + +/* +** CAPI3REF: Mutexes +** +** The SQLite core uses these routines for thread +** synchronization. Though they are intended for internal +** use by SQLite, code that links against SQLite is +** permitted to use any of these routines. +** +** The SQLite source code contains multiple implementations +** of these mutex routines. An appropriate implementation +** is selected automatically at compile-time. The following +** implementations are available in the SQLite core: +** +**
    +**
  • SQLITE_MUTEX_PTHREADS +**
  • SQLITE_MUTEX_W32 +**
  • SQLITE_MUTEX_NOOP +**
+** +** The SQLITE_MUTEX_NOOP implementation is a set of routines +** that does no real locking and is appropriate for use in +** a single-threaded application. The SQLITE_MUTEX_PTHREADS and +** SQLITE_MUTEX_W32 implementations are appropriate for use on Unix +** and Windows. +** +** If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor +** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex +** implementation is included with the library. In this case the +** application must supply a custom mutex implementation using the +** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function +** before calling sqlite3_initialize() or any other public sqlite3_ +** function that calls sqlite3_initialize(). +** +** ^The sqlite3_mutex_alloc() routine allocates a new +** mutex and returns a pointer to it. ^The sqlite3_mutex_alloc() +** routine returns NULL if it is unable to allocate the requested +** mutex. The argument to sqlite3_mutex_alloc() must one of these +** integer constants: +** +**
    +**
  • SQLITE_MUTEX_FAST +**
  • SQLITE_MUTEX_RECURSIVE +**
  • SQLITE_MUTEX_STATIC_MASTER +**
  • SQLITE_MUTEX_STATIC_MEM +**
  • SQLITE_MUTEX_STATIC_OPEN +**
  • SQLITE_MUTEX_STATIC_PRNG +**
  • SQLITE_MUTEX_STATIC_LRU +**
  • SQLITE_MUTEX_STATIC_PMEM +**
  • SQLITE_MUTEX_STATIC_APP1 +**
  • SQLITE_MUTEX_STATIC_APP2 +**
  • SQLITE_MUTEX_STATIC_APP3 +**
  • SQLITE_MUTEX_STATIC_VFS1 +**
  • SQLITE_MUTEX_STATIC_VFS2 +**
  • SQLITE_MUTEX_STATIC_VFS3 +**
+** +** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) +** cause sqlite3_mutex_alloc() to create +** a new mutex. ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE +** is used but not necessarily so when SQLITE_MUTEX_FAST is used. +** The mutex implementation does not need to make a distinction +** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does +** not want to. SQLite will only request a recursive mutex in +** cases where it really needs one. If a faster non-recursive mutex +** implementation is available on the host platform, the mutex subsystem +** might return such a mutex in response to SQLITE_MUTEX_FAST. +** +** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other +** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return +** a pointer to a static preexisting mutex. ^Nine static mutexes are +** used by the current version of SQLite. Future versions of SQLite +** may add additional static mutexes. Static mutexes are for internal +** use by SQLite only. Applications that use SQLite mutexes should +** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or +** SQLITE_MUTEX_RECURSIVE. +** +** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST +** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc() +** returns a different mutex on every call. ^For the static +** mutex types, the same mutex is returned on every call that has +** the same type number. +** +** ^The sqlite3_mutex_free() routine deallocates a previously +** allocated dynamic mutex. Attempting to deallocate a static +** mutex results in undefined behavior. +** +** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt +** to enter a mutex. ^If another thread is already within the mutex, +** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return +** SQLITE_BUSY. ^The sqlite3_mutex_try() interface returns [SQLITE_OK] +** upon successful entry. ^(Mutexes created using +** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread. +** In such cases, the +** mutex must be exited an equal number of times before another thread +** can enter.)^ If the same thread tries to enter any mutex other +** than an SQLITE_MUTEX_RECURSIVE more than once, the behavior is undefined. +** +** ^(Some systems (for example, Windows 95) do not support the operation +** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try() +** will always return SQLITE_BUSY. The SQLite core only ever uses +** sqlite3_mutex_try() as an optimization so this is acceptable +** behavior.)^ +** +** ^The sqlite3_mutex_leave() routine exits a mutex that was +** previously entered by the same thread. The behavior +** is undefined if the mutex is not currently entered by the +** calling thread or is not currently allocated. +** +** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or +** sqlite3_mutex_leave() is a NULL pointer, then all three routines +** behave as no-ops. +** +** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()]. +*/ +SQLITE_API sqlite3_mutex* sqlite3_mutex_alloc(int); +SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*); +SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex*); +SQLITE_API int sqlite3_mutex_try(sqlite3_mutex*); +SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*); + +/* +** CAPI3REF: Mutex Methods Object +** +** An instance of this structure defines the low-level routines +** used to allocate and use mutexes. +** +** Usually, the default mutex implementations provided by SQLite are +** sufficient, however the application has the option of substituting a custom +** implementation for specialized deployments or systems for which SQLite +** does not provide a suitable implementation. In this case, the application +** creates and populates an instance of this structure to pass +** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option. +** Additionally, an instance of this structure can be used as an +** output variable when querying the system for the current mutex +** implementation, using the [SQLITE_CONFIG_GETMUTEX] option. +** +** ^The xMutexInit method defined by this structure is invoked as +** part of system initialization by the sqlite3_initialize() function. +** ^The xMutexInit routine is called by SQLite exactly once for each +** effective call to [sqlite3_initialize()]. +** +** ^The xMutexEnd method defined by this structure is invoked as +** part of system shutdown by the sqlite3_shutdown() function. The +** implementation of this method is expected to release all outstanding +** resources obtained by the mutex methods implementation, especially +** those obtained by the xMutexInit method. ^The xMutexEnd() +** interface is invoked exactly once for each call to [sqlite3_shutdown()]. +** +** ^(The remaining seven methods defined by this structure (xMutexAlloc, +** xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and +** xMutexNotheld) implement the following interfaces (respectively): +** +**
    +**
  • [sqlite3_mutex_alloc()]
  • +**
  • [sqlite3_mutex_free()]
  • +**
  • [sqlite3_mutex_enter()]
  • +**
  • [sqlite3_mutex_try()]
  • +**
  • [sqlite3_mutex_leave()]
  • +**
  • [sqlite3_mutex_held()]
  • +**
  • [sqlite3_mutex_notheld()]
  • +**
)^ +** +** The only difference is that the public sqlite3_XXX functions enumerated +** above silently ignore any invocations that pass a NULL pointer instead +** of a valid mutex handle. The implementations of the methods defined +** by this structure are not required to handle this case, the results +** of passing a NULL pointer instead of a valid mutex handle are undefined +** (i.e. it is acceptable to provide an implementation that segfaults if +** it is passed a NULL pointer). +** +** The xMutexInit() method must be threadsafe. It must be harmless to +** invoke xMutexInit() multiple times within the same process and without +** intervening calls to xMutexEnd(). Second and subsequent calls to +** xMutexInit() must be no-ops. +** +** xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()] +** and its associates). Similarly, xMutexAlloc() must not use SQLite memory +** allocation for a static mutex. ^However xMutexAlloc() may use SQLite +** memory allocation for a fast or recursive mutex. +** +** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is +** called, but only if the prior call to xMutexInit returned SQLITE_OK. +** If xMutexInit fails in any way, it is expected to clean up after itself +** prior to returning. +*/ +typedef struct sqlite3_mutex_methods sqlite3_mutex_methods; +struct sqlite3_mutex_methods { + int (*xMutexInit)(void); + int (*xMutexEnd)(void); + sqlite3_mutex* (*xMutexAlloc)(int); + void (*xMutexFree)(sqlite3_mutex*); + void (*xMutexEnter)(sqlite3_mutex*); + int (*xMutexTry)(sqlite3_mutex*); + void (*xMutexLeave)(sqlite3_mutex*); + int (*xMutexHeld)(sqlite3_mutex*); + int (*xMutexNotheld)(sqlite3_mutex*); +}; + +/* +** CAPI3REF: Mutex Verification Routines +** +** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines +** are intended for use inside assert() statements. The SQLite core +** never uses these routines except inside an assert() and applications +** are advised to follow the lead of the core. The SQLite core only +** provides implementations for these routines when it is compiled +** with the SQLITE_DEBUG flag. External mutex implementations +** are only required to provide these routines if SQLITE_DEBUG is +** defined and if NDEBUG is not defined. +** +** These routines should return true if the mutex in their argument +** is held or not held, respectively, by the calling thread. +** +** The implementation is not required to provide versions of these +** routines that actually work. If the implementation does not provide working +** versions of these routines, it should at least provide stubs that always +** return true so that one does not get spurious assertion failures. +** +** If the argument to sqlite3_mutex_held() is a NULL pointer then +** the routine should return 1. This seems counter-intuitive since +** clearly the mutex cannot be held if it does not exist. But +** the reason the mutex does not exist is because the build is not +** using mutexes. And we do not want the assert() containing the +** call to sqlite3_mutex_held() to fail, so a non-zero return is +** the appropriate thing to do. The sqlite3_mutex_notheld() +** interface should also return 1 when given a NULL pointer. +*/ +#ifndef NDEBUG +SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*); +SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*); +#endif + +/* +** CAPI3REF: Mutex Types +** +** The [sqlite3_mutex_alloc()] interface takes a single argument +** which is one of these integer constants. +** +** The set of static mutexes may change from one SQLite release to the +** next. Applications that override the built-in mutex logic must be +** prepared to accommodate additional static mutexes. +*/ +#define SQLITE_MUTEX_FAST 0 +#define SQLITE_MUTEX_RECURSIVE 1 +#define SQLITE_MUTEX_STATIC_MASTER 2 +#define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */ +#define SQLITE_MUTEX_STATIC_MEM2 4 /* NOT USED */ +#define SQLITE_MUTEX_STATIC_OPEN 4 /* sqlite3BtreeOpen() */ +#define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_randomness() */ +#define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */ +#define SQLITE_MUTEX_STATIC_LRU2 7 /* NOT USED */ +#define SQLITE_MUTEX_STATIC_PMEM 7 /* sqlite3PageMalloc() */ +#define SQLITE_MUTEX_STATIC_APP1 8 /* For use by application */ +#define SQLITE_MUTEX_STATIC_APP2 9 /* For use by application */ +#define SQLITE_MUTEX_STATIC_APP3 10 /* For use by application */ +#define SQLITE_MUTEX_STATIC_VFS1 11 /* For use by built-in VFS */ +#define SQLITE_MUTEX_STATIC_VFS2 12 /* For use by extension VFS */ +#define SQLITE_MUTEX_STATIC_VFS3 13 /* For use by application VFS */ + +/* +** CAPI3REF: Retrieve the mutex for a database connection +** METHOD: sqlite3 +** +** ^This interface returns a pointer the [sqlite3_mutex] object that +** serializes access to the [database connection] given in the argument +** when the [threading mode] is Serialized. +** ^If the [threading mode] is Single-thread or Multi-thread then this +** routine returns a NULL pointer. +*/ +SQLITE_API sqlite3_mutex* sqlite3_db_mutex(sqlite3*); + +/* +** CAPI3REF: Low-Level Control Of Database Files +** METHOD: sqlite3 +** +** ^The [sqlite3_file_control()] interface makes a direct call to the +** xFileControl method for the [sqlite3_io_methods] object associated +** with a particular database identified by the second argument. ^The +** name of the database is "main" for the main database or "temp" for the +** TEMP database, or the name that appears after the AS keyword for +** databases that are added using the [ATTACH] SQL command. +** ^A NULL pointer can be used in place of "main" to refer to the +** main database file. +** ^The third and fourth parameters to this routine +** are passed directly through to the second and third parameters of +** the xFileControl method. ^The return value of the xFileControl +** method becomes the return value of this routine. +** +** ^The [SQLITE_FCNTL_FILE_POINTER] value for the op parameter causes +** a pointer to the underlying [sqlite3_file] object to be written into +** the space pointed to by the 4th parameter. ^The [SQLITE_FCNTL_FILE_POINTER] +** case is a short-circuit path which does not actually invoke the +** underlying sqlite3_io_methods.xFileControl method. +** +** ^If the second parameter (zDbName) does not match the name of any +** open database file, then SQLITE_ERROR is returned. ^This error +** code is not remembered and will not be recalled by [sqlite3_errcode()] +** or [sqlite3_errmsg()]. The underlying xFileControl method might +** also return SQLITE_ERROR. There is no way to distinguish between +** an incorrect zDbName and an SQLITE_ERROR return from the underlying +** xFileControl method. +** +** See also: [file control opcodes] +*/ +SQLITE_API int +sqlite3_file_control(sqlite3*, const char* zDbName, int op, void*); + +/* +** CAPI3REF: Testing Interface +** +** ^The sqlite3_test_control() interface is used to read out internal +** state of SQLite and to inject faults into SQLite for testing +** purposes. ^The first parameter is an operation code that determines +** the number, meaning, and operation of all subsequent parameters. +** +** This interface is not for use by applications. It exists solely +** for verifying the correct operation of the SQLite library. Depending +** on how the SQLite library is compiled, this interface might not exist. +** +** The details of the operation codes, their meanings, the parameters +** they take, and what they do are all subject to change without notice. +** Unlike most of the SQLite API, this function is not guaranteed to +** operate consistently from one release to the next. +*/ +SQLITE_API int sqlite3_test_control(int op, ...); + +/* +** CAPI3REF: Testing Interface Operation Codes +** +** These constants are the valid operation code parameters used +** as the first argument to [sqlite3_test_control()]. +** +** These parameters and their meanings are subject to change +** without notice. These values are for testing purposes only. +** Applications should not use any of these parameters or the +** [sqlite3_test_control()] interface. +*/ +#define SQLITE_TESTCTRL_FIRST 5 +#define SQLITE_TESTCTRL_PRNG_SAVE 5 +#define SQLITE_TESTCTRL_PRNG_RESTORE 6 +#define SQLITE_TESTCTRL_PRNG_RESET 7 +#define SQLITE_TESTCTRL_BITVEC_TEST 8 +#define SQLITE_TESTCTRL_FAULT_INSTALL 9 +#define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10 +#define SQLITE_TESTCTRL_PENDING_BYTE 11 +#define SQLITE_TESTCTRL_ASSERT 12 +#define SQLITE_TESTCTRL_ALWAYS 13 +#define SQLITE_TESTCTRL_RESERVE 14 +#define SQLITE_TESTCTRL_OPTIMIZATIONS 15 +#define SQLITE_TESTCTRL_ISKEYWORD 16 +#define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */ +#define SQLITE_TESTCTRL_LOCALTIME_FAULT 18 +#define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */ +#define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD 19 +#define SQLITE_TESTCTRL_NEVER_CORRUPT 20 +#define SQLITE_TESTCTRL_VDBE_COVERAGE 21 +#define SQLITE_TESTCTRL_BYTEORDER 22 +#define SQLITE_TESTCTRL_ISINIT 23 +#define SQLITE_TESTCTRL_SORTER_MMAP 24 +#define SQLITE_TESTCTRL_IMPOSTER 25 +#define SQLITE_TESTCTRL_PARSER_COVERAGE 26 +#define SQLITE_TESTCTRL_LAST 26 /* Largest TESTCTRL */ + +/* +** CAPI3REF: SQLite Runtime Status +** +** ^These interfaces are used to retrieve runtime status information +** about the performance of SQLite, and optionally to reset various +** highwater marks. ^The first argument is an integer code for +** the specific parameter to measure. ^(Recognized integer codes +** are of the form [status parameters | SQLITE_STATUS_...].)^ +** ^The current value of the parameter is returned into *pCurrent. +** ^The highest recorded value is returned in *pHighwater. ^If the +** resetFlag is true, then the highest record value is reset after +** *pHighwater is written. ^(Some parameters do not record the highest +** value. For those parameters +** nothing is written into *pHighwater and the resetFlag is ignored.)^ +** ^(Other parameters record only the highwater mark and not the current +** value. For these latter parameters nothing is written into *pCurrent.)^ +** +** ^The sqlite3_status() and sqlite3_status64() routines return +** SQLITE_OK on success and a non-zero [error code] on failure. +** +** If either the current value or the highwater mark is too large to +** be represented by a 32-bit integer, then the values returned by +** sqlite3_status() are undefined. +** +** See also: [sqlite3_db_status()] +*/ +SQLITE_API int +sqlite3_status(int op, int* pCurrent, int* pHighwater, int resetFlag); +SQLITE_API int sqlite3_status64( + int op, + sqlite3_int64* pCurrent, + sqlite3_int64* pHighwater, + int resetFlag); + +/* +** CAPI3REF: Status Parameters +** KEYWORDS: {status parameters} +** +** These integer constants designate various run-time status parameters +** that can be returned by [sqlite3_status()]. +** +**
+** [[SQLITE_STATUS_MEMORY_USED]] ^(
SQLITE_STATUS_MEMORY_USED
+**
This parameter is the current amount of memory checked out +** using [sqlite3_malloc()], either directly or indirectly. The +** figure includes calls made to [sqlite3_malloc()] by the application +** and internal memory usage by the SQLite library. Auxiliary page-cache +** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in +** this parameter. The amount returned is the sum of the allocation +** sizes as reported by the xSize method in [sqlite3_mem_methods].
)^ +** +** [[SQLITE_STATUS_MALLOC_SIZE]] ^(
SQLITE_STATUS_MALLOC_SIZE
+**
This parameter records the largest memory allocation request +** handed to [sqlite3_malloc()] or [sqlite3_realloc()] (or their +** internal equivalents). Only the value returned in the +** *pHighwater parameter to [sqlite3_status()] is of interest. +** The value written into the *pCurrent parameter is undefined.
)^ +** +** [[SQLITE_STATUS_MALLOC_COUNT]] ^(
SQLITE_STATUS_MALLOC_COUNT
+**
This parameter records the number of separate memory allocations +** currently checked out.
)^ +** +** [[SQLITE_STATUS_PAGECACHE_USED]] ^(
SQLITE_STATUS_PAGECACHE_USED
+**
This parameter returns the number of pages used out of the +** [pagecache memory allocator] that was configured using +** [SQLITE_CONFIG_PAGECACHE]. The +** value returned is in pages, not in bytes.
)^ +** +** [[SQLITE_STATUS_PAGECACHE_OVERFLOW]] +** ^(
SQLITE_STATUS_PAGECACHE_OVERFLOW
+**
This parameter returns the number of bytes of page cache +** allocation which could not be satisfied by the [SQLITE_CONFIG_PAGECACHE] +** buffer and where forced to overflow to [sqlite3_malloc()]. The +** returned value includes allocations that overflowed because they +** where too large (they were larger than the "sz" parameter to +** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because +** no space was left in the page cache.
)^ +** +** [[SQLITE_STATUS_PAGECACHE_SIZE]] ^(
SQLITE_STATUS_PAGECACHE_SIZE
+**
This parameter records the largest memory allocation request +** handed to [pagecache memory allocator]. Only the value returned in the +** *pHighwater parameter to [sqlite3_status()] is of interest. +** The value written into the *pCurrent parameter is undefined.
)^ +** +** [[SQLITE_STATUS_SCRATCH_USED]]
SQLITE_STATUS_SCRATCH_USED
+**
No longer used.
+** +** [[SQLITE_STATUS_SCRATCH_OVERFLOW]] ^(
SQLITE_STATUS_SCRATCH_OVERFLOW
+**
No longer used.
+** +** [[SQLITE_STATUS_SCRATCH_SIZE]]
SQLITE_STATUS_SCRATCH_SIZE
+**
No longer used.
+** +** [[SQLITE_STATUS_PARSER_STACK]] ^(
SQLITE_STATUS_PARSER_STACK
+**
The *pHighwater parameter records the deepest parser stack. +** The *pCurrent value is undefined. The *pHighwater value is only +** meaningful if SQLite is compiled with [YYTRACKMAXSTACKDEPTH].
)^ +**
+** +** New status parameters may be added from time to time. +*/ +#define SQLITE_STATUS_MEMORY_USED 0 +#define SQLITE_STATUS_PAGECACHE_USED 1 +#define SQLITE_STATUS_PAGECACHE_OVERFLOW 2 +#define SQLITE_STATUS_SCRATCH_USED 3 /* NOT USED */ +#define SQLITE_STATUS_SCRATCH_OVERFLOW 4 /* NOT USED */ +#define SQLITE_STATUS_MALLOC_SIZE 5 +#define SQLITE_STATUS_PARSER_STACK 6 +#define SQLITE_STATUS_PAGECACHE_SIZE 7 +#define SQLITE_STATUS_SCRATCH_SIZE 8 /* NOT USED */ +#define SQLITE_STATUS_MALLOC_COUNT 9 + +/* +** CAPI3REF: Database Connection Status +** METHOD: sqlite3 +** +** ^This interface is used to retrieve runtime status information +** about a single [database connection]. ^The first argument is the +** database connection object to be interrogated. ^The second argument +** is an integer constant, taken from the set of +** [SQLITE_DBSTATUS options], that +** determines the parameter to interrogate. The set of +** [SQLITE_DBSTATUS options] is likely +** to grow in future releases of SQLite. +** +** ^The current value of the requested parameter is written into *pCur +** and the highest instantaneous value is written into *pHiwtr. ^If +** the resetFlg is true, then the highest instantaneous value is +** reset back down to the current value. +** +** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a +** non-zero [error code] on failure. +** +** See also: [sqlite3_status()] and [sqlite3_stmt_status()]. +*/ +SQLITE_API int +sqlite3_db_status(sqlite3*, int op, int* pCur, int* pHiwtr, int resetFlg); + +/* +** CAPI3REF: Status Parameters for database connections +** KEYWORDS: {SQLITE_DBSTATUS options} +** +** These constants are the available integer "verbs" that can be passed as +** the second argument to the [sqlite3_db_status()] interface. +** +** New verbs may be added in future releases of SQLite. Existing verbs +** might be discontinued. Applications should check the return code from +** [sqlite3_db_status()] to make sure that the call worked. +** The [sqlite3_db_status()] interface will return a non-zero error code +** if a discontinued or unsupported verb is invoked. +** +**
+** [[SQLITE_DBSTATUS_LOOKASIDE_USED]] ^(
SQLITE_DBSTATUS_LOOKASIDE_USED
+**
This parameter returns the number of lookaside memory slots currently +** checked out.
)^ +** +** [[SQLITE_DBSTATUS_LOOKASIDE_HIT]] ^(
SQLITE_DBSTATUS_LOOKASIDE_HIT
+**
This parameter returns the number malloc attempts that were +** satisfied using lookaside memory. Only the high-water value is meaningful; +** the current value is always zero.)^ +** +** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE]] +** ^(
SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE
+**
This parameter returns the number malloc attempts that might have +** been satisfied using lookaside memory but failed due to the amount of +** memory requested being larger than the lookaside slot size. +** Only the high-water value is meaningful; +** the current value is always zero.)^ +** +** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL]] +** ^(
SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL
+**
This parameter returns the number malloc attempts that might have +** been satisfied using lookaside memory but failed due to all lookaside +** memory already being in use. +** Only the high-water value is meaningful; +** the current value is always zero.)^ +** +** [[SQLITE_DBSTATUS_CACHE_USED]] ^(
SQLITE_DBSTATUS_CACHE_USED
+**
This parameter returns the approximate number of bytes of heap +** memory used by all pager caches associated with the database connection.)^ +** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0. +** +** [[SQLITE_DBSTATUS_CACHE_USED_SHARED]] +** ^(
SQLITE_DBSTATUS_CACHE_USED_SHARED
+**
This parameter is similar to DBSTATUS_CACHE_USED, except that if a +** pager cache is shared between two or more connections the bytes of heap +** memory used by that pager cache is divided evenly between the attached +** connections.)^ In other words, if none of the pager caches associated +** with the database connection are shared, this request returns the same +** value as DBSTATUS_CACHE_USED. Or, if one or more or the pager caches are +** shared, the value returned by this call will be smaller than that returned +** by DBSTATUS_CACHE_USED. ^The highwater mark associated with +** SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0. +** +** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(
SQLITE_DBSTATUS_SCHEMA_USED
+**
This parameter returns the approximate number of bytes of heap +** memory used to store the schema for all databases associated +** with the connection - main, temp, and any [ATTACH]-ed databases.)^ +** ^The full amount of memory used by the schemas is reported, even if the +** schema memory is shared with other database connections due to +** [shared cache mode] being enabled. +** ^The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always 0. +** +** [[SQLITE_DBSTATUS_STMT_USED]] ^(
SQLITE_DBSTATUS_STMT_USED
+**
This parameter returns the approximate number of bytes of heap +** and lookaside memory used by all prepared statements associated with +** the database connection.)^ +** ^The highwater mark associated with SQLITE_DBSTATUS_STMT_USED is always 0. +**
+** +** [[SQLITE_DBSTATUS_CACHE_HIT]] ^(
SQLITE_DBSTATUS_CACHE_HIT
+**
This parameter returns the number of pager cache hits that have +** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_HIT +** is always 0. +**
+** +** [[SQLITE_DBSTATUS_CACHE_MISS]] ^(
SQLITE_DBSTATUS_CACHE_MISS
+**
This parameter returns the number of pager cache misses that have +** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_MISS +** is always 0. +**
+** +** [[SQLITE_DBSTATUS_CACHE_WRITE]] ^(
SQLITE_DBSTATUS_CACHE_WRITE
+**
This parameter returns the number of dirty cache entries that have +** been written to disk. Specifically, the number of pages written to the +** wal file in wal mode databases, or the number of pages written to the +** database file in rollback mode databases. Any pages written as part of +** transaction rollback or database recovery operations are not included. +** If an IO or other error occurs while writing a page to disk, the effect +** on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is undefined.)^ ^The +** highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always 0. +**
+** +** [[SQLITE_DBSTATUS_CACHE_SPILL]] ^(
SQLITE_DBSTATUS_CACHE_SPILL
+**
This parameter returns the number of dirty cache entries that have +** been written to disk in the middle of a transaction due to the page +** cache overflowing. Transactions are more efficient if they are written +** to disk all at once. When pages spill mid-transaction, that introduces +** additional overhead. This parameter can be used help identify +** inefficiencies that can be resolve by increasing the cache size. +**
+** +** [[SQLITE_DBSTATUS_DEFERRED_FKS]] ^(
SQLITE_DBSTATUS_DEFERRED_FKS
+**
This parameter returns zero for the current value if and only if +** all foreign key constraints (deferred or immediate) have been +** resolved.)^ ^The highwater mark is always 0. +**
+**
+*/ +#define SQLITE_DBSTATUS_LOOKASIDE_USED 0 +#define SQLITE_DBSTATUS_CACHE_USED 1 +#define SQLITE_DBSTATUS_SCHEMA_USED 2 +#define SQLITE_DBSTATUS_STMT_USED 3 +#define SQLITE_DBSTATUS_LOOKASIDE_HIT 4 +#define SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE 5 +#define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL 6 +#define SQLITE_DBSTATUS_CACHE_HIT 7 +#define SQLITE_DBSTATUS_CACHE_MISS 8 +#define SQLITE_DBSTATUS_CACHE_WRITE 9 +#define SQLITE_DBSTATUS_DEFERRED_FKS 10 +#define SQLITE_DBSTATUS_CACHE_USED_SHARED 11 +#define SQLITE_DBSTATUS_CACHE_SPILL 12 +#define SQLITE_DBSTATUS_MAX 12 /* Largest defined DBSTATUS */ + +/* +** CAPI3REF: Prepared Statement Status +** METHOD: sqlite3_stmt +** +** ^(Each prepared statement maintains various +** [SQLITE_STMTSTATUS counters] that measure the number +** of times it has performed specific operations.)^ These counters can +** be used to monitor the performance characteristics of the prepared +** statements. For example, if the number of table steps greatly exceeds +** the number of table searches or result rows, that would tend to indicate +** that the prepared statement is using a full table scan rather than +** an index. +** +** ^(This interface is used to retrieve and reset counter values from +** a [prepared statement]. The first argument is the prepared statement +** object to be interrogated. The second argument +** is an integer code for a specific [SQLITE_STMTSTATUS counter] +** to be interrogated.)^ +** ^The current value of the requested counter is returned. +** ^If the resetFlg is true, then the counter is reset to zero after this +** interface call returns. +** +** See also: [sqlite3_status()] and [sqlite3_db_status()]. +*/ +SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op, int resetFlg); + +/* +** CAPI3REF: Status Parameters for prepared statements +** KEYWORDS: {SQLITE_STMTSTATUS counter} {SQLITE_STMTSTATUS counters} +** +** These preprocessor macros define integer codes that name counter +** values associated with the [sqlite3_stmt_status()] interface. +** The meanings of the various counters are as follows: +** +**
+** [[SQLITE_STMTSTATUS_FULLSCAN_STEP]]
SQLITE_STMTSTATUS_FULLSCAN_STEP
+**
^This is the number of times that SQLite has stepped forward in +** a table as part of a full table scan. Large numbers for this counter +** may indicate opportunities for performance improvement through +** careful use of indices.
+** +** [[SQLITE_STMTSTATUS_SORT]]
SQLITE_STMTSTATUS_SORT
+**
^This is the number of sort operations that have occurred. +** A non-zero value in this counter may indicate an opportunity to +** improvement performance through careful use of indices.
+** +** [[SQLITE_STMTSTATUS_AUTOINDEX]]
SQLITE_STMTSTATUS_AUTOINDEX
+**
^This is the number of rows inserted into transient indices that +** were created automatically in order to help joins run faster. +** A non-zero value in this counter may indicate an opportunity to +** improvement performance by adding permanent indices that do not +** need to be reinitialized each time the statement is run.
+** +** [[SQLITE_STMTSTATUS_VM_STEP]]
SQLITE_STMTSTATUS_VM_STEP
+**
^This is the number of virtual machine operations executed +** by the prepared statement if that number is less than or equal +** to 2147483647. The number of virtual machine operations can be +** used as a proxy for the total work done by the prepared statement. +** If the number of virtual machine operations exceeds 2147483647 +** then the value returned by this statement status code is undefined. +** +** [[SQLITE_STMTSTATUS_REPREPARE]]
SQLITE_STMTSTATUS_REPREPARE
+**
^This is the number of times that the prepare statement has been +** automatically regenerated due to schema changes or change to +** [bound parameters] that might affect the query plan. +** +** [[SQLITE_STMTSTATUS_RUN]]
SQLITE_STMTSTATUS_RUN
+**
^This is the number of times that the prepared statement has +** been run. A single "run" for the purposes of this counter is one +** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()]. +** The counter is incremented on the first [sqlite3_step()] call of each +** cycle. +** +** [[SQLITE_STMTSTATUS_MEMUSED]]
SQLITE_STMTSTATUS_MEMUSED
+**
^This is the approximate number of bytes of heap memory +** used to store the prepared statement. ^This value is not actually +** a counter, and so the resetFlg parameter to sqlite3_stmt_status() +** is ignored when the opcode is SQLITE_STMTSTATUS_MEMUSED. +**
+**
+*/ +#define SQLITE_STMTSTATUS_FULLSCAN_STEP 1 +#define SQLITE_STMTSTATUS_SORT 2 +#define SQLITE_STMTSTATUS_AUTOINDEX 3 +#define SQLITE_STMTSTATUS_VM_STEP 4 +#define SQLITE_STMTSTATUS_REPREPARE 5 +#define SQLITE_STMTSTATUS_RUN 6 +#define SQLITE_STMTSTATUS_MEMUSED 99 + +/* +** CAPI3REF: Custom Page Cache Object +** +** The sqlite3_pcache type is opaque. It is implemented by +** the pluggable module. The SQLite core has no knowledge of +** its size or internal structure and never deals with the +** sqlite3_pcache object except by holding and passing pointers +** to the object. +** +** See [sqlite3_pcache_methods2] for additional information. +*/ +typedef struct sqlite3_pcache sqlite3_pcache; + +/* +** CAPI3REF: Custom Page Cache Object +** +** The sqlite3_pcache_page object represents a single page in the +** page cache. The page cache will allocate instances of this +** object. Various methods of the page cache use pointers to instances +** of this object as parameters or as their return value. +** +** See [sqlite3_pcache_methods2] for additional information. +*/ +typedef struct sqlite3_pcache_page sqlite3_pcache_page; +struct sqlite3_pcache_page { + void* pBuf; /* The content of the page */ + void* pExtra; /* Extra information associated with the page */ +}; + +/* +** CAPI3REF: Application Defined Page Cache. +** KEYWORDS: {page cache} +** +** ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can +** register an alternative page cache implementation by passing in an +** instance of the sqlite3_pcache_methods2 structure.)^ +** In many applications, most of the heap memory allocated by +** SQLite is used for the page cache. +** By implementing a +** custom page cache using this API, an application can better control +** the amount of memory consumed by SQLite, the way in which +** that memory is allocated and released, and the policies used to +** determine exactly which parts of a database file are cached and for +** how long. +** +** The alternative page cache mechanism is an +** extreme measure that is only needed by the most demanding applications. +** The built-in page cache is recommended for most uses. +** +** ^(The contents of the sqlite3_pcache_methods2 structure are copied to an +** internal buffer by SQLite within the call to [sqlite3_config]. Hence +** the application may discard the parameter after the call to +** [sqlite3_config()] returns.)^ +** +** [[the xInit() page cache method]] +** ^(The xInit() method is called once for each effective +** call to [sqlite3_initialize()])^ +** (usually only once during the lifetime of the process). ^(The xInit() +** method is passed a copy of the sqlite3_pcache_methods2.pArg value.)^ +** The intent of the xInit() method is to set up global data structures +** required by the custom page cache implementation. +** ^(If the xInit() method is NULL, then the +** built-in default page cache is used instead of the application defined +** page cache.)^ +** +** [[the xShutdown() page cache method]] +** ^The xShutdown() method is called by [sqlite3_shutdown()]. +** It can be used to clean up +** any outstanding resources before process shutdown, if required. +** ^The xShutdown() method may be NULL. +** +** ^SQLite automatically serializes calls to the xInit method, +** so the xInit method need not be threadsafe. ^The +** xShutdown method is only called from [sqlite3_shutdown()] so it does +** not need to be threadsafe either. All other methods must be threadsafe +** in multithreaded applications. +** +** ^SQLite will never invoke xInit() more than once without an intervening +** call to xShutdown(). +** +** [[the xCreate() page cache methods]] +** ^SQLite invokes the xCreate() method to construct a new cache instance. +** SQLite will typically create one cache instance for each open database file, +** though this is not guaranteed. ^The +** first parameter, szPage, is the size in bytes of the pages that must +** be allocated by the cache. ^szPage will always a power of two. ^The +** second parameter szExtra is a number of bytes of extra storage +** associated with each page cache entry. ^The szExtra parameter will +** a number less than 250. SQLite will use the +** extra szExtra bytes on each page to store metadata about the underlying +** database page on disk. The value passed into szExtra depends +** on the SQLite version, the target platform, and how SQLite was compiled. +** ^The third argument to xCreate(), bPurgeable, is true if the cache being +** created will be used to cache database pages of a file stored on disk, or +** false if it is used for an in-memory database. The cache implementation +** does not have to do anything special based with the value of bPurgeable; +** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will +** never invoke xUnpin() except to deliberately delete a page. +** ^In other words, calls to xUnpin() on a cache with bPurgeable set to +** false will always have the "discard" flag set to true. +** ^Hence, a cache created with bPurgeable false will +** never contain any unpinned pages. +** +** [[the xCachesize() page cache method]] +** ^(The xCachesize() method may be called at any time by SQLite to set the +** suggested maximum cache-size (number of pages stored by) the cache +** instance passed as the first argument. This is the value configured using +** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable +** parameter, the implementation is not required to do anything with this +** value; it is advisory only. +** +** [[the xPagecount() page cache methods]] +** The xPagecount() method must return the number of pages currently +** stored in the cache, both pinned and unpinned. +** +** [[the xFetch() page cache methods]] +** The xFetch() method locates a page in the cache and returns a pointer to +** an sqlite3_pcache_page object associated with that page, or a NULL pointer. +** The pBuf element of the returned sqlite3_pcache_page object will be a +** pointer to a buffer of szPage bytes used to store the content of a +** single database page. The pExtra element of sqlite3_pcache_page will be +** a pointer to the szExtra bytes of extra storage that SQLite has requested +** for each entry in the page cache. +** +** The page to be fetched is determined by the key. ^The minimum key value +** is 1. After it has been retrieved using xFetch, the page is considered +** to be "pinned". +** +** If the requested page is already in the page cache, then the page cache +** implementation must return a pointer to the page buffer with its content +** intact. If the requested page is not already in the cache, then the +** cache implementation should use the value of the createFlag +** parameter to help it determined what action to take: +** +** +**
createFlag Behavior when page is not already in cache +**
0 Do not allocate a new page. Return NULL. +**
1 Allocate a new page if it easy and convenient to do so. +** Otherwise return NULL. +**
2 Make every effort to allocate a new page. Only return +** NULL if allocating a new page is effectively impossible. +**
+** +** ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1. SQLite +** will only use a createFlag of 2 after a prior call with a createFlag of 1 +** failed.)^ In between the to xFetch() calls, SQLite may +** attempt to unpin one or more cache pages by spilling the content of +** pinned pages to disk and synching the operating system disk cache. +** +** [[the xUnpin() page cache method]] +** ^xUnpin() is called by SQLite with a pointer to a currently pinned page +** as its second argument. If the third parameter, discard, is non-zero, +** then the page must be evicted from the cache. +** ^If the discard parameter is +** zero, then the page may be discarded or retained at the discretion of +** page cache implementation. ^The page cache implementation +** may choose to evict unpinned pages at any time. +** +** The cache must not perform any reference counting. A single +** call to xUnpin() unpins the page regardless of the number of prior calls +** to xFetch(). +** +** [[the xRekey() page cache methods]] +** The xRekey() method is used to change the key value associated with the +** page passed as the second argument. If the cache +** previously contains an entry associated with newKey, it must be +** discarded. ^Any prior cache entry associated with newKey is guaranteed not +** to be pinned. +** +** When SQLite calls the xTruncate() method, the cache must discard all +** existing cache entries with page numbers (keys) greater than or equal +** to the value of the iLimit parameter passed to xTruncate(). If any +** of these pages are pinned, they are implicitly unpinned, meaning that +** they can be safely discarded. +** +** [[the xDestroy() page cache method]] +** ^The xDestroy() method is used to delete a cache allocated by xCreate(). +** All resources associated with the specified cache should be freed. ^After +** calling the xDestroy() method, SQLite considers the [sqlite3_pcache*] +** handle invalid, and will not use it with any other sqlite3_pcache_methods2 +** functions. +** +** [[the xShrink() page cache method]] +** ^SQLite invokes the xShrink() method when it wants the page cache to +** free up as much of heap memory as possible. The page cache implementation +** is not obligated to free any memory, but well-behaved implementations should +** do their best. +*/ +typedef struct sqlite3_pcache_methods2 sqlite3_pcache_methods2; +struct sqlite3_pcache_methods2 { + int iVersion; + void* pArg; + int (*xInit)(void*); + void (*xShutdown)(void*); + sqlite3_pcache* (*xCreate)(int szPage, int szExtra, int bPurgeable); + void (*xCachesize)(sqlite3_pcache*, int nCachesize); + int (*xPagecount)(sqlite3_pcache*); + sqlite3_pcache_page* (*xFetch)(sqlite3_pcache*, unsigned key, int createFlag); + void (*xUnpin)(sqlite3_pcache*, sqlite3_pcache_page*, int discard); + void (*xRekey)( + sqlite3_pcache*, + sqlite3_pcache_page*, + unsigned oldKey, + unsigned newKey); + void (*xTruncate)(sqlite3_pcache*, unsigned iLimit); + void (*xDestroy)(sqlite3_pcache*); + void (*xShrink)(sqlite3_pcache*); +}; + +/* +** This is the obsolete pcache_methods object that has now been replaced +** by sqlite3_pcache_methods2. This object is not used by SQLite. It is +** retained in the header file for backwards compatibility only. +*/ +typedef struct sqlite3_pcache_methods sqlite3_pcache_methods; +struct sqlite3_pcache_methods { + void* pArg; + int (*xInit)(void*); + void (*xShutdown)(void*); + sqlite3_pcache* (*xCreate)(int szPage, int bPurgeable); + void (*xCachesize)(sqlite3_pcache*, int nCachesize); + int (*xPagecount)(sqlite3_pcache*); + void* (*xFetch)(sqlite3_pcache*, unsigned key, int createFlag); + void (*xUnpin)(sqlite3_pcache*, void*, int discard); + void (*xRekey)(sqlite3_pcache*, void*, unsigned oldKey, unsigned newKey); + void (*xTruncate)(sqlite3_pcache*, unsigned iLimit); + void (*xDestroy)(sqlite3_pcache*); +}; + +/* +** CAPI3REF: Online Backup Object +** +** The sqlite3_backup object records state information about an ongoing +** online backup operation. ^The sqlite3_backup object is created by +** a call to [sqlite3_backup_init()] and is destroyed by a call to +** [sqlite3_backup_finish()]. +** +** See Also: [Using the SQLite Online Backup API] +*/ +typedef struct sqlite3_backup sqlite3_backup; + +/* +** CAPI3REF: Online Backup API. +** +** The backup API copies the content of one database into another. +** It is useful either for creating backups of databases or +** for copying in-memory databases to or from persistent files. +** +** See Also: [Using the SQLite Online Backup API] +** +** ^SQLite holds a write transaction open on the destination database file +** for the duration of the backup operation. +** ^The source database is read-locked only while it is being read; +** it is not locked continuously for the entire backup operation. +** ^Thus, the backup may be performed on a live source database without +** preventing other database connections from +** reading or writing to the source database while the backup is underway. +** +** ^(To perform a backup operation: +**
    +**
  1. sqlite3_backup_init() is called once to initialize the +** backup, +**
  2. sqlite3_backup_step() is called one or more times to transfer +** the data between the two databases, and finally +**
  3. sqlite3_backup_finish() is called to release all resources +** associated with the backup operation. +**
)^ +** There should be exactly one call to sqlite3_backup_finish() for each +** successful call to sqlite3_backup_init(). +** +** [[sqlite3_backup_init()]] sqlite3_backup_init() +** +** ^The D and N arguments to sqlite3_backup_init(D,N,S,M) are the +** [database connection] associated with the destination database +** and the database name, respectively. +** ^The database name is "main" for the main database, "temp" for the +** temporary database, or the name specified after the AS keyword in +** an [ATTACH] statement for an attached database. +** ^The S and M arguments passed to +** sqlite3_backup_init(D,N,S,M) identify the [database connection] +** and database name of the source database, respectively. +** ^The source and destination [database connections] (parameters S and D) +** must be different or else sqlite3_backup_init(D,N,S,M) will fail with +** an error. +** +** ^A call to sqlite3_backup_init() will fail, returning NULL, if +** there is already a read or read-write transaction open on the +** destination database. +** +** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is +** returned and an error code and error message are stored in the +** destination [database connection] D. +** ^The error code and message for the failed call to sqlite3_backup_init() +** can be retrieved using the [sqlite3_errcode()], [sqlite3_errmsg()], and/or +** [sqlite3_errmsg16()] functions. +** ^A successful call to sqlite3_backup_init() returns a pointer to an +** [sqlite3_backup] object. +** ^The [sqlite3_backup] object may be used with the sqlite3_backup_step() and +** sqlite3_backup_finish() functions to perform the specified backup +** operation. +** +** [[sqlite3_backup_step()]] sqlite3_backup_step() +** +** ^Function sqlite3_backup_step(B,N) will copy up to N pages between +** the source and destination databases specified by [sqlite3_backup] object B. +** ^If N is negative, all remaining source pages are copied. +** ^If sqlite3_backup_step(B,N) successfully copies N pages and there +** are still more pages to be copied, then the function returns [SQLITE_OK]. +** ^If sqlite3_backup_step(B,N) successfully finishes copying all pages +** from source to destination, then it returns [SQLITE_DONE]. +** ^If an error occurs while running sqlite3_backup_step(B,N), +** then an [error code] is returned. ^As well as [SQLITE_OK] and +** [SQLITE_DONE], a call to sqlite3_backup_step() may return [SQLITE_READONLY], +** [SQLITE_NOMEM], [SQLITE_BUSY], [SQLITE_LOCKED], or an +** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX] extended error code. +** +** ^(The sqlite3_backup_step() might return [SQLITE_READONLY] if +**
    +**
  1. the destination database was opened read-only, or +**
  2. the destination database is using write-ahead-log journaling +** and the destination and source page sizes differ, or +**
  3. the destination database is an in-memory database and the +** destination and source page sizes differ. +**
)^ +** +** ^If sqlite3_backup_step() cannot obtain a required file-system lock, then +** the [sqlite3_busy_handler | busy-handler function] +** is invoked (if one is specified). ^If the +** busy-handler returns non-zero before the lock is available, then +** [SQLITE_BUSY] is returned to the caller. ^In this case the call to +** sqlite3_backup_step() can be retried later. ^If the source +** [database connection] +** is being used to write to the source database when sqlite3_backup_step() +** is called, then [SQLITE_LOCKED] is returned immediately. ^Again, in this +** case the call to sqlite3_backup_step() can be retried later on. ^(If +** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX], [SQLITE_NOMEM], or +** [SQLITE_READONLY] is returned, then +** there is no point in retrying the call to sqlite3_backup_step(). These +** errors are considered fatal.)^ The application must accept +** that the backup operation has failed and pass the backup operation handle +** to the sqlite3_backup_finish() to release associated resources. +** +** ^The first call to sqlite3_backup_step() obtains an exclusive lock +** on the destination file. ^The exclusive lock is not released until either +** sqlite3_backup_finish() is called or the backup operation is complete +** and sqlite3_backup_step() returns [SQLITE_DONE]. ^Every call to +** sqlite3_backup_step() obtains a [shared lock] on the source database that +** lasts for the duration of the sqlite3_backup_step() call. +** ^Because the source database is not locked between calls to +** sqlite3_backup_step(), the source database may be modified mid-way +** through the backup process. ^If the source database is modified by an +** external process or via a database connection other than the one being +** used by the backup operation, then the backup will be automatically +** restarted by the next call to sqlite3_backup_step(). ^If the source +** database is modified by the using the same database connection as is used +** by the backup operation, then the backup database is automatically +** updated at the same time. +** +** [[sqlite3_backup_finish()]] sqlite3_backup_finish() +** +** When sqlite3_backup_step() has returned [SQLITE_DONE], or when the +** application wishes to abandon the backup operation, the application +** should destroy the [sqlite3_backup] by passing it to sqlite3_backup_finish(). +** ^The sqlite3_backup_finish() interfaces releases all +** resources associated with the [sqlite3_backup] object. +** ^If sqlite3_backup_step() has not yet returned [SQLITE_DONE], then any +** active write-transaction on the destination database is rolled back. +** The [sqlite3_backup] object is invalid +** and may not be used following a call to sqlite3_backup_finish(). +** +** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no +** sqlite3_backup_step() errors occurred, regardless or whether or not +** sqlite3_backup_step() completed. +** ^If an out-of-memory condition or IO error occurred during any prior +** sqlite3_backup_step() call on the same [sqlite3_backup] object, then +** sqlite3_backup_finish() returns the corresponding [error code]. +** +** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step() +** is not a permanent error and does not affect the return value of +** sqlite3_backup_finish(). +** +** [[sqlite3_backup_remaining()]] [[sqlite3_backup_pagecount()]] +** sqlite3_backup_remaining() and sqlite3_backup_pagecount() +** +** ^The sqlite3_backup_remaining() routine returns the number of pages still +** to be backed up at the conclusion of the most recent sqlite3_backup_step(). +** ^The sqlite3_backup_pagecount() routine returns the total number of pages +** in the source database at the conclusion of the most recent +** sqlite3_backup_step(). +** ^(The values returned by these functions are only updated by +** sqlite3_backup_step(). If the source database is modified in a way that +** changes the size of the source database or the number of pages remaining, +** those changes are not reflected in the output of sqlite3_backup_pagecount() +** and sqlite3_backup_remaining() until after the next +** sqlite3_backup_step().)^ +** +** Concurrent Usage of Database Handles +** +** ^The source [database connection] may be used by the application for other +** purposes while a backup operation is underway or being initialized. +** ^If SQLite is compiled and configured to support threadsafe database +** connections, then the source database connection may be used concurrently +** from within other threads. +** +** However, the application must guarantee that the destination +** [database connection] is not passed to any other API (by any thread) after +** sqlite3_backup_init() is called and before the corresponding call to +** sqlite3_backup_finish(). SQLite does not currently check to see +** if the application incorrectly accesses the destination [database connection] +** and so no error code is reported, but the operations may malfunction +** nevertheless. Use of the destination database connection while a +** backup is in progress might also also cause a mutex deadlock. +** +** If running in [shared cache mode], the application must +** guarantee that the shared cache used by the destination database +** is not accessed while the backup is running. In practice this means +** that the application must guarantee that the disk file being +** backed up to is not accessed by any connection within the process, +** not just the specific connection that was passed to sqlite3_backup_init(). +** +** The [sqlite3_backup] object itself is partially threadsafe. Multiple +** threads may safely make multiple concurrent calls to sqlite3_backup_step(). +** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount() +** APIs are not strictly speaking threadsafe. If they are invoked at the +** same time as another thread is invoking sqlite3_backup_step() it is +** possible that they return invalid values. +*/ +SQLITE_API sqlite3_backup* sqlite3_backup_init( + sqlite3* pDest, /* Destination database handle */ + const char* zDestName, /* Destination database name */ + sqlite3* pSource, /* Source database handle */ + const char* zSourceName /* Source database name */ + ); +SQLITE_API int sqlite3_backup_step(sqlite3_backup* p, int nPage); +SQLITE_API int sqlite3_backup_finish(sqlite3_backup* p); +SQLITE_API int sqlite3_backup_remaining(sqlite3_backup* p); +SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup* p); + +/* +** CAPI3REF: Unlock Notification +** METHOD: sqlite3 +** +** ^When running in shared-cache mode, a database operation may fail with +** an [SQLITE_LOCKED] error if the required locks on the shared-cache or +** individual tables within the shared-cache cannot be obtained. See +** [SQLite Shared-Cache Mode] for a description of shared-cache locking. +** ^This API may be used to register a callback that SQLite will invoke +** when the connection currently holding the required lock relinquishes it. +** ^This API is only available if the library was compiled with the +** [SQLITE_ENABLE_UNLOCK_NOTIFY] C-preprocessor symbol defined. +** +** See Also: [Using the SQLite Unlock Notification Feature]. +** +** ^Shared-cache locks are released when a database connection concludes +** its current transaction, either by committing it or rolling it back. +** +** ^When a connection (known as the blocked connection) fails to obtain a +** shared-cache lock and SQLITE_LOCKED is returned to the caller, the +** identity of the database connection (the blocking connection) that +** has locked the required resource is stored internally. ^After an +** application receives an SQLITE_LOCKED error, it may call the +** sqlite3_unlock_notify() method with the blocked connection handle as +** the first argument to register for a callback that will be invoked +** when the blocking connections current transaction is concluded. ^The +** callback is invoked from within the [sqlite3_step] or [sqlite3_close] +** call that concludes the blocking connections transaction. +** +** ^(If sqlite3_unlock_notify() is called in a multi-threaded application, +** there is a chance that the blocking connection will have already +** concluded its transaction by the time sqlite3_unlock_notify() is invoked. +** If this happens, then the specified callback is invoked immediately, +** from within the call to sqlite3_unlock_notify().)^ +** +** ^If the blocked connection is attempting to obtain a write-lock on a +** shared-cache table, and more than one other connection currently holds +** a read-lock on the same table, then SQLite arbitrarily selects one of +** the other connections to use as the blocking connection. +** +** ^(There may be at most one unlock-notify callback registered by a +** blocked connection. If sqlite3_unlock_notify() is called when the +** blocked connection already has a registered unlock-notify callback, +** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is +** called with a NULL pointer as its second argument, then any existing +** unlock-notify callback is canceled. ^The blocked connections +** unlock-notify callback may also be canceled by closing the blocked +** connection using [sqlite3_close()]. +** +** The unlock-notify callback is not reentrant. If an application invokes +** any sqlite3_xxx API functions from within an unlock-notify callback, a +** crash or deadlock may be the result. +** +** ^Unless deadlock is detected (see below), sqlite3_unlock_notify() always +** returns SQLITE_OK. +** +** Callback Invocation Details +** +** When an unlock-notify callback is registered, the application provides a +** single void* pointer that is passed to the callback when it is invoked. +** However, the signature of the callback function allows SQLite to pass +** it an array of void* context pointers. The first argument passed to +** an unlock-notify callback is a pointer to an array of void* pointers, +** and the second is the number of entries in the array. +** +** When a blocking connections transaction is concluded, there may be +** more than one blocked connection that has registered for an unlock-notify +** callback. ^If two or more such blocked connections have specified the +** same callback function, then instead of invoking the callback function +** multiple times, it is invoked once with the set of void* context pointers +** specified by the blocked connections bundled together into an array. +** This gives the application an opportunity to prioritize any actions +** related to the set of unblocked database connections. +** +** Deadlock Detection +** +** Assuming that after registering for an unlock-notify callback a +** database waits for the callback to be issued before taking any further +** action (a reasonable assumption), then using this API may cause the +** application to deadlock. For example, if connection X is waiting for +** connection Y's transaction to be concluded, and similarly connection +** Y is waiting on connection X's transaction, then neither connection +** will proceed and the system may remain deadlocked indefinitely. +** +** To avoid this scenario, the sqlite3_unlock_notify() performs deadlock +** detection. ^If a given call to sqlite3_unlock_notify() would put the +** system in a deadlocked state, then SQLITE_LOCKED is returned and no +** unlock-notify callback is registered. The system is said to be in +** a deadlocked state if connection A has registered for an unlock-notify +** callback on the conclusion of connection B's transaction, and connection +** B has itself registered for an unlock-notify callback when connection +** A's transaction is concluded. ^Indirect deadlock is also detected, so +** the system is also considered to be deadlocked if connection B has +** registered for an unlock-notify callback on the conclusion of connection +** C's transaction, where connection C is waiting on connection A. ^Any +** number of levels of indirection are allowed. +** +** The "DROP TABLE" Exception +** +** When a call to [sqlite3_step()] returns SQLITE_LOCKED, it is almost +** always appropriate to call sqlite3_unlock_notify(). There is however, +** one exception. When executing a "DROP TABLE" or "DROP INDEX" statement, +** SQLite checks if there are any currently executing SELECT statements +** that belong to the same connection. If there are, SQLITE_LOCKED is +** returned. In this case there is no "blocking connection", so invoking +** sqlite3_unlock_notify() results in the unlock-notify callback being +** invoked immediately. If the application then re-attempts the "DROP TABLE" +** or "DROP INDEX" query, an infinite loop might be the result. +** +** One way around this problem is to check the extended error code returned +** by an sqlite3_step() call. ^(If there is a blocking connection, then the +** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in +** the special "DROP TABLE/INDEX" case, the extended error code is just +** SQLITE_LOCKED.)^ +*/ +SQLITE_API int sqlite3_unlock_notify( + sqlite3* pBlocked, /* Waiting connection */ + void (*xNotify)(void** apArg, int nArg), /* Callback function to invoke */ + void* pNotifyArg /* Argument to pass to xNotify */ + ); + +/* +** CAPI3REF: String Comparison +** +** ^The [sqlite3_stricmp()] and [sqlite3_strnicmp()] APIs allow applications +** and extensions to compare the contents of two buffers containing UTF-8 +** strings in a case-independent fashion, using the same definition of "case +** independence" that SQLite uses internally when comparing identifiers. +*/ +SQLITE_API int sqlite3_stricmp(const char*, const char*); +SQLITE_API int sqlite3_strnicmp(const char*, const char*, int); + +/* +** CAPI3REF: String Globbing +* +** ^The [sqlite3_strglob(P,X)] interface returns zero if and only if +** string X matches the [GLOB] pattern P. +** ^The definition of [GLOB] pattern matching used in +** [sqlite3_strglob(P,X)] is the same as for the "X GLOB P" operator in the +** SQL dialect understood by SQLite. ^The [sqlite3_strglob(P,X)] function +** is case sensitive. +** +** Note that this routine returns zero on a match and non-zero if the strings +** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()]. +** +** See also: [sqlite3_strlike()]. +*/ +SQLITE_API int sqlite3_strglob(const char* zGlob, const char* zStr); + +/* +** CAPI3REF: String LIKE Matching +* +** ^The [sqlite3_strlike(P,X,E)] interface returns zero if and only if +** string X matches the [LIKE] pattern P with escape character E. +** ^The definition of [LIKE] pattern matching used in +** [sqlite3_strlike(P,X,E)] is the same as for the "X LIKE P ESCAPE E" +** operator in the SQL dialect understood by SQLite. ^For "X LIKE P" without +** the ESCAPE clause, set the E parameter of [sqlite3_strlike(P,X,E)] to 0. +** ^As with the LIKE operator, the [sqlite3_strlike(P,X,E)] function is case +** insensitive - equivalent upper and lower case ASCII characters match +** one another. +** +** ^The [sqlite3_strlike(P,X,E)] function matches Unicode characters, though +** only ASCII characters are case folded. +** +** Note that this routine returns zero on a match and non-zero if the strings +** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()]. +** +** See also: [sqlite3_strglob()]. +*/ +SQLITE_API int +sqlite3_strlike(const char* zGlob, const char* zStr, unsigned int cEsc); + +/* +** CAPI3REF: Error Logging Interface +** +** ^The [sqlite3_log()] interface writes a message into the [error log] +** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()]. +** ^If logging is enabled, the zFormat string and subsequent arguments are +** used with [sqlite3_snprintf()] to generate the final output string. +** +** The sqlite3_log() interface is intended for use by extensions such as +** virtual tables, collating functions, and SQL functions. While there is +** nothing to prevent an application from calling sqlite3_log(), doing so +** is considered bad form. +** +** The zFormat string must not be NULL. +** +** To avoid deadlocks and other threading problems, the sqlite3_log() routine +** will not use dynamically allocated memory. The log message is stored in +** a fixed-length buffer on the stack. If the log message is longer than +** a few hundred characters, it will be truncated to the length of the +** buffer. +*/ +SQLITE_API void sqlite3_log(int iErrCode, const char* zFormat, ...); + +/* +** CAPI3REF: Write-Ahead Log Commit Hook +** METHOD: sqlite3 +** +** ^The [sqlite3_wal_hook()] function is used to register a callback that +** is invoked each time data is committed to a database in wal mode. +** +** ^(The callback is invoked by SQLite after the commit has taken place and +** the associated write-lock on the database released)^, so the implementation +** may read, write or [checkpoint] the database as required. +** +** ^The first parameter passed to the callback function when it is invoked +** is a copy of the third parameter passed to sqlite3_wal_hook() when +** registering the callback. ^The second is a copy of the database handle. +** ^The third parameter is the name of the database that was written to - +** either "main" or the name of an [ATTACH]-ed database. ^The fourth parameter +** is the number of pages currently in the write-ahead log file, +** including those that were just committed. +** +** The callback function should normally return [SQLITE_OK]. ^If an error +** code is returned, that error will propagate back up through the +** SQLite code base to cause the statement that provoked the callback +** to report an error, though the commit will have still occurred. If the +** callback returns [SQLITE_ROW] or [SQLITE_DONE], or if it returns a value +** that does not correspond to any valid SQLite error code, the results +** are undefined. +** +** A single database handle may have at most a single write-ahead log callback +** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any +** previously registered write-ahead log callback. ^Note that the +** [sqlite3_wal_autocheckpoint()] interface and the +** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will +** overwrite any prior [sqlite3_wal_hook()] settings. +*/ +SQLITE_API void* +sqlite3_wal_hook(sqlite3*, int (*)(void*, sqlite3*, const char*, int), void*); + +/* +** CAPI3REF: Configure an auto-checkpoint +** METHOD: sqlite3 +** +** ^The [sqlite3_wal_autocheckpoint(D,N)] is a wrapper around +** [sqlite3_wal_hook()] that causes any database on [database connection] D +** to automatically [checkpoint] +** after committing a transaction if there are N or +** more frames in the [write-ahead log] file. ^Passing zero or +** a negative value as the nFrame parameter disables automatic +** checkpoints entirely. +** +** ^The callback registered by this function replaces any existing callback +** registered using [sqlite3_wal_hook()]. ^Likewise, registering a callback +** using [sqlite3_wal_hook()] disables the automatic checkpoint mechanism +** configured by this function. +** +** ^The [wal_autocheckpoint pragma] can be used to invoke this interface +** from SQL. +** +** ^Checkpoints initiated by this mechanism are +** [sqlite3_wal_checkpoint_v2|PASSIVE]. +** +** ^Every new [database connection] defaults to having the auto-checkpoint +** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT] +** pages. The use of this interface +** is only necessary if the default setting is found to be suboptimal +** for a particular application. +*/ +SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3* db, int N); + +/* +** CAPI3REF: Checkpoint a database +** METHOD: sqlite3 +** +** ^(The sqlite3_wal_checkpoint(D,X) is equivalent to +** [sqlite3_wal_checkpoint_v2](D,X,[SQLITE_CHECKPOINT_PASSIVE],0,0).)^ +** +** In brief, sqlite3_wal_checkpoint(D,X) causes the content in the +** [write-ahead log] for database X on [database connection] D to be +** transferred into the database file and for the write-ahead log to +** be reset. See the [checkpointing] documentation for addition +** information. +** +** This interface used to be the only way to cause a checkpoint to +** occur. But then the newer and more powerful [sqlite3_wal_checkpoint_v2()] +** interface was added. This interface is retained for backwards +** compatibility and as a convenience for applications that need to manually +** start a callback but which do not need the full power (and corresponding +** complication) of [sqlite3_wal_checkpoint_v2()]. +*/ +SQLITE_API int sqlite3_wal_checkpoint(sqlite3* db, const char* zDb); + +/* +** CAPI3REF: Checkpoint a database +** METHOD: sqlite3 +** +** ^(The sqlite3_wal_checkpoint_v2(D,X,M,L,C) interface runs a checkpoint +** operation on database X of [database connection] D in mode M. Status +** information is written back into integers pointed to by L and C.)^ +** ^(The M parameter must be a valid [checkpoint mode]:)^ +** +**
+**
SQLITE_CHECKPOINT_PASSIVE
+** ^Checkpoint as many frames as possible without waiting for any database +** readers or writers to finish, then sync the database file if all frames +** in the log were checkpointed. ^The [busy-handler callback] +** is never invoked in the SQLITE_CHECKPOINT_PASSIVE mode. +** ^On the other hand, passive mode might leave the checkpoint unfinished +** if there are concurrent readers or writers. +** +**
SQLITE_CHECKPOINT_FULL
+** ^This mode blocks (it invokes the +** [sqlite3_busy_handler|busy-handler callback]) until there is no +** database writer and all readers are reading from the most recent database +** snapshot. ^It then checkpoints all frames in the log file and syncs the +** database file. ^This mode blocks new database writers while it is pending, +** but new database readers are allowed to continue unimpeded. +** +**
SQLITE_CHECKPOINT_RESTART
+** ^This mode works the same way as SQLITE_CHECKPOINT_FULL with the addition +** that after checkpointing the log file it blocks (calls the +** [busy-handler callback]) +** until all readers are reading from the database file only. ^This ensures +** that the next writer will restart the log file from the beginning. +** ^Like SQLITE_CHECKPOINT_FULL, this mode blocks new +** database writer attempts while it is pending, but does not impede readers. +** +**
SQLITE_CHECKPOINT_TRUNCATE
+** ^This mode works the same way as SQLITE_CHECKPOINT_RESTART with the +** addition that it also truncates the log file to zero bytes just prior +** to a successful return. +**
+** +** ^If pnLog is not NULL, then *pnLog is set to the total number of frames in +** the log file or to -1 if the checkpoint could not run because +** of an error or because the database is not in [WAL mode]. ^If pnCkpt is not +** NULL,then *pnCkpt is set to the total number of checkpointed frames in the +** log file (including any that were already checkpointed before the function +** was called) or to -1 if the checkpoint could not run due to an error or +** because the database is not in WAL mode. ^Note that upon successful +** completion of an SQLITE_CHECKPOINT_TRUNCATE, the log file will have been +** truncated to zero bytes and so both *pnLog and *pnCkpt will be set to zero. +** +** ^All calls obtain an exclusive "checkpoint" lock on the database file. ^If +** any other process is running a checkpoint operation at the same time, the +** lock cannot be obtained and SQLITE_BUSY is returned. ^Even if there is a +** busy-handler configured, it will not be invoked in this case. +** +** ^The SQLITE_CHECKPOINT_FULL, RESTART and TRUNCATE modes also obtain the +** exclusive "writer" lock on the database file. ^If the writer lock cannot be +** obtained immediately, and a busy-handler is configured, it is invoked and +** the writer lock retried until either the busy-handler returns 0 or the lock +** is successfully obtained. ^The busy-handler is also invoked while waiting for +** database readers as described above. ^If the busy-handler returns 0 before +** the writer lock is obtained or while waiting for database readers, the +** checkpoint operation proceeds from that point in the same way as +** SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible +** without blocking any further. ^SQLITE_BUSY is returned in this case. +** +** ^If parameter zDb is NULL or points to a zero length string, then the +** specified operation is attempted on all WAL databases [attached] to +** [database connection] db. In this case the +** values written to output parameters *pnLog and *pnCkpt are undefined. ^If +** an SQLITE_BUSY error is encountered when processing one or more of the +** attached WAL databases, the operation is still attempted on any remaining +** attached databases and SQLITE_BUSY is returned at the end. ^If any other +** error occurs while processing an attached database, processing is abandoned +** and the error code is returned to the caller immediately. ^If no error +** (SQLITE_BUSY or otherwise) is encountered while processing the attached +** databases, SQLITE_OK is returned. +** +** ^If database zDb is the name of an attached database that is not in WAL +** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. ^If +** zDb is not NULL (or a zero length string) and is not the name of any +** attached database, SQLITE_ERROR is returned to the caller. +** +** ^Unless it returns SQLITE_MISUSE, +** the sqlite3_wal_checkpoint_v2() interface +** sets the error information that is queried by +** [sqlite3_errcode()] and [sqlite3_errmsg()]. +** +** ^The [PRAGMA wal_checkpoint] command can be used to invoke this interface +** from SQL. +*/ +SQLITE_API int sqlite3_wal_checkpoint_v2( + sqlite3* db, /* Database handle */ + const char* zDb, /* Name of attached database (or NULL) */ + int eMode, /* SQLITE_CHECKPOINT_* value */ + int* pnLog, /* OUT: Size of WAL log in frames */ + int* pnCkpt /* OUT: Total number of frames checkpointed */ + ); + +/* +** CAPI3REF: Checkpoint Mode Values +** KEYWORDS: {checkpoint mode} +** +** These constants define all valid values for the "checkpoint mode" passed +** as the third parameter to the [sqlite3_wal_checkpoint_v2()] interface. +** See the [sqlite3_wal_checkpoint_v2()] documentation for details on the +** meaning of each of these checkpoint modes. +*/ +#define SQLITE_CHECKPOINT_PASSIVE 0 /* Do as much as possible w/o blocking */ +#define SQLITE_CHECKPOINT_FULL 1 /* Wait for writers, then checkpoint */ +#define SQLITE_CHECKPOINT_RESTART 2 /* Like FULL but wait for for readers */ +#define SQLITE_CHECKPOINT_TRUNCATE 3 /* Like RESTART but also truncate WAL */ + +/* +** CAPI3REF: Virtual Table Interface Configuration +** +** This function may be called by either the [xConnect] or [xCreate] method +** of a [virtual table] implementation to configure +** various facets of the virtual table interface. +** +** If this interface is invoked outside the context of an xConnect or +** xCreate virtual table method then the behavior is undefined. +** +** At present, there is only one option that may be configured using +** this function. (See [SQLITE_VTAB_CONSTRAINT_SUPPORT].) Further options +** may be added in the future. +*/ +SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...); + +/* +** CAPI3REF: Virtual Table Configuration Options +** +** These macros define the various options to the +** [sqlite3_vtab_config()] interface that [virtual table] implementations +** can use to customize and optimize their behavior. +** +**
+**
SQLITE_VTAB_CONSTRAINT_SUPPORT +**
Calls of the form +** [sqlite3_vtab_config](db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X) are supported, +** where X is an integer. If X is zero, then the [virtual table] whose +** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not +** support constraints. In this configuration (which is the default) if +** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire +** statement is rolled back as if [ON CONFLICT | OR ABORT] had been +** specified as part of the users SQL statement, regardless of the actual +** ON CONFLICT mode specified. +** +** If X is non-zero, then the virtual table implementation guarantees +** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before +** any modifications to internal or persistent data structures have been made. +** If the [ON CONFLICT] mode is ABORT, FAIL, IGNORE or ROLLBACK, SQLite +** is able to roll back a statement or database transaction, and abandon +** or continue processing the current SQL statement as appropriate. +** If the ON CONFLICT mode is REPLACE and the [xUpdate] method returns +** [SQLITE_CONSTRAINT], SQLite handles this as if the ON CONFLICT mode +** had been ABORT. +** +** Virtual table implementations that are required to handle OR REPLACE +** must do so within the [xUpdate] method. If a call to the +** [sqlite3_vtab_on_conflict()] function indicates that the current ON +** CONFLICT policy is REPLACE, the virtual table implementation should +** silently replace the appropriate rows within the xUpdate callback and +** return SQLITE_OK. Or, if this is not possible, it may return +** SQLITE_CONSTRAINT, in which case SQLite falls back to OR ABORT +** constraint handling. +**
+*/ +#define SQLITE_VTAB_CONSTRAINT_SUPPORT 1 + +/* +** CAPI3REF: Determine The Virtual Table Conflict Policy +** +** This function may only be called from within a call to the [xUpdate] method +** of a [virtual table] implementation for an INSERT or UPDATE operation. ^The +** value returned is one of [SQLITE_ROLLBACK], [SQLITE_IGNORE], [SQLITE_FAIL], +** [SQLITE_ABORT], or [SQLITE_REPLACE], according to the [ON CONFLICT] mode +** of the SQL statement that triggered the call to the [xUpdate] method of the +** [virtual table]. +*/ +SQLITE_API int sqlite3_vtab_on_conflict(sqlite3*); + +/* +** CAPI3REF: Determine If Virtual Table Column Access Is For UPDATE +** +** If the sqlite3_vtab_nochange(X) routine is called within the [xColumn] +** method of a [virtual table], then it returns true if and only if the +** column is being fetched as part of an UPDATE operation during which the +** column value will not change. Applications might use this to substitute +** a lighter-weight value to return that the corresponding [xUpdate] method +** understands as a "no-change" value. +** +** If the [xColumn] method calls sqlite3_vtab_nochange() and finds that +** the column is not changed by the UPDATE statement, they the xColumn +** method can optionally return without setting a result, without calling +** any of the [sqlite3_result_int|sqlite3_result_xxxxx() interfaces]. +** In that case, [sqlite3_value_nochange(X)] will return true for the +** same column in the [xUpdate] method. +*/ +SQLITE_API int sqlite3_vtab_nochange(sqlite3_context*); + +/* +** CAPI3REF: Determine The Collation For a Virtual Table Constraint +** +** This function may only be called from within a call to the [xBestIndex] +** method of a [virtual table]. +** +** The first argument must be the sqlite3_index_info object that is the +** first parameter to the xBestIndex() method. The second argument must be +** an index into the aConstraint[] array belonging to the sqlite3_index_info +** structure passed to xBestIndex. This function returns a pointer to a buffer +** containing the name of the collation sequence for the corresponding +** constraint. +*/ +SQLITE_API SQLITE_EXPERIMENTAL const char* sqlite3_vtab_collation( + sqlite3_index_info*, + int); + +/* +** CAPI3REF: Conflict resolution modes +** KEYWORDS: {conflict resolution mode} +** +** These constants are returned by [sqlite3_vtab_on_conflict()] to +** inform a [virtual table] implementation what the [ON CONFLICT] mode +** is for the SQL statement being evaluated. +** +** Note that the [SQLITE_IGNORE] constant is also used as a potential +** return value from the [sqlite3_set_authorizer()] callback and that +** [SQLITE_ABORT] is also a [result code]. +*/ +#define SQLITE_ROLLBACK 1 +/* #define SQLITE_IGNORE 2 // Also used by sqlite3_authorizer() callback */ +#define SQLITE_FAIL 3 +/* #define SQLITE_ABORT 4 // Also an error code */ +#define SQLITE_REPLACE 5 + +/* +** CAPI3REF: Prepared Statement Scan Status Opcodes +** KEYWORDS: {scanstatus options} +** +** The following constants can be used for the T parameter to the +** [sqlite3_stmt_scanstatus(S,X,T,V)] interface. Each constant designates a +** different metric for sqlite3_stmt_scanstatus() to return. +** +** When the value returned to V is a string, space to hold that string is +** managed by the prepared statement S and will be automatically freed when +** S is finalized. +** +**
+** [[SQLITE_SCANSTAT_NLOOP]]
SQLITE_SCANSTAT_NLOOP
+**
^The [sqlite3_int64] variable pointed to by the T parameter will be +** set to the total number of times that the X-th loop has run.
+** +** [[SQLITE_SCANSTAT_NVISIT]]
SQLITE_SCANSTAT_NVISIT
+**
^The [sqlite3_int64] variable pointed to by the T parameter will be set +** to the total number of rows examined by all iterations of the X-th loop.
+** +** [[SQLITE_SCANSTAT_EST]]
SQLITE_SCANSTAT_EST
+**
^The "double" variable pointed to by the T parameter will be set to the +** query planner's estimate for the average number of rows output from each +** iteration of the X-th loop. If the query planner's estimates was accurate, +** then this value will approximate the quotient NVISIT/NLOOP and the +** product of this value for all prior loops with the same SELECTID will +** be the NLOOP value for the current loop. +** +** [[SQLITE_SCANSTAT_NAME]]
SQLITE_SCANSTAT_NAME
+**
^The "const char *" variable pointed to by the T parameter will be set +** to a zero-terminated UTF-8 string containing the name of the index or table +** used for the X-th loop. +** +** [[SQLITE_SCANSTAT_EXPLAIN]]
SQLITE_SCANSTAT_EXPLAIN
+**
^The "const char *" variable pointed to by the T parameter will be set +** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN] +** description for the X-th loop. +** +** [[SQLITE_SCANSTAT_SELECTID]]
SQLITE_SCANSTAT_SELECT
+**
^The "int" variable pointed to by the T parameter will be set to the +** "select-id" for the X-th loop. The select-id identifies which query or +** subquery the loop is part of. The main query has a select-id of zero. +** The select-id is the same value as is output in the first column +** of an [EXPLAIN QUERY PLAN] query. +**
+*/ +#define SQLITE_SCANSTAT_NLOOP 0 +#define SQLITE_SCANSTAT_NVISIT 1 +#define SQLITE_SCANSTAT_EST 2 +#define SQLITE_SCANSTAT_NAME 3 +#define SQLITE_SCANSTAT_EXPLAIN 4 +#define SQLITE_SCANSTAT_SELECTID 5 + +/* +** CAPI3REF: Prepared Statement Scan Status +** METHOD: sqlite3_stmt +** +** This interface returns information about the predicted and measured +** performance for pStmt. Advanced applications can use this +** interface to compare the predicted and the measured performance and +** issue warnings and/or rerun [ANALYZE] if discrepancies are found. +** +** Since this interface is expected to be rarely used, it is only +** available if SQLite is compiled using the [SQLITE_ENABLE_STMT_SCANSTATUS] +** compile-time option. +** +** The "iScanStatusOp" parameter determines which status information to return. +** The "iScanStatusOp" must be one of the [scanstatus options] or the behavior +** of this interface is undefined. +** ^The requested measurement is written into a variable pointed to by +** the "pOut" parameter. +** Parameter "idx" identifies the specific loop to retrieve statistics for. +** Loops are numbered starting from zero. ^If idx is out of range - less than +** zero or greater than or equal to the total number of loops used to implement +** the statement - a non-zero value is returned and the variable that pOut +** points to is unchanged. +** +** ^Statistics might not be available for all loops in all statements. ^In cases +** where there exist loops with no available statistics, this function behaves +** as if the loop did not exist - it returns non-zero and leave the variable +** that pOut points to unchanged. +** +** See also: [sqlite3_stmt_scanstatus_reset()] +*/ +SQLITE_API int sqlite3_stmt_scanstatus( + sqlite3_stmt* pStmt, /* Prepared statement for which info desired */ + int idx, /* Index of loop to report on */ + int iScanStatusOp, /* Information desired. SQLITE_SCANSTAT_* */ + void* pOut /* Result written here */ + ); + +/* +** CAPI3REF: Zero Scan-Status Counters +** METHOD: sqlite3_stmt +** +** ^Zero all [sqlite3_stmt_scanstatus()] related event counters. +** +** This API is only available if the library is built with pre-processor +** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined. +*/ +SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*); + +/* +** CAPI3REF: Flush caches to disk mid-transaction +** +** ^If a write-transaction is open on [database connection] D when the +** [sqlite3_db_cacheflush(D)] interface invoked, any dirty +** pages in the pager-cache that are not currently in use are written out +** to disk. A dirty page may be in use if a database cursor created by an +** active SQL statement is reading from it, or if it is page 1 of a database +** file (page 1 is always "in use"). ^The [sqlite3_db_cacheflush(D)] +** interface flushes caches for all schemas - "main", "temp", and +** any [attached] databases. +** +** ^If this function needs to obtain extra database locks before dirty pages +** can be flushed to disk, it does so. ^If those locks cannot be obtained +** immediately and there is a busy-handler callback configured, it is invoked +** in the usual manner. ^If the required lock still cannot be obtained, then +** the database is skipped and an attempt made to flush any dirty pages +** belonging to the next (if any) database. ^If any databases are skipped +** because locks cannot be obtained, but no other error occurs, this +** function returns SQLITE_BUSY. +** +** ^If any other error occurs while flushing dirty pages to disk (for +** example an IO error or out-of-memory condition), then processing is +** abandoned and an SQLite [error code] is returned to the caller immediately. +** +** ^Otherwise, if no error occurs, [sqlite3_db_cacheflush()] returns SQLITE_OK. +** +** ^This function does not set the database handle error code or message +** returned by the [sqlite3_errcode()] and [sqlite3_errmsg()] functions. +*/ +SQLITE_API int sqlite3_db_cacheflush(sqlite3*); + +/* +** CAPI3REF: The pre-update hook. +** +** ^These interfaces are only available if SQLite is compiled using the +** [SQLITE_ENABLE_PREUPDATE_HOOK] compile-time option. +** +** ^The [sqlite3_preupdate_hook()] interface registers a callback function +** that is invoked prior to each [INSERT], [UPDATE], and [DELETE] operation +** on a database table. +** ^At most one preupdate hook may be registered at a time on a single +** [database connection]; each call to [sqlite3_preupdate_hook()] overrides +** the previous setting. +** ^The preupdate hook is disabled by invoking [sqlite3_preupdate_hook()] +** with a NULL pointer as the second parameter. +** ^The third parameter to [sqlite3_preupdate_hook()] is passed through as +** the first parameter to callbacks. +** +** ^The preupdate hook only fires for changes to real database tables; the +** preupdate hook is not invoked for changes to [virtual tables] or to +** system tables like sqlite_master or sqlite_stat1. +** +** ^The second parameter to the preupdate callback is a pointer to +** the [database connection] that registered the preupdate hook. +** ^The third parameter to the preupdate callback is one of the constants +** [SQLITE_INSERT], [SQLITE_DELETE], or [SQLITE_UPDATE] to identify the +** kind of update operation that is about to occur. +** ^(The fourth parameter to the preupdate callback is the name of the +** database within the database connection that is being modified. This +** will be "main" for the main database or "temp" for TEMP tables or +** the name given after the AS keyword in the [ATTACH] statement for attached +** databases.)^ +** ^The fifth parameter to the preupdate callback is the name of the +** table that is being modified. +** +** For an UPDATE or DELETE operation on a [rowid table], the sixth +** parameter passed to the preupdate callback is the initial [rowid] of the +** row being modified or deleted. For an INSERT operation on a rowid table, +** or any operation on a WITHOUT ROWID table, the value of the sixth +** parameter is undefined. For an INSERT or UPDATE on a rowid table the +** seventh parameter is the final rowid value of the row being inserted +** or updated. The value of the seventh parameter passed to the callback +** function is not defined for operations on WITHOUT ROWID tables, or for +** INSERT operations on rowid tables. +** +** The [sqlite3_preupdate_old()], [sqlite3_preupdate_new()], +** [sqlite3_preupdate_count()], and [sqlite3_preupdate_depth()] interfaces +** provide additional information about a preupdate event. These routines +** may only be called from within a preupdate callback. Invoking any of +** these routines from outside of a preupdate callback or with a +** [database connection] pointer that is different from the one supplied +** to the preupdate callback results in undefined and probably undesirable +** behavior. +** +** ^The [sqlite3_preupdate_count(D)] interface returns the number of columns +** in the row that is being inserted, updated, or deleted. +** +** ^The [sqlite3_preupdate_old(D,N,P)] interface writes into P a pointer to +** a [protected sqlite3_value] that contains the value of the Nth column of +** the table row before it is updated. The N parameter must be between 0 +** and one less than the number of columns or the behavior will be +** undefined. This must only be used within SQLITE_UPDATE and SQLITE_DELETE +** preupdate callbacks; if it is used by an SQLITE_INSERT callback then the +** behavior is undefined. The [sqlite3_value] that P points to +** will be destroyed when the preupdate callback returns. +** +** ^The [sqlite3_preupdate_new(D,N,P)] interface writes into P a pointer to +** a [protected sqlite3_value] that contains the value of the Nth column of +** the table row after it is updated. The N parameter must be between 0 +** and one less than the number of columns or the behavior will be +** undefined. This must only be used within SQLITE_INSERT and SQLITE_UPDATE +** preupdate callbacks; if it is used by an SQLITE_DELETE callback then the +** behavior is undefined. The [sqlite3_value] that P points to +** will be destroyed when the preupdate callback returns. +** +** ^The [sqlite3_preupdate_depth(D)] interface returns 0 if the preupdate +** callback was invoked as a result of a direct insert, update, or delete +** operation; or 1 for inserts, updates, or deletes invoked by top-level +** triggers; or 2 for changes resulting from triggers called by top-level +** triggers; and so forth. +** +** See also: [sqlite3_update_hook()] +*/ +#if defined(SQLITE_ENABLE_PREUPDATE_HOOK) +SQLITE_API void* sqlite3_preupdate_hook( + sqlite3* db, + void (*xPreUpdate)( + void* pCtx, /* Copy of third arg to preupdate_hook() */ + sqlite3* db, /* Database handle */ + int op, /* SQLITE_UPDATE, DELETE or INSERT */ + char const* zDb, /* Database name */ + char const* zName, /* Table name */ + sqlite3_int64 iKey1, /* Rowid of row about to be deleted/updated */ + sqlite3_int64 iKey2 /* New rowid value (for a rowid UPDATE) */ + ), + void*); +SQLITE_API int sqlite3_preupdate_old(sqlite3*, int, sqlite3_value**); +SQLITE_API int sqlite3_preupdate_count(sqlite3*); +SQLITE_API int sqlite3_preupdate_depth(sqlite3*); +SQLITE_API int sqlite3_preupdate_new(sqlite3*, int, sqlite3_value**); +#endif + +/* +** CAPI3REF: Low-level system error code +** +** ^Attempt to return the underlying operating system error code or error +** number that caused the most recent I/O error or failure to open a file. +** The return value is OS-dependent. For example, on unix systems, after +** [sqlite3_open_v2()] returns [SQLITE_CANTOPEN], this interface could be +** called to get back the underlying "errno" that caused the problem, such +** as ENOSPC, EAUTH, EISDIR, and so forth. +*/ +SQLITE_API int sqlite3_system_errno(sqlite3*); + +/* +** CAPI3REF: Database Snapshot +** KEYWORDS: {snapshot} {sqlite3_snapshot} +** EXPERIMENTAL +** +** An instance of the snapshot object records the state of a [WAL mode] +** database for some specific point in history. +** +** In [WAL mode], multiple [database connections] that are open on the +** same database file can each be reading a different historical version +** of the database file. When a [database connection] begins a read +** transaction, that connection sees an unchanging copy of the database +** as it existed for the point in time when the transaction first started. +** Subsequent changes to the database from other connections are not seen +** by the reader until a new read transaction is started. +** +** The sqlite3_snapshot object records state information about an historical +** version of the database file so that it is possible to later open a new read +** transaction that sees that historical version of the database rather than +** the most recent version. +** +** The constructor for this object is [sqlite3_snapshot_get()]. The +** [sqlite3_snapshot_open()] method causes a fresh read transaction to refer +** to an historical snapshot (if possible). The destructor for +** sqlite3_snapshot objects is [sqlite3_snapshot_free()]. +*/ +typedef struct sqlite3_snapshot { unsigned char hidden[48]; } sqlite3_snapshot; + +/* +** CAPI3REF: Record A Database Snapshot +** EXPERIMENTAL +** +** ^The [sqlite3_snapshot_get(D,S,P)] interface attempts to make a +** new [sqlite3_snapshot] object that records the current state of +** schema S in database connection D. ^On success, the +** [sqlite3_snapshot_get(D,S,P)] interface writes a pointer to the newly +** created [sqlite3_snapshot] object into *P and returns SQLITE_OK. +** If there is not already a read-transaction open on schema S when +** this function is called, one is opened automatically. +** +** The following must be true for this function to succeed. If any of +** the following statements are false when sqlite3_snapshot_get() is +** called, SQLITE_ERROR is returned. The final value of *P is undefined +** in this case. +** +**
    +**
  • The database handle must be in [autocommit mode]. +** +**
  • Schema S of [database connection] D must be a [WAL mode] database. +** +**
  • There must not be a write transaction open on schema S of database +** connection D. +** +**
  • One or more transactions must have been written to the current wal +** file since it was created on disk (by any connection). This means +** that a snapshot cannot be taken on a wal mode database with no wal +** file immediately after it is first opened. At least one transaction +** must be written to it first. +**
+** +** This function may also return SQLITE_NOMEM. If it is called with the +** database handle in autocommit mode but fails for some other reason, +** whether or not a read transaction is opened on schema S is undefined. +** +** The [sqlite3_snapshot] object returned from a successful call to +** [sqlite3_snapshot_get()] must be freed using [sqlite3_snapshot_free()] +** to avoid a memory leak. +** +** The [sqlite3_snapshot_get()] interface is only available when the +** SQLITE_ENABLE_SNAPSHOT compile-time option is used. +*/ +SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_get( + sqlite3* db, + const char* zSchema, + sqlite3_snapshot** ppSnapshot); + +/* +** CAPI3REF: Start a read transaction on an historical snapshot +** EXPERIMENTAL +** +** ^The [sqlite3_snapshot_open(D,S,P)] interface starts a +** read transaction for schema S of +** [database connection] D such that the read transaction +** refers to historical [snapshot] P, rather than the most +** recent change to the database. +** ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK on success +** or an appropriate [error code] if it fails. +** +** ^In order to succeed, a call to [sqlite3_snapshot_open(D,S,P)] must be +** the first operation following the [BEGIN] that takes the schema S +** out of [autocommit mode]. +** ^In other words, schema S must not currently be in +** a transaction for [sqlite3_snapshot_open(D,S,P)] to work, but the +** database connection D must be out of [autocommit mode]. +** ^A [snapshot] will fail to open if it has been overwritten by a +** [checkpoint]. +** ^(A call to [sqlite3_snapshot_open(D,S,P)] will fail if the +** database connection D does not know that the database file for +** schema S is in [WAL mode]. A database connection might not know +** that the database file is in [WAL mode] if there has been no prior +** I/O on that database connection, or if the database entered [WAL mode] +** after the most recent I/O on the database connection.)^ +** (Hint: Run "[PRAGMA application_id]" against a newly opened +** database connection in order to make it ready to use snapshots.) +** +** The [sqlite3_snapshot_open()] interface is only available when the +** SQLITE_ENABLE_SNAPSHOT compile-time option is used. +*/ +SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_open( + sqlite3* db, + const char* zSchema, + sqlite3_snapshot* pSnapshot); + +/* +** CAPI3REF: Destroy a snapshot +** EXPERIMENTAL +** +** ^The [sqlite3_snapshot_free(P)] interface destroys [sqlite3_snapshot] P. +** The application must eventually free every [sqlite3_snapshot] object +** using this routine to avoid a memory leak. +** +** The [sqlite3_snapshot_free()] interface is only available when the +** SQLITE_ENABLE_SNAPSHOT compile-time option is used. +*/ +SQLITE_API SQLITE_EXPERIMENTAL void sqlite3_snapshot_free(sqlite3_snapshot*); + +/* +** CAPI3REF: Compare the ages of two snapshot handles. +** EXPERIMENTAL +** +** The sqlite3_snapshot_cmp(P1, P2) interface is used to compare the ages +** of two valid snapshot handles. +** +** If the two snapshot handles are not associated with the same database +** file, the result of the comparison is undefined. +** +** Additionally, the result of the comparison is only valid if both of the +** snapshot handles were obtained by calling sqlite3_snapshot_get() since the +** last time the wal file was deleted. The wal file is deleted when the +** database is changed back to rollback mode or when the number of database +** clients drops to zero. If either snapshot handle was obtained before the +** wal file was last deleted, the value returned by this function +** is undefined. +** +** Otherwise, this API returns a negative value if P1 refers to an older +** snapshot than P2, zero if the two handles refer to the same database +** snapshot, and a positive value if P1 is a newer snapshot than P2. +*/ +SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_cmp( + sqlite3_snapshot* p1, + sqlite3_snapshot* p2); + +/* +** CAPI3REF: Recover snapshots from a wal file +** EXPERIMENTAL +** +** If all connections disconnect from a database file but do not perform +** a checkpoint, the existing wal file is opened along with the database +** file the next time the database is opened. At this point it is only +** possible to successfully call sqlite3_snapshot_open() to open the most +** recent snapshot of the database (the one at the head of the wal file), +** even though the wal file may contain other valid snapshots for which +** clients have sqlite3_snapshot handles. +** +** This function attempts to scan the wal file associated with database zDb +** of database handle db and make all valid snapshots available to +** sqlite3_snapshot_open(). It is an error if there is already a read +** transaction open on the database, or if the database is not a wal mode +** database. +** +** SQLITE_OK is returned if successful, or an SQLite error code otherwise. +*/ +SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover( + sqlite3* db, + const char* zDb); + +/* +** CAPI3REF: Serialize a database +** +** The sqlite3_serialize(D,S,P,F) interface returns a pointer to memory +** that is a serialization of the S database on [database connection] D. +** If P is not a NULL pointer, then the size of the database in bytes +** is written into *P. +** +** For an ordinary on-disk database file, the serialization is just a +** copy of the disk file. For an in-memory database or a "TEMP" database, +** the serialization is the same sequence of bytes which would be written +** to disk if that database where backed up to disk. +** +** The usual case is that sqlite3_serialize() copies the serialization of +** the database into memory obtained from [sqlite3_malloc64()] and returns +** a pointer to that memory. The caller is responsible for freeing the +** returned value to avoid a memory leak. However, if the F argument +** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations +** are made, and the sqlite3_serialize() function will return a pointer +** to the contiguous memory representation of the database that SQLite +** is currently using for that database, or NULL if the no such contiguous +** memory representation of the database exists. A contiguous memory +** representation of the database will usually only exist if there has +** been a prior call to [sqlite3_deserialize(D,S,...)] with the same +** values of D and S. +** The size of the database is written into *P even if the +** SQLITE_SERIALIZE_NOCOPY bit is set but no contigious copy +** of the database exists. +** +** A call to sqlite3_serialize(D,S,P,F) might return NULL even if the +** SQLITE_SERIALIZE_NOCOPY bit is omitted from argument F if a memory +** allocation error occurs. +** +** This interface is only available if SQLite is compiled with the +** [SQLITE_ENABLE_DESERIALIZE] option. +*/ +SQLITE_API unsigned char* sqlite3_serialize( + sqlite3* db, /* The database connection */ + const char* zSchema, /* Which DB to serialize. ex: "main", "temp", ... */ + sqlite3_int64* piSize, /* Write size of the DB here, if not NULL */ + unsigned int mFlags /* Zero or more SQLITE_SERIALIZE_* flags */ + ); + +/* +** CAPI3REF: Flags for sqlite3_serialize +** +** Zero or more of the following constants can be OR-ed together for +** the F argument to [sqlite3_serialize(D,S,P,F)]. +** +** SQLITE_SERIALIZE_NOCOPY means that [sqlite3_serialize()] will return +** a pointer to contiguous in-memory database that it is currently using, +** without making a copy of the database. If SQLite is not currently using +** a contiguous in-memory database, then this option causes +** [sqlite3_serialize()] to return a NULL pointer. SQLite will only be +** using a contiguous in-memory database if it has been initialized by a +** prior call to [sqlite3_deserialize()]. +*/ +#define SQLITE_SERIALIZE_NOCOPY 0x001 /* Do no memory allocations */ + +/* +** CAPI3REF: Deserialize a database +** +** The sqlite3_deserialize(D,S,P,N,M,F) interface causes the +** [database connection] D to disconnect from database S and then +** reopen S as an in-memory database based on the serialization contained +** in P. The serialized database P is N bytes in size. M is the size of +** the buffer P, which might be larger than N. If M is larger than N, and +** the SQLITE_DESERIALIZE_READONLY bit is not set in F, then SQLite is +** permitted to add content to the in-memory database as long as the total +** size does not exceed M bytes. +** +** If the SQLITE_DESERIALIZE_FREEONCLOSE bit is set in F, then SQLite will +** invoke sqlite3_free() on the serialization buffer when the database +** connection closes. If the SQLITE_DESERIALIZE_RESIZEABLE bit is set, then +** SQLite will try to increase the buffer size using sqlite3_realloc64() +** if writes on the database cause it to grow larger than M bytes. +** +** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the +** database is currently in a read transaction or is involved in a backup +** operation. +** +** If sqlite3_deserialize(D,S,P,N,M,F) fails for any reason and if the +** SQLITE_DESERIALIZE_FREEONCLOSE bit is set in argument F, then +** [sqlite3_free()] is invoked on argument P prior to returning. +** +** This interface is only available if SQLite is compiled with the +** [SQLITE_ENABLE_DESERIALIZE] option. +*/ +SQLITE_API int sqlite3_deserialize( + sqlite3* db, /* The database connection */ + const char* zSchema, /* Which DB to reopen with the deserialization */ + unsigned char* pData, /* The serialized database content */ + sqlite3_int64 szDb, /* Number bytes in the deserialization */ + sqlite3_int64 szBuf, /* Total size of buffer pData[] */ + unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */ + ); + +/* +** CAPI3REF: Flags for sqlite3_deserialize() +** +** The following are allowed values for 6th argument (the F argument) to +** the [sqlite3_deserialize(D,S,P,N,M,F)] interface. +** +** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization +** in the P argument is held in memory obtained from [sqlite3_malloc64()] +** and that SQLite should take ownership of this memory and automatically +** free it when it has finished using it. Without this flag, the caller +** is resposible for freeing any dynamically allocated memory. +** +** The SQLITE_DESERIALIZE_RESIZEABLE flag means that SQLite is allowed to +** grow the size of the database using calls to [sqlite3_realloc64()]. This +** flag should only be used if SQLITE_DESERIALIZE_FREEONCLOSE is also used. +** Without this flag, the deserialized database cannot increase in size beyond +** the number of bytes specified by the M parameter. +** +** The SQLITE_DESERIALIZE_READONLY flag means that the deserialized database +** should be treated as read-only. +*/ +#define SQLITE_DESERIALIZE_FREEONCLOSE 1 /* Call sqlite3_free() on close */ +#define SQLITE_DESERIALIZE_RESIZEABLE 2 /* Resize using sqlite3_realloc64() */ +#define SQLITE_DESERIALIZE_READONLY 4 /* Database is read-only */ + +/* +** Undo the hack that converts floating point types to integer for +** builds on processors without floating point support. +*/ +#ifdef SQLITE_OMIT_FLOATING_POINT +#undef double +#endif + +#ifdef __cplusplus +} /* End of the 'extern "C"' block */ +#endif +#endif /* SQLITE3_H */ + +/******** Begin file sqlite3rtree.h *********/ +/* +** 2010 August 30 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +*/ + +#ifndef _SQLITE3RTREE_H_ +#define _SQLITE3RTREE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct sqlite3_rtree_geometry sqlite3_rtree_geometry; +typedef struct sqlite3_rtree_query_info sqlite3_rtree_query_info; + +/* The double-precision datatype used by RTree depends on the +** SQLITE_RTREE_INT_ONLY compile-time option. +*/ +#ifdef SQLITE_RTREE_INT_ONLY +typedef sqlite3_int64 sqlite3_rtree_dbl; +#else +typedef double sqlite3_rtree_dbl; +#endif + +/* +** Register a geometry callback named zGeom that can be used as part of an +** R-Tree geometry query as follows: +** +** SELECT ... FROM WHERE MATCH $zGeom(... params ...) +*/ +SQLITE_API int sqlite3_rtree_geometry_callback( + sqlite3* db, + const char* zGeom, + int (*xGeom)(sqlite3_rtree_geometry*, int, sqlite3_rtree_dbl*, int*), + void* pContext); + +/* +** A pointer to a structure of the following type is passed as the first +** argument to callbacks registered using rtree_geometry_callback(). +*/ +struct sqlite3_rtree_geometry { + void* pContext; /* Copy of pContext passed to s_r_g_c() */ + int nParam; /* Size of array aParam[] */ + sqlite3_rtree_dbl* aParam; /* Parameters passed to SQL geom function */ + void* pUser; /* Callback implementation user data */ + void (*xDelUser)(void*); /* Called by SQLite to clean up pUser */ +}; + +/* +** Register a 2nd-generation geometry callback named zScore that can be +** used as part of an R-Tree geometry query as follows: +** +** SELECT ... FROM WHERE MATCH $zQueryFunc(... params ...) +*/ +SQLITE_API int sqlite3_rtree_query_callback( + sqlite3* db, + const char* zQueryFunc, + int (*xQueryFunc)(sqlite3_rtree_query_info*), + void* pContext, + void (*xDestructor)(void*)); + +/* +** A pointer to a structure of the following type is passed as the +** argument to scored geometry callback registered using +** sqlite3_rtree_query_callback(). +** +** Note that the first 5 fields of this structure are identical to +** sqlite3_rtree_geometry. This structure is a subclass of +** sqlite3_rtree_geometry. +*/ +struct sqlite3_rtree_query_info { + void* pContext; /* pContext from when function registered */ + int nParam; /* Number of function parameters */ + sqlite3_rtree_dbl* aParam; /* value of function parameters */ + void* pUser; /* callback can use this, if desired */ + void (*xDelUser)(void*); /* function to free pUser */ + sqlite3_rtree_dbl* aCoord; /* Coordinates of node or entry to check */ + unsigned int* anQueue; /* Number of pending entries in the queue */ + int nCoord; /* Number of coordinates */ + int iLevel; /* Level of current node or entry */ + int mxLevel; /* The largest iLevel value in the tree */ + sqlite3_int64 iRowid; /* Rowid for current entry */ + sqlite3_rtree_dbl rParentScore; /* Score of parent node */ + int eParentWithin; /* Visibility of parent node */ + int eWithin; /* OUT: Visiblity */ + sqlite3_rtree_dbl rScore; /* OUT: Write the score here */ + /* The following fields are only available in 3.8.11 and later */ + sqlite3_value** apSqlParam; /* Original SQL values of parameters */ +}; + +/* +** Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin. +*/ +#define NOT_WITHIN 0 /* Object completely outside of query region */ +#define PARTLY_WITHIN 1 /* Object partially overlaps query region */ +#define FULLY_WITHIN 2 /* Object fully contained within query region */ + +#ifdef __cplusplus +} /* end of the 'extern "C"' block */ +#endif + +#endif /* ifndef _SQLITE3RTREE_H_ */ + +/******** End of sqlite3rtree.h *********/ +/******** Begin file sqlite3session.h *********/ + +#if !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION) +#define __SQLITESESSION_H_ 1 + +/* +** Make sure we can call this stuff from C++. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/* +** CAPI3REF: Session Object Handle +** +** An instance of this object is a [session] that can be used to +** record changes to a database. +*/ +typedef struct sqlite3_session sqlite3_session; + +/* +** CAPI3REF: Changeset Iterator Handle +** +** An instance of this object acts as a cursor for iterating +** over the elements of a [changeset] or [patchset]. +*/ +typedef struct sqlite3_changeset_iter sqlite3_changeset_iter; + +/* +** CAPI3REF: Create A New Session Object +** CONSTRUCTOR: sqlite3_session +** +** Create a new session object attached to database handle db. If successful, +** a pointer to the new object is written to *ppSession and SQLITE_OK is +** returned. If an error occurs, *ppSession is set to NULL and an SQLite +** error code (e.g. SQLITE_NOMEM) is returned. +** +** It is possible to create multiple session objects attached to a single +** database handle. +** +** Session objects created using this function should be deleted using the +** [sqlite3session_delete()] function before the database handle that they +** are attached to is itself closed. If the database handle is closed before +** the session object is deleted, then the results of calling any session +** module function, including [sqlite3session_delete()] on the session object +** are undefined. +** +** Because the session module uses the [sqlite3_preupdate_hook()] API, it +** is not possible for an application to register a pre-update hook on a +** database handle that has one or more session objects attached. Nor is +** it possible to create a session object attached to a database handle for +** which a pre-update hook is already defined. The results of attempting +** either of these things are undefined. +** +** The session object will be used to create changesets for tables in +** database zDb, where zDb is either "main", or "temp", or the name of an +** attached database. It is not an error if database zDb is not attached +** to the database when the session object is created. +*/ +SQLITE_API int sqlite3session_create( + sqlite3* db, /* Database handle */ + const char* zDb, /* Name of db (e.g. "main") */ + sqlite3_session** ppSession /* OUT: New session object */ + ); + +/* +** CAPI3REF: Delete A Session Object +** DESTRUCTOR: sqlite3_session +** +** Delete a session object previously allocated using +** [sqlite3session_create()]. Once a session object has been deleted, the +** results of attempting to use pSession with any other session module +** function are undefined. +** +** Session objects must be deleted before the database handle to which they +** are attached is closed. Refer to the documentation for +** [sqlite3session_create()] for details. +*/ +SQLITE_API void sqlite3session_delete(sqlite3_session* pSession); + +/* +** CAPI3REF: Enable Or Disable A Session Object +** METHOD: sqlite3_session +** +** Enable or disable the recording of changes by a session object. When +** enabled, a session object records changes made to the database. When +** disabled - it does not. A newly created session object is enabled. +** Refer to the documentation for [sqlite3session_changeset()] for further +** details regarding how enabling and disabling a session object affects +** the eventual changesets. +** +** Passing zero to this function disables the session. Passing a value +** greater than zero enables it. Passing a value less than zero is a +** no-op, and may be used to query the current state of the session. +** +** The return value indicates the final state of the session object: 0 if +** the session is disabled, or 1 if it is enabled. +*/ +SQLITE_API int sqlite3session_enable(sqlite3_session* pSession, int bEnable); + +/* +** CAPI3REF: Set Or Clear the Indirect Change Flag +** METHOD: sqlite3_session +** +** Each change recorded by a session object is marked as either direct or +** indirect. A change is marked as indirect if either: +** +**
    +**
  • The session object "indirect" flag is set when the change is +** made, or +**
  • The change is made by an SQL trigger or foreign key action +** instead of directly as a result of a users SQL statement. +**
+** +** If a single row is affected by more than one operation within a session, +** then the change is considered indirect if all operations meet the criteria +** for an indirect change above, or direct otherwise. +** +** This function is used to set, clear or query the session object indirect +** flag. If the second argument passed to this function is zero, then the +** indirect flag is cleared. If it is greater than zero, the indirect flag +** is set. Passing a value less than zero does not modify the current value +** of the indirect flag, and may be used to query the current state of the +** indirect flag for the specified session object. +** +** The return value indicates the final state of the indirect flag: 0 if +** it is clear, or 1 if it is set. +*/ +SQLITE_API int sqlite3session_indirect( + sqlite3_session* pSession, + int bIndirect); + +/* +** CAPI3REF: Attach A Table To A Session Object +** METHOD: sqlite3_session +** +** If argument zTab is not NULL, then it is the name of a table to attach +** to the session object passed as the first argument. All subsequent changes +** made to the table while the session object is enabled will be recorded. See +** documentation for [sqlite3session_changeset()] for further details. +** +** Or, if argument zTab is NULL, then changes are recorded for all tables +** in the database. If additional tables are added to the database (by +** executing "CREATE TABLE" statements) after this call is made, changes for +** the new tables are also recorded. +** +** Changes can only be recorded for tables that have a PRIMARY KEY explicitly +** defined as part of their CREATE TABLE statement. It does not matter if the +** PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias) or not. The PRIMARY +** KEY may consist of a single column, or may be a composite key. +** +** It is not an error if the named table does not exist in the database. Nor +** is it an error if the named table does not have a PRIMARY KEY. However, +** no changes will be recorded in either of these scenarios. +** +** Changes are not recorded for individual rows that have NULL values stored +** in one or more of their PRIMARY KEY columns. +** +** SQLITE_OK is returned if the call completes without error. Or, if an error +** occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned. +** +**

Special sqlite_stat1 Handling

+** +** As of SQLite version 3.22.0, the "sqlite_stat1" table is an exception to +** some of the rules above. In SQLite, the schema of sqlite_stat1 is: +**
+**        CREATE TABLE sqlite_stat1(tbl,idx,stat)
+**  
+** +** Even though sqlite_stat1 does not have a PRIMARY KEY, changes are +** recorded for it as if the PRIMARY KEY is (tbl,idx). Additionally, changes +** are recorded for rows for which (idx IS NULL) is true. However, for such +** rows a zero-length blob (SQL value X'') is stored in the changeset or +** patchset instead of a NULL value. This allows such changesets to be +** manipulated by legacy implementations of sqlite3changeset_invert(), +** concat() and similar. +** +** The sqlite3changeset_apply() function automatically converts the +** zero-length blob back to a NULL value when updating the sqlite_stat1 +** table. However, if the application calls sqlite3changeset_new(), +** sqlite3changeset_old() or sqlite3changeset_conflict on a changeset +** iterator directly (including on a changeset iterator passed to a +** conflict-handler callback) then the X'' value is returned. The application +** must translate X'' to NULL itself if required. +** +** Legacy (older than 3.22.0) versions of the sessions module cannot capture +** changes made to the sqlite_stat1 table. Legacy versions of the +** sqlite3changeset_apply() function silently ignore any modifications to the +** sqlite_stat1 table that are part of a changeset or patchset. +*/ +SQLITE_API int sqlite3session_attach( + sqlite3_session* pSession, /* Session object */ + const char* zTab /* Table name */ + ); + +/* +** CAPI3REF: Set a table filter on a Session Object. +** METHOD: sqlite3_session +** +** The second argument (xFilter) is the "filter callback". For changes to rows +** in tables that are not attached to the Session object, the filter is called +** to determine whether changes to the table's rows should be tracked or not. +** If xFilter returns 0, changes is not tracked. Note that once a table is +** attached, xFilter will not be called again. +*/ +SQLITE_API void sqlite3session_table_filter( + sqlite3_session* pSession, /* Session object */ + int (*xFilter)( + void* pCtx, /* Copy of third arg to _filter_table() */ + const char* zTab /* Table name */ + ), + void* pCtx /* First argument passed to xFilter */ + ); + +/* +** CAPI3REF: Generate A Changeset From A Session Object +** METHOD: sqlite3_session +** +** Obtain a changeset containing changes to the tables attached to the +** session object passed as the first argument. If successful, +** set *ppChangeset to point to a buffer containing the changeset +** and *pnChangeset to the size of the changeset in bytes before returning +** SQLITE_OK. If an error occurs, set both *ppChangeset and *pnChangeset to +** zero and return an SQLite error code. +** +** A changeset consists of zero or more INSERT, UPDATE and/or DELETE changes, +** each representing a change to a single row of an attached table. An INSERT +** change contains the values of each field of a new database row. A DELETE +** contains the original values of each field of a deleted database row. An +** UPDATE change contains the original values of each field of an updated +** database row along with the updated values for each updated non-primary-key +** column. It is not possible for an UPDATE change to represent a change that +** modifies the values of primary key columns. If such a change is made, it +** is represented in a changeset as a DELETE followed by an INSERT. +** +** Changes are not recorded for rows that have NULL values stored in one or +** more of their PRIMARY KEY columns. If such a row is inserted or deleted, +** no corresponding change is present in the changesets returned by this +** function. If an existing row with one or more NULL values stored in +** PRIMARY KEY columns is updated so that all PRIMARY KEY columns are non-NULL, +** only an INSERT is appears in the changeset. Similarly, if an existing row +** with non-NULL PRIMARY KEY values is updated so that one or more of its +** PRIMARY KEY columns are set to NULL, the resulting changeset contains a +** DELETE change only. +** +** The contents of a changeset may be traversed using an iterator created +** using the [sqlite3changeset_start()] API. A changeset may be applied to +** a database with a compatible schema using the [sqlite3changeset_apply()] +** API. +** +** Within a changeset generated by this function, all changes related to a +** single table are grouped together. In other words, when iterating through +** a changeset or when applying a changeset to a database, all changes related +** to a single table are processed before moving on to the next table. Tables +** are sorted in the same order in which they were attached (or auto-attached) +** to the sqlite3_session object. The order in which the changes related to +** a single table are stored is undefined. +** +** Following a successful call to this function, it is the responsibility of +** the caller to eventually free the buffer that *ppChangeset points to using +** [sqlite3_free()]. +** +**

Changeset Generation

+** +** Once a table has been attached to a session object, the session object +** records the primary key values of all new rows inserted into the table. +** It also records the original primary key and other column values of any +** deleted or updated rows. For each unique primary key value, data is only +** recorded once - the first time a row with said primary key is inserted, +** updated or deleted in the lifetime of the session. +** +** There is one exception to the previous paragraph: when a row is inserted, +** updated or deleted, if one or more of its primary key columns contain a +** NULL value, no record of the change is made. +** +** The session object therefore accumulates two types of records - those +** that consist of primary key values only (created when the user inserts +** a new record) and those that consist of the primary key values and the +** original values of other table columns (created when the users deletes +** or updates a record). +** +** When this function is called, the requested changeset is created using +** both the accumulated records and the current contents of the database +** file. Specifically: +** +**
    +**
  • For each record generated by an insert, the database is queried +** for a row with a matching primary key. If one is found, an INSERT +** change is added to the changeset. If no such row is found, no change +** is added to the changeset. +** +**
  • For each record generated by an update or delete, the database is +** queried for a row with a matching primary key. If such a row is +** found and one or more of the non-primary key fields have been +** modified from their original values, an UPDATE change is added to +** the changeset. Or, if no such row is found in the table, a DELETE +** change is added to the changeset. If there is a row with a matching +** primary key in the database, but all fields contain their original +** values, no change is added to the changeset. +**
+** +** This means, amongst other things, that if a row is inserted and then later +** deleted while a session object is active, neither the insert nor the delete +** will be present in the changeset. Or if a row is deleted and then later a +** row with the same primary key values inserted while a session object is +** active, the resulting changeset will contain an UPDATE change instead of +** a DELETE and an INSERT. +** +** When a session object is disabled (see the [sqlite3session_enable()] API), +** it does not accumulate records when rows are inserted, updated or deleted. +** This may appear to have some counter-intuitive effects if a single row +** is written to more than once during a session. For example, if a row +** is inserted while a session object is enabled, then later deleted while +** the same session object is disabled, no INSERT record will appear in the +** changeset, even though the delete took place while the session was disabled. +** Or, if one field of a row is updated while a session is disabled, and +** another field of the same row is updated while the session is enabled, the +** resulting changeset will contain an UPDATE change that updates both fields. +*/ +SQLITE_API int sqlite3session_changeset( + sqlite3_session* pSession, /* Session object */ + int* pnChangeset, /* OUT: Size of buffer at *ppChangeset */ + void** ppChangeset /* OUT: Buffer containing changeset */ + ); + +/* +** CAPI3REF: Load The Difference Between Tables Into A Session +** METHOD: sqlite3_session +** +** If it is not already attached to the session object passed as the first +** argument, this function attaches table zTbl in the same manner as the +** [sqlite3session_attach()] function. If zTbl does not exist, or if it +** does not have a primary key, this function is a no-op (but does not return +** an error). +** +** Argument zFromDb must be the name of a database ("main", "temp" etc.) +** attached to the same database handle as the session object that contains +** a table compatible with the table attached to the session by this function. +** A table is considered compatible if it: +** +**
    +**
  • Has the same name, +**
  • Has the same set of columns declared in the same order, and +**
  • Has the same PRIMARY KEY definition. +**
+** +** If the tables are not compatible, SQLITE_SCHEMA is returned. If the tables +** are compatible but do not have any PRIMARY KEY columns, it is not an error +** but no changes are added to the session object. As with other session +** APIs, tables without PRIMARY KEYs are simply ignored. +** +** This function adds a set of changes to the session object that could be +** used to update the table in database zFrom (call this the "from-table") +** so that its content is the same as the table attached to the session +** object (call this the "to-table"). Specifically: +** +**
    +**
  • For each row (primary key) that exists in the to-table but not in +** the from-table, an INSERT record is added to the session object. +** +**
  • For each row (primary key) that exists in the to-table but not in +** the from-table, a DELETE record is added to the session object. +** +**
  • For each row (primary key) that exists in both tables, but features +** different non-PK values in each, an UPDATE record is added to the +** session. +**
+** +** To clarify, if this function is called and then a changeset constructed +** using [sqlite3session_changeset()], then after applying that changeset to +** database zFrom the contents of the two compatible tables would be +** identical. +** +** It an error if database zFrom does not exist or does not contain the +** required compatible table. +** +** If the operation successful, SQLITE_OK is returned. Otherwise, an SQLite +** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg +** may be set to point to a buffer containing an English language error +** message. It is the responsibility of the caller to free this buffer using +** sqlite3_free(). +*/ +SQLITE_API int sqlite3session_diff( + sqlite3_session* pSession, + const char* zFromDb, + const char* zTbl, + char** pzErrMsg); + +/* +** CAPI3REF: Generate A Patchset From A Session Object +** METHOD: sqlite3_session +** +** The differences between a patchset and a changeset are that: +** +**
    +**
  • DELETE records consist of the primary key fields only. The +** original values of other fields are omitted. +**
  • The original values of any modified fields are omitted from +** UPDATE records. +**
+** +** A patchset blob may be used with up to date versions of all +** sqlite3changeset_xxx API functions except for sqlite3changeset_invert(), +** which returns SQLITE_CORRUPT if it is passed a patchset. Similarly, +** attempting to use a patchset blob with old versions of the +** sqlite3changeset_xxx APIs also provokes an SQLITE_CORRUPT error. +** +** Because the non-primary key "old.*" fields are omitted, no +** SQLITE_CHANGESET_DATA conflicts can be detected or reported if a patchset +** is passed to the sqlite3changeset_apply() API. Other conflict types work +** in the same way as for changesets. +** +** Changes within a patchset are ordered in the same way as for changesets +** generated by the sqlite3session_changeset() function (i.e. all changes for +** a single table are grouped together, tables appear in the order in which +** they were attached to the session object). +*/ +SQLITE_API int sqlite3session_patchset( + sqlite3_session* pSession, /* Session object */ + int* pnPatchset, /* OUT: Size of buffer at *ppPatchset */ + void** ppPatchset /* OUT: Buffer containing patchset */ + ); + +/* +** CAPI3REF: Test if a changeset has recorded any changes. +** +** Return non-zero if no changes to attached tables have been recorded by +** the session object passed as the first argument. Otherwise, if one or +** more changes have been recorded, return zero. +** +** Even if this function returns zero, it is possible that calling +** [sqlite3session_changeset()] on the session handle may still return a +** changeset that contains no changes. This can happen when a row in +** an attached table is modified and then later on the original values +** are restored. However, if this function returns non-zero, then it is +** guaranteed that a call to sqlite3session_changeset() will return a +** changeset containing zero changes. +*/ +SQLITE_API int sqlite3session_isempty(sqlite3_session* pSession); + +/* +** CAPI3REF: Create An Iterator To Traverse A Changeset +** CONSTRUCTOR: sqlite3_changeset_iter +** +** Create an iterator used to iterate through the contents of a changeset. +** If successful, *pp is set to point to the iterator handle and SQLITE_OK +** is returned. Otherwise, if an error occurs, *pp is set to zero and an +** SQLite error code is returned. +** +** The following functions can be used to advance and query a changeset +** iterator created by this function: +** +**
    +**
  • [sqlite3changeset_next()] +**
  • [sqlite3changeset_op()] +**
  • [sqlite3changeset_new()] +**
  • [sqlite3changeset_old()] +**
+** +** It is the responsibility of the caller to eventually destroy the iterator +** by passing it to [sqlite3changeset_finalize()]. The buffer containing the +** changeset (pChangeset) must remain valid until after the iterator is +** destroyed. +** +** Assuming the changeset blob was created by one of the +** [sqlite3session_changeset()], [sqlite3changeset_concat()] or +** [sqlite3changeset_invert()] functions, all changes within the changeset +** that apply to a single table are grouped together. This means that when +** an application iterates through a changeset using an iterator created by +** this function, all changes that relate to a single table are visited +** consecutively. There is no chance that the iterator will visit a change +** the applies to table X, then one for table Y, and then later on visit +** another change for table X. +*/ +SQLITE_API int sqlite3changeset_start( + sqlite3_changeset_iter** pp, /* OUT: New changeset iterator handle */ + int nChangeset, /* Size of changeset blob in bytes */ + void* pChangeset /* Pointer to blob containing changeset */ + ); + +/* +** CAPI3REF: Advance A Changeset Iterator +** METHOD: sqlite3_changeset_iter +** +** This function may only be used with iterators created by function +** [sqlite3changeset_start()]. If it is called on an iterator passed to +** a conflict-handler callback by [sqlite3changeset_apply()], SQLITE_MISUSE +** is returned and the call has no effect. +** +** Immediately after an iterator is created by sqlite3changeset_start(), it +** does not point to any change in the changeset. Assuming the changeset +** is not empty, the first call to this function advances the iterator to +** point to the first change in the changeset. Each subsequent call advances +** the iterator to point to the next change in the changeset (if any). If +** no error occurs and the iterator points to a valid change after a call +** to sqlite3changeset_next() has advanced it, SQLITE_ROW is returned. +** Otherwise, if all changes in the changeset have already been visited, +** SQLITE_DONE is returned. +** +** If an error occurs, an SQLite error code is returned. Possible error +** codes include SQLITE_CORRUPT (if the changeset buffer is corrupt) or +** SQLITE_NOMEM. +*/ +SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter* pIter); + +/* +** CAPI3REF: Obtain The Current Operation From A Changeset Iterator +** METHOD: sqlite3_changeset_iter +** +** The pIter argument passed to this function may either be an iterator +** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator +** created by [sqlite3changeset_start()]. In the latter case, the most recent +** call to [sqlite3changeset_next()] must have returned [SQLITE_ROW]. If this +** is not the case, this function returns [SQLITE_MISUSE]. +** +** If argument pzTab is not NULL, then *pzTab is set to point to a +** nul-terminated utf-8 encoded string containing the name of the table +** affected by the current change. The buffer remains valid until either +** sqlite3changeset_next() is called on the iterator or until the +** conflict-handler function returns. If pnCol is not NULL, then *pnCol is +** set to the number of columns in the table affected by the change. If +** pbIncorrect is not NULL, then *pbIndirect is set to true (1) if the change +** is an indirect change, or false (0) otherwise. See the documentation for +** [sqlite3session_indirect()] for a description of direct and indirect +** changes. Finally, if pOp is not NULL, then *pOp is set to one of +** [SQLITE_INSERT], [SQLITE_DELETE] or [SQLITE_UPDATE], depending on the +** type of change that the iterator currently points to. +** +** If no error occurs, SQLITE_OK is returned. If an error does occur, an +** SQLite error code is returned. The values of the output variables may not +** be trusted in this case. +*/ +SQLITE_API int sqlite3changeset_op( + sqlite3_changeset_iter* pIter, /* Iterator object */ + const char** pzTab, /* OUT: Pointer to table name */ + int* pnCol, /* OUT: Number of columns in table */ + int* pOp, /* OUT: SQLITE_INSERT, DELETE or UPDATE */ + int* pbIndirect /* OUT: True for an 'indirect' change */ + ); + +/* +** CAPI3REF: Obtain The Primary Key Definition Of A Table +** METHOD: sqlite3_changeset_iter +** +** For each modified table, a changeset includes the following: +** +**
    +**
  • The number of columns in the table, and +**
  • Which of those columns make up the tables PRIMARY KEY. +**
+** +** This function is used to find which columns comprise the PRIMARY KEY of +** the table modified by the change that iterator pIter currently points to. +** If successful, *pabPK is set to point to an array of nCol entries, where +** nCol is the number of columns in the table. Elements of *pabPK are set to +** 0x01 if the corresponding column is part of the tables primary key, or +** 0x00 if it is not. +** +** If argument pnCol is not NULL, then *pnCol is set to the number of columns +** in the table. +** +** If this function is called when the iterator does not point to a valid +** entry, SQLITE_MISUSE is returned and the output variables zeroed. Otherwise, +** SQLITE_OK is returned and the output variables populated as described +** above. +*/ +SQLITE_API int sqlite3changeset_pk( + sqlite3_changeset_iter* pIter, /* Iterator object */ + unsigned char** pabPK, /* OUT: Array of boolean - true for PK cols */ + int* pnCol /* OUT: Number of entries in output array */ + ); + +/* +** CAPI3REF: Obtain old.* Values From A Changeset Iterator +** METHOD: sqlite3_changeset_iter +** +** The pIter argument passed to this function may either be an iterator +** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator +** created by [sqlite3changeset_start()]. In the latter case, the most recent +** call to [sqlite3changeset_next()] must have returned SQLITE_ROW. +** Furthermore, it may only be called if the type of change that the iterator +** currently points to is either [SQLITE_DELETE] or [SQLITE_UPDATE]. Otherwise, +** this function returns [SQLITE_MISUSE] and sets *ppValue to NULL. +** +** Argument iVal must be greater than or equal to 0, and less than the number +** of columns in the table affected by the current change. Otherwise, +** [SQLITE_RANGE] is returned and *ppValue is set to NULL. +** +** If successful, this function sets *ppValue to point to a protected +** sqlite3_value object containing the iVal'th value from the vector of +** original row values stored as part of the UPDATE or DELETE change and +** returns SQLITE_OK. The name of the function comes from the fact that this +** is similar to the "old.*" columns available to update or delete triggers. +** +** If some other error occurs (e.g. an OOM condition), an SQLite error code +** is returned and *ppValue is set to NULL. +*/ +SQLITE_API int sqlite3changeset_old( + sqlite3_changeset_iter* pIter, /* Changeset iterator */ + int iVal, /* Column number */ + sqlite3_value** ppValue /* OUT: Old value (or NULL pointer) */ + ); + +/* +** CAPI3REF: Obtain new.* Values From A Changeset Iterator +** METHOD: sqlite3_changeset_iter +** +** The pIter argument passed to this function may either be an iterator +** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator +** created by [sqlite3changeset_start()]. In the latter case, the most recent +** call to [sqlite3changeset_next()] must have returned SQLITE_ROW. +** Furthermore, it may only be called if the type of change that the iterator +** currently points to is either [SQLITE_UPDATE] or [SQLITE_INSERT]. Otherwise, +** this function returns [SQLITE_MISUSE] and sets *ppValue to NULL. +** +** Argument iVal must be greater than or equal to 0, and less than the number +** of columns in the table affected by the current change. Otherwise, +** [SQLITE_RANGE] is returned and *ppValue is set to NULL. +** +** If successful, this function sets *ppValue to point to a protected +** sqlite3_value object containing the iVal'th value from the vector of +** new row values stored as part of the UPDATE or INSERT change and +** returns SQLITE_OK. If the change is an UPDATE and does not include +** a new value for the requested column, *ppValue is set to NULL and +** SQLITE_OK returned. The name of the function comes from the fact that +** this is similar to the "new.*" columns available to update or delete +** triggers. +** +** If some other error occurs (e.g. an OOM condition), an SQLite error code +** is returned and *ppValue is set to NULL. +*/ +SQLITE_API int sqlite3changeset_new( + sqlite3_changeset_iter* pIter, /* Changeset iterator */ + int iVal, /* Column number */ + sqlite3_value** ppValue /* OUT: New value (or NULL pointer) */ + ); + +/* +** CAPI3REF: Obtain Conflicting Row Values From A Changeset Iterator +** METHOD: sqlite3_changeset_iter +** +** This function should only be used with iterator objects passed to a +** conflict-handler callback by [sqlite3changeset_apply()] with either +** [SQLITE_CHANGESET_DATA] or [SQLITE_CHANGESET_CONFLICT]. If this function +** is called on any other iterator, [SQLITE_MISUSE] is returned and *ppValue +** is set to NULL. +** +** Argument iVal must be greater than or equal to 0, and less than the number +** of columns in the table affected by the current change. Otherwise, +** [SQLITE_RANGE] is returned and *ppValue is set to NULL. +** +** If successful, this function sets *ppValue to point to a protected +** sqlite3_value object containing the iVal'th value from the +** "conflicting row" associated with the current conflict-handler callback +** and returns SQLITE_OK. +** +** If some other error occurs (e.g. an OOM condition), an SQLite error code +** is returned and *ppValue is set to NULL. +*/ +SQLITE_API int sqlite3changeset_conflict( + sqlite3_changeset_iter* pIter, /* Changeset iterator */ + int iVal, /* Column number */ + sqlite3_value** ppValue /* OUT: Value from conflicting row */ + ); + +/* +** CAPI3REF: Determine The Number Of Foreign Key Constraint Violations +** METHOD: sqlite3_changeset_iter +** +** This function may only be called with an iterator passed to an +** SQLITE_CHANGESET_FOREIGN_KEY conflict handler callback. In this case +** it sets the output variable to the total number of known foreign key +** violations in the destination database and returns SQLITE_OK. +** +** In all other cases this function returns SQLITE_MISUSE. +*/ +SQLITE_API int sqlite3changeset_fk_conflicts( + sqlite3_changeset_iter* pIter, /* Changeset iterator */ + int* pnOut /* OUT: Number of FK violations */ + ); + +/* +** CAPI3REF: Finalize A Changeset Iterator +** METHOD: sqlite3_changeset_iter +** +** This function is used to finalize an iterator allocated with +** [sqlite3changeset_start()]. +** +** This function should only be called on iterators created using the +** [sqlite3changeset_start()] function. If an application calls this +** function with an iterator passed to a conflict-handler by +** [sqlite3changeset_apply()], [SQLITE_MISUSE] is immediately returned and the +** call has no effect. +** +** If an error was encountered within a call to an sqlite3changeset_xxx() +** function (for example an [SQLITE_CORRUPT] in [sqlite3changeset_next()] or an +** [SQLITE_NOMEM] in [sqlite3changeset_new()]) then an error code corresponding +** to that error is returned by this function. Otherwise, SQLITE_OK is +** returned. This is to allow the following pattern (pseudo-code): +** +**
+**   sqlite3changeset_start();
+**   while( SQLITE_ROW==sqlite3changeset_next() ){
+**     // Do something with change.
+**   }
+**   rc = sqlite3changeset_finalize();
+**   if( rc!=SQLITE_OK ){
+**     // An error has occurred
+**   }
+** 
+*/ +SQLITE_API int sqlite3changeset_finalize(sqlite3_changeset_iter* pIter); + +/* +** CAPI3REF: Invert A Changeset +** +** This function is used to "invert" a changeset object. Applying an inverted +** changeset to a database reverses the effects of applying the uninverted +** changeset. Specifically: +** +**
    +**
  • Each DELETE change is changed to an INSERT, and +**
  • Each INSERT change is changed to a DELETE, and +**
  • For each UPDATE change, the old.* and new.* values are exchanged. +**
+** +** This function does not change the order in which changes appear within +** the changeset. It merely reverses the sense of each individual change. +** +** If successful, a pointer to a buffer containing the inverted changeset +** is stored in *ppOut, the size of the same buffer is stored in *pnOut, and +** SQLITE_OK is returned. If an error occurs, both *pnOut and *ppOut are +** zeroed and an SQLite error code returned. +** +** It is the responsibility of the caller to eventually call sqlite3_free() +** on the *ppOut pointer to free the buffer allocation following a successful +** call to this function. +** +** WARNING/TODO: This function currently assumes that the input is a valid +** changeset. If it is not, the results are undefined. +*/ +SQLITE_API int sqlite3changeset_invert( + int nIn, + const void* pIn, /* Input changeset */ + int* pnOut, + void** ppOut /* OUT: Inverse of input */ + ); + +/* +** CAPI3REF: Concatenate Two Changeset Objects +** +** This function is used to concatenate two changesets, A and B, into a +** single changeset. The result is a changeset equivalent to applying +** changeset A followed by changeset B. +** +** This function combines the two input changesets using an +** sqlite3_changegroup object. Calling it produces similar results as the +** following code fragment: +** +**
+**   sqlite3_changegroup *pGrp;
+**   rc = sqlite3_changegroup_new(&pGrp);
+**   if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nA, pA);
+**   if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nB, pB);
+**   if( rc==SQLITE_OK ){
+**     rc = sqlite3changegroup_output(pGrp, pnOut, ppOut);
+**   }else{
+**     *ppOut = 0;
+**     *pnOut = 0;
+**   }
+** 
+** +** Refer to the sqlite3_changegroup documentation below for details. +*/ +SQLITE_API int sqlite3changeset_concat( + int nA, /* Number of bytes in buffer pA */ + void* pA, /* Pointer to buffer containing changeset A */ + int nB, /* Number of bytes in buffer pB */ + void* pB, /* Pointer to buffer containing changeset B */ + int* pnOut, /* OUT: Number of bytes in output changeset */ + void** ppOut /* OUT: Buffer containing output changeset */ + ); + +/* +** CAPI3REF: Changegroup Handle +** +** A changegroup is an object used to combine two or more +** [changesets] or [patchsets] +*/ +typedef struct sqlite3_changegroup sqlite3_changegroup; + +/* +** CAPI3REF: Create A New Changegroup Object +** CONSTRUCTOR: sqlite3_changegroup +** +** An sqlite3_changegroup object is used to combine two or more changesets +** (or patchsets) into a single changeset (or patchset). A single changegroup +** object may combine changesets or patchsets, but not both. The output is +** always in the same format as the input. +** +** If successful, this function returns SQLITE_OK and populates (*pp) with +** a pointer to a new sqlite3_changegroup object before returning. The caller +** should eventually free the returned object using a call to +** sqlite3changegroup_delete(). If an error occurs, an SQLite error code +** (i.e. SQLITE_NOMEM) is returned and *pp is set to NULL. +** +** The usual usage pattern for an sqlite3_changegroup object is as follows: +** +**
    +**
  • It is created using a call to sqlite3changegroup_new(). +** +**
  • Zero or more changesets (or patchsets) are added to the object +** by calling sqlite3changegroup_add(). +** +**
  • The result of combining all input changesets together is obtained +** by the application via a call to sqlite3changegroup_output(). +** +**
  • The object is deleted using a call to sqlite3changegroup_delete(). +**
+** +** Any number of calls to add() and output() may be made between the calls to +** new() and delete(), and in any order. +** +** As well as the regular sqlite3changegroup_add() and +** sqlite3changegroup_output() functions, also available are the streaming +** versions sqlite3changegroup_add_strm() and sqlite3changegroup_output_strm(). +*/ +SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup** pp); + +/* +** CAPI3REF: Add A Changeset To A Changegroup +** METHOD: sqlite3_changegroup +** +** Add all changes within the changeset (or patchset) in buffer pData (size +** nData bytes) to the changegroup. +** +** If the buffer contains a patchset, then all prior calls to this function +** on the same changegroup object must also have specified patchsets. Or, if +** the buffer contains a changeset, so must have the earlier calls to this +** function. Otherwise, SQLITE_ERROR is returned and no changes are added +** to the changegroup. +** +** Rows within the changeset and changegroup are identified by the values in +** their PRIMARY KEY columns. A change in the changeset is considered to +** apply to the same row as a change already present in the changegroup if +** the two rows have the same primary key. +** +** Changes to rows that do not already appear in the changegroup are +** simply copied into it. Or, if both the new changeset and the changegroup +** contain changes that apply to a single row, the final contents of the +** changegroup depends on the type of each change, as follows: +** +** +** +** +**
Existing Change New Change Output Change +**
INSERT INSERT +** The new change is ignored. This case does not occur if the new +** changeset was recorded immediately after the changesets already +** added to the changegroup. +**
INSERT UPDATE +** The INSERT change remains in the changegroup. The values in the +** INSERT change are modified as if the row was inserted by the +** existing change and then updated according to the new change. +**
INSERT DELETE +** The existing INSERT is removed from the changegroup. The DELETE is +** not added. +**
UPDATE INSERT +** The new change is ignored. This case does not occur if the new +** changeset was recorded immediately after the changesets already +** added to the changegroup. +**
UPDATE UPDATE +** The existing UPDATE remains within the changegroup. It is amended +** so that the accompanying values are as if the row was updated once +** by the existing change and then again by the new change. +**
UPDATE DELETE +** The existing UPDATE is replaced by the new DELETE within the +** changegroup. +**
DELETE INSERT +** If one or more of the column values in the row inserted by the +** new change differ from those in the row deleted by the existing +** change, the existing DELETE is replaced by an UPDATE within the +** changegroup. Otherwise, if the inserted row is exactly the same +** as the deleted row, the existing DELETE is simply discarded. +**
DELETE UPDATE +** The new change is ignored. This case does not occur if the new +** changeset was recorded immediately after the changesets already +** added to the changegroup. +**
DELETE DELETE +** The new change is ignored. This case does not occur if the new +** changeset was recorded immediately after the changesets already +** added to the changegroup. +**
+** +** If the new changeset contains changes to a table that is already present +** in the changegroup, then the number of columns and the position of the +** primary key columns for the table must be consistent. If this is not the +** case, this function fails with SQLITE_SCHEMA. If the input changeset +** appears to be corrupt and the corruption is detected, SQLITE_CORRUPT is +** returned. Or, if an out-of-memory condition occurs during processing, this +** function returns SQLITE_NOMEM. In all cases, if an error occurs the +** final contents of the changegroup is undefined. +** +** If no error occurs, SQLITE_OK is returned. +*/ +SQLITE_API int +sqlite3changegroup_add(sqlite3_changegroup*, int nData, void* pData); + +/* +** CAPI3REF: Obtain A Composite Changeset From A Changegroup +** METHOD: sqlite3_changegroup +** +** Obtain a buffer containing a changeset (or patchset) representing the +** current contents of the changegroup. If the inputs to the changegroup +** were themselves changesets, the output is a changeset. Or, if the +** inputs were patchsets, the output is also a patchset. +** +** As with the output of the sqlite3session_changeset() and +** sqlite3session_patchset() functions, all changes related to a single +** table are grouped together in the output of this function. Tables appear +** in the same order as for the very first changeset added to the changegroup. +** If the second or subsequent changesets added to the changegroup contain +** changes for tables that do not appear in the first changeset, they are +** appended onto the end of the output changeset, again in the order in +** which they are first encountered. +** +** If an error occurs, an SQLite error code is returned and the output +** variables (*pnData) and (*ppData) are set to 0. Otherwise, SQLITE_OK +** is returned and the output variables are set to the size of and a +** pointer to the output buffer, respectively. In this case it is the +** responsibility of the caller to eventually free the buffer using a +** call to sqlite3_free(). +*/ +SQLITE_API int sqlite3changegroup_output( + sqlite3_changegroup*, + int* pnData, /* OUT: Size of output buffer in bytes */ + void** ppData /* OUT: Pointer to output buffer */ + ); + +/* +** CAPI3REF: Delete A Changegroup Object +** DESTRUCTOR: sqlite3_changegroup +*/ +SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*); + +/* +** CAPI3REF: Apply A Changeset To A Database +** +** Apply a changeset or patchset to a database. These functions attempt to +** update the "main" database attached to handle db with the changes found in +** the changeset passed via the second and third arguments. +** +** The fourth argument (xFilter) passed to these functions is the "filter +** callback". If it is not NULL, then for each table affected by at least one +** change in the changeset, the filter callback is invoked with +** the table name as the second argument, and a copy of the context pointer +** passed as the sixth argument as the first. If the "filter callback" +** returns zero, then no attempt is made to apply any changes to the table. +** Otherwise, if the return value is non-zero or the xFilter argument to +** is NULL, all changes related to the table are attempted. +** +** For each table that is not excluded by the filter callback, this function +** tests that the target database contains a compatible table. A table is +** considered compatible if all of the following are true: +** +**
    +**
  • The table has the same name as the name recorded in the +** changeset, and +**
  • The table has at least as many columns as recorded in the +** changeset, and +**
  • The table has primary key columns in the same position as +** recorded in the changeset. +**
+** +** If there is no compatible table, it is not an error, but none of the +** changes associated with the table are applied. A warning message is issued +** via the sqlite3_log() mechanism with the error code SQLITE_SCHEMA. At most +** one such warning is issued for each table in the changeset. +** +** For each change for which there is a compatible table, an attempt is made +** to modify the table contents according to the UPDATE, INSERT or DELETE +** change. If a change cannot be applied cleanly, the conflict handler +** function passed as the fifth argument to sqlite3changeset_apply() may be +** invoked. A description of exactly when the conflict handler is invoked for +** each type of change is below. +** +** Unlike the xFilter argument, xConflict may not be passed NULL. The results +** of passing anything other than a valid function pointer as the xConflict +** argument are undefined. +** +** Each time the conflict handler function is invoked, it must return one +** of [SQLITE_CHANGESET_OMIT], [SQLITE_CHANGESET_ABORT] or +** [SQLITE_CHANGESET_REPLACE]. SQLITE_CHANGESET_REPLACE may only be returned +** if the second argument passed to the conflict handler is either +** SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If the conflict-handler +** returns an illegal value, any changes already made are rolled back and +** the call to sqlite3changeset_apply() returns SQLITE_MISUSE. Different +** actions are taken by sqlite3changeset_apply() depending on the value +** returned by each invocation of the conflict-handler function. Refer to +** the documentation for the three +** [SQLITE_CHANGESET_OMIT|available return values] for details. +** +**
+**
DELETE Changes
+** For each DELETE change, the function checks if the target database +** contains a row with the same primary key value (or values) as the +** original row values stored in the changeset. If it does, and the values +** stored in all non-primary key columns also match the values stored in +** the changeset the row is deleted from the target database. +** +** If a row with matching primary key values is found, but one or more of +** the non-primary key fields contains a value different from the original +** row value stored in the changeset, the conflict-handler function is +** invoked with [SQLITE_CHANGESET_DATA] as the second argument. If the +** database table has more columns than are recorded in the changeset, +** only the values of those non-primary key fields are compared against +** the current database contents - any trailing database table columns +** are ignored. +** +** If no row with matching primary key values is found in the database, +** the conflict-handler function is invoked with [SQLITE_CHANGESET_NOTFOUND] +** passed as the second argument. +** +** If the DELETE operation is attempted, but SQLite returns SQLITE_CONSTRAINT +** (which can only happen if a foreign key constraint is violated), the +** conflict-handler function is invoked with [SQLITE_CHANGESET_CONSTRAINT] +** passed as the second argument. This includes the case where the DELETE +** operation is attempted because an earlier call to the conflict handler +** function returned [SQLITE_CHANGESET_REPLACE]. +** +**
INSERT Changes
+** For each INSERT change, an attempt is made to insert the new row into +** the database. If the changeset row contains fewer fields than the +** database table, the trailing fields are populated with their default +** values. +** +** If the attempt to insert the row fails because the database already +** contains a row with the same primary key values, the conflict handler +** function is invoked with the second argument set to +** [SQLITE_CHANGESET_CONFLICT]. +** +** If the attempt to insert the row fails because of some other constraint +** violation (e.g. NOT NULL or UNIQUE), the conflict handler function is +** invoked with the second argument set to [SQLITE_CHANGESET_CONSTRAINT]. +** This includes the case where the INSERT operation is re-attempted because +** an earlier call to the conflict handler function returned +** [SQLITE_CHANGESET_REPLACE]. +** +**
UPDATE Changes
+** For each UPDATE change, the function checks if the target database +** contains a row with the same primary key value (or values) as the +** original row values stored in the changeset. If it does, and the values +** stored in all modified non-primary key columns also match the values +** stored in the changeset the row is updated within the target database. +** +** If a row with matching primary key values is found, but one or more of +** the modified non-primary key fields contains a value different from an +** original row value stored in the changeset, the conflict-handler function +** is invoked with [SQLITE_CHANGESET_DATA] as the second argument. Since +** UPDATE changes only contain values for non-primary key fields that are +** to be modified, only those fields need to match the original values to +** avoid the SQLITE_CHANGESET_DATA conflict-handler callback. +** +** If no row with matching primary key values is found in the database, +** the conflict-handler function is invoked with [SQLITE_CHANGESET_NOTFOUND] +** passed as the second argument. +** +** If the UPDATE operation is attempted, but SQLite returns +** SQLITE_CONSTRAINT, the conflict-handler function is invoked with +** [SQLITE_CHANGESET_CONSTRAINT] passed as the second argument. +** This includes the case where the UPDATE operation is attempted after +** an earlier call to the conflict handler function returned +** [SQLITE_CHANGESET_REPLACE]. +**
+** +** It is safe to execute SQL statements, including those that write to the +** table that the callback related to, from within the xConflict callback. +** This can be used to further customize the applications conflict +** resolution strategy. +** +** All changes made by these functions are enclosed in a savepoint transaction. +** If any other error (aside from a constraint failure when attempting to +** write to the target database) occurs, then the savepoint transaction is +** rolled back, restoring the target database to its original state, and an +** SQLite error code returned. +** +** If the output parameters (ppRebase) and (pnRebase) are non-NULL and +** the input is a changeset (not a patchset), then sqlite3changeset_apply_v2() +** may set (*ppRebase) to point to a "rebase" that may be used with the +** sqlite3_rebaser APIs buffer before returning. In this case (*pnRebase) +** is set to the size of the buffer in bytes. It is the responsibility of the +** caller to eventually free any such buffer using sqlite3_free(). The buffer +** is only allocated and populated if one or more conflicts were encountered +** while applying the patchset. See comments surrounding the sqlite3_rebaser +** APIs for further details. +** +** The behavior of sqlite3changeset_apply_v2() and its streaming equivalent +** may be modified by passing a combination of +** [SQLITE_CHANGESETAPPLY_NOSAVEPOINT | supported flags] as the 9th parameter. +** +** Note that the sqlite3changeset_apply_v2() API is still experimental +** and therefore subject to change. +*/ +SQLITE_API int sqlite3changeset_apply( + sqlite3* db, /* Apply change to "main" db of this handle */ + int nChangeset, /* Size of changeset in bytes */ + void* pChangeset, /* Changeset blob */ + int (*xFilter)( + void* pCtx, /* Copy of sixth arg to _apply() */ + const char* zTab /* Table name */ + ), + int (*xConflict)( + void* pCtx, /* Copy of sixth arg to _apply() */ + int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ + sqlite3_changeset_iter* p /* Handle describing change and conflict */ + ), + void* pCtx /* First argument passed to xConflict */ + ); +SQLITE_API int sqlite3changeset_apply_v2( + sqlite3* db, /* Apply change to "main" db of this handle */ + int nChangeset, /* Size of changeset in bytes */ + void* pChangeset, /* Changeset blob */ + int (*xFilter)( + void* pCtx, /* Copy of sixth arg to _apply() */ + const char* zTab /* Table name */ + ), + int (*xConflict)( + void* pCtx, /* Copy of sixth arg to _apply() */ + int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ + sqlite3_changeset_iter* p /* Handle describing change and conflict */ + ), + void* pCtx, /* First argument passed to xConflict */ + void** ppRebase, + int* pnRebase, /* OUT: Rebase data */ + int flags /* Combination of SESSION_APPLY_* flags */ + ); + +/* +** CAPI3REF: Flags for sqlite3changeset_apply_v2 +** +** The following flags may passed via the 9th parameter to +** [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]: +** +**
+**
SQLITE_CHANGESETAPPLY_NOSAVEPOINT
+** Usually, the sessions module encloses all operations performed by +** a single call to apply_v2() or apply_v2_strm() in a [SAVEPOINT]. The +** SAVEPOINT is committed if the changeset or patchset is successfully +** applied, or rolled back if an error occurs. Specifying this flag +** causes the sessions module to omit this savepoint. In this case, if the +** caller has an open transaction or savepoint when apply_v2() is called, +** it may revert the partially applied changeset by rolling it back. +*/ +#define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001 + +/* +** CAPI3REF: Constants Passed To The Conflict Handler +** +** Values that may be passed as the second argument to a conflict-handler. +** +**
+**
SQLITE_CHANGESET_DATA
+** The conflict handler is invoked with CHANGESET_DATA as the second argument +** when processing a DELETE or UPDATE change if a row with the required +** PRIMARY KEY fields is present in the database, but one or more other +** (non primary-key) fields modified by the update do not contain the +** expected "before" values. +** +** The conflicting row, in this case, is the database row with the matching +** primary key. +** +**
SQLITE_CHANGESET_NOTFOUND
+** The conflict handler is invoked with CHANGESET_NOTFOUND as the second +** argument when processing a DELETE or UPDATE change if a row with the +** required PRIMARY KEY fields is not present in the database. +** +** There is no conflicting row in this case. The results of invoking the +** sqlite3changeset_conflict() API are undefined. +** +**
SQLITE_CHANGESET_CONFLICT
+** CHANGESET_CONFLICT is passed as the second argument to the conflict +** handler while processing an INSERT change if the operation would result +** in duplicate primary key values. +** +** The conflicting row in this case is the database row with the matching +** primary key. +** +**
SQLITE_CHANGESET_FOREIGN_KEY
+** If foreign key handling is enabled, and applying a changeset leaves the +** database in a state containing foreign key violations, the conflict +** handler is invoked with CHANGESET_FOREIGN_KEY as the second argument +** exactly once before the changeset is committed. If the conflict handler +** returns CHANGESET_OMIT, the changes, including those that caused the +** foreign key constraint violation, are committed. Or, if it returns +** CHANGESET_ABORT, the changeset is rolled back. +** +** No current or conflicting row information is provided. The only function +** it is possible to call on the supplied sqlite3_changeset_iter handle +** is sqlite3changeset_fk_conflicts(). +** +**
SQLITE_CHANGESET_CONSTRAINT
+** If any other constraint violation occurs while applying a change (i.e. +** a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is +** invoked with CHANGESET_CONSTRAINT as the second argument. +** +** There is no conflicting row in this case. The results of invoking the +** sqlite3changeset_conflict() API are undefined. +** +**
+*/ +#define SQLITE_CHANGESET_DATA 1 +#define SQLITE_CHANGESET_NOTFOUND 2 +#define SQLITE_CHANGESET_CONFLICT 3 +#define SQLITE_CHANGESET_CONSTRAINT 4 +#define SQLITE_CHANGESET_FOREIGN_KEY 5 + +/* +** CAPI3REF: Constants Returned By The Conflict Handler +** +** A conflict handler callback must return one of the following three values. +** +**
+**
SQLITE_CHANGESET_OMIT
+** If a conflict handler returns this value no special action is taken. The +** change that caused the conflict is not applied. The session module +** continues to the next change in the changeset. +** +**
SQLITE_CHANGESET_REPLACE
+** This value may only be returned if the second argument to the conflict +** handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this +** is not the case, any changes applied so far are rolled back and the +** call to sqlite3changeset_apply() returns SQLITE_MISUSE. +** +** If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict +** handler, then the conflicting row is either updated or deleted, depending +** on the type of change. +** +** If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict +** handler, then the conflicting row is removed from the database and a +** second attempt to apply the change is made. If this second attempt fails, +** the original row is restored to the database before continuing. +** +**
SQLITE_CHANGESET_ABORT
+** If this value is returned, any changes applied so far are rolled back +** and the call to sqlite3changeset_apply() returns SQLITE_ABORT. +**
+*/ +#define SQLITE_CHANGESET_OMIT 0 +#define SQLITE_CHANGESET_REPLACE 1 +#define SQLITE_CHANGESET_ABORT 2 + +/* +** CAPI3REF: Rebasing changesets +** EXPERIMENTAL +** +** Suppose there is a site hosting a database in state S0. And that +** modifications are made that move that database to state S1 and a +** changeset recorded (the "local" changeset). Then, a changeset based +** on S0 is received from another site (the "remote" changeset) and +** applied to the database. The database is then in state +** (S1+"remote"), where the exact state depends on any conflict +** resolution decisions (OMIT or REPLACE) made while applying "remote". +** Rebasing a changeset is to update it to take those conflict +** resolution decisions into account, so that the same conflicts +** do not have to be resolved elsewhere in the network. +** +** For example, if both the local and remote changesets contain an +** INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)": +** +** local: INSERT INTO t1 VALUES(1, 'v1'); +** remote: INSERT INTO t1 VALUES(1, 'v2'); +** +** and the conflict resolution is REPLACE, then the INSERT change is +** removed from the local changeset (it was overridden). Or, if the +** conflict resolution was "OMIT", then the local changeset is modified +** to instead contain: +** +** UPDATE t1 SET b = 'v2' WHERE a=1; +** +** Changes within the local changeset are rebased as follows: +** +**
+**
Local INSERT
+** This may only conflict with a remote INSERT. If the conflict +** resolution was OMIT, then add an UPDATE change to the rebased +** changeset. Or, if the conflict resolution was REPLACE, add +** nothing to the rebased changeset. +** +**
Local DELETE
+** This may conflict with a remote UPDATE or DELETE. In both cases the +** only possible resolution is OMIT. If the remote operation was a +** DELETE, then add no change to the rebased changeset. If the remote +** operation was an UPDATE, then the old.* fields of change are updated +** to reflect the new.* values in the UPDATE. +** +**
Local UPDATE
+** This may conflict with a remote UPDATE or DELETE. If it conflicts +** with a DELETE, and the conflict resolution was OMIT, then the update +** is changed into an INSERT. Any undefined values in the new.* record +** from the update change are filled in using the old.* values from +** the conflicting DELETE. Or, if the conflict resolution was REPLACE, +** the UPDATE change is simply omitted from the rebased changeset. +** +** If conflict is with a remote UPDATE and the resolution is OMIT, then +** the old.* values are rebased using the new.* values in the remote +** change. Or, if the resolution is REPLACE, then the change is copied +** into the rebased changeset with updates to columns also updated by +** the conflicting remote UPDATE removed. If this means no columns would +** be updated, the change is omitted. +**
+** +** A local change may be rebased against multiple remote changes +** simultaneously. If a single key is modified by multiple remote +** changesets, they are combined as follows before the local changeset +** is rebased: +** +**
    +**
  • If there has been one or more REPLACE resolutions on a +** key, it is rebased according to a REPLACE. +** +**
  • If there have been no REPLACE resolutions on a key, then +** the local changeset is rebased according to the most recent +** of the OMIT resolutions. +**
+** +** Note that conflict resolutions from multiple remote changesets are +** combined on a per-field basis, not per-row. This means that in the +** case of multiple remote UPDATE operations, some fields of a single +** local change may be rebased for REPLACE while others are rebased for +** OMIT. +** +** In order to rebase a local changeset, the remote changeset must first +** be applied to the local database using sqlite3changeset_apply_v2() and +** the buffer of rebase information captured. Then: +** +**
    +**
  1. An sqlite3_rebaser object is created by calling +** sqlite3rebaser_create(). +**
  2. The new object is configured with the rebase buffer obtained from +** sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). +** If the local changeset is to be rebased against multiple remote +** changesets, then sqlite3rebaser_configure() should be called +** multiple times, in the same order that the multiple +** sqlite3changeset_apply_v2() calls were made. +**
  3. Each local changeset is rebased by calling sqlite3rebaser_rebase(). +**
  4. The sqlite3_rebaser object is deleted by calling +** sqlite3rebaser_delete(). +**
+*/ +typedef struct sqlite3_rebaser sqlite3_rebaser; + +/* +** CAPI3REF: Create a changeset rebaser object. +** EXPERIMENTAL +** +** Allocate a new changeset rebaser object. If successful, set (*ppNew) to +** point to the new object and return SQLITE_OK. Otherwise, if an error +** occurs, return an SQLite error code (e.g. SQLITE_NOMEM) and set (*ppNew) +** to NULL. +*/ +SQLITE_API int sqlite3rebaser_create(sqlite3_rebaser** ppNew); + +/* +** CAPI3REF: Configure a changeset rebaser object. +** EXPERIMENTAL +** +** Configure the changeset rebaser object to rebase changesets according +** to the conflict resolutions described by buffer pRebase (size nRebase +** bytes), which must have been obtained from a previous call to +** sqlite3changeset_apply_v2(). +*/ +SQLITE_API int +sqlite3rebaser_configure(sqlite3_rebaser*, int nRebase, const void* pRebase); + +/* +** CAPI3REF: Rebase a changeset +** EXPERIMENTAL +** +** Argument pIn must point to a buffer containing a changeset nIn bytes +** in size. This function allocates and populates a buffer with a copy +** of the changeset rebased rebased according to the configuration of the +** rebaser object passed as the first argument. If successful, (*ppOut) +** is set to point to the new buffer containing the rebased changset and +** (*pnOut) to its size in bytes and SQLITE_OK returned. It is the +** responsibility of the caller to eventually free the new buffer using +** sqlite3_free(). Otherwise, if an error occurs, (*ppOut) and (*pnOut) +** are set to zero and an SQLite error code returned. +*/ +SQLITE_API int sqlite3rebaser_rebase( + sqlite3_rebaser*, + int nIn, + const void* pIn, + int* pnOut, + void** ppOut); + +/* +** CAPI3REF: Delete a changeset rebaser object. +** EXPERIMENTAL +** +** Delete the changeset rebaser object and all associated resources. There +** should be one call to this function for each successful invocation +** of sqlite3rebaser_create(). +*/ +SQLITE_API void sqlite3rebaser_delete(sqlite3_rebaser* p); + +/* +** CAPI3REF: Streaming Versions of API functions. +** +** The six streaming API xxx_strm() functions serve similar purposes to the +** corresponding non-streaming API functions: +** +** +** +**
Streaming functionNon-streaming equivalent
sqlite3changeset_apply_strm[sqlite3changeset_apply] +**
sqlite3changeset_apply_strm_v2[sqlite3changeset_apply_v2] +**
sqlite3changeset_concat_strm[sqlite3changeset_concat] +**
sqlite3changeset_invert_strm[sqlite3changeset_invert] +**
sqlite3changeset_start_strm[sqlite3changeset_start] +**
sqlite3session_changeset_strm[sqlite3session_changeset] +**
sqlite3session_patchset_strm[sqlite3session_patchset] +**
+** +** Non-streaming functions that accept changesets (or patchsets) as input +** require that the entire changeset be stored in a single buffer in memory. +** Similarly, those that return a changeset or patchset do so by returning +** a pointer to a single large buffer allocated using sqlite3_malloc(). +** Normally this is convenient. However, if an application running in a +** low-memory environment is required to handle very large changesets, the +** large contiguous memory allocations required can become onerous. +** +** In order to avoid this problem, instead of a single large buffer, input +** is passed to a streaming API functions by way of a callback function that +** the sessions module invokes to incrementally request input data as it is +** required. In all cases, a pair of API function parameters such as +** +**
+**        int nChangeset,
+**        void *pChangeset,
+**  
+** +** Is replaced by: +** +**
+**        int (*xInput)(void *pIn, void *pData, int *pnData),
+**        void *pIn,
+**  
+** +** Each time the xInput callback is invoked by the sessions module, the first +** argument passed is a copy of the supplied pIn context pointer. The second +** argument, pData, points to a buffer (*pnData) bytes in size. Assuming no +** error occurs the xInput method should copy up to (*pnData) bytes of data +** into the buffer and set (*pnData) to the actual number of bytes copied +** before returning SQLITE_OK. If the input is completely exhausted, (*pnData) +** should be set to zero to indicate this. Or, if an error occurs, an SQLite +** error code should be returned. In all cases, if an xInput callback returns +** an error, all processing is abandoned and the streaming API function +** returns a copy of the error code to the caller. +** +** In the case of sqlite3changeset_start_strm(), the xInput callback may be +** invoked by the sessions module at any point during the lifetime of the +** iterator. If such an xInput callback returns an error, the iterator enters +** an error state, whereby all subsequent calls to iterator functions +** immediately fail with the same error code as returned by xInput. +** +** Similarly, streaming API functions that return changesets (or patchsets) +** return them in chunks by way of a callback function instead of via a +** pointer to a single large buffer. In this case, a pair of parameters such +** as: +** +**
+**        int *pnChangeset,
+**        void **ppChangeset,
+**  
+** +** Is replaced by: +** +**
+**        int (*xOutput)(void *pOut, const void *pData, int nData),
+**        void *pOut
+**  
+** +** The xOutput callback is invoked zero or more times to return data to +** the application. The first parameter passed to each call is a copy of the +** pOut pointer supplied by the application. The second parameter, pData, +** points to a buffer nData bytes in size containing the chunk of output +** data being returned. If the xOutput callback successfully processes the +** supplied data, it should return SQLITE_OK to indicate success. Otherwise, +** it should return some other SQLite error code. In this case processing +** is immediately abandoned and the streaming API function returns a copy +** of the xOutput error code to the application. +** +** The sessions module never invokes an xOutput callback with the third +** parameter set to a value less than or equal to zero. Other than this, +** no guarantees are made as to the size of the chunks of data returned. +*/ +SQLITE_API int sqlite3changeset_apply_strm( + sqlite3* db, /* Apply change to "main" db of this handle */ + int (*xInput)(void* pIn, void* pData, int* pnData), /* Input function */ + void* pIn, /* First arg for xInput */ + int (*xFilter)( + void* pCtx, /* Copy of sixth arg to _apply() */ + const char* zTab /* Table name */ + ), + int (*xConflict)( + void* pCtx, /* Copy of sixth arg to _apply() */ + int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ + sqlite3_changeset_iter* p /* Handle describing change and conflict */ + ), + void* pCtx /* First argument passed to xConflict */ + ); +SQLITE_API int sqlite3changeset_apply_v2_strm( + sqlite3* db, /* Apply change to "main" db of this handle */ + int (*xInput)(void* pIn, void* pData, int* pnData), /* Input function */ + void* pIn, /* First arg for xInput */ + int (*xFilter)( + void* pCtx, /* Copy of sixth arg to _apply() */ + const char* zTab /* Table name */ + ), + int (*xConflict)( + void* pCtx, /* Copy of sixth arg to _apply() */ + int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ + sqlite3_changeset_iter* p /* Handle describing change and conflict */ + ), + void* pCtx, /* First argument passed to xConflict */ + void** ppRebase, + int* pnRebase, + int flags); +SQLITE_API int sqlite3changeset_concat_strm( + int (*xInputA)(void* pIn, void* pData, int* pnData), + void* pInA, + int (*xInputB)(void* pIn, void* pData, int* pnData), + void* pInB, + int (*xOutput)(void* pOut, const void* pData, int nData), + void* pOut); +SQLITE_API int sqlite3changeset_invert_strm( + int (*xInput)(void* pIn, void* pData, int* pnData), + void* pIn, + int (*xOutput)(void* pOut, const void* pData, int nData), + void* pOut); +SQLITE_API int sqlite3changeset_start_strm( + sqlite3_changeset_iter** pp, + int (*xInput)(void* pIn, void* pData, int* pnData), + void* pIn); +SQLITE_API int sqlite3session_changeset_strm( + sqlite3_session* pSession, + int (*xOutput)(void* pOut, const void* pData, int nData), + void* pOut); +SQLITE_API int sqlite3session_patchset_strm( + sqlite3_session* pSession, + int (*xOutput)(void* pOut, const void* pData, int nData), + void* pOut); +SQLITE_API int sqlite3changegroup_add_strm( + sqlite3_changegroup*, + int (*xInput)(void* pIn, void* pData, int* pnData), + void* pIn); +SQLITE_API int sqlite3changegroup_output_strm( + sqlite3_changegroup*, + int (*xOutput)(void* pOut, const void* pData, int nData), + void* pOut); +SQLITE_API int sqlite3rebaser_rebase_strm( + sqlite3_rebaser* pRebaser, + int (*xInput)(void* pIn, void* pData, int* pnData), + void* pIn, + int (*xOutput)(void* pOut, const void* pData, int nData), + void* pOut); + +/* +** Make sure we can call this stuff from C++. +*/ +#ifdef __cplusplus +} +#endif + +#endif /* !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION) */ + +/******** End of sqlite3session.h *********/ +/******** Begin file fts5.h *********/ +/* +** 2014 May 31 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** Interfaces to extend FTS5. Using the interfaces defined in this file, +** FTS5 may be extended with: +** +** * custom tokenizers, and +** * custom auxiliary functions. +*/ + +#ifndef _FTS5_H +#define _FTS5_H + +#ifdef __cplusplus +extern "C" { +#endif + +/************************************************************************* +** CUSTOM AUXILIARY FUNCTIONS +** +** Virtual table implementations may overload SQL functions by implementing +** the sqlite3_module.xFindFunction() method. +*/ + +typedef struct Fts5ExtensionApi Fts5ExtensionApi; +typedef struct Fts5Context Fts5Context; +typedef struct Fts5PhraseIter Fts5PhraseIter; + +typedef void (*fts5_extension_function)( + const Fts5ExtensionApi* pApi, /* API offered by current FTS version */ + Fts5Context* pFts, /* First arg to pass to pApi functions */ + sqlite3_context* pCtx, /* Context for returning result/error */ + int nVal, /* Number of values in apVal[] array */ + sqlite3_value** apVal /* Array of trailing arguments */ + ); + +struct Fts5PhraseIter { + const unsigned char* a; + const unsigned char* b; +}; + +/* +** EXTENSION API FUNCTIONS +** +** xUserData(pFts): +** Return a copy of the context pointer the extension function was +** registered with. +** +** xColumnTotalSize(pFts, iCol, pnToken): +** If parameter iCol is less than zero, set output variable *pnToken +** to the total number of tokens in the FTS5 table. Or, if iCol is +** non-negative but less than the number of columns in the table, return +** the total number of tokens in column iCol, considering all rows in +** the FTS5 table. +** +** If parameter iCol is greater than or equal to the number of columns +** in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g. +** an OOM condition or IO error), an appropriate SQLite error code is +** returned. +** +** xColumnCount(pFts): +** Return the number of columns in the table. +** +** xColumnSize(pFts, iCol, pnToken): +** If parameter iCol is less than zero, set output variable *pnToken +** to the total number of tokens in the current row. Or, if iCol is +** non-negative but less than the number of columns in the table, set +** *pnToken to the number of tokens in column iCol of the current row. +** +** If parameter iCol is greater than or equal to the number of columns +** in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g. +** an OOM condition or IO error), an appropriate SQLite error code is +** returned. +** +** This function may be quite inefficient if used with an FTS5 table +** created with the "columnsize=0" option. +** +** xColumnText: +** This function attempts to retrieve the text of column iCol of the +** current document. If successful, (*pz) is set to point to a buffer +** containing the text in utf-8 encoding, (*pn) is set to the size in bytes +** (not characters) of the buffer and SQLITE_OK is returned. Otherwise, +** if an error occurs, an SQLite error code is returned and the final values +** of (*pz) and (*pn) are undefined. +** +** xPhraseCount: +** Returns the number of phrases in the current query expression. +** +** xPhraseSize: +** Returns the number of tokens in phrase iPhrase of the query. Phrases +** are numbered starting from zero. +** +** xInstCount: +** Set *pnInst to the total number of occurrences of all phrases within +** the query within the current row. Return SQLITE_OK if successful, or +** an error code (i.e. SQLITE_NOMEM) if an error occurs. +** +** This API can be quite slow if used with an FTS5 table created with the +** "detail=none" or "detail=column" option. If the FTS5 table is created +** with either "detail=none" or "detail=column" and "content=" option +** (i.e. if it is a contentless table), then this API always returns 0. +** +** xInst: +** Query for the details of phrase match iIdx within the current row. +** Phrase matches are numbered starting from zero, so the iIdx argument +** should be greater than or equal to zero and smaller than the value +** output by xInstCount(). +** +** Usually, output parameter *piPhrase is set to the phrase number, *piCol +** to the column in which it occurs and *piOff the token offset of the +** first token of the phrase. The exception is if the table was created +** with the offsets=0 option specified. In this case *piOff is always +** set to -1. +** +** Returns SQLITE_OK if successful, or an error code (i.e. SQLITE_NOMEM) +** if an error occurs. +** +** This API can be quite slow if used with an FTS5 table created with the +** "detail=none" or "detail=column" option. +** +** xRowid: +** Returns the rowid of the current row. +** +** xTokenize: +** Tokenize text using the tokenizer belonging to the FTS5 table. +** +** xQueryPhrase(pFts5, iPhrase, pUserData, xCallback): +** This API function is used to query the FTS table for phrase iPhrase +** of the current query. Specifically, a query equivalent to: +** +** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid +** +** with $p set to a phrase equivalent to the phrase iPhrase of the +** current query is executed. Any column filter that applies to +** phrase iPhrase of the current query is included in $p. For each +** row visited, the callback function passed as the fourth argument +** is invoked. The context and API objects passed to the callback +** function may be used to access the properties of each matched row. +** Invoking Api.xUserData() returns a copy of the pointer passed as +** the third argument to pUserData. +** +** If the callback function returns any value other than SQLITE_OK, the +** query is abandoned and the xQueryPhrase function returns immediately. +** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK. +** Otherwise, the error code is propagated upwards. +** +** If the query runs to completion without incident, SQLITE_OK is returned. +** Or, if some error occurs before the query completes or is aborted by +** the callback, an SQLite error code is returned. +** +** +** xSetAuxdata(pFts5, pAux, xDelete) +** +** Save the pointer passed as the second argument as the extension functions +** "auxiliary data". The pointer may then be retrieved by the current or any +** future invocation of the same fts5 extension function made as part of +** of the same MATCH query using the xGetAuxdata() API. +** +** Each extension function is allocated a single auxiliary data slot for +** each FTS query (MATCH expression). If the extension function is invoked +** more than once for a single FTS query, then all invocations share a +** single auxiliary data context. +** +** If there is already an auxiliary data pointer when this function is +** invoked, then it is replaced by the new pointer. If an xDelete callback +** was specified along with the original pointer, it is invoked at this +** point. +** +** The xDelete callback, if one is specified, is also invoked on the +** auxiliary data pointer after the FTS5 query has finished. +** +** If an error (e.g. an OOM condition) occurs within this function, an +** the auxiliary data is set to NULL and an error code returned. If the +** xDelete parameter was not NULL, it is invoked on the auxiliary data +** pointer before returning. +** +** +** xGetAuxdata(pFts5, bClear) +** +** Returns the current auxiliary data pointer for the fts5 extension +** function. See the xSetAuxdata() method for details. +** +** If the bClear argument is non-zero, then the auxiliary data is cleared +** (set to NULL) before this function returns. In this case the xDelete, +** if any, is not invoked. +** +** +** xRowCount(pFts5, pnRow) +** +** This function is used to retrieve the total number of rows in the table. +** In other words, the same value that would be returned by: +** +** SELECT count(*) FROM ftstable; +** +** xPhraseFirst() +** This function is used, along with type Fts5PhraseIter and the xPhraseNext +** method, to iterate through all instances of a single query phrase within +** the current row. This is the same information as is accessible via the +** xInstCount/xInst APIs. While the xInstCount/xInst APIs are more convenient +** to use, this API may be faster under some circumstances. To iterate +** through instances of phrase iPhrase, use the following code: +** +** Fts5PhraseIter iter; +** int iCol, iOff; +** for(pApi->xPhraseFirst(pFts, iPhrase, &iter, &iCol, &iOff); +** iCol>=0; +** pApi->xPhraseNext(pFts, &iter, &iCol, &iOff) +** ){ +** // An instance of phrase iPhrase at offset iOff of column iCol +** } +** +** The Fts5PhraseIter structure is defined above. Applications should not +** modify this structure directly - it should only be used as shown above +** with the xPhraseFirst() and xPhraseNext() API methods (and by +** xPhraseFirstColumn() and xPhraseNextColumn() as illustrated below). +** +** This API can be quite slow if used with an FTS5 table created with the +** "detail=none" or "detail=column" option. If the FTS5 table is created +** with either "detail=none" or "detail=column" and "content=" option +** (i.e. if it is a contentless table), then this API always iterates +** through an empty set (all calls to xPhraseFirst() set iCol to -1). +** +** xPhraseNext() +** See xPhraseFirst above. +** +** xPhraseFirstColumn() +** This function and xPhraseNextColumn() are similar to the xPhraseFirst() +** and xPhraseNext() APIs described above. The difference is that instead +** of iterating through all instances of a phrase in the current row, these +** APIs are used to iterate through the set of columns in the current row +** that contain one or more instances of a specified phrase. For example: +** +** Fts5PhraseIter iter; +** int iCol; +** for(pApi->xPhraseFirstColumn(pFts, iPhrase, &iter, &iCol); +** iCol>=0; +** pApi->xPhraseNextColumn(pFts, &iter, &iCol) +** ){ +** // Column iCol contains at least one instance of phrase iPhrase +** } +** +** This API can be quite slow if used with an FTS5 table created with the +** "detail=none" option. If the FTS5 table is created with either +** "detail=none" "content=" option (i.e. if it is a contentless table), +** then this API always iterates through an empty set (all calls to +** xPhraseFirstColumn() set iCol to -1). +** +** The information accessed using this API and its companion +** xPhraseFirstColumn() may also be obtained using xPhraseFirst/xPhraseNext +** (or xInst/xInstCount). The chief advantage of this API is that it is +** significantly more efficient than those alternatives when used with +** "detail=column" tables. +** +** xPhraseNextColumn() +** See xPhraseFirstColumn above. +*/ +struct Fts5ExtensionApi { + int iVersion; /* Currently always set to 3 */ + + void* (*xUserData)(Fts5Context*); + + int (*xColumnCount)(Fts5Context*); + int (*xRowCount)(Fts5Context*, sqlite3_int64* pnRow); + int (*xColumnTotalSize)(Fts5Context*, int iCol, sqlite3_int64* pnToken); + + int (*xTokenize)( + Fts5Context*, + const char* pText, + int nText, /* Text to tokenize */ + void* pCtx, /* Context passed to xToken() */ + int (*xToken)(void*, int, const char*, int, int, int) /* Callback */ + ); + + int (*xPhraseCount)(Fts5Context*); + int (*xPhraseSize)(Fts5Context*, int iPhrase); + + int (*xInstCount)(Fts5Context*, int* pnInst); + int (*xInst)(Fts5Context*, int iIdx, int* piPhrase, int* piCol, int* piOff); + + sqlite3_int64 (*xRowid)(Fts5Context*); + int (*xColumnText)(Fts5Context*, int iCol, const char** pz, int* pn); + int (*xColumnSize)(Fts5Context*, int iCol, int* pnToken); + + int (*xQueryPhrase)( + Fts5Context*, + int iPhrase, + void* pUserData, + int (*)(const Fts5ExtensionApi*, Fts5Context*, void*)); + int (*xSetAuxdata)(Fts5Context*, void* pAux, void (*xDelete)(void*)); + void* (*xGetAuxdata)(Fts5Context*, int bClear); + + int (*xPhraseFirst)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*, int*); + void (*xPhraseNext)(Fts5Context*, Fts5PhraseIter*, int* piCol, int* piOff); + + int (*xPhraseFirstColumn)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*); + void (*xPhraseNextColumn)(Fts5Context*, Fts5PhraseIter*, int* piCol); +}; + +/* +** CUSTOM AUXILIARY FUNCTIONS +*************************************************************************/ + +/************************************************************************* +** CUSTOM TOKENIZERS +** +** Applications may also register custom tokenizer types. A tokenizer +** is registered by providing fts5 with a populated instance of the +** following structure. All structure methods must be defined, setting +** any member of the fts5_tokenizer struct to NULL leads to undefined +** behaviour. The structure methods are expected to function as follows: +** +** xCreate: +** This function is used to allocate and initialize a tokenizer instance. +** A tokenizer instance is required to actually tokenize text. +** +** The first argument passed to this function is a copy of the (void*) +** pointer provided by the application when the fts5_tokenizer object +** was registered with FTS5 (the third argument to xCreateTokenizer()). +** The second and third arguments are an array of nul-terminated strings +** containing the tokenizer arguments, if any, specified following the +** tokenizer name as part of the CREATE VIRTUAL TABLE statement used +** to create the FTS5 table. +** +** The final argument is an output variable. If successful, (*ppOut) +** should be set to point to the new tokenizer handle and SQLITE_OK +** returned. If an error occurs, some value other than SQLITE_OK should +** be returned. In this case, fts5 assumes that the final value of *ppOut +** is undefined. +** +** xDelete: +** This function is invoked to delete a tokenizer handle previously +** allocated using xCreate(). Fts5 guarantees that this function will +** be invoked exactly once for each successful call to xCreate(). +** +** xTokenize: +** This function is expected to tokenize the nText byte string indicated +** by argument pText. pText may or may not be nul-terminated. The first +** argument passed to this function is a pointer to an Fts5Tokenizer object +** returned by an earlier call to xCreate(). +** +** The second argument indicates the reason that FTS5 is requesting +** tokenization of the supplied text. This is always one of the following +** four values: +** +**
  • FTS5_TOKENIZE_DOCUMENT - A document is being inserted into +** or removed from the FTS table. The tokenizer is being invoked to +** determine the set of tokens to add to (or delete from) the +** FTS index. +** +**
  • FTS5_TOKENIZE_QUERY - A MATCH query is being executed +** against the FTS index. The tokenizer is being called to tokenize +** a bareword or quoted string specified as part of the query. +** +**
  • (FTS5_TOKENIZE_QUERY | FTS5_TOKENIZE_PREFIX) - Same as +** FTS5_TOKENIZE_QUERY, except that the bareword or quoted string is +** followed by a "*" character, indicating that the last token +** returned by the tokenizer will be treated as a token prefix. +** +**
  • FTS5_TOKENIZE_AUX - The tokenizer is being invoked to +** satisfy an fts5_api.xTokenize() request made by an auxiliary +** function. Or an fts5_api.xColumnSize() request made by the same +** on a columnsize=0 database. +**
+** +** For each token in the input string, the supplied callback xToken() must +** be invoked. The first argument to it should be a copy of the pointer +** passed as the second argument to xTokenize(). The third and fourth +** arguments are a pointer to a buffer containing the token text, and the +** size of the token in bytes. The 4th and 5th arguments are the byte offsets +** of the first byte of and first byte immediately following the text from +** which the token is derived within the input. +** +** The second argument passed to the xToken() callback ("tflags") should +** normally be set to 0. The exception is if the tokenizer supports +** synonyms. In this case see the discussion below for details. +** +** FTS5 assumes the xToken() callback is invoked for each token in the +** order that they occur within the input text. +** +** If an xToken() callback returns any value other than SQLITE_OK, then +** the tokenization should be abandoned and the xTokenize() method should +** immediately return a copy of the xToken() return value. Or, if the +** input buffer is exhausted, xTokenize() should return SQLITE_OK. Finally, +** if an error occurs with the xTokenize() implementation itself, it +** may abandon the tokenization and return any error code other than +** SQLITE_OK or SQLITE_DONE. +** +** SYNONYM SUPPORT +** +** Custom tokenizers may also support synonyms. Consider a case in which a +** user wishes to query for a phrase such as "first place". Using the +** built-in tokenizers, the FTS5 query 'first + place' will match instances +** of "first place" within the document set, but not alternative forms +** such as "1st place". In some applications, it would be better to match +** all instances of "first place" or "1st place" regardless of which form +** the user specified in the MATCH query text. +** +** There are several ways to approach this in FTS5: +** +**
  1. By mapping all synonyms to a single token. In this case, the +** In the above example, this means that the tokenizer returns the +** same token for inputs "first" and "1st". Say that token is in +** fact "first", so that when the user inserts the document "I won +** 1st place" entries are added to the index for tokens "i", "won", +** "first" and "place". If the user then queries for '1st + place', +** the tokenizer substitutes "first" for "1st" and the query works +** as expected. +** +**
  2. By adding multiple synonyms for a single term to the FTS index. +** In this case, when tokenizing query text, the tokenizer may +** provide multiple synonyms for a single term within the document. +** FTS5 then queries the index for each synonym individually. For +** example, faced with the query: +** +** +** ... MATCH 'first place' +** +** the tokenizer offers both "1st" and "first" as synonyms for the +** first token in the MATCH query and FTS5 effectively runs a query +** similar to: +** +** +** ... MATCH '(first OR 1st) place' +** +** except that, for the purposes of auxiliary functions, the query +** still appears to contain just two phrases - "(first OR 1st)" +** being treated as a single phrase. +** +**
  3. By adding multiple synonyms for a single term to the FTS index. +** Using this method, when tokenizing document text, the tokenizer +** provides multiple synonyms for each token. So that when a +** document such as "I won first place" is tokenized, entries are +** added to the FTS index for "i", "won", "first", "1st" and +** "place". +** +** This way, even if the tokenizer does not provide synonyms +** when tokenizing query text (it should not - to do would be +** inefficient), it doesn't matter if the user queries for +** 'first + place' or '1st + place', as there are entires in the +** FTS index corresponding to both forms of the first token. +**
+** +** Whether it is parsing document or query text, any call to xToken that +** specifies a tflags argument with the FTS5_TOKEN_COLOCATED bit +** is considered to supply a synonym for the previous token. For example, +** when parsing the document "I won first place", a tokenizer that supports +** synonyms would call xToken() 5 times, as follows: +** +** +** xToken(pCtx, 0, "i", 1, 0, 1); +** xToken(pCtx, 0, "won", 3, 2, 5); +** xToken(pCtx, 0, "first", 5, 6, 11); +** xToken(pCtx, FTS5_TOKEN_COLOCATED, "1st", 3, 6, 11); +** xToken(pCtx, 0, "place", 5, 12, 17); +** +** +** It is an error to specify the FTS5_TOKEN_COLOCATED flag the first time +** xToken() is called. Multiple synonyms may be specified for a single token +** by making multiple calls to xToken(FTS5_TOKEN_COLOCATED) in sequence. +** There is no limit to the number of synonyms that may be provided for a +** single token. +** +** In many cases, method (1) above is the best approach. It does not add +** extra data to the FTS index or require FTS5 to query for multiple terms, +** so it is efficient in terms of disk space and query speed. However, it +** does not support prefix queries very well. If, as suggested above, the +** token "first" is subsituted for "1st" by the tokenizer, then the query: +** +** +** ... MATCH '1s*' +** +** will not match documents that contain the token "1st" (as the tokenizer +** will probably not map "1s" to any prefix of "first"). +** +** For full prefix support, method (3) may be preferred. In this case, +** because the index contains entries for both "first" and "1st", prefix +** queries such as 'fi*' or '1s*' will match correctly. However, because +** extra entries are added to the FTS index, this method uses more space +** within the database. +** +** Method (2) offers a midpoint between (1) and (3). Using this method, +** a query such as '1s*' will match documents that contain the literal +** token "1st", but not "first" (assuming the tokenizer is not able to +** provide synonyms for prefixes). However, a non-prefix query like '1st' +** will match against "1st" and "first". This method does not require +** extra disk space, as no extra entries are added to the FTS index. +** On the other hand, it may require more CPU cycles to run MATCH queries, +** as separate queries of the FTS index are required for each synonym. +** +** When using methods (2) or (3), it is important that the tokenizer only +** provide synonyms when tokenizing document text (method (2)) or query +** text (method (3)), not both. Doing so will not cause any errors, but is +** inefficient. +*/ +typedef struct Fts5Tokenizer Fts5Tokenizer; +typedef struct fts5_tokenizer fts5_tokenizer; +struct fts5_tokenizer { + int (*xCreate)(void*, const char** azArg, int nArg, Fts5Tokenizer** ppOut); + void (*xDelete)(Fts5Tokenizer*); + int (*xTokenize)( + Fts5Tokenizer*, + void* pCtx, + int flags, /* Mask of FTS5_TOKENIZE_* flags */ + const char* pText, + int nText, + int (*xToken)( + void* pCtx, /* Copy of 2nd argument to xTokenize() */ + int tflags, /* Mask of FTS5_TOKEN_* flags */ + const char* pToken, /* Pointer to buffer containing token */ + int nToken, /* Size of token in bytes */ + int iStart, /* Byte offset of token within input text */ + int iEnd /* Byte offset of end of token within input text */ + )); +}; + +/* Flags that may be passed as the third argument to xTokenize() */ +#define FTS5_TOKENIZE_QUERY 0x0001 +#define FTS5_TOKENIZE_PREFIX 0x0002 +#define FTS5_TOKENIZE_DOCUMENT 0x0004 +#define FTS5_TOKENIZE_AUX 0x0008 + +/* Flags that may be passed by the tokenizer implementation back to FTS5 +** as the third argument to the supplied xToken callback. */ +#define FTS5_TOKEN_COLOCATED 0x0001 /* Same position as prev. token */ + +/* +** END OF CUSTOM TOKENIZERS +*************************************************************************/ + +/************************************************************************* +** FTS5 EXTENSION REGISTRATION API +*/ +typedef struct fts5_api fts5_api; +struct fts5_api { + int iVersion; /* Currently always set to 2 */ + + /* Create a new tokenizer */ + int (*xCreateTokenizer)( + fts5_api* pApi, + const char* zName, + void* pContext, + fts5_tokenizer* pTokenizer, + void (*xDestroy)(void*)); + + /* Find an existing tokenizer */ + int (*xFindTokenizer)( + fts5_api* pApi, + const char* zName, + void** ppContext, + fts5_tokenizer* pTokenizer); + + /* Create a new auxiliary function */ + int (*xCreateFunction)( + fts5_api* pApi, + const char* zName, + void* pContext, + fts5_extension_function xFunction, + void (*xDestroy)(void*)); +}; + +/* +** END OF REGISTRATION API +*************************************************************************/ + +#ifdef __cplusplus +} /* end of the 'extern "C"' block */ +#endif + +#endif /* _FTS5_H */ + +/******** End of fts5.h *********/ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/sqlite3ext.h b/src_cpp/elfgames/tasks/elf2codingenv/include/sqlite3ext.h new file mode 100644 index 0000000..e4db1e3 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/sqlite3ext.h @@ -0,0 +1,669 @@ +/* +** 2006 June 7 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This header file defines the SQLite interface for use by +** shared libraries that want to be imported as extensions into +** an SQLite instance. Shared libraries that intend to be loaded +** as extensions by SQLite should #include this file instead of +** sqlite3.h. +*/ +#ifndef SQLITE3EXT_H +#define SQLITE3EXT_H +#include "sqlite3.h" + +/* +** The following structure holds pointers to all of the SQLite API +** routines. +** +** WARNING: In order to maintain backwards compatibility, add new +** interfaces to the end of this structure only. If you insert new +** interfaces in the middle of this structure, then older different +** versions of SQLite will not be able to load each other's shared +** libraries! +*/ +struct sqlite3_api_routines { + void* (*aggregate_context)(sqlite3_context*, int nBytes); + int (*aggregate_count)(sqlite3_context*); + int (*bind_blob)(sqlite3_stmt*, int, const void*, int n, void (*)(void*)); + int (*bind_double)(sqlite3_stmt*, int, double); + int (*bind_int)(sqlite3_stmt*, int, int); + int (*bind_int64)(sqlite3_stmt*, int, sqlite_int64); + int (*bind_null)(sqlite3_stmt*, int); + int (*bind_parameter_count)(sqlite3_stmt*); + int (*bind_parameter_index)(sqlite3_stmt*, const char* zName); + const char* (*bind_parameter_name)(sqlite3_stmt*, int); + int (*bind_text)(sqlite3_stmt*, int, const char*, int n, void (*)(void*)); + int (*bind_text16)(sqlite3_stmt*, int, const void*, int, void (*)(void*)); + int (*bind_value)(sqlite3_stmt*, int, const sqlite3_value*); + int (*busy_handler)(sqlite3*, int (*)(void*, int), void*); + int (*busy_timeout)(sqlite3*, int ms); + int (*changes)(sqlite3*); + int (*close)(sqlite3*); + int (*collation_needed)( + sqlite3*, + void*, + void (*)(void*, sqlite3*, int eTextRep, const char*)); + int (*collation_needed16)( + sqlite3*, + void*, + void (*)(void*, sqlite3*, int eTextRep, const void*)); + const void* (*column_blob)(sqlite3_stmt*, int iCol); + int (*column_bytes)(sqlite3_stmt*, int iCol); + int (*column_bytes16)(sqlite3_stmt*, int iCol); + int (*column_count)(sqlite3_stmt* pStmt); + const char* (*column_database_name)(sqlite3_stmt*, int); + const void* (*column_database_name16)(sqlite3_stmt*, int); + const char* (*column_decltype)(sqlite3_stmt*, int i); + const void* (*column_decltype16)(sqlite3_stmt*, int); + double (*column_double)(sqlite3_stmt*, int iCol); + int (*column_int)(sqlite3_stmt*, int iCol); + sqlite_int64 (*column_int64)(sqlite3_stmt*, int iCol); + const char* (*column_name)(sqlite3_stmt*, int); + const void* (*column_name16)(sqlite3_stmt*, int); + const char* (*column_origin_name)(sqlite3_stmt*, int); + const void* (*column_origin_name16)(sqlite3_stmt*, int); + const char* (*column_table_name)(sqlite3_stmt*, int); + const void* (*column_table_name16)(sqlite3_stmt*, int); + const unsigned char* (*column_text)(sqlite3_stmt*, int iCol); + const void* (*column_text16)(sqlite3_stmt*, int iCol); + int (*column_type)(sqlite3_stmt*, int iCol); + sqlite3_value* (*column_value)(sqlite3_stmt*, int iCol); + void* (*commit_hook)(sqlite3*, int (*)(void*), void*); + int (*complete)(const char* sql); + int (*complete16)(const void* sql); + int (*create_collation)( + sqlite3*, + const char*, + int, + void*, + int (*)(void*, int, const void*, int, const void*)); + int (*create_collation16)( + sqlite3*, + const void*, + int, + void*, + int (*)(void*, int, const void*, int, const void*)); + int (*create_function)( + sqlite3*, + const char*, + int, + int, + void*, + void (*xFunc)(sqlite3_context*, int, sqlite3_value**), + void (*xStep)(sqlite3_context*, int, sqlite3_value**), + void (*xFinal)(sqlite3_context*)); + int (*create_function16)( + sqlite3*, + const void*, + int, + int, + void*, + void (*xFunc)(sqlite3_context*, int, sqlite3_value**), + void (*xStep)(sqlite3_context*, int, sqlite3_value**), + void (*xFinal)(sqlite3_context*)); + int (*create_module)(sqlite3*, const char*, const sqlite3_module*, void*); + int (*data_count)(sqlite3_stmt* pStmt); + sqlite3* (*db_handle)(sqlite3_stmt*); + int (*declare_vtab)(sqlite3*, const char*); + int (*enable_shared_cache)(int); + int (*errcode)(sqlite3* db); + const char* (*errmsg)(sqlite3*); + const void* (*errmsg16)(sqlite3*); + int (*exec)(sqlite3*, const char*, sqlite3_callback, void*, char**); + int (*expired)(sqlite3_stmt*); + int (*finalize)(sqlite3_stmt* pStmt); + void (*free)(void*); + void (*free_table)(char** result); + int (*get_autocommit)(sqlite3*); + void* (*get_auxdata)(sqlite3_context*, int); + int (*get_table)(sqlite3*, const char*, char***, int*, int*, char**); + int (*global_recover)(void); + void (*interruptx)(sqlite3*); + sqlite_int64 (*last_insert_rowid)(sqlite3*); + const char* (*libversion)(void); + int (*libversion_number)(void); + void* (*malloc)(int); + char* (*mprintf)(const char*, ...); + int (*open)(const char*, sqlite3**); + int (*open16)(const void*, sqlite3**); + int (*prepare)(sqlite3*, const char*, int, sqlite3_stmt**, const char**); + int (*prepare16)(sqlite3*, const void*, int, sqlite3_stmt**, const void**); + void* ( + *profile)(sqlite3*, void (*)(void*, const char*, sqlite_uint64), void*); + void (*progress_handler)(sqlite3*, int, int (*)(void*), void*); + void* (*realloc)(void*, int); + int (*reset)(sqlite3_stmt* pStmt); + void (*result_blob)(sqlite3_context*, const void*, int, void (*)(void*)); + void (*result_double)(sqlite3_context*, double); + void (*result_error)(sqlite3_context*, const char*, int); + void (*result_error16)(sqlite3_context*, const void*, int); + void (*result_int)(sqlite3_context*, int); + void (*result_int64)(sqlite3_context*, sqlite_int64); + void (*result_null)(sqlite3_context*); + void (*result_text)(sqlite3_context*, const char*, int, void (*)(void*)); + void (*result_text16)(sqlite3_context*, const void*, int, void (*)(void*)); + void (*result_text16be)(sqlite3_context*, const void*, int, void (*)(void*)); + void (*result_text16le)(sqlite3_context*, const void*, int, void (*)(void*)); + void (*result_value)(sqlite3_context*, sqlite3_value*); + void* (*rollback_hook)(sqlite3*, void (*)(void*), void*); + int (*set_authorizer)( + sqlite3*, + int (*)(void*, int, const char*, const char*, const char*, const char*), + void*); + void (*set_auxdata)(sqlite3_context*, int, void*, void (*)(void*)); + char* (*xsnprintf)(int, char*, const char*, ...); + int (*step)(sqlite3_stmt*); + int (*table_column_metadata)( + sqlite3*, + const char*, + const char*, + const char*, + char const**, + char const**, + int*, + int*, + int*); + void (*thread_cleanup)(void); + int (*total_changes)(sqlite3*); + void* (*trace)(sqlite3*, void (*xTrace)(void*, const char*), void*); + int (*transfer_bindings)(sqlite3_stmt*, sqlite3_stmt*); + void* (*update_hook)( + sqlite3*, + void (*)(void*, int, char const*, char const*, sqlite_int64), + void*); + void* (*user_data)(sqlite3_context*); + const void* (*value_blob)(sqlite3_value*); + int (*value_bytes)(sqlite3_value*); + int (*value_bytes16)(sqlite3_value*); + double (*value_double)(sqlite3_value*); + int (*value_int)(sqlite3_value*); + sqlite_int64 (*value_int64)(sqlite3_value*); + int (*value_numeric_type)(sqlite3_value*); + const unsigned char* (*value_text)(sqlite3_value*); + const void* (*value_text16)(sqlite3_value*); + const void* (*value_text16be)(sqlite3_value*); + const void* (*value_text16le)(sqlite3_value*); + int (*value_type)(sqlite3_value*); + char* (*vmprintf)(const char*, va_list); + /* Added ??? */ + int (*overload_function)(sqlite3*, const char* zFuncName, int nArg); + /* Added by 3.3.13 */ + int (*prepare_v2)(sqlite3*, const char*, int, sqlite3_stmt**, const char**); + int (*prepare16_v2)(sqlite3*, const void*, int, sqlite3_stmt**, const void**); + int (*clear_bindings)(sqlite3_stmt*); + /* Added by 3.4.1 */ + int (*create_module_v2)( + sqlite3*, + const char*, + const sqlite3_module*, + void*, + void (*xDestroy)(void*)); + /* Added by 3.5.0 */ + int (*bind_zeroblob)(sqlite3_stmt*, int, int); + int (*blob_bytes)(sqlite3_blob*); + int (*blob_close)(sqlite3_blob*); + int (*blob_open)( + sqlite3*, + const char*, + const char*, + const char*, + sqlite3_int64, + int, + sqlite3_blob**); + int (*blob_read)(sqlite3_blob*, void*, int, int); + int (*blob_write)(sqlite3_blob*, const void*, int, int); + int (*create_collation_v2)( + sqlite3*, + const char*, + int, + void*, + int (*)(void*, int, const void*, int, const void*), + void (*)(void*)); + int (*file_control)(sqlite3*, const char*, int, void*); + sqlite3_int64 (*memory_highwater)(int); + sqlite3_int64 (*memory_used)(void); + sqlite3_mutex* (*mutex_alloc)(int); + void (*mutex_enter)(sqlite3_mutex*); + void (*mutex_free)(sqlite3_mutex*); + void (*mutex_leave)(sqlite3_mutex*); + int (*mutex_try)(sqlite3_mutex*); + int (*open_v2)(const char*, sqlite3**, int, const char*); + int (*release_memory)(int); + void (*result_error_nomem)(sqlite3_context*); + void (*result_error_toobig)(sqlite3_context*); + int (*sleep)(int); + void (*soft_heap_limit)(int); + sqlite3_vfs* (*vfs_find)(const char*); + int (*vfs_register)(sqlite3_vfs*, int); + int (*vfs_unregister)(sqlite3_vfs*); + int (*xthreadsafe)(void); + void (*result_zeroblob)(sqlite3_context*, int); + void (*result_error_code)(sqlite3_context*, int); + int (*test_control)(int, ...); + void (*randomness)(int, void*); + sqlite3* (*context_db_handle)(sqlite3_context*); + int (*extended_result_codes)(sqlite3*, int); + int (*limit)(sqlite3*, int, int); + sqlite3_stmt* (*next_stmt)(sqlite3*, sqlite3_stmt*); + const char* (*sql)(sqlite3_stmt*); + int (*status)(int, int*, int*, int); + int (*backup_finish)(sqlite3_backup*); + sqlite3_backup* (*backup_init)(sqlite3*, const char*, sqlite3*, const char*); + int (*backup_pagecount)(sqlite3_backup*); + int (*backup_remaining)(sqlite3_backup*); + int (*backup_step)(sqlite3_backup*, int); + const char* (*compileoption_get)(int); + int (*compileoption_used)(const char*); + int (*create_function_v2)( + sqlite3*, + const char*, + int, + int, + void*, + void (*xFunc)(sqlite3_context*, int, sqlite3_value**), + void (*xStep)(sqlite3_context*, int, sqlite3_value**), + void (*xFinal)(sqlite3_context*), + void (*xDestroy)(void*)); + int (*db_config)(sqlite3*, int, ...); + sqlite3_mutex* (*db_mutex)(sqlite3*); + int (*db_status)(sqlite3*, int, int*, int*, int); + int (*extended_errcode)(sqlite3*); + void (*log)(int, const char*, ...); + sqlite3_int64 (*soft_heap_limit64)(sqlite3_int64); + const char* (*sourceid)(void); + int (*stmt_status)(sqlite3_stmt*, int, int); + int (*strnicmp)(const char*, const char*, int); + int (*unlock_notify)(sqlite3*, void (*)(void**, int), void*); + int (*wal_autocheckpoint)(sqlite3*, int); + int (*wal_checkpoint)(sqlite3*, const char*); + void* ( + *wal_hook)(sqlite3*, int (*)(void*, sqlite3*, const char*, int), void*); + int (*blob_reopen)(sqlite3_blob*, sqlite3_int64); + int (*vtab_config)(sqlite3*, int op, ...); + int (*vtab_on_conflict)(sqlite3*); + /* Version 3.7.16 and later */ + int (*close_v2)(sqlite3*); + const char* (*db_filename)(sqlite3*, const char*); + int (*db_readonly)(sqlite3*, const char*); + int (*db_release_memory)(sqlite3*); + const char* (*errstr)(int); + int (*stmt_busy)(sqlite3_stmt*); + int (*stmt_readonly)(sqlite3_stmt*); + int (*stricmp)(const char*, const char*); + int (*uri_boolean)(const char*, const char*, int); + sqlite3_int64 (*uri_int64)(const char*, const char*, sqlite3_int64); + const char* (*uri_parameter)(const char*, const char*); + char* (*xvsnprintf)(int, char*, const char*, va_list); + int (*wal_checkpoint_v2)(sqlite3*, const char*, int, int*, int*); + /* Version 3.8.7 and later */ + int (*auto_extension)(void (*)(void)); + int (*bind_blob64)( + sqlite3_stmt*, + int, + const void*, + sqlite3_uint64, + void (*)(void*)); + int (*bind_text64)( + sqlite3_stmt*, + int, + const char*, + sqlite3_uint64, + void (*)(void*), + unsigned char); + int (*cancel_auto_extension)(void (*)(void)); + int (*load_extension)(sqlite3*, const char*, const char*, char**); + void* (*malloc64)(sqlite3_uint64); + sqlite3_uint64 (*msize)(void*); + void* (*realloc64)(void*, sqlite3_uint64); + void (*reset_auto_extension)(void); + void (*result_blob64)( + sqlite3_context*, + const void*, + sqlite3_uint64, + void (*)(void*)); + void (*result_text64)( + sqlite3_context*, + const char*, + sqlite3_uint64, + void (*)(void*), + unsigned char); + int (*strglob)(const char*, const char*); + /* Version 3.8.11 and later */ + sqlite3_value* (*value_dup)(const sqlite3_value*); + void (*value_free)(sqlite3_value*); + int (*result_zeroblob64)(sqlite3_context*, sqlite3_uint64); + int (*bind_zeroblob64)(sqlite3_stmt*, int, sqlite3_uint64); + /* Version 3.9.0 and later */ + unsigned int (*value_subtype)(sqlite3_value*); + void (*result_subtype)(sqlite3_context*, unsigned int); + /* Version 3.10.0 and later */ + int (*status64)(int, sqlite3_int64*, sqlite3_int64*, int); + int (*strlike)(const char*, const char*, unsigned int); + int (*db_cacheflush)(sqlite3*); + /* Version 3.12.0 and later */ + int (*system_errno)(sqlite3*); + /* Version 3.14.0 and later */ + int (*trace_v2)( + sqlite3*, + unsigned, + int (*)(unsigned, void*, void*, void*), + void*); + char* (*expanded_sql)(sqlite3_stmt*); + /* Version 3.18.0 and later */ + void (*set_last_insert_rowid)(sqlite3*, sqlite3_int64); + /* Version 3.20.0 and later */ + int (*prepare_v3)( + sqlite3*, + const char*, + int, + unsigned int, + sqlite3_stmt**, + const char**); + int (*prepare16_v3)( + sqlite3*, + const void*, + int, + unsigned int, + sqlite3_stmt**, + const void**); + int (*bind_pointer)(sqlite3_stmt*, int, void*, const char*, void (*)(void*)); + void (*result_pointer)(sqlite3_context*, void*, const char*, void (*)(void*)); + void* (*value_pointer)(sqlite3_value*, const char*); + int (*vtab_nochange)(sqlite3_context*); + int (*value_nochange)(sqlite3_value*); + const char* (*vtab_collation)(sqlite3_index_info*, int); +}; + +/* +** This is the function signature used for all extension entry points. It +** is also defined in the file "loadext.c". +*/ +typedef int (*sqlite3_loadext_entry)( + sqlite3* db, /* Handle to the database. */ + char** pzErrMsg, /* Used to set error string on failure. */ + const sqlite3_api_routines* pThunk /* Extension API function pointers. */ + ); + +/* +** The following macros redefine the API routines so that they are +** redirected through the global sqlite3_api structure. +** +** This header file is also used by the loadext.c source file +** (part of the main SQLite library - not an extension) so that +** it can get access to the sqlite3_api_routines structure +** definition. But the main library does not want to redefine +** the API. So the redefinition macros are only valid if the +** SQLITE_CORE macros is undefined. +*/ +#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) +#define sqlite3_aggregate_context sqlite3_api->aggregate_context +#ifndef SQLITE_OMIT_DEPRECATED +#define sqlite3_aggregate_count sqlite3_api->aggregate_count +#endif +#define sqlite3_bind_blob sqlite3_api->bind_blob +#define sqlite3_bind_double sqlite3_api->bind_double +#define sqlite3_bind_int sqlite3_api->bind_int +#define sqlite3_bind_int64 sqlite3_api->bind_int64 +#define sqlite3_bind_null sqlite3_api->bind_null +#define sqlite3_bind_parameter_count sqlite3_api->bind_parameter_count +#define sqlite3_bind_parameter_index sqlite3_api->bind_parameter_index +#define sqlite3_bind_parameter_name sqlite3_api->bind_parameter_name +#define sqlite3_bind_text sqlite3_api->bind_text +#define sqlite3_bind_text16 sqlite3_api->bind_text16 +#define sqlite3_bind_value sqlite3_api->bind_value +#define sqlite3_busy_handler sqlite3_api->busy_handler +#define sqlite3_busy_timeout sqlite3_api->busy_timeout +#define sqlite3_changes sqlite3_api->changes +#define sqlite3_close sqlite3_api->close +#define sqlite3_collation_needed sqlite3_api->collation_needed +#define sqlite3_collation_needed16 sqlite3_api->collation_needed16 +#define sqlite3_column_blob sqlite3_api->column_blob +#define sqlite3_column_bytes sqlite3_api->column_bytes +#define sqlite3_column_bytes16 sqlite3_api->column_bytes16 +#define sqlite3_column_count sqlite3_api->column_count +#define sqlite3_column_database_name sqlite3_api->column_database_name +#define sqlite3_column_database_name16 sqlite3_api->column_database_name16 +#define sqlite3_column_decltype sqlite3_api->column_decltype +#define sqlite3_column_decltype16 sqlite3_api->column_decltype16 +#define sqlite3_column_double sqlite3_api->column_double +#define sqlite3_column_int sqlite3_api->column_int +#define sqlite3_column_int64 sqlite3_api->column_int64 +#define sqlite3_column_name sqlite3_api->column_name +#define sqlite3_column_name16 sqlite3_api->column_name16 +#define sqlite3_column_origin_name sqlite3_api->column_origin_name +#define sqlite3_column_origin_name16 sqlite3_api->column_origin_name16 +#define sqlite3_column_table_name sqlite3_api->column_table_name +#define sqlite3_column_table_name16 sqlite3_api->column_table_name16 +#define sqlite3_column_text sqlite3_api->column_text +#define sqlite3_column_text16 sqlite3_api->column_text16 +#define sqlite3_column_type sqlite3_api->column_type +#define sqlite3_column_value sqlite3_api->column_value +#define sqlite3_commit_hook sqlite3_api->commit_hook +#define sqlite3_complete sqlite3_api->complete +#define sqlite3_complete16 sqlite3_api->complete16 +#define sqlite3_create_collation sqlite3_api->create_collation +#define sqlite3_create_collation16 sqlite3_api->create_collation16 +#define sqlite3_create_function sqlite3_api->create_function +#define sqlite3_create_function16 sqlite3_api->create_function16 +#define sqlite3_create_module sqlite3_api->create_module +#define sqlite3_create_module_v2 sqlite3_api->create_module_v2 +#define sqlite3_data_count sqlite3_api->data_count +#define sqlite3_db_handle sqlite3_api->db_handle +#define sqlite3_declare_vtab sqlite3_api->declare_vtab +#define sqlite3_enable_shared_cache sqlite3_api->enable_shared_cache +#define sqlite3_errcode sqlite3_api->errcode +#define sqlite3_errmsg sqlite3_api->errmsg +#define sqlite3_errmsg16 sqlite3_api->errmsg16 +#define sqlite3_exec sqlite3_api->exec +#ifndef SQLITE_OMIT_DEPRECATED +#define sqlite3_expired sqlite3_api->expired +#endif +#define sqlite3_finalize sqlite3_api->finalize +#define sqlite3_free sqlite3_api->free +#define sqlite3_free_table sqlite3_api->free_table +#define sqlite3_get_autocommit sqlite3_api->get_autocommit +#define sqlite3_get_auxdata sqlite3_api->get_auxdata +#define sqlite3_get_table sqlite3_api->get_table +#ifndef SQLITE_OMIT_DEPRECATED +#define sqlite3_global_recover sqlite3_api->global_recover +#endif +#define sqlite3_interrupt sqlite3_api->interruptx +#define sqlite3_last_insert_rowid sqlite3_api->last_insert_rowid +#define sqlite3_libversion sqlite3_api->libversion +#define sqlite3_libversion_number sqlite3_api->libversion_number +#define sqlite3_malloc sqlite3_api->malloc +#define sqlite3_mprintf sqlite3_api->mprintf +#define sqlite3_open sqlite3_api->open +#define sqlite3_open16 sqlite3_api->open16 +#define sqlite3_prepare sqlite3_api->prepare +#define sqlite3_prepare16 sqlite3_api->prepare16 +#define sqlite3_prepare_v2 sqlite3_api->prepare_v2 +#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2 +#define sqlite3_profile sqlite3_api->profile +#define sqlite3_progress_handler sqlite3_api->progress_handler +#define sqlite3_realloc sqlite3_api->realloc +#define sqlite3_reset sqlite3_api->reset +#define sqlite3_result_blob sqlite3_api->result_blob +#define sqlite3_result_double sqlite3_api->result_double +#define sqlite3_result_error sqlite3_api->result_error +#define sqlite3_result_error16 sqlite3_api->result_error16 +#define sqlite3_result_int sqlite3_api->result_int +#define sqlite3_result_int64 sqlite3_api->result_int64 +#define sqlite3_result_null sqlite3_api->result_null +#define sqlite3_result_text sqlite3_api->result_text +#define sqlite3_result_text16 sqlite3_api->result_text16 +#define sqlite3_result_text16be sqlite3_api->result_text16be +#define sqlite3_result_text16le sqlite3_api->result_text16le +#define sqlite3_result_value sqlite3_api->result_value +#define sqlite3_rollback_hook sqlite3_api->rollback_hook +#define sqlite3_set_authorizer sqlite3_api->set_authorizer +#define sqlite3_set_auxdata sqlite3_api->set_auxdata +#define sqlite3_snprintf sqlite3_api->xsnprintf +#define sqlite3_step sqlite3_api->step +#define sqlite3_table_column_metadata sqlite3_api->table_column_metadata +#define sqlite3_thread_cleanup sqlite3_api->thread_cleanup +#define sqlite3_total_changes sqlite3_api->total_changes +#define sqlite3_trace sqlite3_api->trace +#ifndef SQLITE_OMIT_DEPRECATED +#define sqlite3_transfer_bindings sqlite3_api->transfer_bindings +#endif +#define sqlite3_update_hook sqlite3_api->update_hook +#define sqlite3_user_data sqlite3_api->user_data +#define sqlite3_value_blob sqlite3_api->value_blob +#define sqlite3_value_bytes sqlite3_api->value_bytes +#define sqlite3_value_bytes16 sqlite3_api->value_bytes16 +#define sqlite3_value_double sqlite3_api->value_double +#define sqlite3_value_int sqlite3_api->value_int +#define sqlite3_value_int64 sqlite3_api->value_int64 +#define sqlite3_value_numeric_type sqlite3_api->value_numeric_type +#define sqlite3_value_text sqlite3_api->value_text +#define sqlite3_value_text16 sqlite3_api->value_text16 +#define sqlite3_value_text16be sqlite3_api->value_text16be +#define sqlite3_value_text16le sqlite3_api->value_text16le +#define sqlite3_value_type sqlite3_api->value_type +#define sqlite3_vmprintf sqlite3_api->vmprintf +#define sqlite3_vsnprintf sqlite3_api->xvsnprintf +#define sqlite3_overload_function sqlite3_api->overload_function +#define sqlite3_prepare_v2 sqlite3_api->prepare_v2 +#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2 +#define sqlite3_clear_bindings sqlite3_api->clear_bindings +#define sqlite3_bind_zeroblob sqlite3_api->bind_zeroblob +#define sqlite3_blob_bytes sqlite3_api->blob_bytes +#define sqlite3_blob_close sqlite3_api->blob_close +#define sqlite3_blob_open sqlite3_api->blob_open +#define sqlite3_blob_read sqlite3_api->blob_read +#define sqlite3_blob_write sqlite3_api->blob_write +#define sqlite3_create_collation_v2 sqlite3_api->create_collation_v2 +#define sqlite3_file_control sqlite3_api->file_control +#define sqlite3_memory_highwater sqlite3_api->memory_highwater +#define sqlite3_memory_used sqlite3_api->memory_used +#define sqlite3_mutex_alloc sqlite3_api->mutex_alloc +#define sqlite3_mutex_enter sqlite3_api->mutex_enter +#define sqlite3_mutex_free sqlite3_api->mutex_free +#define sqlite3_mutex_leave sqlite3_api->mutex_leave +#define sqlite3_mutex_try sqlite3_api->mutex_try +#define sqlite3_open_v2 sqlite3_api->open_v2 +#define sqlite3_release_memory sqlite3_api->release_memory +#define sqlite3_result_error_nomem sqlite3_api->result_error_nomem +#define sqlite3_result_error_toobig sqlite3_api->result_error_toobig +#define sqlite3_sleep sqlite3_api->sleep +#define sqlite3_soft_heap_limit sqlite3_api->soft_heap_limit +#define sqlite3_vfs_find sqlite3_api->vfs_find +#define sqlite3_vfs_register sqlite3_api->vfs_register +#define sqlite3_vfs_unregister sqlite3_api->vfs_unregister +#define sqlite3_threadsafe sqlite3_api->xthreadsafe +#define sqlite3_result_zeroblob sqlite3_api->result_zeroblob +#define sqlite3_result_error_code sqlite3_api->result_error_code +#define sqlite3_test_control sqlite3_api->test_control +#define sqlite3_randomness sqlite3_api->randomness +#define sqlite3_context_db_handle sqlite3_api->context_db_handle +#define sqlite3_extended_result_codes sqlite3_api->extended_result_codes +#define sqlite3_limit sqlite3_api->limit +#define sqlite3_next_stmt sqlite3_api->next_stmt +#define sqlite3_sql sqlite3_api->sql +#define sqlite3_status sqlite3_api->status +#define sqlite3_backup_finish sqlite3_api->backup_finish +#define sqlite3_backup_init sqlite3_api->backup_init +#define sqlite3_backup_pagecount sqlite3_api->backup_pagecount +#define sqlite3_backup_remaining sqlite3_api->backup_remaining +#define sqlite3_backup_step sqlite3_api->backup_step +#define sqlite3_compileoption_get sqlite3_api->compileoption_get +#define sqlite3_compileoption_used sqlite3_api->compileoption_used +#define sqlite3_create_function_v2 sqlite3_api->create_function_v2 +#define sqlite3_db_config sqlite3_api->db_config +#define sqlite3_db_mutex sqlite3_api->db_mutex +#define sqlite3_db_status sqlite3_api->db_status +#define sqlite3_extended_errcode sqlite3_api->extended_errcode +#define sqlite3_log sqlite3_api->log +#define sqlite3_soft_heap_limit64 sqlite3_api->soft_heap_limit64 +#define sqlite3_sourceid sqlite3_api->sourceid +#define sqlite3_stmt_status sqlite3_api->stmt_status +#define sqlite3_strnicmp sqlite3_api->strnicmp +#define sqlite3_unlock_notify sqlite3_api->unlock_notify +#define sqlite3_wal_autocheckpoint sqlite3_api->wal_autocheckpoint +#define sqlite3_wal_checkpoint sqlite3_api->wal_checkpoint +#define sqlite3_wal_hook sqlite3_api->wal_hook +#define sqlite3_blob_reopen sqlite3_api->blob_reopen +#define sqlite3_vtab_config sqlite3_api->vtab_config +#define sqlite3_vtab_on_conflict sqlite3_api->vtab_on_conflict +/* Version 3.7.16 and later */ +#define sqlite3_close_v2 sqlite3_api->close_v2 +#define sqlite3_db_filename sqlite3_api->db_filename +#define sqlite3_db_readonly sqlite3_api->db_readonly +#define sqlite3_db_release_memory sqlite3_api->db_release_memory +#define sqlite3_errstr sqlite3_api->errstr +#define sqlite3_stmt_busy sqlite3_api->stmt_busy +#define sqlite3_stmt_readonly sqlite3_api->stmt_readonly +#define sqlite3_stricmp sqlite3_api->stricmp +#define sqlite3_uri_boolean sqlite3_api->uri_boolean +#define sqlite3_uri_int64 sqlite3_api->uri_int64 +#define sqlite3_uri_parameter sqlite3_api->uri_parameter +#define sqlite3_uri_vsnprintf sqlite3_api->xvsnprintf +#define sqlite3_wal_checkpoint_v2 sqlite3_api->wal_checkpoint_v2 +/* Version 3.8.7 and later */ +#define sqlite3_auto_extension sqlite3_api->auto_extension +#define sqlite3_bind_blob64 sqlite3_api->bind_blob64 +#define sqlite3_bind_text64 sqlite3_api->bind_text64 +#define sqlite3_cancel_auto_extension sqlite3_api->cancel_auto_extension +#define sqlite3_load_extension sqlite3_api->load_extension +#define sqlite3_malloc64 sqlite3_api->malloc64 +#define sqlite3_msize sqlite3_api->msize +#define sqlite3_realloc64 sqlite3_api->realloc64 +#define sqlite3_reset_auto_extension sqlite3_api->reset_auto_extension +#define sqlite3_result_blob64 sqlite3_api->result_blob64 +#define sqlite3_result_text64 sqlite3_api->result_text64 +#define sqlite3_strglob sqlite3_api->strglob +/* Version 3.8.11 and later */ +#define sqlite3_value_dup sqlite3_api->value_dup +#define sqlite3_value_free sqlite3_api->value_free +#define sqlite3_result_zeroblob64 sqlite3_api->result_zeroblob64 +#define sqlite3_bind_zeroblob64 sqlite3_api->bind_zeroblob64 +/* Version 3.9.0 and later */ +#define sqlite3_value_subtype sqlite3_api->value_subtype +#define sqlite3_result_subtype sqlite3_api->result_subtype +/* Version 3.10.0 and later */ +#define sqlite3_status64 sqlite3_api->status64 +#define sqlite3_strlike sqlite3_api->strlike +#define sqlite3_db_cacheflush sqlite3_api->db_cacheflush +/* Version 3.12.0 and later */ +#define sqlite3_system_errno sqlite3_api->system_errno +/* Version 3.14.0 and later */ +#define sqlite3_trace_v2 sqlite3_api->trace_v2 +#define sqlite3_expanded_sql sqlite3_api->expanded_sql +/* Version 3.18.0 and later */ +#define sqlite3_set_last_insert_rowid sqlite3_api->set_last_insert_rowid +/* Version 3.20.0 and later */ +#define sqlite3_prepare_v3 sqlite3_api->prepare_v3 +#define sqlite3_prepare16_v3 sqlite3_api->prepare16_v3 +#define sqlite3_bind_pointer sqlite3_api->bind_pointer +#define sqlite3_result_pointer sqlite3_api->result_pointer +#define sqlite3_value_pointer sqlite3_api->value_pointer +/* Version 3.22.0 and later */ +#define sqlite3_vtab_nochange sqlite3_api->vtab_nochange +#define sqlite3_value_nochange sqlite3_api->value_nochange +#define sqlite3_vtab_collation sqlite3_api->vtab_collation +#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */ + +#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) +/* This case when the file really is being compiled as a loadable +** extension */ +#define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines* sqlite3_api = 0; +#define SQLITE_EXTENSION_INIT2(v) sqlite3_api = v; +#define SQLITE_EXTENSION_INIT3 extern const sqlite3_api_routines* sqlite3_api; +#else +/* This case when the file is being statically linked into the +** application */ +#define SQLITE_EXTENSION_INIT1 /*no-op*/ +#define SQLITE_EXTENSION_INIT2(v) (void)v; /* unused parameter */ +#define SQLITE_EXTENSION_INIT3 /*no-op*/ +#endif + +#endif /* SQLITE3EXT_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tcl.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tcl.h new file mode 100644 index 0000000..8144ef1 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tcl.h @@ -0,0 +1,2752 @@ +/* + * tcl.h -- + * + * This header file describes the externally-visible facilities of the + * Tcl interpreter. + * + * Copyright (c) 1987-1994 The Regents of the University of California. + * Copyright (c) 1993-1996 Lucent Technologies. + * Copyright (c) 1994-1998 Sun Microsystems, Inc. + * Copyright (c) 1998-2000 by Scriptics Corporation. + * Copyright (c) 2002 by Kevin B. Kenny. All rights reserved. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TCL +#define _TCL + +/* + * For C++ compilers, use extern "C" + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The following defines are used to indicate the various release levels. + */ + +#define TCL_ALPHA_RELEASE 0 +#define TCL_BETA_RELEASE 1 +#define TCL_FINAL_RELEASE 2 + +/* + * When version numbers change here, must also go into the following files and + * update the version numbers: + * + * library/init.tcl (1 LOC patch) + * unix/configure.in (2 LOC Major, 2 LOC minor, 1 LOC patch) + * win/configure.in (as above) + * win/tcl.m4 (not patchlevel) + * README (sections 0 and 2, with and without separator) + * macosx/Tcl.pbproj/project.pbxproj (not patchlevel) 1 LOC + * macosx/Tcl.pbproj/default.pbxuser (not patchlevel) 1 LOC + * macosx/Tcl.xcode/project.pbxproj (not patchlevel) 2 LOC + * macosx/Tcl.xcode/default.pbxuser (not patchlevel) 1 LOC + * macosx/Tcl-Common.xcconfig (not patchlevel) 1 LOC + * win/README (not patchlevel) (sections 0 and 2) + * unix/tcl.spec (1 LOC patch) + * tools/tcl.hpj.in (not patchlevel, for windows installer) + */ + +#define TCL_MAJOR_VERSION 8 +#define TCL_MINOR_VERSION 6 +#define TCL_RELEASE_LEVEL TCL_FINAL_RELEASE +#define TCL_RELEASE_SERIAL 7 + +#define TCL_VERSION "8.6" +#define TCL_PATCH_LEVEL "8.6.7" + +/* + *---------------------------------------------------------------------------- + * The following definitions set up the proper options for Windows compilers. + * We use this method because there is no autoconf equivalent. + */ + +#ifdef _WIN32 +#ifndef __WIN32__ +#define __WIN32__ +#endif +#ifndef WIN32 +#define WIN32 +#endif +#endif + +/* + * Utility macros: STRINGIFY takes an argument and wraps it in "" (double + * quotation marks), JOIN joins two arguments. + */ + +#ifndef STRINGIFY +#define STRINGIFY(x) STRINGIFY1(x) +#define STRINGIFY1(x) #x +#endif +#ifndef JOIN +#define JOIN(a, b) JOIN1(a, b) +#define JOIN1(a, b) a##b +#endif + +/* + * A special definition used to allow this header file to be included from + * windows resource files so that they can obtain version information. + * RC_INVOKED is defined by default by the windows RC tool. + * + * Resource compilers don't like all the C stuff, like typedefs and function + * declarations, that occur below, so block them out. + */ + +#ifndef RC_INVOKED + +/* + * Special macro to define mutexes, that doesn't do anything if we are not + * using threads. + */ + +#ifdef TCL_THREADS +#define TCL_DECLARE_MUTEX(name) static Tcl_Mutex name; +#else +#define TCL_DECLARE_MUTEX(name) +#endif + +/* + * Tcl's public routine Tcl_FSSeek() uses the values SEEK_SET, SEEK_CUR, and + * SEEK_END, all #define'd by stdio.h . + * + * Also, many extensions need stdio.h, and they've grown accustomed to tcl.h + * providing it for them rather than #include-ing it themselves as they + * should, so also for their sake, we keep the #include to be consistent with + * prior Tcl releases. + */ + +#include + +/* + *---------------------------------------------------------------------------- + * Support for functions with a variable number of arguments. + * + * The following TCL_VARARGS* macros are to support old extensions + * written for older versions of Tcl where the macros permitted + * support for the varargs.h system as well as stdarg.h . + * + * New code should just directly be written to use stdarg.h conventions. + */ + +#include +#ifndef TCL_NO_DEPRECATED +#define TCL_VARARGS(type, name) (type name, ...) +#define TCL_VARARGS_DEF(type, name) (type name, ...) +#define TCL_VARARGS_START(type, name, list) (va_start(list, name), name) +#endif +#if defined(__GNUC__) && (__GNUC__ > 2) +#define TCL_FORMAT_PRINTF(a, b) __attribute__((__format__(__printf__, a, b))) +#define TCL_NORETURN __attribute__((noreturn)) +#if defined(BUILD_tcl) || defined(BUILD_tk) +#define TCL_NORETURN1 __attribute__((noreturn)) +#else +#define TCL_NORETURN1 /* nothing */ +#endif +#else +#define TCL_FORMAT_PRINTF(a, b) +#if defined(_MSC_VER) && (_MSC_VER >= 1310) +#define TCL_NORETURN _declspec(noreturn) +#else +#define TCL_NORETURN /* nothing */ +#endif +#define TCL_NORETURN1 /* nothing */ +#endif + +/* + * Allow a part of Tcl's API to be explicitly marked as deprecated. + * + * Used to make TIP 330/336 generate moans even if people use the + * compatibility macros. Change your code, guys! We won't support you forever. + */ + +#if defined(__GNUC__) && \ + ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) +#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) +#define TCL_DEPRECATED_API(msg) __attribute__((__deprecated__(msg))) +#else +#define TCL_DEPRECATED_API(msg) __attribute__((__deprecated__)) +#endif +#else +#define TCL_DEPRECATED_API(msg) /* nothing portable */ +#endif + +/* + *---------------------------------------------------------------------------- + * Macros used to declare a function to be exported by a DLL. Used by Windows, + * maps to no-op declarations on non-Windows systems. The default build on + * windows is for a DLL, which causes the DLLIMPORT and DLLEXPORT macros to be + * nonempty. To build a static library, the macro STATIC_BUILD should be + * defined. + * + * Note: when building static but linking dynamically to MSVCRT we must still + * correctly decorate the C library imported function. Use CRTIMPORT + * for this purpose. _DLL is defined by the compiler when linking to + * MSVCRT. + */ + +#if ( \ + defined(_WIN32) && (defined(_MSC_VER) || \ + (defined(__BORLANDC__) && (__BORLANDC__ >= 0x0550)) || \ + defined(__LCC__) || defined(__WATCOMC__) || \ + (defined(__GNUC__) && defined(__declspec)))) +#define HAVE_DECLSPEC 1 +#ifdef STATIC_BUILD +#define DLLIMPORT +#define DLLEXPORT +#ifdef _DLL +#define CRTIMPORT __declspec(dllimport) +#else +#define CRTIMPORT +#endif +#else +#define DLLIMPORT __declspec(dllimport) +#define DLLEXPORT __declspec(dllexport) +#define CRTIMPORT __declspec(dllimport) +#endif +#else +#define DLLIMPORT +#if defined(__GNUC__) && __GNUC__ > 3 +#define DLLEXPORT __attribute__((visibility("default"))) +#else +#define DLLEXPORT +#endif +#define CRTIMPORT +#endif + +/* + * These macros are used to control whether functions are being declared for + * import or export. If a function is being declared while it is being built + * to be included in a shared library, then it should have the DLLEXPORT + * storage class. If is being declared for use by a module that is going to + * link against the shared library, then it should have the DLLIMPORT storage + * class. If the symbol is beind declared for a static build or for use from a + * stub library, then the storage class should be empty. + * + * The convention is that a macro called BUILD_xxxx, where xxxx is the name of + * a library we are building, is set on the compile line for sources that are + * to be placed in the library. When this macro is set, the storage class will + * be set to DLLEXPORT. At the end of the header file, the storage class will + * be reset to DLLIMPORT. + */ + +#undef TCL_STORAGE_CLASS +#ifdef BUILD_tcl +#define TCL_STORAGE_CLASS DLLEXPORT +#else +#ifdef USE_TCL_STUBS +#define TCL_STORAGE_CLASS +#else +#define TCL_STORAGE_CLASS DLLIMPORT +#endif +#endif + +/* + * The following _ANSI_ARGS_ macro is to support old extensions + * written for older versions of Tcl where it permitted support + * for compilers written in the pre-prototype era of C. + * + * New code should use prototypes. + */ + +#ifndef TCL_NO_DEPRECATED +#undef _ANSI_ARGS_ +#define _ANSI_ARGS_(x) x +#endif + +/* + * Definitions that allow this header file to be used either with or without + * ANSI C features. + */ + +#ifndef INLINE +#define INLINE +#endif + +#ifdef NO_CONST +#ifndef const +#define const +#endif +#endif +#ifndef CONST +#define CONST const +#endif + +#ifdef USE_NON_CONST +#ifdef USE_COMPAT_CONST +#error define at most one of USE_NON_CONST and USE_COMPAT_CONST +#endif +#define CONST84 +#define CONST84_RETURN +#else +#ifdef USE_COMPAT_CONST +#define CONST84 +#define CONST84_RETURN const +#else +#define CONST84 const +#define CONST84_RETURN const +#endif +#endif + +#ifndef CONST86 +#define CONST86 CONST84 +#endif + +/* + * Make sure EXTERN isn't defined elsewhere. + */ + +#ifdef EXTERN +#undef EXTERN +#endif /* EXTERN */ + +#ifdef __cplusplus +#define EXTERN extern "C" TCL_STORAGE_CLASS +#else +#define EXTERN extern TCL_STORAGE_CLASS +#endif + +/* + *---------------------------------------------------------------------------- + * The following code is copied from winnt.h. If we don't replicate it here, + * then can't be included after tcl.h, since tcl.h also defines + * VOID. This block is skipped under Cygwin and Mingw. + */ + +#if defined(_WIN32) && !defined(HAVE_WINNT_IGNORE_VOID) +#ifndef VOID +#define VOID void +typedef char CHAR; +typedef short SHORT; +typedef long LONG; +#endif +#endif /* _WIN32 && !HAVE_WINNT_IGNORE_VOID */ + +/* + * Macro to use instead of "void" for arguments that must have type "void *" + * in ANSI C; maps them to type "char *" in non-ANSI systems. + */ + +#ifndef __VXWORKS__ +#ifndef NO_VOID +#define VOID void +#else +#define VOID char +#endif +#endif + +/* + * Miscellaneous declarations. + */ + +#ifndef _CLIENTDATA +#ifndef NO_VOID +typedef void* ClientData; +#else +typedef int* ClientData; +#endif +#define _CLIENTDATA +#endif + +/* + * Darwin specific configure overrides (to support fat compiles, where + * configure runs only once for multiple architectures): + */ + +#ifdef __APPLE__ +#ifdef __LP64__ +#undef TCL_WIDE_INT_TYPE +#define TCL_WIDE_INT_IS_LONG 1 +#define TCL_CFG_DO64BIT 1 +#else /* !__LP64__ */ +#define TCL_WIDE_INT_TYPE long long +#undef TCL_WIDE_INT_IS_LONG +#undef TCL_CFG_DO64BIT +#endif /* __LP64__ */ +#undef HAVE_STRUCT_STAT64 +#endif /* __APPLE__ */ + +/* + * Define Tcl_WideInt to be a type that is (at least) 64-bits wide, and define + * Tcl_WideUInt to be the unsigned variant of that type (assuming that where + * we have one, we can have the other.) + * + * Also defines the following macros: + * TCL_WIDE_INT_IS_LONG - if wide ints are really longs (i.e. we're on a + * LP64 system such as modern Solaris or Linux ... not including Win64) + * Tcl_WideAsLong - forgetful converter from wideInt to long. + * Tcl_LongAsWide - sign-extending converter from long to wideInt. + * Tcl_WideAsDouble - converter from wideInt to double. + * Tcl_DoubleAsWide - converter from double to wideInt. + * + * The following invariant should hold for any long value 'longVal': + * longVal == Tcl_WideAsLong(Tcl_LongAsWide(longVal)) + * + * Note on converting between Tcl_WideInt and strings. This implementation (in + * tclObj.c) depends on the function + * sprintf(...,"%" TCL_LL_MODIFIER "d",...). + */ + +#if !defined(TCL_WIDE_INT_TYPE) && !defined(TCL_WIDE_INT_IS_LONG) +#if defined(_WIN32) +#define TCL_WIDE_INT_TYPE __int64 +#ifdef __BORLANDC__ +#define TCL_LL_MODIFIER "L" +#else /* __BORLANDC__ */ +#define TCL_LL_MODIFIER "I64" +#endif /* __BORLANDC__ */ +#elif defined(__GNUC__) +#define TCL_WIDE_INT_TYPE long long +#define TCL_LL_MODIFIER "ll" +#else /* ! _WIN32 && ! __GNUC__ */ +/* + * Don't know what platform it is and configure hasn't discovered what is + * going on for us. Try to guess... + */ +#include +#if (INT_MAX < LONG_MAX) +#define TCL_WIDE_INT_IS_LONG 1 +#else +#define TCL_WIDE_INT_TYPE long long +#endif +#endif /* _WIN32 */ +#endif /* !TCL_WIDE_INT_TYPE & !TCL_WIDE_INT_IS_LONG */ +#ifdef TCL_WIDE_INT_IS_LONG +#undef TCL_WIDE_INT_TYPE +#define TCL_WIDE_INT_TYPE long +#endif /* TCL_WIDE_INT_IS_LONG */ + +typedef TCL_WIDE_INT_TYPE Tcl_WideInt; +typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; + +#ifdef TCL_WIDE_INT_IS_LONG +#define Tcl_WideAsLong(val) ((long)(val)) +#define Tcl_LongAsWide(val) ((long)(val)) +#define Tcl_WideAsDouble(val) ((double)((long)(val))) +#define Tcl_DoubleAsWide(val) ((long)((double)(val))) +#ifndef TCL_LL_MODIFIER +#define TCL_LL_MODIFIER "l" +#endif /* !TCL_LL_MODIFIER */ +#else /* TCL_WIDE_INT_IS_LONG */ +/* + * The next short section of defines are only done when not running on Windows + * or some other strange platform. + */ +#ifndef TCL_LL_MODIFIER +#define TCL_LL_MODIFIER "ll" +#endif /* !TCL_LL_MODIFIER */ +#define Tcl_WideAsLong(val) ((long)((Tcl_WideInt)(val))) +#define Tcl_LongAsWide(val) ((Tcl_WideInt)((long)(val))) +#define Tcl_WideAsDouble(val) ((double)((Tcl_WideInt)(val))) +#define Tcl_DoubleAsWide(val) ((Tcl_WideInt)((double)(val))) +#endif /* TCL_WIDE_INT_IS_LONG */ + +#if defined(_WIN32) +#ifdef __BORLANDC__ +typedef struct stati64 Tcl_StatBuf; +#elif defined(_WIN64) +typedef struct __stat64 Tcl_StatBuf; +#elif (defined(_MSC_VER) && (_MSC_VER < 1400)) || defined(_USE_32BIT_TIME_T) +typedef struct _stati64 Tcl_StatBuf; +#else +typedef struct _stat32i64 Tcl_StatBuf; +#endif /* _MSC_VER < 1400 */ +#elif defined(__CYGWIN__) +typedef struct { + dev_t st_dev; + unsigned short st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + /* Here is a 2-byte gap */ + dev_t st_rdev; + /* Here is a 4-byte gap */ + long long st_size; + struct { + long tv_sec; + } st_atim; + struct { + long tv_sec; + } st_mtim; + struct { + long tv_sec; + } st_ctim; + /* Here is a 4-byte gap */ +} Tcl_StatBuf; +#elif defined(HAVE_STRUCT_STAT64) && !defined(__APPLE__) +typedef struct stat64 Tcl_StatBuf; +#else +typedef struct stat Tcl_StatBuf; +#endif + +/* + *---------------------------------------------------------------------------- + * Data structures defined opaquely in this module. The definitions below just + * provide dummy types. A few fields are made visible in Tcl_Interp + * structures, namely those used for returning a string result from commands. + * Direct access to the result field is discouraged in Tcl 8.0. The + * interpreter result is either an object or a string, and the two values are + * kept consistent unless some C code sets interp->result directly. + * Programmers should use either the function Tcl_GetObjResult() or + * Tcl_GetStringResult() to read the interpreter's result. See the SetResult + * man page for details. + * + * Note: any change to the Tcl_Interp definition below must be mirrored in the + * "real" definition in tclInt.h. + * + * Note: Tcl_ObjCmdProc functions do not directly set result and freeProc. + * Instead, they set a Tcl_Obj member in the "real" structure that can be + * accessed with Tcl_GetObjResult() and Tcl_SetObjResult(). + */ + +typedef struct Tcl_Interp +#ifndef TCL_NO_DEPRECATED +{ +/* TIP #330: Strongly discourage extensions from using the string + * result. */ +#ifdef USE_INTERP_RESULT + char* result TCL_DEPRECATED_API("use Tcl_GetStringResult/Tcl_SetResult"); + /* If the last command returned a string + * result, this points to it. */ + void (*freeProc)(char* blockPtr) + TCL_DEPRECATED_API("use Tcl_GetStringResult/Tcl_SetResult"); +/* Zero means the string result is statically + * allocated. TCL_DYNAMIC means it was + * allocated with ckalloc and should be freed + * with ckfree. Other values give the address + * of function to invoke to free the result. + * Tcl_Eval must free it before executing next + * command. */ +#else + char* resultDontUse; /* Don't use in extensions! */ + void (*freeProcDontUse)(char*); /* Don't use in extensions! */ +#endif +#ifdef USE_INTERP_ERRORLINE + int errorLine TCL_DEPRECATED_API("use Tcl_GetErrorLine/Tcl_SetErrorLine"); +/* When TCL_ERROR is returned, this gives the + * line number within the command where the + * error occurred (1 if first line). */ +#else + int errorLineDontUse; /* Don't use in extensions! */ +#endif +} +#endif /* TCL_NO_DEPRECATED */ +Tcl_Interp; + +typedef struct Tcl_AsyncHandler_* Tcl_AsyncHandler; +typedef struct Tcl_Channel_* Tcl_Channel; +typedef struct Tcl_ChannelTypeVersion_* Tcl_ChannelTypeVersion; +typedef struct Tcl_Command_* Tcl_Command; +typedef struct Tcl_Condition_* Tcl_Condition; +typedef struct Tcl_Dict_* Tcl_Dict; +typedef struct Tcl_EncodingState_* Tcl_EncodingState; +typedef struct Tcl_Encoding_* Tcl_Encoding; +typedef struct Tcl_Event Tcl_Event; +typedef struct Tcl_InterpState_* Tcl_InterpState; +typedef struct Tcl_LoadHandle_* Tcl_LoadHandle; +typedef struct Tcl_Mutex_* Tcl_Mutex; +typedef struct Tcl_Pid_* Tcl_Pid; +typedef struct Tcl_RegExp_* Tcl_RegExp; +typedef struct Tcl_ThreadDataKey_* Tcl_ThreadDataKey; +typedef struct Tcl_ThreadId_* Tcl_ThreadId; +typedef struct Tcl_TimerToken_* Tcl_TimerToken; +typedef struct Tcl_Trace_* Tcl_Trace; +typedef struct Tcl_Var_* Tcl_Var; +typedef struct Tcl_ZLibStream_* Tcl_ZlibStream; + +/* + *---------------------------------------------------------------------------- + * Definition of the interface to functions implementing threads. A function + * following this definition is given to each call of 'Tcl_CreateThread' and + * will be called as the main fuction of the new thread created by that call. + */ + +#if defined _WIN32 +typedef unsigned(__stdcall Tcl_ThreadCreateProc)(ClientData clientData); +#else +typedef void(Tcl_ThreadCreateProc)(ClientData clientData); +#endif + +/* + * Threading function return types used for abstracting away platform + * differences when writing a Tcl_ThreadCreateProc. See the NewThread function + * in generic/tclThreadTest.c for it's usage. + */ + +#if defined _WIN32 +#define Tcl_ThreadCreateType unsigned __stdcall +#define TCL_THREAD_CREATE_RETURN return 0 +#else +#define Tcl_ThreadCreateType void +#define TCL_THREAD_CREATE_RETURN +#endif + +/* + * Definition of values for default stacksize and the possible flags to be + * given to Tcl_CreateThread. + */ + +#define TCL_THREAD_STACK_DEFAULT (0) /* Use default size for stack. */ +#define TCL_THREAD_NOFLAGS \ + (0000) /* Standard flags, default \ + * behaviour. */ +#define TCL_THREAD_JOINABLE (0001) /* Mark the thread as joinable. */ + +/* + * Flag values passed to Tcl_StringCaseMatch. + */ + +#define TCL_MATCH_NOCASE (1 << 0) + +/* + * Flag values passed to Tcl_GetRegExpFromObj. + */ + +#define TCL_REG_BASIC 000000 /* BREs (convenience). */ +#define TCL_REG_EXTENDED 000001 /* EREs. */ +#define TCL_REG_ADVF 000002 /* Advanced features in EREs. */ +#define TCL_REG_ADVANCED 000003 /* AREs (which are also EREs). */ +#define TCL_REG_QUOTE 000004 /* No special characters, none. */ +#define TCL_REG_NOCASE 000010 /* Ignore case. */ +#define TCL_REG_NOSUB 000020 /* Don't care about subexpressions. */ +#define TCL_REG_EXPANDED \ + 000040 /* Expanded format, white space & \ + * comments. */ +#define TCL_REG_NLSTOP 000100 /* \n doesn't match . or [^ ] */ +#define TCL_REG_NLANCH 000200 /* ^ matches after \n, $ before. */ +#define TCL_REG_NEWLINE 000300 /* Newlines are line terminators. */ +#define TCL_REG_CANMATCH \ + 001000 /* Report details on partial/limited \ + * matches. */ + +/* + * Flags values passed to Tcl_RegExpExecObj. + */ + +#define TCL_REG_NOTBOL 0001 /* Beginning of string does not match ^. */ +#define TCL_REG_NOTEOL 0002 /* End of string does not match $. */ + +/* + * Structures filled in by Tcl_RegExpInfo. Note that all offset values are + * relative to the start of the match string, not the beginning of the entire + * string. + */ + +typedef struct Tcl_RegExpIndices { + long start; /* Character offset of first character in + * match. */ + long end; /* Character offset of first character after + * the match. */ +} Tcl_RegExpIndices; + +typedef struct Tcl_RegExpInfo { + int nsubs; /* Number of subexpressions in the compiled + * expression. */ + Tcl_RegExpIndices* matches; /* Array of nsubs match offset pairs. */ + long extendStart; /* The offset at which a subsequent match + * might begin. */ + long reserved; /* Reserved for later use. */ +} Tcl_RegExpInfo; + +/* + * Picky compilers complain if this typdef doesn't appear before the struct's + * reference in tclDecls.h. + */ + +typedef Tcl_StatBuf* Tcl_Stat_; +typedef struct stat* Tcl_OldStat_; + +/* + *---------------------------------------------------------------------------- + * When a TCL command returns, the interpreter contains a result from the + * command. Programmers are strongly encouraged to use one of the functions + * Tcl_GetObjResult() or Tcl_GetStringResult() to read the interpreter's + * result. See the SetResult man page for details. Besides this result, the + * command function returns an integer code, which is one of the following: + * + * TCL_OK Command completed normally; the interpreter's result + * contains the command's result. + * TCL_ERROR The command couldn't be completed successfully; the + * interpreter's result describes what went wrong. + * TCL_RETURN The command requests that the current function return; + * the interpreter's result contains the function's + * return value. + * TCL_BREAK The command requests that the innermost loop be + * exited; the interpreter's result is meaningless. + * TCL_CONTINUE Go on to the next iteration of the current loop; the + * interpreter's result is meaningless. + */ + +#define TCL_OK 0 +#define TCL_ERROR 1 +#define TCL_RETURN 2 +#define TCL_BREAK 3 +#define TCL_CONTINUE 4 + +#define TCL_RESULT_SIZE 200 + +/* + *---------------------------------------------------------------------------- + * Flags to control what substitutions are performed by Tcl_SubstObj(): + */ + +#define TCL_SUBST_COMMANDS 001 +#define TCL_SUBST_VARIABLES 002 +#define TCL_SUBST_BACKSLASHES 004 +#define TCL_SUBST_ALL 007 + +/* + * Argument descriptors for math function callbacks in expressions: + */ + +typedef enum { TCL_INT, TCL_DOUBLE, TCL_EITHER, TCL_WIDE_INT } Tcl_ValueType; + +typedef struct Tcl_Value { + Tcl_ValueType type; /* Indicates intValue or doubleValue is valid, + * or both. */ + long intValue; /* Integer value. */ + double doubleValue; /* Double-precision floating value. */ + Tcl_WideInt wideValue; /* Wide (min. 64-bit) integer value. */ +} Tcl_Value; + +/* + * Forward declaration of Tcl_Obj to prevent an error when the forward + * reference to Tcl_Obj is encountered in the function types declared below. + */ + +struct Tcl_Obj; + +/* + *---------------------------------------------------------------------------- + * Function types defined by Tcl: + */ + +typedef int(Tcl_AppInitProc)(Tcl_Interp* interp); +typedef int(Tcl_AsyncProc)(ClientData clientData, Tcl_Interp* interp, int code); +typedef void(Tcl_ChannelProc)(ClientData clientData, int mask); +typedef void(Tcl_CloseProc)(ClientData data); +typedef void(Tcl_CmdDeleteProc)(ClientData clientData); +typedef int(Tcl_CmdProc)( + ClientData clientData, + Tcl_Interp* interp, + int argc, + CONST84 char* argv[]); +typedef void(Tcl_CmdTraceProc)( + ClientData clientData, + Tcl_Interp* interp, + int level, + char* command, + Tcl_CmdProc* proc, + ClientData cmdClientData, + int argc, + CONST84 char* argv[]); +typedef int(Tcl_CmdObjTraceProc)( + ClientData clientData, + Tcl_Interp* interp, + int level, + const char* command, + Tcl_Command commandInfo, + int objc, + struct Tcl_Obj* const* objv); +typedef void(Tcl_CmdObjTraceDeleteProc)(ClientData clientData); +typedef void( + Tcl_DupInternalRepProc)(struct Tcl_Obj* srcPtr, struct Tcl_Obj* dupPtr); +typedef int(Tcl_EncodingConvertProc)( + ClientData clientData, + const char* src, + int srcLen, + int flags, + Tcl_EncodingState* statePtr, + char* dst, + int dstLen, + int* srcReadPtr, + int* dstWrotePtr, + int* dstCharsPtr); +typedef void(Tcl_EncodingFreeProc)(ClientData clientData); +typedef int(Tcl_EventProc)(Tcl_Event* evPtr, int flags); +typedef void(Tcl_EventCheckProc)(ClientData clientData, int flags); +typedef int(Tcl_EventDeleteProc)(Tcl_Event* evPtr, ClientData clientData); +typedef void(Tcl_EventSetupProc)(ClientData clientData, int flags); +typedef void(Tcl_ExitProc)(ClientData clientData); +typedef void(Tcl_FileProc)(ClientData clientData, int mask); +typedef void(Tcl_FileFreeProc)(ClientData clientData); +typedef void(Tcl_FreeInternalRepProc)(struct Tcl_Obj* objPtr); +typedef void(Tcl_FreeProc)(char* blockPtr); +typedef void(Tcl_IdleProc)(ClientData clientData); +typedef void(Tcl_InterpDeleteProc)(ClientData clientData, Tcl_Interp* interp); +typedef int(Tcl_MathProc)( + ClientData clientData, + Tcl_Interp* interp, + Tcl_Value* args, + Tcl_Value* resultPtr); +typedef void(Tcl_NamespaceDeleteProc)(ClientData clientData); +typedef int(Tcl_ObjCmdProc)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + struct Tcl_Obj* const* objv); +typedef int(Tcl_PackageInitProc)(Tcl_Interp* interp); +typedef int(Tcl_PackageUnloadProc)(Tcl_Interp* interp, int flags); +typedef void(Tcl_PanicProc)(const char* format, ...); +typedef void(Tcl_TcpAcceptProc)( + ClientData callbackData, + Tcl_Channel chan, + char* address, + int port); +typedef void(Tcl_TimerProc)(ClientData clientData); +typedef int(Tcl_SetFromAnyProc)(Tcl_Interp* interp, struct Tcl_Obj* objPtr); +typedef void(Tcl_UpdateStringProc)(struct Tcl_Obj* objPtr); +typedef char*(Tcl_VarTraceProc)( + ClientData clientData, + Tcl_Interp* interp, + CONST84 char* part1, + CONST84 char* part2, + int flags); +typedef void(Tcl_CommandTraceProc)( + ClientData clientData, + Tcl_Interp* interp, + const char* oldName, + const char* newName, + int flags); +typedef void(Tcl_CreateFileHandlerProc)( + int fd, + int mask, + Tcl_FileProc* proc, + ClientData clientData); +typedef void(Tcl_DeleteFileHandlerProc)(int fd); +typedef void(Tcl_AlertNotifierProc)(ClientData clientData); +typedef void(Tcl_ServiceModeHookProc)(int mode); +typedef ClientData(Tcl_InitNotifierProc)(void); +typedef void(Tcl_FinalizeNotifierProc)(ClientData clientData); +typedef void(Tcl_MainLoopProc)(void); + +/* + *---------------------------------------------------------------------------- + * The following structure represents a type of object, which is a particular + * internal representation for an object plus a set of functions that provide + * standard operations on objects of that type. + */ + +typedef struct Tcl_ObjType { + const char* name; /* Name of the type, e.g. "int". */ + Tcl_FreeInternalRepProc* freeIntRepProc; + /* Called to free any storage for the type's + * internal rep. NULL if the internal rep does + * not need freeing. */ + Tcl_DupInternalRepProc* dupIntRepProc; + /* Called to create a new object as a copy of + * an existing object. */ + Tcl_UpdateStringProc* updateStringProc; + /* Called to update the string rep from the + * type's internal representation. */ + Tcl_SetFromAnyProc* setFromAnyProc; + /* Called to convert the object's internal rep + * to this type. Frees the internal rep of the + * old type. Returns TCL_ERROR on failure. */ +} Tcl_ObjType; + +/* + * One of the following structures exists for each object in the Tcl system. + * An object stores a value as either a string, some internal representation, + * or both. + */ + +typedef struct Tcl_Obj { + int refCount; /* When 0 the object will be freed. */ + char* bytes; /* This points to the first byte of the + * object's string representation. The array + * must be followed by a null byte (i.e., at + * offset length) but may also contain + * embedded null characters. The array's + * storage is allocated by ckalloc. NULL means + * the string rep is invalid and must be + * regenerated from the internal rep. Clients + * should use Tcl_GetStringFromObj or + * Tcl_GetString to get a pointer to the byte + * array as a readonly value. */ + int length; /* The number of bytes at *bytes, not + * including the terminating null. */ + const Tcl_ObjType* typePtr; /* Denotes the object's type. Always + * corresponds to the type of the object's + * internal rep. NULL indicates the object has + * no internal rep (has no type). */ + union { /* The internal representation: */ + long longValue; /* - an long integer value. */ + double doubleValue; /* - a double-precision floating value. */ + void* otherValuePtr; /* - another, type-specific value, + not used internally any more. */ + Tcl_WideInt wideValue; /* - a long long value. */ + struct { /* - internal rep as two pointers. + * the main use of which is a bignum's + * tightly packed fields, where the alloc, + * used and signum flags are packed into + * ptr2 with everything else hung off ptr1. */ + void* ptr1; + void* ptr2; + } twoPtrValue; + struct { /* - internal rep as a pointer and a long, + not used internally any more. */ + void* ptr; + unsigned long value; + } ptrAndLongRep; + } internalRep; +} Tcl_Obj; + +/* + * Macros to increment and decrement a Tcl_Obj's reference count, and to test + * whether an object is shared (i.e. has reference count > 1). Note: clients + * should use Tcl_DecrRefCount() when they are finished using an object, and + * should never call TclFreeObj() directly. TclFreeObj() is only defined and + * made public in tcl.h to support Tcl_DecrRefCount's macro definition. + */ + +void Tcl_IncrRefCount(Tcl_Obj* objPtr); +void Tcl_DecrRefCount(Tcl_Obj* objPtr); +int Tcl_IsShared(Tcl_Obj* objPtr); + +/* + *---------------------------------------------------------------------------- + * The following structure contains the state needed by Tcl_SaveResult. No-one + * outside of Tcl should access any of these fields. This structure is + * typically allocated on the stack. + */ + +typedef struct Tcl_SavedResult { + char* result; + Tcl_FreeProc* freeProc; + Tcl_Obj* objResultPtr; + char* appendResult; + int appendAvl; + int appendUsed; + char resultSpace[TCL_RESULT_SIZE + 1]; +} Tcl_SavedResult; + +/* + *---------------------------------------------------------------------------- + * The following definitions support Tcl's namespace facility. Note: the first + * five fields must match exactly the fields in a Namespace structure (see + * tclInt.h). + */ + +typedef struct Tcl_Namespace { + char* name; /* The namespace's name within its parent + * namespace. This contains no ::'s. The name + * of the global namespace is "" although "::" + * is an synonym. */ + char* fullName; /* The namespace's fully qualified name. This + * starts with ::. */ + ClientData clientData; /* Arbitrary value associated with this + * namespace. */ + Tcl_NamespaceDeleteProc* deleteProc; + /* Function invoked when deleting the + * namespace to, e.g., free clientData. */ + struct Tcl_Namespace* parentPtr; + /* Points to the namespace that contains this + * one. NULL if this is the global + * namespace. */ +} Tcl_Namespace; + +/* + *---------------------------------------------------------------------------- + * The following structure represents a call frame, or activation record. A + * call frame defines a naming context for a procedure call: its local scope + * (for local variables) and its namespace scope (used for non-local + * variables; often the global :: namespace). A call frame can also define the + * naming context for a namespace eval or namespace inscope command: the + * namespace in which the command's code should execute. The Tcl_CallFrame + * structures exist only while procedures or namespace eval/inscope's are + * being executed, and provide a Tcl call stack. + * + * A call frame is initialized and pushed using Tcl_PushCallFrame and popped + * using Tcl_PopCallFrame. Storage for a Tcl_CallFrame must be provided by the + * Tcl_PushCallFrame caller, and callers typically allocate them on the C call + * stack for efficiency. For this reason, Tcl_CallFrame is defined as a + * structure and not as an opaque token. However, most Tcl_CallFrame fields + * are hidden since applications should not access them directly; others are + * declared as "dummyX". + * + * WARNING!! The structure definition must be kept consistent with the + * CallFrame structure in tclInt.h. If you change one, change the other. + */ + +typedef struct Tcl_CallFrame { + Tcl_Namespace* nsPtr; + int dummy1; + int dummy2; + void* dummy3; + void* dummy4; + void* dummy5; + int dummy6; + void* dummy7; + void* dummy8; + int dummy9; + void* dummy10; + void* dummy11; + void* dummy12; + void* dummy13; +} Tcl_CallFrame; + +/* + *---------------------------------------------------------------------------- + * Information about commands that is returned by Tcl_GetCommandInfo and + * passed to Tcl_SetCommandInfo. objProc is an objc/objv object-based command + * function while proc is a traditional Tcl argc/argv string-based function. + * Tcl_CreateObjCommand and Tcl_CreateCommand ensure that both objProc and + * proc are non-NULL and can be called to execute the command. However, it may + * be faster to call one instead of the other. The member isNativeObjectProc + * is set to 1 if an object-based function was registered by + * Tcl_CreateObjCommand, and to 0 if a string-based function was registered by + * Tcl_CreateCommand. The other function is typically set to a compatibility + * wrapper that does string-to-object or object-to-string argument conversions + * then calls the other function. + */ + +typedef struct Tcl_CmdInfo { + int isNativeObjectProc; /* 1 if objProc was registered by a call to + * Tcl_CreateObjCommand; 0 otherwise. + * Tcl_SetCmdInfo does not modify this + * field. */ + Tcl_ObjCmdProc* objProc; /* Command's object-based function. */ + ClientData objClientData; /* ClientData for object proc. */ + Tcl_CmdProc* proc; /* Command's string-based function. */ + ClientData clientData; /* ClientData for string proc. */ + Tcl_CmdDeleteProc* deleteProc; + /* Function to call when command is + * deleted. */ + ClientData deleteData; /* Value to pass to deleteProc (usually the + * same as clientData). */ + Tcl_Namespace* namespacePtr; /* Points to the namespace that contains this + * command. Note that Tcl_SetCmdInfo will not + * change a command's namespace; use + * TclRenameCommand or Tcl_Eval (of 'rename') + * to do that. */ +} Tcl_CmdInfo; + +/* + *---------------------------------------------------------------------------- + * The structure defined below is used to hold dynamic strings. The only + * fields that clients should use are string and length, accessible via the + * macros Tcl_DStringValue and Tcl_DStringLength. + */ + +#define TCL_DSTRING_STATIC_SIZE 200 +typedef struct Tcl_DString { + char* string; /* Points to beginning of string: either + * staticSpace below or a malloced array. */ + int length; /* Number of non-NULL characters in the + * string. */ + int spaceAvl; /* Total number of bytes available for the + * string and its terminating NULL char. */ + char staticSpace[TCL_DSTRING_STATIC_SIZE]; + /* Space to use in common case where string is + * small. */ +} Tcl_DString; + +#define Tcl_DStringLength(dsPtr) ((dsPtr)->length) +#define Tcl_DStringValue(dsPtr) ((dsPtr)->string) +#define Tcl_DStringTrunc Tcl_DStringSetLength + +/* + * Definitions for the maximum number of digits of precision that may be + * specified in the "tcl_precision" variable, and the number of bytes of + * buffer space required by Tcl_PrintDouble. + */ + +#define TCL_MAX_PREC 17 +#define TCL_DOUBLE_SPACE (TCL_MAX_PREC + 10) + +/* + * Definition for a number of bytes of buffer space sufficient to hold the + * string representation of an integer in base 10 (assuming the existence of + * 64-bit integers). + */ + +#define TCL_INTEGER_SPACE 24 + +/* + * Flag values passed to Tcl_ConvertElement. + * TCL_DONT_USE_BRACES forces it not to enclose the element in braces, but to + * use backslash quoting instead. + * TCL_DONT_QUOTE_HASH disables the default quoting of the '#' character. It + * is safe to leave the hash unquoted when the element is not the first + * element of a list, and this flag can be used by the caller to indicate + * that condition. + */ + +#define TCL_DONT_USE_BRACES 1 +#define TCL_DONT_QUOTE_HASH 8 + +/* + * Flag that may be passed to Tcl_GetIndexFromObj to force it to disallow + * abbreviated strings. + */ + +#define TCL_EXACT 1 + +/* + *---------------------------------------------------------------------------- + * Flag values passed to Tcl_RecordAndEval, Tcl_EvalObj, Tcl_EvalObjv. + * WARNING: these bit choices must not conflict with the bit choices for + * evalFlag bits in tclInt.h! + * + * Meanings: + * TCL_NO_EVAL: Just record this command + * TCL_EVAL_GLOBAL: Execute script in global namespace + * TCL_EVAL_DIRECT: Do not compile this script + * TCL_EVAL_INVOKE: Magical Tcl_EvalObjv mode for aliases/ensembles + * o Run in iPtr->lookupNsPtr or global namespace + * o Cut out of error traces + * o Don't reset the flags controlling ensemble + * error message rewriting. + * TCL_CANCEL_UNWIND: Magical Tcl_CancelEval mode that causes the + * stack for the script in progress to be + * completely unwound. + * TCL_EVAL_NOERR: Do no exception reporting at all, just return + * as the caller will report. + */ + +#define TCL_NO_EVAL 0x010000 +#define TCL_EVAL_GLOBAL 0x020000 +#define TCL_EVAL_DIRECT 0x040000 +#define TCL_EVAL_INVOKE 0x080000 +#define TCL_CANCEL_UNWIND 0x100000 +#define TCL_EVAL_NOERR 0x200000 + +/* + * Special freeProc values that may be passed to Tcl_SetResult (see the man + * page for details): + */ + +#define TCL_VOLATILE ((Tcl_FreeProc*)1) +#define TCL_STATIC ((Tcl_FreeProc*)0) +#define TCL_DYNAMIC ((Tcl_FreeProc*)3) + +/* + * Flag values passed to variable-related functions. + * WARNING: these bit choices must not conflict with the bit choice for + * TCL_CANCEL_UNWIND, above. + */ + +#define TCL_GLOBAL_ONLY 1 +#define TCL_NAMESPACE_ONLY 2 +#define TCL_APPEND_VALUE 4 +#define TCL_LIST_ELEMENT 8 +#define TCL_TRACE_READS 0x10 +#define TCL_TRACE_WRITES 0x20 +#define TCL_TRACE_UNSETS 0x40 +#define TCL_TRACE_DESTROYED 0x80 +#define TCL_INTERP_DESTROYED 0x100 +#define TCL_LEAVE_ERR_MSG 0x200 +#define TCL_TRACE_ARRAY 0x800 +#ifndef TCL_REMOVE_OBSOLETE_TRACES +/* Required to support old variable/vdelete/vinfo traces. */ +#define TCL_TRACE_OLD_STYLE 0x1000 +#endif +/* Indicate the semantics of the result of a trace. */ +#define TCL_TRACE_RESULT_DYNAMIC 0x8000 +#define TCL_TRACE_RESULT_OBJECT 0x10000 + +/* + * Flag values for ensemble commands. + */ + +#define TCL_ENSEMBLE_PREFIX \ + 0x02 /* Flag value to say whether to allow \ + * unambiguous prefixes of commands or to \ + * require exact matches for command names. */ + +/* + * Flag values passed to command-related functions. + */ + +#define TCL_TRACE_RENAME 0x2000 +#define TCL_TRACE_DELETE 0x4000 + +#define TCL_ALLOW_INLINE_COMPILATION 0x20000 + +/* + * The TCL_PARSE_PART1 flag is deprecated and has no effect. The part1 is now + * always parsed whenever the part2 is NULL. (This is to avoid a common error + * when converting code to use the new object based APIs and forgetting to + * give the flag) + */ + +#ifndef TCL_NO_DEPRECATED +#define TCL_PARSE_PART1 0x400 +#endif + +/* + * Types for linked variables: + */ + +#define TCL_LINK_INT 1 +#define TCL_LINK_DOUBLE 2 +#define TCL_LINK_BOOLEAN 3 +#define TCL_LINK_STRING 4 +#define TCL_LINK_WIDE_INT 5 +#define TCL_LINK_CHAR 6 +#define TCL_LINK_UCHAR 7 +#define TCL_LINK_SHORT 8 +#define TCL_LINK_USHORT 9 +#define TCL_LINK_UINT 10 +#define TCL_LINK_LONG 11 +#define TCL_LINK_ULONG 12 +#define TCL_LINK_FLOAT 13 +#define TCL_LINK_WIDE_UINT 14 +#define TCL_LINK_READ_ONLY 0x80 + +/* + *---------------------------------------------------------------------------- + * Forward declarations of Tcl_HashTable and related types. + */ + +typedef struct Tcl_HashKeyType Tcl_HashKeyType; +typedef struct Tcl_HashTable Tcl_HashTable; +typedef struct Tcl_HashEntry Tcl_HashEntry; + +typedef unsigned(Tcl_HashKeyProc)(Tcl_HashTable* tablePtr, void* keyPtr); +typedef int(Tcl_CompareHashKeysProc)(void* keyPtr, Tcl_HashEntry* hPtr); +typedef Tcl_HashEntry*( + Tcl_AllocHashEntryProc)(Tcl_HashTable* tablePtr, void* keyPtr); +typedef void(Tcl_FreeHashEntryProc)(Tcl_HashEntry* hPtr); + +/* + * This flag controls whether the hash table stores the hash of a key, or + * recalculates it. There should be no reason for turning this flag off as it + * is completely binary and source compatible unless you directly access the + * bucketPtr member of the Tcl_HashTableEntry structure. This member has been + * removed and the space used to store the hash value. + */ + +#ifndef TCL_HASH_KEY_STORE_HASH +#define TCL_HASH_KEY_STORE_HASH 1 +#endif + +/* + * Structure definition for an entry in a hash table. No-one outside Tcl + * should access any of these fields directly; use the macros defined below. + */ + +struct Tcl_HashEntry { + Tcl_HashEntry* nextPtr; /* Pointer to next entry in this hash bucket, + * or NULL for end of chain. */ + Tcl_HashTable* tablePtr; /* Pointer to table containing entry. */ +#if TCL_HASH_KEY_STORE_HASH + void* hash; /* Hash value, stored as pointer to ensure + * that the offsets of the fields in this + * structure are not changed. */ +#else + Tcl_HashEntry** bucketPtr; /* Pointer to bucket that points to first + * entry in this entry's chain: used for + * deleting the entry. */ +#endif + ClientData clientData; /* Application stores something here with + * Tcl_SetHashValue. */ + union { /* Key has one of these forms: */ + char* oneWordValue; /* One-word value for key. */ + Tcl_Obj* objPtr; /* Tcl_Obj * key value. */ + int words[1]; /* Multiple integer words for key. The actual + * size will be as large as necessary for this + * table's keys. */ + char string[1]; /* String for key. The actual size will be as + * large as needed to hold the key. */ + } key; /* MUST BE LAST FIELD IN RECORD!! */ +}; + +/* + * Flags used in Tcl_HashKeyType. + * + * TCL_HASH_KEY_RANDOMIZE_HASH - + * There are some things, pointers for example + * which don't hash well because they do not use + * the lower bits. If this flag is set then the + * hash table will attempt to rectify this by + * randomising the bits and then using the upper + * N bits as the index into the table. + * TCL_HASH_KEY_SYSTEM_HASH - If this flag is set then all memory internally + * allocated for the hash table that is not for an + * entry will use the system heap. + */ + +#define TCL_HASH_KEY_RANDOMIZE_HASH 0x1 +#define TCL_HASH_KEY_SYSTEM_HASH 0x2 + +/* + * Structure definition for the methods associated with a hash table key type. + */ + +#define TCL_HASH_KEY_TYPE_VERSION 1 +struct Tcl_HashKeyType { + int version; /* Version of the table. If this structure is + * extended in future then the version can be + * used to distinguish between different + * structures. */ + int flags; /* Flags, see above for details. */ + Tcl_HashKeyProc* hashKeyProc; + /* Calculates a hash value for the key. If + * this is NULL then the pointer itself is + * used as a hash value. */ + Tcl_CompareHashKeysProc* compareKeysProc; + /* Compares two keys and returns zero if they + * do not match, and non-zero if they do. If + * this is NULL then the pointers are + * compared. */ + Tcl_AllocHashEntryProc* allocEntryProc; + /* Called to allocate memory for a new entry, + * i.e. if the key is a string then this could + * allocate a single block which contains + * enough space for both the entry and the + * string. Only the key field of the allocated + * Tcl_HashEntry structure needs to be filled + * in. If something else needs to be done to + * the key, i.e. incrementing a reference + * count then that should be done by this + * function. If this is NULL then Tcl_Alloc is + * used to allocate enough space for a + * Tcl_HashEntry and the key pointer is + * assigned to key.oneWordValue. */ + Tcl_FreeHashEntryProc* freeEntryProc; + /* Called to free memory associated with an + * entry. If something else needs to be done + * to the key, i.e. decrementing a reference + * count then that should be done by this + * function. If this is NULL then Tcl_Free is + * used to free the Tcl_HashEntry. */ +}; + +/* + * Structure definition for a hash table. Must be in tcl.h so clients can + * allocate space for these structures, but clients should never access any + * fields in this structure. + */ + +#define TCL_SMALL_HASH_TABLE 4 +struct Tcl_HashTable { + Tcl_HashEntry** buckets; /* Pointer to bucket array. Each element + * points to first entry in bucket's hash + * chain, or NULL. */ + Tcl_HashEntry* staticBuckets[TCL_SMALL_HASH_TABLE]; + /* Bucket array used for small tables (to + * avoid mallocs and frees). */ + int numBuckets; /* Total number of buckets allocated at + * **bucketPtr. */ + int numEntries; /* Total number of entries present in + * table. */ + int rebuildSize; /* Enlarge table when numEntries gets to be + * this large. */ + int downShift; /* Shift count used in hashing function. + * Designed to use high-order bits of + * randomized keys. */ + int mask; /* Mask value used in hashing function. */ + int keyType; /* Type of keys used in this table. It's + * either TCL_CUSTOM_KEYS, TCL_STRING_KEYS, + * TCL_ONE_WORD_KEYS, or an integer giving the + * number of ints that is the size of the + * key. */ + Tcl_HashEntry* (*findProc)(Tcl_HashTable* tablePtr, const char* key); + Tcl_HashEntry* ( + *createProc)(Tcl_HashTable* tablePtr, const char* key, int* newPtr); + const Tcl_HashKeyType* typePtr; + /* Type of the keys used in the + * Tcl_HashTable. */ +}; + +/* + * Structure definition for information used to keep track of searches through + * hash tables: + */ + +typedef struct Tcl_HashSearch { + Tcl_HashTable* tablePtr; /* Table being searched. */ + int nextIndex; /* Index of next bucket to be enumerated after + * present one. */ + Tcl_HashEntry* nextEntryPtr; /* Next entry to be enumerated in the current + * bucket. */ +} Tcl_HashSearch; + +/* + * Acceptable key types for hash tables: + * + * TCL_STRING_KEYS: The keys are strings, they are copied into the + * entry. + * TCL_ONE_WORD_KEYS: The keys are pointers, the pointer is stored + * in the entry. + * TCL_CUSTOM_TYPE_KEYS: The keys are arbitrary types which are copied + * into the entry. + * TCL_CUSTOM_PTR_KEYS: The keys are pointers to arbitrary types, the + * pointer is stored in the entry. + * + * While maintaining binary compatibility the above have to be distinct values + * as they are used to differentiate between old versions of the hash table + * which don't have a typePtr and new ones which do. Once binary compatibility + * is discarded in favour of making more wide spread changes TCL_STRING_KEYS + * can be the same as TCL_CUSTOM_TYPE_KEYS, and TCL_ONE_WORD_KEYS can be the + * same as TCL_CUSTOM_PTR_KEYS because they simply determine how the key is + * accessed from the entry and not the behaviour. + */ + +#define TCL_STRING_KEYS (0) +#define TCL_ONE_WORD_KEYS (1) +#define TCL_CUSTOM_TYPE_KEYS (-2) +#define TCL_CUSTOM_PTR_KEYS (-1) + +/* + * Structure definition for information used to keep track of searches through + * dictionaries. These fields should not be accessed by code outside + * tclDictObj.c + */ + +typedef struct { + void* next; /* Search position for underlying hash + * table. */ + int epoch; /* Epoch marker for dictionary being searched, + * or -1 if search has terminated. */ + Tcl_Dict dictionaryPtr; /* Reference to dictionary being searched. */ +} Tcl_DictSearch; + +/* + *---------------------------------------------------------------------------- + * Flag values to pass to Tcl_DoOneEvent to disable searches for some kinds of + * events: + */ + +#define TCL_DONT_WAIT (1 << 1) +#define TCL_WINDOW_EVENTS (1 << 2) +#define TCL_FILE_EVENTS (1 << 3) +#define TCL_TIMER_EVENTS (1 << 4) +#define TCL_IDLE_EVENTS (1 << 5) /* WAS 0x10 ???? */ +#define TCL_ALL_EVENTS (~TCL_DONT_WAIT) + +/* + * The following structure defines a generic event for the Tcl event system. + * These are the things that are queued in calls to Tcl_QueueEvent and + * serviced later by Tcl_DoOneEvent. There can be many different kinds of + * events with different fields, corresponding to window events, timer events, + * etc. The structure for a particular event consists of a Tcl_Event header + * followed by additional information specific to that event. + */ + +struct Tcl_Event { + Tcl_EventProc* proc; /* Function to call to service this event. */ + struct Tcl_Event* nextPtr; /* Next in list of pending events, or NULL. */ +}; + +/* + * Positions to pass to Tcl_QueueEvent: + */ + +typedef enum { + TCL_QUEUE_TAIL, + TCL_QUEUE_HEAD, + TCL_QUEUE_MARK +} Tcl_QueuePosition; + +/* + * Values to pass to Tcl_SetServiceMode to specify the behavior of notifier + * event routines. + */ + +#define TCL_SERVICE_NONE 0 +#define TCL_SERVICE_ALL 1 + +/* + * The following structure keeps is used to hold a time value, either as an + * absolute time (the number of seconds from the epoch) or as an elapsed time. + * On Unix systems the epoch is Midnight Jan 1, 1970 GMT. + */ + +typedef struct Tcl_Time { + long sec; /* Seconds. */ + long usec; /* Microseconds. */ +} Tcl_Time; + +typedef void(Tcl_SetTimerProc)(CONST86 Tcl_Time* timePtr); +typedef int(Tcl_WaitForEventProc)(CONST86 Tcl_Time* timePtr); + +/* + * TIP #233 (Virtualized Time) + */ + +typedef void(Tcl_GetTimeProc)(Tcl_Time* timebuf, ClientData clientData); +typedef void(Tcl_ScaleTimeProc)(Tcl_Time* timebuf, ClientData clientData); + +/* + *---------------------------------------------------------------------------- + * Bits to pass to Tcl_CreateFileHandler and Tcl_CreateChannelHandler to + * indicate what sorts of events are of interest: + */ + +#define TCL_READABLE (1 << 1) +#define TCL_WRITABLE (1 << 2) +#define TCL_EXCEPTION (1 << 3) + +/* + * Flag values to pass to Tcl_OpenCommandChannel to indicate the disposition + * of the stdio handles. TCL_STDIN, TCL_STDOUT, TCL_STDERR, are also used in + * Tcl_GetStdChannel. + */ + +#define TCL_STDIN (1 << 1) +#define TCL_STDOUT (1 << 2) +#define TCL_STDERR (1 << 3) +#define TCL_ENFORCE_MODE (1 << 4) + +/* + * Bits passed to Tcl_DriverClose2Proc to indicate which side of a channel + * should be closed. + */ + +#define TCL_CLOSE_READ (1 << 1) +#define TCL_CLOSE_WRITE (1 << 2) + +/* + * Value to use as the closeProc for a channel that supports the close2Proc + * interface. + */ + +#define TCL_CLOSE2PROC ((Tcl_DriverCloseProc*)1) + +/* + * Channel version tag. This was introduced in 8.3.2/8.4. + */ + +#define TCL_CHANNEL_VERSION_1 ((Tcl_ChannelTypeVersion)0x1) +#define TCL_CHANNEL_VERSION_2 ((Tcl_ChannelTypeVersion)0x2) +#define TCL_CHANNEL_VERSION_3 ((Tcl_ChannelTypeVersion)0x3) +#define TCL_CHANNEL_VERSION_4 ((Tcl_ChannelTypeVersion)0x4) +#define TCL_CHANNEL_VERSION_5 ((Tcl_ChannelTypeVersion)0x5) + +/* + * TIP #218: Channel Actions, Ids for Tcl_DriverThreadActionProc. + */ + +#define TCL_CHANNEL_THREAD_INSERT (0) +#define TCL_CHANNEL_THREAD_REMOVE (1) + +/* + * Typedefs for the various operations in a channel type: + */ + +typedef int(Tcl_DriverBlockModeProc)(ClientData instanceData, int mode); +typedef int(Tcl_DriverCloseProc)(ClientData instanceData, Tcl_Interp* interp); +typedef int(Tcl_DriverClose2Proc)( + ClientData instanceData, + Tcl_Interp* interp, + int flags); +typedef int(Tcl_DriverInputProc)( + ClientData instanceData, + char* buf, + int toRead, + int* errorCodePtr); +typedef int(Tcl_DriverOutputProc)( + ClientData instanceData, + CONST84 char* buf, + int toWrite, + int* errorCodePtr); +typedef int(Tcl_DriverSeekProc)( + ClientData instanceData, + long offset, + int mode, + int* errorCodePtr); +typedef int(Tcl_DriverSetOptionProc)( + ClientData instanceData, + Tcl_Interp* interp, + const char* optionName, + const char* value); +typedef int(Tcl_DriverGetOptionProc)( + ClientData instanceData, + Tcl_Interp* interp, + CONST84 char* optionName, + Tcl_DString* dsPtr); +typedef void(Tcl_DriverWatchProc)(ClientData instanceData, int mask); +typedef int(Tcl_DriverGetHandleProc)( + ClientData instanceData, + int direction, + ClientData* handlePtr); +typedef int(Tcl_DriverFlushProc)(ClientData instanceData); +typedef int(Tcl_DriverHandlerProc)(ClientData instanceData, int interestMask); +typedef Tcl_WideInt(Tcl_DriverWideSeekProc)( + ClientData instanceData, + Tcl_WideInt offset, + int mode, + int* errorCodePtr); +/* + * TIP #218, Channel Thread Actions + */ +typedef void(Tcl_DriverThreadActionProc)(ClientData instanceData, int action); +/* + * TIP #208, File Truncation (etc.) + */ +typedef int( + Tcl_DriverTruncateProc)(ClientData instanceData, Tcl_WideInt length); + +/* + * struct Tcl_ChannelType: + * + * One such structure exists for each type (kind) of channel. It collects + * together in one place all the functions that are part of the specific + * channel type. + * + * It is recommend that the Tcl_Channel* functions are used to access elements + * of this structure, instead of direct accessing. + */ + +typedef struct Tcl_ChannelType { + const char* typeName; /* The name of the channel type in Tcl + * commands. This storage is owned by channel + * type. */ + Tcl_ChannelTypeVersion version; + /* Version of the channel type. */ + Tcl_DriverCloseProc* closeProc; + /* Function to call to close the channel, or + * TCL_CLOSE2PROC if the close2Proc should be + * used instead. */ + Tcl_DriverInputProc* inputProc; + /* Function to call for input on channel. */ + Tcl_DriverOutputProc* outputProc; + /* Function to call for output on channel. */ + Tcl_DriverSeekProc* seekProc; + /* Function to call to seek on the channel. + * May be NULL. */ + Tcl_DriverSetOptionProc* setOptionProc; + /* Set an option on a channel. */ + Tcl_DriverGetOptionProc* getOptionProc; + /* Get an option from a channel. */ + Tcl_DriverWatchProc* watchProc; + /* Set up the notifier to watch for events on + * this channel. */ + Tcl_DriverGetHandleProc* getHandleProc; + /* Get an OS handle from the channel or NULL + * if not supported. */ + Tcl_DriverClose2Proc* close2Proc; + /* Function to call to close the channel if + * the device supports closing the read & + * write sides independently. */ + Tcl_DriverBlockModeProc* blockModeProc; + /* Set blocking mode for the raw channel. May + * be NULL. */ + /* + * Only valid in TCL_CHANNEL_VERSION_2 channels or later. + */ + Tcl_DriverFlushProc* flushProc; + /* Function to call to flush a channel. May be + * NULL. */ + Tcl_DriverHandlerProc* handlerProc; + /* Function to call to handle a channel event. + * This will be passed up the stacked channel + * chain. */ + /* + * Only valid in TCL_CHANNEL_VERSION_3 channels or later. + */ + Tcl_DriverWideSeekProc* wideSeekProc; + /* Function to call to seek on the channel + * which can handle 64-bit offsets. May be + * NULL, and must be NULL if seekProc is + * NULL. */ + /* + * Only valid in TCL_CHANNEL_VERSION_4 channels or later. + * TIP #218, Channel Thread Actions. + */ + Tcl_DriverThreadActionProc* threadActionProc; + /* Function to call to notify the driver of + * thread specific activity for a channel. May + * be NULL. */ + /* + * Only valid in TCL_CHANNEL_VERSION_5 channels or later. + * TIP #208, File Truncation. + */ + Tcl_DriverTruncateProc* truncateProc; + /* Function to call to truncate the underlying + * file to a particular length. May be NULL if + * the channel does not support truncation. */ +} Tcl_ChannelType; + +/* + * The following flags determine whether the blockModeProc above should set + * the channel into blocking or nonblocking mode. They are passed as arguments + * to the blockModeProc function in the above structure. + */ + +#define TCL_MODE_BLOCKING 0 /* Put channel into blocking mode. */ +#define TCL_MODE_NONBLOCKING \ + 1 /* Put channel into nonblocking \ + * mode. */ + +/* + *---------------------------------------------------------------------------- + * Enum for different types of file paths. + */ + +typedef enum Tcl_PathType { + TCL_PATH_ABSOLUTE, + TCL_PATH_RELATIVE, + TCL_PATH_VOLUME_RELATIVE +} Tcl_PathType; + +/* + * The following structure is used to pass glob type data amongst the various + * glob routines and Tcl_FSMatchInDirectory. + */ + +typedef struct Tcl_GlobTypeData { + int type; /* Corresponds to bcdpfls as in 'find -t'. */ + int perm; /* Corresponds to file permissions. */ + Tcl_Obj* macType; /* Acceptable Mac type. */ + Tcl_Obj* macCreator; /* Acceptable Mac creator. */ +} Tcl_GlobTypeData; + +/* + * Type and permission definitions for glob command. + */ + +#define TCL_GLOB_TYPE_BLOCK (1 << 0) +#define TCL_GLOB_TYPE_CHAR (1 << 1) +#define TCL_GLOB_TYPE_DIR (1 << 2) +#define TCL_GLOB_TYPE_PIPE (1 << 3) +#define TCL_GLOB_TYPE_FILE (1 << 4) +#define TCL_GLOB_TYPE_LINK (1 << 5) +#define TCL_GLOB_TYPE_SOCK (1 << 6) +#define TCL_GLOB_TYPE_MOUNT (1 << 7) + +#define TCL_GLOB_PERM_RONLY (1 << 0) +#define TCL_GLOB_PERM_HIDDEN (1 << 1) +#define TCL_GLOB_PERM_R (1 << 2) +#define TCL_GLOB_PERM_W (1 << 3) +#define TCL_GLOB_PERM_X (1 << 4) + +/* + * Flags for the unload callback function. + */ + +#define TCL_UNLOAD_DETACH_FROM_INTERPRETER (1 << 0) +#define TCL_UNLOAD_DETACH_FROM_PROCESS (1 << 1) + +/* + * Typedefs for the various filesystem operations: + */ + +typedef int(Tcl_FSStatProc)(Tcl_Obj* pathPtr, Tcl_StatBuf* buf); +typedef int(Tcl_FSAccessProc)(Tcl_Obj* pathPtr, int mode); +typedef Tcl_Channel(Tcl_FSOpenFileChannelProc)( + Tcl_Interp* interp, + Tcl_Obj* pathPtr, + int mode, + int permissions); +typedef int(Tcl_FSMatchInDirectoryProc)( + Tcl_Interp* interp, + Tcl_Obj* result, + Tcl_Obj* pathPtr, + const char* pattern, + Tcl_GlobTypeData* types); +typedef Tcl_Obj*(Tcl_FSGetCwdProc)(Tcl_Interp* interp); +typedef int(Tcl_FSChdirProc)(Tcl_Obj* pathPtr); +typedef int(Tcl_FSLstatProc)(Tcl_Obj* pathPtr, Tcl_StatBuf* buf); +typedef int(Tcl_FSCreateDirectoryProc)(Tcl_Obj* pathPtr); +typedef int(Tcl_FSDeleteFileProc)(Tcl_Obj* pathPtr); +typedef int(Tcl_FSCopyDirectoryProc)( + Tcl_Obj* srcPathPtr, + Tcl_Obj* destPathPtr, + Tcl_Obj** errorPtr); +typedef int(Tcl_FSCopyFileProc)(Tcl_Obj* srcPathPtr, Tcl_Obj* destPathPtr); +typedef int(Tcl_FSRemoveDirectoryProc)( + Tcl_Obj* pathPtr, + int recursive, + Tcl_Obj** errorPtr); +typedef int(Tcl_FSRenameFileProc)(Tcl_Obj* srcPathPtr, Tcl_Obj* destPathPtr); +typedef void(Tcl_FSUnloadFileProc)(Tcl_LoadHandle loadHandle); +typedef Tcl_Obj*(Tcl_FSListVolumesProc)(void); +/* We have to declare the utime structure here. */ +struct utimbuf; +typedef int(Tcl_FSUtimeProc)(Tcl_Obj* pathPtr, struct utimbuf* tval); +typedef int(Tcl_FSNormalizePathProc)( + Tcl_Interp* interp, + Tcl_Obj* pathPtr, + int nextCheckpoint); +typedef int(Tcl_FSFileAttrsGetProc)( + Tcl_Interp* interp, + int index, + Tcl_Obj* pathPtr, + Tcl_Obj** objPtrRef); +typedef const char* CONST86*( + Tcl_FSFileAttrStringsProc)(Tcl_Obj* pathPtr, Tcl_Obj** objPtrRef); +typedef int(Tcl_FSFileAttrsSetProc)( + Tcl_Interp* interp, + int index, + Tcl_Obj* pathPtr, + Tcl_Obj* objPtr); +typedef Tcl_Obj*( + Tcl_FSLinkProc)(Tcl_Obj* pathPtr, Tcl_Obj* toPtr, int linkType); +typedef int(Tcl_FSLoadFileProc)( + Tcl_Interp* interp, + Tcl_Obj* pathPtr, + Tcl_LoadHandle* handlePtr, + Tcl_FSUnloadFileProc** unloadProcPtr); +typedef int( + Tcl_FSPathInFilesystemProc)(Tcl_Obj* pathPtr, ClientData* clientDataPtr); +typedef Tcl_Obj*(Tcl_FSFilesystemPathTypeProc)(Tcl_Obj* pathPtr); +typedef Tcl_Obj*(Tcl_FSFilesystemSeparatorProc)(Tcl_Obj* pathPtr); +typedef void(Tcl_FSFreeInternalRepProc)(ClientData clientData); +typedef ClientData(Tcl_FSDupInternalRepProc)(ClientData clientData); +typedef Tcl_Obj*(Tcl_FSInternalToNormalizedProc)(ClientData clientData); +typedef ClientData(Tcl_FSCreateInternalRepProc)(Tcl_Obj* pathPtr); + +typedef struct Tcl_FSVersion_* Tcl_FSVersion; + +/* + *---------------------------------------------------------------------------- + * Data structures related to hooking into the filesystem + */ + +/* + * Filesystem version tag. This was introduced in 8.4. + */ + +#define TCL_FILESYSTEM_VERSION_1 ((Tcl_FSVersion)0x1) + +/* + * struct Tcl_Filesystem: + * + * One such structure exists for each type (kind) of filesystem. It collects + * together in one place all the functions that are part of the specific + * filesystem. Tcl always accesses the filesystem through one of these + * structures. + * + * Not all entries need be non-NULL; any which are NULL are simply ignored. + * However, a complete filesystem should provide all of these functions. The + * explanations in the structure show the importance of each function. + */ + +typedef struct Tcl_Filesystem { + const char* typeName; /* The name of the filesystem. */ + int structureLength; /* Length of this structure, so future binary + * compatibility can be assured. */ + Tcl_FSVersion version; /* Version of the filesystem type. */ + Tcl_FSPathInFilesystemProc* pathInFilesystemProc; + /* Function to check whether a path is in this + * filesystem. This is the most important + * filesystem function. */ + Tcl_FSDupInternalRepProc* dupInternalRepProc; + /* Function to duplicate internal fs rep. May + * be NULL (but then fs is less efficient). */ + Tcl_FSFreeInternalRepProc* freeInternalRepProc; + /* Function to free internal fs rep. Must be + * implemented if internal representations + * need freeing, otherwise it can be NULL. */ + Tcl_FSInternalToNormalizedProc* internalToNormalizedProc; + /* Function to convert internal representation + * to a normalized path. Only required if the + * fs creates pure path objects with no + * string/path representation. */ + Tcl_FSCreateInternalRepProc* createInternalRepProc; + /* Function to create a filesystem-specific + * internal representation. May be NULL if + * paths have no internal representation, or + * if the Tcl_FSPathInFilesystemProc for this + * filesystem always immediately creates an + * internal representation for paths it + * accepts. */ + Tcl_FSNormalizePathProc* normalizePathProc; + /* Function to normalize a path. Should be + * implemented for all filesystems which can + * have multiple string representations for + * the same path object. */ + Tcl_FSFilesystemPathTypeProc* filesystemPathTypeProc; + /* Function to determine the type of a path in + * this filesystem. May be NULL. */ + Tcl_FSFilesystemSeparatorProc* filesystemSeparatorProc; + /* Function to return the separator + * character(s) for this filesystem. Must be + * implemented. */ + Tcl_FSStatProc* statProc; /* Function to process a 'Tcl_FSStat()' call. + * Must be implemented for any reasonable + * filesystem. */ + Tcl_FSAccessProc* accessProc; + /* Function to process a 'Tcl_FSAccess()' + * call. Must be implemented for any + * reasonable filesystem. */ + Tcl_FSOpenFileChannelProc* openFileChannelProc; + /* Function to process a + * 'Tcl_FSOpenFileChannel()' call. Must be + * implemented for any reasonable + * filesystem. */ + Tcl_FSMatchInDirectoryProc* matchInDirectoryProc; + /* Function to process a + * 'Tcl_FSMatchInDirectory()'. If not + * implemented, then glob and recursive copy + * functionality will be lacking in the + * filesystem. */ + Tcl_FSUtimeProc* utimeProc; /* Function to process a 'Tcl_FSUtime()' call. + * Required to allow setting (not reading) of + * times with 'file mtime', 'file atime' and + * the open-r/open-w/fcopy implementation of + * 'file copy'. */ + Tcl_FSLinkProc* linkProc; /* Function to process a 'Tcl_FSLink()' call. + * Should be implemented only if the + * filesystem supports links (reading or + * creating). */ + Tcl_FSListVolumesProc* listVolumesProc; + /* Function to list any filesystem volumes + * added by this filesystem. Should be + * implemented only if the filesystem adds + * volumes at the head of the filesystem. */ + Tcl_FSFileAttrStringsProc* fileAttrStringsProc; + /* Function to list all attributes strings + * which are valid for this filesystem. If not + * implemented the filesystem will not support + * the 'file attributes' command. This allows + * arbitrary additional information to be + * attached to files in the filesystem. */ + Tcl_FSFileAttrsGetProc* fileAttrsGetProc; + /* Function to process a + * 'Tcl_FSFileAttrsGet()' call, used by 'file + * attributes'. */ + Tcl_FSFileAttrsSetProc* fileAttrsSetProc; + /* Function to process a + * 'Tcl_FSFileAttrsSet()' call, used by 'file + * attributes'. */ + Tcl_FSCreateDirectoryProc* createDirectoryProc; + /* Function to process a + * 'Tcl_FSCreateDirectory()' call. Should be + * implemented unless the FS is read-only. */ + Tcl_FSRemoveDirectoryProc* removeDirectoryProc; + /* Function to process a + * 'Tcl_FSRemoveDirectory()' call. Should be + * implemented unless the FS is read-only. */ + Tcl_FSDeleteFileProc* deleteFileProc; + /* Function to process a 'Tcl_FSDeleteFile()' + * call. Should be implemented unless the FS + * is read-only. */ + Tcl_FSCopyFileProc* copyFileProc; + /* Function to process a 'Tcl_FSCopyFile()' + * call. If not implemented Tcl will fall back + * on open-r, open-w and fcopy as a copying + * mechanism, for copying actions initiated in + * Tcl (not C). */ + Tcl_FSRenameFileProc* renameFileProc; + /* Function to process a 'Tcl_FSRenameFile()' + * call. If not implemented, Tcl will fall + * back on a copy and delete mechanism, for + * rename actions initiated in Tcl (not C). */ + Tcl_FSCopyDirectoryProc* copyDirectoryProc; + /* Function to process a + * 'Tcl_FSCopyDirectory()' call. If not + * implemented, Tcl will fall back on a + * recursive create-dir, file copy mechanism, + * for copying actions initiated in Tcl (not + * C). */ + Tcl_FSLstatProc* lstatProc; /* Function to process a 'Tcl_FSLstat()' call. + * If not implemented, Tcl will attempt to use + * the 'statProc' defined above instead. */ + Tcl_FSLoadFileProc* loadFileProc; + /* Function to process a 'Tcl_FSLoadFile()' + * call. If not implemented, Tcl will fall + * back on a copy to native-temp followed by a + * Tcl_FSLoadFile on that temporary copy. */ + Tcl_FSGetCwdProc* getCwdProc; + /* Function to process a 'Tcl_FSGetCwd()' + * call. Most filesystems need not implement + * this. It will usually only be called once, + * if 'getcwd' is called before 'chdir'. May + * be NULL. */ + Tcl_FSChdirProc* chdirProc; /* Function to process a 'Tcl_FSChdir()' call. + * If filesystems do not implement this, it + * will be emulated by a series of directory + * access checks. Otherwise, virtual + * filesystems which do implement it need only + * respond with a positive return result if + * the dirName is a valid directory in their + * filesystem. They need not remember the + * result, since that will be automatically + * remembered for use by GetCwd. Real + * filesystems should carry out the correct + * action (i.e. call the correct system + * 'chdir' api). If not implemented, then 'cd' + * and 'pwd' will fail inside the + * filesystem. */ +} Tcl_Filesystem; + +/* + * The following definitions are used as values for the 'linkAction' flag to + * Tcl_FSLink, or the linkProc of any filesystem. Any combination of flags can + * be given. For link creation, the linkProc should create a link which + * matches any of the types given. + * + * TCL_CREATE_SYMBOLIC_LINK - Create a symbolic or soft link. + * TCL_CREATE_HARD_LINK - Create a hard link. + */ + +#define TCL_CREATE_SYMBOLIC_LINK 0x01 +#define TCL_CREATE_HARD_LINK 0x02 + +/* + *---------------------------------------------------------------------------- + * The following structure represents the Notifier functions that you can + * override with the Tcl_SetNotifier call. + */ + +typedef struct Tcl_NotifierProcs { + Tcl_SetTimerProc* setTimerProc; + Tcl_WaitForEventProc* waitForEventProc; + Tcl_CreateFileHandlerProc* createFileHandlerProc; + Tcl_DeleteFileHandlerProc* deleteFileHandlerProc; + Tcl_InitNotifierProc* initNotifierProc; + Tcl_FinalizeNotifierProc* finalizeNotifierProc; + Tcl_AlertNotifierProc* alertNotifierProc; + Tcl_ServiceModeHookProc* serviceModeHookProc; +} Tcl_NotifierProcs; + +/* + *---------------------------------------------------------------------------- + * The following data structures and declarations are for the new Tcl parser. + * + * For each word of a command, and for each piece of a word such as a variable + * reference, one of the following structures is created to describe the + * token. + */ + +typedef struct Tcl_Token { + int type; /* Type of token, such as TCL_TOKEN_WORD; see + * below for valid types. */ + const char* start; /* First character in token. */ + int size; /* Number of bytes in token. */ + int numComponents; /* If this token is composed of other tokens, + * this field tells how many of them there are + * (including components of components, etc.). + * The component tokens immediately follow + * this one. */ +} Tcl_Token; + +/* + * Type values defined for Tcl_Token structures. These values are defined as + * mask bits so that it's easy to check for collections of types. + * + * TCL_TOKEN_WORD - The token describes one word of a command, + * from the first non-blank character of the word + * (which may be " or {) up to but not including + * the space, semicolon, or bracket that + * terminates the word. NumComponents counts the + * total number of sub-tokens that make up the + * word. This includes, for example, sub-tokens + * of TCL_TOKEN_VARIABLE tokens. + * TCL_TOKEN_SIMPLE_WORD - This token is just like TCL_TOKEN_WORD except + * that the word is guaranteed to consist of a + * single TCL_TOKEN_TEXT sub-token. + * TCL_TOKEN_TEXT - The token describes a range of literal text + * that is part of a word. NumComponents is + * always 0. + * TCL_TOKEN_BS - The token describes a backslash sequence that + * must be collapsed. NumComponents is always 0. + * TCL_TOKEN_COMMAND - The token describes a command whose result + * must be substituted into the word. The token + * includes the enclosing brackets. NumComponents + * is always 0. + * TCL_TOKEN_VARIABLE - The token describes a variable substitution, + * including the dollar sign, variable name, and + * array index (if there is one) up through the + * right parentheses. NumComponents tells how + * many additional tokens follow to represent the + * variable name. The first token will be a + * TCL_TOKEN_TEXT token that describes the + * variable name. If the variable is an array + * reference then there will be one or more + * additional tokens, of type TCL_TOKEN_TEXT, + * TCL_TOKEN_BS, TCL_TOKEN_COMMAND, and + * TCL_TOKEN_VARIABLE, that describe the array + * index; numComponents counts the total number + * of nested tokens that make up the variable + * reference, including sub-tokens of + * TCL_TOKEN_VARIABLE tokens. + * TCL_TOKEN_SUB_EXPR - The token describes one subexpression of an + * expression, from the first non-blank character + * of the subexpression up to but not including + * the space, brace, or bracket that terminates + * the subexpression. NumComponents counts the + * total number of following subtokens that make + * up the subexpression; this includes all + * subtokens for any nested TCL_TOKEN_SUB_EXPR + * tokens. For example, a numeric value used as a + * primitive operand is described by a + * TCL_TOKEN_SUB_EXPR token followed by a + * TCL_TOKEN_TEXT token. A binary subexpression + * is described by a TCL_TOKEN_SUB_EXPR token + * followed by the TCL_TOKEN_OPERATOR token for + * the operator, then TCL_TOKEN_SUB_EXPR tokens + * for the left then the right operands. + * TCL_TOKEN_OPERATOR - The token describes one expression operator. + * An operator might be the name of a math + * function such as "abs". A TCL_TOKEN_OPERATOR + * token is always preceeded by one + * TCL_TOKEN_SUB_EXPR token for the operator's + * subexpression, and is followed by zero or more + * TCL_TOKEN_SUB_EXPR tokens for the operator's + * operands. NumComponents is always 0. + * TCL_TOKEN_EXPAND_WORD - This token is just like TCL_TOKEN_WORD except + * that it marks a word that began with the + * literal character prefix "{*}". This word is + * marked to be expanded - that is, broken into + * words after substitution is complete. + */ + +#define TCL_TOKEN_WORD 1 +#define TCL_TOKEN_SIMPLE_WORD 2 +#define TCL_TOKEN_TEXT 4 +#define TCL_TOKEN_BS 8 +#define TCL_TOKEN_COMMAND 16 +#define TCL_TOKEN_VARIABLE 32 +#define TCL_TOKEN_SUB_EXPR 64 +#define TCL_TOKEN_OPERATOR 128 +#define TCL_TOKEN_EXPAND_WORD 256 + +/* + * Parsing error types. On any parsing error, one of these values will be + * stored in the error field of the Tcl_Parse structure defined below. + */ + +#define TCL_PARSE_SUCCESS 0 +#define TCL_PARSE_QUOTE_EXTRA 1 +#define TCL_PARSE_BRACE_EXTRA 2 +#define TCL_PARSE_MISSING_BRACE 3 +#define TCL_PARSE_MISSING_BRACKET 4 +#define TCL_PARSE_MISSING_PAREN 5 +#define TCL_PARSE_MISSING_QUOTE 6 +#define TCL_PARSE_MISSING_VAR_BRACE 7 +#define TCL_PARSE_SYNTAX 8 +#define TCL_PARSE_BAD_NUMBER 9 + +/* + * A structure of the following type is filled in by Tcl_ParseCommand. It + * describes a single command parsed from an input string. + */ + +#define NUM_STATIC_TOKENS 20 + +typedef struct Tcl_Parse { + const char* commentStart; /* Pointer to # that begins the first of one + * or more comments preceding the command. */ + int commentSize; /* Number of bytes in comments (up through + * newline character that terminates the last + * comment). If there were no comments, this + * field is 0. */ + const char* commandStart; /* First character in first word of + * command. */ + int commandSize; /* Number of bytes in command, including first + * character of first word, up through the + * terminating newline, close bracket, or + * semicolon. */ + int numWords; /* Total number of words in command. May be + * 0. */ + Tcl_Token* tokenPtr; /* Pointer to first token representing the + * words of the command. Initially points to + * staticTokens, but may change to point to + * malloc-ed space if command exceeds space in + * staticTokens. */ + int numTokens; /* Total number of tokens in command. */ + int tokensAvailable; /* Total number of tokens available at + * *tokenPtr. */ + int errorType; /* One of the parsing error types defined + * above. */ + + /* + * The fields below are intended only for the private use of the parser. + * They should not be used by functions that invoke Tcl_ParseCommand. + */ + + const char* string; /* The original command string passed to + * Tcl_ParseCommand. */ + const char* end; /* Points to the character just after the last + * one in the command string. */ + Tcl_Interp* interp; /* Interpreter to use for error reporting, or + * NULL. */ + const char* term; /* Points to character in string that + * terminated most recent token. Filled in by + * ParseTokens. If an error occurs, points to + * beginning of region where the error + * occurred (e.g. the open brace if the close + * brace is missing). */ + int incomplete; /* This field is set to 1 by Tcl_ParseCommand + * if the command appears to be incomplete. + * This information is used by + * Tcl_CommandComplete. */ + Tcl_Token staticTokens[NUM_STATIC_TOKENS]; + /* Initial space for tokens for command. This + * space should be large enough to accommodate + * most commands; dynamic space is allocated + * for very large commands that don't fit + * here. */ +} Tcl_Parse; + +/* + *---------------------------------------------------------------------------- + * The following structure represents a user-defined encoding. It collects + * together all the functions that are used by the specific encoding. + */ + +typedef struct Tcl_EncodingType { + const char* encodingName; /* The name of the encoding, e.g. "euc-jp". + * This name is the unique key for this + * encoding type. */ + Tcl_EncodingConvertProc* toUtfProc; + /* Function to convert from external encoding + * into UTF-8. */ + Tcl_EncodingConvertProc* fromUtfProc; + /* Function to convert from UTF-8 into + * external encoding. */ + Tcl_EncodingFreeProc* freeProc; + /* If non-NULL, function to call when this + * encoding is deleted. */ + ClientData clientData; /* Arbitrary value associated with encoding + * type. Passed to conversion functions. */ + int nullSize; /* Number of zero bytes that signify + * end-of-string in this encoding. This number + * is used to determine the source string + * length when the srcLen argument is + * negative. Must be 1 or 2. */ +} Tcl_EncodingType; + +/* + * The following definitions are used as values for the conversion control + * flags argument when converting text from one character set to another: + * + * TCL_ENCODING_START - Signifies that the source buffer is the first + * block in a (potentially multi-block) input + * stream. Tells the conversion function to reset + * to an initial state and perform any + * initialization that needs to occur before the + * first byte is converted. If the source buffer + * contains the entire input stream to be + * converted, this flag should be set. + * TCL_ENCODING_END - Signifies that the source buffer is the last + * block in a (potentially multi-block) input + * stream. Tells the conversion routine to + * perform any finalization that needs to occur + * after the last byte is converted and then to + * reset to an initial state. If the source + * buffer contains the entire input stream to be + * converted, this flag should be set. + * TCL_ENCODING_STOPONERROR - If set, then the converter will return + * immediately upon encountering an invalid byte + * sequence or a source character that has no + * mapping in the target encoding. If clear, then + * the converter will skip the problem, + * substituting one or more "close" characters in + * the destination buffer and then continue to + * convert the source. + * TCL_ENCODING_NO_TERMINATE - If set, Tcl_ExternalToUtf will not append a + * terminating NUL byte. Knowing that it will + * not need space to do so, it will fill all + * dstLen bytes with encoded UTF-8 content, as + * other circumstances permit. If clear, the + * default behavior is to reserve a byte in + * the dst space for NUL termination, and to + * append the NUL byte. + * TCL_ENCODING_CHAR_LIMIT - If set and dstCharsPtr is not NULL, then + * Tcl_ExternalToUtf takes the initial value + * of *dstCharsPtr is taken as a limit of the + * maximum number of chars to produce in the + * encoded UTF-8 content. Otherwise, the + * number of chars produced is controlled only + * by other limiting factors. + */ + +#define TCL_ENCODING_START 0x01 +#define TCL_ENCODING_END 0x02 +#define TCL_ENCODING_STOPONERROR 0x04 +#define TCL_ENCODING_NO_TERMINATE 0x08 +#define TCL_ENCODING_CHAR_LIMIT 0x10 + +/* + * The following definitions are the error codes returned by the conversion + * routines: + * + * TCL_OK - All characters were converted. + * TCL_CONVERT_NOSPACE - The output buffer would not have been large + * enough for all of the converted data; as many + * characters as could fit were converted though. + * TCL_CONVERT_MULTIBYTE - The last few bytes in the source string were + * the beginning of a multibyte sequence, but + * more bytes were needed to complete this + * sequence. A subsequent call to the conversion + * routine should pass the beginning of this + * unconverted sequence plus additional bytes + * from the source stream to properly convert the + * formerly split-up multibyte sequence. + * TCL_CONVERT_SYNTAX - The source stream contained an invalid + * character sequence. This may occur if the + * input stream has been damaged or if the input + * encoding method was misidentified. This error + * is reported only if TCL_ENCODING_STOPONERROR + * was specified. + * TCL_CONVERT_UNKNOWN - The source string contained a character that + * could not be represented in the target + * encoding. This error is reported only if + * TCL_ENCODING_STOPONERROR was specified. + */ + +#define TCL_CONVERT_MULTIBYTE (-1) +#define TCL_CONVERT_SYNTAX (-2) +#define TCL_CONVERT_UNKNOWN (-3) +#define TCL_CONVERT_NOSPACE (-4) + +/* + * The maximum number of bytes that are necessary to represent a single + * Unicode character in UTF-8. The valid values should be 3, 4 or 6 + * (or perhaps 1 if we want to support a non-unicode enabled core). If 3 or + * 4, then Tcl_UniChar must be 2-bytes in size (UCS-2) (the default). If 6, + * then Tcl_UniChar must be 4-bytes in size (UCS-4). At this time UCS-2 mode + * is the default and recommended mode. UCS-4 is experimental and not + * recommended. It works for the core, but most extensions expect UCS-2. + */ + +#ifndef TCL_UTF_MAX +#define TCL_UTF_MAX 3 +#endif + +/* + * This represents a Unicode character. Any changes to this should also be + * reflected in regcustom.h. + */ + +#if TCL_UTF_MAX > 4 +/* + * unsigned int isn't 100% accurate as it should be a strict 4-byte value + * (perhaps wchar_t). 64-bit systems may have troubles. The size of this + * value must be reflected correctly in regcustom.h and + * in tclEncoding.c. + * XXX: Tcl is currently UCS-2 and planning UTF-16 for the Unicode + * XXX: string rep that Tcl_UniChar represents. Changing the size + * XXX: of Tcl_UniChar is /not/ supported. + */ +typedef unsigned int Tcl_UniChar; +#else +typedef unsigned short Tcl_UniChar; +#endif + +/* + *---------------------------------------------------------------------------- + * TIP #59: The following structure is used in calls 'Tcl_RegisterConfig' to + * provide the system with the embedded configuration data. + */ + +typedef struct Tcl_Config { + const char* key; /* Configuration key to register. ASCII + * encoded, thus UTF-8. */ + const char* value; /* The value associated with the key. System + * encoding. */ +} Tcl_Config; + +/* + *---------------------------------------------------------------------------- + * Flags for TIP#143 limits, detailing which limits are active in an + * interpreter. Used for Tcl_{Add,Remove}LimitHandler type argument. + */ + +#define TCL_LIMIT_COMMANDS 0x01 +#define TCL_LIMIT_TIME 0x02 + +/* + * Structure containing information about a limit handler to be called when a + * command- or time-limit is exceeded by an interpreter. + */ + +typedef void(Tcl_LimitHandlerProc)(ClientData clientData, Tcl_Interp* interp); +typedef void(Tcl_LimitHandlerDeleteProc)(ClientData clientData); + +/* + *---------------------------------------------------------------------------- + * Override definitions for libtommath. + */ + +typedef struct mp_int mp_int; +#define MP_INT_DECLARED +typedef unsigned int mp_digit; +#define MP_DIGIT_DECLARED + +/* + *---------------------------------------------------------------------------- + * Definitions needed for Tcl_ParseArgvObj routines. + * Based on tkArgv.c. + * Modifications from the original are copyright (c) Sam Bromley 2006 + */ + +typedef struct { + int type; /* Indicates the option type; see below. */ + const char* keyStr; /* The key string that flags the option in the + * argv array. */ + void* srcPtr; /* Value to be used in setting dst; usage + * depends on type.*/ + void* dstPtr; /* Address of value to be modified; usage + * depends on type.*/ + const char* helpStr; /* Documentation message describing this + * option. */ + ClientData clientData; /* Word to pass to function callbacks. */ +} Tcl_ArgvInfo; + +/* + * Legal values for the type field of a Tcl_ArgInfo: see the user + * documentation for details. + */ + +#define TCL_ARGV_CONSTANT 15 +#define TCL_ARGV_INT 16 +#define TCL_ARGV_STRING 17 +#define TCL_ARGV_REST 18 +#define TCL_ARGV_FLOAT 19 +#define TCL_ARGV_FUNC 20 +#define TCL_ARGV_GENFUNC 21 +#define TCL_ARGV_HELP 22 +#define TCL_ARGV_END 23 + +/* + * Types of callback functions for the TCL_ARGV_FUNC and TCL_ARGV_GENFUNC + * argument types: + */ + +typedef int( + Tcl_ArgvFuncProc)(ClientData clientData, Tcl_Obj* objPtr, void* dstPtr); +typedef int(Tcl_ArgvGenFuncProc)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const* objv, + void* dstPtr); + +/* + * Shorthand for commonly used argTable entries. + */ + +#define TCL_ARGV_AUTO_HELP \ + { \ + TCL_ARGV_HELP, "-help", NULL, NULL, \ + "Print summary of command-line options and abort", NULL \ + } +#define TCL_ARGV_AUTO_REST \ + { TCL_ARGV_REST, "--", NULL, NULL, "Marks the end of the options", NULL } +#define TCL_ARGV_TABLE_END \ + { TCL_ARGV_END, NULL, NULL, NULL, NULL, NULL } + +/* + *---------------------------------------------------------------------------- + * Definitions needed for Tcl_Zlib routines. [TIP #234] + * + * Constants for the format flags describing what sort of data format is + * desired/expected for the Tcl_ZlibDeflate, Tcl_ZlibInflate and + * Tcl_ZlibStreamInit functions. + */ + +#define TCL_ZLIB_FORMAT_RAW 1 +#define TCL_ZLIB_FORMAT_ZLIB 2 +#define TCL_ZLIB_FORMAT_GZIP 4 +#define TCL_ZLIB_FORMAT_AUTO 8 + +/* + * Constants that describe whether the stream is to operate in compressing or + * decompressing mode. + */ + +#define TCL_ZLIB_STREAM_DEFLATE 16 +#define TCL_ZLIB_STREAM_INFLATE 32 + +/* + * Constants giving compression levels. Use of TCL_ZLIB_COMPRESS_DEFAULT is + * recommended. + */ + +#define TCL_ZLIB_COMPRESS_NONE 0 +#define TCL_ZLIB_COMPRESS_FAST 1 +#define TCL_ZLIB_COMPRESS_BEST 9 +#define TCL_ZLIB_COMPRESS_DEFAULT (-1) + +/* + * Constants for types of flushing, used with Tcl_ZlibFlush. + */ + +#define TCL_ZLIB_NO_FLUSH 0 +#define TCL_ZLIB_FLUSH 2 +#define TCL_ZLIB_FULLFLUSH 3 +#define TCL_ZLIB_FINALIZE 4 + +/* + *---------------------------------------------------------------------------- + * Definitions needed for the Tcl_LoadFile function. [TIP #416] + */ + +#define TCL_LOAD_GLOBAL 1 +#define TCL_LOAD_LAZY 2 + +/* + *---------------------------------------------------------------------------- + * Single public declaration for NRE. + */ + +typedef int(Tcl_NRPostProc)(ClientData data[], Tcl_Interp* interp, int result); + +/* + *---------------------------------------------------------------------------- + * The following constant is used to test for older versions of Tcl in the + * stubs tables. + * + * Jan Nijtman's plus patch uses 0xFCA1BACF, so we need to pick a different + * value since the stubs tables don't match. + */ + +#define TCL_STUB_MAGIC ((int)0xFCA3BACF) + +/* + * The following function is required to be defined in all stubs aware + * extensions. The function is actually implemented in the stub library, not + * the main Tcl library, although there is a trivial implementation in the + * main library in case an extension is statically linked into an application. + */ + +const char* Tcl_InitStubs(Tcl_Interp* interp, const char* version, int exact); +const char* TclTomMathInitializeStubs( + Tcl_Interp* interp, + const char* version, + int epoch, + int revision); + +/* + * When not using stubs, make it a macro. + */ + +#ifndef USE_TCL_STUBS +#define Tcl_InitStubs(interp, version, exact) \ + Tcl_PkgInitStubsCheck(interp, version, exact) +#endif + +/* + * TODO - tommath stubs export goes here! + */ + +/* + * Public functions that are not accessible via the stubs table. + * Tcl_GetMemoryInfo is needed for AOLserver. [Bug 1868171] + */ + +#define Tcl_Main(argc, argv, proc) \ + Tcl_MainEx(argc, argv, proc, ((Tcl_CreateInterp)())) +EXTERN void Tcl_MainEx( + int argc, + char** argv, + Tcl_AppInitProc* appInitProc, + Tcl_Interp* interp); +EXTERN const char* +Tcl_PkgInitStubsCheck(Tcl_Interp* interp, const char* version, int exact); +EXTERN void Tcl_GetMemoryInfo(Tcl_DString* dsPtr); + +/* + *---------------------------------------------------------------------------- + * Include the public function declarations that are accessible via the stubs + * table. + */ + +#include "tclDecls.h" + +/* + * Include platform specific public function declarations that are accessible + * via the stubs table. Make all TclOO symbols MODULE_SCOPE (which only + * has effect on building it as a shared library). See ticket [3010352]. + */ + +#if defined(BUILD_tcl) +#undef TCLAPI +#define TCLAPI MODULE_SCOPE +#endif + +#include "tclPlatDecls.h" + +/* + *---------------------------------------------------------------------------- + * The following declarations either map ckalloc and ckfree to malloc and + * free, or they map them to functions with all sorts of debugging hooks + * defined in tclCkalloc.c. + */ + +#ifdef TCL_MEM_DEBUG + +#define ckalloc(x) ((void*)Tcl_DbCkalloc((unsigned)(x), __FILE__, __LINE__)) +#define ckfree(x) Tcl_DbCkfree((char*)(x), __FILE__, __LINE__) +#define ckrealloc(x, y) \ + ((void*)Tcl_DbCkrealloc((char*)(x), (unsigned)(y), __FILE__, __LINE__)) +#define attemptckalloc(x) \ + ((void*)Tcl_AttemptDbCkalloc((unsigned)(x), __FILE__, __LINE__)) +#define attemptckrealloc(x, y) \ + ((void*)Tcl_AttemptDbCkrealloc((char*)(x), (unsigned)(y), __FILE__, __LINE__)) + +#else /* !TCL_MEM_DEBUG */ + +/* + * If we are not using the debugging allocator, we should call the Tcl_Alloc, + * et al. routines in order to guarantee that every module is using the same + * memory allocator both inside and outside of the Tcl library. + */ + +#define ckalloc(x) ((void*)Tcl_Alloc((unsigned)(x))) +#define ckfree(x) Tcl_Free((char*)(x)) +#define ckrealloc(x, y) ((void*)Tcl_Realloc((char*)(x), (unsigned)(y))) +#define attemptckalloc(x) ((void*)Tcl_AttemptAlloc((unsigned)(x))) +#define attemptckrealloc(x, y) \ + ((void*)Tcl_AttemptRealloc((char*)(x), (unsigned)(y))) +#undef Tcl_InitMemory +#define Tcl_InitMemory(x) +#undef Tcl_DumpActiveMemory +#define Tcl_DumpActiveMemory(x) +#undef Tcl_ValidateAllMemory +#define Tcl_ValidateAllMemory(x, y) + +#endif /* !TCL_MEM_DEBUG */ + +#ifdef TCL_MEM_DEBUG +#define Tcl_IncrRefCount(objPtr) Tcl_DbIncrRefCount(objPtr, __FILE__, __LINE__) +#define Tcl_DecrRefCount(objPtr) Tcl_DbDecrRefCount(objPtr, __FILE__, __LINE__) +#define Tcl_IsShared(objPtr) Tcl_DbIsShared(objPtr, __FILE__, __LINE__) +#else +#define Tcl_IncrRefCount(objPtr) ++(objPtr)->refCount +/* + * Use do/while0 idiom for optimum correctness without compiler warnings. + * http://c2.com/cgi/wiki?TrivialDoWhileLoop + */ +#define Tcl_DecrRefCount(objPtr) \ + do { \ + Tcl_Obj* _objPtr = (objPtr); \ + if ((_objPtr)->refCount-- <= 1) { \ + TclFreeObj(_objPtr); \ + } \ + } while (0) +#define Tcl_IsShared(objPtr) ((objPtr)->refCount > 1) +#endif + +/* + * Macros and definitions that help to debug the use of Tcl objects. When + * TCL_MEM_DEBUG is defined, the Tcl_New declarations are overridden to call + * debugging versions of the object creation functions. + */ + +#ifdef TCL_MEM_DEBUG +#undef Tcl_NewBignumObj +#define Tcl_NewBignumObj(val) Tcl_DbNewBignumObj(val, __FILE__, __LINE__) +#undef Tcl_NewBooleanObj +#define Tcl_NewBooleanObj(val) Tcl_DbNewBooleanObj(val, __FILE__, __LINE__) +#undef Tcl_NewByteArrayObj +#define Tcl_NewByteArrayObj(bytes, len) \ + Tcl_DbNewByteArrayObj(bytes, len, __FILE__, __LINE__) +#undef Tcl_NewDoubleObj +#define Tcl_NewDoubleObj(val) Tcl_DbNewDoubleObj(val, __FILE__, __LINE__) +#undef Tcl_NewIntObj +#define Tcl_NewIntObj(val) Tcl_DbNewLongObj(val, __FILE__, __LINE__) +#undef Tcl_NewListObj +#define Tcl_NewListObj(objc, objv) \ + Tcl_DbNewListObj(objc, objv, __FILE__, __LINE__) +#undef Tcl_NewLongObj +#define Tcl_NewLongObj(val) Tcl_DbNewLongObj(val, __FILE__, __LINE__) +#undef Tcl_NewObj +#define Tcl_NewObj() Tcl_DbNewObj(__FILE__, __LINE__) +#undef Tcl_NewStringObj +#define Tcl_NewStringObj(bytes, len) \ + Tcl_DbNewStringObj(bytes, len, __FILE__, __LINE__) +#undef Tcl_NewWideIntObj +#define Tcl_NewWideIntObj(val) Tcl_DbNewWideIntObj(val, __FILE__, __LINE__) +#endif /* TCL_MEM_DEBUG */ + +/* + *---------------------------------------------------------------------------- + * Macros for clients to use to access fields of hash entries: + */ + +#define Tcl_GetHashValue(h) ((h)->clientData) +#define Tcl_SetHashValue(h, value) ((h)->clientData = (ClientData)(value)) +#define Tcl_GetHashKey(tablePtr, h) \ + ((void *) (((tablePtr)->keyType == TCL_ONE_WORD_KEYS || \ + (tablePtr)->keyType == TCL_CUSTOM_PTR_KEYS) \ + ? (h)->key.oneWordValue \ + : (h)->key.string)) + +/* + * Macros to use for clients to use to invoke find and create functions for + * hash tables: + */ + +#undef Tcl_FindHashEntry +#define Tcl_FindHashEntry(tablePtr, key) \ + (*((tablePtr)->findProc))(tablePtr, (const char*)(key)) +#undef Tcl_CreateHashEntry +#define Tcl_CreateHashEntry(tablePtr, key, newPtr) \ + (*((tablePtr)->createProc))(tablePtr, (const char*)(key), newPtr) + +/* + *---------------------------------------------------------------------------- + * Macros that eliminate the overhead of the thread synchronization functions + * when compiling without thread support. + */ + +#ifndef TCL_THREADS +#undef Tcl_MutexLock +#define Tcl_MutexLock(mutexPtr) +#undef Tcl_MutexUnlock +#define Tcl_MutexUnlock(mutexPtr) +#undef Tcl_MutexFinalize +#define Tcl_MutexFinalize(mutexPtr) +#undef Tcl_ConditionNotify +#define Tcl_ConditionNotify(condPtr) +#undef Tcl_ConditionWait +#define Tcl_ConditionWait(condPtr, mutexPtr, timePtr) +#undef Tcl_ConditionFinalize +#define Tcl_ConditionFinalize(condPtr) +#endif /* TCL_THREADS */ + +/* + *---------------------------------------------------------------------------- + * Deprecated Tcl functions: + */ + +#ifndef TCL_NO_DEPRECATED +/* + * These function have been renamed. The old names are deprecated, but we + * define these macros for backwards compatibilty. + */ + +#define Tcl_Ckalloc Tcl_Alloc +#define Tcl_Ckfree Tcl_Free +#define Tcl_Ckrealloc Tcl_Realloc +#define Tcl_Return Tcl_SetResult +#define Tcl_TildeSubst Tcl_TranslateFileName +#if !defined(__APPLE__) /* On OSX, there is a conflict with "mach/mach.h" */ +#define panic Tcl_Panic +#endif +#define panicVA Tcl_PanicVA +#endif /* !TCL_NO_DEPRECATED */ + +/* + *---------------------------------------------------------------------------- + * Convenience declaration of Tcl_AppInit for backwards compatibility. This + * function is not *implemented* by the tcl library, so the storage class is + * neither DLLEXPORT nor DLLIMPORT. + */ + +extern Tcl_AppInitProc Tcl_AppInit; + +#endif /* RC_INVOKED */ + +/* + * end block for C++ + */ + +#ifdef __cplusplus +} +#endif + +#endif /* _TCL */ + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tclDecls.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tclDecls.h new file mode 100644 index 0000000..2109851 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tclDecls.h @@ -0,0 +1,4649 @@ +/* + * tclDecls.h -- + * + * Declarations of functions in the platform independent public Tcl API. + * + * Copyright (c) 1998-1999 by Scriptics Corporation. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TCLDECLS +#define _TCLDECLS + +#undef TCL_STORAGE_CLASS +#ifdef BUILD_tcl +#define TCL_STORAGE_CLASS DLLEXPORT +#else +#ifdef USE_TCL_STUBS +#define TCL_STORAGE_CLASS +#else +#define TCL_STORAGE_CLASS DLLIMPORT +#endif +#endif + +/* + * WARNING: This file is automatically generated by the tools/genStubs.tcl + * script. Any modifications to the function declarations below should be made + * in the generic/tcl.decls script. + */ + +/* !BEGIN!: Do not edit below this line. */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Exported function declarations: + */ + +/* 0 */ +EXTERN int Tcl_PkgProvideEx( + Tcl_Interp* interp, + const char* name, + const char* version, + const void* clientData); +/* 1 */ +EXTERN CONST84_RETURN char* Tcl_PkgRequireEx( + Tcl_Interp* interp, + const char* name, + const char* version, + int exact, + void* clientDataPtr); +/* 2 */ +EXTERN TCL_NORETURN void Tcl_Panic(const char* format, ...) + TCL_FORMAT_PRINTF(1, 2); +/* 3 */ +EXTERN char* Tcl_Alloc(unsigned int size); +/* 4 */ +EXTERN void Tcl_Free(char* ptr); +/* 5 */ +EXTERN char* Tcl_Realloc(char* ptr, unsigned int size); +/* 6 */ +EXTERN char* Tcl_DbCkalloc(unsigned int size, const char* file, int line); +/* 7 */ +EXTERN void Tcl_DbCkfree(char* ptr, const char* file, int line); +/* 8 */ +EXTERN char* +Tcl_DbCkrealloc(char* ptr, unsigned int size, const char* file, int line); +#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */ +/* 9 */ +EXTERN void Tcl_CreateFileHandler( + int fd, + int mask, + Tcl_FileProc* proc, + ClientData clientData); +#endif /* UNIX */ +#ifdef MAC_OSX_TCL /* MACOSX */ +/* 9 */ +EXTERN void Tcl_CreateFileHandler( + int fd, + int mask, + Tcl_FileProc* proc, + ClientData clientData); +#endif /* MACOSX */ +#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */ +/* 10 */ +EXTERN void Tcl_DeleteFileHandler(int fd); +#endif /* UNIX */ +#ifdef MAC_OSX_TCL /* MACOSX */ +/* 10 */ +EXTERN void Tcl_DeleteFileHandler(int fd); +#endif /* MACOSX */ +/* 11 */ +EXTERN void Tcl_SetTimer(const Tcl_Time* timePtr); +/* 12 */ +EXTERN void Tcl_Sleep(int ms); +/* 13 */ +EXTERN int Tcl_WaitForEvent(const Tcl_Time* timePtr); +/* 14 */ +EXTERN int Tcl_AppendAllObjTypes(Tcl_Interp* interp, Tcl_Obj* objPtr); +/* 15 */ +EXTERN void Tcl_AppendStringsToObj(Tcl_Obj* objPtr, ...); +/* 16 */ +EXTERN void Tcl_AppendToObj(Tcl_Obj* objPtr, const char* bytes, int length); +/* 17 */ +EXTERN Tcl_Obj* Tcl_ConcatObj(int objc, Tcl_Obj* const objv[]); +/* 18 */ +EXTERN int Tcl_ConvertToType( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + const Tcl_ObjType* typePtr); +/* 19 */ +EXTERN void Tcl_DbDecrRefCount(Tcl_Obj* objPtr, const char* file, int line); +/* 20 */ +EXTERN void Tcl_DbIncrRefCount(Tcl_Obj* objPtr, const char* file, int line); +/* 21 */ +EXTERN int Tcl_DbIsShared(Tcl_Obj* objPtr, const char* file, int line); +/* 22 */ +EXTERN Tcl_Obj* Tcl_DbNewBooleanObj(int boolValue, const char* file, int line); +/* 23 */ +EXTERN Tcl_Obj* Tcl_DbNewByteArrayObj( + const unsigned char* bytes, + int length, + const char* file, + int line); +/* 24 */ +EXTERN Tcl_Obj* +Tcl_DbNewDoubleObj(double doubleValue, const char* file, int line); +/* 25 */ +EXTERN Tcl_Obj* +Tcl_DbNewListObj(int objc, Tcl_Obj* const* objv, const char* file, int line); +/* 26 */ +EXTERN Tcl_Obj* Tcl_DbNewLongObj(long longValue, const char* file, int line); +/* 27 */ +EXTERN Tcl_Obj* Tcl_DbNewObj(const char* file, int line); +/* 28 */ +EXTERN Tcl_Obj* +Tcl_DbNewStringObj(const char* bytes, int length, const char* file, int line); +/* 29 */ +EXTERN Tcl_Obj* Tcl_DuplicateObj(Tcl_Obj* objPtr); +/* 30 */ +EXTERN void TclFreeObj(Tcl_Obj* objPtr); +/* 31 */ +EXTERN int Tcl_GetBoolean(Tcl_Interp* interp, const char* src, int* boolPtr); +/* 32 */ +EXTERN int +Tcl_GetBooleanFromObj(Tcl_Interp* interp, Tcl_Obj* objPtr, int* boolPtr); +/* 33 */ +EXTERN unsigned char* Tcl_GetByteArrayFromObj(Tcl_Obj* objPtr, int* lengthPtr); +/* 34 */ +EXTERN int +Tcl_GetDouble(Tcl_Interp* interp, const char* src, double* doublePtr); +/* 35 */ +EXTERN int +Tcl_GetDoubleFromObj(Tcl_Interp* interp, Tcl_Obj* objPtr, double* doublePtr); +/* 36 */ +EXTERN int Tcl_GetIndexFromObj( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + CONST84 char* const* tablePtr, + const char* msg, + int flags, + int* indexPtr); +/* 37 */ +EXTERN int Tcl_GetInt(Tcl_Interp* interp, const char* src, int* intPtr); +/* 38 */ +EXTERN int Tcl_GetIntFromObj(Tcl_Interp* interp, Tcl_Obj* objPtr, int* intPtr); +/* 39 */ +EXTERN int +Tcl_GetLongFromObj(Tcl_Interp* interp, Tcl_Obj* objPtr, long* longPtr); +/* 40 */ +EXTERN CONST86 Tcl_ObjType* Tcl_GetObjType(const char* typeName); +/* 41 */ +EXTERN char* Tcl_GetStringFromObj(Tcl_Obj* objPtr, int* lengthPtr); +/* 42 */ +EXTERN void Tcl_InvalidateStringRep(Tcl_Obj* objPtr); +/* 43 */ +EXTERN int Tcl_ListObjAppendList( + Tcl_Interp* interp, + Tcl_Obj* listPtr, + Tcl_Obj* elemListPtr); +/* 44 */ +EXTERN int +Tcl_ListObjAppendElement(Tcl_Interp* interp, Tcl_Obj* listPtr, Tcl_Obj* objPtr); +/* 45 */ +EXTERN int Tcl_ListObjGetElements( + Tcl_Interp* interp, + Tcl_Obj* listPtr, + int* objcPtr, + Tcl_Obj*** objvPtr); +/* 46 */ +EXTERN int Tcl_ListObjIndex( + Tcl_Interp* interp, + Tcl_Obj* listPtr, + int index, + Tcl_Obj** objPtrPtr); +/* 47 */ +EXTERN int +Tcl_ListObjLength(Tcl_Interp* interp, Tcl_Obj* listPtr, int* lengthPtr); +/* 48 */ +EXTERN int Tcl_ListObjReplace( + Tcl_Interp* interp, + Tcl_Obj* listPtr, + int first, + int count, + int objc, + Tcl_Obj* const objv[]); +/* 49 */ +EXTERN Tcl_Obj* Tcl_NewBooleanObj(int boolValue); +/* 50 */ +EXTERN Tcl_Obj* Tcl_NewByteArrayObj(const unsigned char* bytes, int length); +/* 51 */ +EXTERN Tcl_Obj* Tcl_NewDoubleObj(double doubleValue); +/* 52 */ +EXTERN Tcl_Obj* Tcl_NewIntObj(int intValue); +/* 53 */ +EXTERN Tcl_Obj* Tcl_NewListObj(int objc, Tcl_Obj* const objv[]); +/* 54 */ +EXTERN Tcl_Obj* Tcl_NewLongObj(long longValue); +/* 55 */ +EXTERN Tcl_Obj* Tcl_NewObj(void); +/* 56 */ +EXTERN Tcl_Obj* Tcl_NewStringObj(const char* bytes, int length); +/* 57 */ +EXTERN void Tcl_SetBooleanObj(Tcl_Obj* objPtr, int boolValue); +/* 58 */ +EXTERN unsigned char* Tcl_SetByteArrayLength(Tcl_Obj* objPtr, int length); +/* 59 */ +EXTERN void +Tcl_SetByteArrayObj(Tcl_Obj* objPtr, const unsigned char* bytes, int length); +/* 60 */ +EXTERN void Tcl_SetDoubleObj(Tcl_Obj* objPtr, double doubleValue); +/* 61 */ +EXTERN void Tcl_SetIntObj(Tcl_Obj* objPtr, int intValue); +/* 62 */ +EXTERN void Tcl_SetListObj(Tcl_Obj* objPtr, int objc, Tcl_Obj* const objv[]); +/* 63 */ +EXTERN void Tcl_SetLongObj(Tcl_Obj* objPtr, long longValue); +/* 64 */ +EXTERN void Tcl_SetObjLength(Tcl_Obj* objPtr, int length); +/* 65 */ +EXTERN void Tcl_SetStringObj(Tcl_Obj* objPtr, const char* bytes, int length); +/* 66 */ +EXTERN void Tcl_AddErrorInfo(Tcl_Interp* interp, const char* message); +/* 67 */ +EXTERN void +Tcl_AddObjErrorInfo(Tcl_Interp* interp, const char* message, int length); +/* 68 */ +EXTERN void Tcl_AllowExceptions(Tcl_Interp* interp); +/* 69 */ +EXTERN void Tcl_AppendElement(Tcl_Interp* interp, const char* element); +/* 70 */ +EXTERN void Tcl_AppendResult(Tcl_Interp* interp, ...); +/* 71 */ +EXTERN Tcl_AsyncHandler +Tcl_AsyncCreate(Tcl_AsyncProc* proc, ClientData clientData); +/* 72 */ +EXTERN void Tcl_AsyncDelete(Tcl_AsyncHandler async); +/* 73 */ +EXTERN int Tcl_AsyncInvoke(Tcl_Interp* interp, int code); +/* 74 */ +EXTERN void Tcl_AsyncMark(Tcl_AsyncHandler async); +/* 75 */ +EXTERN int Tcl_AsyncReady(void); +/* 76 */ +EXTERN void Tcl_BackgroundError(Tcl_Interp* interp); +/* 77 */ +EXTERN char Tcl_Backslash(const char* src, int* readPtr); +/* 78 */ +EXTERN int Tcl_BadChannelOption( + Tcl_Interp* interp, + const char* optionName, + const char* optionList); +/* 79 */ +EXTERN void Tcl_CallWhenDeleted( + Tcl_Interp* interp, + Tcl_InterpDeleteProc* proc, + ClientData clientData); +/* 80 */ +EXTERN void Tcl_CancelIdleCall(Tcl_IdleProc* idleProc, ClientData clientData); +/* 81 */ +EXTERN int Tcl_Close(Tcl_Interp* interp, Tcl_Channel chan); +/* 82 */ +EXTERN int Tcl_CommandComplete(const char* cmd); +/* 83 */ +EXTERN char* Tcl_Concat(int argc, CONST84 char* const* argv); +/* 84 */ +EXTERN int Tcl_ConvertElement(const char* src, char* dst, int flags); +/* 85 */ +EXTERN int +Tcl_ConvertCountedElement(const char* src, int length, char* dst, int flags); +/* 86 */ +EXTERN int Tcl_CreateAlias( + Tcl_Interp* slave, + const char* slaveCmd, + Tcl_Interp* target, + const char* targetCmd, + int argc, + CONST84 char* const* argv); +/* 87 */ +EXTERN int Tcl_CreateAliasObj( + Tcl_Interp* slave, + const char* slaveCmd, + Tcl_Interp* target, + const char* targetCmd, + int objc, + Tcl_Obj* const objv[]); +/* 88 */ +EXTERN Tcl_Channel Tcl_CreateChannel( + const Tcl_ChannelType* typePtr, + const char* chanName, + ClientData instanceData, + int mask); +/* 89 */ +EXTERN void Tcl_CreateChannelHandler( + Tcl_Channel chan, + int mask, + Tcl_ChannelProc* proc, + ClientData clientData); +/* 90 */ +EXTERN void Tcl_CreateCloseHandler( + Tcl_Channel chan, + Tcl_CloseProc* proc, + ClientData clientData); +/* 91 */ +EXTERN Tcl_Command Tcl_CreateCommand( + Tcl_Interp* interp, + const char* cmdName, + Tcl_CmdProc* proc, + ClientData clientData, + Tcl_CmdDeleteProc* deleteProc); +/* 92 */ +EXTERN void Tcl_CreateEventSource( + Tcl_EventSetupProc* setupProc, + Tcl_EventCheckProc* checkProc, + ClientData clientData); +/* 93 */ +EXTERN void Tcl_CreateExitHandler(Tcl_ExitProc* proc, ClientData clientData); +/* 94 */ +EXTERN Tcl_Interp* Tcl_CreateInterp(void); +/* 95 */ +EXTERN void Tcl_CreateMathFunc( + Tcl_Interp* interp, + const char* name, + int numArgs, + Tcl_ValueType* argTypes, + Tcl_MathProc* proc, + ClientData clientData); +/* 96 */ +EXTERN Tcl_Command Tcl_CreateObjCommand( + Tcl_Interp* interp, + const char* cmdName, + Tcl_ObjCmdProc* proc, + ClientData clientData, + Tcl_CmdDeleteProc* deleteProc); +/* 97 */ +EXTERN Tcl_Interp* +Tcl_CreateSlave(Tcl_Interp* interp, const char* slaveName, int isSafe); +/* 98 */ +EXTERN Tcl_TimerToken Tcl_CreateTimerHandler( + int milliseconds, + Tcl_TimerProc* proc, + ClientData clientData); +/* 99 */ +EXTERN Tcl_Trace Tcl_CreateTrace( + Tcl_Interp* interp, + int level, + Tcl_CmdTraceProc* proc, + ClientData clientData); +/* 100 */ +EXTERN void Tcl_DeleteAssocData(Tcl_Interp* interp, const char* name); +/* 101 */ +EXTERN void Tcl_DeleteChannelHandler( + Tcl_Channel chan, + Tcl_ChannelProc* proc, + ClientData clientData); +/* 102 */ +EXTERN void Tcl_DeleteCloseHandler( + Tcl_Channel chan, + Tcl_CloseProc* proc, + ClientData clientData); +/* 103 */ +EXTERN int Tcl_DeleteCommand(Tcl_Interp* interp, const char* cmdName); +/* 104 */ +EXTERN int Tcl_DeleteCommandFromToken(Tcl_Interp* interp, Tcl_Command command); +/* 105 */ +EXTERN void Tcl_DeleteEvents(Tcl_EventDeleteProc* proc, ClientData clientData); +/* 106 */ +EXTERN void Tcl_DeleteEventSource( + Tcl_EventSetupProc* setupProc, + Tcl_EventCheckProc* checkProc, + ClientData clientData); +/* 107 */ +EXTERN void Tcl_DeleteExitHandler(Tcl_ExitProc* proc, ClientData clientData); +/* 108 */ +EXTERN void Tcl_DeleteHashEntry(Tcl_HashEntry* entryPtr); +/* 109 */ +EXTERN void Tcl_DeleteHashTable(Tcl_HashTable* tablePtr); +/* 110 */ +EXTERN void Tcl_DeleteInterp(Tcl_Interp* interp); +/* 111 */ +EXTERN void Tcl_DetachPids(int numPids, Tcl_Pid* pidPtr); +/* 112 */ +EXTERN void Tcl_DeleteTimerHandler(Tcl_TimerToken token); +/* 113 */ +EXTERN void Tcl_DeleteTrace(Tcl_Interp* interp, Tcl_Trace trace); +/* 114 */ +EXTERN void Tcl_DontCallWhenDeleted( + Tcl_Interp* interp, + Tcl_InterpDeleteProc* proc, + ClientData clientData); +/* 115 */ +EXTERN int Tcl_DoOneEvent(int flags); +/* 116 */ +EXTERN void Tcl_DoWhenIdle(Tcl_IdleProc* proc, ClientData clientData); +/* 117 */ +EXTERN char* +Tcl_DStringAppend(Tcl_DString* dsPtr, const char* bytes, int length); +/* 118 */ +EXTERN char* Tcl_DStringAppendElement(Tcl_DString* dsPtr, const char* element); +/* 119 */ +EXTERN void Tcl_DStringEndSublist(Tcl_DString* dsPtr); +/* 120 */ +EXTERN void Tcl_DStringFree(Tcl_DString* dsPtr); +/* 121 */ +EXTERN void Tcl_DStringGetResult(Tcl_Interp* interp, Tcl_DString* dsPtr); +/* 122 */ +EXTERN void Tcl_DStringInit(Tcl_DString* dsPtr); +/* 123 */ +EXTERN void Tcl_DStringResult(Tcl_Interp* interp, Tcl_DString* dsPtr); +/* 124 */ +EXTERN void Tcl_DStringSetLength(Tcl_DString* dsPtr, int length); +/* 125 */ +EXTERN void Tcl_DStringStartSublist(Tcl_DString* dsPtr); +/* 126 */ +EXTERN int Tcl_Eof(Tcl_Channel chan); +/* 127 */ +EXTERN CONST84_RETURN char* Tcl_ErrnoId(void); +/* 128 */ +EXTERN CONST84_RETURN char* Tcl_ErrnoMsg(int err); +/* 129 */ +EXTERN int Tcl_Eval(Tcl_Interp* interp, const char* script); +/* 130 */ +EXTERN int Tcl_EvalFile(Tcl_Interp* interp, const char* fileName); +/* 131 */ +EXTERN int Tcl_EvalObj(Tcl_Interp* interp, Tcl_Obj* objPtr); +/* 132 */ +EXTERN void Tcl_EventuallyFree(ClientData clientData, Tcl_FreeProc* freeProc); +/* 133 */ +EXTERN TCL_NORETURN void Tcl_Exit(int status); +/* 134 */ +EXTERN int Tcl_ExposeCommand( + Tcl_Interp* interp, + const char* hiddenCmdToken, + const char* cmdName); +/* 135 */ +EXTERN int Tcl_ExprBoolean(Tcl_Interp* interp, const char* expr, int* ptr); +/* 136 */ +EXTERN int Tcl_ExprBooleanObj(Tcl_Interp* interp, Tcl_Obj* objPtr, int* ptr); +/* 137 */ +EXTERN int Tcl_ExprDouble(Tcl_Interp* interp, const char* expr, double* ptr); +/* 138 */ +EXTERN int Tcl_ExprDoubleObj(Tcl_Interp* interp, Tcl_Obj* objPtr, double* ptr); +/* 139 */ +EXTERN int Tcl_ExprLong(Tcl_Interp* interp, const char* expr, long* ptr); +/* 140 */ +EXTERN int Tcl_ExprLongObj(Tcl_Interp* interp, Tcl_Obj* objPtr, long* ptr); +/* 141 */ +EXTERN int +Tcl_ExprObj(Tcl_Interp* interp, Tcl_Obj* objPtr, Tcl_Obj** resultPtrPtr); +/* 142 */ +EXTERN int Tcl_ExprString(Tcl_Interp* interp, const char* expr); +/* 143 */ +EXTERN void Tcl_Finalize(void); +/* 144 */ +EXTERN void Tcl_FindExecutable(const char* argv0); +/* 145 */ +EXTERN Tcl_HashEntry* Tcl_FirstHashEntry( + Tcl_HashTable* tablePtr, + Tcl_HashSearch* searchPtr); +/* 146 */ +EXTERN int Tcl_Flush(Tcl_Channel chan); +/* 147 */ +EXTERN void Tcl_FreeResult(Tcl_Interp* interp); +/* 148 */ +EXTERN int Tcl_GetAlias( + Tcl_Interp* interp, + const char* slaveCmd, + Tcl_Interp** targetInterpPtr, + CONST84 char** targetCmdPtr, + int* argcPtr, + CONST84 char*** argvPtr); +/* 149 */ +EXTERN int Tcl_GetAliasObj( + Tcl_Interp* interp, + const char* slaveCmd, + Tcl_Interp** targetInterpPtr, + CONST84 char** targetCmdPtr, + int* objcPtr, + Tcl_Obj*** objv); +/* 150 */ +EXTERN ClientData Tcl_GetAssocData( + Tcl_Interp* interp, + const char* name, + Tcl_InterpDeleteProc** procPtr); +/* 151 */ +EXTERN Tcl_Channel +Tcl_GetChannel(Tcl_Interp* interp, const char* chanName, int* modePtr); +/* 152 */ +EXTERN int Tcl_GetChannelBufferSize(Tcl_Channel chan); +/* 153 */ +EXTERN int +Tcl_GetChannelHandle(Tcl_Channel chan, int direction, ClientData* handlePtr); +/* 154 */ +EXTERN ClientData Tcl_GetChannelInstanceData(Tcl_Channel chan); +/* 155 */ +EXTERN int Tcl_GetChannelMode(Tcl_Channel chan); +/* 156 */ +EXTERN CONST84_RETURN char* Tcl_GetChannelName(Tcl_Channel chan); +/* 157 */ +EXTERN int Tcl_GetChannelOption( + Tcl_Interp* interp, + Tcl_Channel chan, + const char* optionName, + Tcl_DString* dsPtr); +/* 158 */ +EXTERN CONST86 Tcl_ChannelType* Tcl_GetChannelType(Tcl_Channel chan); +/* 159 */ +EXTERN int Tcl_GetCommandInfo( + Tcl_Interp* interp, + const char* cmdName, + Tcl_CmdInfo* infoPtr); +/* 160 */ +EXTERN CONST84_RETURN char* Tcl_GetCommandName( + Tcl_Interp* interp, + Tcl_Command command); +/* 161 */ +EXTERN int Tcl_GetErrno(void); +/* 162 */ +EXTERN CONST84_RETURN char* Tcl_GetHostName(void); +/* 163 */ +EXTERN int Tcl_GetInterpPath(Tcl_Interp* askInterp, Tcl_Interp* slaveInterp); +/* 164 */ +EXTERN Tcl_Interp* Tcl_GetMaster(Tcl_Interp* interp); +/* 165 */ +EXTERN const char* Tcl_GetNameOfExecutable(void); +/* 166 */ +EXTERN Tcl_Obj* Tcl_GetObjResult(Tcl_Interp* interp); +#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */ +/* 167 */ +EXTERN int Tcl_GetOpenFile( + Tcl_Interp* interp, + const char* chanID, + int forWriting, + int checkUsage, + ClientData* filePtr); +#endif /* UNIX */ +#ifdef MAC_OSX_TCL /* MACOSX */ +/* 167 */ +EXTERN int Tcl_GetOpenFile( + Tcl_Interp* interp, + const char* chanID, + int forWriting, + int checkUsage, + ClientData* filePtr); +#endif /* MACOSX */ +/* 168 */ +EXTERN Tcl_PathType Tcl_GetPathType(const char* path); +/* 169 */ +EXTERN int Tcl_Gets(Tcl_Channel chan, Tcl_DString* dsPtr); +/* 170 */ +EXTERN int Tcl_GetsObj(Tcl_Channel chan, Tcl_Obj* objPtr); +/* 171 */ +EXTERN int Tcl_GetServiceMode(void); +/* 172 */ +EXTERN Tcl_Interp* Tcl_GetSlave(Tcl_Interp* interp, const char* slaveName); +/* 173 */ +EXTERN Tcl_Channel Tcl_GetStdChannel(int type); +/* 174 */ +EXTERN CONST84_RETURN char* Tcl_GetStringResult(Tcl_Interp* interp); +/* 175 */ +EXTERN CONST84_RETURN char* +Tcl_GetVar(Tcl_Interp* interp, const char* varName, int flags); +/* 176 */ +EXTERN CONST84_RETURN char* Tcl_GetVar2( + Tcl_Interp* interp, + const char* part1, + const char* part2, + int flags); +/* 177 */ +EXTERN int Tcl_GlobalEval(Tcl_Interp* interp, const char* command); +/* 178 */ +EXTERN int Tcl_GlobalEvalObj(Tcl_Interp* interp, Tcl_Obj* objPtr); +/* 179 */ +EXTERN int Tcl_HideCommand( + Tcl_Interp* interp, + const char* cmdName, + const char* hiddenCmdToken); +/* 180 */ +EXTERN int Tcl_Init(Tcl_Interp* interp); +/* 181 */ +EXTERN void Tcl_InitHashTable(Tcl_HashTable* tablePtr, int keyType); +/* 182 */ +EXTERN int Tcl_InputBlocked(Tcl_Channel chan); +/* 183 */ +EXTERN int Tcl_InputBuffered(Tcl_Channel chan); +/* 184 */ +EXTERN int Tcl_InterpDeleted(Tcl_Interp* interp); +/* 185 */ +EXTERN int Tcl_IsSafe(Tcl_Interp* interp); +/* 186 */ +EXTERN char* +Tcl_JoinPath(int argc, CONST84 char* const* argv, Tcl_DString* resultPtr); +/* 187 */ +EXTERN int +Tcl_LinkVar(Tcl_Interp* interp, const char* varName, char* addr, int type); +/* Slot 188 is reserved */ +/* 189 */ +EXTERN Tcl_Channel Tcl_MakeFileChannel(ClientData handle, int mode); +/* 190 */ +EXTERN int Tcl_MakeSafe(Tcl_Interp* interp); +/* 191 */ +EXTERN Tcl_Channel Tcl_MakeTcpClientChannel(ClientData tcpSocket); +/* 192 */ +EXTERN char* Tcl_Merge(int argc, CONST84 char* const* argv); +/* 193 */ +EXTERN Tcl_HashEntry* Tcl_NextHashEntry(Tcl_HashSearch* searchPtr); +/* 194 */ +EXTERN void Tcl_NotifyChannel(Tcl_Channel channel, int mask); +/* 195 */ +EXTERN Tcl_Obj* Tcl_ObjGetVar2( + Tcl_Interp* interp, + Tcl_Obj* part1Ptr, + Tcl_Obj* part2Ptr, + int flags); +/* 196 */ +EXTERN Tcl_Obj* Tcl_ObjSetVar2( + Tcl_Interp* interp, + Tcl_Obj* part1Ptr, + Tcl_Obj* part2Ptr, + Tcl_Obj* newValuePtr, + int flags); +/* 197 */ +EXTERN Tcl_Channel Tcl_OpenCommandChannel( + Tcl_Interp* interp, + int argc, + CONST84 char** argv, + int flags); +/* 198 */ +EXTERN Tcl_Channel Tcl_OpenFileChannel( + Tcl_Interp* interp, + const char* fileName, + const char* modeString, + int permissions); +/* 199 */ +EXTERN Tcl_Channel Tcl_OpenTcpClient( + Tcl_Interp* interp, + int port, + const char* address, + const char* myaddr, + int myport, + int async); +/* 200 */ +EXTERN Tcl_Channel Tcl_OpenTcpServer( + Tcl_Interp* interp, + int port, + const char* host, + Tcl_TcpAcceptProc* acceptProc, + ClientData callbackData); +/* 201 */ +EXTERN void Tcl_Preserve(ClientData data); +/* 202 */ +EXTERN void Tcl_PrintDouble(Tcl_Interp* interp, double value, char* dst); +/* 203 */ +EXTERN int Tcl_PutEnv(const char* assignment); +/* 204 */ +EXTERN CONST84_RETURN char* Tcl_PosixError(Tcl_Interp* interp); +/* 205 */ +EXTERN void Tcl_QueueEvent(Tcl_Event* evPtr, Tcl_QueuePosition position); +/* 206 */ +EXTERN int Tcl_Read(Tcl_Channel chan, char* bufPtr, int toRead); +/* 207 */ +EXTERN void Tcl_ReapDetachedProcs(void); +/* 208 */ +EXTERN int Tcl_RecordAndEval(Tcl_Interp* interp, const char* cmd, int flags); +/* 209 */ +EXTERN int Tcl_RecordAndEvalObj(Tcl_Interp* interp, Tcl_Obj* cmdPtr, int flags); +/* 210 */ +EXTERN void Tcl_RegisterChannel(Tcl_Interp* interp, Tcl_Channel chan); +/* 211 */ +EXTERN void Tcl_RegisterObjType(const Tcl_ObjType* typePtr); +/* 212 */ +EXTERN Tcl_RegExp Tcl_RegExpCompile(Tcl_Interp* interp, const char* pattern); +/* 213 */ +EXTERN int Tcl_RegExpExec( + Tcl_Interp* interp, + Tcl_RegExp regexp, + const char* text, + const char* start); +/* 214 */ +EXTERN int +Tcl_RegExpMatch(Tcl_Interp* interp, const char* text, const char* pattern); +/* 215 */ +EXTERN void Tcl_RegExpRange( + Tcl_RegExp regexp, + int index, + CONST84 char** startPtr, + CONST84 char** endPtr); +/* 216 */ +EXTERN void Tcl_Release(ClientData clientData); +/* 217 */ +EXTERN void Tcl_ResetResult(Tcl_Interp* interp); +/* 218 */ +EXTERN int Tcl_ScanElement(const char* src, int* flagPtr); +/* 219 */ +EXTERN int Tcl_ScanCountedElement(const char* src, int length, int* flagPtr); +/* 220 */ +EXTERN int Tcl_SeekOld(Tcl_Channel chan, int offset, int mode); +/* 221 */ +EXTERN int Tcl_ServiceAll(void); +/* 222 */ +EXTERN int Tcl_ServiceEvent(int flags); +/* 223 */ +EXTERN void Tcl_SetAssocData( + Tcl_Interp* interp, + const char* name, + Tcl_InterpDeleteProc* proc, + ClientData clientData); +/* 224 */ +EXTERN void Tcl_SetChannelBufferSize(Tcl_Channel chan, int sz); +/* 225 */ +EXTERN int Tcl_SetChannelOption( + Tcl_Interp* interp, + Tcl_Channel chan, + const char* optionName, + const char* newValue); +/* 226 */ +EXTERN int Tcl_SetCommandInfo( + Tcl_Interp* interp, + const char* cmdName, + const Tcl_CmdInfo* infoPtr); +/* 227 */ +EXTERN void Tcl_SetErrno(int err); +/* 228 */ +EXTERN void Tcl_SetErrorCode(Tcl_Interp* interp, ...); +/* 229 */ +EXTERN void Tcl_SetMaxBlockTime(const Tcl_Time* timePtr); +/* 230 */ +EXTERN void Tcl_SetPanicProc(TCL_NORETURN1 Tcl_PanicProc* panicProc); +/* 231 */ +EXTERN int Tcl_SetRecursionLimit(Tcl_Interp* interp, int depth); +/* 232 */ +EXTERN void +Tcl_SetResult(Tcl_Interp* interp, char* result, Tcl_FreeProc* freeProc); +/* 233 */ +EXTERN int Tcl_SetServiceMode(int mode); +/* 234 */ +EXTERN void Tcl_SetObjErrorCode(Tcl_Interp* interp, Tcl_Obj* errorObjPtr); +/* 235 */ +EXTERN void Tcl_SetObjResult(Tcl_Interp* interp, Tcl_Obj* resultObjPtr); +/* 236 */ +EXTERN void Tcl_SetStdChannel(Tcl_Channel channel, int type); +/* 237 */ +EXTERN CONST84_RETURN char* Tcl_SetVar( + Tcl_Interp* interp, + const char* varName, + const char* newValue, + int flags); +/* 238 */ +EXTERN CONST84_RETURN char* Tcl_SetVar2( + Tcl_Interp* interp, + const char* part1, + const char* part2, + const char* newValue, + int flags); +/* 239 */ +EXTERN CONST84_RETURN char* Tcl_SignalId(int sig); +/* 240 */ +EXTERN CONST84_RETURN char* Tcl_SignalMsg(int sig); +/* 241 */ +EXTERN void Tcl_SourceRCFile(Tcl_Interp* interp); +/* 242 */ +EXTERN int Tcl_SplitList( + Tcl_Interp* interp, + const char* listStr, + int* argcPtr, + CONST84 char*** argvPtr); +/* 243 */ +EXTERN void +Tcl_SplitPath(const char* path, int* argcPtr, CONST84 char*** argvPtr); +/* 244 */ +EXTERN void Tcl_StaticPackage( + Tcl_Interp* interp, + const char* pkgName, + Tcl_PackageInitProc* initProc, + Tcl_PackageInitProc* safeInitProc); +/* 245 */ +EXTERN int Tcl_StringMatch(const char* str, const char* pattern); +/* 246 */ +EXTERN int Tcl_TellOld(Tcl_Channel chan); +/* 247 */ +EXTERN int Tcl_TraceVar( + Tcl_Interp* interp, + const char* varName, + int flags, + Tcl_VarTraceProc* proc, + ClientData clientData); +/* 248 */ +EXTERN int Tcl_TraceVar2( + Tcl_Interp* interp, + const char* part1, + const char* part2, + int flags, + Tcl_VarTraceProc* proc, + ClientData clientData); +/* 249 */ +EXTERN char* Tcl_TranslateFileName( + Tcl_Interp* interp, + const char* name, + Tcl_DString* bufferPtr); +/* 250 */ +EXTERN int Tcl_Ungets(Tcl_Channel chan, const char* str, int len, int atHead); +/* 251 */ +EXTERN void Tcl_UnlinkVar(Tcl_Interp* interp, const char* varName); +/* 252 */ +EXTERN int Tcl_UnregisterChannel(Tcl_Interp* interp, Tcl_Channel chan); +/* 253 */ +EXTERN int Tcl_UnsetVar(Tcl_Interp* interp, const char* varName, int flags); +/* 254 */ +EXTERN int Tcl_UnsetVar2( + Tcl_Interp* interp, + const char* part1, + const char* part2, + int flags); +/* 255 */ +EXTERN void Tcl_UntraceVar( + Tcl_Interp* interp, + const char* varName, + int flags, + Tcl_VarTraceProc* proc, + ClientData clientData); +/* 256 */ +EXTERN void Tcl_UntraceVar2( + Tcl_Interp* interp, + const char* part1, + const char* part2, + int flags, + Tcl_VarTraceProc* proc, + ClientData clientData); +/* 257 */ +EXTERN void Tcl_UpdateLinkedVar(Tcl_Interp* interp, const char* varName); +/* 258 */ +EXTERN int Tcl_UpVar( + Tcl_Interp* interp, + const char* frameName, + const char* varName, + const char* localName, + int flags); +/* 259 */ +EXTERN int Tcl_UpVar2( + Tcl_Interp* interp, + const char* frameName, + const char* part1, + const char* part2, + const char* localName, + int flags); +/* 260 */ +EXTERN int Tcl_VarEval(Tcl_Interp* interp, ...); +/* 261 */ +EXTERN ClientData Tcl_VarTraceInfo( + Tcl_Interp* interp, + const char* varName, + int flags, + Tcl_VarTraceProc* procPtr, + ClientData prevClientData); +/* 262 */ +EXTERN ClientData Tcl_VarTraceInfo2( + Tcl_Interp* interp, + const char* part1, + const char* part2, + int flags, + Tcl_VarTraceProc* procPtr, + ClientData prevClientData); +/* 263 */ +EXTERN int Tcl_Write(Tcl_Channel chan, const char* s, int slen); +/* 264 */ +EXTERN void Tcl_WrongNumArgs( + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[], + const char* message); +/* 265 */ +EXTERN int Tcl_DumpActiveMemory(const char* fileName); +/* 266 */ +EXTERN void Tcl_ValidateAllMemory(const char* file, int line); +/* 267 */ +EXTERN void Tcl_AppendResultVA(Tcl_Interp* interp, va_list argList); +/* 268 */ +EXTERN void Tcl_AppendStringsToObjVA(Tcl_Obj* objPtr, va_list argList); +/* 269 */ +EXTERN char* Tcl_HashStats(Tcl_HashTable* tablePtr); +/* 270 */ +EXTERN CONST84_RETURN char* +Tcl_ParseVar(Tcl_Interp* interp, const char* start, CONST84 char** termPtr); +/* 271 */ +EXTERN CONST84_RETURN char* Tcl_PkgPresent( + Tcl_Interp* interp, + const char* name, + const char* version, + int exact); +/* 272 */ +EXTERN CONST84_RETURN char* Tcl_PkgPresentEx( + Tcl_Interp* interp, + const char* name, + const char* version, + int exact, + void* clientDataPtr); +/* 273 */ +EXTERN int +Tcl_PkgProvide(Tcl_Interp* interp, const char* name, const char* version); +/* 274 */ +EXTERN CONST84_RETURN char* Tcl_PkgRequire( + Tcl_Interp* interp, + const char* name, + const char* version, + int exact); +/* 275 */ +EXTERN void Tcl_SetErrorCodeVA(Tcl_Interp* interp, va_list argList); +/* 276 */ +EXTERN int Tcl_VarEvalVA(Tcl_Interp* interp, va_list argList); +/* 277 */ +EXTERN Tcl_Pid Tcl_WaitPid(Tcl_Pid pid, int* statPtr, int options); +/* 278 */ +EXTERN TCL_NORETURN void Tcl_PanicVA(const char* format, va_list argList); +/* 279 */ +EXTERN void Tcl_GetVersion(int* major, int* minor, int* patchLevel, int* type); +/* 280 */ +EXTERN void Tcl_InitMemory(Tcl_Interp* interp); +/* 281 */ +EXTERN Tcl_Channel Tcl_StackChannel( + Tcl_Interp* interp, + const Tcl_ChannelType* typePtr, + ClientData instanceData, + int mask, + Tcl_Channel prevChan); +/* 282 */ +EXTERN int Tcl_UnstackChannel(Tcl_Interp* interp, Tcl_Channel chan); +/* 283 */ +EXTERN Tcl_Channel Tcl_GetStackedChannel(Tcl_Channel chan); +/* 284 */ +EXTERN void Tcl_SetMainLoop(Tcl_MainLoopProc* proc); +/* Slot 285 is reserved */ +/* 286 */ +EXTERN void Tcl_AppendObjToObj(Tcl_Obj* objPtr, Tcl_Obj* appendObjPtr); +/* 287 */ +EXTERN Tcl_Encoding Tcl_CreateEncoding(const Tcl_EncodingType* typePtr); +/* 288 */ +EXTERN void Tcl_CreateThreadExitHandler( + Tcl_ExitProc* proc, + ClientData clientData); +/* 289 */ +EXTERN void Tcl_DeleteThreadExitHandler( + Tcl_ExitProc* proc, + ClientData clientData); +/* 290 */ +EXTERN void Tcl_DiscardResult(Tcl_SavedResult* statePtr); +/* 291 */ +EXTERN int +Tcl_EvalEx(Tcl_Interp* interp, const char* script, int numBytes, int flags); +/* 292 */ +EXTERN int +Tcl_EvalObjv(Tcl_Interp* interp, int objc, Tcl_Obj* const objv[], int flags); +/* 293 */ +EXTERN int Tcl_EvalObjEx(Tcl_Interp* interp, Tcl_Obj* objPtr, int flags); +/* 294 */ +EXTERN void Tcl_ExitThread(int status); +/* 295 */ +EXTERN int Tcl_ExternalToUtf( + Tcl_Interp* interp, + Tcl_Encoding encoding, + const char* src, + int srcLen, + int flags, + Tcl_EncodingState* statePtr, + char* dst, + int dstLen, + int* srcReadPtr, + int* dstWrotePtr, + int* dstCharsPtr); +/* 296 */ +EXTERN char* Tcl_ExternalToUtfDString( + Tcl_Encoding encoding, + const char* src, + int srcLen, + Tcl_DString* dsPtr); +/* 297 */ +EXTERN void Tcl_FinalizeThread(void); +/* 298 */ +EXTERN void Tcl_FinalizeNotifier(ClientData clientData); +/* 299 */ +EXTERN void Tcl_FreeEncoding(Tcl_Encoding encoding); +/* 300 */ +EXTERN Tcl_ThreadId Tcl_GetCurrentThread(void); +/* 301 */ +EXTERN Tcl_Encoding Tcl_GetEncoding(Tcl_Interp* interp, const char* name); +/* 302 */ +EXTERN CONST84_RETURN char* Tcl_GetEncodingName(Tcl_Encoding encoding); +/* 303 */ +EXTERN void Tcl_GetEncodingNames(Tcl_Interp* interp); +/* 304 */ +EXTERN int Tcl_GetIndexFromObjStruct( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + const void* tablePtr, + int offset, + const char* msg, + int flags, + int* indexPtr); +/* 305 */ +EXTERN void* Tcl_GetThreadData(Tcl_ThreadDataKey* keyPtr, int size); +/* 306 */ +EXTERN Tcl_Obj* Tcl_GetVar2Ex( + Tcl_Interp* interp, + const char* part1, + const char* part2, + int flags); +/* 307 */ +EXTERN ClientData Tcl_InitNotifier(void); +/* 308 */ +EXTERN void Tcl_MutexLock(Tcl_Mutex* mutexPtr); +/* 309 */ +EXTERN void Tcl_MutexUnlock(Tcl_Mutex* mutexPtr); +/* 310 */ +EXTERN void Tcl_ConditionNotify(Tcl_Condition* condPtr); +/* 311 */ +EXTERN void Tcl_ConditionWait( + Tcl_Condition* condPtr, + Tcl_Mutex* mutexPtr, + const Tcl_Time* timePtr); +/* 312 */ +EXTERN int Tcl_NumUtfChars(const char* src, int length); +/* 313 */ +EXTERN int Tcl_ReadChars( + Tcl_Channel channel, + Tcl_Obj* objPtr, + int charsToRead, + int appendFlag); +/* 314 */ +EXTERN void Tcl_RestoreResult(Tcl_Interp* interp, Tcl_SavedResult* statePtr); +/* 315 */ +EXTERN void Tcl_SaveResult(Tcl_Interp* interp, Tcl_SavedResult* statePtr); +/* 316 */ +EXTERN int Tcl_SetSystemEncoding(Tcl_Interp* interp, const char* name); +/* 317 */ +EXTERN Tcl_Obj* Tcl_SetVar2Ex( + Tcl_Interp* interp, + const char* part1, + const char* part2, + Tcl_Obj* newValuePtr, + int flags); +/* 318 */ +EXTERN void Tcl_ThreadAlert(Tcl_ThreadId threadId); +/* 319 */ +EXTERN void Tcl_ThreadQueueEvent( + Tcl_ThreadId threadId, + Tcl_Event* evPtr, + Tcl_QueuePosition position); +/* 320 */ +EXTERN Tcl_UniChar Tcl_UniCharAtIndex(const char* src, int index); +/* 321 */ +EXTERN Tcl_UniChar Tcl_UniCharToLower(int ch); +/* 322 */ +EXTERN Tcl_UniChar Tcl_UniCharToTitle(int ch); +/* 323 */ +EXTERN Tcl_UniChar Tcl_UniCharToUpper(int ch); +/* 324 */ +EXTERN int Tcl_UniCharToUtf(int ch, char* buf); +/* 325 */ +EXTERN CONST84_RETURN char* Tcl_UtfAtIndex(const char* src, int index); +/* 326 */ +EXTERN int Tcl_UtfCharComplete(const char* src, int length); +/* 327 */ +EXTERN int Tcl_UtfBackslash(const char* src, int* readPtr, char* dst); +/* 328 */ +EXTERN CONST84_RETURN char* Tcl_UtfFindFirst(const char* src, int ch); +/* 329 */ +EXTERN CONST84_RETURN char* Tcl_UtfFindLast(const char* src, int ch); +/* 330 */ +EXTERN CONST84_RETURN char* Tcl_UtfNext(const char* src); +/* 331 */ +EXTERN CONST84_RETURN char* Tcl_UtfPrev(const char* src, const char* start); +/* 332 */ +EXTERN int Tcl_UtfToExternal( + Tcl_Interp* interp, + Tcl_Encoding encoding, + const char* src, + int srcLen, + int flags, + Tcl_EncodingState* statePtr, + char* dst, + int dstLen, + int* srcReadPtr, + int* dstWrotePtr, + int* dstCharsPtr); +/* 333 */ +EXTERN char* Tcl_UtfToExternalDString( + Tcl_Encoding encoding, + const char* src, + int srcLen, + Tcl_DString* dsPtr); +/* 334 */ +EXTERN int Tcl_UtfToLower(char* src); +/* 335 */ +EXTERN int Tcl_UtfToTitle(char* src); +/* 336 */ +EXTERN int Tcl_UtfToUniChar(const char* src, Tcl_UniChar* chPtr); +/* 337 */ +EXTERN int Tcl_UtfToUpper(char* src); +/* 338 */ +EXTERN int Tcl_WriteChars(Tcl_Channel chan, const char* src, int srcLen); +/* 339 */ +EXTERN int Tcl_WriteObj(Tcl_Channel chan, Tcl_Obj* objPtr); +/* 340 */ +EXTERN char* Tcl_GetString(Tcl_Obj* objPtr); +/* 341 */ +EXTERN CONST84_RETURN char* Tcl_GetDefaultEncodingDir(void); +/* 342 */ +EXTERN void Tcl_SetDefaultEncodingDir(const char* path); +/* 343 */ +EXTERN void Tcl_AlertNotifier(ClientData clientData); +/* 344 */ +EXTERN void Tcl_ServiceModeHook(int mode); +/* 345 */ +EXTERN int Tcl_UniCharIsAlnum(int ch); +/* 346 */ +EXTERN int Tcl_UniCharIsAlpha(int ch); +/* 347 */ +EXTERN int Tcl_UniCharIsDigit(int ch); +/* 348 */ +EXTERN int Tcl_UniCharIsLower(int ch); +/* 349 */ +EXTERN int Tcl_UniCharIsSpace(int ch); +/* 350 */ +EXTERN int Tcl_UniCharIsUpper(int ch); +/* 351 */ +EXTERN int Tcl_UniCharIsWordChar(int ch); +/* 352 */ +EXTERN int Tcl_UniCharLen(const Tcl_UniChar* uniStr); +/* 353 */ +EXTERN int Tcl_UniCharNcmp( + const Tcl_UniChar* ucs, + const Tcl_UniChar* uct, + unsigned long numChars); +/* 354 */ +EXTERN char* Tcl_UniCharToUtfDString( + const Tcl_UniChar* uniStr, + int uniLength, + Tcl_DString* dsPtr); +/* 355 */ +EXTERN Tcl_UniChar* +Tcl_UtfToUniCharDString(const char* src, int length, Tcl_DString* dsPtr); +/* 356 */ +EXTERN Tcl_RegExp +Tcl_GetRegExpFromObj(Tcl_Interp* interp, Tcl_Obj* patObj, int flags); +/* 357 */ +EXTERN Tcl_Obj* +Tcl_EvalTokens(Tcl_Interp* interp, Tcl_Token* tokenPtr, int count); +/* 358 */ +EXTERN void Tcl_FreeParse(Tcl_Parse* parsePtr); +/* 359 */ +EXTERN void Tcl_LogCommandInfo( + Tcl_Interp* interp, + const char* script, + const char* command, + int length); +/* 360 */ +EXTERN int Tcl_ParseBraces( + Tcl_Interp* interp, + const char* start, + int numBytes, + Tcl_Parse* parsePtr, + int append, + CONST84 char** termPtr); +/* 361 */ +EXTERN int Tcl_ParseCommand( + Tcl_Interp* interp, + const char* start, + int numBytes, + int nested, + Tcl_Parse* parsePtr); +/* 362 */ +EXTERN int Tcl_ParseExpr( + Tcl_Interp* interp, + const char* start, + int numBytes, + Tcl_Parse* parsePtr); +/* 363 */ +EXTERN int Tcl_ParseQuotedString( + Tcl_Interp* interp, + const char* start, + int numBytes, + Tcl_Parse* parsePtr, + int append, + CONST84 char** termPtr); +/* 364 */ +EXTERN int Tcl_ParseVarName( + Tcl_Interp* interp, + const char* start, + int numBytes, + Tcl_Parse* parsePtr, + int append); +/* 365 */ +EXTERN char* Tcl_GetCwd(Tcl_Interp* interp, Tcl_DString* cwdPtr); +/* 366 */ +EXTERN int Tcl_Chdir(const char* dirName); +/* 367 */ +EXTERN int Tcl_Access(const char* path, int mode); +/* 368 */ +EXTERN int Tcl_Stat(const char* path, struct stat* bufPtr); +/* 369 */ +EXTERN int Tcl_UtfNcmp(const char* s1, const char* s2, unsigned long n); +/* 370 */ +EXTERN int Tcl_UtfNcasecmp(const char* s1, const char* s2, unsigned long n); +/* 371 */ +EXTERN int +Tcl_StringCaseMatch(const char* str, const char* pattern, int nocase); +/* 372 */ +EXTERN int Tcl_UniCharIsControl(int ch); +/* 373 */ +EXTERN int Tcl_UniCharIsGraph(int ch); +/* 374 */ +EXTERN int Tcl_UniCharIsPrint(int ch); +/* 375 */ +EXTERN int Tcl_UniCharIsPunct(int ch); +/* 376 */ +EXTERN int Tcl_RegExpExecObj( + Tcl_Interp* interp, + Tcl_RegExp regexp, + Tcl_Obj* textObj, + int offset, + int nmatches, + int flags); +/* 377 */ +EXTERN void Tcl_RegExpGetInfo(Tcl_RegExp regexp, Tcl_RegExpInfo* infoPtr); +/* 378 */ +EXTERN Tcl_Obj* Tcl_NewUnicodeObj(const Tcl_UniChar* unicode, int numChars); +/* 379 */ +EXTERN void +Tcl_SetUnicodeObj(Tcl_Obj* objPtr, const Tcl_UniChar* unicode, int numChars); +/* 380 */ +EXTERN int Tcl_GetCharLength(Tcl_Obj* objPtr); +/* 381 */ +EXTERN Tcl_UniChar Tcl_GetUniChar(Tcl_Obj* objPtr, int index); +/* 382 */ +EXTERN Tcl_UniChar* Tcl_GetUnicode(Tcl_Obj* objPtr); +/* 383 */ +EXTERN Tcl_Obj* Tcl_GetRange(Tcl_Obj* objPtr, int first, int last); +/* 384 */ +EXTERN void +Tcl_AppendUnicodeToObj(Tcl_Obj* objPtr, const Tcl_UniChar* unicode, int length); +/* 385 */ +EXTERN int +Tcl_RegExpMatchObj(Tcl_Interp* interp, Tcl_Obj* textObj, Tcl_Obj* patternObj); +/* 386 */ +EXTERN void Tcl_SetNotifier(Tcl_NotifierProcs* notifierProcPtr); +/* 387 */ +EXTERN Tcl_Mutex* Tcl_GetAllocMutex(void); +/* 388 */ +EXTERN int Tcl_GetChannelNames(Tcl_Interp* interp); +/* 389 */ +EXTERN int Tcl_GetChannelNamesEx(Tcl_Interp* interp, const char* pattern); +/* 390 */ +EXTERN int Tcl_ProcObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 391 */ +EXTERN void Tcl_ConditionFinalize(Tcl_Condition* condPtr); +/* 392 */ +EXTERN void Tcl_MutexFinalize(Tcl_Mutex* mutex); +/* 393 */ +EXTERN int Tcl_CreateThread( + Tcl_ThreadId* idPtr, + Tcl_ThreadCreateProc* proc, + ClientData clientData, + int stackSize, + int flags); +/* 394 */ +EXTERN int Tcl_ReadRaw(Tcl_Channel chan, char* dst, int bytesToRead); +/* 395 */ +EXTERN int Tcl_WriteRaw(Tcl_Channel chan, const char* src, int srcLen); +/* 396 */ +EXTERN Tcl_Channel Tcl_GetTopChannel(Tcl_Channel chan); +/* 397 */ +EXTERN int Tcl_ChannelBuffered(Tcl_Channel chan); +/* 398 */ +EXTERN CONST84_RETURN char* Tcl_ChannelName(const Tcl_ChannelType* chanTypePtr); +/* 399 */ +EXTERN Tcl_ChannelTypeVersion +Tcl_ChannelVersion(const Tcl_ChannelType* chanTypePtr); +/* 400 */ +EXTERN Tcl_DriverBlockModeProc* Tcl_ChannelBlockModeProc( + const Tcl_ChannelType* chanTypePtr); +/* 401 */ +EXTERN Tcl_DriverCloseProc* Tcl_ChannelCloseProc( + const Tcl_ChannelType* chanTypePtr); +/* 402 */ +EXTERN Tcl_DriverClose2Proc* Tcl_ChannelClose2Proc( + const Tcl_ChannelType* chanTypePtr); +/* 403 */ +EXTERN Tcl_DriverInputProc* Tcl_ChannelInputProc( + const Tcl_ChannelType* chanTypePtr); +/* 404 */ +EXTERN Tcl_DriverOutputProc* Tcl_ChannelOutputProc( + const Tcl_ChannelType* chanTypePtr); +/* 405 */ +EXTERN Tcl_DriverSeekProc* Tcl_ChannelSeekProc( + const Tcl_ChannelType* chanTypePtr); +/* 406 */ +EXTERN Tcl_DriverSetOptionProc* Tcl_ChannelSetOptionProc( + const Tcl_ChannelType* chanTypePtr); +/* 407 */ +EXTERN Tcl_DriverGetOptionProc* Tcl_ChannelGetOptionProc( + const Tcl_ChannelType* chanTypePtr); +/* 408 */ +EXTERN Tcl_DriverWatchProc* Tcl_ChannelWatchProc( + const Tcl_ChannelType* chanTypePtr); +/* 409 */ +EXTERN Tcl_DriverGetHandleProc* Tcl_ChannelGetHandleProc( + const Tcl_ChannelType* chanTypePtr); +/* 410 */ +EXTERN Tcl_DriverFlushProc* Tcl_ChannelFlushProc( + const Tcl_ChannelType* chanTypePtr); +/* 411 */ +EXTERN Tcl_DriverHandlerProc* Tcl_ChannelHandlerProc( + const Tcl_ChannelType* chanTypePtr); +/* 412 */ +EXTERN int Tcl_JoinThread(Tcl_ThreadId threadId, int* result); +/* 413 */ +EXTERN int Tcl_IsChannelShared(Tcl_Channel channel); +/* 414 */ +EXTERN int Tcl_IsChannelRegistered(Tcl_Interp* interp, Tcl_Channel channel); +/* 415 */ +EXTERN void Tcl_CutChannel(Tcl_Channel channel); +/* 416 */ +EXTERN void Tcl_SpliceChannel(Tcl_Channel channel); +/* 417 */ +EXTERN void Tcl_ClearChannelHandlers(Tcl_Channel channel); +/* 418 */ +EXTERN int Tcl_IsChannelExisting(const char* channelName); +/* 419 */ +EXTERN int Tcl_UniCharNcasecmp( + const Tcl_UniChar* ucs, + const Tcl_UniChar* uct, + unsigned long numChars); +/* 420 */ +EXTERN int Tcl_UniCharCaseMatch( + const Tcl_UniChar* uniStr, + const Tcl_UniChar* uniPattern, + int nocase); +/* 421 */ +EXTERN Tcl_HashEntry* Tcl_FindHashEntry( + Tcl_HashTable* tablePtr, + const void* key); +/* 422 */ +EXTERN Tcl_HashEntry* +Tcl_CreateHashEntry(Tcl_HashTable* tablePtr, const void* key, int* newPtr); +/* 423 */ +EXTERN void Tcl_InitCustomHashTable( + Tcl_HashTable* tablePtr, + int keyType, + const Tcl_HashKeyType* typePtr); +/* 424 */ +EXTERN void Tcl_InitObjHashTable(Tcl_HashTable* tablePtr); +/* 425 */ +EXTERN ClientData Tcl_CommandTraceInfo( + Tcl_Interp* interp, + const char* varName, + int flags, + Tcl_CommandTraceProc* procPtr, + ClientData prevClientData); +/* 426 */ +EXTERN int Tcl_TraceCommand( + Tcl_Interp* interp, + const char* varName, + int flags, + Tcl_CommandTraceProc* proc, + ClientData clientData); +/* 427 */ +EXTERN void Tcl_UntraceCommand( + Tcl_Interp* interp, + const char* varName, + int flags, + Tcl_CommandTraceProc* proc, + ClientData clientData); +/* 428 */ +EXTERN char* Tcl_AttemptAlloc(unsigned int size); +/* 429 */ +EXTERN char* +Tcl_AttemptDbCkalloc(unsigned int size, const char* file, int line); +/* 430 */ +EXTERN char* Tcl_AttemptRealloc(char* ptr, unsigned int size); +/* 431 */ +EXTERN char* Tcl_AttemptDbCkrealloc( + char* ptr, + unsigned int size, + const char* file, + int line); +/* 432 */ +EXTERN int Tcl_AttemptSetObjLength(Tcl_Obj* objPtr, int length); +/* 433 */ +EXTERN Tcl_ThreadId Tcl_GetChannelThread(Tcl_Channel channel); +/* 434 */ +EXTERN Tcl_UniChar* Tcl_GetUnicodeFromObj(Tcl_Obj* objPtr, int* lengthPtr); +/* 435 */ +EXTERN int Tcl_GetMathFuncInfo( + Tcl_Interp* interp, + const char* name, + int* numArgsPtr, + Tcl_ValueType** argTypesPtr, + Tcl_MathProc** procPtr, + ClientData* clientDataPtr); +/* 436 */ +EXTERN Tcl_Obj* Tcl_ListMathFuncs(Tcl_Interp* interp, const char* pattern); +/* 437 */ +EXTERN Tcl_Obj* Tcl_SubstObj(Tcl_Interp* interp, Tcl_Obj* objPtr, int flags); +/* 438 */ +EXTERN int Tcl_DetachChannel(Tcl_Interp* interp, Tcl_Channel channel); +/* 439 */ +EXTERN int Tcl_IsStandardChannel(Tcl_Channel channel); +/* 440 */ +EXTERN int Tcl_FSCopyFile(Tcl_Obj* srcPathPtr, Tcl_Obj* destPathPtr); +/* 441 */ +EXTERN int Tcl_FSCopyDirectory( + Tcl_Obj* srcPathPtr, + Tcl_Obj* destPathPtr, + Tcl_Obj** errorPtr); +/* 442 */ +EXTERN int Tcl_FSCreateDirectory(Tcl_Obj* pathPtr); +/* 443 */ +EXTERN int Tcl_FSDeleteFile(Tcl_Obj* pathPtr); +/* 444 */ +EXTERN int Tcl_FSLoadFile( + Tcl_Interp* interp, + Tcl_Obj* pathPtr, + const char* sym1, + const char* sym2, + Tcl_PackageInitProc** proc1Ptr, + Tcl_PackageInitProc** proc2Ptr, + Tcl_LoadHandle* handlePtr, + Tcl_FSUnloadFileProc** unloadProcPtr); +/* 445 */ +EXTERN int Tcl_FSMatchInDirectory( + Tcl_Interp* interp, + Tcl_Obj* result, + Tcl_Obj* pathPtr, + const char* pattern, + Tcl_GlobTypeData* types); +/* 446 */ +EXTERN Tcl_Obj* Tcl_FSLink(Tcl_Obj* pathPtr, Tcl_Obj* toPtr, int linkAction); +/* 447 */ +EXTERN int +Tcl_FSRemoveDirectory(Tcl_Obj* pathPtr, int recursive, Tcl_Obj** errorPtr); +/* 448 */ +EXTERN int Tcl_FSRenameFile(Tcl_Obj* srcPathPtr, Tcl_Obj* destPathPtr); +/* 449 */ +EXTERN int Tcl_FSLstat(Tcl_Obj* pathPtr, Tcl_StatBuf* buf); +/* 450 */ +EXTERN int Tcl_FSUtime(Tcl_Obj* pathPtr, struct utimbuf* tval); +/* 451 */ +EXTERN int Tcl_FSFileAttrsGet( + Tcl_Interp* interp, + int index, + Tcl_Obj* pathPtr, + Tcl_Obj** objPtrRef); +/* 452 */ +EXTERN int Tcl_FSFileAttrsSet( + Tcl_Interp* interp, + int index, + Tcl_Obj* pathPtr, + Tcl_Obj* objPtr); +/* 453 */ +EXTERN const char* CONST86* Tcl_FSFileAttrStrings( + Tcl_Obj* pathPtr, + Tcl_Obj** objPtrRef); +/* 454 */ +EXTERN int Tcl_FSStat(Tcl_Obj* pathPtr, Tcl_StatBuf* buf); +/* 455 */ +EXTERN int Tcl_FSAccess(Tcl_Obj* pathPtr, int mode); +/* 456 */ +EXTERN Tcl_Channel Tcl_FSOpenFileChannel( + Tcl_Interp* interp, + Tcl_Obj* pathPtr, + const char* modeString, + int permissions); +/* 457 */ +EXTERN Tcl_Obj* Tcl_FSGetCwd(Tcl_Interp* interp); +/* 458 */ +EXTERN int Tcl_FSChdir(Tcl_Obj* pathPtr); +/* 459 */ +EXTERN int Tcl_FSConvertToPathType(Tcl_Interp* interp, Tcl_Obj* pathPtr); +/* 460 */ +EXTERN Tcl_Obj* Tcl_FSJoinPath(Tcl_Obj* listObj, int elements); +/* 461 */ +EXTERN Tcl_Obj* Tcl_FSSplitPath(Tcl_Obj* pathPtr, int* lenPtr); +/* 462 */ +EXTERN int Tcl_FSEqualPaths(Tcl_Obj* firstPtr, Tcl_Obj* secondPtr); +/* 463 */ +EXTERN Tcl_Obj* Tcl_FSGetNormalizedPath(Tcl_Interp* interp, Tcl_Obj* pathPtr); +/* 464 */ +EXTERN Tcl_Obj* +Tcl_FSJoinToPath(Tcl_Obj* pathPtr, int objc, Tcl_Obj* const objv[]); +/* 465 */ +EXTERN ClientData +Tcl_FSGetInternalRep(Tcl_Obj* pathPtr, const Tcl_Filesystem* fsPtr); +/* 466 */ +EXTERN Tcl_Obj* Tcl_FSGetTranslatedPath(Tcl_Interp* interp, Tcl_Obj* pathPtr); +/* 467 */ +EXTERN int Tcl_FSEvalFile(Tcl_Interp* interp, Tcl_Obj* fileName); +/* 468 */ +EXTERN Tcl_Obj* Tcl_FSNewNativePath( + const Tcl_Filesystem* fromFilesystem, + ClientData clientData); +/* 469 */ +EXTERN const void* Tcl_FSGetNativePath(Tcl_Obj* pathPtr); +/* 470 */ +EXTERN Tcl_Obj* Tcl_FSFileSystemInfo(Tcl_Obj* pathPtr); +/* 471 */ +EXTERN Tcl_Obj* Tcl_FSPathSeparator(Tcl_Obj* pathPtr); +/* 472 */ +EXTERN Tcl_Obj* Tcl_FSListVolumes(void); +/* 473 */ +EXTERN int Tcl_FSRegister(ClientData clientData, const Tcl_Filesystem* fsPtr); +/* 474 */ +EXTERN int Tcl_FSUnregister(const Tcl_Filesystem* fsPtr); +/* 475 */ +EXTERN ClientData Tcl_FSData(const Tcl_Filesystem* fsPtr); +/* 476 */ +EXTERN const char* Tcl_FSGetTranslatedStringPath( + Tcl_Interp* interp, + Tcl_Obj* pathPtr); +/* 477 */ +EXTERN CONST86 Tcl_Filesystem* Tcl_FSGetFileSystemForPath(Tcl_Obj* pathPtr); +/* 478 */ +EXTERN Tcl_PathType Tcl_FSGetPathType(Tcl_Obj* pathPtr); +/* 479 */ +EXTERN int Tcl_OutputBuffered(Tcl_Channel chan); +/* 480 */ +EXTERN void Tcl_FSMountsChanged(const Tcl_Filesystem* fsPtr); +/* 481 */ +EXTERN int +Tcl_EvalTokensStandard(Tcl_Interp* interp, Tcl_Token* tokenPtr, int count); +/* 482 */ +EXTERN void Tcl_GetTime(Tcl_Time* timeBuf); +/* 483 */ +EXTERN Tcl_Trace Tcl_CreateObjTrace( + Tcl_Interp* interp, + int level, + int flags, + Tcl_CmdObjTraceProc* objProc, + ClientData clientData, + Tcl_CmdObjTraceDeleteProc* delProc); +/* 484 */ +EXTERN int Tcl_GetCommandInfoFromToken(Tcl_Command token, Tcl_CmdInfo* infoPtr); +/* 485 */ +EXTERN int Tcl_SetCommandInfoFromToken( + Tcl_Command token, + const Tcl_CmdInfo* infoPtr); +/* 486 */ +EXTERN Tcl_Obj* +Tcl_DbNewWideIntObj(Tcl_WideInt wideValue, const char* file, int line); +/* 487 */ +EXTERN int Tcl_GetWideIntFromObj( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + Tcl_WideInt* widePtr); +/* 488 */ +EXTERN Tcl_Obj* Tcl_NewWideIntObj(Tcl_WideInt wideValue); +/* 489 */ +EXTERN void Tcl_SetWideIntObj(Tcl_Obj* objPtr, Tcl_WideInt wideValue); +/* 490 */ +EXTERN Tcl_StatBuf* Tcl_AllocStatBuf(void); +/* 491 */ +EXTERN Tcl_WideInt Tcl_Seek(Tcl_Channel chan, Tcl_WideInt offset, int mode); +/* 492 */ +EXTERN Tcl_WideInt Tcl_Tell(Tcl_Channel chan); +/* 493 */ +EXTERN Tcl_DriverWideSeekProc* Tcl_ChannelWideSeekProc( + const Tcl_ChannelType* chanTypePtr); +/* 494 */ +EXTERN int Tcl_DictObjPut( + Tcl_Interp* interp, + Tcl_Obj* dictPtr, + Tcl_Obj* keyPtr, + Tcl_Obj* valuePtr); +/* 495 */ +EXTERN int Tcl_DictObjGet( + Tcl_Interp* interp, + Tcl_Obj* dictPtr, + Tcl_Obj* keyPtr, + Tcl_Obj** valuePtrPtr); +/* 496 */ +EXTERN int +Tcl_DictObjRemove(Tcl_Interp* interp, Tcl_Obj* dictPtr, Tcl_Obj* keyPtr); +/* 497 */ +EXTERN int Tcl_DictObjSize(Tcl_Interp* interp, Tcl_Obj* dictPtr, int* sizePtr); +/* 498 */ +EXTERN int Tcl_DictObjFirst( + Tcl_Interp* interp, + Tcl_Obj* dictPtr, + Tcl_DictSearch* searchPtr, + Tcl_Obj** keyPtrPtr, + Tcl_Obj** valuePtrPtr, + int* donePtr); +/* 499 */ +EXTERN void Tcl_DictObjNext( + Tcl_DictSearch* searchPtr, + Tcl_Obj** keyPtrPtr, + Tcl_Obj** valuePtrPtr, + int* donePtr); +/* 500 */ +EXTERN void Tcl_DictObjDone(Tcl_DictSearch* searchPtr); +/* 501 */ +EXTERN int Tcl_DictObjPutKeyList( + Tcl_Interp* interp, + Tcl_Obj* dictPtr, + int keyc, + Tcl_Obj* const* keyv, + Tcl_Obj* valuePtr); +/* 502 */ +EXTERN int Tcl_DictObjRemoveKeyList( + Tcl_Interp* interp, + Tcl_Obj* dictPtr, + int keyc, + Tcl_Obj* const* keyv); +/* 503 */ +EXTERN Tcl_Obj* Tcl_NewDictObj(void); +/* 504 */ +EXTERN Tcl_Obj* Tcl_DbNewDictObj(const char* file, int line); +/* 505 */ +EXTERN void Tcl_RegisterConfig( + Tcl_Interp* interp, + const char* pkgName, + const Tcl_Config* configuration, + const char* valEncoding); +/* 506 */ +EXTERN Tcl_Namespace* Tcl_CreateNamespace( + Tcl_Interp* interp, + const char* name, + ClientData clientData, + Tcl_NamespaceDeleteProc* deleteProc); +/* 507 */ +EXTERN void Tcl_DeleteNamespace(Tcl_Namespace* nsPtr); +/* 508 */ +EXTERN int +Tcl_AppendExportList(Tcl_Interp* interp, Tcl_Namespace* nsPtr, Tcl_Obj* objPtr); +/* 509 */ +EXTERN int Tcl_Export( + Tcl_Interp* interp, + Tcl_Namespace* nsPtr, + const char* pattern, + int resetListFirst); +/* 510 */ +EXTERN int Tcl_Import( + Tcl_Interp* interp, + Tcl_Namespace* nsPtr, + const char* pattern, + int allowOverwrite); +/* 511 */ +EXTERN int +Tcl_ForgetImport(Tcl_Interp* interp, Tcl_Namespace* nsPtr, const char* pattern); +/* 512 */ +EXTERN Tcl_Namespace* Tcl_GetCurrentNamespace(Tcl_Interp* interp); +/* 513 */ +EXTERN Tcl_Namespace* Tcl_GetGlobalNamespace(Tcl_Interp* interp); +/* 514 */ +EXTERN Tcl_Namespace* Tcl_FindNamespace( + Tcl_Interp* interp, + const char* name, + Tcl_Namespace* contextNsPtr, + int flags); +/* 515 */ +EXTERN Tcl_Command Tcl_FindCommand( + Tcl_Interp* interp, + const char* name, + Tcl_Namespace* contextNsPtr, + int flags); +/* 516 */ +EXTERN Tcl_Command Tcl_GetCommandFromObj(Tcl_Interp* interp, Tcl_Obj* objPtr); +/* 517 */ +EXTERN void Tcl_GetCommandFullName( + Tcl_Interp* interp, + Tcl_Command command, + Tcl_Obj* objPtr); +/* 518 */ +EXTERN int Tcl_FSEvalFileEx( + Tcl_Interp* interp, + Tcl_Obj* fileName, + const char* encodingName); +/* 519 */ +EXTERN Tcl_ExitProc* Tcl_SetExitProc(TCL_NORETURN1 Tcl_ExitProc* proc); +/* 520 */ +EXTERN void Tcl_LimitAddHandler( + Tcl_Interp* interp, + int type, + Tcl_LimitHandlerProc* handlerProc, + ClientData clientData, + Tcl_LimitHandlerDeleteProc* deleteProc); +/* 521 */ +EXTERN void Tcl_LimitRemoveHandler( + Tcl_Interp* interp, + int type, + Tcl_LimitHandlerProc* handlerProc, + ClientData clientData); +/* 522 */ +EXTERN int Tcl_LimitReady(Tcl_Interp* interp); +/* 523 */ +EXTERN int Tcl_LimitCheck(Tcl_Interp* interp); +/* 524 */ +EXTERN int Tcl_LimitExceeded(Tcl_Interp* interp); +/* 525 */ +EXTERN void Tcl_LimitSetCommands(Tcl_Interp* interp, int commandLimit); +/* 526 */ +EXTERN void Tcl_LimitSetTime(Tcl_Interp* interp, Tcl_Time* timeLimitPtr); +/* 527 */ +EXTERN void +Tcl_LimitSetGranularity(Tcl_Interp* interp, int type, int granularity); +/* 528 */ +EXTERN int Tcl_LimitTypeEnabled(Tcl_Interp* interp, int type); +/* 529 */ +EXTERN int Tcl_LimitTypeExceeded(Tcl_Interp* interp, int type); +/* 530 */ +EXTERN void Tcl_LimitTypeSet(Tcl_Interp* interp, int type); +/* 531 */ +EXTERN void Tcl_LimitTypeReset(Tcl_Interp* interp, int type); +/* 532 */ +EXTERN int Tcl_LimitGetCommands(Tcl_Interp* interp); +/* 533 */ +EXTERN void Tcl_LimitGetTime(Tcl_Interp* interp, Tcl_Time* timeLimitPtr); +/* 534 */ +EXTERN int Tcl_LimitGetGranularity(Tcl_Interp* interp, int type); +/* 535 */ +EXTERN Tcl_InterpState Tcl_SaveInterpState(Tcl_Interp* interp, int status); +/* 536 */ +EXTERN int Tcl_RestoreInterpState(Tcl_Interp* interp, Tcl_InterpState state); +/* 537 */ +EXTERN void Tcl_DiscardInterpState(Tcl_InterpState state); +/* 538 */ +EXTERN int Tcl_SetReturnOptions(Tcl_Interp* interp, Tcl_Obj* options); +/* 539 */ +EXTERN Tcl_Obj* Tcl_GetReturnOptions(Tcl_Interp* interp, int result); +/* 540 */ +EXTERN int Tcl_IsEnsemble(Tcl_Command token); +/* 541 */ +EXTERN Tcl_Command Tcl_CreateEnsemble( + Tcl_Interp* interp, + const char* name, + Tcl_Namespace* namespacePtr, + int flags); +/* 542 */ +EXTERN Tcl_Command +Tcl_FindEnsemble(Tcl_Interp* interp, Tcl_Obj* cmdNameObj, int flags); +/* 543 */ +EXTERN int Tcl_SetEnsembleSubcommandList( + Tcl_Interp* interp, + Tcl_Command token, + Tcl_Obj* subcmdList); +/* 544 */ +EXTERN int Tcl_SetEnsembleMappingDict( + Tcl_Interp* interp, + Tcl_Command token, + Tcl_Obj* mapDict); +/* 545 */ +EXTERN int Tcl_SetEnsembleUnknownHandler( + Tcl_Interp* interp, + Tcl_Command token, + Tcl_Obj* unknownList); +/* 546 */ +EXTERN int +Tcl_SetEnsembleFlags(Tcl_Interp* interp, Tcl_Command token, int flags); +/* 547 */ +EXTERN int Tcl_GetEnsembleSubcommandList( + Tcl_Interp* interp, + Tcl_Command token, + Tcl_Obj** subcmdListPtr); +/* 548 */ +EXTERN int Tcl_GetEnsembleMappingDict( + Tcl_Interp* interp, + Tcl_Command token, + Tcl_Obj** mapDictPtr); +/* 549 */ +EXTERN int Tcl_GetEnsembleUnknownHandler( + Tcl_Interp* interp, + Tcl_Command token, + Tcl_Obj** unknownListPtr); +/* 550 */ +EXTERN int +Tcl_GetEnsembleFlags(Tcl_Interp* interp, Tcl_Command token, int* flagsPtr); +/* 551 */ +EXTERN int Tcl_GetEnsembleNamespace( + Tcl_Interp* interp, + Tcl_Command token, + Tcl_Namespace** namespacePtrPtr); +/* 552 */ +EXTERN void Tcl_SetTimeProc( + Tcl_GetTimeProc* getProc, + Tcl_ScaleTimeProc* scaleProc, + ClientData clientData); +/* 553 */ +EXTERN void Tcl_QueryTimeProc( + Tcl_GetTimeProc** getProc, + Tcl_ScaleTimeProc** scaleProc, + ClientData* clientData); +/* 554 */ +EXTERN Tcl_DriverThreadActionProc* Tcl_ChannelThreadActionProc( + const Tcl_ChannelType* chanTypePtr); +/* 555 */ +EXTERN Tcl_Obj* Tcl_NewBignumObj(mp_int* value); +/* 556 */ +EXTERN Tcl_Obj* Tcl_DbNewBignumObj(mp_int* value, const char* file, int line); +/* 557 */ +EXTERN void Tcl_SetBignumObj(Tcl_Obj* obj, mp_int* value); +/* 558 */ +EXTERN int +Tcl_GetBignumFromObj(Tcl_Interp* interp, Tcl_Obj* obj, mp_int* value); +/* 559 */ +EXTERN int +Tcl_TakeBignumFromObj(Tcl_Interp* interp, Tcl_Obj* obj, mp_int* value); +/* 560 */ +EXTERN int Tcl_TruncateChannel(Tcl_Channel chan, Tcl_WideInt length); +/* 561 */ +EXTERN Tcl_DriverTruncateProc* Tcl_ChannelTruncateProc( + const Tcl_ChannelType* chanTypePtr); +/* 562 */ +EXTERN void Tcl_SetChannelErrorInterp(Tcl_Interp* interp, Tcl_Obj* msg); +/* 563 */ +EXTERN void Tcl_GetChannelErrorInterp(Tcl_Interp* interp, Tcl_Obj** msg); +/* 564 */ +EXTERN void Tcl_SetChannelError(Tcl_Channel chan, Tcl_Obj* msg); +/* 565 */ +EXTERN void Tcl_GetChannelError(Tcl_Channel chan, Tcl_Obj** msg); +/* 566 */ +EXTERN int +Tcl_InitBignumFromDouble(Tcl_Interp* interp, double initval, mp_int* toInit); +/* 567 */ +EXTERN Tcl_Obj* Tcl_GetNamespaceUnknownHandler( + Tcl_Interp* interp, + Tcl_Namespace* nsPtr); +/* 568 */ +EXTERN int Tcl_SetNamespaceUnknownHandler( + Tcl_Interp* interp, + Tcl_Namespace* nsPtr, + Tcl_Obj* handlerPtr); +/* 569 */ +EXTERN int Tcl_GetEncodingFromObj( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + Tcl_Encoding* encodingPtr); +/* 570 */ +EXTERN Tcl_Obj* Tcl_GetEncodingSearchPath(void); +/* 571 */ +EXTERN int Tcl_SetEncodingSearchPath(Tcl_Obj* searchPath); +/* 572 */ +EXTERN const char* Tcl_GetEncodingNameFromEnvironment(Tcl_DString* bufPtr); +/* 573 */ +EXTERN int Tcl_PkgRequireProc( + Tcl_Interp* interp, + const char* name, + int objc, + Tcl_Obj* const objv[], + void* clientDataPtr); +/* 574 */ +EXTERN void Tcl_AppendObjToErrorInfo(Tcl_Interp* interp, Tcl_Obj* objPtr); +/* 575 */ +EXTERN void Tcl_AppendLimitedToObj( + Tcl_Obj* objPtr, + const char* bytes, + int length, + int limit, + const char* ellipsis); +/* 576 */ +EXTERN Tcl_Obj* Tcl_Format( + Tcl_Interp* interp, + const char* format, + int objc, + Tcl_Obj* const objv[]); +/* 577 */ +EXTERN int Tcl_AppendFormatToObj( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + const char* format, + int objc, + Tcl_Obj* const objv[]); +/* 578 */ +EXTERN Tcl_Obj* Tcl_ObjPrintf(const char* format, ...) TCL_FORMAT_PRINTF(1, 2); +/* 579 */ +EXTERN void Tcl_AppendPrintfToObj(Tcl_Obj* objPtr, const char* format, ...) + TCL_FORMAT_PRINTF(2, 3); +/* 580 */ +EXTERN int Tcl_CancelEval( + Tcl_Interp* interp, + Tcl_Obj* resultObjPtr, + ClientData clientData, + int flags); +/* 581 */ +EXTERN int Tcl_Canceled(Tcl_Interp* interp, int flags); +/* 582 */ +EXTERN int Tcl_CreatePipe( + Tcl_Interp* interp, + Tcl_Channel* rchan, + Tcl_Channel* wchan, + int flags); +/* 583 */ +EXTERN Tcl_Command Tcl_NRCreateCommand( + Tcl_Interp* interp, + const char* cmdName, + Tcl_ObjCmdProc* proc, + Tcl_ObjCmdProc* nreProc, + ClientData clientData, + Tcl_CmdDeleteProc* deleteProc); +/* 584 */ +EXTERN int Tcl_NREvalObj(Tcl_Interp* interp, Tcl_Obj* objPtr, int flags); +/* 585 */ +EXTERN int +Tcl_NREvalObjv(Tcl_Interp* interp, int objc, Tcl_Obj* const objv[], int flags); +/* 586 */ +EXTERN int Tcl_NRCmdSwap( + Tcl_Interp* interp, + Tcl_Command cmd, + int objc, + Tcl_Obj* const objv[], + int flags); +/* 587 */ +EXTERN void Tcl_NRAddCallback( + Tcl_Interp* interp, + Tcl_NRPostProc* postProcPtr, + ClientData data0, + ClientData data1, + ClientData data2, + ClientData data3); +/* 588 */ +EXTERN int Tcl_NRCallObjProc( + Tcl_Interp* interp, + Tcl_ObjCmdProc* objProc, + ClientData clientData, + int objc, + Tcl_Obj* const objv[]); +/* 589 */ +EXTERN unsigned Tcl_GetFSDeviceFromStat(const Tcl_StatBuf* statPtr); +/* 590 */ +EXTERN unsigned Tcl_GetFSInodeFromStat(const Tcl_StatBuf* statPtr); +/* 591 */ +EXTERN unsigned Tcl_GetModeFromStat(const Tcl_StatBuf* statPtr); +/* 592 */ +EXTERN int Tcl_GetLinkCountFromStat(const Tcl_StatBuf* statPtr); +/* 593 */ +EXTERN int Tcl_GetUserIdFromStat(const Tcl_StatBuf* statPtr); +/* 594 */ +EXTERN int Tcl_GetGroupIdFromStat(const Tcl_StatBuf* statPtr); +/* 595 */ +EXTERN int Tcl_GetDeviceTypeFromStat(const Tcl_StatBuf* statPtr); +/* 596 */ +EXTERN Tcl_WideInt Tcl_GetAccessTimeFromStat(const Tcl_StatBuf* statPtr); +/* 597 */ +EXTERN Tcl_WideInt Tcl_GetModificationTimeFromStat(const Tcl_StatBuf* statPtr); +/* 598 */ +EXTERN Tcl_WideInt Tcl_GetChangeTimeFromStat(const Tcl_StatBuf* statPtr); +/* 599 */ +EXTERN Tcl_WideUInt Tcl_GetSizeFromStat(const Tcl_StatBuf* statPtr); +/* 600 */ +EXTERN Tcl_WideUInt Tcl_GetBlocksFromStat(const Tcl_StatBuf* statPtr); +/* 601 */ +EXTERN unsigned Tcl_GetBlockSizeFromStat(const Tcl_StatBuf* statPtr); +/* 602 */ +EXTERN int Tcl_SetEnsembleParameterList( + Tcl_Interp* interp, + Tcl_Command token, + Tcl_Obj* paramList); +/* 603 */ +EXTERN int Tcl_GetEnsembleParameterList( + Tcl_Interp* interp, + Tcl_Command token, + Tcl_Obj** paramListPtr); +/* 604 */ +EXTERN int Tcl_ParseArgsObjv( + Tcl_Interp* interp, + const Tcl_ArgvInfo* argTable, + int* objcPtr, + Tcl_Obj* const* objv, + Tcl_Obj*** remObjv); +/* 605 */ +EXTERN int Tcl_GetErrorLine(Tcl_Interp* interp); +/* 606 */ +EXTERN void Tcl_SetErrorLine(Tcl_Interp* interp, int lineNum); +/* 607 */ +EXTERN void Tcl_TransferResult( + Tcl_Interp* sourceInterp, + int result, + Tcl_Interp* targetInterp); +/* 608 */ +EXTERN int Tcl_InterpActive(Tcl_Interp* interp); +/* 609 */ +EXTERN void Tcl_BackgroundException(Tcl_Interp* interp, int code); +/* 610 */ +EXTERN int Tcl_ZlibDeflate( + Tcl_Interp* interp, + int format, + Tcl_Obj* data, + int level, + Tcl_Obj* gzipHeaderDictObj); +/* 611 */ +EXTERN int Tcl_ZlibInflate( + Tcl_Interp* interp, + int format, + Tcl_Obj* data, + int buffersize, + Tcl_Obj* gzipHeaderDictObj); +/* 612 */ +EXTERN unsigned int +Tcl_ZlibCRC32(unsigned int crc, const unsigned char* buf, int len); +/* 613 */ +EXTERN unsigned int +Tcl_ZlibAdler32(unsigned int adler, const unsigned char* buf, int len); +/* 614 */ +EXTERN int Tcl_ZlibStreamInit( + Tcl_Interp* interp, + int mode, + int format, + int level, + Tcl_Obj* dictObj, + Tcl_ZlibStream* zshandle); +/* 615 */ +EXTERN Tcl_Obj* Tcl_ZlibStreamGetCommandName(Tcl_ZlibStream zshandle); +/* 616 */ +EXTERN int Tcl_ZlibStreamEof(Tcl_ZlibStream zshandle); +/* 617 */ +EXTERN int Tcl_ZlibStreamChecksum(Tcl_ZlibStream zshandle); +/* 618 */ +EXTERN int Tcl_ZlibStreamPut(Tcl_ZlibStream zshandle, Tcl_Obj* data, int flush); +/* 619 */ +EXTERN int Tcl_ZlibStreamGet(Tcl_ZlibStream zshandle, Tcl_Obj* data, int count); +/* 620 */ +EXTERN int Tcl_ZlibStreamClose(Tcl_ZlibStream zshandle); +/* 621 */ +EXTERN int Tcl_ZlibStreamReset(Tcl_ZlibStream zshandle); +/* 622 */ +EXTERN void Tcl_SetStartupScript(Tcl_Obj* path, const char* encoding); +/* 623 */ +EXTERN Tcl_Obj* Tcl_GetStartupScript(const char** encodingPtr); +/* 624 */ +EXTERN int Tcl_CloseEx(Tcl_Interp* interp, Tcl_Channel chan, int flags); +/* 625 */ +EXTERN int +Tcl_NRExprObj(Tcl_Interp* interp, Tcl_Obj* objPtr, Tcl_Obj* resultPtr); +/* 626 */ +EXTERN int Tcl_NRSubstObj(Tcl_Interp* interp, Tcl_Obj* objPtr, int flags); +/* 627 */ +EXTERN int Tcl_LoadFile( + Tcl_Interp* interp, + Tcl_Obj* pathPtr, + const char* const symv[], + int flags, + void* procPtrs, + Tcl_LoadHandle* handlePtr); +/* 628 */ +EXTERN void* +Tcl_FindSymbol(Tcl_Interp* interp, Tcl_LoadHandle handle, const char* symbol); +/* 629 */ +EXTERN int Tcl_FSUnloadFile(Tcl_Interp* interp, Tcl_LoadHandle handlePtr); +/* 630 */ +EXTERN void Tcl_ZlibStreamSetCompressionDictionary( + Tcl_ZlibStream zhandle, + Tcl_Obj* compressionDictionaryObj); + +typedef struct { + const struct TclPlatStubs* tclPlatStubs; + const struct TclIntStubs* tclIntStubs; + const struct TclIntPlatStubs* tclIntPlatStubs; +} TclStubHooks; + +typedef struct TclStubs { + int magic; + const TclStubHooks* hooks; + + int (*tcl_PkgProvideEx)( + Tcl_Interp* interp, + const char* name, + const char* version, + const void* clientData); /* 0 */ + CONST84_RETURN char* (*tcl_PkgRequireEx)( + Tcl_Interp* interp, + const char* name, + const char* version, + int exact, + void* clientDataPtr); /* 1 */ + TCL_NORETURN1 void (*tcl_Panic)(const char* format, ...) + TCL_FORMAT_PRINTF(1, 2); /* 2 */ + char* (*tcl_Alloc)(unsigned int size); /* 3 */ + void (*tcl_Free)(char* ptr); /* 4 */ + char* (*tcl_Realloc)(char* ptr, unsigned int size); /* 5 */ + char* (*tcl_DbCkalloc)(unsigned int size, const char* file, int line); /* 6 */ + void (*tcl_DbCkfree)(char* ptr, const char* file, int line); /* 7 */ + char* (*tcl_DbCkrealloc)( + char* ptr, + unsigned int size, + const char* file, + int line); /* 8 */ +#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */ + void (*tcl_CreateFileHandler)( + int fd, + int mask, + Tcl_FileProc* proc, + ClientData clientData); /* 9 */ +#endif /* UNIX */ +#if defined(_WIN32) /* WIN */ + void (*reserved9)(void); +#endif /* WIN */ +#ifdef MAC_OSX_TCL /* MACOSX */ + void (*tcl_CreateFileHandler)( + int fd, + int mask, + Tcl_FileProc* proc, + ClientData clientData); /* 9 */ +#endif /* MACOSX */ +#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */ + void (*tcl_DeleteFileHandler)(int fd); /* 10 */ +#endif /* UNIX */ +#if defined(_WIN32) /* WIN */ + void (*reserved10)(void); +#endif /* WIN */ +#ifdef MAC_OSX_TCL /* MACOSX */ + void (*tcl_DeleteFileHandler)(int fd); /* 10 */ +#endif /* MACOSX */ + void (*tcl_SetTimer)(const Tcl_Time* timePtr); /* 11 */ + void (*tcl_Sleep)(int ms); /* 12 */ + int (*tcl_WaitForEvent)(const Tcl_Time* timePtr); /* 13 */ + int (*tcl_AppendAllObjTypes)(Tcl_Interp* interp, Tcl_Obj* objPtr); /* 14 */ + void (*tcl_AppendStringsToObj)(Tcl_Obj* objPtr, ...); /* 15 */ + void (*tcl_AppendToObj)( + Tcl_Obj* objPtr, + const char* bytes, + int length); /* 16 */ + Tcl_Obj* (*tcl_ConcatObj)(int objc, Tcl_Obj* const objv[]); /* 17 */ + int (*tcl_ConvertToType)( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + const Tcl_ObjType* typePtr); /* 18 */ + void (*tcl_DbDecrRefCount)( + Tcl_Obj* objPtr, + const char* file, + int line); /* 19 */ + void (*tcl_DbIncrRefCount)( + Tcl_Obj* objPtr, + const char* file, + int line); /* 20 */ + int (*tcl_DbIsShared)(Tcl_Obj* objPtr, const char* file, int line); /* 21 */ + Tcl_Obj* ( + *tcl_DbNewBooleanObj)(int boolValue, const char* file, int line); /* 22 */ + Tcl_Obj* (*tcl_DbNewByteArrayObj)( + const unsigned char* bytes, + int length, + const char* file, + int line); /* 23 */ + Tcl_Obj* (*tcl_DbNewDoubleObj)( + double doubleValue, + const char* file, + int line); /* 24 */ + Tcl_Obj* (*tcl_DbNewListObj)( + int objc, + Tcl_Obj* const* objv, + const char* file, + int line); /* 25 */ + Tcl_Obj* ( + *tcl_DbNewLongObj)(long longValue, const char* file, int line); /* 26 */ + Tcl_Obj* (*tcl_DbNewObj)(const char* file, int line); /* 27 */ + Tcl_Obj* (*tcl_DbNewStringObj)( + const char* bytes, + int length, + const char* file, + int line); /* 28 */ + Tcl_Obj* (*tcl_DuplicateObj)(Tcl_Obj* objPtr); /* 29 */ + void (*tclFreeObj)(Tcl_Obj* objPtr); /* 30 */ + int (*tcl_GetBoolean)( + Tcl_Interp* interp, + const char* src, + int* boolPtr); /* 31 */ + int (*tcl_GetBooleanFromObj)( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + int* boolPtr); /* 32 */ + unsigned char* ( + *tcl_GetByteArrayFromObj)(Tcl_Obj* objPtr, int* lengthPtr); /* 33 */ + int (*tcl_GetDouble)( + Tcl_Interp* interp, + const char* src, + double* doublePtr); /* 34 */ + int (*tcl_GetDoubleFromObj)( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + double* doublePtr); /* 35 */ + int (*tcl_GetIndexFromObj)( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + CONST84 char* const* tablePtr, + const char* msg, + int flags, + int* indexPtr); /* 36 */ + int (*tcl_GetInt)(Tcl_Interp* interp, const char* src, int* intPtr); /* 37 */ + int (*tcl_GetIntFromObj)( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + int* intPtr); /* 38 */ + int (*tcl_GetLongFromObj)( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + long* longPtr); /* 39 */ + CONST86 Tcl_ObjType* (*tcl_GetObjType)(const char* typeName); /* 40 */ + char* (*tcl_GetStringFromObj)(Tcl_Obj* objPtr, int* lengthPtr); /* 41 */ + void (*tcl_InvalidateStringRep)(Tcl_Obj* objPtr); /* 42 */ + int (*tcl_ListObjAppendList)( + Tcl_Interp* interp, + Tcl_Obj* listPtr, + Tcl_Obj* elemListPtr); /* 43 */ + int (*tcl_ListObjAppendElement)( + Tcl_Interp* interp, + Tcl_Obj* listPtr, + Tcl_Obj* objPtr); /* 44 */ + int (*tcl_ListObjGetElements)( + Tcl_Interp* interp, + Tcl_Obj* listPtr, + int* objcPtr, + Tcl_Obj*** objvPtr); /* 45 */ + int (*tcl_ListObjIndex)( + Tcl_Interp* interp, + Tcl_Obj* listPtr, + int index, + Tcl_Obj** objPtrPtr); /* 46 */ + int (*tcl_ListObjLength)( + Tcl_Interp* interp, + Tcl_Obj* listPtr, + int* lengthPtr); /* 47 */ + int (*tcl_ListObjReplace)( + Tcl_Interp* interp, + Tcl_Obj* listPtr, + int first, + int count, + int objc, + Tcl_Obj* const objv[]); /* 48 */ + Tcl_Obj* (*tcl_NewBooleanObj)(int boolValue); /* 49 */ + Tcl_Obj* ( + *tcl_NewByteArrayObj)(const unsigned char* bytes, int length); /* 50 */ + Tcl_Obj* (*tcl_NewDoubleObj)(double doubleValue); /* 51 */ + Tcl_Obj* (*tcl_NewIntObj)(int intValue); /* 52 */ + Tcl_Obj* (*tcl_NewListObj)(int objc, Tcl_Obj* const objv[]); /* 53 */ + Tcl_Obj* (*tcl_NewLongObj)(long longValue); /* 54 */ + Tcl_Obj* (*tcl_NewObj)(void); /* 55 */ + Tcl_Obj* (*tcl_NewStringObj)(const char* bytes, int length); /* 56 */ + void (*tcl_SetBooleanObj)(Tcl_Obj* objPtr, int boolValue); /* 57 */ + unsigned char* ( + *tcl_SetByteArrayLength)(Tcl_Obj* objPtr, int length); /* 58 */ + void (*tcl_SetByteArrayObj)( + Tcl_Obj* objPtr, + const unsigned char* bytes, + int length); /* 59 */ + void (*tcl_SetDoubleObj)(Tcl_Obj* objPtr, double doubleValue); /* 60 */ + void (*tcl_SetIntObj)(Tcl_Obj* objPtr, int intValue); /* 61 */ + void (*tcl_SetListObj)( + Tcl_Obj* objPtr, + int objc, + Tcl_Obj* const objv[]); /* 62 */ + void (*tcl_SetLongObj)(Tcl_Obj* objPtr, long longValue); /* 63 */ + void (*tcl_SetObjLength)(Tcl_Obj* objPtr, int length); /* 64 */ + void (*tcl_SetStringObj)( + Tcl_Obj* objPtr, + const char* bytes, + int length); /* 65 */ + void (*tcl_AddErrorInfo)(Tcl_Interp* interp, const char* message); /* 66 */ + void (*tcl_AddObjErrorInfo)( + Tcl_Interp* interp, + const char* message, + int length); /* 67 */ + void (*tcl_AllowExceptions)(Tcl_Interp* interp); /* 68 */ + void (*tcl_AppendElement)(Tcl_Interp* interp, const char* element); /* 69 */ + void (*tcl_AppendResult)(Tcl_Interp* interp, ...); /* 70 */ + Tcl_AsyncHandler ( + *tcl_AsyncCreate)(Tcl_AsyncProc* proc, ClientData clientData); /* 71 */ + void (*tcl_AsyncDelete)(Tcl_AsyncHandler async); /* 72 */ + int (*tcl_AsyncInvoke)(Tcl_Interp* interp, int code); /* 73 */ + void (*tcl_AsyncMark)(Tcl_AsyncHandler async); /* 74 */ + int (*tcl_AsyncReady)(void); /* 75 */ + void (*tcl_BackgroundError)(Tcl_Interp* interp); /* 76 */ + char (*tcl_Backslash)(const char* src, int* readPtr); /* 77 */ + int (*tcl_BadChannelOption)( + Tcl_Interp* interp, + const char* optionName, + const char* optionList); /* 78 */ + void (*tcl_CallWhenDeleted)( + Tcl_Interp* interp, + Tcl_InterpDeleteProc* proc, + ClientData clientData); /* 79 */ + void (*tcl_CancelIdleCall)( + Tcl_IdleProc* idleProc, + ClientData clientData); /* 80 */ + int (*tcl_Close)(Tcl_Interp* interp, Tcl_Channel chan); /* 81 */ + int (*tcl_CommandComplete)(const char* cmd); /* 82 */ + char* (*tcl_Concat)(int argc, CONST84 char* const* argv); /* 83 */ + int (*tcl_ConvertElement)(const char* src, char* dst, int flags); /* 84 */ + int (*tcl_ConvertCountedElement)( + const char* src, + int length, + char* dst, + int flags); /* 85 */ + int (*tcl_CreateAlias)( + Tcl_Interp* slave, + const char* slaveCmd, + Tcl_Interp* target, + const char* targetCmd, + int argc, + CONST84 char* const* argv); /* 86 */ + int (*tcl_CreateAliasObj)( + Tcl_Interp* slave, + const char* slaveCmd, + Tcl_Interp* target, + const char* targetCmd, + int objc, + Tcl_Obj* const objv[]); /* 87 */ + Tcl_Channel (*tcl_CreateChannel)( + const Tcl_ChannelType* typePtr, + const char* chanName, + ClientData instanceData, + int mask); /* 88 */ + void (*tcl_CreateChannelHandler)( + Tcl_Channel chan, + int mask, + Tcl_ChannelProc* proc, + ClientData clientData); /* 89 */ + void (*tcl_CreateCloseHandler)( + Tcl_Channel chan, + Tcl_CloseProc* proc, + ClientData clientData); /* 90 */ + Tcl_Command (*tcl_CreateCommand)( + Tcl_Interp* interp, + const char* cmdName, + Tcl_CmdProc* proc, + ClientData clientData, + Tcl_CmdDeleteProc* deleteProc); /* 91 */ + void (*tcl_CreateEventSource)( + Tcl_EventSetupProc* setupProc, + Tcl_EventCheckProc* checkProc, + ClientData clientData); /* 92 */ + void (*tcl_CreateExitHandler)( + Tcl_ExitProc* proc, + ClientData clientData); /* 93 */ + Tcl_Interp* (*tcl_CreateInterp)(void); /* 94 */ + void (*tcl_CreateMathFunc)( + Tcl_Interp* interp, + const char* name, + int numArgs, + Tcl_ValueType* argTypes, + Tcl_MathProc* proc, + ClientData clientData); /* 95 */ + Tcl_Command (*tcl_CreateObjCommand)( + Tcl_Interp* interp, + const char* cmdName, + Tcl_ObjCmdProc* proc, + ClientData clientData, + Tcl_CmdDeleteProc* deleteProc); /* 96 */ + Tcl_Interp* (*tcl_CreateSlave)( + Tcl_Interp* interp, + const char* slaveName, + int isSafe); /* 97 */ + Tcl_TimerToken (*tcl_CreateTimerHandler)( + int milliseconds, + Tcl_TimerProc* proc, + ClientData clientData); /* 98 */ + Tcl_Trace (*tcl_CreateTrace)( + Tcl_Interp* interp, + int level, + Tcl_CmdTraceProc* proc, + ClientData clientData); /* 99 */ + void (*tcl_DeleteAssocData)(Tcl_Interp* interp, const char* name); /* 100 */ + void (*tcl_DeleteChannelHandler)( + Tcl_Channel chan, + Tcl_ChannelProc* proc, + ClientData clientData); /* 101 */ + void (*tcl_DeleteCloseHandler)( + Tcl_Channel chan, + Tcl_CloseProc* proc, + ClientData clientData); /* 102 */ + int (*tcl_DeleteCommand)(Tcl_Interp* interp, const char* cmdName); /* 103 */ + int (*tcl_DeleteCommandFromToken)( + Tcl_Interp* interp, + Tcl_Command command); /* 104 */ + void (*tcl_DeleteEvents)( + Tcl_EventDeleteProc* proc, + ClientData clientData); /* 105 */ + void (*tcl_DeleteEventSource)( + Tcl_EventSetupProc* setupProc, + Tcl_EventCheckProc* checkProc, + ClientData clientData); /* 106 */ + void (*tcl_DeleteExitHandler)( + Tcl_ExitProc* proc, + ClientData clientData); /* 107 */ + void (*tcl_DeleteHashEntry)(Tcl_HashEntry* entryPtr); /* 108 */ + void (*tcl_DeleteHashTable)(Tcl_HashTable* tablePtr); /* 109 */ + void (*tcl_DeleteInterp)(Tcl_Interp* interp); /* 110 */ + void (*tcl_DetachPids)(int numPids, Tcl_Pid* pidPtr); /* 111 */ + void (*tcl_DeleteTimerHandler)(Tcl_TimerToken token); /* 112 */ + void (*tcl_DeleteTrace)(Tcl_Interp* interp, Tcl_Trace trace); /* 113 */ + void (*tcl_DontCallWhenDeleted)( + Tcl_Interp* interp, + Tcl_InterpDeleteProc* proc, + ClientData clientData); /* 114 */ + int (*tcl_DoOneEvent)(int flags); /* 115 */ + void (*tcl_DoWhenIdle)(Tcl_IdleProc* proc, ClientData clientData); /* 116 */ + char* (*tcl_DStringAppend)( + Tcl_DString* dsPtr, + const char* bytes, + int length); /* 117 */ + char* (*tcl_DStringAppendElement)( + Tcl_DString* dsPtr, + const char* element); /* 118 */ + void (*tcl_DStringEndSublist)(Tcl_DString* dsPtr); /* 119 */ + void (*tcl_DStringFree)(Tcl_DString* dsPtr); /* 120 */ + void ( + *tcl_DStringGetResult)(Tcl_Interp* interp, Tcl_DString* dsPtr); /* 121 */ + void (*tcl_DStringInit)(Tcl_DString* dsPtr); /* 122 */ + void (*tcl_DStringResult)(Tcl_Interp* interp, Tcl_DString* dsPtr); /* 123 */ + void (*tcl_DStringSetLength)(Tcl_DString* dsPtr, int length); /* 124 */ + void (*tcl_DStringStartSublist)(Tcl_DString* dsPtr); /* 125 */ + int (*tcl_Eof)(Tcl_Channel chan); /* 126 */ + CONST84_RETURN char* (*tcl_ErrnoId)(void); /* 127 */ + CONST84_RETURN char* (*tcl_ErrnoMsg)(int err); /* 128 */ + int (*tcl_Eval)(Tcl_Interp* interp, const char* script); /* 129 */ + int (*tcl_EvalFile)(Tcl_Interp* interp, const char* fileName); /* 130 */ + int (*tcl_EvalObj)(Tcl_Interp* interp, Tcl_Obj* objPtr); /* 131 */ + void (*tcl_EventuallyFree)( + ClientData clientData, + Tcl_FreeProc* freeProc); /* 132 */ + TCL_NORETURN1 void (*tcl_Exit)(int status); /* 133 */ + int (*tcl_ExposeCommand)( + Tcl_Interp* interp, + const char* hiddenCmdToken, + const char* cmdName); /* 134 */ + int (*tcl_ExprBoolean)( + Tcl_Interp* interp, + const char* expr, + int* ptr); /* 135 */ + int (*tcl_ExprBooleanObj)( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + int* ptr); /* 136 */ + int (*tcl_ExprDouble)( + Tcl_Interp* interp, + const char* expr, + double* ptr); /* 137 */ + int (*tcl_ExprDoubleObj)( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + double* ptr); /* 138 */ + int ( + *tcl_ExprLong)(Tcl_Interp* interp, const char* expr, long* ptr); /* 139 */ + int (*tcl_ExprLongObj)( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + long* ptr); /* 140 */ + int (*tcl_ExprObj)( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + Tcl_Obj** resultPtrPtr); /* 141 */ + int (*tcl_ExprString)(Tcl_Interp* interp, const char* expr); /* 142 */ + void (*tcl_Finalize)(void); /* 143 */ + void (*tcl_FindExecutable)(const char* argv0); /* 144 */ + Tcl_HashEntry* (*tcl_FirstHashEntry)( + Tcl_HashTable* tablePtr, + Tcl_HashSearch* searchPtr); /* 145 */ + int (*tcl_Flush)(Tcl_Channel chan); /* 146 */ + void (*tcl_FreeResult)(Tcl_Interp* interp); /* 147 */ + int (*tcl_GetAlias)( + Tcl_Interp* interp, + const char* slaveCmd, + Tcl_Interp** targetInterpPtr, + CONST84 char** targetCmdPtr, + int* argcPtr, + CONST84 char*** argvPtr); /* 148 */ + int (*tcl_GetAliasObj)( + Tcl_Interp* interp, + const char* slaveCmd, + Tcl_Interp** targetInterpPtr, + CONST84 char** targetCmdPtr, + int* objcPtr, + Tcl_Obj*** objv); /* 149 */ + ClientData (*tcl_GetAssocData)( + Tcl_Interp* interp, + const char* name, + Tcl_InterpDeleteProc** procPtr); /* 150 */ + Tcl_Channel (*tcl_GetChannel)( + Tcl_Interp* interp, + const char* chanName, + int* modePtr); /* 151 */ + int (*tcl_GetChannelBufferSize)(Tcl_Channel chan); /* 152 */ + int (*tcl_GetChannelHandle)( + Tcl_Channel chan, + int direction, + ClientData* handlePtr); /* 153 */ + ClientData (*tcl_GetChannelInstanceData)(Tcl_Channel chan); /* 154 */ + int (*tcl_GetChannelMode)(Tcl_Channel chan); /* 155 */ + CONST84_RETURN char* (*tcl_GetChannelName)(Tcl_Channel chan); /* 156 */ + int (*tcl_GetChannelOption)( + Tcl_Interp* interp, + Tcl_Channel chan, + const char* optionName, + Tcl_DString* dsPtr); /* 157 */ + CONST86 Tcl_ChannelType* (*tcl_GetChannelType)(Tcl_Channel chan); /* 158 */ + int (*tcl_GetCommandInfo)( + Tcl_Interp* interp, + const char* cmdName, + Tcl_CmdInfo* infoPtr); /* 159 */ + CONST84_RETURN char* ( + *tcl_GetCommandName)(Tcl_Interp* interp, Tcl_Command command); /* 160 */ + int (*tcl_GetErrno)(void); /* 161 */ + CONST84_RETURN char* (*tcl_GetHostName)(void); /* 162 */ + int (*tcl_GetInterpPath)( + Tcl_Interp* askInterp, + Tcl_Interp* slaveInterp); /* 163 */ + Tcl_Interp* (*tcl_GetMaster)(Tcl_Interp* interp); /* 164 */ + const char* (*tcl_GetNameOfExecutable)(void); /* 165 */ + Tcl_Obj* (*tcl_GetObjResult)(Tcl_Interp* interp); /* 166 */ +#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */ + int (*tcl_GetOpenFile)( + Tcl_Interp* interp, + const char* chanID, + int forWriting, + int checkUsage, + ClientData* filePtr); /* 167 */ +#endif /* UNIX */ +#if defined(_WIN32) /* WIN */ + void (*reserved167)(void); +#endif /* WIN */ +#ifdef MAC_OSX_TCL /* MACOSX */ + int (*tcl_GetOpenFile)( + Tcl_Interp* interp, + const char* chanID, + int forWriting, + int checkUsage, + ClientData* filePtr); /* 167 */ +#endif /* MACOSX */ + Tcl_PathType (*tcl_GetPathType)(const char* path); /* 168 */ + int (*tcl_Gets)(Tcl_Channel chan, Tcl_DString* dsPtr); /* 169 */ + int (*tcl_GetsObj)(Tcl_Channel chan, Tcl_Obj* objPtr); /* 170 */ + int (*tcl_GetServiceMode)(void); /* 171 */ + Tcl_Interp* ( + *tcl_GetSlave)(Tcl_Interp* interp, const char* slaveName); /* 172 */ + Tcl_Channel (*tcl_GetStdChannel)(int type); /* 173 */ + CONST84_RETURN char* (*tcl_GetStringResult)(Tcl_Interp* interp); /* 174 */ + CONST84_RETURN char* (*tcl_GetVar)( + Tcl_Interp* interp, + const char* varName, + int flags); /* 175 */ + CONST84_RETURN char* (*tcl_GetVar2)( + Tcl_Interp* interp, + const char* part1, + const char* part2, + int flags); /* 176 */ + int (*tcl_GlobalEval)(Tcl_Interp* interp, const char* command); /* 177 */ + int (*tcl_GlobalEvalObj)(Tcl_Interp* interp, Tcl_Obj* objPtr); /* 178 */ + int (*tcl_HideCommand)( + Tcl_Interp* interp, + const char* cmdName, + const char* hiddenCmdToken); /* 179 */ + int (*tcl_Init)(Tcl_Interp* interp); /* 180 */ + void (*tcl_InitHashTable)(Tcl_HashTable* tablePtr, int keyType); /* 181 */ + int (*tcl_InputBlocked)(Tcl_Channel chan); /* 182 */ + int (*tcl_InputBuffered)(Tcl_Channel chan); /* 183 */ + int (*tcl_InterpDeleted)(Tcl_Interp* interp); /* 184 */ + int (*tcl_IsSafe)(Tcl_Interp* interp); /* 185 */ + char* (*tcl_JoinPath)( + int argc, + CONST84 char* const* argv, + Tcl_DString* resultPtr); /* 186 */ + int (*tcl_LinkVar)( + Tcl_Interp* interp, + const char* varName, + char* addr, + int type); /* 187 */ + void (*reserved188)(void); + Tcl_Channel (*tcl_MakeFileChannel)(ClientData handle, int mode); /* 189 */ + int (*tcl_MakeSafe)(Tcl_Interp* interp); /* 190 */ + Tcl_Channel (*tcl_MakeTcpClientChannel)(ClientData tcpSocket); /* 191 */ + char* (*tcl_Merge)(int argc, CONST84 char* const* argv); /* 192 */ + Tcl_HashEntry* (*tcl_NextHashEntry)(Tcl_HashSearch* searchPtr); /* 193 */ + void (*tcl_NotifyChannel)(Tcl_Channel channel, int mask); /* 194 */ + Tcl_Obj* (*tcl_ObjGetVar2)( + Tcl_Interp* interp, + Tcl_Obj* part1Ptr, + Tcl_Obj* part2Ptr, + int flags); /* 195 */ + Tcl_Obj* (*tcl_ObjSetVar2)( + Tcl_Interp* interp, + Tcl_Obj* part1Ptr, + Tcl_Obj* part2Ptr, + Tcl_Obj* newValuePtr, + int flags); /* 196 */ + Tcl_Channel (*tcl_OpenCommandChannel)( + Tcl_Interp* interp, + int argc, + CONST84 char** argv, + int flags); /* 197 */ + Tcl_Channel (*tcl_OpenFileChannel)( + Tcl_Interp* interp, + const char* fileName, + const char* modeString, + int permissions); /* 198 */ + Tcl_Channel (*tcl_OpenTcpClient)( + Tcl_Interp* interp, + int port, + const char* address, + const char* myaddr, + int myport, + int async); /* 199 */ + Tcl_Channel (*tcl_OpenTcpServer)( + Tcl_Interp* interp, + int port, + const char* host, + Tcl_TcpAcceptProc* acceptProc, + ClientData callbackData); /* 200 */ + void (*tcl_Preserve)(ClientData data); /* 201 */ + void ( + *tcl_PrintDouble)(Tcl_Interp* interp, double value, char* dst); /* 202 */ + int (*tcl_PutEnv)(const char* assignment); /* 203 */ + CONST84_RETURN char* (*tcl_PosixError)(Tcl_Interp* interp); /* 204 */ + void ( + *tcl_QueueEvent)(Tcl_Event* evPtr, Tcl_QueuePosition position); /* 205 */ + int (*tcl_Read)(Tcl_Channel chan, char* bufPtr, int toRead); /* 206 */ + void (*tcl_ReapDetachedProcs)(void); /* 207 */ + int (*tcl_RecordAndEval)( + Tcl_Interp* interp, + const char* cmd, + int flags); /* 208 */ + int (*tcl_RecordAndEvalObj)( + Tcl_Interp* interp, + Tcl_Obj* cmdPtr, + int flags); /* 209 */ + void (*tcl_RegisterChannel)(Tcl_Interp* interp, Tcl_Channel chan); /* 210 */ + void (*tcl_RegisterObjType)(const Tcl_ObjType* typePtr); /* 211 */ + Tcl_RegExp ( + *tcl_RegExpCompile)(Tcl_Interp* interp, const char* pattern); /* 212 */ + int (*tcl_RegExpExec)( + Tcl_Interp* interp, + Tcl_RegExp regexp, + const char* text, + const char* start); /* 213 */ + int (*tcl_RegExpMatch)( + Tcl_Interp* interp, + const char* text, + const char* pattern); /* 214 */ + void (*tcl_RegExpRange)( + Tcl_RegExp regexp, + int index, + CONST84 char** startPtr, + CONST84 char** endPtr); /* 215 */ + void (*tcl_Release)(ClientData clientData); /* 216 */ + void (*tcl_ResetResult)(Tcl_Interp* interp); /* 217 */ + int (*tcl_ScanElement)(const char* src, int* flagPtr); /* 218 */ + int (*tcl_ScanCountedElement)( + const char* src, + int length, + int* flagPtr); /* 219 */ + int (*tcl_SeekOld)(Tcl_Channel chan, int offset, int mode); /* 220 */ + int (*tcl_ServiceAll)(void); /* 221 */ + int (*tcl_ServiceEvent)(int flags); /* 222 */ + void (*tcl_SetAssocData)( + Tcl_Interp* interp, + const char* name, + Tcl_InterpDeleteProc* proc, + ClientData clientData); /* 223 */ + void (*tcl_SetChannelBufferSize)(Tcl_Channel chan, int sz); /* 224 */ + int (*tcl_SetChannelOption)( + Tcl_Interp* interp, + Tcl_Channel chan, + const char* optionName, + const char* newValue); /* 225 */ + int (*tcl_SetCommandInfo)( + Tcl_Interp* interp, + const char* cmdName, + const Tcl_CmdInfo* infoPtr); /* 226 */ + void (*tcl_SetErrno)(int err); /* 227 */ + void (*tcl_SetErrorCode)(Tcl_Interp* interp, ...); /* 228 */ + void (*tcl_SetMaxBlockTime)(const Tcl_Time* timePtr); /* 229 */ + void (*tcl_SetPanicProc)(TCL_NORETURN1 Tcl_PanicProc* panicProc); /* 230 */ + int (*tcl_SetRecursionLimit)(Tcl_Interp* interp, int depth); /* 231 */ + void (*tcl_SetResult)( + Tcl_Interp* interp, + char* result, + Tcl_FreeProc* freeProc); /* 232 */ + int (*tcl_SetServiceMode)(int mode); /* 233 */ + void ( + *tcl_SetObjErrorCode)(Tcl_Interp* interp, Tcl_Obj* errorObjPtr); /* 234 */ + void (*tcl_SetObjResult)(Tcl_Interp* interp, Tcl_Obj* resultObjPtr); /* 235 */ + void (*tcl_SetStdChannel)(Tcl_Channel channel, int type); /* 236 */ + CONST84_RETURN char* (*tcl_SetVar)( + Tcl_Interp* interp, + const char* varName, + const char* newValue, + int flags); /* 237 */ + CONST84_RETURN char* (*tcl_SetVar2)( + Tcl_Interp* interp, + const char* part1, + const char* part2, + const char* newValue, + int flags); /* 238 */ + CONST84_RETURN char* (*tcl_SignalId)(int sig); /* 239 */ + CONST84_RETURN char* (*tcl_SignalMsg)(int sig); /* 240 */ + void (*tcl_SourceRCFile)(Tcl_Interp* interp); /* 241 */ + int (*tcl_SplitList)( + Tcl_Interp* interp, + const char* listStr, + int* argcPtr, + CONST84 char*** argvPtr); /* 242 */ + void (*tcl_SplitPath)( + const char* path, + int* argcPtr, + CONST84 char*** argvPtr); /* 243 */ + void (*tcl_StaticPackage)( + Tcl_Interp* interp, + const char* pkgName, + Tcl_PackageInitProc* initProc, + Tcl_PackageInitProc* safeInitProc); /* 244 */ + int (*tcl_StringMatch)(const char* str, const char* pattern); /* 245 */ + int (*tcl_TellOld)(Tcl_Channel chan); /* 246 */ + int (*tcl_TraceVar)( + Tcl_Interp* interp, + const char* varName, + int flags, + Tcl_VarTraceProc* proc, + ClientData clientData); /* 247 */ + int (*tcl_TraceVar2)( + Tcl_Interp* interp, + const char* part1, + const char* part2, + int flags, + Tcl_VarTraceProc* proc, + ClientData clientData); /* 248 */ + char* (*tcl_TranslateFileName)( + Tcl_Interp* interp, + const char* name, + Tcl_DString* bufferPtr); /* 249 */ + int (*tcl_Ungets)( + Tcl_Channel chan, + const char* str, + int len, + int atHead); /* 250 */ + void (*tcl_UnlinkVar)(Tcl_Interp* interp, const char* varName); /* 251 */ + int (*tcl_UnregisterChannel)(Tcl_Interp* interp, Tcl_Channel chan); /* 252 */ + int (*tcl_UnsetVar)( + Tcl_Interp* interp, + const char* varName, + int flags); /* 253 */ + int (*tcl_UnsetVar2)( + Tcl_Interp* interp, + const char* part1, + const char* part2, + int flags); /* 254 */ + void (*tcl_UntraceVar)( + Tcl_Interp* interp, + const char* varName, + int flags, + Tcl_VarTraceProc* proc, + ClientData clientData); /* 255 */ + void (*tcl_UntraceVar2)( + Tcl_Interp* interp, + const char* part1, + const char* part2, + int flags, + Tcl_VarTraceProc* proc, + ClientData clientData); /* 256 */ + void ( + *tcl_UpdateLinkedVar)(Tcl_Interp* interp, const char* varName); /* 257 */ + int (*tcl_UpVar)( + Tcl_Interp* interp, + const char* frameName, + const char* varName, + const char* localName, + int flags); /* 258 */ + int (*tcl_UpVar2)( + Tcl_Interp* interp, + const char* frameName, + const char* part1, + const char* part2, + const char* localName, + int flags); /* 259 */ + int (*tcl_VarEval)(Tcl_Interp* interp, ...); /* 260 */ + ClientData (*tcl_VarTraceInfo)( + Tcl_Interp* interp, + const char* varName, + int flags, + Tcl_VarTraceProc* procPtr, + ClientData prevClientData); /* 261 */ + ClientData (*tcl_VarTraceInfo2)( + Tcl_Interp* interp, + const char* part1, + const char* part2, + int flags, + Tcl_VarTraceProc* procPtr, + ClientData prevClientData); /* 262 */ + int (*tcl_Write)(Tcl_Channel chan, const char* s, int slen); /* 263 */ + void (*tcl_WrongNumArgs)( + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[], + const char* message); /* 264 */ + int (*tcl_DumpActiveMemory)(const char* fileName); /* 265 */ + void (*tcl_ValidateAllMemory)(const char* file, int line); /* 266 */ + void (*tcl_AppendResultVA)(Tcl_Interp* interp, va_list argList); /* 267 */ + void (*tcl_AppendStringsToObjVA)(Tcl_Obj* objPtr, va_list argList); /* 268 */ + char* (*tcl_HashStats)(Tcl_HashTable* tablePtr); /* 269 */ + CONST84_RETURN char* (*tcl_ParseVar)( + Tcl_Interp* interp, + const char* start, + CONST84 char** termPtr); /* 270 */ + CONST84_RETURN char* (*tcl_PkgPresent)( + Tcl_Interp* interp, + const char* name, + const char* version, + int exact); /* 271 */ + CONST84_RETURN char* (*tcl_PkgPresentEx)( + Tcl_Interp* interp, + const char* name, + const char* version, + int exact, + void* clientDataPtr); /* 272 */ + int (*tcl_PkgProvide)( + Tcl_Interp* interp, + const char* name, + const char* version); /* 273 */ + CONST84_RETURN char* (*tcl_PkgRequire)( + Tcl_Interp* interp, + const char* name, + const char* version, + int exact); /* 274 */ + void (*tcl_SetErrorCodeVA)(Tcl_Interp* interp, va_list argList); /* 275 */ + int (*tcl_VarEvalVA)(Tcl_Interp* interp, va_list argList); /* 276 */ + Tcl_Pid (*tcl_WaitPid)(Tcl_Pid pid, int* statPtr, int options); /* 277 */ + TCL_NORETURN1 void ( + *tcl_PanicVA)(const char* format, va_list argList); /* 278 */ + void (*tcl_GetVersion)( + int* major, + int* minor, + int* patchLevel, + int* type); /* 279 */ + void (*tcl_InitMemory)(Tcl_Interp* interp); /* 280 */ + Tcl_Channel (*tcl_StackChannel)( + Tcl_Interp* interp, + const Tcl_ChannelType* typePtr, + ClientData instanceData, + int mask, + Tcl_Channel prevChan); /* 281 */ + int (*tcl_UnstackChannel)(Tcl_Interp* interp, Tcl_Channel chan); /* 282 */ + Tcl_Channel (*tcl_GetStackedChannel)(Tcl_Channel chan); /* 283 */ + void (*tcl_SetMainLoop)(Tcl_MainLoopProc* proc); /* 284 */ + void (*reserved285)(void); + void (*tcl_AppendObjToObj)(Tcl_Obj* objPtr, Tcl_Obj* appendObjPtr); /* 286 */ + Tcl_Encoding (*tcl_CreateEncoding)(const Tcl_EncodingType* typePtr); /* 287 */ + void (*tcl_CreateThreadExitHandler)( + Tcl_ExitProc* proc, + ClientData clientData); /* 288 */ + void (*tcl_DeleteThreadExitHandler)( + Tcl_ExitProc* proc, + ClientData clientData); /* 289 */ + void (*tcl_DiscardResult)(Tcl_SavedResult* statePtr); /* 290 */ + int (*tcl_EvalEx)( + Tcl_Interp* interp, + const char* script, + int numBytes, + int flags); /* 291 */ + int (*tcl_EvalObjv)( + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[], + int flags); /* 292 */ + int ( + *tcl_EvalObjEx)(Tcl_Interp* interp, Tcl_Obj* objPtr, int flags); /* 293 */ + void (*tcl_ExitThread)(int status); /* 294 */ + int (*tcl_ExternalToUtf)( + Tcl_Interp* interp, + Tcl_Encoding encoding, + const char* src, + int srcLen, + int flags, + Tcl_EncodingState* statePtr, + char* dst, + int dstLen, + int* srcReadPtr, + int* dstWrotePtr, + int* dstCharsPtr); /* 295 */ + char* (*tcl_ExternalToUtfDString)( + Tcl_Encoding encoding, + const char* src, + int srcLen, + Tcl_DString* dsPtr); /* 296 */ + void (*tcl_FinalizeThread)(void); /* 297 */ + void (*tcl_FinalizeNotifier)(ClientData clientData); /* 298 */ + void (*tcl_FreeEncoding)(Tcl_Encoding encoding); /* 299 */ + Tcl_ThreadId (*tcl_GetCurrentThread)(void); /* 300 */ + Tcl_Encoding ( + *tcl_GetEncoding)(Tcl_Interp* interp, const char* name); /* 301 */ + CONST84_RETURN char* (*tcl_GetEncodingName)(Tcl_Encoding encoding); /* 302 */ + void (*tcl_GetEncodingNames)(Tcl_Interp* interp); /* 303 */ + int (*tcl_GetIndexFromObjStruct)( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + const void* tablePtr, + int offset, + const char* msg, + int flags, + int* indexPtr); /* 304 */ + void* (*tcl_GetThreadData)(Tcl_ThreadDataKey* keyPtr, int size); /* 305 */ + Tcl_Obj* (*tcl_GetVar2Ex)( + Tcl_Interp* interp, + const char* part1, + const char* part2, + int flags); /* 306 */ + ClientData (*tcl_InitNotifier)(void); /* 307 */ + void (*tcl_MutexLock)(Tcl_Mutex* mutexPtr); /* 308 */ + void (*tcl_MutexUnlock)(Tcl_Mutex* mutexPtr); /* 309 */ + void (*tcl_ConditionNotify)(Tcl_Condition* condPtr); /* 310 */ + void (*tcl_ConditionWait)( + Tcl_Condition* condPtr, + Tcl_Mutex* mutexPtr, + const Tcl_Time* timePtr); /* 311 */ + int (*tcl_NumUtfChars)(const char* src, int length); /* 312 */ + int (*tcl_ReadChars)( + Tcl_Channel channel, + Tcl_Obj* objPtr, + int charsToRead, + int appendFlag); /* 313 */ + void (*tcl_RestoreResult)( + Tcl_Interp* interp, + Tcl_SavedResult* statePtr); /* 314 */ + void ( + *tcl_SaveResult)(Tcl_Interp* interp, Tcl_SavedResult* statePtr); /* 315 */ + int (*tcl_SetSystemEncoding)(Tcl_Interp* interp, const char* name); /* 316 */ + Tcl_Obj* (*tcl_SetVar2Ex)( + Tcl_Interp* interp, + const char* part1, + const char* part2, + Tcl_Obj* newValuePtr, + int flags); /* 317 */ + void (*tcl_ThreadAlert)(Tcl_ThreadId threadId); /* 318 */ + void (*tcl_ThreadQueueEvent)( + Tcl_ThreadId threadId, + Tcl_Event* evPtr, + Tcl_QueuePosition position); /* 319 */ + Tcl_UniChar (*tcl_UniCharAtIndex)(const char* src, int index); /* 320 */ + Tcl_UniChar (*tcl_UniCharToLower)(int ch); /* 321 */ + Tcl_UniChar (*tcl_UniCharToTitle)(int ch); /* 322 */ + Tcl_UniChar (*tcl_UniCharToUpper)(int ch); /* 323 */ + int (*tcl_UniCharToUtf)(int ch, char* buf); /* 324 */ + CONST84_RETURN char* (*tcl_UtfAtIndex)(const char* src, int index); /* 325 */ + int (*tcl_UtfCharComplete)(const char* src, int length); /* 326 */ + int (*tcl_UtfBackslash)(const char* src, int* readPtr, char* dst); /* 327 */ + CONST84_RETURN char* (*tcl_UtfFindFirst)(const char* src, int ch); /* 328 */ + CONST84_RETURN char* (*tcl_UtfFindLast)(const char* src, int ch); /* 329 */ + CONST84_RETURN char* (*tcl_UtfNext)(const char* src); /* 330 */ + CONST84_RETURN char* ( + *tcl_UtfPrev)(const char* src, const char* start); /* 331 */ + int (*tcl_UtfToExternal)( + Tcl_Interp* interp, + Tcl_Encoding encoding, + const char* src, + int srcLen, + int flags, + Tcl_EncodingState* statePtr, + char* dst, + int dstLen, + int* srcReadPtr, + int* dstWrotePtr, + int* dstCharsPtr); /* 332 */ + char* (*tcl_UtfToExternalDString)( + Tcl_Encoding encoding, + const char* src, + int srcLen, + Tcl_DString* dsPtr); /* 333 */ + int (*tcl_UtfToLower)(char* src); /* 334 */ + int (*tcl_UtfToTitle)(char* src); /* 335 */ + int (*tcl_UtfToUniChar)(const char* src, Tcl_UniChar* chPtr); /* 336 */ + int (*tcl_UtfToUpper)(char* src); /* 337 */ + int ( + *tcl_WriteChars)(Tcl_Channel chan, const char* src, int srcLen); /* 338 */ + int (*tcl_WriteObj)(Tcl_Channel chan, Tcl_Obj* objPtr); /* 339 */ + char* (*tcl_GetString)(Tcl_Obj* objPtr); /* 340 */ + CONST84_RETURN char* (*tcl_GetDefaultEncodingDir)(void); /* 341 */ + void (*tcl_SetDefaultEncodingDir)(const char* path); /* 342 */ + void (*tcl_AlertNotifier)(ClientData clientData); /* 343 */ + void (*tcl_ServiceModeHook)(int mode); /* 344 */ + int (*tcl_UniCharIsAlnum)(int ch); /* 345 */ + int (*tcl_UniCharIsAlpha)(int ch); /* 346 */ + int (*tcl_UniCharIsDigit)(int ch); /* 347 */ + int (*tcl_UniCharIsLower)(int ch); /* 348 */ + int (*tcl_UniCharIsSpace)(int ch); /* 349 */ + int (*tcl_UniCharIsUpper)(int ch); /* 350 */ + int (*tcl_UniCharIsWordChar)(int ch); /* 351 */ + int (*tcl_UniCharLen)(const Tcl_UniChar* uniStr); /* 352 */ + int (*tcl_UniCharNcmp)( + const Tcl_UniChar* ucs, + const Tcl_UniChar* uct, + unsigned long numChars); /* 353 */ + char* (*tcl_UniCharToUtfDString)( + const Tcl_UniChar* uniStr, + int uniLength, + Tcl_DString* dsPtr); /* 354 */ + Tcl_UniChar* (*tcl_UtfToUniCharDString)( + const char* src, + int length, + Tcl_DString* dsPtr); /* 355 */ + Tcl_RegExp (*tcl_GetRegExpFromObj)( + Tcl_Interp* interp, + Tcl_Obj* patObj, + int flags); /* 356 */ + Tcl_Obj* (*tcl_EvalTokens)( + Tcl_Interp* interp, + Tcl_Token* tokenPtr, + int count); /* 357 */ + void (*tcl_FreeParse)(Tcl_Parse* parsePtr); /* 358 */ + void (*tcl_LogCommandInfo)( + Tcl_Interp* interp, + const char* script, + const char* command, + int length); /* 359 */ + int (*tcl_ParseBraces)( + Tcl_Interp* interp, + const char* start, + int numBytes, + Tcl_Parse* parsePtr, + int append, + CONST84 char** termPtr); /* 360 */ + int (*tcl_ParseCommand)( + Tcl_Interp* interp, + const char* start, + int numBytes, + int nested, + Tcl_Parse* parsePtr); /* 361 */ + int (*tcl_ParseExpr)( + Tcl_Interp* interp, + const char* start, + int numBytes, + Tcl_Parse* parsePtr); /* 362 */ + int (*tcl_ParseQuotedString)( + Tcl_Interp* interp, + const char* start, + int numBytes, + Tcl_Parse* parsePtr, + int append, + CONST84 char** termPtr); /* 363 */ + int (*tcl_ParseVarName)( + Tcl_Interp* interp, + const char* start, + int numBytes, + Tcl_Parse* parsePtr, + int append); /* 364 */ + char* (*tcl_GetCwd)(Tcl_Interp* interp, Tcl_DString* cwdPtr); /* 365 */ + int (*tcl_Chdir)(const char* dirName); /* 366 */ + int (*tcl_Access)(const char* path, int mode); /* 367 */ + int (*tcl_Stat)(const char* path, struct stat* bufPtr); /* 368 */ + int (*tcl_UtfNcmp)(const char* s1, const char* s2, unsigned long n); /* 369 */ + int (*tcl_UtfNcasecmp)( + const char* s1, + const char* s2, + unsigned long n); /* 370 */ + int (*tcl_StringCaseMatch)( + const char* str, + const char* pattern, + int nocase); /* 371 */ + int (*tcl_UniCharIsControl)(int ch); /* 372 */ + int (*tcl_UniCharIsGraph)(int ch); /* 373 */ + int (*tcl_UniCharIsPrint)(int ch); /* 374 */ + int (*tcl_UniCharIsPunct)(int ch); /* 375 */ + int (*tcl_RegExpExecObj)( + Tcl_Interp* interp, + Tcl_RegExp regexp, + Tcl_Obj* textObj, + int offset, + int nmatches, + int flags); /* 376 */ + void ( + *tcl_RegExpGetInfo)(Tcl_RegExp regexp, Tcl_RegExpInfo* infoPtr); /* 377 */ + Tcl_Obj* ( + *tcl_NewUnicodeObj)(const Tcl_UniChar* unicode, int numChars); /* 378 */ + void (*tcl_SetUnicodeObj)( + Tcl_Obj* objPtr, + const Tcl_UniChar* unicode, + int numChars); /* 379 */ + int (*tcl_GetCharLength)(Tcl_Obj* objPtr); /* 380 */ + Tcl_UniChar (*tcl_GetUniChar)(Tcl_Obj* objPtr, int index); /* 381 */ + Tcl_UniChar* (*tcl_GetUnicode)(Tcl_Obj* objPtr); /* 382 */ + Tcl_Obj* (*tcl_GetRange)(Tcl_Obj* objPtr, int first, int last); /* 383 */ + void (*tcl_AppendUnicodeToObj)( + Tcl_Obj* objPtr, + const Tcl_UniChar* unicode, + int length); /* 384 */ + int (*tcl_RegExpMatchObj)( + Tcl_Interp* interp, + Tcl_Obj* textObj, + Tcl_Obj* patternObj); /* 385 */ + void (*tcl_SetNotifier)(Tcl_NotifierProcs* notifierProcPtr); /* 386 */ + Tcl_Mutex* (*tcl_GetAllocMutex)(void); /* 387 */ + int (*tcl_GetChannelNames)(Tcl_Interp* interp); /* 388 */ + int (*tcl_GetChannelNamesEx)( + Tcl_Interp* interp, + const char* pattern); /* 389 */ + int (*tcl_ProcObjCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 390 */ + void (*tcl_ConditionFinalize)(Tcl_Condition* condPtr); /* 391 */ + void (*tcl_MutexFinalize)(Tcl_Mutex* mutex); /* 392 */ + int (*tcl_CreateThread)( + Tcl_ThreadId* idPtr, + Tcl_ThreadCreateProc* proc, + ClientData clientData, + int stackSize, + int flags); /* 393 */ + int (*tcl_ReadRaw)(Tcl_Channel chan, char* dst, int bytesToRead); /* 394 */ + int (*tcl_WriteRaw)(Tcl_Channel chan, const char* src, int srcLen); /* 395 */ + Tcl_Channel (*tcl_GetTopChannel)(Tcl_Channel chan); /* 396 */ + int (*tcl_ChannelBuffered)(Tcl_Channel chan); /* 397 */ + CONST84_RETURN char* (*tcl_ChannelName)( + const Tcl_ChannelType* chanTypePtr); /* 398 */ + Tcl_ChannelTypeVersion (*tcl_ChannelVersion)( + const Tcl_ChannelType* chanTypePtr); /* 399 */ + Tcl_DriverBlockModeProc* (*tcl_ChannelBlockModeProc)( + const Tcl_ChannelType* chanTypePtr); /* 400 */ + Tcl_DriverCloseProc* (*tcl_ChannelCloseProc)( + const Tcl_ChannelType* chanTypePtr); /* 401 */ + Tcl_DriverClose2Proc* (*tcl_ChannelClose2Proc)( + const Tcl_ChannelType* chanTypePtr); /* 402 */ + Tcl_DriverInputProc* (*tcl_ChannelInputProc)( + const Tcl_ChannelType* chanTypePtr); /* 403 */ + Tcl_DriverOutputProc* (*tcl_ChannelOutputProc)( + const Tcl_ChannelType* chanTypePtr); /* 404 */ + Tcl_DriverSeekProc* (*tcl_ChannelSeekProc)( + const Tcl_ChannelType* chanTypePtr); /* 405 */ + Tcl_DriverSetOptionProc* (*tcl_ChannelSetOptionProc)( + const Tcl_ChannelType* chanTypePtr); /* 406 */ + Tcl_DriverGetOptionProc* (*tcl_ChannelGetOptionProc)( + const Tcl_ChannelType* chanTypePtr); /* 407 */ + Tcl_DriverWatchProc* (*tcl_ChannelWatchProc)( + const Tcl_ChannelType* chanTypePtr); /* 408 */ + Tcl_DriverGetHandleProc* (*tcl_ChannelGetHandleProc)( + const Tcl_ChannelType* chanTypePtr); /* 409 */ + Tcl_DriverFlushProc* (*tcl_ChannelFlushProc)( + const Tcl_ChannelType* chanTypePtr); /* 410 */ + Tcl_DriverHandlerProc* (*tcl_ChannelHandlerProc)( + const Tcl_ChannelType* chanTypePtr); /* 411 */ + int (*tcl_JoinThread)(Tcl_ThreadId threadId, int* result); /* 412 */ + int (*tcl_IsChannelShared)(Tcl_Channel channel); /* 413 */ + int (*tcl_IsChannelRegistered)( + Tcl_Interp* interp, + Tcl_Channel channel); /* 414 */ + void (*tcl_CutChannel)(Tcl_Channel channel); /* 415 */ + void (*tcl_SpliceChannel)(Tcl_Channel channel); /* 416 */ + void (*tcl_ClearChannelHandlers)(Tcl_Channel channel); /* 417 */ + int (*tcl_IsChannelExisting)(const char* channelName); /* 418 */ + int (*tcl_UniCharNcasecmp)( + const Tcl_UniChar* ucs, + const Tcl_UniChar* uct, + unsigned long numChars); /* 419 */ + int (*tcl_UniCharCaseMatch)( + const Tcl_UniChar* uniStr, + const Tcl_UniChar* uniPattern, + int nocase); /* 420 */ + Tcl_HashEntry* ( + *tcl_FindHashEntry)(Tcl_HashTable* tablePtr, const void* key); /* 421 */ + Tcl_HashEntry* (*tcl_CreateHashEntry)( + Tcl_HashTable* tablePtr, + const void* key, + int* newPtr); /* 422 */ + void (*tcl_InitCustomHashTable)( + Tcl_HashTable* tablePtr, + int keyType, + const Tcl_HashKeyType* typePtr); /* 423 */ + void (*tcl_InitObjHashTable)(Tcl_HashTable* tablePtr); /* 424 */ + ClientData (*tcl_CommandTraceInfo)( + Tcl_Interp* interp, + const char* varName, + int flags, + Tcl_CommandTraceProc* procPtr, + ClientData prevClientData); /* 425 */ + int (*tcl_TraceCommand)( + Tcl_Interp* interp, + const char* varName, + int flags, + Tcl_CommandTraceProc* proc, + ClientData clientData); /* 426 */ + void (*tcl_UntraceCommand)( + Tcl_Interp* interp, + const char* varName, + int flags, + Tcl_CommandTraceProc* proc, + ClientData clientData); /* 427 */ + char* (*tcl_AttemptAlloc)(unsigned int size); /* 428 */ + char* (*tcl_AttemptDbCkalloc)( + unsigned int size, + const char* file, + int line); /* 429 */ + char* (*tcl_AttemptRealloc)(char* ptr, unsigned int size); /* 430 */ + char* (*tcl_AttemptDbCkrealloc)( + char* ptr, + unsigned int size, + const char* file, + int line); /* 431 */ + int (*tcl_AttemptSetObjLength)(Tcl_Obj* objPtr, int length); /* 432 */ + Tcl_ThreadId (*tcl_GetChannelThread)(Tcl_Channel channel); /* 433 */ + Tcl_UniChar* ( + *tcl_GetUnicodeFromObj)(Tcl_Obj* objPtr, int* lengthPtr); /* 434 */ + int (*tcl_GetMathFuncInfo)( + Tcl_Interp* interp, + const char* name, + int* numArgsPtr, + Tcl_ValueType** argTypesPtr, + Tcl_MathProc** procPtr, + ClientData* clientDataPtr); /* 435 */ + Tcl_Obj* ( + *tcl_ListMathFuncs)(Tcl_Interp* interp, const char* pattern); /* 436 */ + Tcl_Obj* ( + *tcl_SubstObj)(Tcl_Interp* interp, Tcl_Obj* objPtr, int flags); /* 437 */ + int (*tcl_DetachChannel)(Tcl_Interp* interp, Tcl_Channel channel); /* 438 */ + int (*tcl_IsStandardChannel)(Tcl_Channel channel); /* 439 */ + int (*tcl_FSCopyFile)(Tcl_Obj* srcPathPtr, Tcl_Obj* destPathPtr); /* 440 */ + int (*tcl_FSCopyDirectory)( + Tcl_Obj* srcPathPtr, + Tcl_Obj* destPathPtr, + Tcl_Obj** errorPtr); /* 441 */ + int (*tcl_FSCreateDirectory)(Tcl_Obj* pathPtr); /* 442 */ + int (*tcl_FSDeleteFile)(Tcl_Obj* pathPtr); /* 443 */ + int (*tcl_FSLoadFile)( + Tcl_Interp* interp, + Tcl_Obj* pathPtr, + const char* sym1, + const char* sym2, + Tcl_PackageInitProc** proc1Ptr, + Tcl_PackageInitProc** proc2Ptr, + Tcl_LoadHandle* handlePtr, + Tcl_FSUnloadFileProc** unloadProcPtr); /* 444 */ + int (*tcl_FSMatchInDirectory)( + Tcl_Interp* interp, + Tcl_Obj* result, + Tcl_Obj* pathPtr, + const char* pattern, + Tcl_GlobTypeData* types); /* 445 */ + Tcl_Obj* ( + *tcl_FSLink)(Tcl_Obj* pathPtr, Tcl_Obj* toPtr, int linkAction); /* 446 */ + int (*tcl_FSRemoveDirectory)( + Tcl_Obj* pathPtr, + int recursive, + Tcl_Obj** errorPtr); /* 447 */ + int (*tcl_FSRenameFile)(Tcl_Obj* srcPathPtr, Tcl_Obj* destPathPtr); /* 448 */ + int (*tcl_FSLstat)(Tcl_Obj* pathPtr, Tcl_StatBuf* buf); /* 449 */ + int (*tcl_FSUtime)(Tcl_Obj* pathPtr, struct utimbuf* tval); /* 450 */ + int (*tcl_FSFileAttrsGet)( + Tcl_Interp* interp, + int index, + Tcl_Obj* pathPtr, + Tcl_Obj** objPtrRef); /* 451 */ + int (*tcl_FSFileAttrsSet)( + Tcl_Interp* interp, + int index, + Tcl_Obj* pathPtr, + Tcl_Obj* objPtr); /* 452 */ + const char* CONST86* ( + *tcl_FSFileAttrStrings)(Tcl_Obj* pathPtr, Tcl_Obj** objPtrRef); /* 453 */ + int (*tcl_FSStat)(Tcl_Obj* pathPtr, Tcl_StatBuf* buf); /* 454 */ + int (*tcl_FSAccess)(Tcl_Obj* pathPtr, int mode); /* 455 */ + Tcl_Channel (*tcl_FSOpenFileChannel)( + Tcl_Interp* interp, + Tcl_Obj* pathPtr, + const char* modeString, + int permissions); /* 456 */ + Tcl_Obj* (*tcl_FSGetCwd)(Tcl_Interp* interp); /* 457 */ + int (*tcl_FSChdir)(Tcl_Obj* pathPtr); /* 458 */ + int ( + *tcl_FSConvertToPathType)(Tcl_Interp* interp, Tcl_Obj* pathPtr); /* 459 */ + Tcl_Obj* (*tcl_FSJoinPath)(Tcl_Obj* listObj, int elements); /* 460 */ + Tcl_Obj* (*tcl_FSSplitPath)(Tcl_Obj* pathPtr, int* lenPtr); /* 461 */ + int (*tcl_FSEqualPaths)(Tcl_Obj* firstPtr, Tcl_Obj* secondPtr); /* 462 */ + Tcl_Obj* ( + *tcl_FSGetNormalizedPath)(Tcl_Interp* interp, Tcl_Obj* pathPtr); /* 463 */ + Tcl_Obj* (*tcl_FSJoinToPath)( + Tcl_Obj* pathPtr, + int objc, + Tcl_Obj* const objv[]); /* 464 */ + ClientData (*tcl_FSGetInternalRep)( + Tcl_Obj* pathPtr, + const Tcl_Filesystem* fsPtr); /* 465 */ + Tcl_Obj* ( + *tcl_FSGetTranslatedPath)(Tcl_Interp* interp, Tcl_Obj* pathPtr); /* 466 */ + int (*tcl_FSEvalFile)(Tcl_Interp* interp, Tcl_Obj* fileName); /* 467 */ + Tcl_Obj* (*tcl_FSNewNativePath)( + const Tcl_Filesystem* fromFilesystem, + ClientData clientData); /* 468 */ + const void* (*tcl_FSGetNativePath)(Tcl_Obj* pathPtr); /* 469 */ + Tcl_Obj* (*tcl_FSFileSystemInfo)(Tcl_Obj* pathPtr); /* 470 */ + Tcl_Obj* (*tcl_FSPathSeparator)(Tcl_Obj* pathPtr); /* 471 */ + Tcl_Obj* (*tcl_FSListVolumes)(void); /* 472 */ + int (*tcl_FSRegister)( + ClientData clientData, + const Tcl_Filesystem* fsPtr); /* 473 */ + int (*tcl_FSUnregister)(const Tcl_Filesystem* fsPtr); /* 474 */ + ClientData (*tcl_FSData)(const Tcl_Filesystem* fsPtr); /* 475 */ + const char* (*tcl_FSGetTranslatedStringPath)( + Tcl_Interp* interp, + Tcl_Obj* pathPtr); /* 476 */ + CONST86 Tcl_Filesystem* (*tcl_FSGetFileSystemForPath)( + Tcl_Obj* pathPtr); /* 477 */ + Tcl_PathType (*tcl_FSGetPathType)(Tcl_Obj* pathPtr); /* 478 */ + int (*tcl_OutputBuffered)(Tcl_Channel chan); /* 479 */ + void (*tcl_FSMountsChanged)(const Tcl_Filesystem* fsPtr); /* 480 */ + int (*tcl_EvalTokensStandard)( + Tcl_Interp* interp, + Tcl_Token* tokenPtr, + int count); /* 481 */ + void (*tcl_GetTime)(Tcl_Time* timeBuf); /* 482 */ + Tcl_Trace (*tcl_CreateObjTrace)( + Tcl_Interp* interp, + int level, + int flags, + Tcl_CmdObjTraceProc* objProc, + ClientData clientData, + Tcl_CmdObjTraceDeleteProc* delProc); /* 483 */ + int (*tcl_GetCommandInfoFromToken)( + Tcl_Command token, + Tcl_CmdInfo* infoPtr); /* 484 */ + int (*tcl_SetCommandInfoFromToken)( + Tcl_Command token, + const Tcl_CmdInfo* infoPtr); /* 485 */ + Tcl_Obj* (*tcl_DbNewWideIntObj)( + Tcl_WideInt wideValue, + const char* file, + int line); /* 486 */ + int (*tcl_GetWideIntFromObj)( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + Tcl_WideInt* widePtr); /* 487 */ + Tcl_Obj* (*tcl_NewWideIntObj)(Tcl_WideInt wideValue); /* 488 */ + void (*tcl_SetWideIntObj)(Tcl_Obj* objPtr, Tcl_WideInt wideValue); /* 489 */ + Tcl_StatBuf* (*tcl_AllocStatBuf)(void); /* 490 */ + Tcl_WideInt ( + *tcl_Seek)(Tcl_Channel chan, Tcl_WideInt offset, int mode); /* 491 */ + Tcl_WideInt (*tcl_Tell)(Tcl_Channel chan); /* 492 */ + Tcl_DriverWideSeekProc* (*tcl_ChannelWideSeekProc)( + const Tcl_ChannelType* chanTypePtr); /* 493 */ + int (*tcl_DictObjPut)( + Tcl_Interp* interp, + Tcl_Obj* dictPtr, + Tcl_Obj* keyPtr, + Tcl_Obj* valuePtr); /* 494 */ + int (*tcl_DictObjGet)( + Tcl_Interp* interp, + Tcl_Obj* dictPtr, + Tcl_Obj* keyPtr, + Tcl_Obj** valuePtrPtr); /* 495 */ + int (*tcl_DictObjRemove)( + Tcl_Interp* interp, + Tcl_Obj* dictPtr, + Tcl_Obj* keyPtr); /* 496 */ + int (*tcl_DictObjSize)( + Tcl_Interp* interp, + Tcl_Obj* dictPtr, + int* sizePtr); /* 497 */ + int (*tcl_DictObjFirst)( + Tcl_Interp* interp, + Tcl_Obj* dictPtr, + Tcl_DictSearch* searchPtr, + Tcl_Obj** keyPtrPtr, + Tcl_Obj** valuePtrPtr, + int* donePtr); /* 498 */ + void (*tcl_DictObjNext)( + Tcl_DictSearch* searchPtr, + Tcl_Obj** keyPtrPtr, + Tcl_Obj** valuePtrPtr, + int* donePtr); /* 499 */ + void (*tcl_DictObjDone)(Tcl_DictSearch* searchPtr); /* 500 */ + int (*tcl_DictObjPutKeyList)( + Tcl_Interp* interp, + Tcl_Obj* dictPtr, + int keyc, + Tcl_Obj* const* keyv, + Tcl_Obj* valuePtr); /* 501 */ + int (*tcl_DictObjRemoveKeyList)( + Tcl_Interp* interp, + Tcl_Obj* dictPtr, + int keyc, + Tcl_Obj* const* keyv); /* 502 */ + Tcl_Obj* (*tcl_NewDictObj)(void); /* 503 */ + Tcl_Obj* (*tcl_DbNewDictObj)(const char* file, int line); /* 504 */ + void (*tcl_RegisterConfig)( + Tcl_Interp* interp, + const char* pkgName, + const Tcl_Config* configuration, + const char* valEncoding); /* 505 */ + Tcl_Namespace* (*tcl_CreateNamespace)( + Tcl_Interp* interp, + const char* name, + ClientData clientData, + Tcl_NamespaceDeleteProc* deleteProc); /* 506 */ + void (*tcl_DeleteNamespace)(Tcl_Namespace* nsPtr); /* 507 */ + int (*tcl_AppendExportList)( + Tcl_Interp* interp, + Tcl_Namespace* nsPtr, + Tcl_Obj* objPtr); /* 508 */ + int (*tcl_Export)( + Tcl_Interp* interp, + Tcl_Namespace* nsPtr, + const char* pattern, + int resetListFirst); /* 509 */ + int (*tcl_Import)( + Tcl_Interp* interp, + Tcl_Namespace* nsPtr, + const char* pattern, + int allowOverwrite); /* 510 */ + int (*tcl_ForgetImport)( + Tcl_Interp* interp, + Tcl_Namespace* nsPtr, + const char* pattern); /* 511 */ + Tcl_Namespace* (*tcl_GetCurrentNamespace)(Tcl_Interp* interp); /* 512 */ + Tcl_Namespace* (*tcl_GetGlobalNamespace)(Tcl_Interp* interp); /* 513 */ + Tcl_Namespace* (*tcl_FindNamespace)( + Tcl_Interp* interp, + const char* name, + Tcl_Namespace* contextNsPtr, + int flags); /* 514 */ + Tcl_Command (*tcl_FindCommand)( + Tcl_Interp* interp, + const char* name, + Tcl_Namespace* contextNsPtr, + int flags); /* 515 */ + Tcl_Command ( + *tcl_GetCommandFromObj)(Tcl_Interp* interp, Tcl_Obj* objPtr); /* 516 */ + void (*tcl_GetCommandFullName)( + Tcl_Interp* interp, + Tcl_Command command, + Tcl_Obj* objPtr); /* 517 */ + int (*tcl_FSEvalFileEx)( + Tcl_Interp* interp, + Tcl_Obj* fileName, + const char* encodingName); /* 518 */ + Tcl_ExitProc* (*tcl_SetExitProc)(TCL_NORETURN1 Tcl_ExitProc* proc); /* 519 */ + void (*tcl_LimitAddHandler)( + Tcl_Interp* interp, + int type, + Tcl_LimitHandlerProc* handlerProc, + ClientData clientData, + Tcl_LimitHandlerDeleteProc* deleteProc); /* 520 */ + void (*tcl_LimitRemoveHandler)( + Tcl_Interp* interp, + int type, + Tcl_LimitHandlerProc* handlerProc, + ClientData clientData); /* 521 */ + int (*tcl_LimitReady)(Tcl_Interp* interp); /* 522 */ + int (*tcl_LimitCheck)(Tcl_Interp* interp); /* 523 */ + int (*tcl_LimitExceeded)(Tcl_Interp* interp); /* 524 */ + void (*tcl_LimitSetCommands)(Tcl_Interp* interp, int commandLimit); /* 525 */ + void ( + *tcl_LimitSetTime)(Tcl_Interp* interp, Tcl_Time* timeLimitPtr); /* 526 */ + void (*tcl_LimitSetGranularity)( + Tcl_Interp* interp, + int type, + int granularity); /* 527 */ + int (*tcl_LimitTypeEnabled)(Tcl_Interp* interp, int type); /* 528 */ + int (*tcl_LimitTypeExceeded)(Tcl_Interp* interp, int type); /* 529 */ + void (*tcl_LimitTypeSet)(Tcl_Interp* interp, int type); /* 530 */ + void (*tcl_LimitTypeReset)(Tcl_Interp* interp, int type); /* 531 */ + int (*tcl_LimitGetCommands)(Tcl_Interp* interp); /* 532 */ + void ( + *tcl_LimitGetTime)(Tcl_Interp* interp, Tcl_Time* timeLimitPtr); /* 533 */ + int (*tcl_LimitGetGranularity)(Tcl_Interp* interp, int type); /* 534 */ + Tcl_InterpState ( + *tcl_SaveInterpState)(Tcl_Interp* interp, int status); /* 535 */ + int (*tcl_RestoreInterpState)( + Tcl_Interp* interp, + Tcl_InterpState state); /* 536 */ + void (*tcl_DiscardInterpState)(Tcl_InterpState state); /* 537 */ + int (*tcl_SetReturnOptions)(Tcl_Interp* interp, Tcl_Obj* options); /* 538 */ + Tcl_Obj* (*tcl_GetReturnOptions)(Tcl_Interp* interp, int result); /* 539 */ + int (*tcl_IsEnsemble)(Tcl_Command token); /* 540 */ + Tcl_Command (*tcl_CreateEnsemble)( + Tcl_Interp* interp, + const char* name, + Tcl_Namespace* namespacePtr, + int flags); /* 541 */ + Tcl_Command (*tcl_FindEnsemble)( + Tcl_Interp* interp, + Tcl_Obj* cmdNameObj, + int flags); /* 542 */ + int (*tcl_SetEnsembleSubcommandList)( + Tcl_Interp* interp, + Tcl_Command token, + Tcl_Obj* subcmdList); /* 543 */ + int (*tcl_SetEnsembleMappingDict)( + Tcl_Interp* interp, + Tcl_Command token, + Tcl_Obj* mapDict); /* 544 */ + int (*tcl_SetEnsembleUnknownHandler)( + Tcl_Interp* interp, + Tcl_Command token, + Tcl_Obj* unknownList); /* 545 */ + int (*tcl_SetEnsembleFlags)( + Tcl_Interp* interp, + Tcl_Command token, + int flags); /* 546 */ + int (*tcl_GetEnsembleSubcommandList)( + Tcl_Interp* interp, + Tcl_Command token, + Tcl_Obj** subcmdListPtr); /* 547 */ + int (*tcl_GetEnsembleMappingDict)( + Tcl_Interp* interp, + Tcl_Command token, + Tcl_Obj** mapDictPtr); /* 548 */ + int (*tcl_GetEnsembleUnknownHandler)( + Tcl_Interp* interp, + Tcl_Command token, + Tcl_Obj** unknownListPtr); /* 549 */ + int (*tcl_GetEnsembleFlags)( + Tcl_Interp* interp, + Tcl_Command token, + int* flagsPtr); /* 550 */ + int (*tcl_GetEnsembleNamespace)( + Tcl_Interp* interp, + Tcl_Command token, + Tcl_Namespace** namespacePtrPtr); /* 551 */ + void (*tcl_SetTimeProc)( + Tcl_GetTimeProc* getProc, + Tcl_ScaleTimeProc* scaleProc, + ClientData clientData); /* 552 */ + void (*tcl_QueryTimeProc)( + Tcl_GetTimeProc** getProc, + Tcl_ScaleTimeProc** scaleProc, + ClientData* clientData); /* 553 */ + Tcl_DriverThreadActionProc* (*tcl_ChannelThreadActionProc)( + const Tcl_ChannelType* chanTypePtr); /* 554 */ + Tcl_Obj* (*tcl_NewBignumObj)(mp_int* value); /* 555 */ + Tcl_Obj* ( + *tcl_DbNewBignumObj)(mp_int* value, const char* file, int line); /* 556 */ + void (*tcl_SetBignumObj)(Tcl_Obj* obj, mp_int* value); /* 557 */ + int (*tcl_GetBignumFromObj)( + Tcl_Interp* interp, + Tcl_Obj* obj, + mp_int* value); /* 558 */ + int (*tcl_TakeBignumFromObj)( + Tcl_Interp* interp, + Tcl_Obj* obj, + mp_int* value); /* 559 */ + int (*tcl_TruncateChannel)(Tcl_Channel chan, Tcl_WideInt length); /* 560 */ + Tcl_DriverTruncateProc* (*tcl_ChannelTruncateProc)( + const Tcl_ChannelType* chanTypePtr); /* 561 */ + void (*tcl_SetChannelErrorInterp)(Tcl_Interp* interp, Tcl_Obj* msg); /* 562 */ + void ( + *tcl_GetChannelErrorInterp)(Tcl_Interp* interp, Tcl_Obj** msg); /* 563 */ + void (*tcl_SetChannelError)(Tcl_Channel chan, Tcl_Obj* msg); /* 564 */ + void (*tcl_GetChannelError)(Tcl_Channel chan, Tcl_Obj** msg); /* 565 */ + int (*tcl_InitBignumFromDouble)( + Tcl_Interp* interp, + double initval, + mp_int* toInit); /* 566 */ + Tcl_Obj* (*tcl_GetNamespaceUnknownHandler)( + Tcl_Interp* interp, + Tcl_Namespace* nsPtr); /* 567 */ + int (*tcl_SetNamespaceUnknownHandler)( + Tcl_Interp* interp, + Tcl_Namespace* nsPtr, + Tcl_Obj* handlerPtr); /* 568 */ + int (*tcl_GetEncodingFromObj)( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + Tcl_Encoding* encodingPtr); /* 569 */ + Tcl_Obj* (*tcl_GetEncodingSearchPath)(void); /* 570 */ + int (*tcl_SetEncodingSearchPath)(Tcl_Obj* searchPath); /* 571 */ + const char* (*tcl_GetEncodingNameFromEnvironment)( + Tcl_DString* bufPtr); /* 572 */ + int (*tcl_PkgRequireProc)( + Tcl_Interp* interp, + const char* name, + int objc, + Tcl_Obj* const objv[], + void* clientDataPtr); /* 573 */ + void ( + *tcl_AppendObjToErrorInfo)(Tcl_Interp* interp, Tcl_Obj* objPtr); /* 574 */ + void (*tcl_AppendLimitedToObj)( + Tcl_Obj* objPtr, + const char* bytes, + int length, + int limit, + const char* ellipsis); /* 575 */ + Tcl_Obj* (*tcl_Format)( + Tcl_Interp* interp, + const char* format, + int objc, + Tcl_Obj* const objv[]); /* 576 */ + int (*tcl_AppendFormatToObj)( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + const char* format, + int objc, + Tcl_Obj* const objv[]); /* 577 */ + Tcl_Obj* (*tcl_ObjPrintf)(const char* format, ...) + TCL_FORMAT_PRINTF(1, 2); /* 578 */ + void (*tcl_AppendPrintfToObj)(Tcl_Obj* objPtr, const char* format, ...) + TCL_FORMAT_PRINTF(2, 3); /* 579 */ + int (*tcl_CancelEval)( + Tcl_Interp* interp, + Tcl_Obj* resultObjPtr, + ClientData clientData, + int flags); /* 580 */ + int (*tcl_Canceled)(Tcl_Interp* interp, int flags); /* 581 */ + int (*tcl_CreatePipe)( + Tcl_Interp* interp, + Tcl_Channel* rchan, + Tcl_Channel* wchan, + int flags); /* 582 */ + Tcl_Command (*tcl_NRCreateCommand)( + Tcl_Interp* interp, + const char* cmdName, + Tcl_ObjCmdProc* proc, + Tcl_ObjCmdProc* nreProc, + ClientData clientData, + Tcl_CmdDeleteProc* deleteProc); /* 583 */ + int ( + *tcl_NREvalObj)(Tcl_Interp* interp, Tcl_Obj* objPtr, int flags); /* 584 */ + int (*tcl_NREvalObjv)( + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[], + int flags); /* 585 */ + int (*tcl_NRCmdSwap)( + Tcl_Interp* interp, + Tcl_Command cmd, + int objc, + Tcl_Obj* const objv[], + int flags); /* 586 */ + void (*tcl_NRAddCallback)( + Tcl_Interp* interp, + Tcl_NRPostProc* postProcPtr, + ClientData data0, + ClientData data1, + ClientData data2, + ClientData data3); /* 587 */ + int (*tcl_NRCallObjProc)( + Tcl_Interp* interp, + Tcl_ObjCmdProc* objProc, + ClientData clientData, + int objc, + Tcl_Obj* const objv[]); /* 588 */ + unsigned (*tcl_GetFSDeviceFromStat)(const Tcl_StatBuf* statPtr); /* 589 */ + unsigned (*tcl_GetFSInodeFromStat)(const Tcl_StatBuf* statPtr); /* 590 */ + unsigned (*tcl_GetModeFromStat)(const Tcl_StatBuf* statPtr); /* 591 */ + int (*tcl_GetLinkCountFromStat)(const Tcl_StatBuf* statPtr); /* 592 */ + int (*tcl_GetUserIdFromStat)(const Tcl_StatBuf* statPtr); /* 593 */ + int (*tcl_GetGroupIdFromStat)(const Tcl_StatBuf* statPtr); /* 594 */ + int (*tcl_GetDeviceTypeFromStat)(const Tcl_StatBuf* statPtr); /* 595 */ + Tcl_WideInt (*tcl_GetAccessTimeFromStat)( + const Tcl_StatBuf* statPtr); /* 596 */ + Tcl_WideInt (*tcl_GetModificationTimeFromStat)( + const Tcl_StatBuf* statPtr); /* 597 */ + Tcl_WideInt (*tcl_GetChangeTimeFromStat)( + const Tcl_StatBuf* statPtr); /* 598 */ + Tcl_WideUInt (*tcl_GetSizeFromStat)(const Tcl_StatBuf* statPtr); /* 599 */ + Tcl_WideUInt (*tcl_GetBlocksFromStat)(const Tcl_StatBuf* statPtr); /* 600 */ + unsigned (*tcl_GetBlockSizeFromStat)(const Tcl_StatBuf* statPtr); /* 601 */ + int (*tcl_SetEnsembleParameterList)( + Tcl_Interp* interp, + Tcl_Command token, + Tcl_Obj* paramList); /* 602 */ + int (*tcl_GetEnsembleParameterList)( + Tcl_Interp* interp, + Tcl_Command token, + Tcl_Obj** paramListPtr); /* 603 */ + int (*tcl_ParseArgsObjv)( + Tcl_Interp* interp, + const Tcl_ArgvInfo* argTable, + int* objcPtr, + Tcl_Obj* const* objv, + Tcl_Obj*** remObjv); /* 604 */ + int (*tcl_GetErrorLine)(Tcl_Interp* interp); /* 605 */ + void (*tcl_SetErrorLine)(Tcl_Interp* interp, int lineNum); /* 606 */ + void (*tcl_TransferResult)( + Tcl_Interp* sourceInterp, + int result, + Tcl_Interp* targetInterp); /* 607 */ + int (*tcl_InterpActive)(Tcl_Interp* interp); /* 608 */ + void (*tcl_BackgroundException)(Tcl_Interp* interp, int code); /* 609 */ + int (*tcl_ZlibDeflate)( + Tcl_Interp* interp, + int format, + Tcl_Obj* data, + int level, + Tcl_Obj* gzipHeaderDictObj); /* 610 */ + int (*tcl_ZlibInflate)( + Tcl_Interp* interp, + int format, + Tcl_Obj* data, + int buffersize, + Tcl_Obj* gzipHeaderDictObj); /* 611 */ + unsigned int (*tcl_ZlibCRC32)( + unsigned int crc, + const unsigned char* buf, + int len); /* 612 */ + unsigned int (*tcl_ZlibAdler32)( + unsigned int adler, + const unsigned char* buf, + int len); /* 613 */ + int (*tcl_ZlibStreamInit)( + Tcl_Interp* interp, + int mode, + int format, + int level, + Tcl_Obj* dictObj, + Tcl_ZlibStream* zshandle); /* 614 */ + Tcl_Obj* (*tcl_ZlibStreamGetCommandName)(Tcl_ZlibStream zshandle); /* 615 */ + int (*tcl_ZlibStreamEof)(Tcl_ZlibStream zshandle); /* 616 */ + int (*tcl_ZlibStreamChecksum)(Tcl_ZlibStream zshandle); /* 617 */ + int (*tcl_ZlibStreamPut)( + Tcl_ZlibStream zshandle, + Tcl_Obj* data, + int flush); /* 618 */ + int (*tcl_ZlibStreamGet)( + Tcl_ZlibStream zshandle, + Tcl_Obj* data, + int count); /* 619 */ + int (*tcl_ZlibStreamClose)(Tcl_ZlibStream zshandle); /* 620 */ + int (*tcl_ZlibStreamReset)(Tcl_ZlibStream zshandle); /* 621 */ + void (*tcl_SetStartupScript)(Tcl_Obj* path, const char* encoding); /* 622 */ + Tcl_Obj* (*tcl_GetStartupScript)(const char** encodingPtr); /* 623 */ + int (*tcl_CloseEx)(Tcl_Interp* interp, Tcl_Channel chan, int flags); /* 624 */ + int (*tcl_NRExprObj)( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + Tcl_Obj* resultPtr); /* 625 */ + int (*tcl_NRSubstObj)( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + int flags); /* 626 */ + int (*tcl_LoadFile)( + Tcl_Interp* interp, + Tcl_Obj* pathPtr, + const char* const symv[], + int flags, + void* procPtrs, + Tcl_LoadHandle* handlePtr); /* 627 */ + void* (*tcl_FindSymbol)( + Tcl_Interp* interp, + Tcl_LoadHandle handle, + const char* symbol); /* 628 */ + int (*tcl_FSUnloadFile)( + Tcl_Interp* interp, + Tcl_LoadHandle handlePtr); /* 629 */ + void (*tcl_ZlibStreamSetCompressionDictionary)( + Tcl_ZlibStream zhandle, + Tcl_Obj* compressionDictionaryObj); /* 630 */ +} TclStubs; + +extern const TclStubs* tclStubsPtr; + +#ifdef __cplusplus +} +#endif + +#if defined(USE_TCL_STUBS) + +/* + * Inline function declarations: + */ + +#define Tcl_PkgProvideEx (tclStubsPtr->tcl_PkgProvideEx) /* 0 */ +#define Tcl_PkgRequireEx (tclStubsPtr->tcl_PkgRequireEx) /* 1 */ +#define Tcl_Panic (tclStubsPtr->tcl_Panic) /* 2 */ +#define Tcl_Alloc (tclStubsPtr->tcl_Alloc) /* 3 */ +#define Tcl_Free (tclStubsPtr->tcl_Free) /* 4 */ +#define Tcl_Realloc (tclStubsPtr->tcl_Realloc) /* 5 */ +#define Tcl_DbCkalloc (tclStubsPtr->tcl_DbCkalloc) /* 6 */ +#define Tcl_DbCkfree (tclStubsPtr->tcl_DbCkfree) /* 7 */ +#define Tcl_DbCkrealloc (tclStubsPtr->tcl_DbCkrealloc) /* 8 */ +#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */ +#define Tcl_CreateFileHandler (tclStubsPtr->tcl_CreateFileHandler) /* 9 */ +#endif /* UNIX */ +#ifdef MAC_OSX_TCL /* MACOSX */ +#define Tcl_CreateFileHandler (tclStubsPtr->tcl_CreateFileHandler) /* 9 */ +#endif /* MACOSX */ +#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */ +#define Tcl_DeleteFileHandler (tclStubsPtr->tcl_DeleteFileHandler) /* 10 */ +#endif /* UNIX */ +#ifdef MAC_OSX_TCL /* MACOSX */ +#define Tcl_DeleteFileHandler (tclStubsPtr->tcl_DeleteFileHandler) /* 10 */ +#endif /* MACOSX */ +#define Tcl_SetTimer (tclStubsPtr->tcl_SetTimer) /* 11 */ +#define Tcl_Sleep (tclStubsPtr->tcl_Sleep) /* 12 */ +#define Tcl_WaitForEvent (tclStubsPtr->tcl_WaitForEvent) /* 13 */ +#define Tcl_AppendAllObjTypes (tclStubsPtr->tcl_AppendAllObjTypes) /* 14 */ +#define Tcl_AppendStringsToObj (tclStubsPtr->tcl_AppendStringsToObj) /* 15 */ +#define Tcl_AppendToObj (tclStubsPtr->tcl_AppendToObj) /* 16 */ +#define Tcl_ConcatObj (tclStubsPtr->tcl_ConcatObj) /* 17 */ +#define Tcl_ConvertToType (tclStubsPtr->tcl_ConvertToType) /* 18 */ +#define Tcl_DbDecrRefCount (tclStubsPtr->tcl_DbDecrRefCount) /* 19 */ +#define Tcl_DbIncrRefCount (tclStubsPtr->tcl_DbIncrRefCount) /* 20 */ +#define Tcl_DbIsShared (tclStubsPtr->tcl_DbIsShared) /* 21 */ +#define Tcl_DbNewBooleanObj (tclStubsPtr->tcl_DbNewBooleanObj) /* 22 */ +#define Tcl_DbNewByteArrayObj (tclStubsPtr->tcl_DbNewByteArrayObj) /* 23 */ +#define Tcl_DbNewDoubleObj (tclStubsPtr->tcl_DbNewDoubleObj) /* 24 */ +#define Tcl_DbNewListObj (tclStubsPtr->tcl_DbNewListObj) /* 25 */ +#define Tcl_DbNewLongObj (tclStubsPtr->tcl_DbNewLongObj) /* 26 */ +#define Tcl_DbNewObj (tclStubsPtr->tcl_DbNewObj) /* 27 */ +#define Tcl_DbNewStringObj (tclStubsPtr->tcl_DbNewStringObj) /* 28 */ +#define Tcl_DuplicateObj (tclStubsPtr->tcl_DuplicateObj) /* 29 */ +#define TclFreeObj (tclStubsPtr->tclFreeObj) /* 30 */ +#define Tcl_GetBoolean (tclStubsPtr->tcl_GetBoolean) /* 31 */ +#define Tcl_GetBooleanFromObj (tclStubsPtr->tcl_GetBooleanFromObj) /* 32 */ +#define Tcl_GetByteArrayFromObj (tclStubsPtr->tcl_GetByteArrayFromObj) /* 33 \ + */ +#define Tcl_GetDouble (tclStubsPtr->tcl_GetDouble) /* 34 */ +#define Tcl_GetDoubleFromObj (tclStubsPtr->tcl_GetDoubleFromObj) /* 35 */ +#define Tcl_GetIndexFromObj (tclStubsPtr->tcl_GetIndexFromObj) /* 36 */ +#define Tcl_GetInt (tclStubsPtr->tcl_GetInt) /* 37 */ +#define Tcl_GetIntFromObj (tclStubsPtr->tcl_GetIntFromObj) /* 38 */ +#define Tcl_GetLongFromObj (tclStubsPtr->tcl_GetLongFromObj) /* 39 */ +#define Tcl_GetObjType (tclStubsPtr->tcl_GetObjType) /* 40 */ +#define Tcl_GetStringFromObj (tclStubsPtr->tcl_GetStringFromObj) /* 41 */ +#define Tcl_InvalidateStringRep (tclStubsPtr->tcl_InvalidateStringRep) /* 42 \ + */ +#define Tcl_ListObjAppendList (tclStubsPtr->tcl_ListObjAppendList) /* 43 */ +#define Tcl_ListObjAppendElement \ + (tclStubsPtr->tcl_ListObjAppendElement) /* 44 */ +#define Tcl_ListObjGetElements (tclStubsPtr->tcl_ListObjGetElements) /* 45 */ +#define Tcl_ListObjIndex (tclStubsPtr->tcl_ListObjIndex) /* 46 */ +#define Tcl_ListObjLength (tclStubsPtr->tcl_ListObjLength) /* 47 */ +#define Tcl_ListObjReplace (tclStubsPtr->tcl_ListObjReplace) /* 48 */ +#define Tcl_NewBooleanObj (tclStubsPtr->tcl_NewBooleanObj) /* 49 */ +#define Tcl_NewByteArrayObj (tclStubsPtr->tcl_NewByteArrayObj) /* 50 */ +#define Tcl_NewDoubleObj (tclStubsPtr->tcl_NewDoubleObj) /* 51 */ +#define Tcl_NewIntObj (tclStubsPtr->tcl_NewIntObj) /* 52 */ +#define Tcl_NewListObj (tclStubsPtr->tcl_NewListObj) /* 53 */ +#define Tcl_NewLongObj (tclStubsPtr->tcl_NewLongObj) /* 54 */ +#define Tcl_NewObj (tclStubsPtr->tcl_NewObj) /* 55 */ +#define Tcl_NewStringObj (tclStubsPtr->tcl_NewStringObj) /* 56 */ +#define Tcl_SetBooleanObj (tclStubsPtr->tcl_SetBooleanObj) /* 57 */ +#define Tcl_SetByteArrayLength (tclStubsPtr->tcl_SetByteArrayLength) /* 58 */ +#define Tcl_SetByteArrayObj (tclStubsPtr->tcl_SetByteArrayObj) /* 59 */ +#define Tcl_SetDoubleObj (tclStubsPtr->tcl_SetDoubleObj) /* 60 */ +#define Tcl_SetIntObj (tclStubsPtr->tcl_SetIntObj) /* 61 */ +#define Tcl_SetListObj (tclStubsPtr->tcl_SetListObj) /* 62 */ +#define Tcl_SetLongObj (tclStubsPtr->tcl_SetLongObj) /* 63 */ +#define Tcl_SetObjLength (tclStubsPtr->tcl_SetObjLength) /* 64 */ +#define Tcl_SetStringObj (tclStubsPtr->tcl_SetStringObj) /* 65 */ +#define Tcl_AddErrorInfo (tclStubsPtr->tcl_AddErrorInfo) /* 66 */ +#define Tcl_AddObjErrorInfo (tclStubsPtr->tcl_AddObjErrorInfo) /* 67 */ +#define Tcl_AllowExceptions (tclStubsPtr->tcl_AllowExceptions) /* 68 */ +#define Tcl_AppendElement (tclStubsPtr->tcl_AppendElement) /* 69 */ +#define Tcl_AppendResult (tclStubsPtr->tcl_AppendResult) /* 70 */ +#define Tcl_AsyncCreate (tclStubsPtr->tcl_AsyncCreate) /* 71 */ +#define Tcl_AsyncDelete (tclStubsPtr->tcl_AsyncDelete) /* 72 */ +#define Tcl_AsyncInvoke (tclStubsPtr->tcl_AsyncInvoke) /* 73 */ +#define Tcl_AsyncMark (tclStubsPtr->tcl_AsyncMark) /* 74 */ +#define Tcl_AsyncReady (tclStubsPtr->tcl_AsyncReady) /* 75 */ +#define Tcl_BackgroundError (tclStubsPtr->tcl_BackgroundError) /* 76 */ +#define Tcl_Backslash (tclStubsPtr->tcl_Backslash) /* 77 */ +#define Tcl_BadChannelOption (tclStubsPtr->tcl_BadChannelOption) /* 78 */ +#define Tcl_CallWhenDeleted (tclStubsPtr->tcl_CallWhenDeleted) /* 79 */ +#define Tcl_CancelIdleCall (tclStubsPtr->tcl_CancelIdleCall) /* 80 */ +#define Tcl_Close (tclStubsPtr->tcl_Close) /* 81 */ +#define Tcl_CommandComplete (tclStubsPtr->tcl_CommandComplete) /* 82 */ +#define Tcl_Concat (tclStubsPtr->tcl_Concat) /* 83 */ +#define Tcl_ConvertElement (tclStubsPtr->tcl_ConvertElement) /* 84 */ +#define Tcl_ConvertCountedElement \ + (tclStubsPtr->tcl_ConvertCountedElement) /* 85 */ +#define Tcl_CreateAlias (tclStubsPtr->tcl_CreateAlias) /* 86 */ +#define Tcl_CreateAliasObj (tclStubsPtr->tcl_CreateAliasObj) /* 87 */ +#define Tcl_CreateChannel (tclStubsPtr->tcl_CreateChannel) /* 88 */ +#define Tcl_CreateChannelHandler \ + (tclStubsPtr->tcl_CreateChannelHandler) /* 89 */ +#define Tcl_CreateCloseHandler (tclStubsPtr->tcl_CreateCloseHandler) /* 90 */ +#define Tcl_CreateCommand (tclStubsPtr->tcl_CreateCommand) /* 91 */ +#define Tcl_CreateEventSource (tclStubsPtr->tcl_CreateEventSource) /* 92 */ +#define Tcl_CreateExitHandler (tclStubsPtr->tcl_CreateExitHandler) /* 93 */ +#define Tcl_CreateInterp (tclStubsPtr->tcl_CreateInterp) /* 94 */ +#define Tcl_CreateMathFunc (tclStubsPtr->tcl_CreateMathFunc) /* 95 */ +#define Tcl_CreateObjCommand (tclStubsPtr->tcl_CreateObjCommand) /* 96 */ +#define Tcl_CreateSlave (tclStubsPtr->tcl_CreateSlave) /* 97 */ +#define Tcl_CreateTimerHandler (tclStubsPtr->tcl_CreateTimerHandler) /* 98 */ +#define Tcl_CreateTrace (tclStubsPtr->tcl_CreateTrace) /* 99 */ +#define Tcl_DeleteAssocData (tclStubsPtr->tcl_DeleteAssocData) /* 100 */ +#define Tcl_DeleteChannelHandler \ + (tclStubsPtr->tcl_DeleteChannelHandler) /* 101 */ +#define Tcl_DeleteCloseHandler (tclStubsPtr->tcl_DeleteCloseHandler) /* 102 */ +#define Tcl_DeleteCommand (tclStubsPtr->tcl_DeleteCommand) /* 103 */ +#define Tcl_DeleteCommandFromToken \ + (tclStubsPtr->tcl_DeleteCommandFromToken) /* 104 */ +#define Tcl_DeleteEvents (tclStubsPtr->tcl_DeleteEvents) /* 105 */ +#define Tcl_DeleteEventSource (tclStubsPtr->tcl_DeleteEventSource) /* 106 */ +#define Tcl_DeleteExitHandler (tclStubsPtr->tcl_DeleteExitHandler) /* 107 */ +#define Tcl_DeleteHashEntry (tclStubsPtr->tcl_DeleteHashEntry) /* 108 */ +#define Tcl_DeleteHashTable (tclStubsPtr->tcl_DeleteHashTable) /* 109 */ +#define Tcl_DeleteInterp (tclStubsPtr->tcl_DeleteInterp) /* 110 */ +#define Tcl_DetachPids (tclStubsPtr->tcl_DetachPids) /* 111 */ +#define Tcl_DeleteTimerHandler (tclStubsPtr->tcl_DeleteTimerHandler) /* 112 */ +#define Tcl_DeleteTrace (tclStubsPtr->tcl_DeleteTrace) /* 113 */ +#define Tcl_DontCallWhenDeleted (tclStubsPtr->tcl_DontCallWhenDeleted) /* 114 \ + */ +#define Tcl_DoOneEvent (tclStubsPtr->tcl_DoOneEvent) /* 115 */ +#define Tcl_DoWhenIdle (tclStubsPtr->tcl_DoWhenIdle) /* 116 */ +#define Tcl_DStringAppend (tclStubsPtr->tcl_DStringAppend) /* 117 */ +#define Tcl_DStringAppendElement \ + (tclStubsPtr->tcl_DStringAppendElement) /* 118 */ +#define Tcl_DStringEndSublist (tclStubsPtr->tcl_DStringEndSublist) /* 119 */ +#define Tcl_DStringFree (tclStubsPtr->tcl_DStringFree) /* 120 */ +#define Tcl_DStringGetResult (tclStubsPtr->tcl_DStringGetResult) /* 121 */ +#define Tcl_DStringInit (tclStubsPtr->tcl_DStringInit) /* 122 */ +#define Tcl_DStringResult (tclStubsPtr->tcl_DStringResult) /* 123 */ +#define Tcl_DStringSetLength (tclStubsPtr->tcl_DStringSetLength) /* 124 */ +#define Tcl_DStringStartSublist (tclStubsPtr->tcl_DStringStartSublist) /* 125 \ + */ +#define Tcl_Eof (tclStubsPtr->tcl_Eof) /* 126 */ +#define Tcl_ErrnoId (tclStubsPtr->tcl_ErrnoId) /* 127 */ +#define Tcl_ErrnoMsg (tclStubsPtr->tcl_ErrnoMsg) /* 128 */ +#define Tcl_Eval (tclStubsPtr->tcl_Eval) /* 129 */ +#define Tcl_EvalFile (tclStubsPtr->tcl_EvalFile) /* 130 */ +#define Tcl_EvalObj (tclStubsPtr->tcl_EvalObj) /* 131 */ +#define Tcl_EventuallyFree (tclStubsPtr->tcl_EventuallyFree) /* 132 */ +#define Tcl_Exit (tclStubsPtr->tcl_Exit) /* 133 */ +#define Tcl_ExposeCommand (tclStubsPtr->tcl_ExposeCommand) /* 134 */ +#define Tcl_ExprBoolean (tclStubsPtr->tcl_ExprBoolean) /* 135 */ +#define Tcl_ExprBooleanObj (tclStubsPtr->tcl_ExprBooleanObj) /* 136 */ +#define Tcl_ExprDouble (tclStubsPtr->tcl_ExprDouble) /* 137 */ +#define Tcl_ExprDoubleObj (tclStubsPtr->tcl_ExprDoubleObj) /* 138 */ +#define Tcl_ExprLong (tclStubsPtr->tcl_ExprLong) /* 139 */ +#define Tcl_ExprLongObj (tclStubsPtr->tcl_ExprLongObj) /* 140 */ +#define Tcl_ExprObj (tclStubsPtr->tcl_ExprObj) /* 141 */ +#define Tcl_ExprString (tclStubsPtr->tcl_ExprString) /* 142 */ +#define Tcl_Finalize (tclStubsPtr->tcl_Finalize) /* 143 */ +#define Tcl_FindExecutable (tclStubsPtr->tcl_FindExecutable) /* 144 */ +#define Tcl_FirstHashEntry (tclStubsPtr->tcl_FirstHashEntry) /* 145 */ +#define Tcl_Flush (tclStubsPtr->tcl_Flush) /* 146 */ +#define Tcl_FreeResult (tclStubsPtr->tcl_FreeResult) /* 147 */ +#define Tcl_GetAlias (tclStubsPtr->tcl_GetAlias) /* 148 */ +#define Tcl_GetAliasObj (tclStubsPtr->tcl_GetAliasObj) /* 149 */ +#define Tcl_GetAssocData (tclStubsPtr->tcl_GetAssocData) /* 150 */ +#define Tcl_GetChannel (tclStubsPtr->tcl_GetChannel) /* 151 */ +#define Tcl_GetChannelBufferSize \ + (tclStubsPtr->tcl_GetChannelBufferSize) /* 152 */ +#define Tcl_GetChannelHandle (tclStubsPtr->tcl_GetChannelHandle) /* 153 */ +#define Tcl_GetChannelInstanceData \ + (tclStubsPtr->tcl_GetChannelInstanceData) /* 154 */ +#define Tcl_GetChannelMode (tclStubsPtr->tcl_GetChannelMode) /* 155 */ +#define Tcl_GetChannelName (tclStubsPtr->tcl_GetChannelName) /* 156 */ +#define Tcl_GetChannelOption (tclStubsPtr->tcl_GetChannelOption) /* 157 */ +#define Tcl_GetChannelType (tclStubsPtr->tcl_GetChannelType) /* 158 */ +#define Tcl_GetCommandInfo (tclStubsPtr->tcl_GetCommandInfo) /* 159 */ +#define Tcl_GetCommandName (tclStubsPtr->tcl_GetCommandName) /* 160 */ +#define Tcl_GetErrno (tclStubsPtr->tcl_GetErrno) /* 161 */ +#define Tcl_GetHostName (tclStubsPtr->tcl_GetHostName) /* 162 */ +#define Tcl_GetInterpPath (tclStubsPtr->tcl_GetInterpPath) /* 163 */ +#define Tcl_GetMaster (tclStubsPtr->tcl_GetMaster) /* 164 */ +#define Tcl_GetNameOfExecutable (tclStubsPtr->tcl_GetNameOfExecutable) /* 165 \ + */ +#define Tcl_GetObjResult (tclStubsPtr->tcl_GetObjResult) /* 166 */ +#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */ +#define Tcl_GetOpenFile (tclStubsPtr->tcl_GetOpenFile) /* 167 */ +#endif /* UNIX */ +#ifdef MAC_OSX_TCL /* MACOSX */ +#define Tcl_GetOpenFile (tclStubsPtr->tcl_GetOpenFile) /* 167 */ +#endif /* MACOSX */ +#define Tcl_GetPathType (tclStubsPtr->tcl_GetPathType) /* 168 */ +#define Tcl_Gets (tclStubsPtr->tcl_Gets) /* 169 */ +#define Tcl_GetsObj (tclStubsPtr->tcl_GetsObj) /* 170 */ +#define Tcl_GetServiceMode (tclStubsPtr->tcl_GetServiceMode) /* 171 */ +#define Tcl_GetSlave (tclStubsPtr->tcl_GetSlave) /* 172 */ +#define Tcl_GetStdChannel (tclStubsPtr->tcl_GetStdChannel) /* 173 */ +#define Tcl_GetStringResult (tclStubsPtr->tcl_GetStringResult) /* 174 */ +#define Tcl_GetVar (tclStubsPtr->tcl_GetVar) /* 175 */ +#define Tcl_GetVar2 (tclStubsPtr->tcl_GetVar2) /* 176 */ +#define Tcl_GlobalEval (tclStubsPtr->tcl_GlobalEval) /* 177 */ +#define Tcl_GlobalEvalObj (tclStubsPtr->tcl_GlobalEvalObj) /* 178 */ +#define Tcl_HideCommand (tclStubsPtr->tcl_HideCommand) /* 179 */ +#define Tcl_Init (tclStubsPtr->tcl_Init) /* 180 */ +#define Tcl_InitHashTable (tclStubsPtr->tcl_InitHashTable) /* 181 */ +#define Tcl_InputBlocked (tclStubsPtr->tcl_InputBlocked) /* 182 */ +#define Tcl_InputBuffered (tclStubsPtr->tcl_InputBuffered) /* 183 */ +#define Tcl_InterpDeleted (tclStubsPtr->tcl_InterpDeleted) /* 184 */ +#define Tcl_IsSafe (tclStubsPtr->tcl_IsSafe) /* 185 */ +#define Tcl_JoinPath (tclStubsPtr->tcl_JoinPath) /* 186 */ +#define Tcl_LinkVar (tclStubsPtr->tcl_LinkVar) /* 187 */ +/* Slot 188 is reserved */ +#define Tcl_MakeFileChannel (tclStubsPtr->tcl_MakeFileChannel) /* 189 */ +#define Tcl_MakeSafe (tclStubsPtr->tcl_MakeSafe) /* 190 */ +#define Tcl_MakeTcpClientChannel \ + (tclStubsPtr->tcl_MakeTcpClientChannel) /* 191 */ +#define Tcl_Merge (tclStubsPtr->tcl_Merge) /* 192 */ +#define Tcl_NextHashEntry (tclStubsPtr->tcl_NextHashEntry) /* 193 */ +#define Tcl_NotifyChannel (tclStubsPtr->tcl_NotifyChannel) /* 194 */ +#define Tcl_ObjGetVar2 (tclStubsPtr->tcl_ObjGetVar2) /* 195 */ +#define Tcl_ObjSetVar2 (tclStubsPtr->tcl_ObjSetVar2) /* 196 */ +#define Tcl_OpenCommandChannel (tclStubsPtr->tcl_OpenCommandChannel) /* 197 */ +#define Tcl_OpenFileChannel (tclStubsPtr->tcl_OpenFileChannel) /* 198 */ +#define Tcl_OpenTcpClient (tclStubsPtr->tcl_OpenTcpClient) /* 199 */ +#define Tcl_OpenTcpServer (tclStubsPtr->tcl_OpenTcpServer) /* 200 */ +#define Tcl_Preserve (tclStubsPtr->tcl_Preserve) /* 201 */ +#define Tcl_PrintDouble (tclStubsPtr->tcl_PrintDouble) /* 202 */ +#define Tcl_PutEnv (tclStubsPtr->tcl_PutEnv) /* 203 */ +#define Tcl_PosixError (tclStubsPtr->tcl_PosixError) /* 204 */ +#define Tcl_QueueEvent (tclStubsPtr->tcl_QueueEvent) /* 205 */ +#define Tcl_Read (tclStubsPtr->tcl_Read) /* 206 */ +#define Tcl_ReapDetachedProcs (tclStubsPtr->tcl_ReapDetachedProcs) /* 207 */ +#define Tcl_RecordAndEval (tclStubsPtr->tcl_RecordAndEval) /* 208 */ +#define Tcl_RecordAndEvalObj (tclStubsPtr->tcl_RecordAndEvalObj) /* 209 */ +#define Tcl_RegisterChannel (tclStubsPtr->tcl_RegisterChannel) /* 210 */ +#define Tcl_RegisterObjType (tclStubsPtr->tcl_RegisterObjType) /* 211 */ +#define Tcl_RegExpCompile (tclStubsPtr->tcl_RegExpCompile) /* 212 */ +#define Tcl_RegExpExec (tclStubsPtr->tcl_RegExpExec) /* 213 */ +#define Tcl_RegExpMatch (tclStubsPtr->tcl_RegExpMatch) /* 214 */ +#define Tcl_RegExpRange (tclStubsPtr->tcl_RegExpRange) /* 215 */ +#define Tcl_Release (tclStubsPtr->tcl_Release) /* 216 */ +#define Tcl_ResetResult (tclStubsPtr->tcl_ResetResult) /* 217 */ +#define Tcl_ScanElement (tclStubsPtr->tcl_ScanElement) /* 218 */ +#define Tcl_ScanCountedElement (tclStubsPtr->tcl_ScanCountedElement) /* 219 */ +#define Tcl_SeekOld (tclStubsPtr->tcl_SeekOld) /* 220 */ +#define Tcl_ServiceAll (tclStubsPtr->tcl_ServiceAll) /* 221 */ +#define Tcl_ServiceEvent (tclStubsPtr->tcl_ServiceEvent) /* 222 */ +#define Tcl_SetAssocData (tclStubsPtr->tcl_SetAssocData) /* 223 */ +#define Tcl_SetChannelBufferSize \ + (tclStubsPtr->tcl_SetChannelBufferSize) /* 224 */ +#define Tcl_SetChannelOption (tclStubsPtr->tcl_SetChannelOption) /* 225 */ +#define Tcl_SetCommandInfo (tclStubsPtr->tcl_SetCommandInfo) /* 226 */ +#define Tcl_SetErrno (tclStubsPtr->tcl_SetErrno) /* 227 */ +#define Tcl_SetErrorCode (tclStubsPtr->tcl_SetErrorCode) /* 228 */ +#define Tcl_SetMaxBlockTime (tclStubsPtr->tcl_SetMaxBlockTime) /* 229 */ +#define Tcl_SetPanicProc (tclStubsPtr->tcl_SetPanicProc) /* 230 */ +#define Tcl_SetRecursionLimit (tclStubsPtr->tcl_SetRecursionLimit) /* 231 */ +#define Tcl_SetResult (tclStubsPtr->tcl_SetResult) /* 232 */ +#define Tcl_SetServiceMode (tclStubsPtr->tcl_SetServiceMode) /* 233 */ +#define Tcl_SetObjErrorCode (tclStubsPtr->tcl_SetObjErrorCode) /* 234 */ +#define Tcl_SetObjResult (tclStubsPtr->tcl_SetObjResult) /* 235 */ +#define Tcl_SetStdChannel (tclStubsPtr->tcl_SetStdChannel) /* 236 */ +#define Tcl_SetVar (tclStubsPtr->tcl_SetVar) /* 237 */ +#define Tcl_SetVar2 (tclStubsPtr->tcl_SetVar2) /* 238 */ +#define Tcl_SignalId (tclStubsPtr->tcl_SignalId) /* 239 */ +#define Tcl_SignalMsg (tclStubsPtr->tcl_SignalMsg) /* 240 */ +#define Tcl_SourceRCFile (tclStubsPtr->tcl_SourceRCFile) /* 241 */ +#define Tcl_SplitList (tclStubsPtr->tcl_SplitList) /* 242 */ +#define Tcl_SplitPath (tclStubsPtr->tcl_SplitPath) /* 243 */ +#define Tcl_StaticPackage (tclStubsPtr->tcl_StaticPackage) /* 244 */ +#define Tcl_StringMatch (tclStubsPtr->tcl_StringMatch) /* 245 */ +#define Tcl_TellOld (tclStubsPtr->tcl_TellOld) /* 246 */ +#define Tcl_TraceVar (tclStubsPtr->tcl_TraceVar) /* 247 */ +#define Tcl_TraceVar2 (tclStubsPtr->tcl_TraceVar2) /* 248 */ +#define Tcl_TranslateFileName (tclStubsPtr->tcl_TranslateFileName) /* 249 */ +#define Tcl_Ungets (tclStubsPtr->tcl_Ungets) /* 250 */ +#define Tcl_UnlinkVar (tclStubsPtr->tcl_UnlinkVar) /* 251 */ +#define Tcl_UnregisterChannel (tclStubsPtr->tcl_UnregisterChannel) /* 252 */ +#define Tcl_UnsetVar (tclStubsPtr->tcl_UnsetVar) /* 253 */ +#define Tcl_UnsetVar2 (tclStubsPtr->tcl_UnsetVar2) /* 254 */ +#define Tcl_UntraceVar (tclStubsPtr->tcl_UntraceVar) /* 255 */ +#define Tcl_UntraceVar2 (tclStubsPtr->tcl_UntraceVar2) /* 256 */ +#define Tcl_UpdateLinkedVar (tclStubsPtr->tcl_UpdateLinkedVar) /* 257 */ +#define Tcl_UpVar (tclStubsPtr->tcl_UpVar) /* 258 */ +#define Tcl_UpVar2 (tclStubsPtr->tcl_UpVar2) /* 259 */ +#define Tcl_VarEval (tclStubsPtr->tcl_VarEval) /* 260 */ +#define Tcl_VarTraceInfo (tclStubsPtr->tcl_VarTraceInfo) /* 261 */ +#define Tcl_VarTraceInfo2 (tclStubsPtr->tcl_VarTraceInfo2) /* 262 */ +#define Tcl_Write (tclStubsPtr->tcl_Write) /* 263 */ +#define Tcl_WrongNumArgs (tclStubsPtr->tcl_WrongNumArgs) /* 264 */ +#define Tcl_DumpActiveMemory (tclStubsPtr->tcl_DumpActiveMemory) /* 265 */ +#define Tcl_ValidateAllMemory (tclStubsPtr->tcl_ValidateAllMemory) /* 266 */ +#define Tcl_AppendResultVA (tclStubsPtr->tcl_AppendResultVA) /* 267 */ +#define Tcl_AppendStringsToObjVA \ + (tclStubsPtr->tcl_AppendStringsToObjVA) /* 268 */ +#define Tcl_HashStats (tclStubsPtr->tcl_HashStats) /* 269 */ +#define Tcl_ParseVar (tclStubsPtr->tcl_ParseVar) /* 270 */ +#define Tcl_PkgPresent (tclStubsPtr->tcl_PkgPresent) /* 271 */ +#define Tcl_PkgPresentEx (tclStubsPtr->tcl_PkgPresentEx) /* 272 */ +#define Tcl_PkgProvide (tclStubsPtr->tcl_PkgProvide) /* 273 */ +#define Tcl_PkgRequire (tclStubsPtr->tcl_PkgRequire) /* 274 */ +#define Tcl_SetErrorCodeVA (tclStubsPtr->tcl_SetErrorCodeVA) /* 275 */ +#define Tcl_VarEvalVA (tclStubsPtr->tcl_VarEvalVA) /* 276 */ +#define Tcl_WaitPid (tclStubsPtr->tcl_WaitPid) /* 277 */ +#define Tcl_PanicVA (tclStubsPtr->tcl_PanicVA) /* 278 */ +#define Tcl_GetVersion (tclStubsPtr->tcl_GetVersion) /* 279 */ +#define Tcl_InitMemory (tclStubsPtr->tcl_InitMemory) /* 280 */ +#define Tcl_StackChannel (tclStubsPtr->tcl_StackChannel) /* 281 */ +#define Tcl_UnstackChannel (tclStubsPtr->tcl_UnstackChannel) /* 282 */ +#define Tcl_GetStackedChannel (tclStubsPtr->tcl_GetStackedChannel) /* 283 */ +#define Tcl_SetMainLoop (tclStubsPtr->tcl_SetMainLoop) /* 284 */ +/* Slot 285 is reserved */ +#define Tcl_AppendObjToObj (tclStubsPtr->tcl_AppendObjToObj) /* 286 */ +#define Tcl_CreateEncoding (tclStubsPtr->tcl_CreateEncoding) /* 287 */ +#define Tcl_CreateThreadExitHandler \ + (tclStubsPtr->tcl_CreateThreadExitHandler) /* 288 */ +#define Tcl_DeleteThreadExitHandler \ + (tclStubsPtr->tcl_DeleteThreadExitHandler) /* 289 */ +#define Tcl_DiscardResult (tclStubsPtr->tcl_DiscardResult) /* 290 */ +#define Tcl_EvalEx (tclStubsPtr->tcl_EvalEx) /* 291 */ +#define Tcl_EvalObjv (tclStubsPtr->tcl_EvalObjv) /* 292 */ +#define Tcl_EvalObjEx (tclStubsPtr->tcl_EvalObjEx) /* 293 */ +#define Tcl_ExitThread (tclStubsPtr->tcl_ExitThread) /* 294 */ +#define Tcl_ExternalToUtf (tclStubsPtr->tcl_ExternalToUtf) /* 295 */ +#define Tcl_ExternalToUtfDString \ + (tclStubsPtr->tcl_ExternalToUtfDString) /* 296 */ +#define Tcl_FinalizeThread (tclStubsPtr->tcl_FinalizeThread) /* 297 */ +#define Tcl_FinalizeNotifier (tclStubsPtr->tcl_FinalizeNotifier) /* 298 */ +#define Tcl_FreeEncoding (tclStubsPtr->tcl_FreeEncoding) /* 299 */ +#define Tcl_GetCurrentThread (tclStubsPtr->tcl_GetCurrentThread) /* 300 */ +#define Tcl_GetEncoding (tclStubsPtr->tcl_GetEncoding) /* 301 */ +#define Tcl_GetEncodingName (tclStubsPtr->tcl_GetEncodingName) /* 302 */ +#define Tcl_GetEncodingNames (tclStubsPtr->tcl_GetEncodingNames) /* 303 */ +#define Tcl_GetIndexFromObjStruct \ + (tclStubsPtr->tcl_GetIndexFromObjStruct) /* 304 */ +#define Tcl_GetThreadData (tclStubsPtr->tcl_GetThreadData) /* 305 */ +#define Tcl_GetVar2Ex (tclStubsPtr->tcl_GetVar2Ex) /* 306 */ +#define Tcl_InitNotifier (tclStubsPtr->tcl_InitNotifier) /* 307 */ +#define Tcl_MutexLock (tclStubsPtr->tcl_MutexLock) /* 308 */ +#define Tcl_MutexUnlock (tclStubsPtr->tcl_MutexUnlock) /* 309 */ +#define Tcl_ConditionNotify (tclStubsPtr->tcl_ConditionNotify) /* 310 */ +#define Tcl_ConditionWait (tclStubsPtr->tcl_ConditionWait) /* 311 */ +#define Tcl_NumUtfChars (tclStubsPtr->tcl_NumUtfChars) /* 312 */ +#define Tcl_ReadChars (tclStubsPtr->tcl_ReadChars) /* 313 */ +#define Tcl_RestoreResult (tclStubsPtr->tcl_RestoreResult) /* 314 */ +#define Tcl_SaveResult (tclStubsPtr->tcl_SaveResult) /* 315 */ +#define Tcl_SetSystemEncoding (tclStubsPtr->tcl_SetSystemEncoding) /* 316 */ +#define Tcl_SetVar2Ex (tclStubsPtr->tcl_SetVar2Ex) /* 317 */ +#define Tcl_ThreadAlert (tclStubsPtr->tcl_ThreadAlert) /* 318 */ +#define Tcl_ThreadQueueEvent (tclStubsPtr->tcl_ThreadQueueEvent) /* 319 */ +#define Tcl_UniCharAtIndex (tclStubsPtr->tcl_UniCharAtIndex) /* 320 */ +#define Tcl_UniCharToLower (tclStubsPtr->tcl_UniCharToLower) /* 321 */ +#define Tcl_UniCharToTitle (tclStubsPtr->tcl_UniCharToTitle) /* 322 */ +#define Tcl_UniCharToUpper (tclStubsPtr->tcl_UniCharToUpper) /* 323 */ +#define Tcl_UniCharToUtf (tclStubsPtr->tcl_UniCharToUtf) /* 324 */ +#define Tcl_UtfAtIndex (tclStubsPtr->tcl_UtfAtIndex) /* 325 */ +#define Tcl_UtfCharComplete (tclStubsPtr->tcl_UtfCharComplete) /* 326 */ +#define Tcl_UtfBackslash (tclStubsPtr->tcl_UtfBackslash) /* 327 */ +#define Tcl_UtfFindFirst (tclStubsPtr->tcl_UtfFindFirst) /* 328 */ +#define Tcl_UtfFindLast (tclStubsPtr->tcl_UtfFindLast) /* 329 */ +#define Tcl_UtfNext (tclStubsPtr->tcl_UtfNext) /* 330 */ +#define Tcl_UtfPrev (tclStubsPtr->tcl_UtfPrev) /* 331 */ +#define Tcl_UtfToExternal (tclStubsPtr->tcl_UtfToExternal) /* 332 */ +#define Tcl_UtfToExternalDString \ + (tclStubsPtr->tcl_UtfToExternalDString) /* 333 */ +#define Tcl_UtfToLower (tclStubsPtr->tcl_UtfToLower) /* 334 */ +#define Tcl_UtfToTitle (tclStubsPtr->tcl_UtfToTitle) /* 335 */ +#define Tcl_UtfToUniChar (tclStubsPtr->tcl_UtfToUniChar) /* 336 */ +#define Tcl_UtfToUpper (tclStubsPtr->tcl_UtfToUpper) /* 337 */ +#define Tcl_WriteChars (tclStubsPtr->tcl_WriteChars) /* 338 */ +#define Tcl_WriteObj (tclStubsPtr->tcl_WriteObj) /* 339 */ +#define Tcl_GetString (tclStubsPtr->tcl_GetString) /* 340 */ +#define Tcl_GetDefaultEncodingDir \ + (tclStubsPtr->tcl_GetDefaultEncodingDir) /* 341 */ +#define Tcl_SetDefaultEncodingDir \ + (tclStubsPtr->tcl_SetDefaultEncodingDir) /* 342 */ +#define Tcl_AlertNotifier (tclStubsPtr->tcl_AlertNotifier) /* 343 */ +#define Tcl_ServiceModeHook (tclStubsPtr->tcl_ServiceModeHook) /* 344 */ +#define Tcl_UniCharIsAlnum (tclStubsPtr->tcl_UniCharIsAlnum) /* 345 */ +#define Tcl_UniCharIsAlpha (tclStubsPtr->tcl_UniCharIsAlpha) /* 346 */ +#define Tcl_UniCharIsDigit (tclStubsPtr->tcl_UniCharIsDigit) /* 347 */ +#define Tcl_UniCharIsLower (tclStubsPtr->tcl_UniCharIsLower) /* 348 */ +#define Tcl_UniCharIsSpace (tclStubsPtr->tcl_UniCharIsSpace) /* 349 */ +#define Tcl_UniCharIsUpper (tclStubsPtr->tcl_UniCharIsUpper) /* 350 */ +#define Tcl_UniCharIsWordChar (tclStubsPtr->tcl_UniCharIsWordChar) /* 351 */ +#define Tcl_UniCharLen (tclStubsPtr->tcl_UniCharLen) /* 352 */ +#define Tcl_UniCharNcmp (tclStubsPtr->tcl_UniCharNcmp) /* 353 */ +#define Tcl_UniCharToUtfDString (tclStubsPtr->tcl_UniCharToUtfDString) /* 354 \ + */ +#define Tcl_UtfToUniCharDString (tclStubsPtr->tcl_UtfToUniCharDString) /* 355 \ + */ +#define Tcl_GetRegExpFromObj (tclStubsPtr->tcl_GetRegExpFromObj) /* 356 */ +#define Tcl_EvalTokens (tclStubsPtr->tcl_EvalTokens) /* 357 */ +#define Tcl_FreeParse (tclStubsPtr->tcl_FreeParse) /* 358 */ +#define Tcl_LogCommandInfo (tclStubsPtr->tcl_LogCommandInfo) /* 359 */ +#define Tcl_ParseBraces (tclStubsPtr->tcl_ParseBraces) /* 360 */ +#define Tcl_ParseCommand (tclStubsPtr->tcl_ParseCommand) /* 361 */ +#define Tcl_ParseExpr (tclStubsPtr->tcl_ParseExpr) /* 362 */ +#define Tcl_ParseQuotedString (tclStubsPtr->tcl_ParseQuotedString) /* 363 */ +#define Tcl_ParseVarName (tclStubsPtr->tcl_ParseVarName) /* 364 */ +#define Tcl_GetCwd (tclStubsPtr->tcl_GetCwd) /* 365 */ +#define Tcl_Chdir (tclStubsPtr->tcl_Chdir) /* 366 */ +#define Tcl_Access (tclStubsPtr->tcl_Access) /* 367 */ +#define Tcl_Stat (tclStubsPtr->tcl_Stat) /* 368 */ +#define Tcl_UtfNcmp (tclStubsPtr->tcl_UtfNcmp) /* 369 */ +#define Tcl_UtfNcasecmp (tclStubsPtr->tcl_UtfNcasecmp) /* 370 */ +#define Tcl_StringCaseMatch (tclStubsPtr->tcl_StringCaseMatch) /* 371 */ +#define Tcl_UniCharIsControl (tclStubsPtr->tcl_UniCharIsControl) /* 372 */ +#define Tcl_UniCharIsGraph (tclStubsPtr->tcl_UniCharIsGraph) /* 373 */ +#define Tcl_UniCharIsPrint (tclStubsPtr->tcl_UniCharIsPrint) /* 374 */ +#define Tcl_UniCharIsPunct (tclStubsPtr->tcl_UniCharIsPunct) /* 375 */ +#define Tcl_RegExpExecObj (tclStubsPtr->tcl_RegExpExecObj) /* 376 */ +#define Tcl_RegExpGetInfo (tclStubsPtr->tcl_RegExpGetInfo) /* 377 */ +#define Tcl_NewUnicodeObj (tclStubsPtr->tcl_NewUnicodeObj) /* 378 */ +#define Tcl_SetUnicodeObj (tclStubsPtr->tcl_SetUnicodeObj) /* 379 */ +#define Tcl_GetCharLength (tclStubsPtr->tcl_GetCharLength) /* 380 */ +#define Tcl_GetUniChar (tclStubsPtr->tcl_GetUniChar) /* 381 */ +#define Tcl_GetUnicode (tclStubsPtr->tcl_GetUnicode) /* 382 */ +#define Tcl_GetRange (tclStubsPtr->tcl_GetRange) /* 383 */ +#define Tcl_AppendUnicodeToObj (tclStubsPtr->tcl_AppendUnicodeToObj) /* 384 */ +#define Tcl_RegExpMatchObj (tclStubsPtr->tcl_RegExpMatchObj) /* 385 */ +#define Tcl_SetNotifier (tclStubsPtr->tcl_SetNotifier) /* 386 */ +#define Tcl_GetAllocMutex (tclStubsPtr->tcl_GetAllocMutex) /* 387 */ +#define Tcl_GetChannelNames (tclStubsPtr->tcl_GetChannelNames) /* 388 */ +#define Tcl_GetChannelNamesEx (tclStubsPtr->tcl_GetChannelNamesEx) /* 389 */ +#define Tcl_ProcObjCmd (tclStubsPtr->tcl_ProcObjCmd) /* 390 */ +#define Tcl_ConditionFinalize (tclStubsPtr->tcl_ConditionFinalize) /* 391 */ +#define Tcl_MutexFinalize (tclStubsPtr->tcl_MutexFinalize) /* 392 */ +#define Tcl_CreateThread (tclStubsPtr->tcl_CreateThread) /* 393 */ +#define Tcl_ReadRaw (tclStubsPtr->tcl_ReadRaw) /* 394 */ +#define Tcl_WriteRaw (tclStubsPtr->tcl_WriteRaw) /* 395 */ +#define Tcl_GetTopChannel (tclStubsPtr->tcl_GetTopChannel) /* 396 */ +#define Tcl_ChannelBuffered (tclStubsPtr->tcl_ChannelBuffered) /* 397 */ +#define Tcl_ChannelName (tclStubsPtr->tcl_ChannelName) /* 398 */ +#define Tcl_ChannelVersion (tclStubsPtr->tcl_ChannelVersion) /* 399 */ +#define Tcl_ChannelBlockModeProc \ + (tclStubsPtr->tcl_ChannelBlockModeProc) /* 400 */ +#define Tcl_ChannelCloseProc (tclStubsPtr->tcl_ChannelCloseProc) /* 401 */ +#define Tcl_ChannelClose2Proc (tclStubsPtr->tcl_ChannelClose2Proc) /* 402 */ +#define Tcl_ChannelInputProc (tclStubsPtr->tcl_ChannelInputProc) /* 403 */ +#define Tcl_ChannelOutputProc (tclStubsPtr->tcl_ChannelOutputProc) /* 404 */ +#define Tcl_ChannelSeekProc (tclStubsPtr->tcl_ChannelSeekProc) /* 405 */ +#define Tcl_ChannelSetOptionProc \ + (tclStubsPtr->tcl_ChannelSetOptionProc) /* 406 */ +#define Tcl_ChannelGetOptionProc \ + (tclStubsPtr->tcl_ChannelGetOptionProc) /* 407 */ +#define Tcl_ChannelWatchProc (tclStubsPtr->tcl_ChannelWatchProc) /* 408 */ +#define Tcl_ChannelGetHandleProc \ + (tclStubsPtr->tcl_ChannelGetHandleProc) /* 409 */ +#define Tcl_ChannelFlushProc (tclStubsPtr->tcl_ChannelFlushProc) /* 410 */ +#define Tcl_ChannelHandlerProc (tclStubsPtr->tcl_ChannelHandlerProc) /* 411 */ +#define Tcl_JoinThread (tclStubsPtr->tcl_JoinThread) /* 412 */ +#define Tcl_IsChannelShared (tclStubsPtr->tcl_IsChannelShared) /* 413 */ +#define Tcl_IsChannelRegistered (tclStubsPtr->tcl_IsChannelRegistered) /* 414 \ + */ +#define Tcl_CutChannel (tclStubsPtr->tcl_CutChannel) /* 415 */ +#define Tcl_SpliceChannel (tclStubsPtr->tcl_SpliceChannel) /* 416 */ +#define Tcl_ClearChannelHandlers \ + (tclStubsPtr->tcl_ClearChannelHandlers) /* 417 */ +#define Tcl_IsChannelExisting (tclStubsPtr->tcl_IsChannelExisting) /* 418 */ +#define Tcl_UniCharNcasecmp (tclStubsPtr->tcl_UniCharNcasecmp) /* 419 */ +#define Tcl_UniCharCaseMatch (tclStubsPtr->tcl_UniCharCaseMatch) /* 420 */ +#define Tcl_FindHashEntry (tclStubsPtr->tcl_FindHashEntry) /* 421 */ +#define Tcl_CreateHashEntry (tclStubsPtr->tcl_CreateHashEntry) /* 422 */ +#define Tcl_InitCustomHashTable (tclStubsPtr->tcl_InitCustomHashTable) /* 423 \ + */ +#define Tcl_InitObjHashTable (tclStubsPtr->tcl_InitObjHashTable) /* 424 */ +#define Tcl_CommandTraceInfo (tclStubsPtr->tcl_CommandTraceInfo) /* 425 */ +#define Tcl_TraceCommand (tclStubsPtr->tcl_TraceCommand) /* 426 */ +#define Tcl_UntraceCommand (tclStubsPtr->tcl_UntraceCommand) /* 427 */ +#define Tcl_AttemptAlloc (tclStubsPtr->tcl_AttemptAlloc) /* 428 */ +#define Tcl_AttemptDbCkalloc (tclStubsPtr->tcl_AttemptDbCkalloc) /* 429 */ +#define Tcl_AttemptRealloc (tclStubsPtr->tcl_AttemptRealloc) /* 430 */ +#define Tcl_AttemptDbCkrealloc (tclStubsPtr->tcl_AttemptDbCkrealloc) /* 431 */ +#define Tcl_AttemptSetObjLength (tclStubsPtr->tcl_AttemptSetObjLength) /* 432 \ + */ +#define Tcl_GetChannelThread (tclStubsPtr->tcl_GetChannelThread) /* 433 */ +#define Tcl_GetUnicodeFromObj (tclStubsPtr->tcl_GetUnicodeFromObj) /* 434 */ +#define Tcl_GetMathFuncInfo (tclStubsPtr->tcl_GetMathFuncInfo) /* 435 */ +#define Tcl_ListMathFuncs (tclStubsPtr->tcl_ListMathFuncs) /* 436 */ +#define Tcl_SubstObj (tclStubsPtr->tcl_SubstObj) /* 437 */ +#define Tcl_DetachChannel (tclStubsPtr->tcl_DetachChannel) /* 438 */ +#define Tcl_IsStandardChannel (tclStubsPtr->tcl_IsStandardChannel) /* 439 */ +#define Tcl_FSCopyFile (tclStubsPtr->tcl_FSCopyFile) /* 440 */ +#define Tcl_FSCopyDirectory (tclStubsPtr->tcl_FSCopyDirectory) /* 441 */ +#define Tcl_FSCreateDirectory (tclStubsPtr->tcl_FSCreateDirectory) /* 442 */ +#define Tcl_FSDeleteFile (tclStubsPtr->tcl_FSDeleteFile) /* 443 */ +#define Tcl_FSLoadFile (tclStubsPtr->tcl_FSLoadFile) /* 444 */ +#define Tcl_FSMatchInDirectory (tclStubsPtr->tcl_FSMatchInDirectory) /* 445 */ +#define Tcl_FSLink (tclStubsPtr->tcl_FSLink) /* 446 */ +#define Tcl_FSRemoveDirectory (tclStubsPtr->tcl_FSRemoveDirectory) /* 447 */ +#define Tcl_FSRenameFile (tclStubsPtr->tcl_FSRenameFile) /* 448 */ +#define Tcl_FSLstat (tclStubsPtr->tcl_FSLstat) /* 449 */ +#define Tcl_FSUtime (tclStubsPtr->tcl_FSUtime) /* 450 */ +#define Tcl_FSFileAttrsGet (tclStubsPtr->tcl_FSFileAttrsGet) /* 451 */ +#define Tcl_FSFileAttrsSet (tclStubsPtr->tcl_FSFileAttrsSet) /* 452 */ +#define Tcl_FSFileAttrStrings (tclStubsPtr->tcl_FSFileAttrStrings) /* 453 */ +#define Tcl_FSStat (tclStubsPtr->tcl_FSStat) /* 454 */ +#define Tcl_FSAccess (tclStubsPtr->tcl_FSAccess) /* 455 */ +#define Tcl_FSOpenFileChannel (tclStubsPtr->tcl_FSOpenFileChannel) /* 456 */ +#define Tcl_FSGetCwd (tclStubsPtr->tcl_FSGetCwd) /* 457 */ +#define Tcl_FSChdir (tclStubsPtr->tcl_FSChdir) /* 458 */ +#define Tcl_FSConvertToPathType (tclStubsPtr->tcl_FSConvertToPathType) /* 459 \ + */ +#define Tcl_FSJoinPath (tclStubsPtr->tcl_FSJoinPath) /* 460 */ +#define Tcl_FSSplitPath (tclStubsPtr->tcl_FSSplitPath) /* 461 */ +#define Tcl_FSEqualPaths (tclStubsPtr->tcl_FSEqualPaths) /* 462 */ +#define Tcl_FSGetNormalizedPath (tclStubsPtr->tcl_FSGetNormalizedPath) /* 463 \ + */ +#define Tcl_FSJoinToPath (tclStubsPtr->tcl_FSJoinToPath) /* 464 */ +#define Tcl_FSGetInternalRep (tclStubsPtr->tcl_FSGetInternalRep) /* 465 */ +#define Tcl_FSGetTranslatedPath (tclStubsPtr->tcl_FSGetTranslatedPath) /* 466 \ + */ +#define Tcl_FSEvalFile (tclStubsPtr->tcl_FSEvalFile) /* 467 */ +#define Tcl_FSNewNativePath (tclStubsPtr->tcl_FSNewNativePath) /* 468 */ +#define Tcl_FSGetNativePath (tclStubsPtr->tcl_FSGetNativePath) /* 469 */ +#define Tcl_FSFileSystemInfo (tclStubsPtr->tcl_FSFileSystemInfo) /* 470 */ +#define Tcl_FSPathSeparator (tclStubsPtr->tcl_FSPathSeparator) /* 471 */ +#define Tcl_FSListVolumes (tclStubsPtr->tcl_FSListVolumes) /* 472 */ +#define Tcl_FSRegister (tclStubsPtr->tcl_FSRegister) /* 473 */ +#define Tcl_FSUnregister (tclStubsPtr->tcl_FSUnregister) /* 474 */ +#define Tcl_FSData (tclStubsPtr->tcl_FSData) /* 475 */ +#define Tcl_FSGetTranslatedStringPath \ + (tclStubsPtr->tcl_FSGetTranslatedStringPath) /* 476 */ +#define Tcl_FSGetFileSystemForPath \ + (tclStubsPtr->tcl_FSGetFileSystemForPath) /* 477 */ +#define Tcl_FSGetPathType (tclStubsPtr->tcl_FSGetPathType) /* 478 */ +#define Tcl_OutputBuffered (tclStubsPtr->tcl_OutputBuffered) /* 479 */ +#define Tcl_FSMountsChanged (tclStubsPtr->tcl_FSMountsChanged) /* 480 */ +#define Tcl_EvalTokensStandard (tclStubsPtr->tcl_EvalTokensStandard) /* 481 */ +#define Tcl_GetTime (tclStubsPtr->tcl_GetTime) /* 482 */ +#define Tcl_CreateObjTrace (tclStubsPtr->tcl_CreateObjTrace) /* 483 */ +#define Tcl_GetCommandInfoFromToken \ + (tclStubsPtr->tcl_GetCommandInfoFromToken) /* 484 */ +#define Tcl_SetCommandInfoFromToken \ + (tclStubsPtr->tcl_SetCommandInfoFromToken) /* 485 */ +#define Tcl_DbNewWideIntObj (tclStubsPtr->tcl_DbNewWideIntObj) /* 486 */ +#define Tcl_GetWideIntFromObj (tclStubsPtr->tcl_GetWideIntFromObj) /* 487 */ +#define Tcl_NewWideIntObj (tclStubsPtr->tcl_NewWideIntObj) /* 488 */ +#define Tcl_SetWideIntObj (tclStubsPtr->tcl_SetWideIntObj) /* 489 */ +#define Tcl_AllocStatBuf (tclStubsPtr->tcl_AllocStatBuf) /* 490 */ +#define Tcl_Seek (tclStubsPtr->tcl_Seek) /* 491 */ +#define Tcl_Tell (tclStubsPtr->tcl_Tell) /* 492 */ +#define Tcl_ChannelWideSeekProc (tclStubsPtr->tcl_ChannelWideSeekProc) /* 493 \ + */ +#define Tcl_DictObjPut (tclStubsPtr->tcl_DictObjPut) /* 494 */ +#define Tcl_DictObjGet (tclStubsPtr->tcl_DictObjGet) /* 495 */ +#define Tcl_DictObjRemove (tclStubsPtr->tcl_DictObjRemove) /* 496 */ +#define Tcl_DictObjSize (tclStubsPtr->tcl_DictObjSize) /* 497 */ +#define Tcl_DictObjFirst (tclStubsPtr->tcl_DictObjFirst) /* 498 */ +#define Tcl_DictObjNext (tclStubsPtr->tcl_DictObjNext) /* 499 */ +#define Tcl_DictObjDone (tclStubsPtr->tcl_DictObjDone) /* 500 */ +#define Tcl_DictObjPutKeyList (tclStubsPtr->tcl_DictObjPutKeyList) /* 501 */ +#define Tcl_DictObjRemoveKeyList \ + (tclStubsPtr->tcl_DictObjRemoveKeyList) /* 502 */ +#define Tcl_NewDictObj (tclStubsPtr->tcl_NewDictObj) /* 503 */ +#define Tcl_DbNewDictObj (tclStubsPtr->tcl_DbNewDictObj) /* 504 */ +#define Tcl_RegisterConfig (tclStubsPtr->tcl_RegisterConfig) /* 505 */ +#define Tcl_CreateNamespace (tclStubsPtr->tcl_CreateNamespace) /* 506 */ +#define Tcl_DeleteNamespace (tclStubsPtr->tcl_DeleteNamespace) /* 507 */ +#define Tcl_AppendExportList (tclStubsPtr->tcl_AppendExportList) /* 508 */ +#define Tcl_Export (tclStubsPtr->tcl_Export) /* 509 */ +#define Tcl_Import (tclStubsPtr->tcl_Import) /* 510 */ +#define Tcl_ForgetImport (tclStubsPtr->tcl_ForgetImport) /* 511 */ +#define Tcl_GetCurrentNamespace (tclStubsPtr->tcl_GetCurrentNamespace) /* 512 \ + */ +#define Tcl_GetGlobalNamespace (tclStubsPtr->tcl_GetGlobalNamespace) /* 513 */ +#define Tcl_FindNamespace (tclStubsPtr->tcl_FindNamespace) /* 514 */ +#define Tcl_FindCommand (tclStubsPtr->tcl_FindCommand) /* 515 */ +#define Tcl_GetCommandFromObj (tclStubsPtr->tcl_GetCommandFromObj) /* 516 */ +#define Tcl_GetCommandFullName (tclStubsPtr->tcl_GetCommandFullName) /* 517 */ +#define Tcl_FSEvalFileEx (tclStubsPtr->tcl_FSEvalFileEx) /* 518 */ +#define Tcl_SetExitProc (tclStubsPtr->tcl_SetExitProc) /* 519 */ +#define Tcl_LimitAddHandler (tclStubsPtr->tcl_LimitAddHandler) /* 520 */ +#define Tcl_LimitRemoveHandler (tclStubsPtr->tcl_LimitRemoveHandler) /* 521 */ +#define Tcl_LimitReady (tclStubsPtr->tcl_LimitReady) /* 522 */ +#define Tcl_LimitCheck (tclStubsPtr->tcl_LimitCheck) /* 523 */ +#define Tcl_LimitExceeded (tclStubsPtr->tcl_LimitExceeded) /* 524 */ +#define Tcl_LimitSetCommands (tclStubsPtr->tcl_LimitSetCommands) /* 525 */ +#define Tcl_LimitSetTime (tclStubsPtr->tcl_LimitSetTime) /* 526 */ +#define Tcl_LimitSetGranularity (tclStubsPtr->tcl_LimitSetGranularity) /* 527 \ + */ +#define Tcl_LimitTypeEnabled (tclStubsPtr->tcl_LimitTypeEnabled) /* 528 */ +#define Tcl_LimitTypeExceeded (tclStubsPtr->tcl_LimitTypeExceeded) /* 529 */ +#define Tcl_LimitTypeSet (tclStubsPtr->tcl_LimitTypeSet) /* 530 */ +#define Tcl_LimitTypeReset (tclStubsPtr->tcl_LimitTypeReset) /* 531 */ +#define Tcl_LimitGetCommands (tclStubsPtr->tcl_LimitGetCommands) /* 532 */ +#define Tcl_LimitGetTime (tclStubsPtr->tcl_LimitGetTime) /* 533 */ +#define Tcl_LimitGetGranularity (tclStubsPtr->tcl_LimitGetGranularity) /* 534 \ + */ +#define Tcl_SaveInterpState (tclStubsPtr->tcl_SaveInterpState) /* 535 */ +#define Tcl_RestoreInterpState (tclStubsPtr->tcl_RestoreInterpState) /* 536 */ +#define Tcl_DiscardInterpState (tclStubsPtr->tcl_DiscardInterpState) /* 537 */ +#define Tcl_SetReturnOptions (tclStubsPtr->tcl_SetReturnOptions) /* 538 */ +#define Tcl_GetReturnOptions (tclStubsPtr->tcl_GetReturnOptions) /* 539 */ +#define Tcl_IsEnsemble (tclStubsPtr->tcl_IsEnsemble) /* 540 */ +#define Tcl_CreateEnsemble (tclStubsPtr->tcl_CreateEnsemble) /* 541 */ +#define Tcl_FindEnsemble (tclStubsPtr->tcl_FindEnsemble) /* 542 */ +#define Tcl_SetEnsembleSubcommandList \ + (tclStubsPtr->tcl_SetEnsembleSubcommandList) /* 543 */ +#define Tcl_SetEnsembleMappingDict \ + (tclStubsPtr->tcl_SetEnsembleMappingDict) /* 544 */ +#define Tcl_SetEnsembleUnknownHandler \ + (tclStubsPtr->tcl_SetEnsembleUnknownHandler) /* 545 */ +#define Tcl_SetEnsembleFlags (tclStubsPtr->tcl_SetEnsembleFlags) /* 546 */ +#define Tcl_GetEnsembleSubcommandList \ + (tclStubsPtr->tcl_GetEnsembleSubcommandList) /* 547 */ +#define Tcl_GetEnsembleMappingDict \ + (tclStubsPtr->tcl_GetEnsembleMappingDict) /* 548 */ +#define Tcl_GetEnsembleUnknownHandler \ + (tclStubsPtr->tcl_GetEnsembleUnknownHandler) /* 549 */ +#define Tcl_GetEnsembleFlags (tclStubsPtr->tcl_GetEnsembleFlags) /* 550 */ +#define Tcl_GetEnsembleNamespace \ + (tclStubsPtr->tcl_GetEnsembleNamespace) /* 551 */ +#define Tcl_SetTimeProc (tclStubsPtr->tcl_SetTimeProc) /* 552 */ +#define Tcl_QueryTimeProc (tclStubsPtr->tcl_QueryTimeProc) /* 553 */ +#define Tcl_ChannelThreadActionProc \ + (tclStubsPtr->tcl_ChannelThreadActionProc) /* 554 */ +#define Tcl_NewBignumObj (tclStubsPtr->tcl_NewBignumObj) /* 555 */ +#define Tcl_DbNewBignumObj (tclStubsPtr->tcl_DbNewBignumObj) /* 556 */ +#define Tcl_SetBignumObj (tclStubsPtr->tcl_SetBignumObj) /* 557 */ +#define Tcl_GetBignumFromObj (tclStubsPtr->tcl_GetBignumFromObj) /* 558 */ +#define Tcl_TakeBignumFromObj (tclStubsPtr->tcl_TakeBignumFromObj) /* 559 */ +#define Tcl_TruncateChannel (tclStubsPtr->tcl_TruncateChannel) /* 560 */ +#define Tcl_ChannelTruncateProc (tclStubsPtr->tcl_ChannelTruncateProc) /* 561 \ + */ +#define Tcl_SetChannelErrorInterp \ + (tclStubsPtr->tcl_SetChannelErrorInterp) /* 562 */ +#define Tcl_GetChannelErrorInterp \ + (tclStubsPtr->tcl_GetChannelErrorInterp) /* 563 */ +#define Tcl_SetChannelError (tclStubsPtr->tcl_SetChannelError) /* 564 */ +#define Tcl_GetChannelError (tclStubsPtr->tcl_GetChannelError) /* 565 */ +#define Tcl_InitBignumFromDouble \ + (tclStubsPtr->tcl_InitBignumFromDouble) /* 566 */ +#define Tcl_GetNamespaceUnknownHandler \ + (tclStubsPtr->tcl_GetNamespaceUnknownHandler) /* 567 */ +#define Tcl_SetNamespaceUnknownHandler \ + (tclStubsPtr->tcl_SetNamespaceUnknownHandler) /* 568 */ +#define Tcl_GetEncodingFromObj (tclStubsPtr->tcl_GetEncodingFromObj) /* 569 */ +#define Tcl_GetEncodingSearchPath \ + (tclStubsPtr->tcl_GetEncodingSearchPath) /* 570 */ +#define Tcl_SetEncodingSearchPath \ + (tclStubsPtr->tcl_SetEncodingSearchPath) /* 571 */ +#define Tcl_GetEncodingNameFromEnvironment \ + (tclStubsPtr->tcl_GetEncodingNameFromEnvironment) /* 572 */ +#define Tcl_PkgRequireProc (tclStubsPtr->tcl_PkgRequireProc) /* 573 */ +#define Tcl_AppendObjToErrorInfo \ + (tclStubsPtr->tcl_AppendObjToErrorInfo) /* 574 */ +#define Tcl_AppendLimitedToObj (tclStubsPtr->tcl_AppendLimitedToObj) /* 575 */ +#define Tcl_Format (tclStubsPtr->tcl_Format) /* 576 */ +#define Tcl_AppendFormatToObj (tclStubsPtr->tcl_AppendFormatToObj) /* 577 */ +#define Tcl_ObjPrintf (tclStubsPtr->tcl_ObjPrintf) /* 578 */ +#define Tcl_AppendPrintfToObj (tclStubsPtr->tcl_AppendPrintfToObj) /* 579 */ +#define Tcl_CancelEval (tclStubsPtr->tcl_CancelEval) /* 580 */ +#define Tcl_Canceled (tclStubsPtr->tcl_Canceled) /* 581 */ +#define Tcl_CreatePipe (tclStubsPtr->tcl_CreatePipe) /* 582 */ +#define Tcl_NRCreateCommand (tclStubsPtr->tcl_NRCreateCommand) /* 583 */ +#define Tcl_NREvalObj (tclStubsPtr->tcl_NREvalObj) /* 584 */ +#define Tcl_NREvalObjv (tclStubsPtr->tcl_NREvalObjv) /* 585 */ +#define Tcl_NRCmdSwap (tclStubsPtr->tcl_NRCmdSwap) /* 586 */ +#define Tcl_NRAddCallback (tclStubsPtr->tcl_NRAddCallback) /* 587 */ +#define Tcl_NRCallObjProc (tclStubsPtr->tcl_NRCallObjProc) /* 588 */ +#define Tcl_GetFSDeviceFromStat (tclStubsPtr->tcl_GetFSDeviceFromStat) /* 589 \ + */ +#define Tcl_GetFSInodeFromStat (tclStubsPtr->tcl_GetFSInodeFromStat) /* 590 */ +#define Tcl_GetModeFromStat (tclStubsPtr->tcl_GetModeFromStat) /* 591 */ +#define Tcl_GetLinkCountFromStat \ + (tclStubsPtr->tcl_GetLinkCountFromStat) /* 592 */ +#define Tcl_GetUserIdFromStat (tclStubsPtr->tcl_GetUserIdFromStat) /* 593 */ +#define Tcl_GetGroupIdFromStat (tclStubsPtr->tcl_GetGroupIdFromStat) /* 594 */ +#define Tcl_GetDeviceTypeFromStat \ + (tclStubsPtr->tcl_GetDeviceTypeFromStat) /* 595 */ +#define Tcl_GetAccessTimeFromStat \ + (tclStubsPtr->tcl_GetAccessTimeFromStat) /* 596 */ +#define Tcl_GetModificationTimeFromStat \ + (tclStubsPtr->tcl_GetModificationTimeFromStat) /* 597 */ +#define Tcl_GetChangeTimeFromStat \ + (tclStubsPtr->tcl_GetChangeTimeFromStat) /* 598 */ +#define Tcl_GetSizeFromStat (tclStubsPtr->tcl_GetSizeFromStat) /* 599 */ +#define Tcl_GetBlocksFromStat (tclStubsPtr->tcl_GetBlocksFromStat) /* 600 */ +#define Tcl_GetBlockSizeFromStat \ + (tclStubsPtr->tcl_GetBlockSizeFromStat) /* 601 */ +#define Tcl_SetEnsembleParameterList \ + (tclStubsPtr->tcl_SetEnsembleParameterList) /* 602 */ +#define Tcl_GetEnsembleParameterList \ + (tclStubsPtr->tcl_GetEnsembleParameterList) /* 603 */ +#define Tcl_ParseArgsObjv (tclStubsPtr->tcl_ParseArgsObjv) /* 604 */ +#define Tcl_GetErrorLine (tclStubsPtr->tcl_GetErrorLine) /* 605 */ +#define Tcl_SetErrorLine (tclStubsPtr->tcl_SetErrorLine) /* 606 */ +#define Tcl_TransferResult (tclStubsPtr->tcl_TransferResult) /* 607 */ +#define Tcl_InterpActive (tclStubsPtr->tcl_InterpActive) /* 608 */ +#define Tcl_BackgroundException (tclStubsPtr->tcl_BackgroundException) /* 609 \ + */ +#define Tcl_ZlibDeflate (tclStubsPtr->tcl_ZlibDeflate) /* 610 */ +#define Tcl_ZlibInflate (tclStubsPtr->tcl_ZlibInflate) /* 611 */ +#define Tcl_ZlibCRC32 (tclStubsPtr->tcl_ZlibCRC32) /* 612 */ +#define Tcl_ZlibAdler32 (tclStubsPtr->tcl_ZlibAdler32) /* 613 */ +#define Tcl_ZlibStreamInit (tclStubsPtr->tcl_ZlibStreamInit) /* 614 */ +#define Tcl_ZlibStreamGetCommandName \ + (tclStubsPtr->tcl_ZlibStreamGetCommandName) /* 615 */ +#define Tcl_ZlibStreamEof (tclStubsPtr->tcl_ZlibStreamEof) /* 616 */ +#define Tcl_ZlibStreamChecksum (tclStubsPtr->tcl_ZlibStreamChecksum) /* 617 */ +#define Tcl_ZlibStreamPut (tclStubsPtr->tcl_ZlibStreamPut) /* 618 */ +#define Tcl_ZlibStreamGet (tclStubsPtr->tcl_ZlibStreamGet) /* 619 */ +#define Tcl_ZlibStreamClose (tclStubsPtr->tcl_ZlibStreamClose) /* 620 */ +#define Tcl_ZlibStreamReset (tclStubsPtr->tcl_ZlibStreamReset) /* 621 */ +#define Tcl_SetStartupScript (tclStubsPtr->tcl_SetStartupScript) /* 622 */ +#define Tcl_GetStartupScript (tclStubsPtr->tcl_GetStartupScript) /* 623 */ +#define Tcl_CloseEx (tclStubsPtr->tcl_CloseEx) /* 624 */ +#define Tcl_NRExprObj (tclStubsPtr->tcl_NRExprObj) /* 625 */ +#define Tcl_NRSubstObj (tclStubsPtr->tcl_NRSubstObj) /* 626 */ +#define Tcl_LoadFile (tclStubsPtr->tcl_LoadFile) /* 627 */ +#define Tcl_FindSymbol (tclStubsPtr->tcl_FindSymbol) /* 628 */ +#define Tcl_FSUnloadFile (tclStubsPtr->tcl_FSUnloadFile) /* 629 */ +#define Tcl_ZlibStreamSetCompressionDictionary \ + (tclStubsPtr->tcl_ZlibStreamSetCompressionDictionary) /* 630 */ + +#endif /* defined(USE_TCL_STUBS) */ + +/* !END!: Do not edit above this line. */ + +#if defined(USE_TCL_STUBS) +#undef Tcl_CreateInterp +#undef Tcl_FindExecutable +#undef Tcl_GetStringResult +#undef Tcl_Init +#undef Tcl_SetPanicProc +#undef Tcl_SetVar +#undef Tcl_ObjSetVar2 +#undef Tcl_StaticPackage +#define Tcl_CreateInterp() (tclStubsPtr->tcl_CreateInterp()) +#define Tcl_GetStringResult(interp) (tclStubsPtr->tcl_GetStringResult(interp)) +#define Tcl_Init(interp) (tclStubsPtr->tcl_Init(interp)) +#define Tcl_SetPanicProc(proc) (tclStubsPtr->tcl_SetPanicProc(proc)) +#define Tcl_SetVar(interp, varName, newValue, flags) \ + (tclStubsPtr->tcl_SetVar(interp, varName, newValue, flags)) +#define Tcl_ObjSetVar2(interp, part1, part2, newValue, flags) \ + (tclStubsPtr->tcl_ObjSetVar2(interp, part1, part2, newValue, flags)) +#endif + +#if defined(_WIN32) && defined(UNICODE) +#define Tcl_FindExecutable(arg) ((Tcl_FindExecutable)((const char*)(arg))) +#define Tcl_MainEx Tcl_MainExW +EXTERN void Tcl_MainExW( + int argc, + wchar_t** argv, + Tcl_AppInitProc* appInitProc, + Tcl_Interp* interp); +#endif + +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLIMPORT + +#undef Tcl_SeekOld +#undef Tcl_TellOld + +#undef Tcl_PkgPresent +#define Tcl_PkgPresent(interp, name, version, exact) \ + Tcl_PkgPresentEx(interp, name, version, exact, NULL) +#undef Tcl_PkgProvide +#define Tcl_PkgProvide(interp, name, version) \ + Tcl_PkgProvideEx(interp, name, version, NULL) +#undef Tcl_PkgRequire +#define Tcl_PkgRequire(interp, name, version, exact) \ + Tcl_PkgRequireEx(interp, name, version, exact, NULL) +#undef Tcl_GetIndexFromObj +#define Tcl_GetIndexFromObj(interp, objPtr, tablePtr, msg, flags, indexPtr) \ + Tcl_GetIndexFromObjStruct( \ + interp, objPtr, tablePtr, sizeof(char*), msg, flags, indexPtr) +#undef Tcl_NewBooleanObj +#define Tcl_NewBooleanObj(boolValue) Tcl_NewIntObj((boolValue) != 0) +#undef Tcl_DbNewBooleanObj +#define Tcl_DbNewBooleanObj(boolValue, file, line) \ + Tcl_DbNewLongObj((boolValue) != 0, file, line) +#undef Tcl_SetBooleanObj +#define Tcl_SetBooleanObj(objPtr, boolValue) \ + Tcl_SetIntObj((objPtr), (boolValue) != 0) +#undef Tcl_SetVar +#define Tcl_SetVar(interp, varName, newValue, flags) \ + Tcl_SetVar2(interp, varName, NULL, newValue, flags) +#undef Tcl_UnsetVar +#define Tcl_UnsetVar(interp, varName, flags) \ + Tcl_UnsetVar2(interp, varName, NULL, flags) +#undef Tcl_GetVar +#define Tcl_GetVar(interp, varName, flags) \ + Tcl_GetVar2(interp, varName, NULL, flags) +#undef Tcl_TraceVar +#define Tcl_TraceVar(interp, varName, flags, proc, clientData) \ + Tcl_TraceVar2(interp, varName, NULL, flags, proc, clientData) +#undef Tcl_UntraceVar +#define Tcl_UntraceVar(interp, varName, flags, proc, clientData) \ + Tcl_UntraceVar2(interp, varName, NULL, flags, proc, clientData) +#undef Tcl_VarTraceInfo +#define Tcl_VarTraceInfo(interp, varName, flags, proc, prevClientData) \ + Tcl_VarTraceInfo2(interp, varName, NULL, flags, proc, prevClientData) +#undef Tcl_UpVar +#define Tcl_UpVar(interp, frameName, varName, localName, flags) \ + Tcl_UpVar2(interp, frameName, varName, NULL, localName, flags) + +#if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) +#if defined(__CYGWIN__) && defined(TCL_WIDE_INT_IS_LONG) +/* On Cygwin64, long is 64-bit while on Win64 long is 32-bit. Therefore + * we have to make sure that all stub entries on Cygwin64 follow the + * Win64 signature. Cygwin64 stubbed extensions cannot use those stub + * entries any more, they should use the 64-bit alternatives where + * possible. Tcl 9 must find a better solution, but that cannot be done + * without introducing a binary incompatibility. + */ +#undef Tcl_DbNewLongObj +#undef Tcl_GetLongFromObj +#undef Tcl_NewLongObj +#undef Tcl_SetLongObj +#undef Tcl_ExprLong +#undef Tcl_ExprLongObj +#undef Tcl_UniCharNcmp +#undef Tcl_UtfNcmp +#undef Tcl_UtfNcasecmp +#undef Tcl_UniCharNcasecmp +#define Tcl_DbNewLongObj \ + ((Tcl_Obj * (*)(long, const char*, int))Tcl_DbNewWideIntObj) +#define Tcl_GetLongFromObj \ + ((int (*)(Tcl_Interp*, Tcl_Obj*, long*))Tcl_GetWideIntFromObj) +#define Tcl_NewLongObj ((Tcl_Obj * (*)(long))Tcl_NewWideIntObj) +#define Tcl_SetLongObj ((void (*)(Tcl_Obj*, long))Tcl_SetWideIntObj) +#define Tcl_ExprLong TclExprLong +static inline int +TclExprLong(Tcl_Interp* interp, const char* string, long* ptr) { + int intValue; + int result = tclStubsPtr->tcl_ExprLong(interp, string, (long*)&intValue); + if (result == TCL_OK) + *ptr = (long)intValue; + return result; +} +#define Tcl_ExprLongObj TclExprLongObj +static inline int TclExprLongObj(Tcl_Interp* interp, Tcl_Obj* obj, long* ptr) { + int intValue; + int result = tclStubsPtr->tcl_ExprLongObj(interp, obj, (long*)&intValue); + if (result == TCL_OK) + *ptr = (long)intValue; + return result; +} +#define Tcl_UniCharNcmp(ucs, uct, n) \ + ((int (*)(const Tcl_UniChar*, const Tcl_UniChar*, unsigned int)) \ + tclStubsPtr->tcl_UniCharNcmp)(ucs, uct, (unsigned int)(n)) +#define Tcl_UtfNcmp(s1, s2, n) \ + ((int (*)(const char*, const char*, unsigned int))tclStubsPtr->tcl_UtfNcmp)( \ + s1, s2, (unsigned int)(n)) +#define Tcl_UtfNcasecmp(s1, s2, n) \ + ((int (*)( \ + const char*, const char*, unsigned int))tclStubsPtr->tcl_UtfNcasecmp)( \ + s1, s2, (unsigned int)(n)) +#define Tcl_UniCharNcasecmp(ucs, uct, n) \ + ((int (*)(const Tcl_UniChar*, const Tcl_UniChar*, unsigned int)) \ + tclStubsPtr->tcl_UniCharNcasecmp)(ucs, uct, (unsigned int)(n)) +#endif +#endif + +/* + * Deprecated Tcl procedures: + */ + +#undef Tcl_EvalObj +#define Tcl_EvalObj(interp, objPtr) Tcl_EvalObjEx((interp), (objPtr), 0) +#undef Tcl_GlobalEvalObj +#define Tcl_GlobalEvalObj(interp, objPtr) \ + Tcl_EvalObjEx((interp), (objPtr), TCL_EVAL_GLOBAL) + +#endif /* _TCLDECLS */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tclOO.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tclOO.h new file mode 100644 index 0000000..2e3445a --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tclOO.h @@ -0,0 +1,154 @@ +/* + * tclOO.h -- + * + * This file contains the public API definitions and some of the function + * declarations for the object-system (NB: not Tcl_Obj, but ::oo). + * + * Copyright (c) 2006-2010 by Donal K. Fellows + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef TCLOO_H_INCLUDED +#define TCLOO_H_INCLUDED + +/* + * Be careful when it comes to versioning; need to make sure that the + * standalone TclOO version matches. Also make sure that this matches the + * version in the files: + * + * tests/oo.test + * tests/ooNext2.test + * unix/tclooConfig.sh + * win/tclooConfig.sh + */ + +#define TCLOO_VERSION "1.1.0" +#define TCLOO_PATCHLEVEL TCLOO_VERSION + +#include "tcl.h" + +/* + * For C++ compilers, use extern "C" + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern const char* TclOOInitializeStubs(Tcl_Interp*, const char* version); +#define Tcl_OOInitStubs(interp) TclOOInitializeStubs((interp), TCLOO_VERSION) +#ifndef USE_TCL_STUBS +#define TclOOInitializeStubs(interp, version) (TCLOO_PATCHLEVEL) +#endif + +/* + * These are opaque types. + */ + +typedef struct Tcl_Class_* Tcl_Class; +typedef struct Tcl_Method_* Tcl_Method; +typedef struct Tcl_Object_* Tcl_Object; +typedef struct Tcl_ObjectContext_* Tcl_ObjectContext; + +/* + * Public datatypes for callbacks and structures used in the TIP#257 (OO) + * implementation. These are used to implement custom types of method calls + * and to allow the attachment of arbitrary data to objects and classes. + */ + +typedef int(Tcl_MethodCallProc)( + ClientData clientData, + Tcl_Interp* interp, + Tcl_ObjectContext objectContext, + int objc, + Tcl_Obj* const* objv); +typedef void(Tcl_MethodDeleteProc)(ClientData clientData); +typedef int(Tcl_CloneProc)( + Tcl_Interp* interp, + ClientData oldClientData, + ClientData* newClientData); +typedef void(Tcl_ObjectMetadataDeleteProc)(ClientData clientData); +typedef int(Tcl_ObjectMapMethodNameProc)( + Tcl_Interp* interp, + Tcl_Object object, + Tcl_Class* startClsPtr, + Tcl_Obj* methodNameObj); + +/* + * The type of a method implementation. This describes how to call the method + * implementation, how to delete it (when the object or class is deleted) and + * how to create a clone of it (when the object or class is copied). + */ + +typedef struct { + int version; /* Structure version field. Always to be equal + * to TCL_OO_METHOD_VERSION_CURRENT in + * declarations. */ + const char* name; /* Name of this type of method, mostly for + * debugging purposes. */ + Tcl_MethodCallProc* callProc; + /* How to invoke this method. */ + Tcl_MethodDeleteProc* deleteProc; + /* How to delete this method's type-specific + * data, or NULL if the type-specific data + * does not need deleting. */ + Tcl_CloneProc* cloneProc; /* How to copy this method's type-specific + * data, or NULL if the type-specific data can + * be copied directly. */ +} Tcl_MethodType; + +/* + * The correct value for the version field of the Tcl_MethodType structure. + * This allows new versions of the structure to be introduced without breaking + * binary compatability. + */ + +#define TCL_OO_METHOD_VERSION_CURRENT 1 + +/* + * The type of some object (or class) metadata. This describes how to delete + * the metadata (when the object or class is deleted) and how to create a + * clone of it (when the object or class is copied). + */ + +typedef struct { + int version; /* Structure version field. Always to be equal + * to TCL_OO_METADATA_VERSION_CURRENT in + * declarations. */ + const char* name; + Tcl_ObjectMetadataDeleteProc* deleteProc; + /* How to delete the metadata. This must not + * be NULL. */ + Tcl_CloneProc* cloneProc; /* How to copy the metadata, or NULL if the + * type-specific data can be copied + * directly. */ +} Tcl_ObjectMetadataType; + +/* + * The correct value for the version field of the Tcl_ObjectMetadataType + * structure. This allows new versions of the structure to be introduced + * without breaking binary compatability. + */ + +#define TCL_OO_METADATA_VERSION_CURRENT 1 + +/* + * Include all the public API, generated from tclOO.decls. + */ + +#include "tclOODecls.h" + +#ifdef __cplusplus +} +#endif +#endif + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tclOODecls.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tclOODecls.h new file mode 100644 index 0000000..9de7134 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tclOODecls.h @@ -0,0 +1,279 @@ +/* + * This file is (mostly) automatically generated from tclOO.decls. + */ + +#ifndef _TCLOODECLS +#define _TCLOODECLS + +#ifndef TCLAPI +#ifdef BUILD_tcl +#define TCLAPI extern DLLEXPORT +#else +#define TCLAPI extern DLLIMPORT +#endif +#endif + +#ifdef USE_TCL_STUBS +#undef USE_TCLOO_STUBS +#define USE_TCLOO_STUBS +#endif + +/* !BEGIN!: Do not edit below this line. */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Exported function declarations: + */ + +/* 0 */ +TCLAPI Tcl_Object Tcl_CopyObjectInstance( + Tcl_Interp* interp, + Tcl_Object sourceObject, + const char* targetName, + const char* targetNamespaceName); +/* 1 */ +TCLAPI Tcl_Object Tcl_GetClassAsObject(Tcl_Class clazz); +/* 2 */ +TCLAPI Tcl_Class Tcl_GetObjectAsClass(Tcl_Object object); +/* 3 */ +TCLAPI Tcl_Command Tcl_GetObjectCommand(Tcl_Object object); +/* 4 */ +TCLAPI Tcl_Object Tcl_GetObjectFromObj(Tcl_Interp* interp, Tcl_Obj* objPtr); +/* 5 */ +TCLAPI Tcl_Namespace* Tcl_GetObjectNamespace(Tcl_Object object); +/* 6 */ +TCLAPI Tcl_Class Tcl_MethodDeclarerClass(Tcl_Method method); +/* 7 */ +TCLAPI Tcl_Object Tcl_MethodDeclarerObject(Tcl_Method method); +/* 8 */ +TCLAPI int Tcl_MethodIsPublic(Tcl_Method method); +/* 9 */ +TCLAPI int Tcl_MethodIsType( + Tcl_Method method, + const Tcl_MethodType* typePtr, + ClientData* clientDataPtr); +/* 10 */ +TCLAPI Tcl_Obj* Tcl_MethodName(Tcl_Method method); +/* 11 */ +TCLAPI Tcl_Method Tcl_NewInstanceMethod( + Tcl_Interp* interp, + Tcl_Object object, + Tcl_Obj* nameObj, + int isPublic, + const Tcl_MethodType* typePtr, + ClientData clientData); +/* 12 */ +TCLAPI Tcl_Method Tcl_NewMethod( + Tcl_Interp* interp, + Tcl_Class cls, + Tcl_Obj* nameObj, + int isPublic, + const Tcl_MethodType* typePtr, + ClientData clientData); +/* 13 */ +TCLAPI Tcl_Object Tcl_NewObjectInstance( + Tcl_Interp* interp, + Tcl_Class cls, + const char* nameStr, + const char* nsNameStr, + int objc, + Tcl_Obj* const* objv, + int skip); +/* 14 */ +TCLAPI int Tcl_ObjectDeleted(Tcl_Object object); +/* 15 */ +TCLAPI int Tcl_ObjectContextIsFiltering(Tcl_ObjectContext context); +/* 16 */ +TCLAPI Tcl_Method Tcl_ObjectContextMethod(Tcl_ObjectContext context); +/* 17 */ +TCLAPI Tcl_Object Tcl_ObjectContextObject(Tcl_ObjectContext context); +/* 18 */ +TCLAPI int Tcl_ObjectContextSkippedArgs(Tcl_ObjectContext context); +/* 19 */ +TCLAPI ClientData +Tcl_ClassGetMetadata(Tcl_Class clazz, const Tcl_ObjectMetadataType* typePtr); +/* 20 */ +TCLAPI void Tcl_ClassSetMetadata( + Tcl_Class clazz, + const Tcl_ObjectMetadataType* typePtr, + ClientData metadata); +/* 21 */ +TCLAPI ClientData +Tcl_ObjectGetMetadata(Tcl_Object object, const Tcl_ObjectMetadataType* typePtr); +/* 22 */ +TCLAPI void Tcl_ObjectSetMetadata( + Tcl_Object object, + const Tcl_ObjectMetadataType* typePtr, + ClientData metadata); +/* 23 */ +TCLAPI int Tcl_ObjectContextInvokeNext( + Tcl_Interp* interp, + Tcl_ObjectContext context, + int objc, + Tcl_Obj* const* objv, + int skip); +/* 24 */ +TCLAPI Tcl_ObjectMapMethodNameProc* Tcl_ObjectGetMethodNameMapper( + Tcl_Object object); +/* 25 */ +TCLAPI void Tcl_ObjectSetMethodNameMapper( + Tcl_Object object, + Tcl_ObjectMapMethodNameProc* mapMethodNameProc); +/* 26 */ +TCLAPI void +Tcl_ClassSetConstructor(Tcl_Interp* interp, Tcl_Class clazz, Tcl_Method method); +/* 27 */ +TCLAPI void +Tcl_ClassSetDestructor(Tcl_Interp* interp, Tcl_Class clazz, Tcl_Method method); +/* 28 */ +TCLAPI Tcl_Obj* Tcl_GetObjectName(Tcl_Interp* interp, Tcl_Object object); + +typedef struct { const struct TclOOIntStubs* tclOOIntStubs; } TclOOStubHooks; + +typedef struct TclOOStubs { + int magic; + const TclOOStubHooks* hooks; + + Tcl_Object (*tcl_CopyObjectInstance)( + Tcl_Interp* interp, + Tcl_Object sourceObject, + const char* targetName, + const char* targetNamespaceName); /* 0 */ + Tcl_Object (*tcl_GetClassAsObject)(Tcl_Class clazz); /* 1 */ + Tcl_Class (*tcl_GetObjectAsClass)(Tcl_Object object); /* 2 */ + Tcl_Command (*tcl_GetObjectCommand)(Tcl_Object object); /* 3 */ + Tcl_Object ( + *tcl_GetObjectFromObj)(Tcl_Interp* interp, Tcl_Obj* objPtr); /* 4 */ + Tcl_Namespace* (*tcl_GetObjectNamespace)(Tcl_Object object); /* 5 */ + Tcl_Class (*tcl_MethodDeclarerClass)(Tcl_Method method); /* 6 */ + Tcl_Object (*tcl_MethodDeclarerObject)(Tcl_Method method); /* 7 */ + int (*tcl_MethodIsPublic)(Tcl_Method method); /* 8 */ + int (*tcl_MethodIsType)( + Tcl_Method method, + const Tcl_MethodType* typePtr, + ClientData* clientDataPtr); /* 9 */ + Tcl_Obj* (*tcl_MethodName)(Tcl_Method method); /* 10 */ + Tcl_Method (*tcl_NewInstanceMethod)( + Tcl_Interp* interp, + Tcl_Object object, + Tcl_Obj* nameObj, + int isPublic, + const Tcl_MethodType* typePtr, + ClientData clientData); /* 11 */ + Tcl_Method (*tcl_NewMethod)( + Tcl_Interp* interp, + Tcl_Class cls, + Tcl_Obj* nameObj, + int isPublic, + const Tcl_MethodType* typePtr, + ClientData clientData); /* 12 */ + Tcl_Object (*tcl_NewObjectInstance)( + Tcl_Interp* interp, + Tcl_Class cls, + const char* nameStr, + const char* nsNameStr, + int objc, + Tcl_Obj* const* objv, + int skip); /* 13 */ + int (*tcl_ObjectDeleted)(Tcl_Object object); /* 14 */ + int (*tcl_ObjectContextIsFiltering)(Tcl_ObjectContext context); /* 15 */ + Tcl_Method (*tcl_ObjectContextMethod)(Tcl_ObjectContext context); /* 16 */ + Tcl_Object (*tcl_ObjectContextObject)(Tcl_ObjectContext context); /* 17 */ + int (*tcl_ObjectContextSkippedArgs)(Tcl_ObjectContext context); /* 18 */ + ClientData (*tcl_ClassGetMetadata)( + Tcl_Class clazz, + const Tcl_ObjectMetadataType* typePtr); /* 19 */ + void (*tcl_ClassSetMetadata)( + Tcl_Class clazz, + const Tcl_ObjectMetadataType* typePtr, + ClientData metadata); /* 20 */ + ClientData (*tcl_ObjectGetMetadata)( + Tcl_Object object, + const Tcl_ObjectMetadataType* typePtr); /* 21 */ + void (*tcl_ObjectSetMetadata)( + Tcl_Object object, + const Tcl_ObjectMetadataType* typePtr, + ClientData metadata); /* 22 */ + int (*tcl_ObjectContextInvokeNext)( + Tcl_Interp* interp, + Tcl_ObjectContext context, + int objc, + Tcl_Obj* const* objv, + int skip); /* 23 */ + Tcl_ObjectMapMethodNameProc* (*tcl_ObjectGetMethodNameMapper)( + Tcl_Object object); /* 24 */ + void (*tcl_ObjectSetMethodNameMapper)( + Tcl_Object object, + Tcl_ObjectMapMethodNameProc* mapMethodNameProc); /* 25 */ + void (*tcl_ClassSetConstructor)( + Tcl_Interp* interp, + Tcl_Class clazz, + Tcl_Method method); /* 26 */ + void (*tcl_ClassSetDestructor)( + Tcl_Interp* interp, + Tcl_Class clazz, + Tcl_Method method); /* 27 */ + Tcl_Obj* (*tcl_GetObjectName)(Tcl_Interp* interp, Tcl_Object object); /* 28 */ +} TclOOStubs; + +extern const TclOOStubs* tclOOStubsPtr; + +#ifdef __cplusplus +} +#endif + +#if defined(USE_TCLOO_STUBS) + +/* + * Inline function declarations: + */ + +#define Tcl_CopyObjectInstance (tclOOStubsPtr->tcl_CopyObjectInstance) /* 0 */ +#define Tcl_GetClassAsObject (tclOOStubsPtr->tcl_GetClassAsObject) /* 1 */ +#define Tcl_GetObjectAsClass (tclOOStubsPtr->tcl_GetObjectAsClass) /* 2 */ +#define Tcl_GetObjectCommand (tclOOStubsPtr->tcl_GetObjectCommand) /* 3 */ +#define Tcl_GetObjectFromObj (tclOOStubsPtr->tcl_GetObjectFromObj) /* 4 */ +#define Tcl_GetObjectNamespace (tclOOStubsPtr->tcl_GetObjectNamespace) /* 5 */ +#define Tcl_MethodDeclarerClass (tclOOStubsPtr->tcl_MethodDeclarerClass) /* 6 \ + */ +#define Tcl_MethodDeclarerObject \ + (tclOOStubsPtr->tcl_MethodDeclarerObject) /* 7 */ +#define Tcl_MethodIsPublic (tclOOStubsPtr->tcl_MethodIsPublic) /* 8 */ +#define Tcl_MethodIsType (tclOOStubsPtr->tcl_MethodIsType) /* 9 */ +#define Tcl_MethodName (tclOOStubsPtr->tcl_MethodName) /* 10 */ +#define Tcl_NewInstanceMethod (tclOOStubsPtr->tcl_NewInstanceMethod) /* 11 */ +#define Tcl_NewMethod (tclOOStubsPtr->tcl_NewMethod) /* 12 */ +#define Tcl_NewObjectInstance (tclOOStubsPtr->tcl_NewObjectInstance) /* 13 */ +#define Tcl_ObjectDeleted (tclOOStubsPtr->tcl_ObjectDeleted) /* 14 */ +#define Tcl_ObjectContextIsFiltering \ + (tclOOStubsPtr->tcl_ObjectContextIsFiltering) /* 15 */ +#define Tcl_ObjectContextMethod \ + (tclOOStubsPtr->tcl_ObjectContextMethod) /* 16 */ +#define Tcl_ObjectContextObject \ + (tclOOStubsPtr->tcl_ObjectContextObject) /* 17 */ +#define Tcl_ObjectContextSkippedArgs \ + (tclOOStubsPtr->tcl_ObjectContextSkippedArgs) /* 18 */ +#define Tcl_ClassGetMetadata (tclOOStubsPtr->tcl_ClassGetMetadata) /* 19 */ +#define Tcl_ClassSetMetadata (tclOOStubsPtr->tcl_ClassSetMetadata) /* 20 */ +#define Tcl_ObjectGetMetadata (tclOOStubsPtr->tcl_ObjectGetMetadata) /* 21 */ +#define Tcl_ObjectSetMetadata (tclOOStubsPtr->tcl_ObjectSetMetadata) /* 22 */ +#define Tcl_ObjectContextInvokeNext \ + (tclOOStubsPtr->tcl_ObjectContextInvokeNext) /* 23 */ +#define Tcl_ObjectGetMethodNameMapper \ + (tclOOStubsPtr->tcl_ObjectGetMethodNameMapper) /* 24 */ +#define Tcl_ObjectSetMethodNameMapper \ + (tclOOStubsPtr->tcl_ObjectSetMethodNameMapper) /* 25 */ +#define Tcl_ClassSetConstructor \ + (tclOOStubsPtr->tcl_ClassSetConstructor) /* 26 */ +#define Tcl_ClassSetDestructor (tclOOStubsPtr->tcl_ClassSetDestructor) /* 27 \ + */ +#define Tcl_GetObjectName (tclOOStubsPtr->tcl_GetObjectName) /* 28 */ + +#endif /* defined(USE_TCLOO_STUBS) */ + +/* !END!: Do not edit above this line. */ + +#endif /* _TCLOODECLS */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tclPlatDecls.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tclPlatDecls.h new file mode 100644 index 0000000..1c23c56 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tclPlatDecls.h @@ -0,0 +1,136 @@ +/* + * tclPlatDecls.h -- + * + * Declarations of platform specific Tcl APIs. + * + * Copyright (c) 1998-1999 by Scriptics Corporation. + * All rights reserved. + */ + +#ifndef _TCLPLATDECLS +#define _TCLPLATDECLS + +#undef TCL_STORAGE_CLASS +#ifdef BUILD_tcl +#define TCL_STORAGE_CLASS DLLEXPORT +#else +#ifdef USE_TCL_STUBS +#define TCL_STORAGE_CLASS +#else +#define TCL_STORAGE_CLASS DLLIMPORT +#endif +#endif + +/* + * WARNING: This file is automatically generated by the tools/genStubs.tcl + * script. Any modifications to the function declarations below should be made + * in the generic/tcl.decls script. + */ + +/* + * TCHAR is needed here for win32, so if it is not defined yet do it here. + * This way, we don't need to include just for one define. + */ +#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(_TCHAR_DEFINED) +#if defined(_UNICODE) +typedef wchar_t TCHAR; +#else +typedef char TCHAR; +#endif +#define _TCHAR_DEFINED +#endif + +/* !BEGIN!: Do not edit below this line. */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Exported function declarations: + */ + +#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ +/* 0 */ +EXTERN TCHAR* Tcl_WinUtfToTChar(const char* str, int len, Tcl_DString* dsPtr); +/* 1 */ +EXTERN char* Tcl_WinTCharToUtf(const TCHAR* str, int len, Tcl_DString* dsPtr); +#endif /* WIN */ +#ifdef MAC_OSX_TCL /* MACOSX */ +/* 0 */ +EXTERN int Tcl_MacOSXOpenBundleResources( + Tcl_Interp* interp, + const char* bundleName, + int hasResourceFile, + int maxPathLen, + char* libraryPath); +/* 1 */ +EXTERN int Tcl_MacOSXOpenVersionedBundleResources( + Tcl_Interp* interp, + const char* bundleName, + const char* bundleVersion, + int hasResourceFile, + int maxPathLen, + char* libraryPath); +#endif /* MACOSX */ + +typedef struct TclPlatStubs { + int magic; + void* hooks; + +#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ + TCHAR* ( + *tcl_WinUtfToTChar)(const char* str, int len, Tcl_DString* dsPtr); /* 0 */ + char* (*tcl_WinTCharToUtf)( + const TCHAR* str, + int len, + Tcl_DString* dsPtr); /* 1 */ +#endif /* WIN */ +#ifdef MAC_OSX_TCL /* MACOSX */ + int (*tcl_MacOSXOpenBundleResources)( + Tcl_Interp* interp, + const char* bundleName, + int hasResourceFile, + int maxPathLen, + char* libraryPath); /* 0 */ + int (*tcl_MacOSXOpenVersionedBundleResources)( + Tcl_Interp* interp, + const char* bundleName, + const char* bundleVersion, + int hasResourceFile, + int maxPathLen, + char* libraryPath); /* 1 */ +#endif /* MACOSX */ +} TclPlatStubs; + +extern const TclPlatStubs* tclPlatStubsPtr; + +#ifdef __cplusplus +} +#endif + +#if defined(USE_TCL_STUBS) + +/* + * Inline function declarations: + */ + +#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ +#define Tcl_WinUtfToTChar (tclPlatStubsPtr->tcl_WinUtfToTChar) /* 0 */ +#define Tcl_WinTCharToUtf (tclPlatStubsPtr->tcl_WinTCharToUtf) /* 1 */ +#endif /* WIN */ +#ifdef MAC_OSX_TCL /* MACOSX */ +#define Tcl_MacOSXOpenBundleResources \ + (tclPlatStubsPtr->tcl_MacOSXOpenBundleResources) /* 0 */ +#define Tcl_MacOSXOpenVersionedBundleResources \ + (tclPlatStubsPtr->tcl_MacOSXOpenVersionedBundleResources) /* 1 */ +#endif /* MACOSX */ + +#endif /* defined(USE_TCL_STUBS) */ + +/* !END!: Do not edit above this line. */ + +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLIMPORT + +#endif /* _TCLPLATDECLS */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tclThread.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tclThread.h new file mode 100644 index 0000000..df094e5 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tclThread.h @@ -0,0 +1,31 @@ +/* + * -------------------------------------------------------------------------- + * tclthread.h -- + * + * Global header file for the thread extension. + * + * Copyright (c) 2002 ActiveState Corporation. + * Copyright (c) 2002 by Zoran Vasiljevic. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * --------------------------------------------------------------------------- + */ + +/* + * Thread extension version numbers are not stored here + * because this isn't a public export file. + */ + +#ifndef _TCL_THREAD_H_ +#define _TCL_THREAD_H_ + +#include + +/* + * Exported from threadCmd.c file. + */ + +DLLEXPORT int Thread_Init(Tcl_Interp* interp); + +#endif /* _TCL_THREAD_H_ */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tclTomMath.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tclTomMath.h new file mode 100644 index 0000000..65e2107 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tclTomMath.h @@ -0,0 +1,839 @@ +/* LibTomMath, multiple-precision integer library -- Tom St Denis + * + * LibTomMath is a library that provides multiple-precision + * integer arithmetic as well as number theoretic functionality. + * + * The library was designed directly after the MPI library by + * Michael Fromberger but has been written from scratch with + * additional optimizations in place. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com + */ +#ifndef BN_H_ +#define BN_H_ + +#include "tclTomMathDecls.h" +#ifndef MODULE_SCOPE +#define MODULE_SCOPE extern +#endif + +#ifndef MIN +#define MIN(x, y) ((x) < (y) ? (x) : (y)) +#endif + +#ifndef MAX +#define MAX(x, y) ((x) > (y) ? (x) : (y)) +#endif + +#ifdef __cplusplus +extern "C" { + +/* C++ compilers don't like assigning void * to mp_digit * */ +#define OPT_CAST(x) (x*) + +#else + +/* C on the other hand doesn't care */ +#define OPT_CAST(x) + +#endif + +/* detect 64-bit mode if possible */ +#if defined(NEVER) /* 128-bit ints fail in too many places */ +#if !(defined(MP_64BIT) && defined(MP_16BIT) && defined(MP_8BIT)) +#define MP_64BIT +#endif +#endif + +/* some default configurations. + * + * A "mp_digit" must be able to hold DIGIT_BIT + 1 bits + * A "mp_word" must be able to hold 2*DIGIT_BIT + 1 bits + * + * At the very least a mp_digit must be able to hold 7 bits + * [any size beyond that is ok provided it doesn't overflow the data type] + */ +#ifdef MP_8BIT +#ifndef MP_DIGIT_DECLARED +typedef unsigned char mp_digit; +#define MP_DIGIT_DECLARED +#endif +typedef unsigned short mp_word; +#elif defined(MP_16BIT) +#ifndef MP_DIGIT_DECLARED +typedef unsigned short mp_digit; +#define MP_DIGIT_DECLARED +#endif +typedef unsigned long mp_word; +#elif defined(MP_64BIT) +/* for GCC only on supported platforms */ +#ifndef CRYPT +typedef unsigned long long ulong64; +typedef signed long long long64; +#endif + +#ifndef MP_DIGIT_DECLARED +typedef unsigned long mp_digit; +#define MP_DIGIT_DECLARED +#endif +typedef unsigned long mp_word __attribute__((mode(TI))); + +#define DIGIT_BIT 60 +#else +/* this is the default case, 28-bit digits */ + +/* this is to make porting into LibTomCrypt easier :-) */ +#ifndef CRYPT +#if defined(_MSC_VER) || defined(__BORLANDC__) +typedef unsigned __int64 ulong64; +typedef signed __int64 long64; +#else +typedef unsigned long long ulong64; +typedef signed long long long64; +#endif +#endif + +#ifndef MP_DIGIT_DECLARED +typedef unsigned int mp_digit; +#define MP_DIGIT_DECLARED +#endif +typedef ulong64 mp_word; + +#ifdef MP_31BIT +/* this is an extension that uses 31-bit digits */ +#define DIGIT_BIT 31 +#else +/* default case is 28-bit digits, defines MP_28BIT as a handy macro to test */ +#define DIGIT_BIT 28 +#define MP_28BIT +#endif +#endif + +/* define heap macros */ +#if 0 /* these are macros in tclTomMathDecls.h */ +#ifndef CRYPT + /* default to libc stuff */ +#ifndef XMALLOC +#define XMALLOC malloc +#define XFREE free +#define XREALLOC realloc +#define XCALLOC calloc +#else + /* prototypes for our heap functions */ + extern void *XMALLOC(size_t n); + extern void *XREALLOC(void *p, size_t n); + extern void *XCALLOC(size_t n, size_t s); + extern void XFREE(void *p); +#endif +#endif +#endif + +/* otherwise the bits per digit is calculated automatically from the size of a + * mp_digit */ +#ifndef DIGIT_BIT +#define DIGIT_BIT \ + ((int)((CHAR_BIT * sizeof(mp_digit) - 1))) /* bits per digit */ +#endif + +#define MP_DIGIT_BIT DIGIT_BIT +#define MP_MASK ((((mp_digit)1) << ((mp_digit)DIGIT_BIT)) - ((mp_digit)1)) +#define MP_DIGIT_MAX MP_MASK + +/* equalities */ +#define MP_LT -1 /* less than */ +#define MP_EQ 0 /* equal to */ +#define MP_GT 1 /* greater than */ + +#define MP_ZPOS 0 /* positive integer */ +#define MP_NEG 1 /* negative */ + +#define MP_OKAY 0 /* ok result */ +#define MP_MEM -2 /* out of mem */ +#define MP_VAL -3 /* invalid input */ +#define MP_RANGE MP_VAL + +#define MP_YES 1 /* yes response */ +#define MP_NO 0 /* no response */ + +/* Primality generation flags */ +#define LTM_PRIME_BBS 0x0001 /* BBS style prime */ +#define LTM_PRIME_SAFE 0x0002 /* Safe prime (p-1)/2 == prime */ +#define LTM_PRIME_2MSB_ON 0x0008 /* force 2nd MSB to 1 */ + +typedef int mp_err; + +/* you'll have to tune these... */ +#if defined(BUILD_tcl) || !defined(_WIN32) +MODULE_SCOPE int KARATSUBA_MUL_CUTOFF, KARATSUBA_SQR_CUTOFF, TOOM_MUL_CUTOFF, + TOOM_SQR_CUTOFF; +#endif + +/* define this to use lower memory usage routines (exptmods mostly) */ +/* #define MP_LOW_MEM */ + +/* default precision */ +#ifndef MP_PREC +#ifndef MP_LOW_MEM +#define MP_PREC 32 /* default digits of precision */ +#else +#define MP_PREC 8 /* default digits of precision */ +#endif +#endif + +/* size of comba arrays, should be at least 2 * 2**(BITS_PER_WORD - + * BITS_PER_DIGIT*2) */ +#define MP_WARRAY (1 << (sizeof(mp_word) * CHAR_BIT - 2 * DIGIT_BIT + 1)) + +/* the infamous mp_int structure */ +#ifndef MP_INT_DECLARED +#define MP_INT_DECLARED +typedef struct mp_int mp_int; +#endif +struct mp_int { + int used, alloc, sign; + mp_digit* dp; +}; + +/* callback for mp_prime_random, should fill dst with random bytes and return + * how many read [upto len] */ +typedef int ltm_prime_callback(unsigned char* dst, int len, void* dat); + +#define USED(m) ((m)->used) +#define DIGIT(m, k) ((m)->dp[(k)]) +#define SIGN(m) ((m)->sign) + +/* error code to char* string */ +/* +char *mp_error_to_string(int code); +*/ + +/* ---> init and deinit bignum functions <--- */ +/* init a bignum */ +/* +int mp_init(mp_int *a); +*/ + +/* free a bignum */ +/* +void mp_clear(mp_int *a); +*/ + +/* init a null terminated series of arguments */ +/* +int mp_init_multi(mp_int *mp, ...); +*/ + +/* clear a null terminated series of arguments */ +/* +void mp_clear_multi(mp_int *mp, ...); +*/ + +/* exchange two ints */ +/* +void mp_exch(mp_int *a, mp_int *b); +*/ + +/* shrink ram required for a bignum */ +/* +int mp_shrink(mp_int *a); +*/ + +/* grow an int to a given size */ +/* +int mp_grow(mp_int *a, int size); +*/ + +/* init to a given number of digits */ +/* +int mp_init_size(mp_int *a, int size); +*/ + +/* ---> Basic Manipulations <--- */ +#define mp_iszero(a) (((a)->used == 0) ? MP_YES : MP_NO) +#define mp_iseven(a) \ + (((a)->used == 0 || (((a)->dp[0] & 1) == 0)) ? MP_YES : MP_NO) +#define mp_isodd(a) \ + (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO) + +/* set to zero */ +/* +void mp_zero(mp_int *a); +*/ + +/* set to a digit */ +/* +void mp_set(mp_int *a, mp_digit b); +*/ + +/* set a 32-bit const */ +/* +int mp_set_int(mp_int *a, unsigned long b); +*/ + +/* get a 32-bit value */ +unsigned long mp_get_int(mp_int* a); + +/* initialize and set a digit */ +/* +int mp_init_set (mp_int * a, mp_digit b); +*/ + +/* initialize and set 32-bit value */ +/* +int mp_init_set_int (mp_int * a, unsigned long b); +*/ + +/* copy, b = a */ +/* +int mp_copy(const mp_int *a, mp_int *b); +*/ + +/* inits and copies, a = b */ +/* +int mp_init_copy(mp_int *a, mp_int *b); +*/ + +/* trim unused digits */ +/* +void mp_clamp(mp_int *a); +*/ + +/* ---> digit manipulation <--- */ + +/* right shift by "b" digits */ +/* +void mp_rshd(mp_int *a, int b); +*/ + +/* left shift by "b" digits */ +/* +int mp_lshd(mp_int *a, int b); +*/ + +/* c = a / 2**b */ +/* +int mp_div_2d(const mp_int *a, int b, mp_int *c, mp_int *d); +*/ + +/* b = a/2 */ +/* +int mp_div_2(mp_int *a, mp_int *b); +*/ + +/* c = a * 2**b */ +/* +int mp_mul_2d(const mp_int *a, int b, mp_int *c); +*/ + +/* b = a*2 */ +/* +int mp_mul_2(mp_int *a, mp_int *b); +*/ + +/* c = a mod 2**d */ +/* +int mp_mod_2d(const mp_int *a, int b, mp_int *c); +*/ + +/* computes a = 2**b */ +/* +int mp_2expt(mp_int *a, int b); +*/ + +/* Counts the number of lsbs which are zero before the first zero bit */ +/* +int mp_cnt_lsb(const mp_int *a); +*/ + +/* I Love Earth! */ + +/* makes a pseudo-random int of a given size */ +/* +int mp_rand(mp_int *a, int digits); +*/ + +/* ---> binary operations <--- */ +/* c = a XOR b */ +/* +int mp_xor(mp_int *a, mp_int *b, mp_int *c); +*/ + +/* c = a OR b */ +/* +int mp_or(mp_int *a, mp_int *b, mp_int *c); +*/ + +/* c = a AND b */ +/* +int mp_and(mp_int *a, mp_int *b, mp_int *c); +*/ + +/* ---> Basic arithmetic <--- */ + +/* b = -a */ +/* +int mp_neg(const mp_int *a, mp_int *b); +*/ + +/* b = |a| */ +/* +int mp_abs(mp_int *a, mp_int *b); +*/ + +/* compare a to b */ +/* +int mp_cmp(const mp_int *a, const mp_int *b); +*/ + +/* compare |a| to |b| */ +/* +int mp_cmp_mag(const mp_int *a, const mp_int *b); +*/ + +/* c = a + b */ +/* +int mp_add(mp_int *a, mp_int *b, mp_int *c); +*/ + +/* c = a - b */ +/* +int mp_sub(mp_int *a, mp_int *b, mp_int *c); +*/ + +/* c = a * b */ +/* +int mp_mul(mp_int *a, mp_int *b, mp_int *c); +*/ + +/* b = a*a */ +/* +int mp_sqr(mp_int *a, mp_int *b); +*/ + +/* a/b => cb + d == a */ +/* +int mp_div(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +*/ + +/* c = a mod b, 0 <= c < b */ +/* +int mp_mod(mp_int *a, mp_int *b, mp_int *c); +*/ + +/* ---> single digit functions <--- */ + +/* compare against a single digit */ +/* +int mp_cmp_d(const mp_int *a, mp_digit b); +*/ + +/* c = a + b */ +/* +int mp_add_d(mp_int *a, mp_digit b, mp_int *c); +*/ + +/* c = a - b */ +/* +int mp_sub_d(mp_int *a, mp_digit b, mp_int *c); +*/ + +/* c = a * b */ +/* +int mp_mul_d(mp_int *a, mp_digit b, mp_int *c); +*/ + +/* a/b => cb + d == a */ +/* +int mp_div_d(mp_int *a, mp_digit b, mp_int *c, mp_digit *d); +*/ + +/* a/3 => 3c + d == a */ +/* +int mp_div_3(mp_int *a, mp_int *c, mp_digit *d); +*/ + +/* c = a**b */ +/* +int mp_expt_d(mp_int *a, mp_digit b, mp_int *c); +*/ + +/* c = a mod b, 0 <= c < b */ +/* +int mp_mod_d(mp_int *a, mp_digit b, mp_digit *c); +*/ + +/* ---> number theory <--- */ + +/* d = a + b (mod c) */ +/* +int mp_addmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +*/ + +/* d = a - b (mod c) */ +/* +int mp_submod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +*/ + +/* d = a * b (mod c) */ +/* +int mp_mulmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +*/ + +/* c = a * a (mod b) */ +/* +int mp_sqrmod(mp_int *a, mp_int *b, mp_int *c); +*/ + +/* c = 1/a (mod b) */ +/* +int mp_invmod(mp_int *a, mp_int *b, mp_int *c); +*/ + +/* c = (a, b) */ +/* +int mp_gcd(mp_int *a, mp_int *b, mp_int *c); +*/ + +/* produces value such that U1*a + U2*b = U3 */ +/* +int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3); +*/ + +/* c = [a, b] or (a*b)/(a, b) */ +/* +int mp_lcm(mp_int *a, mp_int *b, mp_int *c); +*/ + +/* finds one of the b'th root of a, such that |c|**b <= |a| + * + * returns error if a < 0 and b is even + */ +/* +int mp_n_root(mp_int *a, mp_digit b, mp_int *c); +*/ + +/* special sqrt algo */ +/* +int mp_sqrt(mp_int *arg, mp_int *ret); +*/ + +/* is number a square? */ +/* +int mp_is_square(mp_int *arg, int *ret); +*/ + +/* computes the jacobi c = (a | n) (or Legendre if b is prime) */ +/* +int mp_jacobi(mp_int *a, mp_int *n, int *c); +*/ + +/* used to setup the Barrett reduction for a given modulus b */ +/* +int mp_reduce_setup(mp_int *a, mp_int *b); +*/ + +/* Barrett Reduction, computes a (mod b) with a precomputed value c + * + * Assumes that 0 < a <= b*b, note if 0 > a > -(b*b) then you can merely + * compute the reduction as -1 * mp_reduce(mp_abs(a)) [pseudo code]. + */ +/* +int mp_reduce(mp_int *a, mp_int *b, mp_int *c); +*/ + +/* setups the montgomery reduction */ +/* +int mp_montgomery_setup(mp_int *a, mp_digit *mp); +*/ + +/* computes a = B**n mod b without division or multiplication useful for + * normalizing numbers in a Montgomery system. + */ +/* +int mp_montgomery_calc_normalization(mp_int *a, mp_int *b); +*/ + +/* computes x/R == x (mod N) via Montgomery Reduction */ +/* +int mp_montgomery_reduce(mp_int *a, mp_int *m, mp_digit mp); +*/ + +/* returns 1 if a is a valid DR modulus */ +/* +int mp_dr_is_modulus(mp_int *a); +*/ + +/* sets the value of "d" required for mp_dr_reduce */ +/* +void mp_dr_setup(mp_int *a, mp_digit *d); +*/ + +/* reduces a modulo b using the Diminished Radix method */ +/* +int mp_dr_reduce(mp_int *a, mp_int *b, mp_digit mp); +*/ + +/* returns true if a can be reduced with mp_reduce_2k */ +/* +int mp_reduce_is_2k(mp_int *a); +*/ + +/* determines k value for 2k reduction */ +/* +int mp_reduce_2k_setup(mp_int *a, mp_digit *d); +*/ + +/* reduces a modulo b where b is of the form 2**p - k [0 <= a] */ +/* +int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d); +*/ + +/* returns true if a can be reduced with mp_reduce_2k_l */ +/* +int mp_reduce_is_2k_l(mp_int *a); +*/ + +/* determines k value for 2k reduction */ +/* +int mp_reduce_2k_setup_l(mp_int *a, mp_int *d); +*/ + +/* reduces a modulo b where b is of the form 2**p - k [0 <= a] */ +/* +int mp_reduce_2k_l(mp_int *a, mp_int *n, mp_int *d); +*/ + +/* d = a**b (mod c) */ +/* +int mp_exptmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +*/ + +/* ---> Primes <--- */ + +/* number of primes */ +#ifdef MP_8BIT +#define PRIME_SIZE 31 +#else +#define PRIME_SIZE 256 +#endif + +/* table of first PRIME_SIZE primes */ +#if defined(BUILD_tcl) || !defined(_WIN32) +MODULE_SCOPE const mp_digit ltm_prime_tab[]; +#endif + +/* result=1 if a is divisible by one of the first PRIME_SIZE primes */ +/* +int mp_prime_is_divisible(mp_int *a, int *result); +*/ + +/* performs one Fermat test of "a" using base "b". + * Sets result to 0 if composite or 1 if probable prime + */ +/* +int mp_prime_fermat(mp_int *a, mp_int *b, int *result); +*/ + +/* performs one Miller-Rabin test of "a" using base "b". + * Sets result to 0 if composite or 1 if probable prime + */ +/* +int mp_prime_miller_rabin(mp_int *a, mp_int *b, int *result); +*/ + +/* This gives [for a given bit size] the number of trials required + * such that Miller-Rabin gives a prob of failure lower than 2^-96 + */ +/* +int mp_prime_rabin_miller_trials(int size); +*/ + +/* performs t rounds of Miller-Rabin on "a" using the first + * t prime bases. Also performs an initial sieve of trial + * division. Determines if "a" is prime with probability + * of error no more than (1/4)**t. + * + * Sets result to 1 if probably prime, 0 otherwise + */ +/* +int mp_prime_is_prime(mp_int *a, int t, int *result); +*/ + +/* finds the next prime after the number "a" using "t" trials + * of Miller-Rabin. + * + * bbs_style = 1 means the prime must be congruent to 3 mod 4 + */ +/* +int mp_prime_next_prime(mp_int *a, int t, int bbs_style); +*/ + +/* makes a truly random prime of a given size (bytes), + * call with bbs = 1 if you want it to be congruent to 3 mod 4 + * + * You have to supply a callback which fills in a buffer with random bytes. + * "dat" is a parameter you can + * have passed to the callback (e.g. a state or something). This function + * doesn't use "dat" itself + * so it can be NULL + * + * The prime generated will be larger than 2^(8*size). + */ +#define mp_prime_random(a, t, size, bbs, cb, dat) \ + mp_prime_random_ex( \ + a, t, ((size)*8) + 1, (bbs == 1) ? LTM_PRIME_BBS : 0, cb, dat) + +/* makes a truly random prime of a given size (bits), + * + * Flags are as follows: + * + * LTM_PRIME_BBS - make prime congruent to 3 mod 4 + * LTM_PRIME_SAFE - make sure (p-1)/2 is prime as well (implies + * LTM_PRIME_BBS) + * LTM_PRIME_2MSB_OFF - make the 2nd highest bit zero + * LTM_PRIME_2MSB_ON - make the 2nd highest bit one + * + * You have to supply a callback which fills in a buffer with random bytes. + * "dat" is a parameter you can + * have passed to the callback (e.g. a state or something). This function + * doesn't use "dat" itself + * so it can be NULL + * + */ +/* +int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback +cb, void *dat); +*/ + +/* ---> radix conversion <--- */ +/* +int mp_count_bits(const mp_int *a); +*/ + +/* +int mp_unsigned_bin_size(mp_int *a); +*/ +/* +int mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c); +*/ +/* +int mp_to_unsigned_bin(mp_int *a, unsigned char *b); +*/ +/* +int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen); +*/ + +/* +int mp_signed_bin_size(mp_int *a); +*/ +/* +int mp_read_signed_bin(mp_int *a, const unsigned char *b, int c); +*/ +/* +int mp_to_signed_bin(mp_int *a, unsigned char *b); +*/ +/* +int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen); +*/ + +/* +int mp_read_radix(mp_int *a, const char *str, int radix); +*/ +/* +int mp_toradix(mp_int *a, char *str, int radix); +*/ +/* +int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen); +*/ +/* +int mp_radix_size(mp_int *a, int radix, int *size); +*/ + +/* +int mp_fread(mp_int *a, int radix, FILE *stream); +*/ +/* +int mp_fwrite(mp_int *a, int radix, FILE *stream); +*/ + +#define mp_read_raw(mp, str, len) mp_read_signed_bin((mp), (str), (len)) +#define mp_raw_size(mp) mp_signed_bin_size(mp) +#define mp_toraw(mp, str) mp_to_signed_bin((mp), (str)) +#define mp_read_mag(mp, str, len) mp_read_unsigned_bin((mp), (str), (len)) +#define mp_mag_size(mp) mp_unsigned_bin_size(mp) +#define mp_tomag(mp, str) mp_to_unsigned_bin((mp), (str)) + +#define mp_tobinary(M, S) mp_toradix((M), (S), 2) +#define mp_tooctal(M, S) mp_toradix((M), (S), 8) +#define mp_todecimal(M, S) mp_toradix((M), (S), 10) +#define mp_tohex(M, S) mp_toradix((M), (S), 16) + +/* lowlevel functions, do not call! */ +/* +int s_mp_add(mp_int *a, mp_int *b, mp_int *c); +*/ +/* +int s_mp_sub(mp_int *a, mp_int *b, mp_int *c); +*/ +#define s_mp_mul(a, b, c) s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1) +/* +int fast_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs); +*/ +/* +int s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs); +*/ +/* +int fast_s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs); +*/ +/* +int s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs); +*/ +/* +int fast_s_mp_sqr(mp_int *a, mp_int *b); +*/ +/* +int s_mp_sqr(mp_int *a, mp_int *b); +*/ +/* +int mp_karatsuba_mul(mp_int *a, mp_int *b, mp_int *c); +*/ +/* +int mp_toom_mul(mp_int *a, mp_int *b, mp_int *c); +*/ +/* +int mp_karatsuba_sqr(mp_int *a, mp_int *b); +*/ +/* +int mp_toom_sqr(mp_int *a, mp_int *b); +*/ +/* +int fast_mp_invmod(mp_int *a, mp_int *b, mp_int *c); +*/ +/* +int mp_invmod_slow (mp_int * a, mp_int * b, mp_int * c); +*/ +/* +int fast_mp_montgomery_reduce(mp_int *a, mp_int *m, mp_digit mp); +*/ +/* +int mp_exptmod_fast(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int mode); +*/ +/* +int s_mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int mode); +*/ +/* +void bn_reverse(unsigned char *s, int len); +*/ + +#if defined(BUILD_tcl) || !defined(_WIN32) +MODULE_SCOPE const char* mp_s_rmap; +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tclTomMathDecls.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tclTomMathDecls.h new file mode 100644 index 0000000..8ef3799 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tclTomMathDecls.h @@ -0,0 +1,468 @@ +/* + *---------------------------------------------------------------------- + * + * tclTomMathDecls.h -- + * + * This file contains the declarations for the 'libtommath' + * functions that are exported by the Tcl library. + * + * Copyright (c) 2005 by Kevin B. Kenny. All rights reserved. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TCLTOMMATHDECLS +#define _TCLTOMMATHDECLS + +#include "tcl.h" + +/* + * Define the version of the Stubs table that's exported for tommath + */ + +#define TCLTOMMATH_EPOCH 0 +#define TCLTOMMATH_REVISION 0 + +#define Tcl_TomMath_InitStubs(interp, version) \ + (TclTomMathInitializeStubs( \ + (interp), (version), TCLTOMMATH_EPOCH, TCLTOMMATH_REVISION)) + +/* Define custom memory allocation for libtommath */ + +/* MODULE_SCOPE void* TclBNAlloc( size_t ); */ +#define TclBNAlloc(s) ((void*)ckalloc((size_t)(s))) +/* MODULE_SCOPE void* TclBNRealloc( void*, size_t ); */ +#define TclBNRealloc(x, s) ((void*)ckrealloc((char*)(x), (size_t)(s))) +/* MODULE_SCOPE void TclBNFree( void* ); */ +#define TclBNFree(x) (ckfree((char*)(x))) +/* MODULE_SCOPE void* TclBNCalloc( size_t, size_t ); */ +/* unused - no macro */ + +#define XMALLOC(x) TclBNAlloc(x) +#define XFREE(x) TclBNFree(x) +#define XREALLOC(x, n) TclBNRealloc(x, n) +#define XCALLOC(n, x) TclBNCalloc(n, x) + +/* Rename the global symbols in libtommath to avoid linkage conflicts */ + +#define KARATSUBA_MUL_CUTOFF TclBNKaratsubaMulCutoff +#define KARATSUBA_SQR_CUTOFF TclBNKaratsubaSqrCutoff +#define TOOM_MUL_CUTOFF TclBNToomMulCutoff +#define TOOM_SQR_CUTOFF TclBNToomSqrCutoff + +#define bn_reverse TclBN_reverse +#define fast_s_mp_mul_digs TclBN_fast_s_mp_mul_digs +#define fast_s_mp_sqr TclBN_fast_s_mp_sqr +#define mp_add TclBN_mp_add +#define mp_add_d TclBN_mp_add_d +#define mp_and TclBN_mp_and +#define mp_clamp TclBN_mp_clamp +#define mp_clear TclBN_mp_clear +#define mp_clear_multi TclBN_mp_clear_multi +#define mp_cmp TclBN_mp_cmp +#define mp_cmp_d TclBN_mp_cmp_d +#define mp_cmp_mag TclBN_mp_cmp_mag +#define mp_cnt_lsb TclBN_mp_cnt_lsb +#define mp_copy TclBN_mp_copy +#define mp_count_bits TclBN_mp_count_bits +#define mp_div TclBN_mp_div +#define mp_div_2 TclBN_mp_div_2 +#define mp_div_2d TclBN_mp_div_2d +#define mp_div_3 TclBN_mp_div_3 +#define mp_div_d TclBN_mp_div_d +#define mp_exch TclBN_mp_exch +#define mp_expt_d TclBN_mp_expt_d +#define mp_grow TclBN_mp_grow +#define mp_init TclBN_mp_init +#define mp_init_copy TclBN_mp_init_copy +#define mp_init_multi TclBN_mp_init_multi +#define mp_init_set TclBN_mp_init_set +#define mp_init_set_int TclBN_mp_init_set_int +#define mp_init_size TclBN_mp_init_size +#define mp_karatsuba_mul TclBN_mp_karatsuba_mul +#define mp_karatsuba_sqr TclBN_mp_karatsuba_sqr +#define mp_lshd TclBN_mp_lshd +#define mp_mod TclBN_mp_mod +#define mp_mod_2d TclBN_mp_mod_2d +#define mp_mul TclBN_mp_mul +#define mp_mul_2 TclBN_mp_mul_2 +#define mp_mul_2d TclBN_mp_mul_2d +#define mp_mul_d TclBN_mp_mul_d +#define mp_neg TclBN_mp_neg +#define mp_or TclBN_mp_or +#define mp_radix_size TclBN_mp_radix_size +#define mp_read_radix TclBN_mp_read_radix +#define mp_rshd TclBN_mp_rshd +#define mp_s_rmap TclBNMpSRmap +#define mp_set TclBN_mp_set +#define mp_set_int TclBN_mp_set_int +#define mp_shrink TclBN_mp_shrink +#define mp_sqr TclBN_mp_sqr +#define mp_sqrt TclBN_mp_sqrt +#define mp_sub TclBN_mp_sub +#define mp_sub_d TclBN_mp_sub_d +#define mp_to_unsigned_bin TclBN_mp_to_unsigned_bin +#define mp_to_unsigned_bin_n TclBN_mp_to_unsigned_bin_n +#define mp_toom_mul TclBN_mp_toom_mul +#define mp_toom_sqr TclBN_mp_toom_sqr +#define mp_toradix_n TclBN_mp_toradix_n +#define mp_unsigned_bin_size TclBN_mp_unsigned_bin_size +#define mp_xor TclBN_mp_xor +#define mp_zero TclBN_mp_zero +#define s_mp_add TclBN_s_mp_add +#define s_mp_mul_digs TclBN_s_mp_mul_digs +#define s_mp_sqr TclBN_s_mp_sqr +#define s_mp_sub TclBN_s_mp_sub + +#undef TCL_STORAGE_CLASS +#ifdef BUILD_tcl +#define TCL_STORAGE_CLASS DLLEXPORT +#else +#ifdef USE_TCL_STUBS +#define TCL_STORAGE_CLASS +#else +#define TCL_STORAGE_CLASS DLLIMPORT +#endif +#endif + +/* + * WARNING: This file is automatically generated by the tools/genStubs.tcl + * script. Any modifications to the function declarations below should be made + * in the generic/tclInt.decls script. + */ + +/* !BEGIN!: Do not edit below this line. */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Exported function declarations: + */ + +/* 0 */ +EXTERN int TclBN_epoch(void); +/* 1 */ +EXTERN int TclBN_revision(void); +/* 2 */ +EXTERN int TclBN_mp_add(mp_int* a, mp_int* b, mp_int* c); +/* 3 */ +EXTERN int TclBN_mp_add_d(mp_int* a, mp_digit b, mp_int* c); +/* 4 */ +EXTERN int TclBN_mp_and(mp_int* a, mp_int* b, mp_int* c); +/* 5 */ +EXTERN void TclBN_mp_clamp(mp_int* a); +/* 6 */ +EXTERN void TclBN_mp_clear(mp_int* a); +/* 7 */ +EXTERN void TclBN_mp_clear_multi(mp_int* a, ...); +/* 8 */ +EXTERN int TclBN_mp_cmp(const mp_int* a, const mp_int* b); +/* 9 */ +EXTERN int TclBN_mp_cmp_d(const mp_int* a, mp_digit b); +/* 10 */ +EXTERN int TclBN_mp_cmp_mag(const mp_int* a, const mp_int* b); +/* 11 */ +EXTERN int TclBN_mp_copy(const mp_int* a, mp_int* b); +/* 12 */ +EXTERN int TclBN_mp_count_bits(const mp_int* a); +/* 13 */ +EXTERN int TclBN_mp_div(mp_int* a, mp_int* b, mp_int* q, mp_int* r); +/* 14 */ +EXTERN int TclBN_mp_div_d(mp_int* a, mp_digit b, mp_int* q, mp_digit* r); +/* 15 */ +EXTERN int TclBN_mp_div_2(mp_int* a, mp_int* q); +/* 16 */ +EXTERN int TclBN_mp_div_2d(const mp_int* a, int b, mp_int* q, mp_int* r); +/* 17 */ +EXTERN int TclBN_mp_div_3(mp_int* a, mp_int* q, mp_digit* r); +/* 18 */ +EXTERN void TclBN_mp_exch(mp_int* a, mp_int* b); +/* 19 */ +EXTERN int TclBN_mp_expt_d(mp_int* a, mp_digit b, mp_int* c); +/* 20 */ +EXTERN int TclBN_mp_grow(mp_int* a, int size); +/* 21 */ +EXTERN int TclBN_mp_init(mp_int* a); +/* 22 */ +EXTERN int TclBN_mp_init_copy(mp_int* a, mp_int* b); +/* 23 */ +EXTERN int TclBN_mp_init_multi(mp_int* a, ...); +/* 24 */ +EXTERN int TclBN_mp_init_set(mp_int* a, mp_digit b); +/* 25 */ +EXTERN int TclBN_mp_init_size(mp_int* a, int size); +/* 26 */ +EXTERN int TclBN_mp_lshd(mp_int* a, int shift); +/* 27 */ +EXTERN int TclBN_mp_mod(mp_int* a, mp_int* b, mp_int* r); +/* 28 */ +EXTERN int TclBN_mp_mod_2d(const mp_int* a, int b, mp_int* r); +/* 29 */ +EXTERN int TclBN_mp_mul(mp_int* a, mp_int* b, mp_int* p); +/* 30 */ +EXTERN int TclBN_mp_mul_d(mp_int* a, mp_digit b, mp_int* p); +/* 31 */ +EXTERN int TclBN_mp_mul_2(mp_int* a, mp_int* p); +/* 32 */ +EXTERN int TclBN_mp_mul_2d(const mp_int* a, int d, mp_int* p); +/* 33 */ +EXTERN int TclBN_mp_neg(const mp_int* a, mp_int* b); +/* 34 */ +EXTERN int TclBN_mp_or(mp_int* a, mp_int* b, mp_int* c); +/* 35 */ +EXTERN int TclBN_mp_radix_size(mp_int* a, int radix, int* size); +/* 36 */ +EXTERN int TclBN_mp_read_radix(mp_int* a, const char* str, int radix); +/* 37 */ +EXTERN void TclBN_mp_rshd(mp_int* a, int shift); +/* 38 */ +EXTERN int TclBN_mp_shrink(mp_int* a); +/* 39 */ +EXTERN void TclBN_mp_set(mp_int* a, mp_digit b); +/* 40 */ +EXTERN int TclBN_mp_sqr(mp_int* a, mp_int* b); +/* 41 */ +EXTERN int TclBN_mp_sqrt(mp_int* a, mp_int* b); +/* 42 */ +EXTERN int TclBN_mp_sub(mp_int* a, mp_int* b, mp_int* c); +/* 43 */ +EXTERN int TclBN_mp_sub_d(mp_int* a, mp_digit b, mp_int* c); +/* 44 */ +EXTERN int TclBN_mp_to_unsigned_bin(mp_int* a, unsigned char* b); +/* 45 */ +EXTERN int +TclBN_mp_to_unsigned_bin_n(mp_int* a, unsigned char* b, unsigned long* outlen); +/* 46 */ +EXTERN int TclBN_mp_toradix_n(mp_int* a, char* str, int radix, int maxlen); +/* 47 */ +EXTERN int TclBN_mp_unsigned_bin_size(mp_int* a); +/* 48 */ +EXTERN int TclBN_mp_xor(mp_int* a, mp_int* b, mp_int* c); +/* 49 */ +EXTERN void TclBN_mp_zero(mp_int* a); +/* 50 */ +EXTERN void TclBN_reverse(unsigned char* s, int len); +/* 51 */ +EXTERN int TclBN_fast_s_mp_mul_digs(mp_int* a, mp_int* b, mp_int* c, int digs); +/* 52 */ +EXTERN int TclBN_fast_s_mp_sqr(mp_int* a, mp_int* b); +/* 53 */ +EXTERN int TclBN_mp_karatsuba_mul(mp_int* a, mp_int* b, mp_int* c); +/* 54 */ +EXTERN int TclBN_mp_karatsuba_sqr(mp_int* a, mp_int* b); +/* 55 */ +EXTERN int TclBN_mp_toom_mul(mp_int* a, mp_int* b, mp_int* c); +/* 56 */ +EXTERN int TclBN_mp_toom_sqr(mp_int* a, mp_int* b); +/* 57 */ +EXTERN int TclBN_s_mp_add(mp_int* a, mp_int* b, mp_int* c); +/* 58 */ +EXTERN int TclBN_s_mp_mul_digs(mp_int* a, mp_int* b, mp_int* c, int digs); +/* 59 */ +EXTERN int TclBN_s_mp_sqr(mp_int* a, mp_int* b); +/* 60 */ +EXTERN int TclBN_s_mp_sub(mp_int* a, mp_int* b, mp_int* c); +/* 61 */ +EXTERN int TclBN_mp_init_set_int(mp_int* a, unsigned long i); +/* 62 */ +EXTERN int TclBN_mp_set_int(mp_int* a, unsigned long i); +/* 63 */ +EXTERN int TclBN_mp_cnt_lsb(const mp_int* a); +/* 64 */ +EXTERN void TclBNInitBignumFromLong(mp_int* bignum, long initVal); +/* 65 */ +EXTERN void TclBNInitBignumFromWideInt(mp_int* bignum, Tcl_WideInt initVal); +/* 66 */ +EXTERN void TclBNInitBignumFromWideUInt(mp_int* bignum, Tcl_WideUInt initVal); + +typedef struct TclTomMathStubs { + int magic; + void* hooks; + + int (*tclBN_epoch)(void); /* 0 */ + int (*tclBN_revision)(void); /* 1 */ + int (*tclBN_mp_add)(mp_int* a, mp_int* b, mp_int* c); /* 2 */ + int (*tclBN_mp_add_d)(mp_int* a, mp_digit b, mp_int* c); /* 3 */ + int (*tclBN_mp_and)(mp_int* a, mp_int* b, mp_int* c); /* 4 */ + void (*tclBN_mp_clamp)(mp_int* a); /* 5 */ + void (*tclBN_mp_clear)(mp_int* a); /* 6 */ + void (*tclBN_mp_clear_multi)(mp_int* a, ...); /* 7 */ + int (*tclBN_mp_cmp)(const mp_int* a, const mp_int* b); /* 8 */ + int (*tclBN_mp_cmp_d)(const mp_int* a, mp_digit b); /* 9 */ + int (*tclBN_mp_cmp_mag)(const mp_int* a, const mp_int* b); /* 10 */ + int (*tclBN_mp_copy)(const mp_int* a, mp_int* b); /* 11 */ + int (*tclBN_mp_count_bits)(const mp_int* a); /* 12 */ + int (*tclBN_mp_div)(mp_int* a, mp_int* b, mp_int* q, mp_int* r); /* 13 */ + int (*tclBN_mp_div_d)(mp_int* a, mp_digit b, mp_int* q, mp_digit* r); /* 14 */ + int (*tclBN_mp_div_2)(mp_int* a, mp_int* q); /* 15 */ + int (*tclBN_mp_div_2d)(const mp_int* a, int b, mp_int* q, mp_int* r); /* 16 */ + int (*tclBN_mp_div_3)(mp_int* a, mp_int* q, mp_digit* r); /* 17 */ + void (*tclBN_mp_exch)(mp_int* a, mp_int* b); /* 18 */ + int (*tclBN_mp_expt_d)(mp_int* a, mp_digit b, mp_int* c); /* 19 */ + int (*tclBN_mp_grow)(mp_int* a, int size); /* 20 */ + int (*tclBN_mp_init)(mp_int* a); /* 21 */ + int (*tclBN_mp_init_copy)(mp_int* a, mp_int* b); /* 22 */ + int (*tclBN_mp_init_multi)(mp_int* a, ...); /* 23 */ + int (*tclBN_mp_init_set)(mp_int* a, mp_digit b); /* 24 */ + int (*tclBN_mp_init_size)(mp_int* a, int size); /* 25 */ + int (*tclBN_mp_lshd)(mp_int* a, int shift); /* 26 */ + int (*tclBN_mp_mod)(mp_int* a, mp_int* b, mp_int* r); /* 27 */ + int (*tclBN_mp_mod_2d)(const mp_int* a, int b, mp_int* r); /* 28 */ + int (*tclBN_mp_mul)(mp_int* a, mp_int* b, mp_int* p); /* 29 */ + int (*tclBN_mp_mul_d)(mp_int* a, mp_digit b, mp_int* p); /* 30 */ + int (*tclBN_mp_mul_2)(mp_int* a, mp_int* p); /* 31 */ + int (*tclBN_mp_mul_2d)(const mp_int* a, int d, mp_int* p); /* 32 */ + int (*tclBN_mp_neg)(const mp_int* a, mp_int* b); /* 33 */ + int (*tclBN_mp_or)(mp_int* a, mp_int* b, mp_int* c); /* 34 */ + int (*tclBN_mp_radix_size)(mp_int* a, int radix, int* size); /* 35 */ + int (*tclBN_mp_read_radix)(mp_int* a, const char* str, int radix); /* 36 */ + void (*tclBN_mp_rshd)(mp_int* a, int shift); /* 37 */ + int (*tclBN_mp_shrink)(mp_int* a); /* 38 */ + void (*tclBN_mp_set)(mp_int* a, mp_digit b); /* 39 */ + int (*tclBN_mp_sqr)(mp_int* a, mp_int* b); /* 40 */ + int (*tclBN_mp_sqrt)(mp_int* a, mp_int* b); /* 41 */ + int (*tclBN_mp_sub)(mp_int* a, mp_int* b, mp_int* c); /* 42 */ + int (*tclBN_mp_sub_d)(mp_int* a, mp_digit b, mp_int* c); /* 43 */ + int (*tclBN_mp_to_unsigned_bin)(mp_int* a, unsigned char* b); /* 44 */ + int (*tclBN_mp_to_unsigned_bin_n)( + mp_int* a, + unsigned char* b, + unsigned long* outlen); /* 45 */ + int (*tclBN_mp_toradix_n)( + mp_int* a, + char* str, + int radix, + int maxlen); /* 46 */ + int (*tclBN_mp_unsigned_bin_size)(mp_int* a); /* 47 */ + int (*tclBN_mp_xor)(mp_int* a, mp_int* b, mp_int* c); /* 48 */ + void (*tclBN_mp_zero)(mp_int* a); /* 49 */ + void (*tclBN_reverse)(unsigned char* s, int len); /* 50 */ + int (*tclBN_fast_s_mp_mul_digs)( + mp_int* a, + mp_int* b, + mp_int* c, + int digs); /* 51 */ + int (*tclBN_fast_s_mp_sqr)(mp_int* a, mp_int* b); /* 52 */ + int (*tclBN_mp_karatsuba_mul)(mp_int* a, mp_int* b, mp_int* c); /* 53 */ + int (*tclBN_mp_karatsuba_sqr)(mp_int* a, mp_int* b); /* 54 */ + int (*tclBN_mp_toom_mul)(mp_int* a, mp_int* b, mp_int* c); /* 55 */ + int (*tclBN_mp_toom_sqr)(mp_int* a, mp_int* b); /* 56 */ + int (*tclBN_s_mp_add)(mp_int* a, mp_int* b, mp_int* c); /* 57 */ + int ( + *tclBN_s_mp_mul_digs)(mp_int* a, mp_int* b, mp_int* c, int digs); /* 58 */ + int (*tclBN_s_mp_sqr)(mp_int* a, mp_int* b); /* 59 */ + int (*tclBN_s_mp_sub)(mp_int* a, mp_int* b, mp_int* c); /* 60 */ + int (*tclBN_mp_init_set_int)(mp_int* a, unsigned long i); /* 61 */ + int (*tclBN_mp_set_int)(mp_int* a, unsigned long i); /* 62 */ + int (*tclBN_mp_cnt_lsb)(const mp_int* a); /* 63 */ + void (*tclBNInitBignumFromLong)(mp_int* bignum, long initVal); /* 64 */ + void (*tclBNInitBignumFromWideInt)( + mp_int* bignum, + Tcl_WideInt initVal); /* 65 */ + void (*tclBNInitBignumFromWideUInt)( + mp_int* bignum, + Tcl_WideUInt initVal); /* 66 */ +} TclTomMathStubs; + +extern const TclTomMathStubs* tclTomMathStubsPtr; + +#ifdef __cplusplus +} +#endif + +#if defined(USE_TCL_STUBS) + +/* + * Inline function declarations: + */ + +#define TclBN_epoch (tclTomMathStubsPtr->tclBN_epoch) /* 0 */ +#define TclBN_revision (tclTomMathStubsPtr->tclBN_revision) /* 1 */ +#define TclBN_mp_add (tclTomMathStubsPtr->tclBN_mp_add) /* 2 */ +#define TclBN_mp_add_d (tclTomMathStubsPtr->tclBN_mp_add_d) /* 3 */ +#define TclBN_mp_and (tclTomMathStubsPtr->tclBN_mp_and) /* 4 */ +#define TclBN_mp_clamp (tclTomMathStubsPtr->tclBN_mp_clamp) /* 5 */ +#define TclBN_mp_clear (tclTomMathStubsPtr->tclBN_mp_clear) /* 6 */ +#define TclBN_mp_clear_multi (tclTomMathStubsPtr->tclBN_mp_clear_multi) /* 7 \ + */ +#define TclBN_mp_cmp (tclTomMathStubsPtr->tclBN_mp_cmp) /* 8 */ +#define TclBN_mp_cmp_d (tclTomMathStubsPtr->tclBN_mp_cmp_d) /* 9 */ +#define TclBN_mp_cmp_mag (tclTomMathStubsPtr->tclBN_mp_cmp_mag) /* 10 */ +#define TclBN_mp_copy (tclTomMathStubsPtr->tclBN_mp_copy) /* 11 */ +#define TclBN_mp_count_bits (tclTomMathStubsPtr->tclBN_mp_count_bits) /* 12 */ +#define TclBN_mp_div (tclTomMathStubsPtr->tclBN_mp_div) /* 13 */ +#define TclBN_mp_div_d (tclTomMathStubsPtr->tclBN_mp_div_d) /* 14 */ +#define TclBN_mp_div_2 (tclTomMathStubsPtr->tclBN_mp_div_2) /* 15 */ +#define TclBN_mp_div_2d (tclTomMathStubsPtr->tclBN_mp_div_2d) /* 16 */ +#define TclBN_mp_div_3 (tclTomMathStubsPtr->tclBN_mp_div_3) /* 17 */ +#define TclBN_mp_exch (tclTomMathStubsPtr->tclBN_mp_exch) /* 18 */ +#define TclBN_mp_expt_d (tclTomMathStubsPtr->tclBN_mp_expt_d) /* 19 */ +#define TclBN_mp_grow (tclTomMathStubsPtr->tclBN_mp_grow) /* 20 */ +#define TclBN_mp_init (tclTomMathStubsPtr->tclBN_mp_init) /* 21 */ +#define TclBN_mp_init_copy (tclTomMathStubsPtr->tclBN_mp_init_copy) /* 22 */ +#define TclBN_mp_init_multi (tclTomMathStubsPtr->tclBN_mp_init_multi) /* 23 */ +#define TclBN_mp_init_set (tclTomMathStubsPtr->tclBN_mp_init_set) /* 24 */ +#define TclBN_mp_init_size (tclTomMathStubsPtr->tclBN_mp_init_size) /* 25 */ +#define TclBN_mp_lshd (tclTomMathStubsPtr->tclBN_mp_lshd) /* 26 */ +#define TclBN_mp_mod (tclTomMathStubsPtr->tclBN_mp_mod) /* 27 */ +#define TclBN_mp_mod_2d (tclTomMathStubsPtr->tclBN_mp_mod_2d) /* 28 */ +#define TclBN_mp_mul (tclTomMathStubsPtr->tclBN_mp_mul) /* 29 */ +#define TclBN_mp_mul_d (tclTomMathStubsPtr->tclBN_mp_mul_d) /* 30 */ +#define TclBN_mp_mul_2 (tclTomMathStubsPtr->tclBN_mp_mul_2) /* 31 */ +#define TclBN_mp_mul_2d (tclTomMathStubsPtr->tclBN_mp_mul_2d) /* 32 */ +#define TclBN_mp_neg (tclTomMathStubsPtr->tclBN_mp_neg) /* 33 */ +#define TclBN_mp_or (tclTomMathStubsPtr->tclBN_mp_or) /* 34 */ +#define TclBN_mp_radix_size (tclTomMathStubsPtr->tclBN_mp_radix_size) /* 35 */ +#define TclBN_mp_read_radix (tclTomMathStubsPtr->tclBN_mp_read_radix) /* 36 */ +#define TclBN_mp_rshd (tclTomMathStubsPtr->tclBN_mp_rshd) /* 37 */ +#define TclBN_mp_shrink (tclTomMathStubsPtr->tclBN_mp_shrink) /* 38 */ +#define TclBN_mp_set (tclTomMathStubsPtr->tclBN_mp_set) /* 39 */ +#define TclBN_mp_sqr (tclTomMathStubsPtr->tclBN_mp_sqr) /* 40 */ +#define TclBN_mp_sqrt (tclTomMathStubsPtr->tclBN_mp_sqrt) /* 41 */ +#define TclBN_mp_sub (tclTomMathStubsPtr->tclBN_mp_sub) /* 42 */ +#define TclBN_mp_sub_d (tclTomMathStubsPtr->tclBN_mp_sub_d) /* 43 */ +#define TclBN_mp_to_unsigned_bin \ + (tclTomMathStubsPtr->tclBN_mp_to_unsigned_bin) /* 44 */ +#define TclBN_mp_to_unsigned_bin_n \ + (tclTomMathStubsPtr->tclBN_mp_to_unsigned_bin_n) /* 45 */ +#define TclBN_mp_toradix_n (tclTomMathStubsPtr->tclBN_mp_toradix_n) /* 46 */ +#define TclBN_mp_unsigned_bin_size \ + (tclTomMathStubsPtr->tclBN_mp_unsigned_bin_size) /* 47 */ +#define TclBN_mp_xor (tclTomMathStubsPtr->tclBN_mp_xor) /* 48 */ +#define TclBN_mp_zero (tclTomMathStubsPtr->tclBN_mp_zero) /* 49 */ +#define TclBN_reverse (tclTomMathStubsPtr->tclBN_reverse) /* 50 */ +#define TclBN_fast_s_mp_mul_digs \ + (tclTomMathStubsPtr->tclBN_fast_s_mp_mul_digs) /* 51 */ +#define TclBN_fast_s_mp_sqr (tclTomMathStubsPtr->tclBN_fast_s_mp_sqr) /* 52 */ +#define TclBN_mp_karatsuba_mul \ + (tclTomMathStubsPtr->tclBN_mp_karatsuba_mul) /* 53 */ +#define TclBN_mp_karatsuba_sqr \ + (tclTomMathStubsPtr->tclBN_mp_karatsuba_sqr) /* 54 */ +#define TclBN_mp_toom_mul (tclTomMathStubsPtr->tclBN_mp_toom_mul) /* 55 */ +#define TclBN_mp_toom_sqr (tclTomMathStubsPtr->tclBN_mp_toom_sqr) /* 56 */ +#define TclBN_s_mp_add (tclTomMathStubsPtr->tclBN_s_mp_add) /* 57 */ +#define TclBN_s_mp_mul_digs (tclTomMathStubsPtr->tclBN_s_mp_mul_digs) /* 58 */ +#define TclBN_s_mp_sqr (tclTomMathStubsPtr->tclBN_s_mp_sqr) /* 59 */ +#define TclBN_s_mp_sub (tclTomMathStubsPtr->tclBN_s_mp_sub) /* 60 */ +#define TclBN_mp_init_set_int \ + (tclTomMathStubsPtr->tclBN_mp_init_set_int) /* 61 */ +#define TclBN_mp_set_int (tclTomMathStubsPtr->tclBN_mp_set_int) /* 62 */ +#define TclBN_mp_cnt_lsb (tclTomMathStubsPtr->tclBN_mp_cnt_lsb) /* 63 */ +#define TclBNInitBignumFromLong \ + (tclTomMathStubsPtr->tclBNInitBignumFromLong) /* 64 */ +#define TclBNInitBignumFromWideInt \ + (tclTomMathStubsPtr->tclBNInitBignumFromWideInt) /* 65 */ +#define TclBNInitBignumFromWideUInt \ + (tclTomMathStubsPtr->tclBNInitBignumFromWideUInt) /* 66 */ + +#endif /* defined(USE_TCL_STUBS) */ + +/* !END!: Do not edit above this line. */ + +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLIMPORT + +#endif /* _TCLINTDECLS */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tdbc.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tdbc.h new file mode 100644 index 0000000..d22db80 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tdbc.h @@ -0,0 +1,84 @@ +/* + * tdbc.h -- + * + * Declarations of the public API for Tcl DataBase Connectivity (TDBC) + * + * Copyright (c) 2006 by Kevin B. Kenny + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + * RCS: @(#) $Id$ + * + *----------------------------------------------------------------------------- + */ + +#ifndef TDBC_H_INCLUDED +#define TDBC_H_INCLUDED 1 + +#include + +#ifndef TDBCAPI +#if defined(BUILD_tdbc) +#define TDBCAPI MODULE_SCOPE +#else +#define TDBCAPI extern +#undef USE_TDBC_STUBS +#define USE_TDBC_STUBS 1 +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(BUILD_tdbc) +DLLEXPORT int Tdbc_Init(Tcl_Interp* interp); +#elif defined(STATIC_BUILD) +extern int Tdbc_Init(Tcl_Interp* interp); +#else +DLLIMPORT int Tdbc_Init(Tcl_Interp* interp); +#endif + +#define Tdbc_InitStubs(interp) \ + TdbcInitializeStubs( \ + interp, TDBC_VERSION, TDBC_STUBS_EPOCH, TDBC_STUBS_REVISION) +#if defined(USE_TDBC_STUBS) +TDBCAPI const char* TdbcInitializeStubs( + Tcl_Interp* interp, + const char* version, + int epoch, + int revision); +#else +#define TdbcInitializeStubs(interp, version, epoch, revision) \ + (Tcl_PkgRequire(interp, "tdbc", version)) +#endif + +#ifdef __cplusplus +} +#endif + +/* + * TDBC_VERSION and TDBC_PATCHLEVEL here must match the ones that + * appear near the top of configure.ac. + */ + +#define TDBC_VERSION "1.0.5" +#define TDBC_PATCHLEVEL "1.0.5" + +/* + * Include the Stubs declarations for the public API, generated from + * tdbc.decls. + */ + +#include "tdbcDecls.h" + +#endif + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tdbcDecls.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tdbcDecls.h new file mode 100644 index 0000000..c9c321b --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tdbcDecls.h @@ -0,0 +1,67 @@ +/* + * tdbcDecls.h -- + * + * Exported Stubs declarations for Tcl DataBaseConnectivity (TDBC). + * + * This file is (mostly) generated automatically from tdbc.decls + * + * Copyright (c) 2008 by Kevin B. Kenny. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + * RCS: @(#) $Id$ + * + */ + +/* !BEGIN!: Do not edit below this line. */ + +#define TDBC_STUBS_EPOCH 0 +#define TDBC_STUBS_REVISION 3 + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Exported function declarations: + */ + +/* 0 */ +TDBCAPI int Tdbc_Init_(Tcl_Interp* interp); +/* 1 */ +TDBCAPI Tcl_Obj* Tdbc_TokenizeSql(Tcl_Interp* interp, const char* statement); +/* 2 */ +TDBCAPI const char* Tdbc_MapSqlState(const char* sqlstate); + +typedef struct TdbcStubs { + int magic; + int epoch; + int revision; + void* hooks; + + int (*tdbc_Init_)(Tcl_Interp* interp); /* 0 */ + Tcl_Obj* ( + *tdbc_TokenizeSql)(Tcl_Interp* interp, const char* statement); /* 1 */ + const char* (*tdbc_MapSqlState)(const char* sqlstate); /* 2 */ +} TdbcStubs; + +extern const TdbcStubs* tdbcStubsPtr; + +#ifdef __cplusplus +} +#endif + +#if defined(USE_TDBC_STUBS) + +/* + * Inline function declarations: + */ + +#define Tdbc_Init_ (tdbcStubsPtr->tdbc_Init_) /* 0 */ +#define Tdbc_TokenizeSql (tdbcStubsPtr->tdbc_TokenizeSql) /* 1 */ +#define Tdbc_MapSqlState (tdbcStubsPtr->tdbc_MapSqlState) /* 2 */ + +#endif /* defined(USE_TDBC_STUBS) */ + +/* !END!: Do not edit above this line. */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tdbcInt.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tdbcInt.h new file mode 100644 index 0000000..0366409 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tdbcInt.h @@ -0,0 +1,43 @@ +/* + * tdbcInt.h -- + * + * Declarations of the public API for Tcl DataBase Connectivity (TDBC) + * + * Copyright (c) 2006 by Kevin B. Kenny + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + * RCS: @(#) $Id$ + * + *----------------------------------------------------------------------------- + */ +#ifndef TDBCINT_H_INCLUDED +#define TDBCINT_H_INCLUDED 1 + +#include "tdbc.h" + +/* + * Used to tag functions that are only to be visible within the module being + * built and not outside it (where this is supported by the linker). + */ + +#ifndef MODULE_SCOPE +#ifdef __cplusplus +#define MODULE_SCOPE extern "C" +#else +#define MODULE_SCOPE extern +#endif +#endif + +/* + * Linkage to procedures not exported from this module + */ + +MODULE_SCOPE int TdbcTokenizeObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); + +#endif diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/term.h b/src_cpp/elfgames/tasks/elf2codingenv/include/term.h new file mode 100644 index 0000000..79b83db --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/term.h @@ -0,0 +1,886 @@ +/**************************************************************************** + * Copyright (c) 1998-2013,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/****************************************************************************/ +/* Author: Zeyd M. Ben-Halim 1992,1995 */ +/* and: Eric S. Raymond */ +/* and: Thomas E. Dickey 1995-on */ +/****************************************************************************/ + +/* $Id: MKterm.h.awk.in,v 1.67 2017/04/06 00:19:26 tom Exp $ */ + +/* +** term.h -- Definition of struct term +*/ + +#ifndef NCURSES_TERM_H_incl +#define NCURSES_TERM_H_incl 1 + +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.1" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H + * definition (based on the system for which this was configured). + */ + +#undef NCURSES_CONST +#define NCURSES_CONST const + +#undef NCURSES_SBOOL +#define NCURSES_SBOOL char + +#undef NCURSES_USE_DATABASE +#define NCURSES_USE_DATABASE 1 + +#undef NCURSES_USE_TERMCAP +#define NCURSES_USE_TERMCAP 1 + +#undef NCURSES_XNAMES +#define NCURSES_XNAMES 1 + +/* We will use these symbols to hide differences between + * termios/termio/sgttyb interfaces. + */ +#undef TTY +#undef SET_TTY +#undef GET_TTY + +/* Assume POSIX termio if we have the header and function */ +/* #if HAVE_TERMIOS_H && HAVE_TCGETATTR */ +#if 1 && 1 + +#undef TERMIOS +#define TERMIOS 1 + +#include +#define TTY struct termios + +#else /* !HAVE_TERMIOS_H */ + +/* #if HAVE_TERMIO_H */ +#if 1 + +#undef TERMIOS +#define TERMIOS 1 + +#include +#define TTY struct termio + +#else /* !HAVE_TERMIO_H */ + +#if __MINGW32__ +#include +#define TTY struct termios +#else +#undef TERMIOS +#include +#include +#define TTY struct sgttyb +#endif /* MINGW32 */ +#endif /* HAVE_TERMIO_H */ + +#endif /* HAVE_TERMIOS_H */ + +#ifdef TERMIOS +#define GET_TTY(fd, buf) tcgetattr(fd, buf) +#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf) +#else +#define GET_TTY(fd, buf) gtty(fd, buf) +#define SET_TTY(fd, buf) stty(fd, buf) +#endif + +#define NAMESIZE 256 + +/* The cast works because TERMTYPE is the first data in TERMINAL */ +#define CUR ((TERMTYPE*)(cur_term))-> + +#define auto_left_margin CUR Booleans[0] +#define auto_right_margin CUR Booleans[1] +#define no_esc_ctlc CUR Booleans[2] +#define ceol_standout_glitch CUR Booleans[3] +#define eat_newline_glitch CUR Booleans[4] +#define erase_overstrike CUR Booleans[5] +#define generic_type CUR Booleans[6] +#define hard_copy CUR Booleans[7] +#define has_meta_key CUR Booleans[8] +#define has_status_line CUR Booleans[9] +#define insert_null_glitch CUR Booleans[10] +#define memory_above CUR Booleans[11] +#define memory_below CUR Booleans[12] +#define move_insert_mode CUR Booleans[13] +#define move_standout_mode CUR Booleans[14] +#define over_strike CUR Booleans[15] +#define status_line_esc_ok CUR Booleans[16] +#define dest_tabs_magic_smso CUR Booleans[17] +#define tilde_glitch CUR Booleans[18] +#define transparent_underline CUR Booleans[19] +#define xon_xoff CUR Booleans[20] +#define needs_xon_xoff CUR Booleans[21] +#define prtr_silent CUR Booleans[22] +#define hard_cursor CUR Booleans[23] +#define non_rev_rmcup CUR Booleans[24] +#define no_pad_char CUR Booleans[25] +#define non_dest_scroll_region CUR Booleans[26] +#define can_change CUR Booleans[27] +#define back_color_erase CUR Booleans[28] +#define hue_lightness_saturation CUR Booleans[29] +#define col_addr_glitch CUR Booleans[30] +#define cr_cancels_micro_mode CUR Booleans[31] +#define has_print_wheel CUR Booleans[32] +#define row_addr_glitch CUR Booleans[33] +#define semi_auto_right_margin CUR Booleans[34] +#define cpi_changes_res CUR Booleans[35] +#define lpi_changes_res CUR Booleans[36] +#define columns CUR Numbers[0] +#define init_tabs CUR Numbers[1] +#define lines CUR Numbers[2] +#define lines_of_memory CUR Numbers[3] +#define magic_cookie_glitch CUR Numbers[4] +#define padding_baud_rate CUR Numbers[5] +#define virtual_terminal CUR Numbers[6] +#define width_status_line CUR Numbers[7] +#define num_labels CUR Numbers[8] +#define label_height CUR Numbers[9] +#define label_width CUR Numbers[10] +#define max_attributes CUR Numbers[11] +#define maximum_windows CUR Numbers[12] +#define max_colors CUR Numbers[13] +#define max_pairs CUR Numbers[14] +#define no_color_video CUR Numbers[15] +#define buffer_capacity CUR Numbers[16] +#define dot_vert_spacing CUR Numbers[17] +#define dot_horz_spacing CUR Numbers[18] +#define max_micro_address CUR Numbers[19] +#define max_micro_jump CUR Numbers[20] +#define micro_col_size CUR Numbers[21] +#define micro_line_size CUR Numbers[22] +#define number_of_pins CUR Numbers[23] +#define output_res_char CUR Numbers[24] +#define output_res_line CUR Numbers[25] +#define output_res_horz_inch CUR Numbers[26] +#define output_res_vert_inch CUR Numbers[27] +#define print_rate CUR Numbers[28] +#define wide_char_size CUR Numbers[29] +#define buttons CUR Numbers[30] +#define bit_image_entwining CUR Numbers[31] +#define bit_image_type CUR Numbers[32] +#define back_tab CUR Strings[0] +#define bell CUR Strings[1] +#define carriage_return CUR Strings[2] +#define change_scroll_region CUR Strings[3] +#define clear_all_tabs CUR Strings[4] +#define clear_screen CUR Strings[5] +#define clr_eol CUR Strings[6] +#define clr_eos CUR Strings[7] +#define column_address CUR Strings[8] +#define command_character CUR Strings[9] +#define cursor_address CUR Strings[10] +#define cursor_down CUR Strings[11] +#define cursor_home CUR Strings[12] +#define cursor_invisible CUR Strings[13] +#define cursor_left CUR Strings[14] +#define cursor_mem_address CUR Strings[15] +#define cursor_normal CUR Strings[16] +#define cursor_right CUR Strings[17] +#define cursor_to_ll CUR Strings[18] +#define cursor_up CUR Strings[19] +#define cursor_visible CUR Strings[20] +#define delete_character CUR Strings[21] +#define delete_line CUR Strings[22] +#define dis_status_line CUR Strings[23] +#define down_half_line CUR Strings[24] +#define enter_alt_charset_mode CUR Strings[25] +#define enter_blink_mode CUR Strings[26] +#define enter_bold_mode CUR Strings[27] +#define enter_ca_mode CUR Strings[28] +#define enter_delete_mode CUR Strings[29] +#define enter_dim_mode CUR Strings[30] +#define enter_insert_mode CUR Strings[31] +#define enter_secure_mode CUR Strings[32] +#define enter_protected_mode CUR Strings[33] +#define enter_reverse_mode CUR Strings[34] +#define enter_standout_mode CUR Strings[35] +#define enter_underline_mode CUR Strings[36] +#define erase_chars CUR Strings[37] +#define exit_alt_charset_mode CUR Strings[38] +#define exit_attribute_mode CUR Strings[39] +#define exit_ca_mode CUR Strings[40] +#define exit_delete_mode CUR Strings[41] +#define exit_insert_mode CUR Strings[42] +#define exit_standout_mode CUR Strings[43] +#define exit_underline_mode CUR Strings[44] +#define flash_screen CUR Strings[45] +#define form_feed CUR Strings[46] +#define from_status_line CUR Strings[47] +#define init_1string CUR Strings[48] +#define init_2string CUR Strings[49] +#define init_3string CUR Strings[50] +#define init_file CUR Strings[51] +#define insert_character CUR Strings[52] +#define insert_line CUR Strings[53] +#define insert_padding CUR Strings[54] +#define key_backspace CUR Strings[55] +#define key_catab CUR Strings[56] +#define key_clear CUR Strings[57] +#define key_ctab CUR Strings[58] +#define key_dc CUR Strings[59] +#define key_dl CUR Strings[60] +#define key_down CUR Strings[61] +#define key_eic CUR Strings[62] +#define key_eol CUR Strings[63] +#define key_eos CUR Strings[64] +#define key_f0 CUR Strings[65] +#define key_f1 CUR Strings[66] +#define key_f10 CUR Strings[67] +#define key_f2 CUR Strings[68] +#define key_f3 CUR Strings[69] +#define key_f4 CUR Strings[70] +#define key_f5 CUR Strings[71] +#define key_f6 CUR Strings[72] +#define key_f7 CUR Strings[73] +#define key_f8 CUR Strings[74] +#define key_f9 CUR Strings[75] +#define key_home CUR Strings[76] +#define key_ic CUR Strings[77] +#define key_il CUR Strings[78] +#define key_left CUR Strings[79] +#define key_ll CUR Strings[80] +#define key_npage CUR Strings[81] +#define key_ppage CUR Strings[82] +#define key_right CUR Strings[83] +#define key_sf CUR Strings[84] +#define key_sr CUR Strings[85] +#define key_stab CUR Strings[86] +#define key_up CUR Strings[87] +#define keypad_local CUR Strings[88] +#define keypad_xmit CUR Strings[89] +#define lab_f0 CUR Strings[90] +#define lab_f1 CUR Strings[91] +#define lab_f10 CUR Strings[92] +#define lab_f2 CUR Strings[93] +#define lab_f3 CUR Strings[94] +#define lab_f4 CUR Strings[95] +#define lab_f5 CUR Strings[96] +#define lab_f6 CUR Strings[97] +#define lab_f7 CUR Strings[98] +#define lab_f8 CUR Strings[99] +#define lab_f9 CUR Strings[100] +#define meta_off CUR Strings[101] +#define meta_on CUR Strings[102] +#define newline CUR Strings[103] +#define pad_char CUR Strings[104] +#define parm_dch CUR Strings[105] +#define parm_delete_line CUR Strings[106] +#define parm_down_cursor CUR Strings[107] +#define parm_ich CUR Strings[108] +#define parm_index CUR Strings[109] +#define parm_insert_line CUR Strings[110] +#define parm_left_cursor CUR Strings[111] +#define parm_right_cursor CUR Strings[112] +#define parm_rindex CUR Strings[113] +#define parm_up_cursor CUR Strings[114] +#define pkey_key CUR Strings[115] +#define pkey_local CUR Strings[116] +#define pkey_xmit CUR Strings[117] +#define print_screen CUR Strings[118] +#define prtr_off CUR Strings[119] +#define prtr_on CUR Strings[120] +#define repeat_char CUR Strings[121] +#define reset_1string CUR Strings[122] +#define reset_2string CUR Strings[123] +#define reset_3string CUR Strings[124] +#define reset_file CUR Strings[125] +#define restore_cursor CUR Strings[126] +#define row_address CUR Strings[127] +#define save_cursor CUR Strings[128] +#define scroll_forward CUR Strings[129] +#define scroll_reverse CUR Strings[130] +#define set_attributes CUR Strings[131] +#define set_tab CUR Strings[132] +#define set_window CUR Strings[133] +#define tab CUR Strings[134] +#define to_status_line CUR Strings[135] +#define underline_char CUR Strings[136] +#define up_half_line CUR Strings[137] +#define init_prog CUR Strings[138] +#define key_a1 CUR Strings[139] +#define key_a3 CUR Strings[140] +#define key_b2 CUR Strings[141] +#define key_c1 CUR Strings[142] +#define key_c3 CUR Strings[143] +#define prtr_non CUR Strings[144] +#define char_padding CUR Strings[145] +#define acs_chars CUR Strings[146] +#define plab_norm CUR Strings[147] +#define key_btab CUR Strings[148] +#define enter_xon_mode CUR Strings[149] +#define exit_xon_mode CUR Strings[150] +#define enter_am_mode CUR Strings[151] +#define exit_am_mode CUR Strings[152] +#define xon_character CUR Strings[153] +#define xoff_character CUR Strings[154] +#define ena_acs CUR Strings[155] +#define label_on CUR Strings[156] +#define label_off CUR Strings[157] +#define key_beg CUR Strings[158] +#define key_cancel CUR Strings[159] +#define key_close CUR Strings[160] +#define key_command CUR Strings[161] +#define key_copy CUR Strings[162] +#define key_create CUR Strings[163] +#define key_end CUR Strings[164] +#define key_enter CUR Strings[165] +#define key_exit CUR Strings[166] +#define key_find CUR Strings[167] +#define key_help CUR Strings[168] +#define key_mark CUR Strings[169] +#define key_message CUR Strings[170] +#define key_move CUR Strings[171] +#define key_next CUR Strings[172] +#define key_open CUR Strings[173] +#define key_options CUR Strings[174] +#define key_previous CUR Strings[175] +#define key_print CUR Strings[176] +#define key_redo CUR Strings[177] +#define key_reference CUR Strings[178] +#define key_refresh CUR Strings[179] +#define key_replace CUR Strings[180] +#define key_restart CUR Strings[181] +#define key_resume CUR Strings[182] +#define key_save CUR Strings[183] +#define key_suspend CUR Strings[184] +#define key_undo CUR Strings[185] +#define key_sbeg CUR Strings[186] +#define key_scancel CUR Strings[187] +#define key_scommand CUR Strings[188] +#define key_scopy CUR Strings[189] +#define key_screate CUR Strings[190] +#define key_sdc CUR Strings[191] +#define key_sdl CUR Strings[192] +#define key_select CUR Strings[193] +#define key_send CUR Strings[194] +#define key_seol CUR Strings[195] +#define key_sexit CUR Strings[196] +#define key_sfind CUR Strings[197] +#define key_shelp CUR Strings[198] +#define key_shome CUR Strings[199] +#define key_sic CUR Strings[200] +#define key_sleft CUR Strings[201] +#define key_smessage CUR Strings[202] +#define key_smove CUR Strings[203] +#define key_snext CUR Strings[204] +#define key_soptions CUR Strings[205] +#define key_sprevious CUR Strings[206] +#define key_sprint CUR Strings[207] +#define key_sredo CUR Strings[208] +#define key_sreplace CUR Strings[209] +#define key_sright CUR Strings[210] +#define key_srsume CUR Strings[211] +#define key_ssave CUR Strings[212] +#define key_ssuspend CUR Strings[213] +#define key_sundo CUR Strings[214] +#define req_for_input CUR Strings[215] +#define key_f11 CUR Strings[216] +#define key_f12 CUR Strings[217] +#define key_f13 CUR Strings[218] +#define key_f14 CUR Strings[219] +#define key_f15 CUR Strings[220] +#define key_f16 CUR Strings[221] +#define key_f17 CUR Strings[222] +#define key_f18 CUR Strings[223] +#define key_f19 CUR Strings[224] +#define key_f20 CUR Strings[225] +#define key_f21 CUR Strings[226] +#define key_f22 CUR Strings[227] +#define key_f23 CUR Strings[228] +#define key_f24 CUR Strings[229] +#define key_f25 CUR Strings[230] +#define key_f26 CUR Strings[231] +#define key_f27 CUR Strings[232] +#define key_f28 CUR Strings[233] +#define key_f29 CUR Strings[234] +#define key_f30 CUR Strings[235] +#define key_f31 CUR Strings[236] +#define key_f32 CUR Strings[237] +#define key_f33 CUR Strings[238] +#define key_f34 CUR Strings[239] +#define key_f35 CUR Strings[240] +#define key_f36 CUR Strings[241] +#define key_f37 CUR Strings[242] +#define key_f38 CUR Strings[243] +#define key_f39 CUR Strings[244] +#define key_f40 CUR Strings[245] +#define key_f41 CUR Strings[246] +#define key_f42 CUR Strings[247] +#define key_f43 CUR Strings[248] +#define key_f44 CUR Strings[249] +#define key_f45 CUR Strings[250] +#define key_f46 CUR Strings[251] +#define key_f47 CUR Strings[252] +#define key_f48 CUR Strings[253] +#define key_f49 CUR Strings[254] +#define key_f50 CUR Strings[255] +#define key_f51 CUR Strings[256] +#define key_f52 CUR Strings[257] +#define key_f53 CUR Strings[258] +#define key_f54 CUR Strings[259] +#define key_f55 CUR Strings[260] +#define key_f56 CUR Strings[261] +#define key_f57 CUR Strings[262] +#define key_f58 CUR Strings[263] +#define key_f59 CUR Strings[264] +#define key_f60 CUR Strings[265] +#define key_f61 CUR Strings[266] +#define key_f62 CUR Strings[267] +#define key_f63 CUR Strings[268] +#define clr_bol CUR Strings[269] +#define clear_margins CUR Strings[270] +#define set_left_margin CUR Strings[271] +#define set_right_margin CUR Strings[272] +#define label_format CUR Strings[273] +#define set_clock CUR Strings[274] +#define display_clock CUR Strings[275] +#define remove_clock CUR Strings[276] +#define create_window CUR Strings[277] +#define goto_window CUR Strings[278] +#define hangup CUR Strings[279] +#define dial_phone CUR Strings[280] +#define quick_dial CUR Strings[281] +#define tone CUR Strings[282] +#define pulse CUR Strings[283] +#define flash_hook CUR Strings[284] +#define fixed_pause CUR Strings[285] +#define wait_tone CUR Strings[286] +#define user0 CUR Strings[287] +#define user1 CUR Strings[288] +#define user2 CUR Strings[289] +#define user3 CUR Strings[290] +#define user4 CUR Strings[291] +#define user5 CUR Strings[292] +#define user6 CUR Strings[293] +#define user7 CUR Strings[294] +#define user8 CUR Strings[295] +#define user9 CUR Strings[296] +#define orig_pair CUR Strings[297] +#define orig_colors CUR Strings[298] +#define initialize_color CUR Strings[299] +#define initialize_pair CUR Strings[300] +#define set_color_pair CUR Strings[301] +#define set_foreground CUR Strings[302] +#define set_background CUR Strings[303] +#define change_char_pitch CUR Strings[304] +#define change_line_pitch CUR Strings[305] +#define change_res_horz CUR Strings[306] +#define change_res_vert CUR Strings[307] +#define define_char CUR Strings[308] +#define enter_doublewide_mode CUR Strings[309] +#define enter_draft_quality CUR Strings[310] +#define enter_italics_mode CUR Strings[311] +#define enter_leftward_mode CUR Strings[312] +#define enter_micro_mode CUR Strings[313] +#define enter_near_letter_quality CUR Strings[314] +#define enter_normal_quality CUR Strings[315] +#define enter_shadow_mode CUR Strings[316] +#define enter_subscript_mode CUR Strings[317] +#define enter_superscript_mode CUR Strings[318] +#define enter_upward_mode CUR Strings[319] +#define exit_doublewide_mode CUR Strings[320] +#define exit_italics_mode CUR Strings[321] +#define exit_leftward_mode CUR Strings[322] +#define exit_micro_mode CUR Strings[323] +#define exit_shadow_mode CUR Strings[324] +#define exit_subscript_mode CUR Strings[325] +#define exit_superscript_mode CUR Strings[326] +#define exit_upward_mode CUR Strings[327] +#define micro_column_address CUR Strings[328] +#define micro_down CUR Strings[329] +#define micro_left CUR Strings[330] +#define micro_right CUR Strings[331] +#define micro_row_address CUR Strings[332] +#define micro_up CUR Strings[333] +#define order_of_pins CUR Strings[334] +#define parm_down_micro CUR Strings[335] +#define parm_left_micro CUR Strings[336] +#define parm_right_micro CUR Strings[337] +#define parm_up_micro CUR Strings[338] +#define select_char_set CUR Strings[339] +#define set_bottom_margin CUR Strings[340] +#define set_bottom_margin_parm CUR Strings[341] +#define set_left_margin_parm CUR Strings[342] +#define set_right_margin_parm CUR Strings[343] +#define set_top_margin CUR Strings[344] +#define set_top_margin_parm CUR Strings[345] +#define start_bit_image CUR Strings[346] +#define start_char_set_def CUR Strings[347] +#define stop_bit_image CUR Strings[348] +#define stop_char_set_def CUR Strings[349] +#define subscript_characters CUR Strings[350] +#define superscript_characters CUR Strings[351] +#define these_cause_cr CUR Strings[352] +#define zero_motion CUR Strings[353] +#define char_set_names CUR Strings[354] +#define key_mouse CUR Strings[355] +#define mouse_info CUR Strings[356] +#define req_mouse_pos CUR Strings[357] +#define get_mouse CUR Strings[358] +#define set_a_foreground CUR Strings[359] +#define set_a_background CUR Strings[360] +#define pkey_plab CUR Strings[361] +#define device_type CUR Strings[362] +#define code_set_init CUR Strings[363] +#define set0_des_seq CUR Strings[364] +#define set1_des_seq CUR Strings[365] +#define set2_des_seq CUR Strings[366] +#define set3_des_seq CUR Strings[367] +#define set_lr_margin CUR Strings[368] +#define set_tb_margin CUR Strings[369] +#define bit_image_repeat CUR Strings[370] +#define bit_image_newline CUR Strings[371] +#define bit_image_carriage_return CUR Strings[372] +#define color_names CUR Strings[373] +#define define_bit_image_region CUR Strings[374] +#define end_bit_image_region CUR Strings[375] +#define set_color_band CUR Strings[376] +#define set_page_length CUR Strings[377] +#define display_pc_char CUR Strings[378] +#define enter_pc_charset_mode CUR Strings[379] +#define exit_pc_charset_mode CUR Strings[380] +#define enter_scancode_mode CUR Strings[381] +#define exit_scancode_mode CUR Strings[382] +#define pc_term_options CUR Strings[383] +#define scancode_escape CUR Strings[384] +#define alt_scancode_esc CUR Strings[385] +#define enter_horizontal_hl_mode CUR Strings[386] +#define enter_left_hl_mode CUR Strings[387] +#define enter_low_hl_mode CUR Strings[388] +#define enter_right_hl_mode CUR Strings[389] +#define enter_top_hl_mode CUR Strings[390] +#define enter_vertical_hl_mode CUR Strings[391] +#define set_a_attributes CUR Strings[392] +#define set_pglen_inch CUR Strings[393] + +#define BOOLWRITE 37 +#define NUMWRITE 33 +#define STRWRITE 394 + +/* older synonyms for some capabilities */ +#define beehive_glitch no_esc_ctlc +#define teleray_glitch dest_tabs_magic_smso +#define micro_char_size micro_col_size + +#ifdef __INTERNAL_CAPS_VISIBLE +#define termcap_init2 CUR Strings[394] +#define termcap_reset CUR Strings[395] +#define magic_cookie_glitch_ul CUR Numbers[33] +#define backspaces_with_bs CUR Booleans[37] +#define crt_no_scrolling CUR Booleans[38] +#define no_correctly_working_cr CUR Booleans[39] +#define carriage_return_delay CUR Numbers[34] +#define new_line_delay CUR Numbers[35] +#define linefeed_if_not_lf CUR Strings[396] +#define backspace_if_not_bs CUR Strings[397] +#define gnu_has_meta_key CUR Booleans[40] +#define linefeed_is_newline CUR Booleans[41] +#define backspace_delay CUR Numbers[36] +#define horizontal_tab_delay CUR Numbers[37] +#define number_of_function_keys CUR Numbers[38] +#define other_non_function_keys CUR Strings[398] +#define arrow_key_map CUR Strings[399] +#define has_hardware_tabs CUR Booleans[42] +#define return_does_clr_eol CUR Booleans[43] +#define acs_ulcorner CUR Strings[400] +#define acs_llcorner CUR Strings[401] +#define acs_urcorner CUR Strings[402] +#define acs_lrcorner CUR Strings[403] +#define acs_ltee CUR Strings[404] +#define acs_rtee CUR Strings[405] +#define acs_btee CUR Strings[406] +#define acs_ttee CUR Strings[407] +#define acs_hline CUR Strings[408] +#define acs_vline CUR Strings[409] +#define acs_plus CUR Strings[410] +#define memory_lock CUR Strings[411] +#define memory_unlock CUR Strings[412] +#define box_chars_1 CUR Strings[413] +#endif /* __INTERNAL_CAPS_VISIBLE */ + +/* + * Predefined terminfo array sizes + */ +#define BOOLCOUNT 44 +#define NUMCOUNT 39 +#define STRCOUNT 414 + +/* used by code for comparing entries */ +#define acs_chars_index 146 + +typedef struct termtype { /* in-core form of terminfo data */ + char* term_names; /* str_table offset of term names */ + char* str_table; /* pointer to string table */ + NCURSES_SBOOL* Booleans; /* array of boolean values */ + short* Numbers; /* array of integer values */ + char** Strings; /* array of string offsets */ + +#if NCURSES_XNAMES + char* ext_str_table; /* pointer to extended string table */ + char** ext_Names; /* corresponding names */ + + unsigned short num_Booleans; /* count total Booleans */ + unsigned short num_Numbers; /* count total Numbers */ + unsigned short num_Strings; /* count total Strings */ + + unsigned short ext_Booleans; /* count extensions to Booleans */ + unsigned short ext_Numbers; /* count extensions to Numbers */ + unsigned short ext_Strings; /* count extensions to Strings */ +#endif /* NCURSES_XNAMES */ + +} TERMTYPE; + +/* + * The only reason these structures are visible is for read-only use. + * Programs which modify the data are not, never were, portable across + * curses implementations. + */ +#ifdef NCURSES_INTERNALS + +typedef struct termtype2 { /* in-core form of terminfo data */ + char* term_names; /* str_table offset of term names */ + char* str_table; /* pointer to string table */ + NCURSES_SBOOL* Booleans; /* array of boolean values */ + int* Numbers; /* array of integer values */ + char** Strings; /* array of string offsets */ + +#if NCURSES_XNAMES + char* ext_str_table; /* pointer to extended string table */ + char** ext_Names; /* corresponding names */ + + unsigned short num_Booleans; /* count total Booleans */ + unsigned short num_Numbers; /* count total Numbers */ + unsigned short num_Strings; /* count total Strings */ + + unsigned short ext_Booleans; /* count extensions to Booleans */ + unsigned short ext_Numbers; /* count extensions to Numbers */ + unsigned short ext_Strings; /* count extensions to Strings */ +#endif /* NCURSES_XNAMES */ + +} TERMTYPE2; + +typedef struct term { /* describe an actual terminal */ + TERMTYPE type; /* terminal type description */ + short Filedes; /* file description being written to */ + TTY Ottyb; /* original state of the terminal */ + TTY Nttyb; /* current state of the terminal */ + int _baudrate; /* used to compute padding */ + char* _termname; /* used for termname() */ + TERMTYPE2 type2; /* extended terminal type description */ +} TERMINAL; +#else +typedef struct term TERMINAL; +#endif /* NCURSES_INTERNALS */ + +#if 0 && !0 +extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term; +#elif 0 +NCURSES_WRAPPED_VAR(TERMINAL*, cur_term); +#define cur_term NCURSES_PUBLIC_VAR(cur_term()) +#else +extern NCURSES_EXPORT_VAR(TERMINAL*) cur_term; +#endif + +#if 0 || 0 +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolcodes); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolfnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numcodes); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numfnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strcodes); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strfnames); + +#define boolnames NCURSES_PUBLIC_VAR(boolnames()) +#define boolcodes NCURSES_PUBLIC_VAR(boolcodes()) +#define boolfnames NCURSES_PUBLIC_VAR(boolfnames()) +#define numnames NCURSES_PUBLIC_VAR(numnames()) +#define numcodes NCURSES_PUBLIC_VAR(numcodes()) +#define numfnames NCURSES_PUBLIC_VAR(numfnames()) +#define strnames NCURSES_PUBLIC_VAR(strnames()) +#define strcodes NCURSES_PUBLIC_VAR(strcodes()) +#define strfnames NCURSES_PUBLIC_VAR(strfnames()) + +#else + +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) boolnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) boolcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) boolfnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) numnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) numcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) numfnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) strnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) strcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char* const) strfnames[]; + +#endif + +/* + * These entrypoints are used only by the ncurses utilities such as tic. + */ +#ifdef NCURSES_INTERNALS + +extern NCURSES_EXPORT(int) _nc_set_tty_mode(TTY* buf); +extern NCURSES_EXPORT(int) + _nc_read_entry2(const char* const, char* const, TERMTYPE2* const); +extern NCURSES_EXPORT(int) _nc_read_file_entry(const char* const, TERMTYPE2*); +extern NCURSES_EXPORT(int) _nc_read_termtype(TERMTYPE2*, char*, int); +extern NCURSES_EXPORT(char*) _nc_first_name(const char* const); +extern NCURSES_EXPORT(int) + _nc_name_match(const char* const, const char* const, const char* const); + +#endif /* NCURSES_INTERNALS */ + +/* + * These entrypoints are used by tack. + */ +extern NCURSES_EXPORT(const TERMTYPE*) _nc_fallback(const char*); +extern NCURSES_EXPORT(int) + _nc_read_entry(const char* const, char* const, TERMTYPE* const); + +/* Normal entry points */ +extern NCURSES_EXPORT(TERMINAL*) set_curterm(TERMINAL*); +extern NCURSES_EXPORT(int) del_curterm(TERMINAL*); + +/* miscellaneous entry points */ +extern NCURSES_EXPORT(int) restartterm(NCURSES_CONST char*, int, int*); +extern NCURSES_EXPORT(int) setupterm(NCURSES_CONST char*, int, int*); + +/* terminfo entry points, also declared in curses.h */ +#if !defined(__NCURSES_H) +extern NCURSES_EXPORT(char*) tigetstr(NCURSES_CONST char*); +extern NCURSES_EXPORT_VAR(char) ttytype[]; +extern NCURSES_EXPORT(int) putp(const char*); +extern NCURSES_EXPORT(int) tigetflag(NCURSES_CONST char*); +extern NCURSES_EXPORT(int) tigetnum(NCURSES_CONST char*); + +#if 1 /* NCURSES_TPARM_VARARGS */ +extern NCURSES_EXPORT(char*) tparm(NCURSES_CONST char*, ...); /* special */ +#else +extern NCURSES_EXPORT(char*) tparm( + NCURSES_CONST char*, + long, + long, + long, + long, + long, + long, + long, + long, + long); /* special */ +extern NCURSES_EXPORT(char*) + tparm_varargs(NCURSES_CONST char*, ...); /* special */ +#endif + +extern NCURSES_EXPORT(char*) tiparm(const char*, ...); /* special */ + +#endif /* __NCURSES_H */ + +/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */ +#if !defined(NCURSES_TERMCAP_H_incl) +extern NCURSES_EXPORT(char*) tgetstr(NCURSES_CONST char*, char**); +extern NCURSES_EXPORT(char*) tgoto(const char*, int, int); +extern NCURSES_EXPORT(int) tgetent(char*, const char*); +extern NCURSES_EXPORT(int) tgetflag(NCURSES_CONST char*); +extern NCURSES_EXPORT(int) tgetnum(NCURSES_CONST char*); +extern NCURSES_EXPORT(int) tputs(const char*, int, int (*)(int)); +#endif /* NCURSES_TERMCAP_H_incl */ + +/* + * Include curses.h before term.h to enable these extensions. + */ +#if defined(NCURSES_SP_FUNCS) && (NCURSES_SP_FUNCS != 0) + +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(tigetstr)(SCREEN*, NCURSES_CONST char*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(putp)(SCREEN*, const char*); +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(tigetflag)(SCREEN*, NCURSES_CONST char*); +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(tigetnum)(SCREEN*, NCURSES_CONST char*); + +#if 1 /* NCURSES_TPARM_VARARGS */ +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(tparm)(SCREEN*, NCURSES_CONST char*, ...); /* special */ +#else +extern NCURSES_EXPORT(char*) NCURSES_SP_NAME(tparm)( + SCREEN*, + NCURSES_CONST char*, + long, + long, + long, + long, + long, + long, + long, + long, + long); /* special */ +extern NCURSES_EXPORT(char*) NCURSES_SP_NAME( + tparm_varargs)(SCREEN*, NCURSES_CONST char*, ...); /* special */ +#endif + +/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */ +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(tgetstr)(SCREEN*, NCURSES_CONST char*, char**); +extern NCURSES_EXPORT(char*) + NCURSES_SP_NAME(tgoto)(SCREEN*, const char*, int, int); +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(tgetent)(SCREEN*, char*, const char*); +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(tgetflag)(SCREEN*, NCURSES_CONST char*); +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(tgetnum)(SCREEN*, NCURSES_CONST char*); +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(tputs)(SCREEN*, const char*, int, NCURSES_SP_OUTC); + +extern NCURSES_EXPORT(TERMINAL*) + NCURSES_SP_NAME(set_curterm)(SCREEN*, TERMINAL*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(del_curterm)(SCREEN*, TERMINAL*); + +extern NCURSES_EXPORT(int) + NCURSES_SP_NAME(restartterm)(SCREEN*, NCURSES_CONST char*, int, int*); +#endif /* NCURSES_SP_FUNCS */ + +#ifdef __cplusplus +} +#endif + +#endif /* NCURSES_TERM_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/term_entry.h b/src_cpp/elfgames/tasks/elf2codingenv/include/term_entry.h new file mode 100644 index 0000000..f62326b --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/term_entry.h @@ -0,0 +1,252 @@ +/**************************************************************************** + * Copyright (c) 1998-2015,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1998-on * + ****************************************************************************/ + +/* $Id: term_entry.h,v 1.55 2017/04/06 22:45:34 tom Exp $ */ + +/* + * term_entry.h -- interface to entry-manipulation code + */ + +#ifndef NCURSES_TERM_ENTRY_H_incl +#define NCURSES_TERM_ENTRY_H_incl 1 +/* *INDENT-OFF* */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * These macros may be used by programs that know about TERMTYPE: + */ +#if NCURSES_XNAMES +#define NUM_BOOLEANS(tp) (tp)->num_Booleans +#define NUM_NUMBERS(tp) (tp)->num_Numbers +#define NUM_STRINGS(tp) (tp)->num_Strings +#define EXT_NAMES(tp, i, limit, index, table) \ + (i >= limit) ? tp->ext_Names[index] : table[i] +#else +#define NUM_BOOLEANS(tp) BOOLCOUNT +#define NUM_NUMBERS(tp) NUMCOUNT +#define NUM_STRINGS(tp) STRCOUNT +#define EXT_NAMES(tp, i, limit, index, table) table[i] +#endif + +#define NUM_EXT_NAMES(tp) \ + (unsigned)((tp)->ext_Booleans + (tp)->ext_Numbers + (tp)->ext_Strings) + +#define for_each_boolean(n, tp) for (n = 0; n < NUM_BOOLEANS(tp); n++) +#define for_each_number(n, tp) for (n = 0; n < NUM_NUMBERS(tp); n++) +#define for_each_string(n, tp) for (n = 0; n < NUM_STRINGS(tp); n++) + +#if NCURSES_XNAMES +#define for_each_ext_boolean(n, tp) \ + for (n = BOOLCOUNT; (int)n < (int)NUM_BOOLEANS(tp); n++) +#define for_each_ext_number(n, tp) \ + for (n = NUMCOUNT; (int)n < (int)NUM_NUMBERS(tp); n++) +#define for_each_ext_string(n, tp) \ + for (n = STRCOUNT; (int)n < (int)NUM_STRINGS(tp); n++) +#endif + +#define ExtBoolname(tp, i, names) \ + EXT_NAMES( \ + tp, i, BOOLCOUNT, (i - (tp->num_Booleans - tp->ext_Booleans)), names) +#define ExtNumname(tp, i, names) \ + EXT_NAMES( \ + tp, \ + i, \ + NUMCOUNT, \ + (i - (tp->num_Numbers - tp->ext_Numbers)) + tp->ext_Booleans, \ + names) +#define ExtStrname(tp, i, names) \ + EXT_NAMES( \ + tp, \ + i, \ + STRCOUNT, \ + (i - (tp->num_Strings - tp->ext_Strings)) + \ + (tp->ext_Numbers + tp->ext_Booleans), \ + names) + +/* + * The remaining type-definitions and macros are used only internally by the + * ncurses utilities. + */ +#ifdef NCURSES_INTERNALS + +/* + * see db_iterator.c - this enumeration lists the places searched for a + * terminal description and defines the order in which they are searched. + */ +typedef enum { + dbdTIC = 0, /* special, used by tic when writing entry */ +#if NCURSES_USE_DATABASE + dbdEnvOnce, /* the $TERMINFO environment variable */ + dbdHome, /* $HOME/.terminfo */ + dbdEnvList, /* the $TERMINFO_DIRS environment variable */ + dbdCfgList, /* the compiled-in TERMINFO_DIRS value */ + dbdCfgOnce, /* the compiled-in TERMINFO value */ +#endif +#if NCURSES_USE_TERMCAP + dbdEnvOnce2, /* the $TERMCAP environment variable */ + dbdEnvList2, /* the $TERMPATH environment variable */ + dbdCfgList2, /* the compiled-in TERMPATH */ +#endif + dbdLAST +} DBDIRS; + +#define MAX_USES 32 +#define MAX_CROSSLINKS 16 + +typedef struct entry ENTRY; + +typedef struct { + char* name; + ENTRY* link; + long line; +} ENTRY_USES; + +struct entry { + TERMTYPE2 tterm; + unsigned nuses; + ENTRY_USES uses[MAX_USES]; + int ncrosslinks; + ENTRY* crosslinks[MAX_CROSSLINKS]; + long cstart; + long cend; + long startline; + ENTRY* next; + ENTRY* last; +}; + +extern NCURSES_EXPORT_VAR(ENTRY*) _nc_head; +extern NCURSES_EXPORT_VAR(ENTRY*) _nc_tail; +#define for_entry_list(qp) for (qp = _nc_head; qp; qp = qp->next) + +#define MAX_LINE 132 + +#define NULLHOOK (bool (*)(ENTRY*))0 + +/* + * Note that WANTED and PRESENT are not simple inverses! If a capability + * has been explicitly cancelled, it's not considered WANTED. + */ +#define WANTED(s) ((s) == ABSENT_STRING) +#define PRESENT(s) (((s) != ABSENT_STRING) && ((s) != CANCELLED_STRING)) + +#define ANDMISSING(p, q) \ + { \ + if (PRESENT(p) && !PRESENT(q)) \ + _nc_warning(#p " but no " #q); \ + } + +#define PAIRED(p, q) \ + { \ + if (PRESENT(q) && !PRESENT(p)) \ + _nc_warning(#q " but no " #p); \ + if (PRESENT(p) && !PRESENT(q)) \ + _nc_warning(#p " but no " #q); \ + } + +/* + * These entrypoints are used only by the ncurses utilities such as tic. + */ + +/* alloc_entry.c: elementary allocation code */ +extern NCURSES_EXPORT(ENTRY*) _nc_copy_entry(ENTRY* oldp); +extern NCURSES_EXPORT(char*) _nc_save_str(const char* const); +extern NCURSES_EXPORT(void) _nc_init_entry(ENTRY* const); +extern NCURSES_EXPORT(void) _nc_merge_entry(ENTRY* const, ENTRY* const); +extern NCURSES_EXPORT(void) _nc_wrap_entry(ENTRY* const, bool); + +/* alloc_ttype.c: elementary allocation code */ +extern NCURSES_EXPORT(void) _nc_align_termtype(TERMTYPE2*, TERMTYPE2*); + +/* free_ttype.c: elementary allocation code */ +extern NCURSES_EXPORT(void) _nc_free_termtype2(TERMTYPE2*); + +/* lib_termcap.c: trim sgr0 string for termcap users */ +extern NCURSES_EXPORT(char*) _nc_trim_sgr0(TERMTYPE2*); + +/* parse_entry.c: entry-parsing code */ +#if NCURSES_XNAMES +extern NCURSES_EXPORT_VAR(bool) _nc_user_definable; +extern NCURSES_EXPORT_VAR(bool) _nc_disable_period; +#endif +extern NCURSES_EXPORT(int) _nc_parse_entry(ENTRY*, int, bool); +extern NCURSES_EXPORT(int) _nc_capcmp(const char*, const char*); + +/* write_entry.c: writing an entry to the file system */ +extern NCURSES_EXPORT(void) _nc_set_writedir(const char*); +extern NCURSES_EXPORT(void) _nc_write_entry(TERMTYPE2* const); +extern NCURSES_EXPORT(int) + _nc_write_object(TERMTYPE2*, char*, unsigned*, unsigned); + +/* comp_parse.c: entry list handling */ +extern NCURSES_EXPORT(void) + _nc_read_entry_source(FILE*, char*, int, bool, bool (*)(ENTRY*)); +extern NCURSES_EXPORT(bool) _nc_entry_match(char*, char*); +extern NCURSES_EXPORT(int) _nc_resolve_uses(bool); /* obs 20040705 */ +extern NCURSES_EXPORT(int) _nc_resolve_uses2(bool, bool); +extern NCURSES_EXPORT(void) _nc_free_entries(ENTRY*); +extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype)( + TERMTYPE*); /* obs 20040705 */ +extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype2)(TERMTYPE2*, bool); + +/* trace_xnames.c */ +extern NCURSES_EXPORT(void) _nc_trace_xnames(TERMTYPE*); + +#endif /* NCURSES_INTERNALS */ + +/* + * These entrypoints are used by tack. + */ + +/* alloc_ttype.c: elementary allocation code */ +extern NCURSES_EXPORT(void) _nc_copy_termtype(TERMTYPE*, const TERMTYPE*); + +/* lib_acs.c */ +extern NCURSES_EXPORT(void) + _nc_init_acs(void); /* corresponds to traditional 'init_acs()' */ + +/* free_ttype.c: elementary allocation code */ +extern NCURSES_EXPORT(void) _nc_free_termtype(TERMTYPE*); + +#ifdef __cplusplus +} +#endif + +/* *INDENT-ON* */ + +#endif /* NCURSES_TERM_ENTRY_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/termcap.h b/src_cpp/elfgames/tasks/elf2codingenv/include/termcap.h new file mode 100644 index 0000000..8bad007 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/termcap.h @@ -0,0 +1,74 @@ +/**************************************************************************** + * Copyright (c) 1998-2000,2001 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* $Id: termcap.h.in,v 1.17 2001/03/24 21:53:27 tom Exp $ */ + +#ifndef NCURSES_TERMCAP_H_incl +#define NCURSES_TERMCAP_H_incl 1 + +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.1" + +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include + +#undef NCURSES_CONST +#define NCURSES_CONST const + +#undef NCURSES_OSPEED +#define NCURSES_OSPEED short + +extern NCURSES_EXPORT_VAR(char) PC; +extern NCURSES_EXPORT_VAR(char*) UP; +extern NCURSES_EXPORT_VAR(char*) BC; +extern NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed; + +#if !defined(NCURSES_TERM_H_incl) +extern NCURSES_EXPORT(char*) tgetstr(NCURSES_CONST char*, char**); +extern NCURSES_EXPORT(char*) tgoto(const char*, int, int); +extern NCURSES_EXPORT(int) tgetent(char*, const char*); +extern NCURSES_EXPORT(int) tgetflag(NCURSES_CONST char*); +extern NCURSES_EXPORT(int) tgetnum(NCURSES_CONST char*); +extern NCURSES_EXPORT(int) tputs(const char*, int, int (*)(int)); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* NCURSES_TERMCAP_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tic.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tic.h new file mode 100644 index 0000000..fd2c5e6 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tic.h @@ -0,0 +1,369 @@ +/**************************************************************************** + * Copyright (c) 1998-2012,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996 on * + ****************************************************************************/ + +/* + * $Id: tic.h,v 1.75 2017/07/29 23:21:06 tom Exp $ + * tic.h - Global variables and structures for the terminfo compiler. + */ + +#ifndef __TIC_H +#define __TIC_H +/* *INDENT-OFF* */ +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include /* for the _tracef() prototype, ERR/OK, bool defs */ + +/* +** The format of SVr2 compiled terminfo files is as follows: +** +** Header (12 bytes), containing information given below +** Names Section, containing the names of the terminal +** Boolean Section, containing the values of all of the +** boolean capabilities +** A null byte may be inserted here to make +** sure that the Number Section begins on an +** even word boundary. +** Number Section, containing the values of all of the numeric +** capabilities, each as a short integer +** String Section, containing short integer offsets into the +** String Table, one per string capability +** String Table, containing the actual characters of the string +** capabilities. +** +** In the SVr2 format, "short" means signed 16-bit numbers, which is sometimes +** inconvenient. The numbers are signed, to provide for absent and canceled +** values. ncurses6.1 introduced an extension to this compiled format, by +** making the Number Section a list of signed 32-bit integers. +** +** NOTE that all short integers in the file are stored using VAX/PDP-style +** byte-order, i.e., least-significant byte first. +** +** There is no structure definition here because it would only confuse +** matters. Terminfo format is a raw byte layout, not a structure +** dump. If you happen to be on a little-endian machine with 16-bit +** shorts that requires no padding between short members in a struct, +** then there is a natural C structure that captures the header, but +** not very helpfully. +*/ + +#define MAGIC 0432 /* first two bytes of a compiled entry */ +#define MAGIC2 01036 /* first two bytes of a compiled 32-bit entry */ + +#undef BYTE +#define BYTE(p, n) (unsigned char)((p)[n]) + +#define IS_NEG1(p) ((BYTE(p, 0) == 0377) && (BYTE(p, 1) == 0377)) +#define IS_NEG2(p) ((BYTE(p, 0) == 0376) && (BYTE(p, 1) == 0377)) +#define LOW_MSB(p) (BYTE(p, 0) + 256 * BYTE(p, 1)) + +#define IS_TIC_MAGIC(p) (LOW_MSB(p) == MAGIC || LOW_MSB(p) == MAGIC2) + +#define quick_prefix(s) (!strncmp((s), "b64:", 4) || !strncmp((s), "hex:", 4)) + +/* + * The "maximum" here is misleading; XSI guarantees minimum values, which a + * given implementation may exceed. + */ +#define MAX_NAME_SIZE 512 /* maximum legal name field size (XSI:127) */ +#define MAX_ENTRY_SIZE1 4096 /* maximum legal entry size (SVr2) */ +#define MAX_ENTRY_SIZE2 32768 /* maximum legal entry size (ncurses6.1) */ + +#if NCURSES_EXT_COLORS && HAVE_INIT_EXTENDED_COLOR +#define MAX_ENTRY_SIZE MAX_ENTRY_SIZE2 +#else +#define MAX_ENTRY_SIZE MAX_ENTRY_SIZE1 +#endif + +/* + * The maximum size of individual name or alias is guaranteed in XSI to be at + * least 14, since that corresponds to the older filename lengths. Newer + * systems allow longer aliases, though not many terminal descriptions are + * written to use them. The MAX_ALIAS symbol is used for warnings. + */ +#if HAVE_LONG_FILE_NAMES +#define MAX_ALIAS 32 /* smaller than POSIX minimum for PATH_MAX */ +#else +#define MAX_ALIAS 14 /* SVr3 filename length */ +#endif + +/* location of user's personal info directory */ +#define PRIVATE_INFO "%s/.terminfo" /* plug getenv("HOME") into %s */ + +/* + * Some traces are designed to be used via tic's verbose option (and similar in + * infocmp and toe) rather than the 'trace()' function. So we use the bits + * above the normal trace() parameter as a debug-level. + */ + +#define MAX_DEBUG_LEVEL 15 +#define DEBUG_LEVEL(n) ((n) << TRACE_SHIFT) + +#define set_trace_level(n) \ + _nc_tracing &= \ + DEBUG_LEVEL(MAX_DEBUG_LEVEL) + DEBUG_LEVEL(MAX_DEBUG_LEVEL) - 1, \ + _nc_tracing |= DEBUG_LEVEL(n) + +#ifdef TRACE +#define DEBUG(n, a) \ + if (_nc_tracing >= DEBUG_LEVEL(n)) \ + _tracef a +#else +#define DEBUG(n, a) /*nothing*/ +#endif + +/* + * These are the types of tokens returned by the scanner. The first + * three are also used in the hash table of capability names. The scanner + * returns one of these values after loading the specifics into the global + * structure curr_token. + */ + +#define BOOLEAN 0 /* Boolean capability */ +#define NUMBER 1 /* Numeric capability */ +#define STRING 2 /* String-valued capability */ +#define CANCEL 3 /* Capability to be cancelled in following tc's */ +#define NAMES 4 /* The names for a terminal type */ +#define UNDEF 5 /* Undefined */ + +#define NO_PUSHBACK -1 /* used in pushtype to indicate no pushback */ + +/* + * The global structure in which the specific parts of a + * scanned token are returned. + */ + +struct token { + char* tk_name; /* name of capability */ + int tk_valnumber; /* value of capability (if a number) */ + char* tk_valstring; /* value of capability (if a string) */ +}; + +/* + * Offsets to string capabilities, with the corresponding functionkey codes. + */ +struct tinfo_fkeys { + unsigned offset; + chtype code; +}; + +typedef short HashValue; + +/* + * The file comp_captab.c contains an array of these structures, one per + * possible capability. These are indexed by a hash table array of pointers to + * the same structures for use by the parser. + */ +struct name_table_entry { + const char* nte_name; /* name to hash on */ + int nte_type; /* BOOLEAN, NUMBER or STRING */ + HashValue nte_index; /* index of associated variable in its array */ + HashValue nte_link; /* index in table of next hash, or -1 */ +}; + +/* + * Use this structure to hide differences between terminfo and termcap tables. + */ +typedef struct { + unsigned table_size; + const HashValue* table_data; + HashValue (*hash_of)(const char*); + int (*compare_names)(const char*, const char*); +} HashData; + +struct alias { + const char* from; + const char* to; + const char* source; +}; + +#define NOTFOUND ((struct name_table_entry*)0) + +/* + * The casts are required for correct sign-propagation with systems such as + * AIX, IRIX64, Solaris which default to unsigned characters. The C standard + * leaves this detail unspecified. + */ + +/* out-of-band values for representing absent capabilities */ +#define ABSENT_BOOLEAN ((signed char)-1) /* 255 */ +#define ABSENT_NUMERIC (-1) +#define ABSENT_STRING (char*)0 + +/* out-of-band values for representing cancels */ +#define CANCELLED_BOOLEAN ((signed char)-2) /* 254 */ +#define CANCELLED_NUMERIC (-2) +#define CANCELLED_STRING (char*)(-1) + +#define VALID_BOOLEAN(s) ((unsigned char)(s) <= 1) /* reject "-1" */ +#define VALID_NUMERIC(s) ((s) >= 0) +#define VALID_STRING(s) ((s) != CANCELLED_STRING && (s) != ABSENT_STRING) + +/* termcap entries longer than this may break old binaries */ +#define MAX_TERMCAP_LENGTH 1023 + +/* this is a documented limitation of terminfo */ +#define MAX_TERMINFO_LENGTH 4096 + +#ifndef TERMINFO +#define TERMINFO "/usr/share/terminfo" +#endif + +#ifdef NCURSES_TERM_ENTRY_H_incl + +/* + * These entrypoints are used only by the ncurses utilities such as tic. + */ +#ifdef NCURSES_INTERNALS +/* access.c */ +extern NCURSES_EXPORT(unsigned) _nc_pathlast(const char*); +extern NCURSES_EXPORT(bool) _nc_is_abs_path(const char*); +extern NCURSES_EXPORT(bool) _nc_is_dir_path(const char*); +extern NCURSES_EXPORT(bool) _nc_is_file_path(const char*); +extern NCURSES_EXPORT(char*) _nc_basename(char*); +extern NCURSES_EXPORT(char*) _nc_rootname(char*); + +/* comp_captab.c */ +extern NCURSES_EXPORT(const struct name_table_entry*) _nc_get_table(bool); +extern NCURSES_EXPORT(const HashData*) _nc_get_hash_info(bool); +extern NCURSES_EXPORT(const struct alias*) _nc_get_alias_table(bool); + +/* comp_hash.c: name lookup */ +extern NCURSES_EXPORT(struct name_table_entry const*) + _nc_find_type_entry(const char*, int, bool); + +/* comp_scan.c: lexical analysis */ +extern NCURSES_EXPORT(int) _nc_get_token(bool); +extern NCURSES_EXPORT(void) _nc_panic_mode(char); +extern NCURSES_EXPORT(void) _nc_push_token(int); +extern NCURSES_EXPORT_VAR(int) _nc_curr_col; +extern NCURSES_EXPORT_VAR(int) _nc_curr_line; +extern NCURSES_EXPORT_VAR(int) _nc_syntax; +extern NCURSES_EXPORT_VAR(int) _nc_strict_bsd; +extern NCURSES_EXPORT_VAR(long) _nc_comment_end; +extern NCURSES_EXPORT_VAR(long) _nc_comment_start; +extern NCURSES_EXPORT_VAR(long) _nc_curr_file_pos; +extern NCURSES_EXPORT_VAR(long) _nc_start_line; +#define SYN_TERMINFO 0 +#define SYN_TERMCAP 1 + +/* comp_error.c: warning & abort messages */ +extern NCURSES_EXPORT(const char*) _nc_get_source(void); +extern NCURSES_EXPORT(void) _nc_err_abort(const char* const, ...) + GCC_PRINTFLIKE(1, 2) GCC_NORETURN; +extern NCURSES_EXPORT(void) _nc_get_type(char* name); +extern NCURSES_EXPORT(void) _nc_set_source(const char* const); +extern NCURSES_EXPORT(void) _nc_set_type(const char* const); +extern NCURSES_EXPORT(void) _nc_syserr_abort(const char* const, ...) + GCC_PRINTFLIKE(1, 2) GCC_NORETURN; +extern NCURSES_EXPORT(void) _nc_warning(const char* const, ...) + GCC_PRINTFLIKE(1, 2); +extern NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings; + +/* comp_scan.c */ +extern NCURSES_EXPORT_VAR(struct token) _nc_curr_token; + +/* captoinfo.c: capability conversion */ +extern NCURSES_EXPORT(char*) _nc_captoinfo(const char*, const char*, int const); +extern NCURSES_EXPORT(char*) _nc_infotocap(const char*, const char*, int const); + +/* home_terminfo.c */ +extern NCURSES_EXPORT(char*) _nc_home_terminfo(void); + +/* init_keytry.c */ +#if BROKEN_LINKER +#define _nc_tinfo_fkeys _nc_tinfo_fkeysf() +extern NCURSES_EXPORT(const struct tinfo_fkeys*) _nc_tinfo_fkeysf(void); +#else +extern NCURSES_EXPORT_VAR(const struct tinfo_fkeys) _nc_tinfo_fkeys[]; +#endif + +/* lib_tparm.c */ +#define NUM_PARM 9 + +extern NCURSES_EXPORT_VAR(int) _nc_tparm_err; + +extern NCURSES_EXPORT(int) _nc_tparm_analyze(const char*, char**, int*); + +/* lib_trace.c */ +extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing; +extern NCURSES_EXPORT(const char*) _nc_visbuf(const char*); +extern NCURSES_EXPORT(const char*) _nc_visbuf2(int, const char*); + +/* lib_tputs.c */ +extern NCURSES_EXPORT_VAR(int) _nc_nulls_sent; /* Add one for every null sent */ + +/* comp_main.c: compiler main */ +extern const char* _nc_progname; + +/* db_iterator.c */ +extern NCURSES_EXPORT(const char*) _nc_next_db(DBDIRS*, int*); +extern NCURSES_EXPORT(const char*) _nc_tic_dir(const char*); +extern NCURSES_EXPORT(void) _nc_first_db(DBDIRS*, int*); +extern NCURSES_EXPORT(void) _nc_last_db(void); + +/* write_entry.c */ +extern NCURSES_EXPORT(int) _nc_tic_written(void); + +#endif /* NCURSES_INTERNALS */ + +/* + * These entrypoints are used by tack. + */ + +/* comp_hash.c: name lookup */ +extern NCURSES_EXPORT(struct name_table_entry const*) + _nc_find_entry(const char*, const HashValue*); +extern NCURSES_EXPORT(const HashValue*) _nc_get_hash_table(bool); + +/* comp_scan.c: lexical analysis */ +extern NCURSES_EXPORT(void) _nc_reset_input(FILE*, char*); + +/* comp_expand.c: expand string into readable form */ +extern NCURSES_EXPORT(char*) _nc_tic_expand(const char*, bool, int); + +/* comp_scan.c: decode string from readable form */ +extern NCURSES_EXPORT(int) _nc_trans_string(char*, char*); + +#endif /* NCURSES_TERM_ENTRY_H_incl */ + +#ifdef __cplusplus +} +#endif + +/* *INDENT-ON* */ +#endif /* __TIC_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tk.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tk.h new file mode 100644 index 0000000..6e4ad08 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tk.h @@ -0,0 +1,1861 @@ +/* + * tk.h -- + * + * Declarations for Tk-related things that are visible outside of the Tk + * module itself. + * + * Copyright (c) 1989-1994 The Regents of the University of California. + * Copyright (c) 1994 The Australian National University. + * Copyright (c) 1994-1998 Sun Microsystems, Inc. + * Copyright (c) 1998-2000 Ajuba Solutions. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TK +#define _TK + +#include +#if (TCL_MAJOR_VERSION != 8) || (TCL_MINOR_VERSION < 6) +#error Tk 8.6 must be compiled with tcl.h from Tcl 8.6 or better +#endif + +#ifndef CONST84 +#define CONST84 const +#define CONST84_RETURN const +#endif +#ifndef CONST86 +#define CONST86 CONST84 +#endif +#ifndef EXTERN +#define EXTERN extern TCL_STORAGE_CLASS +#endif + +/* + * Utility macros: STRINGIFY takes an argument and wraps it in "" (double + * quotation marks), JOIN joins two arguments. + */ + +#ifndef STRINGIFY +#define STRINGIFY(x) STRINGIFY1(x) +#define STRINGIFY1(x) #x +#endif +#ifndef JOIN +#define JOIN(a, b) JOIN1(a, b) +#define JOIN1(a, b) a##b +#endif + +/* + * For C++ compilers, use extern "C" + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * When version numbers change here, you must also go into the following files + * and update the version numbers: + * + * library/tk.tcl (1 LOC patch) + * unix/configure.in (2 LOC Major, 2 LOC minor, 1 LOC patch) + * win/configure.in (as above) + * README (sections 0 and 1) + * macosx/Tk-Common.xcconfig (not patchlevel) 1 LOC + * win/README (not patchlevel) + * unix/README (not patchlevel) + * unix/tk.spec (1 LOC patch) + * win/tcl.m4 (not patchlevel) + * + * You may also need to update some of these files when the numbers change for + * the version of Tcl that this release of Tk is compiled against. + */ + +#define TK_MAJOR_VERSION 8 +#define TK_MINOR_VERSION 6 +#define TK_RELEASE_LEVEL TCL_FINAL_RELEASE +#define TK_RELEASE_SERIAL 7 + +#define TK_VERSION "8.6" +#define TK_PATCH_LEVEL "8.6.7" + +/* + * A special definition used to allow this header file to be included from + * windows or mac resource files so that they can obtain version information. + * RC_INVOKED is defined by default by the windows RC tool and manually set + * for macintosh. + * + * Resource compilers don't like all the C stuff, like typedefs and procedure + * declarations, that occur below, so block them out. + */ + +#ifndef RC_INVOKED + +#ifndef _XLIB_H +#include +#ifdef MAC_OSX_TK +#include +#endif +#endif +#ifdef __STDC__ +#include +#endif + +#ifdef BUILD_tk +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLEXPORT +#endif + +/* + *---------------------------------------------------------------------- + * + * Decide whether or not to use input methods. + */ + +#ifdef XNQueryInputStyle +#define TK_USE_INPUT_METHODS +#endif + +/* + * Dummy types that are used by clients: + */ + +typedef struct Tk_BindingTable_* Tk_BindingTable; +typedef struct Tk_Canvas_* Tk_Canvas; +typedef struct Tk_Cursor_* Tk_Cursor; +typedef struct Tk_ErrorHandler_* Tk_ErrorHandler; +typedef struct Tk_Font_* Tk_Font; +typedef struct Tk_Image__* Tk_Image; +typedef struct Tk_ImageMaster_* Tk_ImageMaster; +typedef struct Tk_OptionTable_* Tk_OptionTable; +typedef struct Tk_PostscriptInfo_* Tk_PostscriptInfo; +typedef struct Tk_TextLayout_* Tk_TextLayout; +typedef struct Tk_Window_* Tk_Window; +typedef struct Tk_3DBorder_* Tk_3DBorder; +typedef struct Tk_Style_* Tk_Style; +typedef struct Tk_StyleEngine_* Tk_StyleEngine; +typedef struct Tk_StyledElement_* Tk_StyledElement; + +/* + * Additional types exported to clients. + */ + +typedef const char* Tk_Uid; + +/* + *---------------------------------------------------------------------- + * + * The enum below defines the valid types for Tk configuration options as + * implemented by Tk_InitOptions, Tk_SetOptions, etc. + */ + +typedef enum { + TK_OPTION_BOOLEAN, + TK_OPTION_INT, + TK_OPTION_DOUBLE, + TK_OPTION_STRING, + TK_OPTION_STRING_TABLE, + TK_OPTION_COLOR, + TK_OPTION_FONT, + TK_OPTION_BITMAP, + TK_OPTION_BORDER, + TK_OPTION_RELIEF, + TK_OPTION_CURSOR, + TK_OPTION_JUSTIFY, + TK_OPTION_ANCHOR, + TK_OPTION_SYNONYM, + TK_OPTION_PIXELS, + TK_OPTION_WINDOW, + TK_OPTION_END, + TK_OPTION_CUSTOM, + TK_OPTION_STYLE +} Tk_OptionType; + +/* + * Structures of the following type are used by widgets to specify their + * configuration options. Typically each widget has a static array of these + * structures, where each element of the array describes a single + * configuration option. The array is passed to Tk_CreateOptionTable. + */ + +typedef struct Tk_OptionSpec { + Tk_OptionType type; /* Type of option, such as TK_OPTION_COLOR; + * see definitions above. Last option in table + * must have type TK_OPTION_END. */ + const char* optionName; /* Name used to specify option in Tcl + * commands. */ + const char* dbName; /* Name for option in option database. */ + const char* dbClass; /* Class for option in database. */ + const char* defValue; /* Default value for option if not specified + * in command line, the option database, or + * the system. */ + int objOffset; /* Where in record to store a Tcl_Obj * that + * holds the value of this option, specified + * as an offset in bytes from the start of the + * record. Use the Tk_Offset macro to generate + * values for this. -1 means don't store the + * Tcl_Obj in the record. */ + int internalOffset; /* Where in record to store the internal + * representation of the value of this option, + * such as an int or XColor *. This field is + * specified as an offset in bytes from the + * start of the record. Use the Tk_Offset + * macro to generate values for it. -1 means + * don't store the internal representation in + * the record. */ + int flags; /* Any combination of the values defined + * below. */ + const void* clientData; /* An alternate place to put option-specific + * data. Used for the monochrome default value + * for colors, etc. */ + int typeMask; /* An arbitrary bit mask defined by the class + * manager; typically bits correspond to + * certain kinds of options such as all those + * that require a redisplay when they change. + * Tk_SetOptions returns the bit-wise OR of + * the typeMasks of all options that were + * changed. */ +} Tk_OptionSpec; + +/* + * Flag values for Tk_OptionSpec structures. These flags are shared by + * Tk_ConfigSpec structures, so be sure to coordinate any changes carefully. + */ + +#define TK_OPTION_NULL_OK (1 << 0) +#define TK_OPTION_DONT_SET_DEFAULT (1 << 3) + +/* + * The following structure and function types are used by TK_OPTION_CUSTOM + * options; the structure holds pointers to the functions needed by the Tk + * option config code to handle a custom option. + */ + +typedef int(Tk_CustomOptionSetProc)( + ClientData clientData, + Tcl_Interp* interp, + Tk_Window tkwin, + Tcl_Obj** value, + char* widgRec, + int offset, + char* saveInternalPtr, + int flags); +typedef Tcl_Obj*(Tk_CustomOptionGetProc)( + ClientData clientData, + Tk_Window tkwin, + char* widgRec, + int offset); +typedef void(Tk_CustomOptionRestoreProc)( + ClientData clientData, + Tk_Window tkwin, + char* internalPtr, + char* saveInternalPtr); +typedef void(Tk_CustomOptionFreeProc)( + ClientData clientData, + Tk_Window tkwin, + char* internalPtr); + +typedef struct Tk_ObjCustomOption { + const char* name; /* Name of the custom option. */ + Tk_CustomOptionSetProc* setProc; + /* Function to use to set a record's option + * value from a Tcl_Obj */ + Tk_CustomOptionGetProc* getProc; + /* Function to use to get a Tcl_Obj + * representation from an internal + * representation of an option. */ + Tk_CustomOptionRestoreProc* restoreProc; + /* Function to use to restore a saved value + * for the internal representation. */ + Tk_CustomOptionFreeProc* freeProc; + /* Function to use to free the internal + * representation of an option. */ + ClientData clientData; /* Arbitrary one-word value passed to the + * handling procs. */ +} Tk_ObjCustomOption; + +/* + * Macro to use to fill in "offset" fields of the Tk_OptionSpec structure. + * Computes number of bytes from beginning of structure to a given field. + */ + +#ifdef offsetof +#define Tk_Offset(type, field) ((int)offsetof(type, field)) +#else +#define Tk_Offset(type, field) ((int)((char*)&((type*)0)->field)) +#endif + +/* + * The following two structures are used for error handling. When config + * options are being modified, the old values are saved in a Tk_SavedOptions + * structure. If an error occurs, then the contents of the structure can be + * used to restore all of the old values. The contents of this structure are + * for the private use Tk. No-one outside Tk should ever read or write any of + * the fields of these structures. + */ + +typedef struct Tk_SavedOption { + struct TkOption* optionPtr; /* Points to information that describes the + * option. */ + Tcl_Obj* valuePtr; /* The old value of the option, in the form of + * a Tcl object; may be NULL if the value was + * not saved as an object. */ + double internalForm; /* The old value of the option, in some + * internal representation such as an int or + * (XColor *). Valid only if the field + * optionPtr->specPtr->objOffset is < 0. The + * space must be large enough to accommodate a + * double, a long, or a pointer; right now it + * looks like a double (i.e., 8 bytes) is big + * enough. Also, using a double guarantees + * that the field is properly aligned for + * storing large values. */ +} Tk_SavedOption; + +#ifdef TCL_MEM_DEBUG +#define TK_NUM_SAVED_OPTIONS 2 +#else +#define TK_NUM_SAVED_OPTIONS 20 +#endif + +typedef struct Tk_SavedOptions { + char* recordPtr; /* The data structure in which to restore + * configuration options. */ + Tk_Window tkwin; /* Window associated with recordPtr; needed to + * restore certain options. */ + int numItems; /* The number of valid items in items field. */ + Tk_SavedOption items[TK_NUM_SAVED_OPTIONS]; + /* Items used to hold old values. */ + struct Tk_SavedOptions* nextPtr; + /* Points to next structure in list; needed if + * too many options changed to hold all the + * old values in a single structure. NULL + * means no more structures. */ +} Tk_SavedOptions; + +/* + * Structure used to describe application-specific configuration options: + * indicates procedures to call to parse an option and to return a text string + * describing an option. THESE ARE DEPRECATED; PLEASE USE THE NEW STRUCTURES + * LISTED ABOVE. + */ + +/* + * This is a temporary flag used while tkObjConfig and new widgets are in + * development. + */ + +#ifndef __NO_OLD_CONFIG + +typedef int(Tk_OptionParseProc)( + ClientData clientData, + Tcl_Interp* interp, + Tk_Window tkwin, + CONST84 char* value, + char* widgRec, + int offset); +typedef CONST86 char*(Tk_OptionPrintProc)( + ClientData clientData, + Tk_Window tkwin, + char* widgRec, + int offset, + Tcl_FreeProc** freeProcPtr); + +typedef struct Tk_CustomOption { + Tk_OptionParseProc* parseProc; + /* Procedure to call to parse an option and + * store it in converted form. */ + Tk_OptionPrintProc* printProc; + /* Procedure to return a printable string + * describing an existing option. */ + ClientData clientData; /* Arbitrary one-word value used by option + * parser: passed to parseProc and + * printProc. */ +} Tk_CustomOption; + +/* + * Structure used to specify information for Tk_ConfigureWidget. Each + * structure gives complete information for one option, including how the + * option is specified on the command line, where it appears in the option + * database, etc. + */ + +typedef struct Tk_ConfigSpec { + int type; /* Type of option, such as TK_CONFIG_COLOR; + * see definitions below. Last option in table + * must have type TK_CONFIG_END. */ + CONST86 char* argvName; /* Switch used to specify option in argv. NULL + * means this spec is part of a group. */ + Tk_Uid dbName; /* Name for option in option database. */ + Tk_Uid dbClass; /* Class for option in database. */ + Tk_Uid defValue; /* Default value for option if not specified + * in command line or database. */ + int offset; /* Where in widget record to store value; use + * Tk_Offset macro to generate values for + * this. */ + int specFlags; /* Any combination of the values defined + * below; other bits are used internally by + * tkConfig.c. */ + CONST86 Tk_CustomOption* customPtr; + /* If type is TK_CONFIG_CUSTOM then this is a + * pointer to info about how to parse and + * print the option. Otherwise it is + * irrelevant. */ +} Tk_ConfigSpec; + +/* + * Type values for Tk_ConfigSpec structures. See the user documentation for + * details. + */ + +typedef enum { + TK_CONFIG_BOOLEAN, + TK_CONFIG_INT, + TK_CONFIG_DOUBLE, + TK_CONFIG_STRING, + TK_CONFIG_UID, + TK_CONFIG_COLOR, + TK_CONFIG_FONT, + TK_CONFIG_BITMAP, + TK_CONFIG_BORDER, + TK_CONFIG_RELIEF, + TK_CONFIG_CURSOR, + TK_CONFIG_ACTIVE_CURSOR, + TK_CONFIG_JUSTIFY, + TK_CONFIG_ANCHOR, + TK_CONFIG_SYNONYM, + TK_CONFIG_CAP_STYLE, + TK_CONFIG_JOIN_STYLE, + TK_CONFIG_PIXELS, + TK_CONFIG_MM, + TK_CONFIG_WINDOW, + TK_CONFIG_CUSTOM, + TK_CONFIG_END +} Tk_ConfigTypes; + +/* + * Possible values for flags argument to Tk_ConfigureWidget: + */ + +#define TK_CONFIG_ARGV_ONLY 1 +#define TK_CONFIG_OBJS 0x80 + +/* + * Possible flag values for Tk_ConfigSpec structures. Any bits at or above + * TK_CONFIG_USER_BIT may be used by clients for selecting certain entries. + * Before changing any values here, coordinate with tkOldConfig.c + * (internal-use-only flags are defined there). + */ + +#define TK_CONFIG_NULL_OK (1 << 0) +#define TK_CONFIG_COLOR_ONLY (1 << 1) +#define TK_CONFIG_MONO_ONLY (1 << 2) +#define TK_CONFIG_DONT_SET_DEFAULT (1 << 3) +#define TK_CONFIG_OPTION_SPECIFIED (1 << 4) +#define TK_CONFIG_USER_BIT 0x100 +#endif /* __NO_OLD_CONFIG */ + +/* + * Structure used to specify how to handle argv options. + */ + +typedef struct { + CONST86 char* key; /* The key string that flags the option in the + * argv array. */ + int type; /* Indicates option type; see below. */ + char* src; /* Value to be used in setting dst; usage + * depends on type. */ + char* dst; /* Address of value to be modified; usage + * depends on type. */ + CONST86 char* help; /* Documentation message describing this + * option. */ +} Tk_ArgvInfo; + +/* + * Legal values for the type field of a Tk_ArgvInfo: see the user + * documentation for details. + */ + +#define TK_ARGV_CONSTANT 15 +#define TK_ARGV_INT 16 +#define TK_ARGV_STRING 17 +#define TK_ARGV_UID 18 +#define TK_ARGV_REST 19 +#define TK_ARGV_FLOAT 20 +#define TK_ARGV_FUNC 21 +#define TK_ARGV_GENFUNC 22 +#define TK_ARGV_HELP 23 +#define TK_ARGV_CONST_OPTION 24 +#define TK_ARGV_OPTION_VALUE 25 +#define TK_ARGV_OPTION_NAME_VALUE 26 +#define TK_ARGV_END 27 + +/* + * Flag bits for passing to Tk_ParseArgv: + */ + +#define TK_ARGV_NO_DEFAULTS 0x1 +#define TK_ARGV_NO_LEFTOVERS 0x2 +#define TK_ARGV_NO_ABBREV 0x4 +#define TK_ARGV_DONT_SKIP_FIRST_ARG 0x8 + +/* + * Enumerated type for describing actions to be taken in response to a + * restrictProc established by Tk_RestrictEvents. + */ + +typedef enum { + TK_DEFER_EVENT, + TK_PROCESS_EVENT, + TK_DISCARD_EVENT +} Tk_RestrictAction; + +/* + * Priority levels to pass to Tk_AddOption: + */ + +#define TK_WIDGET_DEFAULT_PRIO 20 +#define TK_STARTUP_FILE_PRIO 40 +#define TK_USER_DEFAULT_PRIO 60 +#define TK_INTERACTIVE_PRIO 80 +#define TK_MAX_PRIO 100 + +/* + * Relief values returned by Tk_GetRelief: + */ + +#define TK_RELIEF_NULL -1 +#define TK_RELIEF_FLAT 0 +#define TK_RELIEF_GROOVE 1 +#define TK_RELIEF_RAISED 2 +#define TK_RELIEF_RIDGE 3 +#define TK_RELIEF_SOLID 4 +#define TK_RELIEF_SUNKEN 5 + +/* + * "Which" argument values for Tk_3DBorderGC: + */ + +#define TK_3D_FLAT_GC 1 +#define TK_3D_LIGHT_GC 2 +#define TK_3D_DARK_GC 3 + +/* + * Special EnterNotify/LeaveNotify "mode" for use in events generated by + * tkShare.c. Pick a high enough value that it's unlikely to conflict with + * existing values (like NotifyNormal) or any new values defined in the + * future. + */ + +#define TK_NOTIFY_SHARE 20 + +/* + * Enumerated type for describing a point by which to anchor something: + */ + +typedef enum { + TK_ANCHOR_N, + TK_ANCHOR_NE, + TK_ANCHOR_E, + TK_ANCHOR_SE, + TK_ANCHOR_S, + TK_ANCHOR_SW, + TK_ANCHOR_W, + TK_ANCHOR_NW, + TK_ANCHOR_CENTER +} Tk_Anchor; + +/* + * Enumerated type for describing a style of justification: + */ + +typedef enum { + TK_JUSTIFY_LEFT, + TK_JUSTIFY_RIGHT, + TK_JUSTIFY_CENTER +} Tk_Justify; + +/* + * The following structure is used by Tk_GetFontMetrics() to return + * information about the properties of a Tk_Font. + */ + +typedef struct Tk_FontMetrics { + int ascent; /* The amount in pixels that the tallest + * letter sticks up above the baseline, plus + * any extra blank space added by the designer + * of the font. */ + int descent; /* The largest amount in pixels that any + * letter sticks below the baseline, plus any + * extra blank space added by the designer of + * the font. */ + int linespace; /* The sum of the ascent and descent. How far + * apart two lines of text in the same font + * should be placed so that none of the + * characters in one line overlap any of the + * characters in the other line. */ +} Tk_FontMetrics; + +/* + * Flags passed to Tk_MeasureChars: + */ + +#define TK_WHOLE_WORDS 1 +#define TK_AT_LEAST_ONE 2 +#define TK_PARTIAL_OK 4 + +/* + * Flags passed to Tk_ComputeTextLayout: + */ + +#define TK_IGNORE_TABS 8 +#define TK_IGNORE_NEWLINES 16 + +/* + * Widget class procedures used to implement platform specific widget + * behavior. + */ + +typedef Window(Tk_ClassCreateProc)( + Tk_Window tkwin, + Window parent, + ClientData instanceData); +typedef void(Tk_ClassWorldChangedProc)(ClientData instanceData); +typedef void(Tk_ClassModalProc)(Tk_Window tkwin, XEvent* eventPtr); + +typedef struct Tk_ClassProcs { + unsigned int size; + Tk_ClassWorldChangedProc* worldChangedProc; + /* Procedure to invoke when the widget needs + * to respond in some way to a change in the + * world (font changes, etc.) */ + Tk_ClassCreateProc* createProc; + /* Procedure to invoke when the platform- + * dependent window needs to be created. */ + Tk_ClassModalProc* modalProc; + /* Procedure to invoke after all bindings on a + * widget have been triggered in order to + * handle a modal loop. */ +} Tk_ClassProcs; + +/* + * Simple accessor for Tk_ClassProcs structure. Checks that the structure is + * not NULL, then checks the size field and returns either the requested + * field, if present, or NULL if the structure is too small to have the field + * (or NULL if the structure is NULL). + * + * A more general version of this function may be useful if other + * size-versioned structure pop up in the future: + * + * #define Tk_GetField(name, who, which) \ + * (((who) == NULL) ? NULL : + * (((who)->size <= Tk_Offset(name, which)) ? NULL :(name)->which)) + */ + +#define Tk_GetClassProc(procs, which) \ + (((procs) == NULL) ? NULL \ + : (((procs)->size <= Tk_Offset(Tk_ClassProcs, which)) \ + ? NULL \ + : (procs)->which)) + +/* + * Each geometry manager (the packer, the placer, etc.) is represented by a + * structure of the following form, which indicates procedures to invoke in + * the geometry manager to carry out certain functions. + */ + +typedef void(Tk_GeomRequestProc)(ClientData clientData, Tk_Window tkwin); +typedef void(Tk_GeomLostSlaveProc)(ClientData clientData, Tk_Window tkwin); + +typedef struct Tk_GeomMgr { + const char* name; /* Name of the geometry manager (command used + * to invoke it, or name of widget class that + * allows embedded widgets). */ + Tk_GeomRequestProc* requestProc; + /* Procedure to invoke when a slave's + * requested geometry changes. */ + Tk_GeomLostSlaveProc* lostSlaveProc; + /* Procedure to invoke when a slave is taken + * away from one geometry manager by another. + * NULL means geometry manager doesn't care + * when slaves are lost. */ +} Tk_GeomMgr; + +/* + * Result values returned by Tk_GetScrollInfo: + */ + +#define TK_SCROLL_MOVETO 1 +#define TK_SCROLL_PAGES 2 +#define TK_SCROLL_UNITS 3 +#define TK_SCROLL_ERROR 4 + +/* + *---------------------------------------------------------------------- + * + * Extensions to the X event set + * + *---------------------------------------------------------------------- + */ + +#define VirtualEvent (MappingNotify + 1) +#define ActivateNotify (MappingNotify + 2) +#define DeactivateNotify (MappingNotify + 3) +#define MouseWheelEvent (MappingNotify + 4) +#define TK_LASTEVENT (MappingNotify + 5) + +#define MouseWheelMask (1L << 28) +#define ActivateMask (1L << 29) +#define VirtualEventMask (1L << 30) + +/* + * A virtual event shares most of its fields with the XKeyEvent and + * XButtonEvent structures. 99% of the time a virtual event will be an + * abstraction of a key or button event, so this structure provides the most + * information to the user. The only difference is the changing of the detail + * field for a virtual event so that it holds the name of the virtual event + * being triggered. + * + * When using this structure, you should ensure that you zero out all the + * fields first using memset() or bzero(). + */ + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server. */ + Bool send_event; /* True if this came from a SendEvent + * request. */ + Display* display; /* Display the event was read from. */ + Window event; /* Window on which event was requested. */ + Window root; /* Root window that the event occured on. */ + Window subwindow; /* Child window. */ + Time time; /* Milliseconds. */ + int x, y; /* Pointer x, y coordinates in event + * window. */ + int x_root, y_root; /* Coordinates relative to root. */ + unsigned int state; /* Key or button mask */ + Tk_Uid name; /* Name of virtual event. */ + Bool same_screen; /* Same screen flag. */ + Tcl_Obj* user_data; /* Application-specific data reference; Tk + * will decrement the reference count *once* + * when it has finished processing the + * event. */ +} XVirtualEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server. */ + Bool send_event; /* True if this came from a SendEvent + * request. */ + Display* display; /* Display the event was read from. */ + Window window; /* Window in which event occurred. */ +} XActivateDeactivateEvent; +typedef XActivateDeactivateEvent XActivateEvent; +typedef XActivateDeactivateEvent XDeactivateEvent; + +/* + *---------------------------------------------------------------------- + * + * Macros for querying Tk_Window structures. See the manual entries for + * documentation. + * + *---------------------------------------------------------------------- + */ + +#define Tk_Display(tkwin) (((Tk_FakeWin*)(tkwin))->display) +#define Tk_ScreenNumber(tkwin) (((Tk_FakeWin*)(tkwin))->screenNum) +#define Tk_Screen(tkwin) \ + (ScreenOfDisplay(Tk_Display(tkwin), Tk_ScreenNumber(tkwin))) +#define Tk_Depth(tkwin) (((Tk_FakeWin*)(tkwin))->depth) +#define Tk_Visual(tkwin) (((Tk_FakeWin*)(tkwin))->visual) +#define Tk_WindowId(tkwin) (((Tk_FakeWin*)(tkwin))->window) +#define Tk_PathName(tkwin) (((Tk_FakeWin*)(tkwin))->pathName) +#define Tk_Name(tkwin) (((Tk_FakeWin*)(tkwin))->nameUid) +#define Tk_Class(tkwin) (((Tk_FakeWin*)(tkwin))->classUid) +#define Tk_X(tkwin) (((Tk_FakeWin*)(tkwin))->changes.x) +#define Tk_Y(tkwin) (((Tk_FakeWin*)(tkwin))->changes.y) +#define Tk_Width(tkwin) (((Tk_FakeWin*)(tkwin))->changes.width) +#define Tk_Height(tkwin) (((Tk_FakeWin*)(tkwin))->changes.height) +#define Tk_Changes(tkwin) (&((Tk_FakeWin*)(tkwin))->changes) +#define Tk_Attributes(tkwin) (&((Tk_FakeWin*)(tkwin))->atts) +#define Tk_IsEmbedded(tkwin) (((Tk_FakeWin*)(tkwin))->flags & TK_EMBEDDED) +#define Tk_IsContainer(tkwin) (((Tk_FakeWin*)(tkwin))->flags & TK_CONTAINER) +#define Tk_IsMapped(tkwin) (((Tk_FakeWin*)(tkwin))->flags & TK_MAPPED) +#define Tk_IsTopLevel(tkwin) (((Tk_FakeWin*)(tkwin))->flags & TK_TOP_LEVEL) +#define Tk_HasWrapper(tkwin) (((Tk_FakeWin*)(tkwin))->flags & TK_HAS_WRAPPER) +#define Tk_WinManaged(tkwin) (((Tk_FakeWin*)(tkwin))->flags & TK_WIN_MANAGED) +#define Tk_TopWinHierarchy(tkwin) \ + (((Tk_FakeWin*)(tkwin))->flags & TK_TOP_HIERARCHY) +#define Tk_IsManageable(tkwin) \ + (((Tk_FakeWin*)(tkwin))->flags & TK_WM_MANAGEABLE) +#define Tk_ReqWidth(tkwin) (((Tk_FakeWin*)(tkwin))->reqWidth) +#define Tk_ReqHeight(tkwin) (((Tk_FakeWin*)(tkwin))->reqHeight) +/* Tk_InternalBorderWidth is deprecated */ +#define Tk_InternalBorderWidth(tkwin) \ + (((Tk_FakeWin*)(tkwin))->internalBorderLeft) +#define Tk_InternalBorderLeft(tkwin) \ + (((Tk_FakeWin*)(tkwin))->internalBorderLeft) +#define Tk_InternalBorderRight(tkwin) \ + (((Tk_FakeWin*)(tkwin))->internalBorderRight) +#define Tk_InternalBorderTop(tkwin) (((Tk_FakeWin*)(tkwin))->internalBorderTop) +#define Tk_InternalBorderBottom(tkwin) \ + (((Tk_FakeWin*)(tkwin))->internalBorderBottom) +#define Tk_MinReqWidth(tkwin) (((Tk_FakeWin*)(tkwin))->minReqWidth) +#define Tk_MinReqHeight(tkwin) (((Tk_FakeWin*)(tkwin))->minReqHeight) +#define Tk_Parent(tkwin) (((Tk_FakeWin*)(tkwin))->parentPtr) +#define Tk_Colormap(tkwin) (((Tk_FakeWin*)(tkwin))->atts.colormap) + +/* + * The structure below is needed by the macros above so that they can access + * the fields of a Tk_Window. The fields not needed by the macros are declared + * as "dummyX". The structure has its own type in order to prevent apps from + * accessing Tk_Window fields except using official macros. WARNING!! The + * structure definition must be kept consistent with the TkWindow structure in + * tkInt.h. If you change one, then change the other. See the declaration in + * tkInt.h for documentation on what the fields are used for internally. + */ + +typedef struct Tk_FakeWin { + Display* display; + char* dummy1; /* dispPtr */ + int screenNum; + Visual* visual; + int depth; + Window window; + char* dummy2; /* childList */ + char* dummy3; /* lastChildPtr */ + Tk_Window parentPtr; /* parentPtr */ + char* dummy4; /* nextPtr */ + char* dummy5; /* mainPtr */ + char* pathName; + Tk_Uid nameUid; + Tk_Uid classUid; + XWindowChanges changes; + unsigned int dummy6; /* dirtyChanges */ + XSetWindowAttributes atts; + unsigned long dummy7; /* dirtyAtts */ + unsigned int flags; + char* dummy8; /* handlerList */ +#ifdef TK_USE_INPUT_METHODS + XIC dummy9; /* inputContext */ +#endif /* TK_USE_INPUT_METHODS */ + ClientData* dummy10; /* tagPtr */ + int dummy11; /* numTags */ + int dummy12; /* optionLevel */ + char* dummy13; /* selHandlerList */ + char* dummy14; /* geomMgrPtr */ + ClientData dummy15; /* geomData */ + int reqWidth, reqHeight; + int internalBorderLeft; + char* dummy16; /* wmInfoPtr */ + char* dummy17; /* classProcPtr */ + ClientData dummy18; /* instanceData */ + char* dummy19; /* privatePtr */ + int internalBorderRight; + int internalBorderTop; + int internalBorderBottom; + int minReqWidth; + int minReqHeight; + char* dummy20; /* geometryMaster */ +#ifdef TK_USE_INPUT_METHODS + int dummy21; +#endif /* TK_USE_INPUT_METHODS */ +} Tk_FakeWin; + +/* + * Flag values for TkWindow (and Tk_FakeWin) structures are: + * + * TK_MAPPED: 1 means window is currently mapped, + * 0 means unmapped. + * TK_TOP_LEVEL: 1 means this is a top-level widget. + * TK_ALREADY_DEAD: 1 means the window is in the process of + * being destroyed already. + * TK_NEED_CONFIG_NOTIFY: 1 means that the window has been reconfigured + * before it was made to exist. At the time of + * making it exist a ConfigureNotify event needs + * to be generated. + * TK_GRAB_FLAG: Used to manage grabs. See tkGrab.c for details + * TK_CHECKED_IC: 1 means we've already tried to get an input + * context for this window; if the ic field is + * NULL it means that there isn't a context for + * the field. + * TK_DONT_DESTROY_WINDOW: 1 means that Tk_DestroyWindow should not + * invoke XDestroyWindow to destroy this widget's + * X window. The flag is set when the window has + * already been destroyed elsewhere (e.g. by + * another application) or when it will be + * destroyed later (e.g. by destroying its parent) + * TK_WM_COLORMAP_WINDOW: 1 means that this window has at some time + * appeared in the WM_COLORMAP_WINDOWS property + * for its toplevel, so we have to remove it from + * that property if the window is deleted and the + * toplevel isn't. + * TK_EMBEDDED: 1 means that this window (which must be a + * toplevel) is not a free-standing window but + * rather is embedded in some other application. + * TK_CONTAINER: 1 means that this window is a container, and + * that some other application (either in this + * process or elsewhere) may be embedding itself + * inside the window. + * TK_BOTH_HALVES: 1 means that this window is used for + * application embedding (either as container or + * embedded application), and both the containing + * and embedded halves are associated with + * windows in this particular process. + * TK_WRAPPER: 1 means that this window is the extra wrapper + * window created around a toplevel to hold the + * menubar under Unix. See tkUnixWm.c for more + * information. + * TK_REPARENTED: 1 means that this window has been reparented + * so that as far as the window system is + * concerned it isn't a child of its Tk parent. + * Initially this is used only for special Unix + * menubar windows. + * TK_ANONYMOUS_WINDOW: 1 means that this window has no name, and is + * thus not accessible from Tk. + * TK_HAS_WRAPPER 1 means that this window has a wrapper window + * TK_WIN_MANAGED 1 means that this window is a child of the root + * window, and is managed by the window manager. + * TK_TOP_HIERARCHY 1 means this window is at the top of a physical + * window hierarchy within this process, i.e. the + * window's parent either doesn't exist or is not + * owned by this Tk application. + * TK_PROP_PROPCHANGE 1 means that PropertyNotify events in the + * window's children should propagate up to this + * window. + * TK_WM_MANAGEABLE 1 marks a window as capable of being converted + * into a toplevel using [wm manage]. + */ + +#define TK_MAPPED 1 +#define TK_TOP_LEVEL 2 +#define TK_ALREADY_DEAD 4 +#define TK_NEED_CONFIG_NOTIFY 8 +#define TK_GRAB_FLAG 0x10 +#define TK_CHECKED_IC 0x20 +#define TK_DONT_DESTROY_WINDOW 0x40 +#define TK_WM_COLORMAP_WINDOW 0x80 +#define TK_EMBEDDED 0x100 +#define TK_CONTAINER 0x200 +#define TK_BOTH_HALVES 0x400 +#define TK_WRAPPER 0x1000 +#define TK_REPARENTED 0x2000 +#define TK_ANONYMOUS_WINDOW 0x4000 +#define TK_HAS_WRAPPER 0x8000 +#define TK_WIN_MANAGED 0x10000 +#define TK_TOP_HIERARCHY 0x20000 +#define TK_PROP_PROPCHANGE 0x40000 +#define TK_WM_MANAGEABLE 0x80000 + +/* + *---------------------------------------------------------------------- + * + * Procedure prototypes and structures used for defining new canvas items: + * + *---------------------------------------------------------------------- + */ + +typedef enum { + TK_STATE_NULL = -1, + TK_STATE_ACTIVE, + TK_STATE_DISABLED, + TK_STATE_NORMAL, + TK_STATE_HIDDEN +} Tk_State; + +typedef struct Tk_SmoothMethod { + CONST86 char* name; + int (*coordProc)( + Tk_Canvas canvas, + double* pointPtr, + int numPoints, + int numSteps, + XPoint xPoints[], + double dblPoints[]); + void (*postscriptProc)( + Tcl_Interp* interp, + Tk_Canvas canvas, + double* coordPtr, + int numPoints, + int numSteps); +} Tk_SmoothMethod; + +/* + * For each item in a canvas widget there exists one record with the following + * structure. Each actual item is represented by a record with the following + * stuff at its beginning, plus additional type-specific stuff after that. + */ + +#define TK_TAG_SPACE 3 + +typedef struct Tk_Item { + int id; /* Unique identifier for this item (also + * serves as first tag for item). */ + struct Tk_Item* nextPtr; /* Next in display list of all items in this + * canvas. Later items in list are drawn on + * top of earlier ones. */ + Tk_Uid staticTagSpace[TK_TAG_SPACE]; + /* Built-in space for limited # of tags. */ + Tk_Uid* tagPtr; /* Pointer to array of tags. Usually points to + * staticTagSpace, but may point to malloc-ed + * space if there are lots of tags. */ + int tagSpace; /* Total amount of tag space available at + * tagPtr. */ + int numTags; /* Number of tag slots actually used at + * *tagPtr. */ + struct Tk_ItemType* typePtr; /* Table of procedures that implement this + * type of item. */ + int x1, y1, x2, y2; /* Bounding box for item, in integer canvas + * units. Set by item-specific code and + * guaranteed to contain every pixel drawn in + * item. Item area includes x1 and y1 but not + * x2 and y2. */ + struct Tk_Item* prevPtr; /* Previous in display list of all items in + * this canvas. Later items in list are drawn + * just below earlier ones. */ + Tk_State state; /* State of item. */ + char* reserved1; /* reserved for future use */ + int redraw_flags; /* Some flags used in the canvas */ + + /* + *------------------------------------------------------------------ + * Starting here is additional type-specific stuff; see the declarations + * for individual types to see what is part of each type. The actual space + * below is determined by the "itemInfoSize" of the type's Tk_ItemType + * record. + *------------------------------------------------------------------ + */ +} Tk_Item; + +/* + * Flag bits for canvases (redraw_flags): + * + * TK_ITEM_STATE_DEPENDANT - 1 means that object needs to be redrawn if the + * canvas state changes. + * TK_ITEM_DONT_REDRAW - 1 means that the object redraw is already been + * prepared, so the general canvas code doesn't + * need to do that any more. + */ + +#define TK_ITEM_STATE_DEPENDANT 1 +#define TK_ITEM_DONT_REDRAW 2 + +/* + * Records of the following type are used to describe a type of item (e.g. + * lines, circles, etc.) that can form part of a canvas widget. + */ + +#ifdef USE_OLD_CANVAS +typedef int(Tk_ItemCreateProc)( + Tcl_Interp* interp, + Tk_Canvas canvas, + Tk_Item* itemPtr, + int argc, + char** argv); +typedef int(Tk_ItemConfigureProc)( + Tcl_Interp* interp, + Tk_Canvas canvas, + Tk_Item* itemPtr, + int argc, + char** argv, + int flags); +typedef int(Tk_ItemCoordProc)( + Tcl_Interp* interp, + Tk_Canvas canvas, + Tk_Item* itemPtr, + int argc, + char** argv); +#else +typedef int(Tk_ItemCreateProc)( + Tcl_Interp* interp, + Tk_Canvas canvas, + Tk_Item* itemPtr, + int argc, + Tcl_Obj* const objv[]); +typedef int(Tk_ItemConfigureProc)( + Tcl_Interp* interp, + Tk_Canvas canvas, + Tk_Item* itemPtr, + int argc, + Tcl_Obj* const objv[], + int flags); +typedef int(Tk_ItemCoordProc)( + Tcl_Interp* interp, + Tk_Canvas canvas, + Tk_Item* itemPtr, + int argc, + Tcl_Obj* const argv[]); +#endif /* USE_OLD_CANVAS */ +typedef void( + Tk_ItemDeleteProc)(Tk_Canvas canvas, Tk_Item* itemPtr, Display* display); +typedef void(Tk_ItemDisplayProc)( + Tk_Canvas canvas, + Tk_Item* itemPtr, + Display* display, + Drawable dst, + int x, + int y, + int width, + int height); +typedef double( + Tk_ItemPointProc)(Tk_Canvas canvas, Tk_Item* itemPtr, double* pointPtr); +typedef int( + Tk_ItemAreaProc)(Tk_Canvas canvas, Tk_Item* itemPtr, double* rectPtr); +typedef int(Tk_ItemPostscriptProc)( + Tcl_Interp* interp, + Tk_Canvas canvas, + Tk_Item* itemPtr, + int prepass); +typedef void(Tk_ItemScaleProc)( + Tk_Canvas canvas, + Tk_Item* itemPtr, + double originX, + double originY, + double scaleX, + double scaleY); +typedef void(Tk_ItemTranslateProc)( + Tk_Canvas canvas, + Tk_Item* itemPtr, + double deltaX, + double deltaY); +#ifdef USE_OLD_CANVAS +typedef int(Tk_ItemIndexProc)( + Tcl_Interp* interp, + Tk_Canvas canvas, + Tk_Item* itemPtr, + char* indexString, + int* indexPtr); +#else +typedef int(Tk_ItemIndexProc)( + Tcl_Interp* interp, + Tk_Canvas canvas, + Tk_Item* itemPtr, + Tcl_Obj* indexString, + int* indexPtr); +#endif /* USE_OLD_CANVAS */ +typedef void(Tk_ItemCursorProc)(Tk_Canvas canvas, Tk_Item* itemPtr, int index); +typedef int(Tk_ItemSelectionProc)( + Tk_Canvas canvas, + Tk_Item* itemPtr, + int offset, + char* buffer, + int maxBytes); +#ifdef USE_OLD_CANVAS +typedef void(Tk_ItemInsertProc)( + Tk_Canvas canvas, + Tk_Item* itemPtr, + int beforeThis, + char* string); +#else +typedef void(Tk_ItemInsertProc)( + Tk_Canvas canvas, + Tk_Item* itemPtr, + int beforeThis, + Tcl_Obj* string); +#endif /* USE_OLD_CANVAS */ +typedef void( + Tk_ItemDCharsProc)(Tk_Canvas canvas, Tk_Item* itemPtr, int first, int last); + +#ifndef __NO_OLD_CONFIG + +typedef struct Tk_ItemType { + CONST86 char* name; /* The name of this type of item, such as + * "line". */ + int itemSize; /* Total amount of space needed for item's + * record. */ + Tk_ItemCreateProc* createProc; + /* Procedure to create a new item of this + * type. */ + CONST86 Tk_ConfigSpec* + configSpecs; /* Pointer to array of configuration specs for + * this type. Used for returning configuration + * info. */ + Tk_ItemConfigureProc* configProc; + /* Procedure to call to change configuration + * options. */ + Tk_ItemCoordProc* coordProc; /* Procedure to call to get and set the item's + * coordinates. */ + Tk_ItemDeleteProc* deleteProc; + /* Procedure to delete existing item of this + * type. */ + Tk_ItemDisplayProc* displayProc; + /* Procedure to display items of this type. */ + int alwaysRedraw; /* Non-zero means displayProc should be called + * even when the item has been moved + * off-screen. */ + Tk_ItemPointProc* pointProc; /* Computes distance from item to a given + * point. */ + Tk_ItemAreaProc* areaProc; /* Computes whether item is inside, outside, + * or overlapping an area. */ + Tk_ItemPostscriptProc* postscriptProc; + /* Procedure to write a Postscript description + * for items of this type. */ + Tk_ItemScaleProc* scaleProc; /* Procedure to rescale items of this type. */ + Tk_ItemTranslateProc* translateProc; + /* Procedure to translate items of this + * type. */ + Tk_ItemIndexProc* indexProc; /* Procedure to determine index of indicated + * character. NULL if item doesn't support + * indexing. */ + Tk_ItemCursorProc* icursorProc; + /* Procedure to set insert cursor posn to just + * before a given position. */ + Tk_ItemSelectionProc* selectionProc; + /* Procedure to return selection (in STRING + * format) when it is in this item. */ + Tk_ItemInsertProc* insertProc; + /* Procedure to insert something into an + * item. */ + Tk_ItemDCharsProc* dCharsProc; + /* Procedure to delete characters from an + * item. */ + struct Tk_ItemType* nextPtr; /* Used to link types together into a list. */ + char* reserved1; /* Reserved for future extension. */ + int reserved2; /* Carefully compatible with */ + char* reserved3; /* Jan Nijtmans dash patch */ + char* reserved4; +} Tk_ItemType; + +/* + * Flag (used in the alwaysRedraw field) to say whether an item supports + * point-level manipulation like the line and polygon items. + */ + +#define TK_MOVABLE_POINTS 2 + +#endif /* __NO_OLD_CONFIG */ + +/* + * The following structure provides information about the selection and the + * insertion cursor. It is needed by only a few items, such as those that + * display text. It is shared by the generic canvas code and the item-specific + * code, but most of the fields should be written only by the canvas generic + * code. + */ + +typedef struct Tk_CanvasTextInfo { + Tk_3DBorder selBorder; /* Border and background for selected + * characters. Read-only to items.*/ + int selBorderWidth; /* Width of border around selection. Read-only + * to items. */ + XColor* selFgColorPtr; /* Foreground color for selected text. + * Read-only to items. */ + Tk_Item* selItemPtr; /* Pointer to selected item. NULL means + * selection isn't in this canvas. Writable by + * items. */ + int selectFirst; /* Character index of first selected + * character. Writable by items. */ + int selectLast; /* Character index of last selected character. + * Writable by items. */ + Tk_Item* anchorItemPtr; /* Item corresponding to "selectAnchor": not + * necessarily selItemPtr. Read-only to + * items. */ + int selectAnchor; /* Character index of fixed end of selection + * (i.e. "select to" operation will use this + * as one end of the selection). Writable by + * items. */ + Tk_3DBorder insertBorder; /* Used to draw vertical bar for insertion + * cursor. Read-only to items. */ + int insertWidth; /* Total width of insertion cursor. Read-only + * to items. */ + int insertBorderWidth; /* Width of 3-D border around insert cursor. + * Read-only to items. */ + Tk_Item* focusItemPtr; /* Item that currently has the input focus, or + * NULL if no such item. Read-only to items. */ + int gotFocus; /* Non-zero means that the canvas widget has + * the input focus. Read-only to items.*/ + int cursorOn; /* Non-zero means that an insertion cursor + * should be displayed in focusItemPtr. + * Read-only to items.*/ +} Tk_CanvasTextInfo; + +/* + * Structures used for Dashing and Outline. + */ + +typedef struct Tk_Dash { + int number; + union { + char* pt; + char array[sizeof(char*)]; + } pattern; +} Tk_Dash; + +typedef struct Tk_TSOffset { + int flags; /* Flags; see below for possible values */ + int xoffset; /* x offset */ + int yoffset; /* y offset */ +} Tk_TSOffset; + +/* + * Bit fields in Tk_Offset->flags: + */ + +#define TK_OFFSET_INDEX 1 +#define TK_OFFSET_RELATIVE 2 +#define TK_OFFSET_LEFT 4 +#define TK_OFFSET_CENTER 8 +#define TK_OFFSET_RIGHT 16 +#define TK_OFFSET_TOP 32 +#define TK_OFFSET_MIDDLE 64 +#define TK_OFFSET_BOTTOM 128 + +typedef struct Tk_Outline { + GC gc; /* Graphics context. */ + double width; /* Width of outline. */ + double activeWidth; /* Width of outline. */ + double disabledWidth; /* Width of outline. */ + int offset; /* Dash offset. */ + Tk_Dash dash; /* Dash pattern. */ + Tk_Dash activeDash; /* Dash pattern if state is active. */ + Tk_Dash disabledDash; /* Dash pattern if state is disabled. */ + void* reserved1; /* Reserved for future expansion. */ + void* reserved2; + void* reserved3; + Tk_TSOffset tsoffset; /* Stipple offset for outline. */ + XColor* color; /* Outline color. */ + XColor* activeColor; /* Outline color if state is active. */ + XColor* disabledColor; /* Outline color if state is disabled. */ + Pixmap stipple; /* Outline Stipple pattern. */ + Pixmap activeStipple; /* Outline Stipple pattern if state is + * active. */ + Pixmap disabledStipple; /* Outline Stipple pattern if state is + * disabled. */ +} Tk_Outline; + +/* + *---------------------------------------------------------------------- + * + * Procedure prototypes and structures used for managing images: + * + *---------------------------------------------------------------------- + */ + +typedef struct Tk_ImageType Tk_ImageType; +#ifdef USE_OLD_IMAGE +typedef int(Tk_ImageCreateProc)( + Tcl_Interp* interp, + char* name, + int argc, + char** argv, + Tk_ImageType* typePtr, + Tk_ImageMaster master, + ClientData* masterDataPtr); +#else +typedef int(Tk_ImageCreateProc)( + Tcl_Interp* interp, + CONST86 char* name, + int objc, + Tcl_Obj* const objv[], + CONST86 Tk_ImageType* typePtr, + Tk_ImageMaster master, + ClientData* masterDataPtr); +#endif /* USE_OLD_IMAGE */ +typedef ClientData(Tk_ImageGetProc)(Tk_Window tkwin, ClientData masterData); +typedef void(Tk_ImageDisplayProc)( + ClientData instanceData, + Display* display, + Drawable drawable, + int imageX, + int imageY, + int width, + int height, + int drawableX, + int drawableY); +typedef void(Tk_ImageFreeProc)(ClientData instanceData, Display* display); +typedef void(Tk_ImageDeleteProc)(ClientData masterData); +typedef void(Tk_ImageChangedProc)( + ClientData clientData, + int x, + int y, + int width, + int height, + int imageWidth, + int imageHeight); +typedef int(Tk_ImagePostscriptProc)( + ClientData clientData, + Tcl_Interp* interp, + Tk_Window tkwin, + Tk_PostscriptInfo psinfo, + int x, + int y, + int width, + int height, + int prepass); + +/* + * The following structure represents a particular type of image (bitmap, xpm + * image, etc.). It provides information common to all images of that type, + * such as the type name and a collection of procedures in the image manager + * that respond to various events. Each image manager is represented by one of + * these structures. + */ + +struct Tk_ImageType { + CONST86 char* name; /* Name of image type. */ + Tk_ImageCreateProc* createProc; + /* Procedure to call to create a new image of + * this type. */ + Tk_ImageGetProc* getProc; /* Procedure to call the first time + * Tk_GetImage is called in a new way (new + * visual or screen). */ + Tk_ImageDisplayProc* displayProc; + /* Call to draw image, in response to + * Tk_RedrawImage calls. */ + Tk_ImageFreeProc* freeProc; /* Procedure to call whenever Tk_FreeImage is + * called to release an instance of an + * image. */ + Tk_ImageDeleteProc* deleteProc; + /* Procedure to call to delete image. It will + * not be called until after freeProc has been + * called for each instance of the image. */ + Tk_ImagePostscriptProc* postscriptProc; + /* Procedure to call to produce postscript + * output for the image. */ + struct Tk_ImageType* nextPtr; + /* Next in list of all image types currently + * known. Filled in by Tk, not by image + * manager. */ + char* reserved; /* reserved for future expansion */ +}; + +/* + *---------------------------------------------------------------------- + * + * Additional definitions used to manage images of type "photo". + * + *---------------------------------------------------------------------- + */ + +/* + * The following type is used to identify a particular photo image to be + * manipulated: + */ + +typedef void* Tk_PhotoHandle; + +/* + * The following structure describes a block of pixels in memory: + */ + +typedef struct Tk_PhotoImageBlock { + unsigned char* pixelPtr; /* Pointer to the first pixel. */ + int width; /* Width of block, in pixels. */ + int height; /* Height of block, in pixels. */ + int pitch; /* Address difference between corresponding + * pixels in successive lines. */ + int pixelSize; /* Address difference between successive + * pixels in the same line. */ + int offset[4]; /* Address differences between the red, green, + * blue and alpha components of the pixel and + * the pixel as a whole. */ +} Tk_PhotoImageBlock; + +/* + * The following values control how blocks are combined into photo images when + * the alpha component of a pixel is not 255, a.k.a. the compositing rule. + */ + +#define TK_PHOTO_COMPOSITE_OVERLAY 0 +#define TK_PHOTO_COMPOSITE_SET 1 + +/* + * Procedure prototypes and structures used in reading and writing photo + * images: + */ + +typedef struct Tk_PhotoImageFormat Tk_PhotoImageFormat; +#ifdef USE_OLD_IMAGE +typedef int(Tk_ImageFileMatchProc)( + Tcl_Channel chan, + char* fileName, + char* formatString, + int* widthPtr, + int* heightPtr); +typedef int(Tk_ImageStringMatchProc)( + char* string, + char* formatString, + int* widthPtr, + int* heightPtr); +typedef int(Tk_ImageFileReadProc)( + Tcl_Interp* interp, + Tcl_Channel chan, + char* fileName, + char* formatString, + Tk_PhotoHandle imageHandle, + int destX, + int destY, + int width, + int height, + int srcX, + int srcY); +typedef int(Tk_ImageStringReadProc)( + Tcl_Interp* interp, + char* string, + char* formatString, + Tk_PhotoHandle imageHandle, + int destX, + int destY, + int width, + int height, + int srcX, + int srcY); +typedef int(Tk_ImageFileWriteProc)( + Tcl_Interp* interp, + char* fileName, + char* formatString, + Tk_PhotoImageBlock* blockPtr); +typedef int(Tk_ImageStringWriteProc)( + Tcl_Interp* interp, + Tcl_DString* dataPtr, + char* formatString, + Tk_PhotoImageBlock* blockPtr); +#else +typedef int(Tk_ImageFileMatchProc)( + Tcl_Channel chan, + const char* fileName, + Tcl_Obj* format, + int* widthPtr, + int* heightPtr, + Tcl_Interp* interp); +typedef int(Tk_ImageStringMatchProc)( + Tcl_Obj* dataObj, + Tcl_Obj* format, + int* widthPtr, + int* heightPtr, + Tcl_Interp* interp); +typedef int(Tk_ImageFileReadProc)( + Tcl_Interp* interp, + Tcl_Channel chan, + const char* fileName, + Tcl_Obj* format, + Tk_PhotoHandle imageHandle, + int destX, + int destY, + int width, + int height, + int srcX, + int srcY); +typedef int(Tk_ImageStringReadProc)( + Tcl_Interp* interp, + Tcl_Obj* dataObj, + Tcl_Obj* format, + Tk_PhotoHandle imageHandle, + int destX, + int destY, + int width, + int height, + int srcX, + int srcY); +typedef int(Tk_ImageFileWriteProc)( + Tcl_Interp* interp, + const char* fileName, + Tcl_Obj* format, + Tk_PhotoImageBlock* blockPtr); +typedef int(Tk_ImageStringWriteProc)( + Tcl_Interp* interp, + Tcl_Obj* format, + Tk_PhotoImageBlock* blockPtr); +#endif /* USE_OLD_IMAGE */ + +/* + * The following structure represents a particular file format for storing + * images (e.g., PPM, GIF, JPEG, etc.). It provides information to allow image + * files of that format to be recognized and read into a photo image. + */ + +struct Tk_PhotoImageFormat { + CONST86 char* name; /* Name of image file format */ + Tk_ImageFileMatchProc* fileMatchProc; + /* Procedure to call to determine whether an + * image file matches this format. */ + Tk_ImageStringMatchProc* stringMatchProc; + /* Procedure to call to determine whether the + * data in a string matches this format. */ + Tk_ImageFileReadProc* fileReadProc; + /* Procedure to call to read data from an + * image file into a photo image. */ + Tk_ImageStringReadProc* stringReadProc; + /* Procedure to call to read data from a + * string into a photo image. */ + Tk_ImageFileWriteProc* fileWriteProc; + /* Procedure to call to write data from a + * photo image to a file. */ + Tk_ImageStringWriteProc* stringWriteProc; + /* Procedure to call to obtain a string + * representation of the data in a photo + * image.*/ + struct Tk_PhotoImageFormat* nextPtr; + /* Next in list of all photo image formats + * currently known. Filled in by Tk, not by + * image format handler. */ +}; + +/* + *---------------------------------------------------------------------- + * + * Procedure prototypes and structures used for managing styles: + * + *---------------------------------------------------------------------- + */ + +/* + * Style support version tag. + */ + +#define TK_STYLE_VERSION_1 0x1 +#define TK_STYLE_VERSION TK_STYLE_VERSION_1 + +/* + * The following structures and prototypes are used as static templates to + * declare widget elements. + */ + +typedef void(Tk_GetElementSizeProc)( + ClientData clientData, + char* recordPtr, + const Tk_OptionSpec** optionsPtr, + Tk_Window tkwin, + int width, + int height, + int inner, + int* widthPtr, + int* heightPtr); +typedef void(Tk_GetElementBoxProc)( + ClientData clientData, + char* recordPtr, + const Tk_OptionSpec** optionsPtr, + Tk_Window tkwin, + int x, + int y, + int width, + int height, + int inner, + int* xPtr, + int* yPtr, + int* widthPtr, + int* heightPtr); +typedef int(Tk_GetElementBorderWidthProc)( + ClientData clientData, + char* recordPtr, + const Tk_OptionSpec** optionsPtr, + Tk_Window tkwin); +typedef void(Tk_DrawElementProc)( + ClientData clientData, + char* recordPtr, + const Tk_OptionSpec** optionsPtr, + Tk_Window tkwin, + Drawable d, + int x, + int y, + int width, + int height, + int state); + +typedef struct Tk_ElementOptionSpec { + char* name; /* Name of the required option. */ + Tk_OptionType type; /* Accepted option type. TK_OPTION_END means + * any. */ +} Tk_ElementOptionSpec; + +typedef struct Tk_ElementSpec { + int version; /* Version of the style support. */ + char* name; /* Name of element. */ + Tk_ElementOptionSpec* options; + /* List of required options. Last one's name + * must be NULL. */ + Tk_GetElementSizeProc* getSize; + /* Compute the external (resp. internal) size + * of the element from its desired internal + * (resp. external) size. */ + Tk_GetElementBoxProc* getBox; + /* Compute the inscribed or bounding boxes + * within a given area. */ + Tk_GetElementBorderWidthProc* getBorderWidth; + /* Return the element's internal border width. + * Mostly useful for widgets. */ + Tk_DrawElementProc* draw; /* Draw the element in the given bounding + * box. */ +} Tk_ElementSpec; + +/* + * Element state flags. Can be OR'ed. + */ + +#define TK_ELEMENT_STATE_ACTIVE 1 << 0 +#define TK_ELEMENT_STATE_DISABLED 1 << 1 +#define TK_ELEMENT_STATE_FOCUS 1 << 2 +#define TK_ELEMENT_STATE_PRESSED 1 << 3 + +/* + *---------------------------------------------------------------------- + * + * The definitions below provide backward compatibility for functions and + * types related to event handling that used to be in Tk but have moved to + * Tcl. + * + *---------------------------------------------------------------------- + */ + +#define TK_READABLE TCL_READABLE +#define TK_WRITABLE TCL_WRITABLE +#define TK_EXCEPTION TCL_EXCEPTION + +#define TK_DONT_WAIT TCL_DONT_WAIT +#define TK_X_EVENTS TCL_WINDOW_EVENTS +#define TK_WINDOW_EVENTS TCL_WINDOW_EVENTS +#define TK_FILE_EVENTS TCL_FILE_EVENTS +#define TK_TIMER_EVENTS TCL_TIMER_EVENTS +#define TK_IDLE_EVENTS TCL_IDLE_EVENTS +#define TK_ALL_EVENTS TCL_ALL_EVENTS + +#define Tk_IdleProc Tcl_IdleProc +#define Tk_FileProc Tcl_FileProc +#define Tk_TimerProc Tcl_TimerProc +#define Tk_TimerToken Tcl_TimerToken + +#define Tk_BackgroundError Tcl_BackgroundError +#define Tk_CancelIdleCall Tcl_CancelIdleCall +#define Tk_CreateFileHandler Tcl_CreateFileHandler +#define Tk_CreateTimerHandler Tcl_CreateTimerHandler +#define Tk_DeleteFileHandler Tcl_DeleteFileHandler +#define Tk_DeleteTimerHandler Tcl_DeleteTimerHandler +#define Tk_DoOneEvent Tcl_DoOneEvent +#define Tk_DoWhenIdle Tcl_DoWhenIdle +#define Tk_Sleep Tcl_Sleep + +/* Additional stuff that has moved to Tcl: */ + +#define Tk_EventuallyFree Tcl_EventuallyFree +#define Tk_FreeProc Tcl_FreeProc +#define Tk_Preserve Tcl_Preserve +#define Tk_Release Tcl_Release + +/* Removed Tk_Main, use macro instead */ +#if defined(_WIN32) || defined(__CYGWIN__) +#define Tk_Main(argc, argv, proc) \ + Tk_MainEx(argc, argv, proc, (Tcl_FindExecutable(0), (Tcl_CreateInterp)())) +#else +#define Tk_Main(argc, argv, proc) \ + Tk_MainEx( \ + argc, argv, proc, (Tcl_FindExecutable(argv[0]), (Tcl_CreateInterp)())) +#endif +const char* Tk_InitStubs(Tcl_Interp* interp, const char* version, int exact); +EXTERN const char* +Tk_PkgInitStubsCheck(Tcl_Interp* interp, const char* version, int exact); + +#ifndef USE_TK_STUBS +#define Tk_InitStubs(interp, version, exact) \ + Tk_PkgInitStubsCheck(interp, version, exact) +#endif /* USE_TK_STUBS */ + +#define Tk_InitImageArgs(interp, argc, argv) /**/ + +/* + *---------------------------------------------------------------------- + * + * Additional procedure types defined by Tk. + * + *---------------------------------------------------------------------- + */ + +typedef int(Tk_ErrorProc)(ClientData clientData, XErrorEvent* errEventPtr); +typedef void(Tk_EventProc)(ClientData clientData, XEvent* eventPtr); +typedef int(Tk_GenericProc)(ClientData clientData, XEvent* eventPtr); +typedef int(Tk_ClientMessageProc)(Tk_Window tkwin, XEvent* eventPtr); +typedef int(Tk_GetSelProc)( + ClientData clientData, + Tcl_Interp* interp, + CONST86 char* portion); +typedef void(Tk_LostSelProc)(ClientData clientData); +typedef Tk_RestrictAction( + Tk_RestrictProc)(ClientData clientData, XEvent* eventPtr); +typedef int(Tk_SelectionProc)( + ClientData clientData, + int offset, + char* buffer, + int maxBytes); + +/* + *---------------------------------------------------------------------- + * + * Platform independent exported procedures and variables. + * + *---------------------------------------------------------------------- + */ + +#include "tkDecls.h" + +#ifdef USE_OLD_IMAGE +#undef Tk_CreateImageType +#define Tk_CreateImageType Tk_CreateOldImageType +#undef Tk_CreatePhotoImageFormat +#define Tk_CreatePhotoImageFormat Tk_CreateOldPhotoImageFormat +#endif /* USE_OLD_IMAGE */ + +/* + *---------------------------------------------------------------------- + * + * Allow users to say that they don't want to alter their source to add extra + * arguments to Tk_PhotoPutBlock() et al; DO NOT DEFINE THIS WHEN BUILDING TK. + * + * This goes after the inclusion of the stubbed-decls so that the declarations + * of what is actually there can be correct. + */ + +#ifdef USE_COMPOSITELESS_PHOTO_PUT_BLOCK +#ifdef Tk_PhotoPutBlock +#undef Tk_PhotoPutBlock +#endif +#define Tk_PhotoPutBlock Tk_PhotoPutBlock_NoComposite +#ifdef Tk_PhotoPutZoomedBlock +#undef Tk_PhotoPutZoomedBlock +#endif +#define Tk_PhotoPutZoomedBlock Tk_PhotoPutZoomedBlock_NoComposite +#define USE_PANIC_ON_PHOTO_ALLOC_FAILURE +#else /* !USE_COMPOSITELESS_PHOTO_PUT_BLOCK */ +#ifdef USE_PANIC_ON_PHOTO_ALLOC_FAILURE +#ifdef Tk_PhotoPutBlock +#undef Tk_PhotoPutBlock +#endif +#define Tk_PhotoPutBlock Tk_PhotoPutBlock_Panic +#ifdef Tk_PhotoPutZoomedBlock +#undef Tk_PhotoPutZoomedBlock +#endif +#define Tk_PhotoPutZoomedBlock Tk_PhotoPutZoomedBlock_Panic +#endif /* USE_PANIC_ON_PHOTO_ALLOC_FAILURE */ +#endif /* USE_COMPOSITELESS_PHOTO_PUT_BLOCK */ +#ifdef USE_PANIC_ON_PHOTO_ALLOC_FAILURE +#ifdef Tk_PhotoExpand +#undef Tk_PhotoExpand +#endif +#define Tk_PhotoExpand Tk_PhotoExpand_Panic +#ifdef Tk_PhotoSetSize +#undef Tk_PhotoSetSize +#endif +#define Tk_PhotoSetSize Tk_PhotoSetSize_Panic +#endif /* USE_PANIC_ON_PHOTO_ALLOC_FAILURE */ + +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLIMPORT + +#endif /* RC_INVOKED */ + +/* + * end block for C++ + */ + +#ifdef __cplusplus +} +#endif + +#endif /* _TK */ + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tk3d.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tk3d.h new file mode 100644 index 0000000..b962373 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tk3d.h @@ -0,0 +1,85 @@ +/* + * tk3d.h -- + * + * Declarations of types and functions shared by the 3d border module. + * + * Copyright (c) 1996-1997 by Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TK3D +#define _TK3D + +#include "tkInt.h" + +/* + * One of the following data structures is allocated for each 3-D border + * currently in use. Structures of this type are indexed by borderTable, so + * that a single structure can be shared for several uses. + */ + +typedef struct TkBorder { + Screen* screen; /* Screen on which the border will be used. */ + Visual* visual; /* Visual for all windows and pixmaps using + * the border. */ + int depth; /* Number of bits per pixel of drawables where + * the border will be used. */ + Colormap colormap; /* Colormap out of which pixels are + * allocated. */ + int resourceRefCount; /* Number of active uses of this color (each + * active use corresponds to a call to + * Tk_Alloc3DBorderFromObj or Tk_Get3DBorder). + * If this count is 0, then this structure is + * no longer valid and it isn't present in + * borderTable: it is being kept around only + * because there are objects referring to it. + * The structure is freed when objRefCount and + * resourceRefCount are both 0. */ + int objRefCount; /* The number of Tcl objects that reference + * this structure. */ + XColor* bgColorPtr; /* Background color (intensity between + * lightColorPtr and darkColorPtr). */ + XColor* darkColorPtr; /* Color for darker areas (must free when + * deleting structure). NULL means shadows + * haven't been allocated yet.*/ + XColor* lightColorPtr; /* Color used for lighter areas of border + * (must free this when deleting structure). + * NULL means shadows haven't been allocated + * yet. */ + Pixmap shadow; /* Stipple pattern to use for drawing shadows + * areas. Used for displays with <= 64 colors + * or where colormap has filled up. */ + GC bgGC; /* Used (if necessary) to draw areas in the + * background color. */ + GC darkGC; /* Used to draw darker parts of the border. + * None means the shadow colors haven't been + * allocated yet.*/ + GC lightGC; /* Used to draw lighter parts of the border. + * None means the shadow colors haven't been + * allocated yet. */ + Tcl_HashEntry* hashPtr; /* Entry in borderTable (needed in order to + * delete structure). */ + struct TkBorder* nextPtr; /* Points to the next TkBorder structure with + * the same color name. Borders with the same + * name but different screens or colormaps are + * chained together off a single entry in + * borderTable. */ +} TkBorder; + +/* + * Maximum intensity for a color: + */ + +#define MAX_INTENSITY 65535 + +/* + * Declarations for platform specific interfaces used by this module. + */ + +MODULE_SCOPE TkBorder* TkpGetBorder(void); +MODULE_SCOPE void TkpGetShadows(TkBorder* borderPtr, Tk_Window tkwin); +MODULE_SCOPE void TkpFreeBorder(TkBorder* borderPtr); + +#endif /* _TK3D */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkBusy.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkBusy.h new file mode 100644 index 0000000..8538574 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkBusy.h @@ -0,0 +1,41 @@ +/* + * tkBusy.h -- + * + * This file defines the type of the structure describing a busy window. + * + * Copyright 1993-1998 Lucent Technologies, Inc. + * + * The "busy" command was created by George Howlett. Adapted for + * integration into Tk by Jos Decoster and Donal K. Fellows. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +typedef struct Busy { + Display* display; /* Display of busy window */ + Tcl_Interp* interp; /* Interpreter where "busy" command was + * created. It's used to key the searches in + * the window hierarchy. See the "windows" + * command. */ + Tk_Window tkBusy; /* Busy window: Transparent window used to + * block delivery of events to windows + * underneath it. */ + Tk_Window tkParent; /* Parent window of the busy window. It may be + * the reference window (if the reference is a + * toplevel) or a mutual ancestor of the + * reference window */ + Tk_Window tkRef; /* Reference window of the busy window. It is + * used to manage the size and position of the + * busy window. */ + int x, y; /* Position of the reference window */ + int width, height; /* Size of the reference window. Retained to + * know if the reference window has been + * reconfigured to a new size. */ + int menuBar; /* Menu bar flag. */ + Tk_Cursor cursor; /* Cursor for the busy window. */ + Tcl_HashEntry* hashPtr; /* Used the delete the busy window entry out + * of the global hash table. */ + Tcl_HashTable* tablePtr; + Tk_OptionTable optionTable; +} Busy; diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkButton.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkButton.h new file mode 100644 index 0000000..b5cb571 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkButton.h @@ -0,0 +1,322 @@ +/* + * tkButton.h -- + * + * Declarations of types and functions used to implement button-like + * widgets. + * + * Copyright (c) 1996-1998 by Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TKBUTTON +#define _TKBUTTON + +#ifndef _TKINT +#include "tkInt.h" +#endif + +/* + * Legal values for the "compound" field of TkButton records. + */ + +enum compound { + COMPOUND_BOTTOM, + COMPOUND_CENTER, + COMPOUND_LEFT, + COMPOUND_NONE, + COMPOUND_RIGHT, + COMPOUND_TOP +}; + +/* + * Legal values for the "state" field of TkButton records. + */ + +enum state { STATE_ACTIVE, STATE_DISABLED, STATE_NORMAL }; + +/* + * Legal values for the "defaultState" field of TkButton records. + */ + +enum defaultState { DEFAULT_ACTIVE, DEFAULT_DISABLED, DEFAULT_NORMAL }; + +/* + * A data structure of the following type is kept for each widget managed by + * this file: + */ + +typedef struct { + Tk_Window tkwin; /* Window that embodies the button. NULL means + * that the window has been destroyed. */ + Display* display; /* Display containing widget. Needed to free + * up resources after tkwin is gone. */ + Tcl_Interp* interp; /* Interpreter associated with button. */ + Tcl_Command widgetCmd; /* Token for button's widget command. */ + int type; /* Type of widget, such as TYPE_LABEL: + * restricts operations that may be performed + * on widget. See below for legal values. */ + Tk_OptionTable optionTable; /* Table that defines configuration options + * available for this widget. */ + + /* + * Information about what's in the button. + */ + + Tcl_Obj* textPtr; /* Value of -text option: specifies text to + * display in button. */ + int underline; /* Value of -underline option: specifies index + * of character to underline. < 0 means don't + * underline anything. */ + Tcl_Obj* textVarNamePtr; /* Value of -textvariable option: specifies + * name of variable or NULL. If non-NULL, + * button displays the contents of this + * variable. */ + Pixmap bitmap; /* Value of -bitmap option. If not None, + * specifies bitmap to display and text and + * textVar are ignored. */ + Tcl_Obj* imagePtr; /* Value of -image option: specifies image to + * display in window, or NULL if none. If + * non-NULL, bitmap, text, and textVarName are + * ignored.*/ + Tk_Image image; /* Derived from imagePtr by calling + * Tk_GetImage, or NULL if imagePtr is + * NULL. */ + Tcl_Obj* selectImagePtr; /* Value of -selectimage option: specifies + * image to display in window when selected, + * or NULL if none. Ignored if imagePtr is + * NULL. */ + Tk_Image selectImage; /* Derived from selectImagePtr by calling + * Tk_GetImage, or NULL if selectImagePtr is + * NULL. */ + Tcl_Obj* tristateImagePtr; /* Value of -tristateimage option: specifies + * image to display in window when selected, + * or NULL if none. Ignored if imagePtr is + * NULL. */ + Tk_Image tristateImage; /* Derived from tristateImagePtr by calling + * Tk_GetImage, or NULL if tristateImagePtr is + * NULL. */ + + /* + * Information used when displaying widget: + */ + + enum state state; /* Value of -state option: specifies state of + * button for display purposes.*/ + Tk_3DBorder normalBorder; /* Value of -background option: specifies + * color for background (and border) when + * window isn't active. */ + Tk_3DBorder activeBorder; /* Value of -activebackground option: this is + * the color used to draw 3-D border and + * background when widget is active. */ + Tcl_Obj* borderWidthPtr; /* Value of -borderWidth option: specifies + * width of border in pixels. */ + int borderWidth; /* Integer value corresponding to + * borderWidthPtr. Always >= 0. */ + int relief; /* Value of -relief option: specifies 3-d + * effect for border, such as + * TK_RELIEF_RAISED. */ + int overRelief; /* Value of -overrelief option: specifies a + * 3-d effect for the border, such as + * TK_RELIEF_RAISED, to be used when the mouse + * is over the button. */ + int offRelief; /* Value of -offrelief option: specifies a 3-d + * effect for the border, such as + * TK_RELIEF_RAISED, to be used when a + * checkbutton or radiobutton without + * indicator is off. */ + Tcl_Obj* highlightWidthPtr; /* Value of -highlightthickness option: + * specifies width in pixels of highlight to + * draw around widget when it has the focus. + * <= 0 means don't draw a highlight. */ + int highlightWidth; /* Integer value corresponding to + * highlightWidthPtr. Always >= 0. */ + Tk_3DBorder highlightBorder; /* Value of -highlightbackground option: + * specifies background with which to draw 3-D + * default ring and focus highlight area when + * highlight is off. */ + XColor* highlightColorPtr; /* Value of -highlightcolor option: specifies + * color for drawing traversal highlight. */ + int inset; /* Total width of all borders, including + * traversal highlight and 3-D border. + * Indicates how much interior stuff must be + * offset from outside edges to leave room for + * borders. */ + Tk_Font tkfont; /* Value of -font option: specifies font to + * use for display text. */ + XColor* normalFg; /* Value of -font option: specifies foreground + * color in normal mode. */ + XColor* activeFg; /* Value of -activeforeground option: + * foreground color in active mode. NULL means + * use -foreground instead. */ + XColor* disabledFg; /* Value of -disabledforeground option: + * foreground color when disabled. NULL means + * use normalFg with a 50% stipple instead. */ + GC normalTextGC; /* GC for drawing text in normal mode. Also + * used to copy from off-screen pixmap onto + * screen. */ + GC activeTextGC; /* GC for drawing text in active mode (NULL + * means use normalTextGC). */ + GC disabledGC; /* Used to produce disabled effect for text + * and check/radio marks. */ + GC stippleGC; /* Used to produce disabled stipple effect for + * images when disabled. */ + Pixmap gray; /* Pixmap for displaying disabled text if + * disabledFg is NULL. */ + GC copyGC; /* Used for copying information from an + * off-screen pixmap to the screen. */ + Tcl_Obj* widthPtr; /* Value of -width option. */ + int width; /* Integer value corresponding to widthPtr. */ + Tcl_Obj* heightPtr; /* Value of -height option. */ + int height; /* Integer value corresponding to heightPtr. */ + Tcl_Obj* wrapLengthPtr; /* Value of -wraplength option: specifies line + * length (in pixels) at which to wrap onto + * next line. <= 0 means don't wrap except at + * newlines. */ + int wrapLength; /* Integer value corresponding to + * wrapLengthPtr. */ + Tcl_Obj* padXPtr; /* Value of -padx option: specifies how many + * pixels of extra space to leave on left and + * right of text. Ignored for bitmaps and + * images. */ + int padX; /* Integer value corresponding to padXPtr. */ + Tcl_Obj* padYPtr; /* Value of -padx option: specifies how many + * pixels of extra space to leave above and + * below text. Ignored for bitmaps and + * images. */ + int padY; /* Integer value corresponding to padYPtr. */ + Tk_Anchor anchor; /* Value of -anchor option: specifies where + * text/bitmap should be displayed inside + * button region. */ + Tk_Justify justify; /* Value of -justify option: specifies how to + * align lines of multi-line text. */ + int indicatorOn; /* Value of -indicatoron option: 1 means draw + * indicator in checkbuttons and radiobuttons, + * 0 means don't draw it. */ + Tk_3DBorder selectBorder; /* Value of -selectcolor option: specifies + * color for drawing indicator background, or + * perhaps widget background, when + * selected. */ + int textWidth; /* Width needed to display text as requested, + * in pixels. */ + int textHeight; /* Height needed to display text as requested, + * in pixels. */ + Tk_TextLayout textLayout; /* Saved text layout information. */ + int indicatorSpace; /* Horizontal space (in pixels) allocated for + * display of indicator. */ + int indicatorDiameter; /* Diameter of indicator, in pixels. */ + enum defaultState defaultState; + /* Value of -default option, such as + * DEFAULT_NORMAL: specifies state of default + * ring for buttons (normal, active, or + * disabled). NULL for other classes. */ + + /* + * For check and radio buttons, the fields below are used to manage the + * variable indicating the button's state. + */ + + Tcl_Obj* selVarNamePtr; /* Value of -variable option: specifies name + * of variable used to control selected state + * of button. */ + Tcl_Obj* onValuePtr; /* Value of -offvalue option: specifies value + * to store in variable when this button is + * selected. */ + Tcl_Obj* offValuePtr; /* Value of -offvalue option: specifies value + * to store in variable when this button isn't + * selected. Used only by checkbuttons. */ + Tcl_Obj* tristateValuePtr; /* Value of -tristatevalue option: specifies + * value to display Tristate or Multivalue + * mode when variable matches this value. + * Used by check- buttons. */ + + /* + * Miscellaneous information: + */ + + Tk_Cursor cursor; /* Value of -cursor option: if not None, + * specifies current cursor for window. */ + Tcl_Obj* takeFocusPtr; /* Value of -takefocus option; not used in the + * C code, but used by keyboard traversal + * scripts. */ + Tcl_Obj* commandPtr; /* Value of -command option: specifies script + * to execute when button is invoked. If + * widget is label or has no command, this is + * NULL. */ + int compound; /* Value of -compound option; specifies + * whether the button should show both an + * image and text, and, if so, how. */ + int repeatDelay; /* Value of -repeatdelay option; specifies the + * number of ms after which the button will + * start to auto-repeat its command. */ + int repeatInterval; /* Value of -repeatinterval option; specifies + * the number of ms between auto-repeat + * invocataions of the button command. */ + int flags; /* Various flags; see below for + * definitions. */ +} TkButton; + +/* + * Possible "type" values for buttons. These are the kinds of widgets + * supported by this file. The ordering of the type numbers is significant: + * greater means more features and is used in the code. + */ + +#define TYPE_LABEL 0 +#define TYPE_BUTTON 1 +#define TYPE_CHECK_BUTTON 2 +#define TYPE_RADIO_BUTTON 3 + +/* + * Flag bits for buttons: + * + * REDRAW_PENDING: Non-zero means a DoWhenIdle handler has + * already been queued to redraw this window. + * SELECTED: Non-zero means this button is selected, so + * special highlight should be drawn. + * GOT_FOCUS: Non-zero means this button currently has the + * input focus. + * BUTTON_DELETED: Non-zero needs that this button has been + * deleted, or is in the process of being deleted + */ + +#define REDRAW_PENDING (1 << 0) +#define SELECTED (1 << 1) +#define GOT_FOCUS (1 << 2) +#define BUTTON_DELETED (1 << 3) +#define TRISTATED (1 << 4) + +/* + * Declaration of button class functions structure + * and button/label defaults, for use in optionSpecs. + */ + +MODULE_SCOPE const Tk_ClassProcs tkpButtonProcs; +MODULE_SCOPE char tkDefButtonHighlightWidth[TCL_INTEGER_SPACE]; +MODULE_SCOPE char tkDefButtonPadx[TCL_INTEGER_SPACE]; +MODULE_SCOPE char tkDefButtonPady[TCL_INTEGER_SPACE]; +MODULE_SCOPE char tkDefButtonBorderWidth[TCL_INTEGER_SPACE]; +MODULE_SCOPE char tkDefLabelHighlightWidth[TCL_INTEGER_SPACE]; +MODULE_SCOPE char tkDefLabelPadx[TCL_INTEGER_SPACE]; +MODULE_SCOPE char tkDefLabelPady[TCL_INTEGER_SPACE]; + +/* + * Declaration of functions used in the implementation of the button widget. + */ + +#ifndef TkpButtonSetDefaults +MODULE_SCOPE void TkpButtonSetDefaults(); +#endif +MODULE_SCOPE void TkButtonWorldChanged(ClientData instanceData); +MODULE_SCOPE void TkpComputeButtonGeometry(TkButton* butPtr); +MODULE_SCOPE TkButton* TkpCreateButton(Tk_Window tkwin); +#ifndef TkpDestroyButton +MODULE_SCOPE void TkpDestroyButton(TkButton* butPtr); +#endif +#ifndef TkpDisplayButton +MODULE_SCOPE void TkpDisplayButton(ClientData clientData); +#endif +MODULE_SCOPE int TkInvokeButton(TkButton* butPtr); + +#endif /* _TKBUTTON */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkCanvas.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkCanvas.h new file mode 100644 index 0000000..bb72487 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkCanvas.h @@ -0,0 +1,318 @@ +/* + * tkCanvas.h -- + * + * Declarations shared among all the files that implement canvas widgets. + * + * Copyright (c) 1991-1994 The Regents of the University of California. + * Copyright (c) 1994-1995 Sun Microsystems, Inc. + * Copyright (c) 1998 by Scriptics Corporation. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TKCANVAS +#define _TKCANVAS + +#ifndef _TK +#include "tk.h" +#endif + +#ifndef USE_OLD_TAG_SEARCH +typedef struct TagSearchExpr_s TagSearchExpr; + +struct TagSearchExpr_s { + TagSearchExpr* next; /* For linked lists of expressions - used in + * bindings. */ + Tk_Uid uid; /* The uid of the whole expression. */ + Tk_Uid* uids; /* Expresion compiled to an array of uids. */ + int allocated; /* Available space for array of uids. */ + int length; /* Length of expression. */ + int index; /* Current position in expression + * evaluation. */ + int match; /* This expression matches event's item's + * tags. */ +}; +#endif /* not USE_OLD_TAG_SEARCH */ + +/* + * The record below describes a canvas widget. It is made available to the + * item functions so they can access certain shared fields such as the overall + * displacement and scale factor for the canvas. + */ + +typedef struct TkCanvas { + Tk_Window tkwin; /* Window that embodies the canvas. NULL means + * that the window has been destroyed but the + * data structures haven't yet been cleaned + * up.*/ + Display* display; /* Display containing widget; needed, among + * other things, to release resources after + * tkwin has already gone away. */ + Tcl_Interp* interp; /* Interpreter associated with canvas. */ + Tcl_Command widgetCmd; /* Token for canvas's widget command. */ + Tk_Item* firstItemPtr; /* First in list of all items in canvas, or + * NULL if canvas empty. */ + Tk_Item* lastItemPtr; /* Last in list of all items in canvas, or + * NULL if canvas empty. */ + + /* + * Information used when displaying widget: + */ + + int borderWidth; /* Width of 3-D border around window. */ + Tk_3DBorder bgBorder; /* Used for canvas background. */ + int relief; /* Indicates whether window as a whole is + * raised, sunken, or flat. */ + int highlightWidth; /* Width in pixels of highlight to draw around + * widget when it has the focus. <= 0 means + * don't draw a highlight. */ + XColor* highlightBgColorPtr; + /* Color for drawing traversal highlight area + * when highlight is off. */ + XColor* highlightColorPtr; /* Color for drawing traversal highlight. */ + int inset; /* Total width of all borders, including + * traversal highlight and 3-D border. + * Indicates how much interior stuff must be + * offset from outside edges to leave room for + * borders. */ + GC pixmapGC; /* Used to copy bits from a pixmap to the + * screen and also to clear the pixmap. */ + int width, height; /* Dimensions to request for canvas window, + * specified in pixels. */ + int redrawX1, redrawY1; /* Upper left corner of area to redraw, in + * pixel coordinates. Border pixels are + * included. Only valid if REDRAW_PENDING flag + * is set. */ + int redrawX2, redrawY2; /* Lower right corner of area to redraw, in + * integer canvas coordinates. Border pixels + * will *not* be redrawn. */ + int confine; /* Non-zero means constrain view to keep as + * much of canvas visible as possible. */ + + /* + * Information used to manage the selection and insertion cursor: + */ + + Tk_CanvasTextInfo textInfo; /* Contains lots of fields; see tk.h for + * details. This structure is shared with the + * code that implements individual items. */ + int insertOnTime; /* Number of milliseconds cursor should spend + * in "on" state for each blink. */ + int insertOffTime; /* Number of milliseconds cursor should spend + * in "off" state for each blink. */ + Tcl_TimerToken insertBlinkHandler; + /* Timer handler used to blink cursor on and + * off. */ + + /* + * Transformation applied to canvas as a whole: to compute screen + * coordinates (X,Y) from canvas coordinates (x,y), do the following: + * + * X = x - xOrigin; + * Y = y - yOrigin; + */ + + int xOrigin, yOrigin; /* Canvas coordinates corresponding to + * upper-left corner of window, given in + * canvas pixel units. */ + int drawableXOrigin, drawableYOrigin; + /* During redisplay, these fields give the + * canvas coordinates corresponding to the + * upper-left corner of the drawable where + * items are actually being drawn (typically a + * pixmap smaller than the whole window). */ + + /* + * Information used for event bindings associated with items. + */ + + Tk_BindingTable bindingTable; + /* Table of all bindings currently defined for + * this canvas. NULL means that no bindings + * exist, so the table hasn't been created. + * Each "object" used for this table is either + * a Tk_Uid for a tag or the address of an + * item named by id. */ + Tk_Item* currentItemPtr; /* The item currently containing the mouse + * pointer, or NULL if none. */ + Tk_Item* newCurrentPtr; /* The item that is about to become the + * current one, or NULL. This field is used to + * detect deletions of the new current item + * pointer that occur during Leave processing + * of the previous current item. */ + double closeEnough; /* The mouse is assumed to be inside an item + * if it is this close to it. */ + XEvent pickEvent; /* The event upon which the current choice of + * currentItem is based. Must be saved so that + * if the currentItem is deleted, can pick + * another. */ + int state; /* Last known modifier state. Used to defer + * picking a new current object while buttons + * are down. */ + + /* + * Information used for managing scrollbars: + */ + + char* xScrollCmd; /* Command prefix for communicating with + * horizontal scrollbar. NULL means no + * horizontal scrollbar. Malloc'ed. */ + char* yScrollCmd; /* Command prefix for communicating with + * vertical scrollbar. NULL means no vertical + * scrollbar. Malloc'ed. */ + int scrollX1, scrollY1, scrollX2, scrollY2; + /* These four coordinates define the region + * that is the 100% area for scrolling (i.e. + * these numbers determine the size and + * location of the sliders on scrollbars). + * Units are pixels in canvas coords. */ + char* regionString; /* The option string from which scrollX1 etc. + * are derived. Malloc'ed. */ + int xScrollIncrement; /* If >0, defines a grid for horizontal + * scrolling. This is the size of the "unit", + * and the left edge of the screen will always + * lie on an even unit boundary. */ + int yScrollIncrement; /* If >0, defines a grid for horizontal + * scrolling. This is the size of the "unit", + * and the left edge of the screen will always + * lie on an even unit boundary. */ + + /* + * Information used for scanning: + */ + + int scanX; /* X-position at which scan started (e.g. + * button was pressed here). */ + int scanXOrigin; /* Value of xOrigin field when scan started. */ + int scanY; /* Y-position at which scan started (e.g. + * button was pressed here). */ + int scanYOrigin; /* Value of yOrigin field when scan started. */ + + /* + * Information used to speed up searches by remembering the last item + * created or found with an item id search. + */ + + Tk_Item* hotPtr; /* Pointer to "hot" item (one that's been + * recently used. NULL means there's no hot + * item. */ + Tk_Item* hotPrevPtr; /* Pointer to predecessor to hotPtr (NULL + * means item is first in list). This is only + * a hint and may not really be hotPtr's + * predecessor. */ + + /* + * Miscellaneous information: + */ + + Tk_Cursor cursor; /* Current cursor for window, or None. */ + char* takeFocus; /* Value of -takefocus option; not used in the + * C code, but used by keyboard traversal + * scripts. Malloc'ed, but may be NULL. */ + double pixelsPerMM; /* Scale factor between MM and pixels; used + * when converting coordinates. */ + int flags; /* Various flags; see below for + * definitions. */ + int nextId; /* Number to use as id for next item created + * in widget. */ + Tk_PostscriptInfo psInfo; /* Pointer to information used for generating + * Postscript for the canvas. NULL means no + * Postscript is currently being generated. */ + Tcl_HashTable idTable; /* Table of integer indices. */ + + /* + * Additional information, added by the 'dash'-patch + */ + + void* reserved1; + Tk_State canvas_state; /* State of canvas. */ + void* reserved2; + void* reserved3; + Tk_TSOffset tsoffset; +#ifndef USE_OLD_TAG_SEARCH + TagSearchExpr* bindTagExprs; /* Linked list of tag expressions used in + * bindings. */ +#endif +} TkCanvas; + +/* + * Flag bits for canvases: + * + * REDRAW_PENDING - 1 means a DoWhenIdle handler has already been + * created to redraw some or all of the canvas. + * REDRAW_BORDERS - 1 means that the borders need to be redrawn + * during the next redisplay operation. + * REPICK_NEEDED - 1 means DisplayCanvas should pick a new + * current item before redrawing the canvas. + * GOT_FOCUS - 1 means the focus is currently in this widget, + * so should draw the insertion cursor and + * traversal highlight. + * CURSOR_ON - 1 means the insertion cursor is in the "on" + * phase of its blink cycle. 0 means either we + * don't have the focus or the cursor is in the + * "off" phase of its cycle. + * UPDATE_SCROLLBARS - 1 means the scrollbars should get updated as + * part of the next display operation. + * LEFT_GRABBED_ITEM - 1 means that the mouse left the current item + * while a grab was in effect, so we didn't + * change canvasPtr->currentItemPtr. + * REPICK_IN_PROGRESS - 1 means PickCurrentItem is currently + * executing. If it should be called recursively, + * it should simply return immediately. + * BBOX_NOT_EMPTY - 1 means that the bounding box of the area that + * should be redrawn is not empty. + */ + +#define REDRAW_PENDING 1 +#define REDRAW_BORDERS 2 +#define REPICK_NEEDED 4 +#define GOT_FOCUS 8 +#define CURSOR_ON 0x10 +#define UPDATE_SCROLLBARS 0x20 +#define LEFT_GRABBED_ITEM 0x40 +#define REPICK_IN_PROGRESS 0x100 +#define BBOX_NOT_EMPTY 0x200 + +/* + * Flag bits for canvas items (redraw_flags): + * + * FORCE_REDRAW - 1 means that the new coordinates of some item + * are not yet registered using + * Tk_CanvasEventuallyRedraw(). It should still + * be done by the general canvas code. + */ + +#define FORCE_REDRAW 8 + +/* + * Canvas-related functions that are shared among Tk modules but not exported + * to the outside world: + */ + +MODULE_SCOPE int TkCanvPostscriptCmd( + TkCanvas* canvasPtr, + Tcl_Interp* interp, + int argc, + const char** argv); +MODULE_SCOPE int TkCanvTranslatePath( + TkCanvas* canvPtr, + int numVertex, + double* coordPtr, + int closed, + XPoint* outPtr); +/* + * Standard item types provided by Tk: + */ + +MODULE_SCOPE Tk_ItemType tkArcType, tkBitmapType, tkImageType, tkLineType; +MODULE_SCOPE Tk_ItemType tkOvalType, tkPolygonType; +MODULE_SCOPE Tk_ItemType tkRectangleType, tkTextType, tkWindowType; + +/* + * Convenience macro. + */ + +#define Canvas(canvas) ((TkCanvas*)(canvas)) + +#endif /* _TKCANVAS */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkColor.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkColor.h new file mode 100644 index 0000000..dc76da1 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkColor.h @@ -0,0 +1,75 @@ +/* + * tkColor.h -- + * + * Declarations of data types and functions used by the Tk color module. + * + * Copyright (c) 1996-1997 by Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TKCOLOR +#define _TKCOLOR + +#include "tkInt.h" + +/* + * One of the following data structures is used to keep track of each color + * that is being used by the application; typically there is a colormap entry + * allocated for each of these colors. + */ + +#define TK_COLOR_BY_NAME 1 +#define TK_COLOR_BY_VALUE 2 + +#define COLOR_MAGIC ((unsigned int)0x46140277) + +typedef struct TkColor { + XColor color; /* Information about this color. */ + unsigned int magic; /* Used for quick integrity check on this + * structure. Must always have the value + * COLOR_MAGIC. */ + GC gc; /* Simple gc with this color as foreground + * color and all other fields defaulted. May + * be None. */ + Screen* screen; /* Screen where this color is valid. Used to + * delete it, and to find its display. */ + Colormap colormap; /* Colormap from which this entry was + * allocated. */ + Visual* visual; /* Visual associated with colormap. */ + int resourceRefCount; /* Number of active uses of this color (each + * active use corresponds to a call to + * Tk_AllocColorFromObj or Tk_GetColor). If + * this count is 0, then this TkColor + * structure is no longer valid and it isn't + * present in a hash table: it is being kept + * around only because there are objects + * referring to it. The structure is freed + * when resourceRefCount and objRefCount are + * both 0. */ + int objRefCount; /* The number of Tcl objects that reference + * this structure. */ + int type; /* TK_COLOR_BY_NAME or TK_COLOR_BY_VALUE. */ + Tcl_HashEntry* hashPtr; /* Pointer to hash table entry for this + * structure. (for use in deleting entry). */ + struct TkColor* nextPtr; /* Points to the next TkColor structure with + * the same color name. Colors with the same + * name but different screens or colormaps are + * chained together off a single entry in + * nameTable. For colors in valueTable (those + * allocated by Tk_GetColorByValue) this field + * is always NULL. */ +} TkColor; + +/* + * Common APIs exported from all platform-specific implementations. + */ + +#ifndef TkpFreeColor +MODULE_SCOPE void TkpFreeColor(TkColor* tkColPtr); +#endif +MODULE_SCOPE TkColor* TkpGetColor(Tk_Window tkwin, Tk_Uid name); +MODULE_SCOPE TkColor* TkpGetColorByValue(Tk_Window tkwin, XColor* colorPtr); + +#endif /* _TKCOLOR */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkDecls.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkDecls.h new file mode 100644 index 0000000..a91cb87 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkDecls.h @@ -0,0 +1,2478 @@ +/* + * tkDecls.h -- + * + * Declarations of functions in the platform independent public Tcl API. + * + * Copyright (c) 1998-1999 by Scriptics Corporation. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TKDECLS +#define _TKDECLS + +#ifdef BUILD_tk +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLEXPORT +#endif + +/* + * WARNING: This file is automatically generated by the tools/genStubs.tcl + * script. Any modifications to the function declarations below should be made + * in the generic/tk.decls script. + */ + +/* !BEGIN!: Do not edit below this line. */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Exported function declarations: + */ + +/* 0 */ +EXTERN void Tk_MainLoop(void); +/* 1 */ +EXTERN XColor* Tk_3DBorderColor(Tk_3DBorder border); +/* 2 */ +EXTERN GC Tk_3DBorderGC(Tk_Window tkwin, Tk_3DBorder border, int which); +/* 3 */ +EXTERN void Tk_3DHorizontalBevel( + Tk_Window tkwin, + Drawable drawable, + Tk_3DBorder border, + int x, + int y, + int width, + int height, + int leftIn, + int rightIn, + int topBevel, + int relief); +/* 4 */ +EXTERN void Tk_3DVerticalBevel( + Tk_Window tkwin, + Drawable drawable, + Tk_3DBorder border, + int x, + int y, + int width, + int height, + int leftBevel, + int relief); +/* 5 */ +EXTERN void Tk_AddOption( + Tk_Window tkwin, + const char* name, + const char* value, + int priority); +/* 6 */ +EXTERN void Tk_BindEvent( + Tk_BindingTable bindingTable, + XEvent* eventPtr, + Tk_Window tkwin, + int numObjects, + ClientData* objectPtr); +/* 7 */ +EXTERN void Tk_CanvasDrawableCoords( + Tk_Canvas canvas, + double x, + double y, + short* drawableXPtr, + short* drawableYPtr); +/* 8 */ +EXTERN void +Tk_CanvasEventuallyRedraw(Tk_Canvas canvas, int x1, int y1, int x2, int y2); +/* 9 */ +EXTERN int Tk_CanvasGetCoord( + Tcl_Interp* interp, + Tk_Canvas canvas, + const char* str, + double* doublePtr); +/* 10 */ +EXTERN Tk_CanvasTextInfo* Tk_CanvasGetTextInfo(Tk_Canvas canvas); +/* 11 */ +EXTERN int Tk_CanvasPsBitmap( + Tcl_Interp* interp, + Tk_Canvas canvas, + Pixmap bitmap, + int x, + int y, + int width, + int height); +/* 12 */ +EXTERN int +Tk_CanvasPsColor(Tcl_Interp* interp, Tk_Canvas canvas, XColor* colorPtr); +/* 13 */ +EXTERN int Tk_CanvasPsFont(Tcl_Interp* interp, Tk_Canvas canvas, Tk_Font font); +/* 14 */ +EXTERN void Tk_CanvasPsPath( + Tcl_Interp* interp, + Tk_Canvas canvas, + double* coordPtr, + int numPoints); +/* 15 */ +EXTERN int +Tk_CanvasPsStipple(Tcl_Interp* interp, Tk_Canvas canvas, Pixmap bitmap); +/* 16 */ +EXTERN double Tk_CanvasPsY(Tk_Canvas canvas, double y); +/* 17 */ +EXTERN void Tk_CanvasSetStippleOrigin(Tk_Canvas canvas, GC gc); +/* 18 */ +EXTERN int Tk_CanvasTagsParseProc( + ClientData clientData, + Tcl_Interp* interp, + Tk_Window tkwin, + const char* value, + char* widgRec, + int offset); +/* 19 */ +EXTERN CONST86 char* Tk_CanvasTagsPrintProc( + ClientData clientData, + Tk_Window tkwin, + char* widgRec, + int offset, + Tcl_FreeProc** freeProcPtr); +/* 20 */ +EXTERN Tk_Window Tk_CanvasTkwin(Tk_Canvas canvas); +/* 21 */ +EXTERN void Tk_CanvasWindowCoords( + Tk_Canvas canvas, + double x, + double y, + short* screenXPtr, + short* screenYPtr); +/* 22 */ +EXTERN void Tk_ChangeWindowAttributes( + Tk_Window tkwin, + unsigned long valueMask, + XSetWindowAttributes* attsPtr); +/* 23 */ +EXTERN int Tk_CharBbox( + Tk_TextLayout layout, + int index, + int* xPtr, + int* yPtr, + int* widthPtr, + int* heightPtr); +/* 24 */ +EXTERN void Tk_ClearSelection(Tk_Window tkwin, Atom selection); +/* 25 */ +EXTERN int Tk_ClipboardAppend( + Tcl_Interp* interp, + Tk_Window tkwin, + Atom target, + Atom format, + const char* buffer); +/* 26 */ +EXTERN int Tk_ClipboardClear(Tcl_Interp* interp, Tk_Window tkwin); +/* 27 */ +EXTERN int Tk_ConfigureInfo( + Tcl_Interp* interp, + Tk_Window tkwin, + const Tk_ConfigSpec* specs, + char* widgRec, + const char* argvName, + int flags); +/* 28 */ +EXTERN int Tk_ConfigureValue( + Tcl_Interp* interp, + Tk_Window tkwin, + const Tk_ConfigSpec* specs, + char* widgRec, + const char* argvName, + int flags); +/* 29 */ +EXTERN int Tk_ConfigureWidget( + Tcl_Interp* interp, + Tk_Window tkwin, + const Tk_ConfigSpec* specs, + int argc, + CONST84 char** argv, + char* widgRec, + int flags); +/* 30 */ +EXTERN void Tk_ConfigureWindow( + Tk_Window tkwin, + unsigned int valueMask, + XWindowChanges* valuePtr); +/* 31 */ +EXTERN Tk_TextLayout Tk_ComputeTextLayout( + Tk_Font font, + const char* str, + int numChars, + int wrapLength, + Tk_Justify justify, + int flags, + int* widthPtr, + int* heightPtr); +/* 32 */ +EXTERN Tk_Window Tk_CoordsToWindow(int rootX, int rootY, Tk_Window tkwin); +/* 33 */ +EXTERN unsigned long Tk_CreateBinding( + Tcl_Interp* interp, + Tk_BindingTable bindingTable, + ClientData object, + const char* eventStr, + const char* script, + int append); +/* 34 */ +EXTERN Tk_BindingTable Tk_CreateBindingTable(Tcl_Interp* interp); +/* 35 */ +EXTERN Tk_ErrorHandler Tk_CreateErrorHandler( + Display* display, + int errNum, + int request, + int minorCode, + Tk_ErrorProc* errorProc, + ClientData clientData); +/* 36 */ +EXTERN void Tk_CreateEventHandler( + Tk_Window token, + unsigned long mask, + Tk_EventProc* proc, + ClientData clientData); +/* 37 */ +EXTERN void Tk_CreateGenericHandler( + Tk_GenericProc* proc, + ClientData clientData); +/* 38 */ +EXTERN void Tk_CreateImageType(const Tk_ImageType* typePtr); +/* 39 */ +EXTERN void Tk_CreateItemType(Tk_ItemType* typePtr); +/* 40 */ +EXTERN void Tk_CreatePhotoImageFormat(const Tk_PhotoImageFormat* formatPtr); +/* 41 */ +EXTERN void Tk_CreateSelHandler( + Tk_Window tkwin, + Atom selection, + Atom target, + Tk_SelectionProc* proc, + ClientData clientData, + Atom format); +/* 42 */ +EXTERN Tk_Window Tk_CreateWindow( + Tcl_Interp* interp, + Tk_Window parent, + const char* name, + const char* screenName); +/* 43 */ +EXTERN Tk_Window Tk_CreateWindowFromPath( + Tcl_Interp* interp, + Tk_Window tkwin, + const char* pathName, + const char* screenName); +/* 44 */ +EXTERN int Tk_DefineBitmap( + Tcl_Interp* interp, + const char* name, + const void* source, + int width, + int height); +/* 45 */ +EXTERN void Tk_DefineCursor(Tk_Window window, Tk_Cursor cursor); +/* 46 */ +EXTERN void Tk_DeleteAllBindings( + Tk_BindingTable bindingTable, + ClientData object); +/* 47 */ +EXTERN int Tk_DeleteBinding( + Tcl_Interp* interp, + Tk_BindingTable bindingTable, + ClientData object, + const char* eventStr); +/* 48 */ +EXTERN void Tk_DeleteBindingTable(Tk_BindingTable bindingTable); +/* 49 */ +EXTERN void Tk_DeleteErrorHandler(Tk_ErrorHandler handler); +/* 50 */ +EXTERN void Tk_DeleteEventHandler( + Tk_Window token, + unsigned long mask, + Tk_EventProc* proc, + ClientData clientData); +/* 51 */ +EXTERN void Tk_DeleteGenericHandler( + Tk_GenericProc* proc, + ClientData clientData); +/* 52 */ +EXTERN void Tk_DeleteImage(Tcl_Interp* interp, const char* name); +/* 53 */ +EXTERN void Tk_DeleteSelHandler(Tk_Window tkwin, Atom selection, Atom target); +/* 54 */ +EXTERN void Tk_DestroyWindow(Tk_Window tkwin); +/* 55 */ +EXTERN CONST84_RETURN char* Tk_DisplayName(Tk_Window tkwin); +/* 56 */ +EXTERN int Tk_DistanceToTextLayout(Tk_TextLayout layout, int x, int y); +/* 57 */ +EXTERN void Tk_Draw3DPolygon( + Tk_Window tkwin, + Drawable drawable, + Tk_3DBorder border, + XPoint* pointPtr, + int numPoints, + int borderWidth, + int leftRelief); +/* 58 */ +EXTERN void Tk_Draw3DRectangle( + Tk_Window tkwin, + Drawable drawable, + Tk_3DBorder border, + int x, + int y, + int width, + int height, + int borderWidth, + int relief); +/* 59 */ +EXTERN void Tk_DrawChars( + Display* display, + Drawable drawable, + GC gc, + Tk_Font tkfont, + const char* source, + int numBytes, + int x, + int y); +/* 60 */ +EXTERN void +Tk_DrawFocusHighlight(Tk_Window tkwin, GC gc, int width, Drawable drawable); +/* 61 */ +EXTERN void Tk_DrawTextLayout( + Display* display, + Drawable drawable, + GC gc, + Tk_TextLayout layout, + int x, + int y, + int firstChar, + int lastChar); +/* 62 */ +EXTERN void Tk_Fill3DPolygon( + Tk_Window tkwin, + Drawable drawable, + Tk_3DBorder border, + XPoint* pointPtr, + int numPoints, + int borderWidth, + int leftRelief); +/* 63 */ +EXTERN void Tk_Fill3DRectangle( + Tk_Window tkwin, + Drawable drawable, + Tk_3DBorder border, + int x, + int y, + int width, + int height, + int borderWidth, + int relief); +/* 64 */ +EXTERN Tk_PhotoHandle Tk_FindPhoto(Tcl_Interp* interp, const char* imageName); +/* 65 */ +EXTERN Font Tk_FontId(Tk_Font font); +/* 66 */ +EXTERN void Tk_Free3DBorder(Tk_3DBorder border); +/* 67 */ +EXTERN void Tk_FreeBitmap(Display* display, Pixmap bitmap); +/* 68 */ +EXTERN void Tk_FreeColor(XColor* colorPtr); +/* 69 */ +EXTERN void Tk_FreeColormap(Display* display, Colormap colormap); +/* 70 */ +EXTERN void Tk_FreeCursor(Display* display, Tk_Cursor cursor); +/* 71 */ +EXTERN void Tk_FreeFont(Tk_Font f); +/* 72 */ +EXTERN void Tk_FreeGC(Display* display, GC gc); +/* 73 */ +EXTERN void Tk_FreeImage(Tk_Image image); +/* 74 */ +EXTERN void Tk_FreeOptions( + const Tk_ConfigSpec* specs, + char* widgRec, + Display* display, + int needFlags); +/* 75 */ +EXTERN void Tk_FreePixmap(Display* display, Pixmap pixmap); +/* 76 */ +EXTERN void Tk_FreeTextLayout(Tk_TextLayout textLayout); +/* 77 */ +EXTERN void Tk_FreeXId(Display* display, XID xid); +/* 78 */ +EXTERN GC Tk_GCForColor(XColor* colorPtr, Drawable drawable); +/* 79 */ +EXTERN void Tk_GeometryRequest(Tk_Window tkwin, int reqWidth, int reqHeight); +/* 80 */ +EXTERN Tk_3DBorder +Tk_Get3DBorder(Tcl_Interp* interp, Tk_Window tkwin, Tk_Uid colorName); +/* 81 */ +EXTERN void Tk_GetAllBindings( + Tcl_Interp* interp, + Tk_BindingTable bindingTable, + ClientData object); +/* 82 */ +EXTERN int +Tk_GetAnchor(Tcl_Interp* interp, const char* str, Tk_Anchor* anchorPtr); +/* 83 */ +EXTERN CONST84_RETURN char* Tk_GetAtomName(Tk_Window tkwin, Atom atom); +/* 84 */ +EXTERN CONST84_RETURN char* Tk_GetBinding( + Tcl_Interp* interp, + Tk_BindingTable bindingTable, + ClientData object, + const char* eventStr); +/* 85 */ +EXTERN Pixmap +Tk_GetBitmap(Tcl_Interp* interp, Tk_Window tkwin, const char* str); +/* 86 */ +EXTERN Pixmap Tk_GetBitmapFromData( + Tcl_Interp* interp, + Tk_Window tkwin, + const void* source, + int width, + int height); +/* 87 */ +EXTERN int Tk_GetCapStyle(Tcl_Interp* interp, const char* str, int* capPtr); +/* 88 */ +EXTERN XColor* Tk_GetColor(Tcl_Interp* interp, Tk_Window tkwin, Tk_Uid name); +/* 89 */ +EXTERN XColor* Tk_GetColorByValue(Tk_Window tkwin, XColor* colorPtr); +/* 90 */ +EXTERN Colormap +Tk_GetColormap(Tcl_Interp* interp, Tk_Window tkwin, const char* str); +/* 91 */ +EXTERN Tk_Cursor Tk_GetCursor(Tcl_Interp* interp, Tk_Window tkwin, Tk_Uid str); +/* 92 */ +EXTERN Tk_Cursor Tk_GetCursorFromData( + Tcl_Interp* interp, + Tk_Window tkwin, + const char* source, + const char* mask, + int width, + int height, + int xHot, + int yHot, + Tk_Uid fg, + Tk_Uid bg); +/* 93 */ +EXTERN Tk_Font Tk_GetFont(Tcl_Interp* interp, Tk_Window tkwin, const char* str); +/* 94 */ +EXTERN Tk_Font Tk_GetFontFromObj(Tk_Window tkwin, Tcl_Obj* objPtr); +/* 95 */ +EXTERN void Tk_GetFontMetrics(Tk_Font font, Tk_FontMetrics* fmPtr); +/* 96 */ +EXTERN GC +Tk_GetGC(Tk_Window tkwin, unsigned long valueMask, XGCValues* valuePtr); +/* 97 */ +EXTERN Tk_Image Tk_GetImage( + Tcl_Interp* interp, + Tk_Window tkwin, + const char* name, + Tk_ImageChangedProc* changeProc, + ClientData clientData); +/* 98 */ +EXTERN ClientData Tk_GetImageMasterData( + Tcl_Interp* interp, + const char* name, + CONST86 Tk_ImageType** typePtrPtr); +/* 99 */ +EXTERN Tk_ItemType* Tk_GetItemTypes(void); +/* 100 */ +EXTERN int Tk_GetJoinStyle(Tcl_Interp* interp, const char* str, int* joinPtr); +/* 101 */ +EXTERN int +Tk_GetJustify(Tcl_Interp* interp, const char* str, Tk_Justify* justifyPtr); +/* 102 */ +EXTERN int Tk_GetNumMainWindows(void); +/* 103 */ +EXTERN Tk_Uid +Tk_GetOption(Tk_Window tkwin, const char* name, const char* className); +/* 104 */ +EXTERN int +Tk_GetPixels(Tcl_Interp* interp, Tk_Window tkwin, const char* str, int* intPtr); +/* 105 */ +EXTERN Pixmap +Tk_GetPixmap(Display* display, Drawable d, int width, int height, int depth); +/* 106 */ +EXTERN int Tk_GetRelief(Tcl_Interp* interp, const char* name, int* reliefPtr); +/* 107 */ +EXTERN void Tk_GetRootCoords(Tk_Window tkwin, int* xPtr, int* yPtr); +/* 108 */ +EXTERN int Tk_GetScrollInfo( + Tcl_Interp* interp, + int argc, + CONST84 char** argv, + double* dblPtr, + int* intPtr); +/* 109 */ +EXTERN int Tk_GetScreenMM( + Tcl_Interp* interp, + Tk_Window tkwin, + const char* str, + double* doublePtr); +/* 110 */ +EXTERN int Tk_GetSelection( + Tcl_Interp* interp, + Tk_Window tkwin, + Atom selection, + Atom target, + Tk_GetSelProc* proc, + ClientData clientData); +/* 111 */ +EXTERN Tk_Uid Tk_GetUid(const char* str); +/* 112 */ +EXTERN Visual* Tk_GetVisual( + Tcl_Interp* interp, + Tk_Window tkwin, + const char* str, + int* depthPtr, + Colormap* colormapPtr); +/* 113 */ +EXTERN void Tk_GetVRootGeometry( + Tk_Window tkwin, + int* xPtr, + int* yPtr, + int* widthPtr, + int* heightPtr); +/* 114 */ +EXTERN int Tk_Grab(Tcl_Interp* interp, Tk_Window tkwin, int grabGlobal); +/* 115 */ +EXTERN void Tk_HandleEvent(XEvent* eventPtr); +/* 116 */ +EXTERN Tk_Window Tk_IdToWindow(Display* display, Window window); +/* 117 */ +EXTERN void Tk_ImageChanged( + Tk_ImageMaster master, + int x, + int y, + int width, + int height, + int imageWidth, + int imageHeight); +/* 118 */ +EXTERN int Tk_Init(Tcl_Interp* interp); +/* 119 */ +EXTERN Atom Tk_InternAtom(Tk_Window tkwin, const char* name); +/* 120 */ +EXTERN int Tk_IntersectTextLayout( + Tk_TextLayout layout, + int x, + int y, + int width, + int height); +/* 121 */ +EXTERN void Tk_MaintainGeometry( + Tk_Window slave, + Tk_Window master, + int x, + int y, + int width, + int height); +/* 122 */ +EXTERN Tk_Window Tk_MainWindow(Tcl_Interp* interp); +/* 123 */ +EXTERN void Tk_MakeWindowExist(Tk_Window tkwin); +/* 124 */ +EXTERN void Tk_ManageGeometry( + Tk_Window tkwin, + const Tk_GeomMgr* mgrPtr, + ClientData clientData); +/* 125 */ +EXTERN void Tk_MapWindow(Tk_Window tkwin); +/* 126 */ +EXTERN int Tk_MeasureChars( + Tk_Font tkfont, + const char* source, + int numBytes, + int maxPixels, + int flags, + int* lengthPtr); +/* 127 */ +EXTERN void +Tk_MoveResizeWindow(Tk_Window tkwin, int x, int y, int width, int height); +/* 128 */ +EXTERN void Tk_MoveWindow(Tk_Window tkwin, int x, int y); +/* 129 */ +EXTERN void Tk_MoveToplevelWindow(Tk_Window tkwin, int x, int y); +/* 130 */ +EXTERN CONST84_RETURN char* Tk_NameOf3DBorder(Tk_3DBorder border); +/* 131 */ +EXTERN CONST84_RETURN char* Tk_NameOfAnchor(Tk_Anchor anchor); +/* 132 */ +EXTERN CONST84_RETURN char* Tk_NameOfBitmap(Display* display, Pixmap bitmap); +/* 133 */ +EXTERN CONST84_RETURN char* Tk_NameOfCapStyle(int cap); +/* 134 */ +EXTERN CONST84_RETURN char* Tk_NameOfColor(XColor* colorPtr); +/* 135 */ +EXTERN CONST84_RETURN char* Tk_NameOfCursor(Display* display, Tk_Cursor cursor); +/* 136 */ +EXTERN CONST84_RETURN char* Tk_NameOfFont(Tk_Font font); +/* 137 */ +EXTERN CONST84_RETURN char* Tk_NameOfImage(Tk_ImageMaster imageMaster); +/* 138 */ +EXTERN CONST84_RETURN char* Tk_NameOfJoinStyle(int join); +/* 139 */ +EXTERN CONST84_RETURN char* Tk_NameOfJustify(Tk_Justify justify); +/* 140 */ +EXTERN CONST84_RETURN char* Tk_NameOfRelief(int relief); +/* 141 */ +EXTERN Tk_Window +Tk_NameToWindow(Tcl_Interp* interp, const char* pathName, Tk_Window tkwin); +/* 142 */ +EXTERN void Tk_OwnSelection( + Tk_Window tkwin, + Atom selection, + Tk_LostSelProc* proc, + ClientData clientData); +/* 143 */ +EXTERN int Tk_ParseArgv( + Tcl_Interp* interp, + Tk_Window tkwin, + int* argcPtr, + CONST84 char** argv, + const Tk_ArgvInfo* argTable, + int flags); +/* 144 */ +EXTERN void Tk_PhotoPutBlock_NoComposite( + Tk_PhotoHandle handle, + Tk_PhotoImageBlock* blockPtr, + int x, + int y, + int width, + int height); +/* 145 */ +EXTERN void Tk_PhotoPutZoomedBlock_NoComposite( + Tk_PhotoHandle handle, + Tk_PhotoImageBlock* blockPtr, + int x, + int y, + int width, + int height, + int zoomX, + int zoomY, + int subsampleX, + int subsampleY); +/* 146 */ +EXTERN int Tk_PhotoGetImage( + Tk_PhotoHandle handle, + Tk_PhotoImageBlock* blockPtr); +/* 147 */ +EXTERN void Tk_PhotoBlank(Tk_PhotoHandle handle); +/* 148 */ +EXTERN void Tk_PhotoExpand_Panic(Tk_PhotoHandle handle, int width, int height); +/* 149 */ +EXTERN void +Tk_PhotoGetSize(Tk_PhotoHandle handle, int* widthPtr, int* heightPtr); +/* 150 */ +EXTERN void Tk_PhotoSetSize_Panic(Tk_PhotoHandle handle, int width, int height); +/* 151 */ +EXTERN int Tk_PointToChar(Tk_TextLayout layout, int x, int y); +/* 152 */ +EXTERN int Tk_PostscriptFontName(Tk_Font tkfont, Tcl_DString* dsPtr); +/* 153 */ +EXTERN void Tk_PreserveColormap(Display* display, Colormap colormap); +/* 154 */ +EXTERN void Tk_QueueWindowEvent(XEvent* eventPtr, Tcl_QueuePosition position); +/* 155 */ +EXTERN void Tk_RedrawImage( + Tk_Image image, + int imageX, + int imageY, + int width, + int height, + Drawable drawable, + int drawableX, + int drawableY); +/* 156 */ +EXTERN void Tk_ResizeWindow(Tk_Window tkwin, int width, int height); +/* 157 */ +EXTERN int Tk_RestackWindow(Tk_Window tkwin, int aboveBelow, Tk_Window other); +/* 158 */ +EXTERN Tk_RestrictProc* Tk_RestrictEvents( + Tk_RestrictProc* proc, + ClientData arg, + ClientData* prevArgPtr); +/* 159 */ +EXTERN int Tk_SafeInit(Tcl_Interp* interp); +/* 160 */ +EXTERN const char* Tk_SetAppName(Tk_Window tkwin, const char* name); +/* 161 */ +EXTERN void Tk_SetBackgroundFromBorder(Tk_Window tkwin, Tk_3DBorder border); +/* 162 */ +EXTERN void Tk_SetClass(Tk_Window tkwin, const char* className); +/* 163 */ +EXTERN void Tk_SetGrid( + Tk_Window tkwin, + int reqWidth, + int reqHeight, + int gridWidth, + int gridHeight); +/* 164 */ +EXTERN void Tk_SetInternalBorder(Tk_Window tkwin, int width); +/* 165 */ +EXTERN void Tk_SetWindowBackground(Tk_Window tkwin, unsigned long pixel); +/* 166 */ +EXTERN void Tk_SetWindowBackgroundPixmap(Tk_Window tkwin, Pixmap pixmap); +/* 167 */ +EXTERN void Tk_SetWindowBorder(Tk_Window tkwin, unsigned long pixel); +/* 168 */ +EXTERN void Tk_SetWindowBorderWidth(Tk_Window tkwin, int width); +/* 169 */ +EXTERN void Tk_SetWindowBorderPixmap(Tk_Window tkwin, Pixmap pixmap); +/* 170 */ +EXTERN void Tk_SetWindowColormap(Tk_Window tkwin, Colormap colormap); +/* 171 */ +EXTERN int Tk_SetWindowVisual( + Tk_Window tkwin, + Visual* visual, + int depth, + Colormap colormap); +/* 172 */ +EXTERN void +Tk_SizeOfBitmap(Display* display, Pixmap bitmap, int* widthPtr, int* heightPtr); +/* 173 */ +EXTERN void Tk_SizeOfImage(Tk_Image image, int* widthPtr, int* heightPtr); +/* 174 */ +EXTERN int Tk_StrictMotif(Tk_Window tkwin); +/* 175 */ +EXTERN void Tk_TextLayoutToPostscript(Tcl_Interp* interp, Tk_TextLayout layout); +/* 176 */ +EXTERN int Tk_TextWidth(Tk_Font font, const char* str, int numBytes); +/* 177 */ +EXTERN void Tk_UndefineCursor(Tk_Window window); +/* 178 */ +EXTERN void Tk_UnderlineChars( + Display* display, + Drawable drawable, + GC gc, + Tk_Font tkfont, + const char* source, + int x, + int y, + int firstByte, + int lastByte); +/* 179 */ +EXTERN void Tk_UnderlineTextLayout( + Display* display, + Drawable drawable, + GC gc, + Tk_TextLayout layout, + int x, + int y, + int underline); +/* 180 */ +EXTERN void Tk_Ungrab(Tk_Window tkwin); +/* 181 */ +EXTERN void Tk_UnmaintainGeometry(Tk_Window slave, Tk_Window master); +/* 182 */ +EXTERN void Tk_UnmapWindow(Tk_Window tkwin); +/* 183 */ +EXTERN void Tk_UnsetGrid(Tk_Window tkwin); +/* 184 */ +EXTERN void Tk_UpdatePointer(Tk_Window tkwin, int x, int y, int state); +/* 185 */ +EXTERN Pixmap +Tk_AllocBitmapFromObj(Tcl_Interp* interp, Tk_Window tkwin, Tcl_Obj* objPtr); +/* 186 */ +EXTERN Tk_3DBorder +Tk_Alloc3DBorderFromObj(Tcl_Interp* interp, Tk_Window tkwin, Tcl_Obj* objPtr); +/* 187 */ +EXTERN XColor* +Tk_AllocColorFromObj(Tcl_Interp* interp, Tk_Window tkwin, Tcl_Obj* objPtr); +/* 188 */ +EXTERN Tk_Cursor +Tk_AllocCursorFromObj(Tcl_Interp* interp, Tk_Window tkwin, Tcl_Obj* objPtr); +/* 189 */ +EXTERN Tk_Font +Tk_AllocFontFromObj(Tcl_Interp* interp, Tk_Window tkwin, Tcl_Obj* objPtr); +/* 190 */ +EXTERN Tk_OptionTable +Tk_CreateOptionTable(Tcl_Interp* interp, const Tk_OptionSpec* templatePtr); +/* 191 */ +EXTERN void Tk_DeleteOptionTable(Tk_OptionTable optionTable); +/* 192 */ +EXTERN void Tk_Free3DBorderFromObj(Tk_Window tkwin, Tcl_Obj* objPtr); +/* 193 */ +EXTERN void Tk_FreeBitmapFromObj(Tk_Window tkwin, Tcl_Obj* objPtr); +/* 194 */ +EXTERN void Tk_FreeColorFromObj(Tk_Window tkwin, Tcl_Obj* objPtr); +/* 195 */ +EXTERN void Tk_FreeConfigOptions( + char* recordPtr, + Tk_OptionTable optionToken, + Tk_Window tkwin); +/* 196 */ +EXTERN void Tk_FreeSavedOptions(Tk_SavedOptions* savePtr); +/* 197 */ +EXTERN void Tk_FreeCursorFromObj(Tk_Window tkwin, Tcl_Obj* objPtr); +/* 198 */ +EXTERN void Tk_FreeFontFromObj(Tk_Window tkwin, Tcl_Obj* objPtr); +/* 199 */ +EXTERN Tk_3DBorder Tk_Get3DBorderFromObj(Tk_Window tkwin, Tcl_Obj* objPtr); +/* 200 */ +EXTERN int +Tk_GetAnchorFromObj(Tcl_Interp* interp, Tcl_Obj* objPtr, Tk_Anchor* anchorPtr); +/* 201 */ +EXTERN Pixmap Tk_GetBitmapFromObj(Tk_Window tkwin, Tcl_Obj* objPtr); +/* 202 */ +EXTERN XColor* Tk_GetColorFromObj(Tk_Window tkwin, Tcl_Obj* objPtr); +/* 203 */ +EXTERN Tk_Cursor Tk_GetCursorFromObj(Tk_Window tkwin, Tcl_Obj* objPtr); +/* 204 */ +EXTERN Tcl_Obj* Tk_GetOptionInfo( + Tcl_Interp* interp, + char* recordPtr, + Tk_OptionTable optionTable, + Tcl_Obj* namePtr, + Tk_Window tkwin); +/* 205 */ +EXTERN Tcl_Obj* Tk_GetOptionValue( + Tcl_Interp* interp, + char* recordPtr, + Tk_OptionTable optionTable, + Tcl_Obj* namePtr, + Tk_Window tkwin); +/* 206 */ +EXTERN int Tk_GetJustifyFromObj( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + Tk_Justify* justifyPtr); +/* 207 */ +EXTERN int Tk_GetMMFromObj( + Tcl_Interp* interp, + Tk_Window tkwin, + Tcl_Obj* objPtr, + double* doublePtr); +/* 208 */ +EXTERN int Tk_GetPixelsFromObj( + Tcl_Interp* interp, + Tk_Window tkwin, + Tcl_Obj* objPtr, + int* intPtr); +/* 209 */ +EXTERN int +Tk_GetReliefFromObj(Tcl_Interp* interp, Tcl_Obj* objPtr, int* resultPtr); +/* 210 */ +EXTERN int Tk_GetScrollInfoObj( + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[], + double* dblPtr, + int* intPtr); +/* 211 */ +EXTERN int Tk_InitOptions( + Tcl_Interp* interp, + char* recordPtr, + Tk_OptionTable optionToken, + Tk_Window tkwin); +/* 212 */ +EXTERN void Tk_MainEx( + int argc, + char** argv, + Tcl_AppInitProc* appInitProc, + Tcl_Interp* interp); +/* 213 */ +EXTERN void Tk_RestoreSavedOptions(Tk_SavedOptions* savePtr); +/* 214 */ +EXTERN int Tk_SetOptions( + Tcl_Interp* interp, + char* recordPtr, + Tk_OptionTable optionTable, + int objc, + Tcl_Obj* const objv[], + Tk_Window tkwin, + Tk_SavedOptions* savePtr, + int* maskPtr); +/* 215 */ +EXTERN void Tk_InitConsoleChannels(Tcl_Interp* interp); +/* 216 */ +EXTERN int Tk_CreateConsoleWindow(Tcl_Interp* interp); +/* 217 */ +EXTERN void Tk_CreateSmoothMethod( + Tcl_Interp* interp, + const Tk_SmoothMethod* method); +/* Slot 218 is reserved */ +/* Slot 219 is reserved */ +/* 220 */ +EXTERN int Tk_GetDash(Tcl_Interp* interp, const char* value, Tk_Dash* dash); +/* 221 */ +EXTERN void Tk_CreateOutline(Tk_Outline* outline); +/* 222 */ +EXTERN void Tk_DeleteOutline(Display* display, Tk_Outline* outline); +/* 223 */ +EXTERN int Tk_ConfigOutlineGC( + XGCValues* gcValues, + Tk_Canvas canvas, + Tk_Item* item, + Tk_Outline* outline); +/* 224 */ +EXTERN int +Tk_ChangeOutlineGC(Tk_Canvas canvas, Tk_Item* item, Tk_Outline* outline); +/* 225 */ +EXTERN int +Tk_ResetOutlineGC(Tk_Canvas canvas, Tk_Item* item, Tk_Outline* outline); +/* 226 */ +EXTERN int +Tk_CanvasPsOutline(Tk_Canvas canvas, Tk_Item* item, Tk_Outline* outline); +/* 227 */ +EXTERN void Tk_SetTSOrigin(Tk_Window tkwin, GC gc, int x, int y); +/* 228 */ +EXTERN int Tk_CanvasGetCoordFromObj( + Tcl_Interp* interp, + Tk_Canvas canvas, + Tcl_Obj* obj, + double* doublePtr); +/* 229 */ +EXTERN void Tk_CanvasSetOffset(Tk_Canvas canvas, GC gc, Tk_TSOffset* offset); +/* 230 */ +EXTERN void +Tk_DitherPhoto(Tk_PhotoHandle handle, int x, int y, int width, int height); +/* 231 */ +EXTERN int Tk_PostscriptBitmap( + Tcl_Interp* interp, + Tk_Window tkwin, + Tk_PostscriptInfo psInfo, + Pixmap bitmap, + int startX, + int startY, + int width, + int height); +/* 232 */ +EXTERN int Tk_PostscriptColor( + Tcl_Interp* interp, + Tk_PostscriptInfo psInfo, + XColor* colorPtr); +/* 233 */ +EXTERN int +Tk_PostscriptFont(Tcl_Interp* interp, Tk_PostscriptInfo psInfo, Tk_Font font); +/* 234 */ +EXTERN int Tk_PostscriptImage( + Tk_Image image, + Tcl_Interp* interp, + Tk_Window tkwin, + Tk_PostscriptInfo psinfo, + int x, + int y, + int width, + int height, + int prepass); +/* 235 */ +EXTERN void Tk_PostscriptPath( + Tcl_Interp* interp, + Tk_PostscriptInfo psInfo, + double* coordPtr, + int numPoints); +/* 236 */ +EXTERN int Tk_PostscriptStipple( + Tcl_Interp* interp, + Tk_Window tkwin, + Tk_PostscriptInfo psInfo, + Pixmap bitmap); +/* 237 */ +EXTERN double Tk_PostscriptY(double y, Tk_PostscriptInfo psInfo); +/* 238 */ +EXTERN int Tk_PostscriptPhoto( + Tcl_Interp* interp, + Tk_PhotoImageBlock* blockPtr, + Tk_PostscriptInfo psInfo, + int width, + int height); +/* 239 */ +EXTERN void Tk_CreateClientMessageHandler(Tk_ClientMessageProc* proc); +/* 240 */ +EXTERN void Tk_DeleteClientMessageHandler(Tk_ClientMessageProc* proc); +/* 241 */ +EXTERN Tk_Window Tk_CreateAnonymousWindow( + Tcl_Interp* interp, + Tk_Window parent, + const char* screenName); +/* 242 */ +EXTERN void Tk_SetClassProcs( + Tk_Window tkwin, + const Tk_ClassProcs* procs, + ClientData instanceData); +/* 243 */ +EXTERN void Tk_SetInternalBorderEx( + Tk_Window tkwin, + int left, + int right, + int top, + int bottom); +/* 244 */ +EXTERN void +Tk_SetMinimumRequestSize(Tk_Window tkwin, int minWidth, int minHeight); +/* 245 */ +EXTERN void Tk_SetCaretPos(Tk_Window tkwin, int x, int y, int height); +/* 246 */ +EXTERN void Tk_PhotoPutBlock_Panic( + Tk_PhotoHandle handle, + Tk_PhotoImageBlock* blockPtr, + int x, + int y, + int width, + int height, + int compRule); +/* 247 */ +EXTERN void Tk_PhotoPutZoomedBlock_Panic( + Tk_PhotoHandle handle, + Tk_PhotoImageBlock* blockPtr, + int x, + int y, + int width, + int height, + int zoomX, + int zoomY, + int subsampleX, + int subsampleY, + int compRule); +/* 248 */ +EXTERN int Tk_CollapseMotionEvents(Display* display, int collapse); +/* 249 */ +EXTERN Tk_StyleEngine +Tk_RegisterStyleEngine(const char* name, Tk_StyleEngine parent); +/* 250 */ +EXTERN Tk_StyleEngine Tk_GetStyleEngine(const char* name); +/* 251 */ +EXTERN int Tk_RegisterStyledElement( + Tk_StyleEngine engine, + Tk_ElementSpec* templatePtr); +/* 252 */ +EXTERN int Tk_GetElementId(const char* name); +/* 253 */ +EXTERN Tk_Style +Tk_CreateStyle(const char* name, Tk_StyleEngine engine, ClientData clientData); +/* 254 */ +EXTERN Tk_Style Tk_GetStyle(Tcl_Interp* interp, const char* name); +/* 255 */ +EXTERN void Tk_FreeStyle(Tk_Style style); +/* 256 */ +EXTERN const char* Tk_NameOfStyle(Tk_Style style); +/* 257 */ +EXTERN Tk_Style Tk_AllocStyleFromObj(Tcl_Interp* interp, Tcl_Obj* objPtr); +/* 258 */ +EXTERN Tk_Style Tk_GetStyleFromObj(Tcl_Obj* objPtr); +/* 259 */ +EXTERN void Tk_FreeStyleFromObj(Tcl_Obj* objPtr); +/* 260 */ +EXTERN Tk_StyledElement +Tk_GetStyledElement(Tk_Style style, int elementId, Tk_OptionTable optionTable); +/* 261 */ +EXTERN void Tk_GetElementSize( + Tk_Style style, + Tk_StyledElement element, + char* recordPtr, + Tk_Window tkwin, + int width, + int height, + int inner, + int* widthPtr, + int* heightPtr); +/* 262 */ +EXTERN void Tk_GetElementBox( + Tk_Style style, + Tk_StyledElement element, + char* recordPtr, + Tk_Window tkwin, + int x, + int y, + int width, + int height, + int inner, + int* xPtr, + int* yPtr, + int* widthPtr, + int* heightPtr); +/* 263 */ +EXTERN int Tk_GetElementBorderWidth( + Tk_Style style, + Tk_StyledElement element, + char* recordPtr, + Tk_Window tkwin); +/* 264 */ +EXTERN void Tk_DrawElement( + Tk_Style style, + Tk_StyledElement element, + char* recordPtr, + Tk_Window tkwin, + Drawable d, + int x, + int y, + int width, + int height, + int state); +/* 265 */ +EXTERN int Tk_PhotoExpand( + Tcl_Interp* interp, + Tk_PhotoHandle handle, + int width, + int height); +/* 266 */ +EXTERN int Tk_PhotoPutBlock( + Tcl_Interp* interp, + Tk_PhotoHandle handle, + Tk_PhotoImageBlock* blockPtr, + int x, + int y, + int width, + int height, + int compRule); +/* 267 */ +EXTERN int Tk_PhotoPutZoomedBlock( + Tcl_Interp* interp, + Tk_PhotoHandle handle, + Tk_PhotoImageBlock* blockPtr, + int x, + int y, + int width, + int height, + int zoomX, + int zoomY, + int subsampleX, + int subsampleY, + int compRule); +/* 268 */ +EXTERN int Tk_PhotoSetSize( + Tcl_Interp* interp, + Tk_PhotoHandle handle, + int width, + int height); +/* 269 */ +EXTERN long Tk_GetUserInactiveTime(Display* dpy); +/* 270 */ +EXTERN void Tk_ResetUserInactiveTime(Display* dpy); +/* 271 */ +EXTERN Tcl_Interp* Tk_Interp(Tk_Window tkwin); +/* 272 */ +EXTERN void Tk_CreateOldImageType(const Tk_ImageType* typePtr); +/* 273 */ +EXTERN void Tk_CreateOldPhotoImageFormat(const Tk_PhotoImageFormat* formatPtr); + +typedef struct { + const struct TkPlatStubs* tkPlatStubs; + const struct TkIntStubs* tkIntStubs; + const struct TkIntPlatStubs* tkIntPlatStubs; + const struct TkIntXlibStubs* tkIntXlibStubs; +} TkStubHooks; + +typedef struct TkStubs { + int magic; + const TkStubHooks* hooks; + + void (*tk_MainLoop)(void); /* 0 */ + XColor* (*tk_3DBorderColor)(Tk_3DBorder border); /* 1 */ + GC (*tk_3DBorderGC)(Tk_Window tkwin, Tk_3DBorder border, int which); /* 2 */ + void (*tk_3DHorizontalBevel)( + Tk_Window tkwin, + Drawable drawable, + Tk_3DBorder border, + int x, + int y, + int width, + int height, + int leftIn, + int rightIn, + int topBevel, + int relief); /* 3 */ + void (*tk_3DVerticalBevel)( + Tk_Window tkwin, + Drawable drawable, + Tk_3DBorder border, + int x, + int y, + int width, + int height, + int leftBevel, + int relief); /* 4 */ + void (*tk_AddOption)( + Tk_Window tkwin, + const char* name, + const char* value, + int priority); /* 5 */ + void (*tk_BindEvent)( + Tk_BindingTable bindingTable, + XEvent* eventPtr, + Tk_Window tkwin, + int numObjects, + ClientData* objectPtr); /* 6 */ + void (*tk_CanvasDrawableCoords)( + Tk_Canvas canvas, + double x, + double y, + short* drawableXPtr, + short* drawableYPtr); /* 7 */ + void (*tk_CanvasEventuallyRedraw)( + Tk_Canvas canvas, + int x1, + int y1, + int x2, + int y2); /* 8 */ + int (*tk_CanvasGetCoord)( + Tcl_Interp* interp, + Tk_Canvas canvas, + const char* str, + double* doublePtr); /* 9 */ + Tk_CanvasTextInfo* (*tk_CanvasGetTextInfo)(Tk_Canvas canvas); /* 10 */ + int (*tk_CanvasPsBitmap)( + Tcl_Interp* interp, + Tk_Canvas canvas, + Pixmap bitmap, + int x, + int y, + int width, + int height); /* 11 */ + int (*tk_CanvasPsColor)( + Tcl_Interp* interp, + Tk_Canvas canvas, + XColor* colorPtr); /* 12 */ + int (*tk_CanvasPsFont)( + Tcl_Interp* interp, + Tk_Canvas canvas, + Tk_Font font); /* 13 */ + void (*tk_CanvasPsPath)( + Tcl_Interp* interp, + Tk_Canvas canvas, + double* coordPtr, + int numPoints); /* 14 */ + int (*tk_CanvasPsStipple)( + Tcl_Interp* interp, + Tk_Canvas canvas, + Pixmap bitmap); /* 15 */ + double (*tk_CanvasPsY)(Tk_Canvas canvas, double y); /* 16 */ + void (*tk_CanvasSetStippleOrigin)(Tk_Canvas canvas, GC gc); /* 17 */ + int (*tk_CanvasTagsParseProc)( + ClientData clientData, + Tcl_Interp* interp, + Tk_Window tkwin, + const char* value, + char* widgRec, + int offset); /* 18 */ + CONST86 char* (*tk_CanvasTagsPrintProc)( + ClientData clientData, + Tk_Window tkwin, + char* widgRec, + int offset, + Tcl_FreeProc** freeProcPtr); /* 19 */ + Tk_Window (*tk_CanvasTkwin)(Tk_Canvas canvas); /* 20 */ + void (*tk_CanvasWindowCoords)( + Tk_Canvas canvas, + double x, + double y, + short* screenXPtr, + short* screenYPtr); /* 21 */ + void (*tk_ChangeWindowAttributes)( + Tk_Window tkwin, + unsigned long valueMask, + XSetWindowAttributes* attsPtr); /* 22 */ + int (*tk_CharBbox)( + Tk_TextLayout layout, + int index, + int* xPtr, + int* yPtr, + int* widthPtr, + int* heightPtr); /* 23 */ + void (*tk_ClearSelection)(Tk_Window tkwin, Atom selection); /* 24 */ + int (*tk_ClipboardAppend)( + Tcl_Interp* interp, + Tk_Window tkwin, + Atom target, + Atom format, + const char* buffer); /* 25 */ + int (*tk_ClipboardClear)(Tcl_Interp* interp, Tk_Window tkwin); /* 26 */ + int (*tk_ConfigureInfo)( + Tcl_Interp* interp, + Tk_Window tkwin, + const Tk_ConfigSpec* specs, + char* widgRec, + const char* argvName, + int flags); /* 27 */ + int (*tk_ConfigureValue)( + Tcl_Interp* interp, + Tk_Window tkwin, + const Tk_ConfigSpec* specs, + char* widgRec, + const char* argvName, + int flags); /* 28 */ + int (*tk_ConfigureWidget)( + Tcl_Interp* interp, + Tk_Window tkwin, + const Tk_ConfigSpec* specs, + int argc, + CONST84 char** argv, + char* widgRec, + int flags); /* 29 */ + void (*tk_ConfigureWindow)( + Tk_Window tkwin, + unsigned int valueMask, + XWindowChanges* valuePtr); /* 30 */ + Tk_TextLayout (*tk_ComputeTextLayout)( + Tk_Font font, + const char* str, + int numChars, + int wrapLength, + Tk_Justify justify, + int flags, + int* widthPtr, + int* heightPtr); /* 31 */ + Tk_Window ( + *tk_CoordsToWindow)(int rootX, int rootY, Tk_Window tkwin); /* 32 */ + unsigned long (*tk_CreateBinding)( + Tcl_Interp* interp, + Tk_BindingTable bindingTable, + ClientData object, + const char* eventStr, + const char* script, + int append); /* 33 */ + Tk_BindingTable (*tk_CreateBindingTable)(Tcl_Interp* interp); /* 34 */ + Tk_ErrorHandler (*tk_CreateErrorHandler)( + Display* display, + int errNum, + int request, + int minorCode, + Tk_ErrorProc* errorProc, + ClientData clientData); /* 35 */ + void (*tk_CreateEventHandler)( + Tk_Window token, + unsigned long mask, + Tk_EventProc* proc, + ClientData clientData); /* 36 */ + void (*tk_CreateGenericHandler)( + Tk_GenericProc* proc, + ClientData clientData); /* 37 */ + void (*tk_CreateImageType)(const Tk_ImageType* typePtr); /* 38 */ + void (*tk_CreateItemType)(Tk_ItemType* typePtr); /* 39 */ + void (*tk_CreatePhotoImageFormat)( + const Tk_PhotoImageFormat* formatPtr); /* 40 */ + void (*tk_CreateSelHandler)( + Tk_Window tkwin, + Atom selection, + Atom target, + Tk_SelectionProc* proc, + ClientData clientData, + Atom format); /* 41 */ + Tk_Window (*tk_CreateWindow)( + Tcl_Interp* interp, + Tk_Window parent, + const char* name, + const char* screenName); /* 42 */ + Tk_Window (*tk_CreateWindowFromPath)( + Tcl_Interp* interp, + Tk_Window tkwin, + const char* pathName, + const char* screenName); /* 43 */ + int (*tk_DefineBitmap)( + Tcl_Interp* interp, + const char* name, + const void* source, + int width, + int height); /* 44 */ + void (*tk_DefineCursor)(Tk_Window window, Tk_Cursor cursor); /* 45 */ + void (*tk_DeleteAllBindings)( + Tk_BindingTable bindingTable, + ClientData object); /* 46 */ + int (*tk_DeleteBinding)( + Tcl_Interp* interp, + Tk_BindingTable bindingTable, + ClientData object, + const char* eventStr); /* 47 */ + void (*tk_DeleteBindingTable)(Tk_BindingTable bindingTable); /* 48 */ + void (*tk_DeleteErrorHandler)(Tk_ErrorHandler handler); /* 49 */ + void (*tk_DeleteEventHandler)( + Tk_Window token, + unsigned long mask, + Tk_EventProc* proc, + ClientData clientData); /* 50 */ + void (*tk_DeleteGenericHandler)( + Tk_GenericProc* proc, + ClientData clientData); /* 51 */ + void (*tk_DeleteImage)(Tcl_Interp* interp, const char* name); /* 52 */ + void (*tk_DeleteSelHandler)( + Tk_Window tkwin, + Atom selection, + Atom target); /* 53 */ + void (*tk_DestroyWindow)(Tk_Window tkwin); /* 54 */ + CONST84_RETURN char* (*tk_DisplayName)(Tk_Window tkwin); /* 55 */ + int (*tk_DistanceToTextLayout)(Tk_TextLayout layout, int x, int y); /* 56 */ + void (*tk_Draw3DPolygon)( + Tk_Window tkwin, + Drawable drawable, + Tk_3DBorder border, + XPoint* pointPtr, + int numPoints, + int borderWidth, + int leftRelief); /* 57 */ + void (*tk_Draw3DRectangle)( + Tk_Window tkwin, + Drawable drawable, + Tk_3DBorder border, + int x, + int y, + int width, + int height, + int borderWidth, + int relief); /* 58 */ + void (*tk_DrawChars)( + Display* display, + Drawable drawable, + GC gc, + Tk_Font tkfont, + const char* source, + int numBytes, + int x, + int y); /* 59 */ + void (*tk_DrawFocusHighlight)( + Tk_Window tkwin, + GC gc, + int width, + Drawable drawable); /* 60 */ + void (*tk_DrawTextLayout)( + Display* display, + Drawable drawable, + GC gc, + Tk_TextLayout layout, + int x, + int y, + int firstChar, + int lastChar); /* 61 */ + void (*tk_Fill3DPolygon)( + Tk_Window tkwin, + Drawable drawable, + Tk_3DBorder border, + XPoint* pointPtr, + int numPoints, + int borderWidth, + int leftRelief); /* 62 */ + void (*tk_Fill3DRectangle)( + Tk_Window tkwin, + Drawable drawable, + Tk_3DBorder border, + int x, + int y, + int width, + int height, + int borderWidth, + int relief); /* 63 */ + Tk_PhotoHandle ( + *tk_FindPhoto)(Tcl_Interp* interp, const char* imageName); /* 64 */ + Font (*tk_FontId)(Tk_Font font); /* 65 */ + void (*tk_Free3DBorder)(Tk_3DBorder border); /* 66 */ + void (*tk_FreeBitmap)(Display* display, Pixmap bitmap); /* 67 */ + void (*tk_FreeColor)(XColor* colorPtr); /* 68 */ + void (*tk_FreeColormap)(Display* display, Colormap colormap); /* 69 */ + void (*tk_FreeCursor)(Display* display, Tk_Cursor cursor); /* 70 */ + void (*tk_FreeFont)(Tk_Font f); /* 71 */ + void (*tk_FreeGC)(Display* display, GC gc); /* 72 */ + void (*tk_FreeImage)(Tk_Image image); /* 73 */ + void (*tk_FreeOptions)( + const Tk_ConfigSpec* specs, + char* widgRec, + Display* display, + int needFlags); /* 74 */ + void (*tk_FreePixmap)(Display* display, Pixmap pixmap); /* 75 */ + void (*tk_FreeTextLayout)(Tk_TextLayout textLayout); /* 76 */ + void (*tk_FreeXId)(Display* display, XID xid); /* 77 */ + GC (*tk_GCForColor)(XColor* colorPtr, Drawable drawable); /* 78 */ + void (*tk_GeometryRequest)( + Tk_Window tkwin, + int reqWidth, + int reqHeight); /* 79 */ + Tk_3DBorder (*tk_Get3DBorder)( + Tcl_Interp* interp, + Tk_Window tkwin, + Tk_Uid colorName); /* 80 */ + void (*tk_GetAllBindings)( + Tcl_Interp* interp, + Tk_BindingTable bindingTable, + ClientData object); /* 81 */ + int (*tk_GetAnchor)( + Tcl_Interp* interp, + const char* str, + Tk_Anchor* anchorPtr); /* 82 */ + CONST84_RETURN char* (*tk_GetAtomName)(Tk_Window tkwin, Atom atom); /* 83 */ + CONST84_RETURN char* (*tk_GetBinding)( + Tcl_Interp* interp, + Tk_BindingTable bindingTable, + ClientData object, + const char* eventStr); /* 84 */ + Pixmap (*tk_GetBitmap)( + Tcl_Interp* interp, + Tk_Window tkwin, + const char* str); /* 85 */ + Pixmap (*tk_GetBitmapFromData)( + Tcl_Interp* interp, + Tk_Window tkwin, + const void* source, + int width, + int height); /* 86 */ + int (*tk_GetCapStyle)( + Tcl_Interp* interp, + const char* str, + int* capPtr); /* 87 */ + XColor* ( + *tk_GetColor)(Tcl_Interp* interp, Tk_Window tkwin, Tk_Uid name); /* 88 */ + XColor* (*tk_GetColorByValue)(Tk_Window tkwin, XColor* colorPtr); /* 89 */ + Colormap (*tk_GetColormap)( + Tcl_Interp* interp, + Tk_Window tkwin, + const char* str); /* 90 */ + Tk_Cursor ( + *tk_GetCursor)(Tcl_Interp* interp, Tk_Window tkwin, Tk_Uid str); /* 91 */ + Tk_Cursor (*tk_GetCursorFromData)( + Tcl_Interp* interp, + Tk_Window tkwin, + const char* source, + const char* mask, + int width, + int height, + int xHot, + int yHot, + Tk_Uid fg, + Tk_Uid bg); /* 92 */ + Tk_Font (*tk_GetFont)( + Tcl_Interp* interp, + Tk_Window tkwin, + const char* str); /* 93 */ + Tk_Font (*tk_GetFontFromObj)(Tk_Window tkwin, Tcl_Obj* objPtr); /* 94 */ + void (*tk_GetFontMetrics)(Tk_Font font, Tk_FontMetrics* fmPtr); /* 95 */ + GC (*tk_GetGC) + (Tk_Window tkwin, unsigned long valueMask, XGCValues* valuePtr); /* 96 */ + Tk_Image (*tk_GetImage)( + Tcl_Interp* interp, + Tk_Window tkwin, + const char* name, + Tk_ImageChangedProc* changeProc, + ClientData clientData); /* 97 */ + ClientData (*tk_GetImageMasterData)( + Tcl_Interp* interp, + const char* name, + CONST86 Tk_ImageType** typePtrPtr); /* 98 */ + Tk_ItemType* (*tk_GetItemTypes)(void); /* 99 */ + int (*tk_GetJoinStyle)( + Tcl_Interp* interp, + const char* str, + int* joinPtr); /* 100 */ + int (*tk_GetJustify)( + Tcl_Interp* interp, + const char* str, + Tk_Justify* justifyPtr); /* 101 */ + int (*tk_GetNumMainWindows)(void); /* 102 */ + Tk_Uid (*tk_GetOption)( + Tk_Window tkwin, + const char* name, + const char* className); /* 103 */ + int (*tk_GetPixels)( + Tcl_Interp* interp, + Tk_Window tkwin, + const char* str, + int* intPtr); /* 104 */ + Pixmap (*tk_GetPixmap)( + Display* display, + Drawable d, + int width, + int height, + int depth); /* 105 */ + int (*tk_GetRelief)( + Tcl_Interp* interp, + const char* name, + int* reliefPtr); /* 106 */ + void (*tk_GetRootCoords)(Tk_Window tkwin, int* xPtr, int* yPtr); /* 107 */ + int (*tk_GetScrollInfo)( + Tcl_Interp* interp, + int argc, + CONST84 char** argv, + double* dblPtr, + int* intPtr); /* 108 */ + int (*tk_GetScreenMM)( + Tcl_Interp* interp, + Tk_Window tkwin, + const char* str, + double* doublePtr); /* 109 */ + int (*tk_GetSelection)( + Tcl_Interp* interp, + Tk_Window tkwin, + Atom selection, + Atom target, + Tk_GetSelProc* proc, + ClientData clientData); /* 110 */ + Tk_Uid (*tk_GetUid)(const char* str); /* 111 */ + Visual* (*tk_GetVisual)( + Tcl_Interp* interp, + Tk_Window tkwin, + const char* str, + int* depthPtr, + Colormap* colormapPtr); /* 112 */ + void (*tk_GetVRootGeometry)( + Tk_Window tkwin, + int* xPtr, + int* yPtr, + int* widthPtr, + int* heightPtr); /* 113 */ + int (*tk_Grab)(Tcl_Interp* interp, Tk_Window tkwin, int grabGlobal); /* 114 */ + void (*tk_HandleEvent)(XEvent* eventPtr); /* 115 */ + Tk_Window (*tk_IdToWindow)(Display* display, Window window); /* 116 */ + void (*tk_ImageChanged)( + Tk_ImageMaster master, + int x, + int y, + int width, + int height, + int imageWidth, + int imageHeight); /* 117 */ + int (*tk_Init)(Tcl_Interp* interp); /* 118 */ + Atom (*tk_InternAtom)(Tk_Window tkwin, const char* name); /* 119 */ + int (*tk_IntersectTextLayout)( + Tk_TextLayout layout, + int x, + int y, + int width, + int height); /* 120 */ + void (*tk_MaintainGeometry)( + Tk_Window slave, + Tk_Window master, + int x, + int y, + int width, + int height); /* 121 */ + Tk_Window (*tk_MainWindow)(Tcl_Interp* interp); /* 122 */ + void (*tk_MakeWindowExist)(Tk_Window tkwin); /* 123 */ + void (*tk_ManageGeometry)( + Tk_Window tkwin, + const Tk_GeomMgr* mgrPtr, + ClientData clientData); /* 124 */ + void (*tk_MapWindow)(Tk_Window tkwin); /* 125 */ + int (*tk_MeasureChars)( + Tk_Font tkfont, + const char* source, + int numBytes, + int maxPixels, + int flags, + int* lengthPtr); /* 126 */ + void (*tk_MoveResizeWindow)( + Tk_Window tkwin, + int x, + int y, + int width, + int height); /* 127 */ + void (*tk_MoveWindow)(Tk_Window tkwin, int x, int y); /* 128 */ + void (*tk_MoveToplevelWindow)(Tk_Window tkwin, int x, int y); /* 129 */ + CONST84_RETURN char* (*tk_NameOf3DBorder)(Tk_3DBorder border); /* 130 */ + CONST84_RETURN char* (*tk_NameOfAnchor)(Tk_Anchor anchor); /* 131 */ + CONST84_RETURN char* ( + *tk_NameOfBitmap)(Display* display, Pixmap bitmap); /* 132 */ + CONST84_RETURN char* (*tk_NameOfCapStyle)(int cap); /* 133 */ + CONST84_RETURN char* (*tk_NameOfColor)(XColor* colorPtr); /* 134 */ + CONST84_RETURN char* ( + *tk_NameOfCursor)(Display* display, Tk_Cursor cursor); /* 135 */ + CONST84_RETURN char* (*tk_NameOfFont)(Tk_Font font); /* 136 */ + CONST84_RETURN char* (*tk_NameOfImage)(Tk_ImageMaster imageMaster); /* 137 */ + CONST84_RETURN char* (*tk_NameOfJoinStyle)(int join); /* 138 */ + CONST84_RETURN char* (*tk_NameOfJustify)(Tk_Justify justify); /* 139 */ + CONST84_RETURN char* (*tk_NameOfRelief)(int relief); /* 140 */ + Tk_Window (*tk_NameToWindow)( + Tcl_Interp* interp, + const char* pathName, + Tk_Window tkwin); /* 141 */ + void (*tk_OwnSelection)( + Tk_Window tkwin, + Atom selection, + Tk_LostSelProc* proc, + ClientData clientData); /* 142 */ + int (*tk_ParseArgv)( + Tcl_Interp* interp, + Tk_Window tkwin, + int* argcPtr, + CONST84 char** argv, + const Tk_ArgvInfo* argTable, + int flags); /* 143 */ + void (*tk_PhotoPutBlock_NoComposite)( + Tk_PhotoHandle handle, + Tk_PhotoImageBlock* blockPtr, + int x, + int y, + int width, + int height); /* 144 */ + void (*tk_PhotoPutZoomedBlock_NoComposite)( + Tk_PhotoHandle handle, + Tk_PhotoImageBlock* blockPtr, + int x, + int y, + int width, + int height, + int zoomX, + int zoomY, + int subsampleX, + int subsampleY); /* 145 */ + int (*tk_PhotoGetImage)( + Tk_PhotoHandle handle, + Tk_PhotoImageBlock* blockPtr); /* 146 */ + void (*tk_PhotoBlank)(Tk_PhotoHandle handle); /* 147 */ + void (*tk_PhotoExpand_Panic)( + Tk_PhotoHandle handle, + int width, + int height); /* 148 */ + void (*tk_PhotoGetSize)( + Tk_PhotoHandle handle, + int* widthPtr, + int* heightPtr); /* 149 */ + void (*tk_PhotoSetSize_Panic)( + Tk_PhotoHandle handle, + int width, + int height); /* 150 */ + int (*tk_PointToChar)(Tk_TextLayout layout, int x, int y); /* 151 */ + int (*tk_PostscriptFontName)(Tk_Font tkfont, Tcl_DString* dsPtr); /* 152 */ + void (*tk_PreserveColormap)(Display* display, Colormap colormap); /* 153 */ + void (*tk_QueueWindowEvent)( + XEvent* eventPtr, + Tcl_QueuePosition position); /* 154 */ + void (*tk_RedrawImage)( + Tk_Image image, + int imageX, + int imageY, + int width, + int height, + Drawable drawable, + int drawableX, + int drawableY); /* 155 */ + void (*tk_ResizeWindow)(Tk_Window tkwin, int width, int height); /* 156 */ + int (*tk_RestackWindow)( + Tk_Window tkwin, + int aboveBelow, + Tk_Window other); /* 157 */ + Tk_RestrictProc* (*tk_RestrictEvents)( + Tk_RestrictProc* proc, + ClientData arg, + ClientData* prevArgPtr); /* 158 */ + int (*tk_SafeInit)(Tcl_Interp* interp); /* 159 */ + const char* (*tk_SetAppName)(Tk_Window tkwin, const char* name); /* 160 */ + void (*tk_SetBackgroundFromBorder)( + Tk_Window tkwin, + Tk_3DBorder border); /* 161 */ + void (*tk_SetClass)(Tk_Window tkwin, const char* className); /* 162 */ + void (*tk_SetGrid)( + Tk_Window tkwin, + int reqWidth, + int reqHeight, + int gridWidth, + int gridHeight); /* 163 */ + void (*tk_SetInternalBorder)(Tk_Window tkwin, int width); /* 164 */ + void ( + *tk_SetWindowBackground)(Tk_Window tkwin, unsigned long pixel); /* 165 */ + void ( + *tk_SetWindowBackgroundPixmap)(Tk_Window tkwin, Pixmap pixmap); /* 166 */ + void (*tk_SetWindowBorder)(Tk_Window tkwin, unsigned long pixel); /* 167 */ + void (*tk_SetWindowBorderWidth)(Tk_Window tkwin, int width); /* 168 */ + void (*tk_SetWindowBorderPixmap)(Tk_Window tkwin, Pixmap pixmap); /* 169 */ + void (*tk_SetWindowColormap)(Tk_Window tkwin, Colormap colormap); /* 170 */ + int (*tk_SetWindowVisual)( + Tk_Window tkwin, + Visual* visual, + int depth, + Colormap colormap); /* 171 */ + void (*tk_SizeOfBitmap)( + Display* display, + Pixmap bitmap, + int* widthPtr, + int* heightPtr); /* 172 */ + void ( + *tk_SizeOfImage)(Tk_Image image, int* widthPtr, int* heightPtr); /* 173 */ + int (*tk_StrictMotif)(Tk_Window tkwin); /* 174 */ + void (*tk_TextLayoutToPostscript)( + Tcl_Interp* interp, + Tk_TextLayout layout); /* 175 */ + int (*tk_TextWidth)(Tk_Font font, const char* str, int numBytes); /* 176 */ + void (*tk_UndefineCursor)(Tk_Window window); /* 177 */ + void (*tk_UnderlineChars)( + Display* display, + Drawable drawable, + GC gc, + Tk_Font tkfont, + const char* source, + int x, + int y, + int firstByte, + int lastByte); /* 178 */ + void (*tk_UnderlineTextLayout)( + Display* display, + Drawable drawable, + GC gc, + Tk_TextLayout layout, + int x, + int y, + int underline); /* 179 */ + void (*tk_Ungrab)(Tk_Window tkwin); /* 180 */ + void (*tk_UnmaintainGeometry)(Tk_Window slave, Tk_Window master); /* 181 */ + void (*tk_UnmapWindow)(Tk_Window tkwin); /* 182 */ + void (*tk_UnsetGrid)(Tk_Window tkwin); /* 183 */ + void (*tk_UpdatePointer)(Tk_Window tkwin, int x, int y, int state); /* 184 */ + Pixmap (*tk_AllocBitmapFromObj)( + Tcl_Interp* interp, + Tk_Window tkwin, + Tcl_Obj* objPtr); /* 185 */ + Tk_3DBorder (*tk_Alloc3DBorderFromObj)( + Tcl_Interp* interp, + Tk_Window tkwin, + Tcl_Obj* objPtr); /* 186 */ + XColor* (*tk_AllocColorFromObj)( + Tcl_Interp* interp, + Tk_Window tkwin, + Tcl_Obj* objPtr); /* 187 */ + Tk_Cursor (*tk_AllocCursorFromObj)( + Tcl_Interp* interp, + Tk_Window tkwin, + Tcl_Obj* objPtr); /* 188 */ + Tk_Font (*tk_AllocFontFromObj)( + Tcl_Interp* interp, + Tk_Window tkwin, + Tcl_Obj* objPtr); /* 189 */ + Tk_OptionTable (*tk_CreateOptionTable)( + Tcl_Interp* interp, + const Tk_OptionSpec* templatePtr); /* 190 */ + void (*tk_DeleteOptionTable)(Tk_OptionTable optionTable); /* 191 */ + void (*tk_Free3DBorderFromObj)(Tk_Window tkwin, Tcl_Obj* objPtr); /* 192 */ + void (*tk_FreeBitmapFromObj)(Tk_Window tkwin, Tcl_Obj* objPtr); /* 193 */ + void (*tk_FreeColorFromObj)(Tk_Window tkwin, Tcl_Obj* objPtr); /* 194 */ + void (*tk_FreeConfigOptions)( + char* recordPtr, + Tk_OptionTable optionToken, + Tk_Window tkwin); /* 195 */ + void (*tk_FreeSavedOptions)(Tk_SavedOptions* savePtr); /* 196 */ + void (*tk_FreeCursorFromObj)(Tk_Window tkwin, Tcl_Obj* objPtr); /* 197 */ + void (*tk_FreeFontFromObj)(Tk_Window tkwin, Tcl_Obj* objPtr); /* 198 */ + Tk_3DBorder ( + *tk_Get3DBorderFromObj)(Tk_Window tkwin, Tcl_Obj* objPtr); /* 199 */ + int (*tk_GetAnchorFromObj)( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + Tk_Anchor* anchorPtr); /* 200 */ + Pixmap (*tk_GetBitmapFromObj)(Tk_Window tkwin, Tcl_Obj* objPtr); /* 201 */ + XColor* (*tk_GetColorFromObj)(Tk_Window tkwin, Tcl_Obj* objPtr); /* 202 */ + Tk_Cursor (*tk_GetCursorFromObj)(Tk_Window tkwin, Tcl_Obj* objPtr); /* 203 */ + Tcl_Obj* (*tk_GetOptionInfo)( + Tcl_Interp* interp, + char* recordPtr, + Tk_OptionTable optionTable, + Tcl_Obj* namePtr, + Tk_Window tkwin); /* 204 */ + Tcl_Obj* (*tk_GetOptionValue)( + Tcl_Interp* interp, + char* recordPtr, + Tk_OptionTable optionTable, + Tcl_Obj* namePtr, + Tk_Window tkwin); /* 205 */ + int (*tk_GetJustifyFromObj)( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + Tk_Justify* justifyPtr); /* 206 */ + int (*tk_GetMMFromObj)( + Tcl_Interp* interp, + Tk_Window tkwin, + Tcl_Obj* objPtr, + double* doublePtr); /* 207 */ + int (*tk_GetPixelsFromObj)( + Tcl_Interp* interp, + Tk_Window tkwin, + Tcl_Obj* objPtr, + int* intPtr); /* 208 */ + int (*tk_GetReliefFromObj)( + Tcl_Interp* interp, + Tcl_Obj* objPtr, + int* resultPtr); /* 209 */ + int (*tk_GetScrollInfoObj)( + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[], + double* dblPtr, + int* intPtr); /* 210 */ + int (*tk_InitOptions)( + Tcl_Interp* interp, + char* recordPtr, + Tk_OptionTable optionToken, + Tk_Window tkwin); /* 211 */ + void (*tk_MainEx)( + int argc, + char** argv, + Tcl_AppInitProc* appInitProc, + Tcl_Interp* interp); /* 212 */ + void (*tk_RestoreSavedOptions)(Tk_SavedOptions* savePtr); /* 213 */ + int (*tk_SetOptions)( + Tcl_Interp* interp, + char* recordPtr, + Tk_OptionTable optionTable, + int objc, + Tcl_Obj* const objv[], + Tk_Window tkwin, + Tk_SavedOptions* savePtr, + int* maskPtr); /* 214 */ + void (*tk_InitConsoleChannels)(Tcl_Interp* interp); /* 215 */ + int (*tk_CreateConsoleWindow)(Tcl_Interp* interp); /* 216 */ + void (*tk_CreateSmoothMethod)( + Tcl_Interp* interp, + const Tk_SmoothMethod* method); /* 217 */ + void (*reserved218)(void); + void (*reserved219)(void); + int (*tk_GetDash)( + Tcl_Interp* interp, + const char* value, + Tk_Dash* dash); /* 220 */ + void (*tk_CreateOutline)(Tk_Outline* outline); /* 221 */ + void (*tk_DeleteOutline)(Display* display, Tk_Outline* outline); /* 222 */ + int (*tk_ConfigOutlineGC)( + XGCValues* gcValues, + Tk_Canvas canvas, + Tk_Item* item, + Tk_Outline* outline); /* 223 */ + int (*tk_ChangeOutlineGC)( + Tk_Canvas canvas, + Tk_Item* item, + Tk_Outline* outline); /* 224 */ + int (*tk_ResetOutlineGC)( + Tk_Canvas canvas, + Tk_Item* item, + Tk_Outline* outline); /* 225 */ + int (*tk_CanvasPsOutline)( + Tk_Canvas canvas, + Tk_Item* item, + Tk_Outline* outline); /* 226 */ + void (*tk_SetTSOrigin)(Tk_Window tkwin, GC gc, int x, int y); /* 227 */ + int (*tk_CanvasGetCoordFromObj)( + Tcl_Interp* interp, + Tk_Canvas canvas, + Tcl_Obj* obj, + double* doublePtr); /* 228 */ + void (*tk_CanvasSetOffset)( + Tk_Canvas canvas, + GC gc, + Tk_TSOffset* offset); /* 229 */ + void (*tk_DitherPhoto)( + Tk_PhotoHandle handle, + int x, + int y, + int width, + int height); /* 230 */ + int (*tk_PostscriptBitmap)( + Tcl_Interp* interp, + Tk_Window tkwin, + Tk_PostscriptInfo psInfo, + Pixmap bitmap, + int startX, + int startY, + int width, + int height); /* 231 */ + int (*tk_PostscriptColor)( + Tcl_Interp* interp, + Tk_PostscriptInfo psInfo, + XColor* colorPtr); /* 232 */ + int (*tk_PostscriptFont)( + Tcl_Interp* interp, + Tk_PostscriptInfo psInfo, + Tk_Font font); /* 233 */ + int (*tk_PostscriptImage)( + Tk_Image image, + Tcl_Interp* interp, + Tk_Window tkwin, + Tk_PostscriptInfo psinfo, + int x, + int y, + int width, + int height, + int prepass); /* 234 */ + void (*tk_PostscriptPath)( + Tcl_Interp* interp, + Tk_PostscriptInfo psInfo, + double* coordPtr, + int numPoints); /* 235 */ + int (*tk_PostscriptStipple)( + Tcl_Interp* interp, + Tk_Window tkwin, + Tk_PostscriptInfo psInfo, + Pixmap bitmap); /* 236 */ + double (*tk_PostscriptY)(double y, Tk_PostscriptInfo psInfo); /* 237 */ + int (*tk_PostscriptPhoto)( + Tcl_Interp* interp, + Tk_PhotoImageBlock* blockPtr, + Tk_PostscriptInfo psInfo, + int width, + int height); /* 238 */ + void (*tk_CreateClientMessageHandler)(Tk_ClientMessageProc* proc); /* 239 */ + void (*tk_DeleteClientMessageHandler)(Tk_ClientMessageProc* proc); /* 240 */ + Tk_Window (*tk_CreateAnonymousWindow)( + Tcl_Interp* interp, + Tk_Window parent, + const char* screenName); /* 241 */ + void (*tk_SetClassProcs)( + Tk_Window tkwin, + const Tk_ClassProcs* procs, + ClientData instanceData); /* 242 */ + void (*tk_SetInternalBorderEx)( + Tk_Window tkwin, + int left, + int right, + int top, + int bottom); /* 243 */ + void (*tk_SetMinimumRequestSize)( + Tk_Window tkwin, + int minWidth, + int minHeight); /* 244 */ + void (*tk_SetCaretPos)(Tk_Window tkwin, int x, int y, int height); /* 245 */ + void (*tk_PhotoPutBlock_Panic)( + Tk_PhotoHandle handle, + Tk_PhotoImageBlock* blockPtr, + int x, + int y, + int width, + int height, + int compRule); /* 246 */ + void (*tk_PhotoPutZoomedBlock_Panic)( + Tk_PhotoHandle handle, + Tk_PhotoImageBlock* blockPtr, + int x, + int y, + int width, + int height, + int zoomX, + int zoomY, + int subsampleX, + int subsampleY, + int compRule); /* 247 */ + int (*tk_CollapseMotionEvents)(Display* display, int collapse); /* 248 */ + Tk_StyleEngine (*tk_RegisterStyleEngine)( + const char* name, + Tk_StyleEngine parent); /* 249 */ + Tk_StyleEngine (*tk_GetStyleEngine)(const char* name); /* 250 */ + int (*tk_RegisterStyledElement)( + Tk_StyleEngine engine, + Tk_ElementSpec* templatePtr); /* 251 */ + int (*tk_GetElementId)(const char* name); /* 252 */ + Tk_Style (*tk_CreateStyle)( + const char* name, + Tk_StyleEngine engine, + ClientData clientData); /* 253 */ + Tk_Style (*tk_GetStyle)(Tcl_Interp* interp, const char* name); /* 254 */ + void (*tk_FreeStyle)(Tk_Style style); /* 255 */ + const char* (*tk_NameOfStyle)(Tk_Style style); /* 256 */ + Tk_Style ( + *tk_AllocStyleFromObj)(Tcl_Interp* interp, Tcl_Obj* objPtr); /* 257 */ + Tk_Style (*tk_GetStyleFromObj)(Tcl_Obj* objPtr); /* 258 */ + void (*tk_FreeStyleFromObj)(Tcl_Obj* objPtr); /* 259 */ + Tk_StyledElement (*tk_GetStyledElement)( + Tk_Style style, + int elementId, + Tk_OptionTable optionTable); /* 260 */ + void (*tk_GetElementSize)( + Tk_Style style, + Tk_StyledElement element, + char* recordPtr, + Tk_Window tkwin, + int width, + int height, + int inner, + int* widthPtr, + int* heightPtr); /* 261 */ + void (*tk_GetElementBox)( + Tk_Style style, + Tk_StyledElement element, + char* recordPtr, + Tk_Window tkwin, + int x, + int y, + int width, + int height, + int inner, + int* xPtr, + int* yPtr, + int* widthPtr, + int* heightPtr); /* 262 */ + int (*tk_GetElementBorderWidth)( + Tk_Style style, + Tk_StyledElement element, + char* recordPtr, + Tk_Window tkwin); /* 263 */ + void (*tk_DrawElement)( + Tk_Style style, + Tk_StyledElement element, + char* recordPtr, + Tk_Window tkwin, + Drawable d, + int x, + int y, + int width, + int height, + int state); /* 264 */ + int (*tk_PhotoExpand)( + Tcl_Interp* interp, + Tk_PhotoHandle handle, + int width, + int height); /* 265 */ + int (*tk_PhotoPutBlock)( + Tcl_Interp* interp, + Tk_PhotoHandle handle, + Tk_PhotoImageBlock* blockPtr, + int x, + int y, + int width, + int height, + int compRule); /* 266 */ + int (*tk_PhotoPutZoomedBlock)( + Tcl_Interp* interp, + Tk_PhotoHandle handle, + Tk_PhotoImageBlock* blockPtr, + int x, + int y, + int width, + int height, + int zoomX, + int zoomY, + int subsampleX, + int subsampleY, + int compRule); /* 267 */ + int (*tk_PhotoSetSize)( + Tcl_Interp* interp, + Tk_PhotoHandle handle, + int width, + int height); /* 268 */ + long (*tk_GetUserInactiveTime)(Display* dpy); /* 269 */ + void (*tk_ResetUserInactiveTime)(Display* dpy); /* 270 */ + Tcl_Interp* (*tk_Interp)(Tk_Window tkwin); /* 271 */ + void (*tk_CreateOldImageType)(const Tk_ImageType* typePtr); /* 272 */ + void (*tk_CreateOldPhotoImageFormat)( + const Tk_PhotoImageFormat* formatPtr); /* 273 */ +} TkStubs; + +extern const TkStubs* tkStubsPtr; + +#ifdef __cplusplus +} +#endif + +#if defined(USE_TK_STUBS) + +/* + * Inline function declarations: + */ + +#define Tk_MainLoop (tkStubsPtr->tk_MainLoop) /* 0 */ +#define Tk_3DBorderColor (tkStubsPtr->tk_3DBorderColor) /* 1 */ +#define Tk_3DBorderGC (tkStubsPtr->tk_3DBorderGC) /* 2 */ +#define Tk_3DHorizontalBevel (tkStubsPtr->tk_3DHorizontalBevel) /* 3 */ +#define Tk_3DVerticalBevel (tkStubsPtr->tk_3DVerticalBevel) /* 4 */ +#define Tk_AddOption (tkStubsPtr->tk_AddOption) /* 5 */ +#define Tk_BindEvent (tkStubsPtr->tk_BindEvent) /* 6 */ +#define Tk_CanvasDrawableCoords (tkStubsPtr->tk_CanvasDrawableCoords) /* 7 */ +#define Tk_CanvasEventuallyRedraw \ + (tkStubsPtr->tk_CanvasEventuallyRedraw) /* 8 */ +#define Tk_CanvasGetCoord (tkStubsPtr->tk_CanvasGetCoord) /* 9 */ +#define Tk_CanvasGetTextInfo (tkStubsPtr->tk_CanvasGetTextInfo) /* 10 */ +#define Tk_CanvasPsBitmap (tkStubsPtr->tk_CanvasPsBitmap) /* 11 */ +#define Tk_CanvasPsColor (tkStubsPtr->tk_CanvasPsColor) /* 12 */ +#define Tk_CanvasPsFont (tkStubsPtr->tk_CanvasPsFont) /* 13 */ +#define Tk_CanvasPsPath (tkStubsPtr->tk_CanvasPsPath) /* 14 */ +#define Tk_CanvasPsStipple (tkStubsPtr->tk_CanvasPsStipple) /* 15 */ +#define Tk_CanvasPsY (tkStubsPtr->tk_CanvasPsY) /* 16 */ +#define Tk_CanvasSetStippleOrigin \ + (tkStubsPtr->tk_CanvasSetStippleOrigin) /* 17 */ +#define Tk_CanvasTagsParseProc (tkStubsPtr->tk_CanvasTagsParseProc) /* 18 */ +#define Tk_CanvasTagsPrintProc (tkStubsPtr->tk_CanvasTagsPrintProc) /* 19 */ +#define Tk_CanvasTkwin (tkStubsPtr->tk_CanvasTkwin) /* 20 */ +#define Tk_CanvasWindowCoords (tkStubsPtr->tk_CanvasWindowCoords) /* 21 */ +#define Tk_ChangeWindowAttributes \ + (tkStubsPtr->tk_ChangeWindowAttributes) /* 22 */ +#define Tk_CharBbox (tkStubsPtr->tk_CharBbox) /* 23 */ +#define Tk_ClearSelection (tkStubsPtr->tk_ClearSelection) /* 24 */ +#define Tk_ClipboardAppend (tkStubsPtr->tk_ClipboardAppend) /* 25 */ +#define Tk_ClipboardClear (tkStubsPtr->tk_ClipboardClear) /* 26 */ +#define Tk_ConfigureInfo (tkStubsPtr->tk_ConfigureInfo) /* 27 */ +#define Tk_ConfigureValue (tkStubsPtr->tk_ConfigureValue) /* 28 */ +#define Tk_ConfigureWidget (tkStubsPtr->tk_ConfigureWidget) /* 29 */ +#define Tk_ConfigureWindow (tkStubsPtr->tk_ConfigureWindow) /* 30 */ +#define Tk_ComputeTextLayout (tkStubsPtr->tk_ComputeTextLayout) /* 31 */ +#define Tk_CoordsToWindow (tkStubsPtr->tk_CoordsToWindow) /* 32 */ +#define Tk_CreateBinding (tkStubsPtr->tk_CreateBinding) /* 33 */ +#define Tk_CreateBindingTable (tkStubsPtr->tk_CreateBindingTable) /* 34 */ +#define Tk_CreateErrorHandler (tkStubsPtr->tk_CreateErrorHandler) /* 35 */ +#define Tk_CreateEventHandler (tkStubsPtr->tk_CreateEventHandler) /* 36 */ +#define Tk_CreateGenericHandler (tkStubsPtr->tk_CreateGenericHandler) /* 37 */ +#define Tk_CreateImageType (tkStubsPtr->tk_CreateImageType) /* 38 */ +#define Tk_CreateItemType (tkStubsPtr->tk_CreateItemType) /* 39 */ +#define Tk_CreatePhotoImageFormat \ + (tkStubsPtr->tk_CreatePhotoImageFormat) /* 40 */ +#define Tk_CreateSelHandler (tkStubsPtr->tk_CreateSelHandler) /* 41 */ +#define Tk_CreateWindow (tkStubsPtr->tk_CreateWindow) /* 42 */ +#define Tk_CreateWindowFromPath (tkStubsPtr->tk_CreateWindowFromPath) /* 43 */ +#define Tk_DefineBitmap (tkStubsPtr->tk_DefineBitmap) /* 44 */ +#define Tk_DefineCursor (tkStubsPtr->tk_DefineCursor) /* 45 */ +#define Tk_DeleteAllBindings (tkStubsPtr->tk_DeleteAllBindings) /* 46 */ +#define Tk_DeleteBinding (tkStubsPtr->tk_DeleteBinding) /* 47 */ +#define Tk_DeleteBindingTable (tkStubsPtr->tk_DeleteBindingTable) /* 48 */ +#define Tk_DeleteErrorHandler (tkStubsPtr->tk_DeleteErrorHandler) /* 49 */ +#define Tk_DeleteEventHandler (tkStubsPtr->tk_DeleteEventHandler) /* 50 */ +#define Tk_DeleteGenericHandler (tkStubsPtr->tk_DeleteGenericHandler) /* 51 */ +#define Tk_DeleteImage (tkStubsPtr->tk_DeleteImage) /* 52 */ +#define Tk_DeleteSelHandler (tkStubsPtr->tk_DeleteSelHandler) /* 53 */ +#define Tk_DestroyWindow (tkStubsPtr->tk_DestroyWindow) /* 54 */ +#define Tk_DisplayName (tkStubsPtr->tk_DisplayName) /* 55 */ +#define Tk_DistanceToTextLayout (tkStubsPtr->tk_DistanceToTextLayout) /* 56 */ +#define Tk_Draw3DPolygon (tkStubsPtr->tk_Draw3DPolygon) /* 57 */ +#define Tk_Draw3DRectangle (tkStubsPtr->tk_Draw3DRectangle) /* 58 */ +#define Tk_DrawChars (tkStubsPtr->tk_DrawChars) /* 59 */ +#define Tk_DrawFocusHighlight (tkStubsPtr->tk_DrawFocusHighlight) /* 60 */ +#define Tk_DrawTextLayout (tkStubsPtr->tk_DrawTextLayout) /* 61 */ +#define Tk_Fill3DPolygon (tkStubsPtr->tk_Fill3DPolygon) /* 62 */ +#define Tk_Fill3DRectangle (tkStubsPtr->tk_Fill3DRectangle) /* 63 */ +#define Tk_FindPhoto (tkStubsPtr->tk_FindPhoto) /* 64 */ +#define Tk_FontId (tkStubsPtr->tk_FontId) /* 65 */ +#define Tk_Free3DBorder (tkStubsPtr->tk_Free3DBorder) /* 66 */ +#define Tk_FreeBitmap (tkStubsPtr->tk_FreeBitmap) /* 67 */ +#define Tk_FreeColor (tkStubsPtr->tk_FreeColor) /* 68 */ +#define Tk_FreeColormap (tkStubsPtr->tk_FreeColormap) /* 69 */ +#define Tk_FreeCursor (tkStubsPtr->tk_FreeCursor) /* 70 */ +#define Tk_FreeFont (tkStubsPtr->tk_FreeFont) /* 71 */ +#define Tk_FreeGC (tkStubsPtr->tk_FreeGC) /* 72 */ +#define Tk_FreeImage (tkStubsPtr->tk_FreeImage) /* 73 */ +#define Tk_FreeOptions (tkStubsPtr->tk_FreeOptions) /* 74 */ +#define Tk_FreePixmap (tkStubsPtr->tk_FreePixmap) /* 75 */ +#define Tk_FreeTextLayout (tkStubsPtr->tk_FreeTextLayout) /* 76 */ +#define Tk_FreeXId (tkStubsPtr->tk_FreeXId) /* 77 */ +#define Tk_GCForColor (tkStubsPtr->tk_GCForColor) /* 78 */ +#define Tk_GeometryRequest (tkStubsPtr->tk_GeometryRequest) /* 79 */ +#define Tk_Get3DBorder (tkStubsPtr->tk_Get3DBorder) /* 80 */ +#define Tk_GetAllBindings (tkStubsPtr->tk_GetAllBindings) /* 81 */ +#define Tk_GetAnchor (tkStubsPtr->tk_GetAnchor) /* 82 */ +#define Tk_GetAtomName (tkStubsPtr->tk_GetAtomName) /* 83 */ +#define Tk_GetBinding (tkStubsPtr->tk_GetBinding) /* 84 */ +#define Tk_GetBitmap (tkStubsPtr->tk_GetBitmap) /* 85 */ +#define Tk_GetBitmapFromData (tkStubsPtr->tk_GetBitmapFromData) /* 86 */ +#define Tk_GetCapStyle (tkStubsPtr->tk_GetCapStyle) /* 87 */ +#define Tk_GetColor (tkStubsPtr->tk_GetColor) /* 88 */ +#define Tk_GetColorByValue (tkStubsPtr->tk_GetColorByValue) /* 89 */ +#define Tk_GetColormap (tkStubsPtr->tk_GetColormap) /* 90 */ +#define Tk_GetCursor (tkStubsPtr->tk_GetCursor) /* 91 */ +#define Tk_GetCursorFromData (tkStubsPtr->tk_GetCursorFromData) /* 92 */ +#define Tk_GetFont (tkStubsPtr->tk_GetFont) /* 93 */ +#define Tk_GetFontFromObj (tkStubsPtr->tk_GetFontFromObj) /* 94 */ +#define Tk_GetFontMetrics (tkStubsPtr->tk_GetFontMetrics) /* 95 */ +#define Tk_GetGC (tkStubsPtr->tk_GetGC) /* 96 */ +#define Tk_GetImage (tkStubsPtr->tk_GetImage) /* 97 */ +#define Tk_GetImageMasterData (tkStubsPtr->tk_GetImageMasterData) /* 98 */ +#define Tk_GetItemTypes (tkStubsPtr->tk_GetItemTypes) /* 99 */ +#define Tk_GetJoinStyle (tkStubsPtr->tk_GetJoinStyle) /* 100 */ +#define Tk_GetJustify (tkStubsPtr->tk_GetJustify) /* 101 */ +#define Tk_GetNumMainWindows (tkStubsPtr->tk_GetNumMainWindows) /* 102 */ +#define Tk_GetOption (tkStubsPtr->tk_GetOption) /* 103 */ +#define Tk_GetPixels (tkStubsPtr->tk_GetPixels) /* 104 */ +#define Tk_GetPixmap (tkStubsPtr->tk_GetPixmap) /* 105 */ +#define Tk_GetRelief (tkStubsPtr->tk_GetRelief) /* 106 */ +#define Tk_GetRootCoords (tkStubsPtr->tk_GetRootCoords) /* 107 */ +#define Tk_GetScrollInfo (tkStubsPtr->tk_GetScrollInfo) /* 108 */ +#define Tk_GetScreenMM (tkStubsPtr->tk_GetScreenMM) /* 109 */ +#define Tk_GetSelection (tkStubsPtr->tk_GetSelection) /* 110 */ +#define Tk_GetUid (tkStubsPtr->tk_GetUid) /* 111 */ +#define Tk_GetVisual (tkStubsPtr->tk_GetVisual) /* 112 */ +#define Tk_GetVRootGeometry (tkStubsPtr->tk_GetVRootGeometry) /* 113 */ +#define Tk_Grab (tkStubsPtr->tk_Grab) /* 114 */ +#define Tk_HandleEvent (tkStubsPtr->tk_HandleEvent) /* 115 */ +#define Tk_IdToWindow (tkStubsPtr->tk_IdToWindow) /* 116 */ +#define Tk_ImageChanged (tkStubsPtr->tk_ImageChanged) /* 117 */ +#define Tk_Init (tkStubsPtr->tk_Init) /* 118 */ +#define Tk_InternAtom (tkStubsPtr->tk_InternAtom) /* 119 */ +#define Tk_IntersectTextLayout (tkStubsPtr->tk_IntersectTextLayout) /* 120 */ +#define Tk_MaintainGeometry (tkStubsPtr->tk_MaintainGeometry) /* 121 */ +#define Tk_MainWindow (tkStubsPtr->tk_MainWindow) /* 122 */ +#define Tk_MakeWindowExist (tkStubsPtr->tk_MakeWindowExist) /* 123 */ +#define Tk_ManageGeometry (tkStubsPtr->tk_ManageGeometry) /* 124 */ +#define Tk_MapWindow (tkStubsPtr->tk_MapWindow) /* 125 */ +#define Tk_MeasureChars (tkStubsPtr->tk_MeasureChars) /* 126 */ +#define Tk_MoveResizeWindow (tkStubsPtr->tk_MoveResizeWindow) /* 127 */ +#define Tk_MoveWindow (tkStubsPtr->tk_MoveWindow) /* 128 */ +#define Tk_MoveToplevelWindow (tkStubsPtr->tk_MoveToplevelWindow) /* 129 */ +#define Tk_NameOf3DBorder (tkStubsPtr->tk_NameOf3DBorder) /* 130 */ +#define Tk_NameOfAnchor (tkStubsPtr->tk_NameOfAnchor) /* 131 */ +#define Tk_NameOfBitmap (tkStubsPtr->tk_NameOfBitmap) /* 132 */ +#define Tk_NameOfCapStyle (tkStubsPtr->tk_NameOfCapStyle) /* 133 */ +#define Tk_NameOfColor (tkStubsPtr->tk_NameOfColor) /* 134 */ +#define Tk_NameOfCursor (tkStubsPtr->tk_NameOfCursor) /* 135 */ +#define Tk_NameOfFont (tkStubsPtr->tk_NameOfFont) /* 136 */ +#define Tk_NameOfImage (tkStubsPtr->tk_NameOfImage) /* 137 */ +#define Tk_NameOfJoinStyle (tkStubsPtr->tk_NameOfJoinStyle) /* 138 */ +#define Tk_NameOfJustify (tkStubsPtr->tk_NameOfJustify) /* 139 */ +#define Tk_NameOfRelief (tkStubsPtr->tk_NameOfRelief) /* 140 */ +#define Tk_NameToWindow (tkStubsPtr->tk_NameToWindow) /* 141 */ +#define Tk_OwnSelection (tkStubsPtr->tk_OwnSelection) /* 142 */ +#define Tk_ParseArgv (tkStubsPtr->tk_ParseArgv) /* 143 */ +#define Tk_PhotoPutBlock_NoComposite \ + (tkStubsPtr->tk_PhotoPutBlock_NoComposite) /* 144 */ +#define Tk_PhotoPutZoomedBlock_NoComposite \ + (tkStubsPtr->tk_PhotoPutZoomedBlock_NoComposite) /* 145 */ +#define Tk_PhotoGetImage (tkStubsPtr->tk_PhotoGetImage) /* 146 */ +#define Tk_PhotoBlank (tkStubsPtr->tk_PhotoBlank) /* 147 */ +#define Tk_PhotoExpand_Panic (tkStubsPtr->tk_PhotoExpand_Panic) /* 148 */ +#define Tk_PhotoGetSize (tkStubsPtr->tk_PhotoGetSize) /* 149 */ +#define Tk_PhotoSetSize_Panic (tkStubsPtr->tk_PhotoSetSize_Panic) /* 150 */ +#define Tk_PointToChar (tkStubsPtr->tk_PointToChar) /* 151 */ +#define Tk_PostscriptFontName (tkStubsPtr->tk_PostscriptFontName) /* 152 */ +#define Tk_PreserveColormap (tkStubsPtr->tk_PreserveColormap) /* 153 */ +#define Tk_QueueWindowEvent (tkStubsPtr->tk_QueueWindowEvent) /* 154 */ +#define Tk_RedrawImage (tkStubsPtr->tk_RedrawImage) /* 155 */ +#define Tk_ResizeWindow (tkStubsPtr->tk_ResizeWindow) /* 156 */ +#define Tk_RestackWindow (tkStubsPtr->tk_RestackWindow) /* 157 */ +#define Tk_RestrictEvents (tkStubsPtr->tk_RestrictEvents) /* 158 */ +#define Tk_SafeInit (tkStubsPtr->tk_SafeInit) /* 159 */ +#define Tk_SetAppName (tkStubsPtr->tk_SetAppName) /* 160 */ +#define Tk_SetBackgroundFromBorder \ + (tkStubsPtr->tk_SetBackgroundFromBorder) /* 161 */ +#define Tk_SetClass (tkStubsPtr->tk_SetClass) /* 162 */ +#define Tk_SetGrid (tkStubsPtr->tk_SetGrid) /* 163 */ +#define Tk_SetInternalBorder (tkStubsPtr->tk_SetInternalBorder) /* 164 */ +#define Tk_SetWindowBackground (tkStubsPtr->tk_SetWindowBackground) /* 165 */ +#define Tk_SetWindowBackgroundPixmap \ + (tkStubsPtr->tk_SetWindowBackgroundPixmap) /* 166 */ +#define Tk_SetWindowBorder (tkStubsPtr->tk_SetWindowBorder) /* 167 */ +#define Tk_SetWindowBorderWidth (tkStubsPtr->tk_SetWindowBorderWidth) /* 168 \ + */ +#define Tk_SetWindowBorderPixmap \ + (tkStubsPtr->tk_SetWindowBorderPixmap) /* 169 */ +#define Tk_SetWindowColormap (tkStubsPtr->tk_SetWindowColormap) /* 170 */ +#define Tk_SetWindowVisual (tkStubsPtr->tk_SetWindowVisual) /* 171 */ +#define Tk_SizeOfBitmap (tkStubsPtr->tk_SizeOfBitmap) /* 172 */ +#define Tk_SizeOfImage (tkStubsPtr->tk_SizeOfImage) /* 173 */ +#define Tk_StrictMotif (tkStubsPtr->tk_StrictMotif) /* 174 */ +#define Tk_TextLayoutToPostscript \ + (tkStubsPtr->tk_TextLayoutToPostscript) /* 175 */ +#define Tk_TextWidth (tkStubsPtr->tk_TextWidth) /* 176 */ +#define Tk_UndefineCursor (tkStubsPtr->tk_UndefineCursor) /* 177 */ +#define Tk_UnderlineChars (tkStubsPtr->tk_UnderlineChars) /* 178 */ +#define Tk_UnderlineTextLayout (tkStubsPtr->tk_UnderlineTextLayout) /* 179 */ +#define Tk_Ungrab (tkStubsPtr->tk_Ungrab) /* 180 */ +#define Tk_UnmaintainGeometry (tkStubsPtr->tk_UnmaintainGeometry) /* 181 */ +#define Tk_UnmapWindow (tkStubsPtr->tk_UnmapWindow) /* 182 */ +#define Tk_UnsetGrid (tkStubsPtr->tk_UnsetGrid) /* 183 */ +#define Tk_UpdatePointer (tkStubsPtr->tk_UpdatePointer) /* 184 */ +#define Tk_AllocBitmapFromObj (tkStubsPtr->tk_AllocBitmapFromObj) /* 185 */ +#define Tk_Alloc3DBorderFromObj (tkStubsPtr->tk_Alloc3DBorderFromObj) /* 186 \ + */ +#define Tk_AllocColorFromObj (tkStubsPtr->tk_AllocColorFromObj) /* 187 */ +#define Tk_AllocCursorFromObj (tkStubsPtr->tk_AllocCursorFromObj) /* 188 */ +#define Tk_AllocFontFromObj (tkStubsPtr->tk_AllocFontFromObj) /* 189 */ +#define Tk_CreateOptionTable (tkStubsPtr->tk_CreateOptionTable) /* 190 */ +#define Tk_DeleteOptionTable (tkStubsPtr->tk_DeleteOptionTable) /* 191 */ +#define Tk_Free3DBorderFromObj (tkStubsPtr->tk_Free3DBorderFromObj) /* 192 */ +#define Tk_FreeBitmapFromObj (tkStubsPtr->tk_FreeBitmapFromObj) /* 193 */ +#define Tk_FreeColorFromObj (tkStubsPtr->tk_FreeColorFromObj) /* 194 */ +#define Tk_FreeConfigOptions (tkStubsPtr->tk_FreeConfigOptions) /* 195 */ +#define Tk_FreeSavedOptions (tkStubsPtr->tk_FreeSavedOptions) /* 196 */ +#define Tk_FreeCursorFromObj (tkStubsPtr->tk_FreeCursorFromObj) /* 197 */ +#define Tk_FreeFontFromObj (tkStubsPtr->tk_FreeFontFromObj) /* 198 */ +#define Tk_Get3DBorderFromObj (tkStubsPtr->tk_Get3DBorderFromObj) /* 199 */ +#define Tk_GetAnchorFromObj (tkStubsPtr->tk_GetAnchorFromObj) /* 200 */ +#define Tk_GetBitmapFromObj (tkStubsPtr->tk_GetBitmapFromObj) /* 201 */ +#define Tk_GetColorFromObj (tkStubsPtr->tk_GetColorFromObj) /* 202 */ +#define Tk_GetCursorFromObj (tkStubsPtr->tk_GetCursorFromObj) /* 203 */ +#define Tk_GetOptionInfo (tkStubsPtr->tk_GetOptionInfo) /* 204 */ +#define Tk_GetOptionValue (tkStubsPtr->tk_GetOptionValue) /* 205 */ +#define Tk_GetJustifyFromObj (tkStubsPtr->tk_GetJustifyFromObj) /* 206 */ +#define Tk_GetMMFromObj (tkStubsPtr->tk_GetMMFromObj) /* 207 */ +#define Tk_GetPixelsFromObj (tkStubsPtr->tk_GetPixelsFromObj) /* 208 */ +#define Tk_GetReliefFromObj (tkStubsPtr->tk_GetReliefFromObj) /* 209 */ +#define Tk_GetScrollInfoObj (tkStubsPtr->tk_GetScrollInfoObj) /* 210 */ +#define Tk_InitOptions (tkStubsPtr->tk_InitOptions) /* 211 */ +#define Tk_MainEx (tkStubsPtr->tk_MainEx) /* 212 */ +#define Tk_RestoreSavedOptions (tkStubsPtr->tk_RestoreSavedOptions) /* 213 */ +#define Tk_SetOptions (tkStubsPtr->tk_SetOptions) /* 214 */ +#define Tk_InitConsoleChannels (tkStubsPtr->tk_InitConsoleChannels) /* 215 */ +#define Tk_CreateConsoleWindow (tkStubsPtr->tk_CreateConsoleWindow) /* 216 */ +#define Tk_CreateSmoothMethod (tkStubsPtr->tk_CreateSmoothMethod) /* 217 */ +/* Slot 218 is reserved */ +/* Slot 219 is reserved */ +#define Tk_GetDash (tkStubsPtr->tk_GetDash) /* 220 */ +#define Tk_CreateOutline (tkStubsPtr->tk_CreateOutline) /* 221 */ +#define Tk_DeleteOutline (tkStubsPtr->tk_DeleteOutline) /* 222 */ +#define Tk_ConfigOutlineGC (tkStubsPtr->tk_ConfigOutlineGC) /* 223 */ +#define Tk_ChangeOutlineGC (tkStubsPtr->tk_ChangeOutlineGC) /* 224 */ +#define Tk_ResetOutlineGC (tkStubsPtr->tk_ResetOutlineGC) /* 225 */ +#define Tk_CanvasPsOutline (tkStubsPtr->tk_CanvasPsOutline) /* 226 */ +#define Tk_SetTSOrigin (tkStubsPtr->tk_SetTSOrigin) /* 227 */ +#define Tk_CanvasGetCoordFromObj \ + (tkStubsPtr->tk_CanvasGetCoordFromObj) /* 228 */ +#define Tk_CanvasSetOffset (tkStubsPtr->tk_CanvasSetOffset) /* 229 */ +#define Tk_DitherPhoto (tkStubsPtr->tk_DitherPhoto) /* 230 */ +#define Tk_PostscriptBitmap (tkStubsPtr->tk_PostscriptBitmap) /* 231 */ +#define Tk_PostscriptColor (tkStubsPtr->tk_PostscriptColor) /* 232 */ +#define Tk_PostscriptFont (tkStubsPtr->tk_PostscriptFont) /* 233 */ +#define Tk_PostscriptImage (tkStubsPtr->tk_PostscriptImage) /* 234 */ +#define Tk_PostscriptPath (tkStubsPtr->tk_PostscriptPath) /* 235 */ +#define Tk_PostscriptStipple (tkStubsPtr->tk_PostscriptStipple) /* 236 */ +#define Tk_PostscriptY (tkStubsPtr->tk_PostscriptY) /* 237 */ +#define Tk_PostscriptPhoto (tkStubsPtr->tk_PostscriptPhoto) /* 238 */ +#define Tk_CreateClientMessageHandler \ + (tkStubsPtr->tk_CreateClientMessageHandler) /* 239 */ +#define Tk_DeleteClientMessageHandler \ + (tkStubsPtr->tk_DeleteClientMessageHandler) /* 240 */ +#define Tk_CreateAnonymousWindow \ + (tkStubsPtr->tk_CreateAnonymousWindow) /* 241 */ +#define Tk_SetClassProcs (tkStubsPtr->tk_SetClassProcs) /* 242 */ +#define Tk_SetInternalBorderEx (tkStubsPtr->tk_SetInternalBorderEx) /* 243 */ +#define Tk_SetMinimumRequestSize \ + (tkStubsPtr->tk_SetMinimumRequestSize) /* 244 */ +#define Tk_SetCaretPos (tkStubsPtr->tk_SetCaretPos) /* 245 */ +#define Tk_PhotoPutBlock_Panic (tkStubsPtr->tk_PhotoPutBlock_Panic) /* 246 */ +#define Tk_PhotoPutZoomedBlock_Panic \ + (tkStubsPtr->tk_PhotoPutZoomedBlock_Panic) /* 247 */ +#define Tk_CollapseMotionEvents (tkStubsPtr->tk_CollapseMotionEvents) /* 248 \ + */ +#define Tk_RegisterStyleEngine (tkStubsPtr->tk_RegisterStyleEngine) /* 249 */ +#define Tk_GetStyleEngine (tkStubsPtr->tk_GetStyleEngine) /* 250 */ +#define Tk_RegisterStyledElement \ + (tkStubsPtr->tk_RegisterStyledElement) /* 251 */ +#define Tk_GetElementId (tkStubsPtr->tk_GetElementId) /* 252 */ +#define Tk_CreateStyle (tkStubsPtr->tk_CreateStyle) /* 253 */ +#define Tk_GetStyle (tkStubsPtr->tk_GetStyle) /* 254 */ +#define Tk_FreeStyle (tkStubsPtr->tk_FreeStyle) /* 255 */ +#define Tk_NameOfStyle (tkStubsPtr->tk_NameOfStyle) /* 256 */ +#define Tk_AllocStyleFromObj (tkStubsPtr->tk_AllocStyleFromObj) /* 257 */ +#define Tk_GetStyleFromObj (tkStubsPtr->tk_GetStyleFromObj) /* 258 */ +#define Tk_FreeStyleFromObj (tkStubsPtr->tk_FreeStyleFromObj) /* 259 */ +#define Tk_GetStyledElement (tkStubsPtr->tk_GetStyledElement) /* 260 */ +#define Tk_GetElementSize (tkStubsPtr->tk_GetElementSize) /* 261 */ +#define Tk_GetElementBox (tkStubsPtr->tk_GetElementBox) /* 262 */ +#define Tk_GetElementBorderWidth \ + (tkStubsPtr->tk_GetElementBorderWidth) /* 263 */ +#define Tk_DrawElement (tkStubsPtr->tk_DrawElement) /* 264 */ +#define Tk_PhotoExpand (tkStubsPtr->tk_PhotoExpand) /* 265 */ +#define Tk_PhotoPutBlock (tkStubsPtr->tk_PhotoPutBlock) /* 266 */ +#define Tk_PhotoPutZoomedBlock (tkStubsPtr->tk_PhotoPutZoomedBlock) /* 267 */ +#define Tk_PhotoSetSize (tkStubsPtr->tk_PhotoSetSize) /* 268 */ +#define Tk_GetUserInactiveTime (tkStubsPtr->tk_GetUserInactiveTime) /* 269 */ +#define Tk_ResetUserInactiveTime \ + (tkStubsPtr->tk_ResetUserInactiveTime) /* 270 */ +#define Tk_Interp (tkStubsPtr->tk_Interp) /* 271 */ +#define Tk_CreateOldImageType (tkStubsPtr->tk_CreateOldImageType) /* 272 */ +#define Tk_CreateOldPhotoImageFormat \ + (tkStubsPtr->tk_CreateOldPhotoImageFormat) /* 273 */ + +#endif /* defined(USE_TK_STUBS) */ + +/* !END!: Do not edit above this line. */ + +/* Functions that don't belong in the stub table */ +#undef Tk_MainEx +#undef Tk_Init +#undef Tk_SafeInit +#undef Tk_CreateConsoleWindow + +#if defined(_WIN32) && defined(UNICODE) +#define Tk_MainEx Tk_MainExW +EXTERN void Tk_MainExW( + int argc, + wchar_t** argv, + Tcl_AppInitProc* appInitProc, + Tcl_Interp* interp); +#endif + +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLIMPORT + +#endif /* _TKDECLS */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkEntry.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkEntry.h new file mode 100644 index 0000000..a1a7384 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkEntry.h @@ -0,0 +1,292 @@ +/* + * tkEntry.h -- + * + * This module defined the structures for the Entry & SpinBox widgets. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + * Copyright (c) 2002 Apple Inc. + */ + +#ifndef _TKENTRY +#define _TKENTRY + +#ifndef _TKINT +#include "tkInt.h" +#endif + +enum EntryType { TK_ENTRY, TK_SPINBOX }; + +/* + * A data structure of the following type is kept for each Entry widget + * managed by this file: + */ + +typedef struct { + Tk_Window tkwin; /* Window that embodies the entry. NULL means + * that the window has been destroyed but the + * data structures haven't yet been cleaned + * up.*/ + Display* display; /* Display containing widget. Used, among + * other things, so that resources can be + * freed even after tkwin has gone away. */ + Tcl_Interp* interp; /* Interpreter associated with entry. */ + Tcl_Command widgetCmd; /* Token for entry's widget command. */ + Tk_OptionTable optionTable; /* Table that defines configuration options + * available for this widget. */ + enum EntryType type; /* Specialized type of Entry widget */ + + /* + * Fields that are set by widget commands other than "configure". + */ + + const char* string; /* Pointer to storage for string; + * NULL-terminated; malloc-ed. */ + int insertPos; /* Character index before which next typed + * character will be inserted. */ + + /* + * Information about what's selected, if any. + */ + + int selectFirst; /* Character index of first selected character + * (-1 means nothing selected. */ + int selectLast; /* Character index just after last selected + * character (-1 means nothing selected. */ + int selectAnchor; /* Fixed end of selection (i.e. "select to" + * operation will use this as one end of the + * selection). */ + + /* + * Information for scanning: + */ + + int scanMarkX; /* X-position at which scan started (e.g. + * button was pressed here). */ + int scanMarkIndex; /* Character index of character that was at + * left of window when scan started. */ + + /* + * Configuration settings that are updated by Tk_ConfigureWidget. + */ + + Tk_3DBorder normalBorder; /* Used for drawing border around whole + * window, plus used for background. */ + Tk_3DBorder disabledBorder; /* Used for drawing border around whole window + * in disabled state, plus used for + * background. */ + Tk_3DBorder readonlyBorder; /* Used for drawing border around whole window + * in readonly state, plus used for + * background. */ + int borderWidth; /* Width of 3-D border around window. */ + Tk_Cursor cursor; /* Current cursor for window, or None. */ + int exportSelection; /* Non-zero means tie internal entry selection + * to X selection. */ + Tk_Font tkfont; /* Information about text font, or NULL. */ + XColor* fgColorPtr; /* Text color in normal mode. */ + XColor* dfgColorPtr; /* Text color in disabled mode. */ + XColor* highlightBgColorPtr; /* Color for drawing traversal highlight area + * when highlight is off. */ + XColor* highlightColorPtr; /* Color for drawing traversal highlight. */ + int highlightWidth; /* Width in pixels of highlight to draw around + * widget when it has the focus. <= 0 means + * don't draw a highlight. */ + Tk_3DBorder insertBorder; /* Used to draw vertical bar for insertion + * cursor. */ + int insertBorderWidth; /* Width of 3-D border around insert cursor. */ + int insertOffTime; /* Number of milliseconds cursor should spend + * in "off" state for each blink. */ + int insertOnTime; /* Number of milliseconds cursor should spend + * in "on" state for each blink. */ + int insertWidth; /* Total width of insert cursor. */ + Tk_Justify justify; /* Justification to use for text within + * window. */ + int relief; /* 3-D effect: TK_RELIEF_RAISED, etc. */ + Tk_3DBorder selBorder; /* Border and background for selected + * characters. */ + int selBorderWidth; /* Width of border around selection. */ + XColor* selFgColorPtr; /* Foreground color for selected text. */ + int state; /* Normal or disabled. Entry is read-only when + * disabled. */ + char* textVarName; /* Name of variable (malloc'ed) or NULL. If + * non-NULL, entry's string tracks the + * contents of this variable and vice + * versa. */ + char* takeFocus; /* Value of -takefocus option; not used in the + * C code, but used by keyboard traversal + * scripts. Malloc'ed, but may be NULL. */ + int prefWidth; /* Desired width of window, measured in + * average characters. */ + char* scrollCmd; /* Command prefix for communicating with + * scrollbar(s). Malloc'ed. NULL means no + * command to issue. */ + char* showChar; /* Value of -show option. If non-NULL, first + * character is used for displaying all + * characters in entry. Malloc'ed. This is + * only used by the Entry widget. */ + + /* + * Fields whose values are derived from the current values of the + * configuration settings above. + */ + + const char* displayString; /* String to use when displaying. This may be + * a pointer to string, or a pointer to + * malloced memory with the same character + * length as string but whose characters are + * all equal to showChar. */ + int numBytes; /* Length of string in bytes. */ + int numChars; /* Length of string in characters. Both string + * and displayString have the same character + * length, but may have different byte lengths + * due to being made from different UTF-8 + * characters. */ + int numDisplayBytes; /* Length of displayString in bytes. */ + int inset; /* Number of pixels on the left and right + * sides that are taken up by XPAD, + * borderWidth (if any), and highlightWidth + * (if any). */ + Tk_TextLayout textLayout; /* Cached text layout information. */ + int layoutX, layoutY; /* Origin for layout. */ + int leftX; /* X position at which character at leftIndex + * is drawn (varies depending on justify). */ + int leftIndex; /* Character index of left-most character + * visible in window. */ + Tcl_TimerToken insertBlinkHandler; + /* Timer handler used to blink cursor on and + * off. */ + GC textGC; /* For drawing normal text. */ + GC selTextGC; /* For drawing selected text. */ + GC highlightGC; /* For drawing traversal highlight. */ + int avgWidth; /* Width of average character. */ + int xWidth; /* Extra width to reserve for widget. Used by + * spinboxes for button space. */ + int flags; /* Miscellaneous flags; see below for + * definitions. */ + + int validate; /* Non-zero means try to validate */ + char* validateCmd; /* Command prefix to use when invoking + * validate command. NULL means don't invoke + * commands. Malloc'ed. */ + char* invalidCmd; /* Command called when a validation returns 0 + * (successfully fails), defaults to {}. */ +} Entry; + +/* + * A data structure of the following type is kept for each spinbox widget + * managed by this file: + */ + +typedef struct { + Entry entry; /* A pointer to the generic entry structure. + * This must be the first element of the + * Spinbox. */ + + /* + * Spinbox specific configuration settings. + */ + + Tk_3DBorder activeBorder; /* Used for drawing border around active + * buttons. */ + Tk_3DBorder buttonBorder; /* Used for drawing border around buttons. */ + Tk_Cursor bCursor; /* cursor for buttons, or None. */ + int bdRelief; /* 3-D effect: TK_RELIEF_RAISED, etc. */ + int buRelief; /* 3-D effect: TK_RELIEF_RAISED, etc. */ + char* command; /* Command to invoke for spin buttons. NULL + * means no command to issue. */ + + /* + * Spinbox specific fields for use with configuration settings above. + */ + + int wrap; /* whether to wrap around when spinning */ + + int selElement; /* currently selected control */ + int curElement; /* currently mouseover control */ + + int repeatDelay; /* repeat delay */ + int repeatInterval; /* repeat interval */ + + double fromValue; /* Value corresponding to left/top of dial */ + double toValue; /* Value corresponding to right/bottom of + * dial */ + double increment; /* If > 0, all values are rounded to an even + * multiple of this value. */ + char* formatBuf; /* string into which to format value. + * Malloc'ed. */ + char* reqFormat; /* Sprintf conversion specifier used for the + * value that the users requests. Malloc'ed */ + char* valueFormat; /* Sprintf conversion specifier used for the + * value. */ + char digitFormat[10]; /* Sprintf conversion specifier computed from + * digits and other information; used for the + * value. */ + + char* valueStr; /* Values List. Malloc'ed. */ + Tcl_Obj* listObj; /* Pointer to the list object being used */ + int eIndex; /* Holds the current index into elements */ + int nElements; /* Holds the current count of elements */ +} Spinbox; + +/* + * Assigned bits of "flags" fields of Entry structures, and what those bits + * mean: + * + * REDRAW_PENDING: Non-zero means a DoWhenIdle handler has + * already been queued to redisplay the entry. + * BORDER_NEEDED: Non-zero means 3-D border must be redrawn + * around window during redisplay. Normally only + * text portion needs to be redrawn. + * CURSOR_ON: Non-zero means insert cursor is displayed at + * present. 0 means it isn't displayed. + * GOT_FOCUS: Non-zero means this window has the input + * focus. + * UPDATE_SCROLLBAR: Non-zero means scrollbar should be updated + * during next redisplay operation. + * GOT_SELECTION: Non-zero means we've claimed the selection. + * ENTRY_DELETED: This entry has been effectively destroyed. + * VALIDATING: Non-zero means we are in a validateCmd + * VALIDATE_VAR: Non-zero means we are attempting to validate + * the entry's textvariable with validateCmd + * VALIDATE_ABORT: Non-zero if validatecommand signals an abort + * for current procedure and make no changes + * ENTRY_VAR_TRACED: Non-zero if a var trace is set. + */ + +#define REDRAW_PENDING 1 +#define BORDER_NEEDED 2 +#define CURSOR_ON 4 +#define GOT_FOCUS 8 +#define UPDATE_SCROLLBAR 0x10 +#define GOT_SELECTION 0x20 +#define ENTRY_DELETED 0x40 +#define VALIDATING 0x80 +#define VALIDATE_VAR 0x100 +#define VALIDATE_ABORT 0x200 +#define ENTRY_VAR_TRACED 0x400 + +/* + * The following enum is used to define a type for the -state option of the + * Entry widget. These values are used as indices into the string table below. + */ + +enum state { STATE_DISABLED, STATE_NORMAL, STATE_READONLY }; + +/* + * This is the element index corresponding to the strings in selElementNames. + * If you modify them, you must modify the numbers here. + */ + +enum selelement { SEL_NONE, SEL_BUTTONDOWN, SEL_BUTTONUP, SEL_NULL, SEL_ENTRY }; + +/* + * Declaration of functions used in the implementation of the native side of + * the Entry widget. + */ + +MODULE_SCOPE int +TkpDrawEntryBorderAndFocus(Entry* entryPtr, Drawable d, int isSpinbox); +MODULE_SCOPE int TkpDrawSpinboxButtons(Spinbox* sbPtr, Drawable d); + +#endif /* _TKENTRY */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkFileFilter.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkFileFilter.h new file mode 100644 index 0000000..b877c4c --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkFileFilter.h @@ -0,0 +1,80 @@ +/* + * tkFileFilter.h -- + * + * Declarations for the file filter processing routines needed by the + * file selection dialogs. + * + * Copyright (c) 1996 Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TK_FILE_FILTER +#define _TK_FILE_FILTER + +#define OSType long + +typedef struct GlobPattern { + struct GlobPattern* next; /* Chains to the next glob pattern in a glob + * pattern list */ + char* pattern; /* String value of the pattern, such as + * "*.txt" or "*.*" */ +} GlobPattern; + +typedef struct MacFileType { + struct MacFileType* next; /* Chains to the next mac file type in a mac + * file type list */ + OSType type; /* Mac file type, such as 'TEXT' or 'GIFF' */ +} MacFileType; + +typedef struct FileFilterClause { + struct FileFilterClause* next; + /* Chains to the next clause in a clause + * list */ + GlobPattern* patterns; /* Head of glob pattern type list */ + GlobPattern* patternsTail; /* Tail of glob pattern type list */ + MacFileType* macTypes; /* Head of mac file type list */ + MacFileType* macTypesTail; /* Tail of mac file type list */ +} FileFilterClause; + +typedef struct FileFilter { + struct FileFilter* next; /* Chains to the next filter in a filter + * list */ + char* name; /* Name of the file filter, such as "Text + * Documents" */ + FileFilterClause* clauses; /* Head of the clauses list */ + FileFilterClause* clausesTail; + /* Tail of the clauses list */ +} FileFilter; + +/* + *---------------------------------------------------------------------- + * + * FileFilterList -- + * + * The routine TkGetFileFilters() translates the string value of the + * -filefilters option into a FileFilterList structure, which consists of + * a list of file filters. + * + * Each file filter consists of one or more clauses. Each clause has one + * or more glob patterns and/or one or more Mac file types + * + *---------------------------------------------------------------------- + */ + +typedef struct FileFilterList { + FileFilter* filters; /* Head of the filter list */ + FileFilter* filtersTail; /* Tail of the filter list */ + int numFilters; /* number of filters in the list */ +} FileFilterList; + +MODULE_SCOPE void TkFreeFileFilters(FileFilterList* flistPtr); +MODULE_SCOPE void TkInitFileFilters(FileFilterList* flistPtr); +MODULE_SCOPE int TkGetFileFilters( + Tcl_Interp* interp, + FileFilterList* flistPtr, + Tcl_Obj* valuePtr, + int isWindows); + +#endif /* _TK_FILE_FILTER */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkFont.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkFont.h new file mode 100644 index 0000000..856029f --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkFont.h @@ -0,0 +1,234 @@ +/* + * tkFont.h -- + * + * Declarations for interfaces between the generic and platform-specific + * parts of the font package. This information is not visible outside of + * the font package. + * + * Copyright (c) 1996-1997 Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TKFONT +#define _TKFONT + +/* + * The following structure keeps track of the attributes of a font. It can be + * used to keep track of either the desired attributes or the actual + * attributes gotten when the font was instantiated. + */ + +struct TkFontAttributes { + Tk_Uid family; /* Font family, or NULL to represent plaform- + * specific default system font. */ + double size; /* Pointsize of font, 0.0 for default size, or + * negative number meaning pixel size. */ + int weight; /* Weight flag; see below for def'n. */ + int slant; /* Slant flag; see below for def'n. */ + int underline; /* Non-zero for underline font. */ + int overstrike; /* Non-zero for overstrike font. */ +}; + +/* + * Possible values for the "weight" field in a TkFontAttributes structure. + * Weight is a subjective term and depends on what the company that created + * the font considers bold. + */ + +#define TK_FW_NORMAL 0 +#define TK_FW_BOLD 1 + +#define TK_FW_UNKNOWN \ + -1 /* Unknown weight. This value is used for \ + * error checking and is never actually stored \ + * in the weight field. */ + +/* + * Possible values for the "slant" field in a TkFontAttributes structure. + */ + +#define TK_FS_ROMAN 0 +#define TK_FS_ITALIC 1 +#define TK_FS_OBLIQUE \ + 2 /* This value is only used when parsing X font \ + * names to determine the closest match. It is \ + * only stored in the XLFDAttributes \ + * structure, never in the slant field of the \ + * TkFontAttributes. */ + +#define TK_FS_UNKNOWN \ + -1 /* Unknown slant. This value is used for error \ + * checking and is never actually stored in \ + * the slant field. */ + +/* + * The following structure keeps track of the metrics for an instantiated + * font. The metrics are the physical properties of the font itself. + */ + +typedef struct TkFontMetrics { + int ascent; /* From baseline to top of font. */ + int descent; /* From baseline to bottom of font. */ + int maxWidth; /* Width of widest character in font. */ + int fixed; /* Non-zero if this is a fixed-width font, + * 0 otherwise. */ +} TkFontMetrics; + +/* + * The following structure is used to keep track of the generic information + * about a font. Each platform-specific font is represented by a structure + * with the following structure at its beginning, plus any platform-specific + * stuff after that. + */ + +typedef struct TkFont { + /* + * Fields used and maintained exclusively by generic code. + */ + + int resourceRefCount; /* Number of active uses of this font (each + * active use corresponds to a call to + * Tk_AllocFontFromTable or Tk_GetFont). If + * this count is 0, then this TkFont structure + * is no longer valid and it isn't present in + * a hash table: it is being kept around only + * because there are objects referring to it. + * The structure is freed when + * resourceRefCount and objRefCount are both + * 0. */ + int objRefCount; /* The number of Tcl objects that reference + * this structure. */ + Tcl_HashEntry* cacheHashPtr; /* Entry in font cache for this structure, + * used when deleting it. */ + Tcl_HashEntry* namedHashPtr; /* Pointer to hash table entry that + * corresponds to the named font that the + * tkfont was based on, or NULL if the tkfont + * was not based on a named font. */ + Screen* screen; /* The screen where this font is valid. */ + int tabWidth; /* Width of tabs in this font (pixels). */ + int underlinePos; /* Offset from baseline to origin of underline + * bar (used for drawing underlines on a + * non-underlined font). */ + int underlineHeight; /* Height of underline bar (used for drawing + * underlines on a non-underlined font). */ + + /* + * Fields used in the generic code that are filled in by + * platform-specific code. + */ + + Font fid; /* For backwards compatibility with XGCValues + * structures. Remove when TkGCValues is + * implemented. */ + TkFontAttributes fa; /* Actual font attributes obtained when the + * the font was created, as opposed to the + * desired attributes passed in to + * TkpGetFontFromAttributes(). The desired + * metrics can be determined from the string + * that was used to create this font. */ + TkFontMetrics fm; /* Font metrics determined when font was + * created. */ + struct TkFont* nextPtr; /* Points to the next TkFont structure with + * the same name. All fonts with the same name + * (but different displays) are chained + * together off a single entry in a hash + * table. */ +} TkFont; + +/* + * The following structure is used to return attributes when parsing an XLFD. + * The extra information is of interest to the Unix-specific code when + * attempting to find the closest matching font. + */ + +typedef struct TkXLFDAttributes { + Tk_Uid foundry; /* The foundry of the font. */ + int slant; /* The tristate value for the slant, which is + * significant under X. */ + int setwidth; /* The proportionate width, see below for + * definition. */ + Tk_Uid charset; /* The actual charset string. */ +} TkXLFDAttributes; + +/* + * Possible values for the "setwidth" field in a TkXLFDAttributes structure. + * The setwidth is whether characters are considered wider or narrower than + * normal. + */ + +#define TK_SW_NORMAL 0 +#define TK_SW_CONDENSE 1 +#define TK_SW_EXPAND 2 +#define TK_SW_UNKNOWN \ + 3 /* Unknown setwidth. This value may be stored \ + * in the setwidth field. */ + +/* + * The following defines specify the meaning of the fields in a fully + * qualified XLFD. + */ + +#define XLFD_FOUNDRY 0 +#define XLFD_FAMILY 1 +#define XLFD_WEIGHT 2 +#define XLFD_SLANT 3 +#define XLFD_SETWIDTH 4 +#define XLFD_ADD_STYLE 5 +#define XLFD_PIXEL_SIZE 6 +#define XLFD_POINT_SIZE 7 +#define XLFD_RESOLUTION_X 8 +#define XLFD_RESOLUTION_Y 9 +#define XLFD_SPACING 10 +#define XLFD_AVERAGE_WIDTH 11 +#define XLFD_CHARSET 12 +#define XLFD_NUMFIELDS 13 /* Number of fields in XLFD. */ + +/* + * Helper macro. How to correctly round a double to a short. + */ + +#define ROUND16(x) ((short)floor((x) + 0.5)) + +/* + * Low-level API exported by generic code to platform-specific code. + */ + +#define TkInitFontAttributes(fa) memset((fa), 0, sizeof(TkFontAttributes)); +#define TkInitXLFDAttributes(xa) memset((xa), 0, sizeof(TkXLFDAttributes)); + +MODULE_SCOPE int TkFontParseXLFD( + const char* string, + TkFontAttributes* faPtr, + TkXLFDAttributes* xaPtr); +MODULE_SCOPE const char* const* TkFontGetAliasList(const char* faceName); +MODULE_SCOPE const char* const* const* TkFontGetFallbacks(void); +MODULE_SCOPE double TkFontGetPixels(Tk_Window tkwin, double size); +MODULE_SCOPE double TkFontGetPoints(Tk_Window tkwin, double size); +MODULE_SCOPE const char* const* TkFontGetGlobalClass(void); +MODULE_SCOPE const char* const* TkFontGetSymbolClass(void); +MODULE_SCOPE int TkCreateNamedFont( + Tcl_Interp* interp, + Tk_Window tkwin, + const char* name, + TkFontAttributes* faPtr); +MODULE_SCOPE int +TkDeleteNamedFont(Tcl_Interp* interp, Tk_Window tkwin, const char* name); +MODULE_SCOPE int +TkFontGetFirstTextLayout(Tk_TextLayout layout, Tk_Font* font, char* dst); + +/* + * Low-level API exported by platform-specific code to generic code. + */ + +MODULE_SCOPE void TkpDeleteFont(TkFont* tkFontPtr); +MODULE_SCOPE void TkpFontPkgInit(TkMainInfo* mainPtr); +MODULE_SCOPE TkFont* TkpGetFontFromAttributes( + TkFont* tkFontPtr, + Tk_Window tkwin, + const TkFontAttributes* faPtr); +MODULE_SCOPE void TkpGetFontFamilies(Tcl_Interp* interp, Tk_Window tkwin); +MODULE_SCOPE TkFont* TkpGetNativeFont(Tk_Window tkwin, const char* name); + +#endif /* _TKFONT */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkImgPhoto.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkImgPhoto.h new file mode 100644 index 0000000..1df5e2f --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkImgPhoto.h @@ -0,0 +1,270 @@ +/* + * tkImgPhoto.h -- + * + * Declarations for images of type "photo" for Tk. + * + * Copyright (c) 1994 The Australian National University. + * Copyright (c) 1994-1997 Sun Microsystems, Inc. + * Copyright (c) 2002-2008 Donal K. Fellows + * Copyright (c) 2003 ActiveState Corporation. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + * Author: Paul Mackerras (paulus@cs.anu.edu.au), + * Department of Computer Science, + * Australian National University. + */ + +#include "tkInt.h" +#ifdef _WIN32 +#include "tkWinInt.h" +#elif defined(__CYGWIN__) +#include "tkUnixInt.h" +#endif + +/* + * Forward declarations of the structures we define. + */ + +typedef struct ColorTableId ColorTableId; +typedef struct ColorTable ColorTable; +typedef struct PhotoInstance PhotoInstance; +typedef struct PhotoMaster PhotoMaster; + +/* + * A signed 8-bit integral type. If chars are unsigned and the compiler isn't + * an ANSI one, then we have to use short instead (which wastes space) to get + * signed behavior. + */ + +#if defined(__STDC__) || defined(_AIX) +typedef signed char schar; +#else +#ifndef __CHAR_UNSIGNED__ +typedef char schar; +#else +typedef short schar; +#endif +#endif + +/* + * An unsigned 32-bit integral type, used for pixel values. We use int rather + * than long here to accommodate those systems where longs are 64 bits. + */ + +typedef unsigned int pixel; + +/* + * The maximum number of pixels to transmit to the server in a single + * XPutImage call. + */ + +#define MAX_PIXELS 65536 + +/* + * The set of colors required to display a photo image in a window depends on: + * - the visual used by the window + * - the palette, which specifies how many levels of each primary color to + * use, and + * - the gamma value for the image. + * + * Pixel values allocated for specific colors are valid only for the colormap + * in which they were allocated. Sets of pixel values allocated for displaying + * photos are re-used in other windows if possible, that is, if the display, + * colormap, palette and gamma values match. A hash table is used to locate + * these sets of pixel values, using the following data structure as key: + */ + +struct ColorTableId { + Display* display; /* Qualifies the colormap resource ID. */ + Colormap colormap; /* Colormap that the windows are using. */ + double gamma; /* Gamma exponent value for images. */ + Tk_Uid palette; /* Specifies how many shades of each primary + * we want to allocate. */ +}; + +/* + * For a particular (display, colormap, palette, gamma) combination, a data + * structure of the following type is used to store the allocated pixel values + * and other information: + */ + +struct ColorTable { + ColorTableId id; /* Information used in selecting this color + * table. */ + int flags; /* See below. */ + int refCount; /* Number of instances using this map. */ + int liveRefCount; /* Number of instances which are actually in + * use, using this map. */ + int numColors; /* Number of colors allocated for this map. */ + + XVisualInfo visualInfo; /* Information about the visual for windows + * using this color table. */ + + pixel redValues[256]; /* Maps 8-bit values of red intensity to a + * pixel value or index in pixelMap. */ + pixel greenValues[256]; /* Ditto for green intensity. */ + pixel blueValues[256]; /* Ditto for blue intensity. */ + unsigned long* pixelMap; /* Actual pixel values allocated. */ + + unsigned char colorQuant[3][256]; + /* Maps 8-bit intensities to quantized + * intensities. The first index is 0 for red, + * 1 for green, 2 for blue. */ +}; + +/* + * Bit definitions for the flags field of a ColorTable. + * BLACK_AND_WHITE: 1 means only black and white colors are + * available. + * COLOR_WINDOW: 1 means a full 3-D color cube has been + * allocated. + * DISPOSE_PENDING: 1 means a call to DisposeColorTable has been + * scheduled as an idle handler, but it hasn't + * been invoked yet. + * MAP_COLORS: 1 means pixel values should be mapped through + * pixelMap. + */ + +#ifdef COLOR_WINDOW +#undef COLOR_WINDOW +#endif + +#define BLACK_AND_WHITE 1 +#define COLOR_WINDOW 2 +#define DISPOSE_PENDING 4 +#define MAP_COLORS 8 + +/* + * Definition of the data associated with each photo image master. + */ + +struct PhotoMaster { + Tk_ImageMaster tkMaster; /* Tk's token for image master. NULL means the + * image is being deleted. */ + Tcl_Interp* interp; /* Interpreter associated with the application + * using this image. */ + Tcl_Command imageCmd; /* Token for image command (used to delete it + * when the image goes away). NULL means the + * image command has already been deleted. */ + int flags; /* Sundry flags, defined below. */ + int width, height; /* Dimensions of image. */ + int userWidth, userHeight; /* User-declared image dimensions. */ + Tk_Uid palette; /* User-specified default palette for + * instances of this image. */ + double gamma; /* Display gamma value to correct for. */ + char* fileString; /* Name of file to read into image. */ + Tcl_Obj* dataString; /* Object to use as contents of image. */ + Tcl_Obj* format; /* User-specified format of data in image file + * or string value. */ + unsigned char* pix32; /* Local storage for 32-bit image. */ + int ditherX, ditherY; /* Location of first incorrectly dithered + * pixel in image. */ + TkRegion validRegion; /* Tk region indicating which parts of the + * image have valid image data. */ + PhotoInstance* instancePtr; /* First in the list of instances associated + * with this master. */ +}; + +/* + * Bit definitions for the flags field of a PhotoMaster. + * COLOR_IMAGE: 1 means that the image has different color + * components. + * IMAGE_CHANGED: 1 means that the instances of this image need + * to be redithered. + * COMPLEX_ALPHA: 1 means that the instances of this image have + * alpha values that aren't 0 or 255, and so need + * the copy-merge-replace renderer . + */ + +#define COLOR_IMAGE 1 +#define IMAGE_CHANGED 2 +#define COMPLEX_ALPHA 4 + +/* + * Flag to OR with the compositing rule to indicate that the source, despite + * having an alpha channel, has simple alpha. + */ + +#define SOURCE_IS_SIMPLE_ALPHA_PHOTO 0x10000000 + +/* + * The following data structure represents all of the instances of a photo + * image in windows on a given screen that are using the same colormap. + */ + +struct PhotoInstance { + PhotoMaster* masterPtr; /* Pointer to master for image. */ + Display* display; /* Display for windows using this instance. */ + Colormap colormap; /* The image may only be used in windows with + * this particular colormap. */ + PhotoInstance* nextPtr; /* Pointer to the next instance in the list of + * instances associated with this master. */ + int refCount; /* Number of instances using this structure. */ + Tk_Uid palette; /* Palette for these particular instances. */ + double gamma; /* Gamma value for these instances. */ + Tk_Uid defaultPalette; /* Default palette to use if a palette is not + * specified for the master. */ + ColorTable* colorTablePtr; /* Pointer to information about colors + * allocated for image display in windows like + * this one. */ + Pixmap pixels; /* X pixmap containing dithered image. */ + int width, height; /* Dimensions of the pixmap. */ + schar* error; /* Error image, used in dithering. */ + XImage* imagePtr; /* Image structure for converted pixels. */ + XVisualInfo visualInfo; /* Information about the visual that these + * windows are using. */ + GC gc; /* Graphics context for writing images to the + * pixmap. */ +}; + +/* + * Implementation of the Porter-Duff Source-Over compositing rule. + */ + +#define PD_SRC_OVER(srcColor, srcAlpha, dstColor, dstAlpha) \ + (srcColor * srcAlpha / 255) + dstAlpha*(255 - srcAlpha) / 255 * dstColor / 255 +#define PD_SRC_OVER_ALPHA(srcAlpha, dstAlpha) \ + (srcAlpha + (255 - srcAlpha) * dstAlpha / 255) + +#undef MIN +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#undef MAX +#define MAX(a, b) ((a) > (b) ? (a) : (b)) + +/* + * Declarations of functions shared between the different parts of the + * photo image implementation. + */ + +MODULE_SCOPE void TkImgPhotoConfigureInstance(PhotoInstance* instancePtr); +MODULE_SCOPE void TkImgDisposeInstance(ClientData clientData); +MODULE_SCOPE void TkImgPhotoInstanceSetSize(PhotoInstance* instancePtr); +MODULE_SCOPE ClientData TkImgPhotoGet(Tk_Window tkwin, ClientData clientData); +MODULE_SCOPE void TkImgDitherInstance( + PhotoInstance* instancePtr, + int x, + int y, + int width, + int height); +MODULE_SCOPE void TkImgPhotoDisplay( + ClientData clientData, + Display* display, + Drawable drawable, + int imageX, + int imageY, + int width, + int height, + int drawableX, + int drawableY); +MODULE_SCOPE void TkImgPhotoFree(ClientData clientData, Display* display); +MODULE_SCOPE void TkImgResetDither(PhotoInstance* instancePtr); + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkInt.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkInt.h new file mode 100644 index 0000000..64f83ac --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkInt.h @@ -0,0 +1,1436 @@ +/* + * tkInt.h -- + * + * Declarations for things used internally by the Tk functions but not + * exported outside the module. + * + * Copyright (c) 1990-1994 The Regents of the University of California. + * Copyright (c) 1994-1997 Sun Microsystems, Inc. + * Copyright (c) 1998 by Scriptics Corporation. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TKINT +#define _TKINT + +#ifndef _TKPORT +#include "tkPort.h" +#endif + +/* + * Ensure WORDS_BIGENDIAN is defined correctly: + * Needs to happen here in addition to configure to work with fat compiles on + * Darwin (where configure runs only once for multiple architectures). + */ + +#include +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef BYTE_ORDER +#ifdef BIG_ENDIAN +#if BYTE_ORDER == BIG_ENDIAN +#undef WORDS_BIGENDIAN +#define WORDS_BIGENDIAN 1 +#endif +#endif +#ifdef LITTLE_ENDIAN +#if BYTE_ORDER == LITTLE_ENDIAN +#undef WORDS_BIGENDIAN +#endif +#endif +#endif + +/* + * Used to tag functions that are only to be visible within the module being + * built and not outside it (where this is supported by the linker). + */ + +#ifndef MODULE_SCOPE +#ifdef __cplusplus +#define MODULE_SCOPE extern "C" +#else +#define MODULE_SCOPE extern +#endif +#endif + +/* + * Macros used to cast between pointers and integers (e.g. when storing an int + * in ClientData), on 64-bit architectures they avoid gcc warning about "cast + * to/from pointer from/to integer of different size". + */ + +#if !defined(INT2PTR) && !defined(PTR2INT) +#if defined(HAVE_INTPTR_T) || defined(intptr_t) +#define INT2PTR(p) ((void*)(intptr_t)(p)) +#define PTR2INT(p) ((int)(intptr_t)(p)) +#else +#define INT2PTR(p) ((void*)(p)) +#define PTR2INT(p) ((int)(p)) +#endif +#endif +#if !defined(UINT2PTR) && !defined(PTR2UINT) +#if defined(HAVE_UINTPTR_T) || defined(uintptr_t) +#define UINT2PTR(p) ((void*)(uintptr_t)(p)) +#define PTR2UINT(p) ((unsigned int)(uintptr_t)(p)) +#else +#define UINT2PTR(p) ((void*)(p)) +#define PTR2UINT(p) ((unsigned int)(p)) +#endif +#endif + +/* + * Opaque type declarations: + */ + +typedef struct TkColormap TkColormap; +typedef struct TkFontAttributes TkFontAttributes; +typedef struct TkGrabEvent TkGrabEvent; +typedef struct TkpCursor_* TkpCursor; +typedef struct TkRegion_* TkRegion; +typedef struct TkStressedCmap TkStressedCmap; +typedef struct TkBindInfo_* TkBindInfo; +typedef struct Busy* TkBusy; + +/* + * One of the following structures is maintained for each cursor in use in the + * system. This structure is used by tkCursor.c and the various system- + * specific cursor files. + */ + +typedef struct TkCursor { + Tk_Cursor cursor; /* System specific identifier for cursor. */ + Display* display; /* Display containing cursor. Needed for + * disposal and retrieval of cursors. */ + int resourceRefCount; /* Number of active uses of this cursor (each + * active use corresponds to a call to + * Tk_AllocPreserveFromObj or Tk_Preserve). If + * this count is 0, then this structure is no + * longer valid and it isn't present in a hash + * table: it is being kept around only because + * there are objects referring to it. The + * structure is freed when resourceRefCount + * and objRefCount are both 0. */ + int objRefCount; /* Number of Tcl objects that reference this + * structure.. */ + Tcl_HashTable* otherTable; /* Second table (other than idTable) used to + * index this entry. */ + Tcl_HashEntry* hashPtr; /* Entry in otherTable for this structure + * (needed when deleting). */ + Tcl_HashEntry* idHashPtr; /* Entry in idTable for this structure (needed + * when deleting). */ + struct TkCursor* nextPtr; /* Points to the next TkCursor structure with + * the same name. Cursors with the same name + * but different displays are chained together + * off a single hash table entry. */ +} TkCursor; + +/* + * The following structure is kept one-per-TkDisplay to maintain information + * about the caret (cursor location) on this display. This is used to dictate + * global focus location (Windows Accessibility guidelines) and to position + * the IME or XIM over-the-spot window. + */ + +typedef struct TkCaret { + struct TkWindow* winPtr; /* The window on which we requested caret + * placement. */ + int x; /* Relative x coord of the caret. */ + int y; /* Relative y coord of the caret. */ + int height; /* Specified height of the window. */ +} TkCaret; + +/* + * One of the following structures is maintained for each display containing a + * window managed by Tk. In part, the structure is used to store thread- + * specific data, since each thread will have its own TkDisplay structure. + */ + +typedef struct TkDisplay { + Display* display; /* Xlib's info about display. */ + struct TkDisplay* nextPtr; /* Next in list of all displays. */ + char* name; /* Name of display (with any screen identifier + * removed). Malloc-ed. */ + Time lastEventTime; /* Time of last event received for this + * display. */ + + /* + * Information used primarily by tk3d.c: + */ + + int borderInit; /* 0 means borderTable needs initializing. */ + Tcl_HashTable borderTable; /* Maps from color name to TkBorder + * structure. */ + + /* + * Information used by tkAtom.c only: + */ + + int atomInit; /* 0 means stuff below hasn't been initialized + * yet. */ + Tcl_HashTable nameTable; /* Maps from names to Atom's. */ + Tcl_HashTable atomTable; /* Maps from Atom's back to names. */ + + /* + * Information used primarily by tkBind.c: + */ + + int bindInfoStale; /* Non-zero means the variables in this part + * of the structure are potentially incorrect + * and should be recomputed. */ + unsigned int modeModMask; /* Has one bit set to indicate the modifier + * corresponding to "mode shift". If no such + * modifier, than this is zero. */ + unsigned int metaModMask; /* Has one bit set to indicate the modifier + * corresponding to the "Meta" key. If no such + * modifier, then this is zero. */ + unsigned int altModMask; /* Has one bit set to indicate the modifier + * corresponding to the "Meta" key. If no such + * modifier, then this is zero. */ + enum { LU_IGNORE, LU_CAPS, LU_SHIFT } lockUsage; + /* Indicates how to interpret lock + * modifier. */ + int numModKeyCodes; /* Number of entries in modKeyCodes array + * below. */ + KeyCode* modKeyCodes; /* Pointer to an array giving keycodes for all + * of the keys that have modifiers associated + * with them. Malloc'ed, but may be NULL. */ + + /* + * Information used by tkBitmap.c only: + */ + + int bitmapInit; /* 0 means tables above need initializing. */ + int bitmapAutoNumber; /* Used to number bitmaps. */ + Tcl_HashTable bitmapNameTable; + /* Maps from name of bitmap to the first + * TkBitmap record for that name. */ + Tcl_HashTable bitmapIdTable; /* Maps from bitmap id to the TkBitmap + * structure for the bitmap. */ + Tcl_HashTable bitmapDataTable; + /* Used by Tk_GetBitmapFromData to map from a + * collection of in-core data about a bitmap + * to a reference giving an automatically- + * generated name for the bitmap. */ + + /* + * Information used by tkCanvas.c only: + */ + + int numIdSearches; + int numSlowSearches; + + /* + * Used by tkColor.c only: + */ + + int colorInit; /* 0 means color module needs initializing. */ + TkStressedCmap* stressPtr; /* First in list of colormaps that have filled + * up, so we have to pick an approximate + * color. */ + Tcl_HashTable colorNameTable; + /* Maps from color name to TkColor structure + * for that color. */ + Tcl_HashTable colorValueTable; + /* Maps from integer RGB values to TkColor + * structures. */ + + /* + * Used by tkCursor.c only: + */ + + int cursorInit; /* 0 means cursor module need initializing. */ + Tcl_HashTable cursorNameTable; + /* Maps from a string name to a cursor to the + * TkCursor record for the cursor. */ + Tcl_HashTable cursorDataTable; + /* Maps from a collection of in-core data + * about a cursor to a TkCursor structure. */ + Tcl_HashTable cursorIdTable; + /* Maps from a cursor id to the TkCursor + * structure for the cursor. */ + char cursorString[20]; /* Used to store a cursor id string. */ + Font cursorFont; /* Font to use for standard cursors. None + * means font not loaded yet. */ + + /* + * Information used by tkError.c only: + */ + + struct TkErrorHandler* errorPtr; + /* First in list of error handlers for this + * display. NULL means no handlers exist at + * present. */ + int deleteCount; /* Counts # of handlers deleted since last + * time inactive handlers were garbage- + * collected. When this number gets big, + * handlers get cleaned up. */ + + /* + * Used by tkEvent.c only: + */ + + struct TkWindowEvent* delayedMotionPtr; + /* Points to a malloc-ed motion event whose + * processing has been delayed in the hopes + * that another motion event will come along + * right away and we can merge the two of them + * together. NULL means that there is no + * delayed motion event. */ + + /* + * Information used by tkFocus.c only: + */ + + int focusDebug; /* 1 means collect focus debugging + * statistics. */ + struct TkWindow* implicitWinPtr; + /* If the focus arrived at a toplevel window + * implicitly via an Enter event (rather than + * via a FocusIn event), this points to the + * toplevel window. Otherwise it is NULL. */ + struct TkWindow* focusPtr; /* Points to the window on this display that + * should be receiving keyboard events. When + * multiple applications on the display have + * the focus, this will refer to the innermost + * window in the innermost application. This + * information isn't used on Windows, but it's + * needed on the Mac, and also on X11 when XIM + * processing is being done. */ + + /* + * Information used by tkGC.c only: + */ + + Tcl_HashTable gcValueTable; /* Maps from a GC's values to a TkGC structure + * describing a GC with those values. */ + Tcl_HashTable gcIdTable; /* Maps from a GC to a TkGC. */ + int gcInit; /* 0 means the tables below need + * initializing. */ + + /* + * Information used by tkGeometry.c only: + */ + + Tcl_HashTable maintainHashTable; + /* Hash table that maps from a master's + * Tk_Window token to a list of slaves managed + * by that master. */ + int geomInit; + + /* + * Information used by tkGet.c only: + */ + + Tcl_HashTable uidTable; /* Stores all Tk_Uid used in a thread. */ + int uidInit; /* 0 means uidTable needs initializing. */ + + /* + * Information used by tkGrab.c only: + */ + + struct TkWindow* grabWinPtr; /* Window in which the pointer is currently + * grabbed, or NULL if none. */ + struct TkWindow* eventualGrabWinPtr; + /* Value that grabWinPtr will have once the + * grab event queue (below) has been + * completely emptied. */ + struct TkWindow* buttonWinPtr; + /* Window in which first mouse button was + * pressed while grab was in effect, or NULL + * if no such press in effect. */ + struct TkWindow* serverWinPtr; + /* If no application contains the pointer then + * this is NULL. Otherwise it contains the + * last window for which we've gotten an Enter + * or Leave event from the server (i.e. the + * last window known to have contained the + * pointer). Doesn't reflect events that were + * synthesized in tkGrab.c. */ + TkGrabEvent* firstGrabEventPtr; + /* First in list of enter/leave events + * synthesized by grab code. These events must + * be processed in order before any other + * events are processed. NULL means no such + * events. */ + TkGrabEvent* lastGrabEventPtr; + /* Last in list of synthesized events, or NULL + * if list is empty. */ + int grabFlags; /* Miscellaneous flag values. See definitions + * in tkGrab.c. */ + + /* + * Information used by tkGrid.c only: + */ + + int gridInit; /* 0 means table below needs initializing. */ + Tcl_HashTable gridHashTable; /* Maps from Tk_Window tokens to corresponding + * Grid structures. */ + + /* + * Information used by tkImage.c only: + */ + + int imageId; /* Value used to number image ids. */ + + /* + * Information used by tkMacWinMenu.c only: + */ + + int postCommandGeneration; + + /* + * Information used by tkPack.c only. + */ + + int packInit; /* 0 means table below needs initializing. */ + Tcl_HashTable packerHashTable; + /* Maps from Tk_Window tokens to corresponding + * Packer structures. */ + + /* + * Information used by tkPlace.c only. + */ + + int placeInit; /* 0 means tables below need initializing. */ + Tcl_HashTable masterTable; /* Maps from Tk_Window toke to the Master + * structure for the window, if it exists. */ + Tcl_HashTable slaveTable; /* Maps from Tk_Window toke to the Slave + * structure for the window, if it exists. */ + + /* + * Information used by tkSelect.c and tkClipboard.c only: + */ + + struct TkSelectionInfo* selectionInfoPtr; + /* First in list of selection information + * records. Each entry contains information + * about the current owner of a particular + * selection on this display. */ + Atom multipleAtom; /* Atom for MULTIPLE. None means selection + * stuff isn't initialized. */ + Atom incrAtom; /* Atom for INCR. */ + Atom targetsAtom; /* Atom for TARGETS. */ + Atom timestampAtom; /* Atom for TIMESTAMP. */ + Atom textAtom; /* Atom for TEXT. */ + Atom compoundTextAtom; /* Atom for COMPOUND_TEXT. */ + Atom applicationAtom; /* Atom for TK_APPLICATION. */ + Atom windowAtom; /* Atom for TK_WINDOW. */ + Atom clipboardAtom; /* Atom for CLIPBOARD. */ + Atom utf8Atom; /* Atom for UTF8_STRING. */ + + Tk_Window clipWindow; /* Window used for clipboard ownership and to + * retrieve selections between processes. NULL + * means clipboard info hasn't been + * initialized. */ + int clipboardActive; /* 1 means we currently own the clipboard + * selection, 0 means we don't. */ + struct TkMainInfo* clipboardAppPtr; + /* Last application that owned clipboard. */ + struct TkClipboardTarget* clipTargetPtr; + /* First in list of clipboard type information + * records. Each entry contains information + * about the buffers for a given selection + * target. */ + + /* + * Information used by tkSend.c only: + */ + + Tk_Window commTkwin; /* Window used for communication between + * interpreters during "send" commands. NULL + * means send info hasn't been initialized + * yet. */ + Atom commProperty; /* X's name for comm property. */ + Atom registryProperty; /* X's name for property containing registry + * of interpreter names. */ + Atom appNameProperty; /* X's name for property used to hold the + * application name on each comm window. */ + + /* + * Information used by tkUnixWm.c and tkWinWm.c only: + */ + + struct TkWmInfo* firstWmPtr; /* Points to first top-level window. */ + struct TkWmInfo* foregroundWmPtr; + /* Points to the foreground window. */ + + /* + * Information used by tkVisual.c only: + */ + + TkColormap* cmapPtr; /* First in list of all non-default colormaps + * allocated for this display. */ + +/* + * Miscellaneous information: + */ + +#ifdef TK_USE_INPUT_METHODS + XIM inputMethod; /* Input method for this display. */ + XIMStyle inputStyle; /* Input style selected for this display. */ + XFontSet inputXfs; /* XFontSet cached for over-the-spot XIM. */ +#endif /* TK_USE_INPUT_METHODS */ + Tcl_HashTable winTable; /* Maps from X window ids to TkWindow ptrs. */ + + int refCount; /* Reference count of how many Tk applications + * are using this display. Used to clean up + * the display when we no longer have any Tk + * applications using it. */ + + /* + * The following field were all added for Tk8.3 + */ + + int mouseButtonState; /* Current mouse button state for this + * display. */ + Window mouseButtonWindow; /* Window the button state was set in, added + * in Tk 8.4. */ + Tk_Window warpWindow; + Tk_Window warpMainwin; /* For finding the root window for warping + * purposes. */ + int warpX; + int warpY; + + /* + * The following field(s) were all added for Tk8.4 + */ + + unsigned int flags; /* Various flag values: these are all defined + * in below. */ + TkCaret caret; /* Information about the caret for this + * display. This is not a pointer. */ + + int iconDataSize; /* Size of default iconphoto image data. */ + unsigned char* iconDataPtr; /* Default iconphoto image data, if set. */ +#ifdef TK_USE_INPUT_METHODS + int ximGeneration; /* Used to invalidate XIC */ +#endif /* TK_USE_INPUT_METHODS */ +} TkDisplay; + +/* + * Flag values for TkDisplay flags. + * TK_DISPLAY_COLLAPSE_MOTION_EVENTS: (default on) + * Indicates that we should collapse motion events on this display + * TK_DISPLAY_USE_IM: (default on, set via tk.tcl) + * Whether to use input methods for this display + * TK_DISPLAY_WM_TRACING: (default off) + * Whether we should do wm tracing on this display. + * TK_DISPLAY_IN_WARP: (default off) + * Indicates that we are in a pointer warp + */ + +#define TK_DISPLAY_COLLAPSE_MOTION_EVENTS (1 << 0) +#define TK_DISPLAY_USE_IM (1 << 1) +#define TK_DISPLAY_WM_TRACING (1 << 3) +#define TK_DISPLAY_IN_WARP (1 << 4) +#define TK_DISPLAY_USE_XKB (1 << 5) + +/* + * One of the following structures exists for each error handler created by a + * call to Tk_CreateErrorHandler. The structure is managed by tkError.c. + */ + +typedef struct TkErrorHandler { + TkDisplay* dispPtr; /* Display to which handler applies. */ + unsigned long firstRequest; /* Only errors with serial numbers >= to this + * are considered. */ + unsigned long lastRequest; /* Only errors with serial numbers <= to this + * are considered. This field is filled in + * when XUnhandle is called. -1 means + * XUnhandle hasn't been called yet. */ + int error; /* Consider only errors with this error_code + * (-1 means consider all errors). */ + int request; /* Consider only errors with this major + * request code (-1 means consider all major + * codes). */ + int minorCode; /* Consider only errors with this minor + * request code (-1 means consider all minor + * codes). */ + Tk_ErrorProc* errorProc; /* Function to invoke when a matching error + * occurs. NULL means just ignore errors. */ + ClientData clientData; /* Arbitrary value to pass to errorProc. */ + struct TkErrorHandler* nextPtr; + /* Pointer to next older handler for this + * display, or NULL for end of list. */ +} TkErrorHandler; + +/* + * One of the following structures exists for each event handler created by + * calling Tk_CreateEventHandler. This information is used by tkEvent.c only. + */ + +typedef struct TkEventHandler { + unsigned long mask; /* Events for which to invoke proc. */ + Tk_EventProc* proc; /* Function to invoke when an event in mask + * occurs. */ + ClientData clientData; /* Argument to pass to proc. */ + struct TkEventHandler* nextPtr; + /* Next in list of handlers associated with + * window (NULL means end of list). */ +} TkEventHandler; + +/* + * Tk keeps one of the following data structures for each main window (created + * by a call to TkCreateMainWindow). It stores information that is shared by + * all of the windows associated with a particular main window. + */ + +typedef struct TkMainInfo { + int refCount; /* Number of windows whose "mainPtr" fields + * point here. When this becomes zero, can + * free up the structure (the reference count + * is zero because windows can get deleted in + * almost any order; the main window isn't + * necessarily the last one deleted). */ + struct TkWindow* winPtr; /* Pointer to main window. */ + Tcl_Interp* interp; /* Interpreter associated with application. */ + Tcl_HashTable nameTable; /* Hash table mapping path names to TkWindow + * structs for all windows related to this + * main window. Managed by tkWindow.c. */ + long deletionEpoch; /* Incremented by window deletions. */ + Tk_BindingTable bindingTable; + /* Used in conjunction with "bind" command to + * bind events to Tcl commands. */ + TkBindInfo bindInfo; /* Information used by tkBind.c on a per + * application basis. */ + struct TkFontInfo* fontInfoPtr; + /* Information used by tkFont.c on a per + * application basis. */ + + /* + * Information used only by tkFocus.c and tk*Embed.c: + */ + + struct TkToplevelFocusInfo* tlFocusPtr; + /* First in list of records containing focus + * information for each top-level in the + * application. Used only by tkFocus.c. */ + struct TkDisplayFocusInfo* displayFocusPtr; + /* First in list of records containing focus + * information for each display that this + * application has ever used. Used only by + * tkFocus.c. */ + + struct ElArray* optionRootPtr; + /* Top level of option hierarchy for this main + * window. NULL means uninitialized. Managed + * by tkOption.c. */ + Tcl_HashTable imageTable; /* Maps from image names to Tk_ImageMaster + * structures. Managed by tkImage.c. */ + int strictMotif; /* This is linked to the tk_strictMotif global + * variable. */ + int alwaysShowSelection; /* This is linked to the + * ::tk::AlwaysShowSelection variable. */ + struct TkMainInfo* nextPtr; /* Next in list of all main windows managed by + * this process. */ + Tcl_HashTable busyTable; /* Information used by [tk busy] command. */ +} TkMainInfo; + +/* + * Tk keeps the following data structure for each of it's builtin bitmaps. + * This structure is only used by tkBitmap.c and other platform specific + * bitmap files. + */ + +typedef struct { + const void* source; /* Bits for bitmap. */ + int width, height; /* Dimensions of bitmap. */ + int native; /* 0 means generic (X style) bitmap, 1 means + * native style bitmap. */ +} TkPredefBitmap; + +/* + * Tk keeps one of the following structures for each window. Some of the + * information (like size and location) is a shadow of information managed by + * the X server, and some is special information used here, such as event and + * geometry management information. This information is (mostly) managed by + * tkWindow.c. WARNING: the declaration below must be kept consistent with the + * Tk_FakeWin structure in tk.h. If you change one, be sure to change the + * other! + */ + +typedef struct TkWindow { + /* + * Structural information: + */ + + Display* display; /* Display containing window. */ + TkDisplay* dispPtr; /* Tk's information about display for + * window. */ + int screenNum; /* Index of screen for window, among all those + * for dispPtr. */ + Visual* visual; /* Visual to use for window. If not default, + * MUST be set before X window is created. */ + int depth; /* Number of bits/pixel. */ + Window window; /* X's id for window. NULL means window hasn't + * actually been created yet, or it's been + * deleted. */ + struct TkWindow* childList; /* First in list of child windows, or NULL if + * no children. List is in stacking order, + * lowest window first.*/ + struct TkWindow* lastChildPtr; + /* Last in list of child windows (highest in + * stacking order), or NULL if no children. */ + struct TkWindow* parentPtr; /* Pointer to parent window (logical parent, + * not necessarily X parent). NULL means + * either this is the main window, or the + * window's parent has already been deleted. */ + struct TkWindow* nextPtr; /* Next higher sibling (in stacking order) in + * list of children with same parent. NULL + * means end of list. */ + TkMainInfo* mainPtr; /* Information shared by all windows + * associated with a particular main window. + * NULL means this window is a rogue that is + * not associated with any application (at + * present, this only happens for the dummy + * windows used for "send" communication). */ + + /* + * Name and type information for the window: + */ + + char* pathName; /* Path name of window (concatenation of all + * names between this window and its top-level + * ancestor). This is a pointer into an entry + * in mainPtr->nameTable. NULL means that the + * window hasn't been completely created + * yet. */ + Tk_Uid nameUid; /* Name of the window within its parent + * (unique within the parent). */ + Tk_Uid classUid; /* Class of the window. NULL means window + * hasn't been given a class yet. */ + + /* + * Geometry and other attributes of window. This information may not be + * updated on the server immediately; stuff that hasn't been reflected in + * the server yet is called "dirty". At present, information can be dirty + * only if the window hasn't yet been created. + */ + + XWindowChanges changes; /* Geometry and other info about window. */ + unsigned int dirtyChanges; /* Bits indicate fields of "changes" that are + * dirty. */ + XSetWindowAttributes atts; /* Current attributes of window. */ + unsigned long dirtyAtts; /* Bits indicate fields of "atts" that are + * dirty. */ + + unsigned int flags; /* Various flag values: these are all defined + * in tk.h (confusing, but they're needed + * there for some query macros). */ + + /* + * Information kept by the event manager (tkEvent.c): + */ + + TkEventHandler* handlerList; /* First in list of event handlers declared + * for this window, or NULL if none. */ +#ifdef TK_USE_INPUT_METHODS + XIC inputContext; /* XIM input context. */ +#endif /* TK_USE_INPUT_METHODS */ + + /* + * Information used for event bindings (see "bind" and "bindtags" commands + * in tkCmds.c): + */ + + ClientData* tagPtr; /* Points to array of tags used for bindings + * on this window. Each tag is a Tk_Uid. + * Malloc'ed. NULL means no tags. */ + int numTags; /* Number of tags at *tagPtr. */ + + /* + * Information used by tkOption.c to manage options for the window. + */ + + int optionLevel; /* -1 means no option information is currently + * cached for this window. Otherwise this + * gives the level in the option stack at + * which info is cached. */ + /* + * Information used by tkSelect.c to manage the selection. + */ + + struct TkSelHandler* selHandlerList; + /* First in list of handlers for returning the + * selection in various forms. */ + + /* + * Information used by tkGeometry.c for geometry management. + */ + + const Tk_GeomMgr* geomMgrPtr; + /* Information about geometry manager for this + * window. */ + ClientData geomData; /* Argument for geometry manager functions. */ + int reqWidth, reqHeight; /* Arguments from last call to + * Tk_GeometryRequest, or 0's if + * Tk_GeometryRequest hasn't been called. */ + int internalBorderLeft; /* Width of internal border of window (0 means + * no internal border). Geometry managers + * should not normally place children on top + * of the border. Fields for the other three + * sides are found below. */ + + /* + * Information maintained by tkWm.c for window manager communication. + */ + + struct TkWmInfo* wmInfoPtr; /* For top-level windows (and also for special + * Unix menubar and wrapper windows), points + * to structure with wm-related info (see + * tkWm.c). For other windows, this is + * NULL. */ + + /* + * Information used by widget classes. + */ + + const Tk_ClassProcs* classProcsPtr; + ClientData instanceData; + + /* + * Platform specific information private to each port. + */ + + struct TkWindowPrivate* privatePtr; + + /* + * More information used by tkGeometry.c for geometry management. + */ + + /* The remaining fields of internal border. */ + int internalBorderRight; + int internalBorderTop; + int internalBorderBottom; + + int minReqWidth; /* Minimum requested width. */ + int minReqHeight; /* Minimum requested height. */ + char* geometryMaster; +#ifdef TK_USE_INPUT_METHODS + int ximGeneration; /* Used to invalidate XIC */ +#endif /* TK_USE_INPUT_METHODS */ +} TkWindow; + +/* + * Real definition of some events. Note that these events come from outside + * but have internally generated pieces added to them. + */ + +typedef struct { + XKeyEvent keyEvent; /* The real event from X11. */ + char* charValuePtr; /* A pointer to a string that holds the key's + * %A substitution text (before backslash + * adding), or NULL if that has not been + * computed yet. If non-NULL, this string was + * allocated with ckalloc(). */ + int charValueLen; /* Length of string in charValuePtr when that + * is non-NULL. */ + KeySym keysym; /* Key symbol computed after input methods + * have been invoked */ +} TkKeyEvent; + +/* + * Flags passed to TkpMakeMenuWindow's 'transient' argument. + */ + +#define TK_MAKE_MENU_TEAROFF 0 /* Only non-transient case. */ +#define TK_MAKE_MENU_POPUP 1 +#define TK_MAKE_MENU_DROPDOWN 2 + +/* + * The following structure is used with TkMakeEnsemble to create ensemble + * commands and optionally to create sub-ensembles. + */ + +typedef struct TkEnsemble { + const char* name; + Tcl_ObjCmdProc* proc; + const struct TkEnsemble* subensemble; +} TkEnsemble; + +/* + * The following structure is used as a two way map between integers and + * strings, usually to map between an internal C representation and the + * strings used in Tcl. + */ + +typedef struct TkStateMap { + int numKey; /* Integer representation of a value. */ + const char* strKey; /* String representation of a value. */ +} TkStateMap; + +/* + * This structure is used by the Mac and Window porting layers as the internal + * representation of a clip_mask in a GC. + */ + +typedef struct TkpClipMask { + int type; /* TKP_CLIP_PIXMAP or TKP_CLIP_REGION. */ + union { + Pixmap pixmap; + TkRegion region; + } value; +} TkpClipMask; + +#define TKP_CLIP_PIXMAP 0 +#define TKP_CLIP_REGION 1 + +/* + * Return values from TkGrabState: + */ + +#define TK_GRAB_NONE 0 +#define TK_GRAB_IN_TREE 1 +#define TK_GRAB_ANCESTOR 2 +#define TK_GRAB_EXCLUDED 3 + +/* + * Additional flag for TkpMeasureCharsInContext. Coordinate with other flags + * for this routine, but don't make public until TkpMeasureCharsInContext is + * made public, too. + */ + +#define TK_ISOLATE_END 32 + +/* + * The macro below is used to modify a "char" value (e.g. by casting it to an + * unsigned character) so that it can be used safely with macros such as + * isspace(). + */ + +#define UCHAR(c) ((unsigned char)(c)) + +/* + * The following symbol is used in the mode field of FocusIn events generated + * by an embedded application to request the input focus from its container. + */ + +#define EMBEDDED_APP_WANTS_FOCUS (NotifyNormal + 20) + +/* + * The following special modifier mask bits are defined, to indicate logical + * modifiers such as Meta and Alt that may float among the actual modifier + * bits. + */ + +#define META_MASK (AnyModifier << 1) +#define ALT_MASK (AnyModifier << 2) +#define EXTENDED_MASK (AnyModifier << 3) + +/* + * Object types not declared in tkObj.c need to be mentioned here so they can + * be properly registered with Tcl: + */ + +MODULE_SCOPE const Tcl_ObjType tkBorderObjType; +MODULE_SCOPE const Tcl_ObjType tkBitmapObjType; +MODULE_SCOPE const Tcl_ObjType tkColorObjType; +MODULE_SCOPE const Tcl_ObjType tkCursorObjType; +MODULE_SCOPE const Tcl_ObjType tkFontObjType; +MODULE_SCOPE const Tcl_ObjType tkStateKeyObjType; +MODULE_SCOPE const Tcl_ObjType tkTextIndexType; + +/* + * Miscellaneous variables shared among Tk modules but not exported to the + * outside world: + */ + +MODULE_SCOPE const Tk_SmoothMethod tkBezierSmoothMethod; +MODULE_SCOPE Tk_ImageType tkBitmapImageType; +MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtGIF; +MODULE_SCOPE void (*tkHandleEventProc)(XEvent* eventPtr); +MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtPNG; +MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtPPM; +MODULE_SCOPE TkMainInfo* tkMainWindowList; +MODULE_SCOPE Tk_ImageType tkPhotoImageType; +MODULE_SCOPE Tcl_HashTable tkPredefBitmapTable; + +MODULE_SCOPE const char* const tkWebColors[20]; + +/* + * The definition of pi, at least from the perspective of double-precision + * floats. + */ + +#ifndef PI +#ifdef M_PI +#define PI M_PI +#else +#define PI 3.14159265358979323846 +#endif +#endif + +/* + * Support for Clang Static Analyzer + */ + +#if defined(PURIFY) && defined(__clang__) +#if __has_feature(attribute_analyzer_noreturn) && !defined(Tcl_Panic) && \ + defined(Tcl_Panic_TCL_DECLARED) +void Tcl_Panic(const char*, ...) __attribute__((analyzer_noreturn)); +#endif +#if !defined(CLANG_ASSERT) +#include +#define CLANG_ASSERT(x) assert(x) +#endif +#elif !defined(CLANG_ASSERT) +#define CLANG_ASSERT(x) +#endif /* PURIFY && __clang__ */ + +/* + * The following magic value is stored in the "send_event" field of FocusIn + * and FocusOut events. This allows us to separate "real" events coming from + * the server from those that we generated. + */ + +#define GENERATED_FOCUS_EVENT_MAGIC ((Bool)0x547321ac) + +/* + * Exported internals. + */ + +#include "tkIntDecls.h" + +/* + * Themed widget set init function: + */ + +MODULE_SCOPE int Ttk_Init(Tcl_Interp* interp); + +/* + * Internal functions shared among Tk modules but not exported to the outside + * world: + */ + +MODULE_SCOPE int Tk_BellObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_BindObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_BindtagsObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_BusyObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_ButtonObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_CanvasObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int argc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_CheckbuttonObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_ClipboardObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_ChooseColorObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_ChooseDirectoryObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_DestroyObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_EntryObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_EventObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_FrameObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_FocusObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_FontObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_GetOpenFileObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_GetSaveFileObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_GrabObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_GridObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_ImageObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_LabelObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_LabelframeObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_ListboxObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_LowerObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_MenuObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_MenubuttonObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_MessageBoxObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_MessageObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_PanedWindowObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_OptionObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_PackObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_PlaceObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_RadiobuttonObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_RaiseObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_ScaleObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_ScrollbarObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_SelectionObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_SendObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_SendObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_SpinboxObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_TextObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_TkwaitObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_ToplevelObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_UpdateObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_WinfoObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int Tk_WmObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); + +MODULE_SCOPE int Tk_GetDoublePixelsFromObj( + Tcl_Interp* interp, + Tk_Window tkwin, + Tcl_Obj* objPtr, + double* doublePtr); +MODULE_SCOPE int +TkSetGeometryMaster(Tcl_Interp* interp, Tk_Window tkwin, const char* master); +MODULE_SCOPE void TkFreeGeometryMaster(Tk_Window tkwin, const char* master); + +MODULE_SCOPE void TkEventInit(void); +MODULE_SCOPE void TkRegisterObjTypes(void); +MODULE_SCOPE int TkDeadAppObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const argv[]); +MODULE_SCOPE int TkCanvasGetCoordObj( + Tcl_Interp* interp, + Tk_Canvas canvas, + Tcl_Obj* obj, + double* doublePtr); +MODULE_SCOPE int TkGetDoublePixels( + Tcl_Interp* interp, + Tk_Window tkwin, + const char* string, + double* doublePtr); +MODULE_SCOPE int TkPostscriptImage( + Tcl_Interp* interp, + Tk_Window tkwin, + Tk_PostscriptInfo psInfo, + XImage* ximage, + int x, + int y, + int width, + int height); +MODULE_SCOPE void TkMapTopFrame(Tk_Window tkwin); +MODULE_SCOPE XEvent* TkpGetBindingXEvent(Tcl_Interp* interp); +MODULE_SCOPE void TkCreateExitHandler( + Tcl_ExitProc* proc, + ClientData clientData); +MODULE_SCOPE void TkDeleteExitHandler( + Tcl_ExitProc* proc, + ClientData clientData); +MODULE_SCOPE Tcl_ExitProc TkFinalize; +MODULE_SCOPE Tcl_ExitProc TkFinalizeThread; +MODULE_SCOPE void TkpBuildRegionFromAlphaData( + TkRegion region, + unsigned x, + unsigned y, + unsigned width, + unsigned height, + unsigned char* dataPtr, + unsigned pixelStride, + unsigned lineStride); +MODULE_SCOPE void +TkAppendPadAmount(Tcl_Obj* bufferObj, const char* buffer, int pad1, int pad2); +MODULE_SCOPE int TkParsePadAmount( + Tcl_Interp* interp, + Tk_Window tkwin, + Tcl_Obj* objPtr, + int* pad1Ptr, + int* pad2Ptr); +MODULE_SCOPE void TkFocusSplit(TkWindow* winPtr); +MODULE_SCOPE void TkFocusJoin(TkWindow* winPtr); +MODULE_SCOPE int TkpAlwaysShowSelection(Tk_Window tkwin); +MODULE_SCOPE void TkpDrawCharsInContext( + Display* display, + Drawable drawable, + GC gc, + Tk_Font tkfont, + const char* source, + int numBytes, + int rangeStart, + int rangeLength, + int x, + int y); +MODULE_SCOPE int TkpMeasureCharsInContext( + Tk_Font tkfont, + const char* source, + int numBytes, + int rangeStart, + int rangeLength, + int maxLength, + int flags, + int* lengthPtr); +MODULE_SCOPE void TkUnderlineCharsInContext( + Display* display, + Drawable drawable, + GC gc, + Tk_Font tkfont, + const char* string, + int numBytes, + int x, + int y, + int firstByte, + int lastByte); +MODULE_SCOPE void TkpGetFontAttrsForChar( + Tk_Window tkwin, + Tk_Font tkfont, + int c, + struct TkFontAttributes* faPtr); +MODULE_SCOPE Tcl_Obj* TkNewWindowObj(Tk_Window tkwin); +MODULE_SCOPE void TkpShowBusyWindow(TkBusy busy); +MODULE_SCOPE void TkpHideBusyWindow(TkBusy busy); +MODULE_SCOPE void TkpMakeTransparentWindowExist(Tk_Window tkwin, Window parent); +MODULE_SCOPE void TkpCreateBusy( + Tk_FakeWin* winPtr, + Tk_Window tkRef, + Window* parentPtr, + Tk_Window tkParent, + TkBusy busy); +MODULE_SCOPE int TkBackgroundEvalObjv( + Tcl_Interp* interp, + int objc, + Tcl_Obj* const* objv, + int flags); +MODULE_SCOPE void +TkSendVirtualEvent(Tk_Window tgtWin, const char* eventName, Tcl_Obj* detail); +MODULE_SCOPE Tcl_Command TkMakeEnsemble( + Tcl_Interp* interp, + const char* nsname, + const char* name, + ClientData clientData, + const TkEnsemble* map); +MODULE_SCOPE int TkInitTkCmd(Tcl_Interp* interp, ClientData clientData); +MODULE_SCOPE int TkInitFontchooser(Tcl_Interp* interp, ClientData clientData); +MODULE_SCOPE void TkpWarpPointer(TkDisplay* dispPtr); +MODULE_SCOPE void TkpCancelWarp(TkDisplay* dispPtr); +MODULE_SCOPE int TkListCreateFrame( + ClientData clientData, + Tcl_Interp* interp, + Tcl_Obj* listObj, + int toplevel, + Tcl_Obj* nameObj); + +#ifdef _WIN32 +#define TkParseColor XParseColor +#else +MODULE_SCOPE Status TkParseColor( + Display* display, + Colormap map, + const char* spec, + XColor* colorPtr); +#endif +#ifdef HAVE_XFT +MODULE_SCOPE void TkUnixSetXftClipRegion(TkRegion clipRegion); +#endif + +#if TCL_UTF_MAX > 4 +#define TkUtfToUniChar Tcl_UtfToUniChar +#define TkUniCharToUtf Tcl_UniCharToUtf +#else +MODULE_SCOPE int TkUtfToUniChar(const char*, int*); +MODULE_SCOPE int TkUniCharToUtf(int, char*); +#endif + +/* + * Unsupported commands. + */ + +MODULE_SCOPE int TkUnsupported1ObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); + +/* + * For Tktest. + */ +MODULE_SCOPE int SquareObjCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int TkOldTestInit(Tcl_Interp* interp); +#if !(defined(_WIN32) || defined(MAC_OSX_TK)) +#define TkplatformtestInit(x) TCL_OK +#else +MODULE_SCOPE int TkplatformtestInit(Tcl_Interp* interp); +#endif + +#endif /* _TKINT */ + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkIntDecls.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkIntDecls.h new file mode 100644 index 0000000..6f258e7 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkIntDecls.h @@ -0,0 +1,1583 @@ +/* + * tkIntDecls.h -- + * + * This file contains the declarations for all unsupported + * functions that are exported by the Tk library. These + * interfaces are not guaranteed to remain the same between + * versions. Use at your own risk. + * + * Copyright (c) 1998-1999 by Scriptics Corporation. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TKINTDECLS +#define _TKINTDECLS + +#ifdef BUILD_tk +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLEXPORT +#endif + +struct TkText; +typedef struct TkTextBTree_* TkTextBTree; +struct TkTextDispChunk; +struct TkTextIndex; +struct TkTextSegment; +struct TkSharedText; + +/* + * WARNING: This file is automatically generated by the tools/genStubs.tcl + * script. Any modifications to the function declarations below should be made + * in the generic/tkInt.decls script. + */ + +/* !BEGIN!: Do not edit below this line. */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Exported function declarations: + */ + +/* 0 */ +EXTERN TkWindow* +TkAllocWindow(TkDisplay* dispPtr, int screenNum, TkWindow* parentPtr); +/* 1 */ +EXTERN void TkBezierPoints(double control[], int numSteps, double* coordPtr); +/* 2 */ +EXTERN void TkBezierScreenPoints( + Tk_Canvas canvas, + double control[], + int numSteps, + XPoint* xPointPtr); +/* Slot 3 is reserved */ +/* 4 */ +EXTERN void TkBindEventProc(TkWindow* winPtr, XEvent* eventPtr); +/* 5 */ +EXTERN void TkBindFree(TkMainInfo* mainPtr); +/* 6 */ +EXTERN void TkBindInit(TkMainInfo* mainPtr); +/* 7 */ +EXTERN void TkChangeEventWindow(XEvent* eventPtr, TkWindow* winPtr); +/* 8 */ +EXTERN int TkClipInit(Tcl_Interp* interp, TkDisplay* dispPtr); +/* 9 */ +EXTERN void TkComputeAnchor( + Tk_Anchor anchor, + Tk_Window tkwin, + int padX, + int padY, + int innerWidth, + int innerHeight, + int* xPtr, + int* yPtr); +/* Slot 10 is reserved */ +/* Slot 11 is reserved */ +/* 12 */ +EXTERN TkCursor* TkCreateCursorFromData( + Tk_Window tkwin, + const char* source, + const char* mask, + int width, + int height, + int xHot, + int yHot, + XColor fg, + XColor bg); +/* 13 */ +EXTERN int TkCreateFrame( + ClientData clientData, + Tcl_Interp* interp, + int argc, + const char* const* argv, + int toplevel, + const char* appName); +/* 14 */ +EXTERN Tk_Window TkCreateMainWindow( + Tcl_Interp* interp, + const char* screenName, + const char* baseName); +/* 15 */ +EXTERN Time TkCurrentTime(TkDisplay* dispPtr); +/* 16 */ +EXTERN void TkDeleteAllImages(TkMainInfo* mainPtr); +/* 17 */ +EXTERN void TkDoConfigureNotify(TkWindow* winPtr); +/* 18 */ +EXTERN void TkDrawInsetFocusHighlight( + Tk_Window tkwin, + GC gc, + int width, + Drawable drawable, + int padding); +/* 19 */ +EXTERN void TkEventDeadWindow(TkWindow* winPtr); +/* 20 */ +EXTERN void TkFillPolygon( + Tk_Canvas canvas, + double* coordPtr, + int numPoints, + Display* display, + Drawable drawable, + GC gc, + GC outlineGC); +/* 21 */ +EXTERN int TkFindStateNum( + Tcl_Interp* interp, + const char* option, + const TkStateMap* mapPtr, + const char* strKey); +/* 22 */ +EXTERN CONST86 char* TkFindStateString(const TkStateMap* mapPtr, int numKey); +/* 23 */ +EXTERN void TkFocusDeadWindow(TkWindow* winPtr); +/* 24 */ +EXTERN int TkFocusFilterEvent(TkWindow* winPtr, XEvent* eventPtr); +/* 25 */ +EXTERN TkWindow* TkFocusKeyEvent(TkWindow* winPtr, XEvent* eventPtr); +/* 26 */ +EXTERN void TkFontPkgInit(TkMainInfo* mainPtr); +/* 27 */ +EXTERN void TkFontPkgFree(TkMainInfo* mainPtr); +/* 28 */ +EXTERN void TkFreeBindingTags(TkWindow* winPtr); +/* 29 */ +EXTERN void TkpFreeCursor(TkCursor* cursorPtr); +/* 30 */ +EXTERN char* TkGetBitmapData( + Tcl_Interp* interp, + const char* string, + const char* fileName, + int* widthPtr, + int* heightPtr, + int* hotXPtr, + int* hotYPtr); +/* 31 */ +EXTERN void TkGetButtPoints( + double p1[], + double p2[], + double width, + int project, + double m1[], + double m2[]); +/* 32 */ +EXTERN TkCursor* +TkGetCursorByName(Tcl_Interp* interp, Tk_Window tkwin, Tk_Uid string); +/* 33 */ +EXTERN const char* TkGetDefaultScreenName( + Tcl_Interp* interp, + const char* screenName); +/* 34 */ +EXTERN TkDisplay* TkGetDisplay(Display* display); +/* 35 */ +EXTERN int TkGetDisplayOf( + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[], + Tk_Window* tkwinPtr); +/* 36 */ +EXTERN TkWindow* TkGetFocusWin(TkWindow* winPtr); +/* 37 */ +EXTERN int TkGetInterpNames(Tcl_Interp* interp, Tk_Window tkwin); +/* 38 */ +EXTERN int TkGetMiterPoints( + double p1[], + double p2[], + double p3[], + double width, + double m1[], + double m2[]); +/* 39 */ +EXTERN void TkGetPointerCoords(Tk_Window tkwin, int* xPtr, int* yPtr); +/* 40 */ +EXTERN void TkGetServerInfo(Tcl_Interp* interp, Tk_Window tkwin); +/* 41 */ +EXTERN void TkGrabDeadWindow(TkWindow* winPtr); +/* 42 */ +EXTERN int TkGrabState(TkWindow* winPtr); +/* 43 */ +EXTERN void TkIncludePoint(Tk_Item* itemPtr, double* pointPtr); +/* 44 */ +EXTERN void TkInOutEvents( + XEvent* eventPtr, + TkWindow* sourcePtr, + TkWindow* destPtr, + int leaveType, + int enterType, + Tcl_QueuePosition position); +/* 45 */ +EXTERN void TkInstallFrameMenu(Tk_Window tkwin); +/* 46 */ +EXTERN CONST86 char* TkKeysymToString(KeySym keysym); +/* 47 */ +EXTERN int TkLineToArea(double end1Ptr[], double end2Ptr[], double rectPtr[]); +/* 48 */ +EXTERN double +TkLineToPoint(double end1Ptr[], double end2Ptr[], double pointPtr[]); +/* 49 */ +EXTERN int TkMakeBezierCurve( + Tk_Canvas canvas, + double* pointPtr, + int numPoints, + int numSteps, + XPoint xPoints[], + double dblPoints[]); +/* 50 */ +EXTERN void TkMakeBezierPostscript( + Tcl_Interp* interp, + Tk_Canvas canvas, + double* pointPtr, + int numPoints); +/* 51 */ +EXTERN void TkOptionClassChanged(TkWindow* winPtr); +/* 52 */ +EXTERN void TkOptionDeadWindow(TkWindow* winPtr); +/* 53 */ +EXTERN int TkOvalToArea(double* ovalPtr, double* rectPtr); +/* 54 */ +EXTERN double +TkOvalToPoint(double ovalPtr[], double width, int filled, double pointPtr[]); +/* 55 */ +EXTERN int TkpChangeFocus(TkWindow* winPtr, int force); +/* 56 */ +EXTERN void TkpCloseDisplay(TkDisplay* dispPtr); +/* 57 */ +EXTERN void TkpClaimFocus(TkWindow* topLevelPtr, int force); +/* 58 */ +EXTERN void TkpDisplayWarning(const char* msg, const char* title); +/* 59 */ +EXTERN void TkpGetAppName(Tcl_Interp* interp, Tcl_DString* name); +/* 60 */ +EXTERN TkWindow* TkpGetOtherWindow(TkWindow* winPtr); +/* 61 */ +EXTERN TkWindow* TkpGetWrapperWindow(TkWindow* winPtr); +/* 62 */ +EXTERN int TkpInit(Tcl_Interp* interp); +/* 63 */ +EXTERN void TkpInitializeMenuBindings( + Tcl_Interp* interp, + Tk_BindingTable bindingTable); +/* 64 */ +EXTERN void TkpMakeContainer(Tk_Window tkwin); +/* 65 */ +EXTERN void TkpMakeMenuWindow(Tk_Window tkwin, int transient); +/* 66 */ +EXTERN Window TkpMakeWindow(TkWindow* winPtr, Window parent); +/* 67 */ +EXTERN void TkpMenuNotifyToplevelCreate( + Tcl_Interp* interp, + const char* menuName); +/* 68 */ +EXTERN TkDisplay* TkpOpenDisplay(const char* display_name); +/* 69 */ +EXTERN int TkPointerEvent(XEvent* eventPtr, TkWindow* winPtr); +/* 70 */ +EXTERN int TkPolygonToArea(double* polyPtr, int numPoints, double* rectPtr); +/* 71 */ +EXTERN double +TkPolygonToPoint(double* polyPtr, int numPoints, double* pointPtr); +/* 72 */ +EXTERN int TkPositionInTree(TkWindow* winPtr, TkWindow* treePtr); +/* 73 */ +EXTERN void TkpRedirectKeyEvent(TkWindow* winPtr, XEvent* eventPtr); +/* 74 */ +EXTERN void +TkpSetMainMenubar(Tcl_Interp* interp, Tk_Window tkwin, const char* menuName); +/* 75 */ +EXTERN int +TkpUseWindow(Tcl_Interp* interp, Tk_Window tkwin, const char* string); +/* Slot 76 is reserved */ +/* 77 */ +EXTERN void TkQueueEventForAllChildren(TkWindow* winPtr, XEvent* eventPtr); +/* 78 */ +EXTERN int TkReadBitmapFile( + Display* display, + Drawable d, + const char* filename, + unsigned int* width_return, + unsigned int* height_return, + Pixmap* bitmap_return, + int* x_hot_return, + int* y_hot_return); +/* 79 */ +EXTERN int TkScrollWindow( + Tk_Window tkwin, + GC gc, + int x, + int y, + int width, + int height, + int dx, + int dy, + TkRegion damageRgn); +/* 80 */ +EXTERN void TkSelDeadWindow(TkWindow* winPtr); +/* 81 */ +EXTERN void TkSelEventProc(Tk_Window tkwin, XEvent* eventPtr); +/* 82 */ +EXTERN void TkSelInit(Tk_Window tkwin); +/* 83 */ +EXTERN void TkSelPropProc(XEvent* eventPtr); +/* Slot 84 is reserved */ +/* 85 */ +EXTERN void TkSetWindowMenuBar( + Tcl_Interp* interp, + Tk_Window tkwin, + const char* oldMenuName, + const char* menuName); +/* 86 */ +EXTERN KeySym TkStringToKeysym(const char* name); +/* 87 */ +EXTERN int TkThickPolyLineToArea( + double* coordPtr, + int numPoints, + double width, + int capStyle, + int joinStyle, + double* rectPtr); +/* 88 */ +EXTERN void TkWmAddToColormapWindows(TkWindow* winPtr); +/* 89 */ +EXTERN void TkWmDeadWindow(TkWindow* winPtr); +/* 90 */ +EXTERN TkWindow* TkWmFocusToplevel(TkWindow* winPtr); +/* 91 */ +EXTERN void TkWmMapWindow(TkWindow* winPtr); +/* 92 */ +EXTERN void TkWmNewWindow(TkWindow* winPtr); +/* 93 */ +EXTERN void TkWmProtocolEventProc(TkWindow* winPtr, XEvent* evenvPtr); +/* 94 */ +EXTERN void TkWmRemoveFromColormapWindows(TkWindow* winPtr); +/* 95 */ +EXTERN void +TkWmRestackToplevel(TkWindow* winPtr, int aboveBelow, TkWindow* otherPtr); +/* 96 */ +EXTERN void TkWmSetClass(TkWindow* winPtr); +/* 97 */ +EXTERN void TkWmUnmapWindow(TkWindow* winPtr); +/* 98 */ +EXTERN Tcl_Obj* TkDebugBitmap(Tk_Window tkwin, const char* name); +/* 99 */ +EXTERN Tcl_Obj* TkDebugBorder(Tk_Window tkwin, const char* name); +/* 100 */ +EXTERN Tcl_Obj* TkDebugCursor(Tk_Window tkwin, const char* name); +/* 101 */ +EXTERN Tcl_Obj* TkDebugColor(Tk_Window tkwin, const char* name); +/* 102 */ +EXTERN Tcl_Obj* TkDebugConfig(Tcl_Interp* interp, Tk_OptionTable table); +/* 103 */ +EXTERN Tcl_Obj* TkDebugFont(Tk_Window tkwin, const char* name); +/* 104 */ +EXTERN int TkFindStateNumObj( + Tcl_Interp* interp, + Tcl_Obj* optionPtr, + const TkStateMap* mapPtr, + Tcl_Obj* keyPtr); +/* 105 */ +EXTERN Tcl_HashTable* TkGetBitmapPredefTable(void); +/* 106 */ +EXTERN TkDisplay* TkGetDisplayList(void); +/* 107 */ +EXTERN TkMainInfo* TkGetMainInfoList(void); +/* 108 */ +EXTERN int TkGetWindowFromObj( + Tcl_Interp* interp, + Tk_Window tkwin, + Tcl_Obj* objPtr, + Tk_Window* windowPtr); +/* 109 */ +EXTERN CONST86 char* +TkpGetString(TkWindow* winPtr, XEvent* eventPtr, Tcl_DString* dsPtr); +/* 110 */ +EXTERN void TkpGetSubFonts(Tcl_Interp* interp, Tk_Font tkfont); +/* 111 */ +EXTERN Tcl_Obj* +TkpGetSystemDefault(Tk_Window tkwin, const char* dbName, const char* className); +/* 112 */ +EXTERN void TkpMenuThreadInit(void); +/* 113 */ +EXTERN void TkClipBox(TkRegion rgn, XRectangle* rect_return); +/* 114 */ +EXTERN TkRegion TkCreateRegion(void); +/* 115 */ +EXTERN void TkDestroyRegion(TkRegion rgn); +/* 116 */ +EXTERN void TkIntersectRegion(TkRegion sra, TkRegion srcb, TkRegion dr_return); +/* 117 */ +EXTERN int TkRectInRegion( + TkRegion rgn, + int x, + int y, + unsigned int width, + unsigned int height); +/* 118 */ +EXTERN void TkSetRegion(Display* display, GC gc, TkRegion rgn); +/* 119 */ +EXTERN void +TkUnionRectWithRegion(XRectangle* rect, TkRegion src, TkRegion dr_return); +/* Slot 120 is reserved */ +#ifdef MAC_OSX_TK /* AQUA */ +/* 121 */ +EXTERN Pixmap TkpCreateNativeBitmap(Display* display, const void* source); +#endif /* AQUA */ +#ifdef MAC_OSX_TK /* AQUA */ +/* 122 */ +EXTERN void TkpDefineNativeBitmaps(void); +#endif /* AQUA */ +/* Slot 123 is reserved */ +#ifdef MAC_OSX_TK /* AQUA */ +/* 124 */ +EXTERN Pixmap TkpGetNativeAppBitmap( + Display* display, + const char* name, + int* width, + int* height); +#endif /* AQUA */ +/* Slot 125 is reserved */ +/* Slot 126 is reserved */ +/* Slot 127 is reserved */ +/* Slot 128 is reserved */ +/* Slot 129 is reserved */ +/* Slot 130 is reserved */ +/* Slot 131 is reserved */ +/* Slot 132 is reserved */ +/* Slot 133 is reserved */ +/* Slot 134 is reserved */ +/* 135 */ +EXTERN void TkpDrawHighlightBorder( + Tk_Window tkwin, + GC fgGC, + GC bgGC, + int highlightWidth, + Drawable drawable); +/* 136 */ +EXTERN void TkSetFocusWin(TkWindow* winPtr, int force); +/* 137 */ +EXTERN void +TkpSetKeycodeAndState(Tk_Window tkwin, KeySym keySym, XEvent* eventPtr); +/* 138 */ +EXTERN KeySym TkpGetKeySym(TkDisplay* dispPtr, XEvent* eventPtr); +/* 139 */ +EXTERN void TkpInitKeymapInfo(TkDisplay* dispPtr); +/* 140 */ +EXTERN TkRegion TkPhotoGetValidRegion(Tk_PhotoHandle handle); +/* 141 */ +EXTERN TkWindow** TkWmStackorderToplevel(TkWindow* parentPtr); +/* 142 */ +EXTERN void TkFocusFree(TkMainInfo* mainPtr); +/* 143 */ +EXTERN void TkClipCleanup(TkDisplay* dispPtr); +/* 144 */ +EXTERN void TkGCCleanup(TkDisplay* dispPtr); +/* 145 */ +EXTERN void TkSubtractRegion(TkRegion sra, TkRegion srcb, TkRegion dr_return); +/* 146 */ +EXTERN void TkStylePkgInit(TkMainInfo* mainPtr); +/* 147 */ +EXTERN void TkStylePkgFree(TkMainInfo* mainPtr); +/* 148 */ +EXTERN Tk_Window +TkToplevelWindowForCommand(Tcl_Interp* interp, const char* cmdName); +/* 149 */ +EXTERN const Tk_OptionSpec* TkGetOptionSpec( + const char* name, + Tk_OptionTable optionTable); +/* 150 */ +EXTERN int TkMakeRawCurve( + Tk_Canvas canvas, + double* pointPtr, + int numPoints, + int numSteps, + XPoint xPoints[], + double dblPoints[]); +/* 151 */ +EXTERN void TkMakeRawCurvePostscript( + Tcl_Interp* interp, + Tk_Canvas canvas, + double* pointPtr, + int numPoints); +/* 152 */ +EXTERN void TkpDrawFrame( + Tk_Window tkwin, + Tk_3DBorder border, + int highlightWidth, + int borderWidth, + int relief); +/* 153 */ +EXTERN void TkCreateThreadExitHandler( + Tcl_ExitProc* proc, + ClientData clientData); +/* 154 */ +EXTERN void TkDeleteThreadExitHandler( + Tcl_ExitProc* proc, + ClientData clientData); +/* Slot 155 is reserved */ +/* 156 */ +EXTERN int TkpTestembedCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 157 */ +EXTERN int TkpTesttextCmd( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 158 */ +EXTERN int TkSelGetSelection( + Tcl_Interp* interp, + Tk_Window tkwin, + Atom selection, + Atom target, + Tk_GetSelProc* proc, + ClientData clientData); +/* 159 */ +EXTERN int TkTextGetIndex( + Tcl_Interp* interp, + struct TkText* textPtr, + const char* string, + struct TkTextIndex* indexPtr); +/* 160 */ +EXTERN int TkTextIndexBackBytes( + const struct TkText* textPtr, + const struct TkTextIndex* srcPtr, + int count, + struct TkTextIndex* dstPtr); +/* 161 */ +EXTERN int TkTextIndexForwBytes( + const struct TkText* textPtr, + const struct TkTextIndex* srcPtr, + int count, + struct TkTextIndex* dstPtr); +/* 162 */ +EXTERN struct TkTextIndex* TkTextMakeByteIndex( + TkTextBTree tree, + const struct TkText* textPtr, + int lineIndex, + int byteIndex, + struct TkTextIndex* indexPtr); +/* 163 */ +EXTERN int TkTextPrintIndex( + const struct TkText* textPtr, + const struct TkTextIndex* indexPtr, + char* string); +/* 164 */ +EXTERN struct TkTextSegment* TkTextSetMark( + struct TkText* textPtr, + const char* name, + struct TkTextIndex* indexPtr); +/* 165 */ +EXTERN int TkTextXviewCmd( + struct TkText* textPtr, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +/* 166 */ +EXTERN void TkTextChanged( + struct TkSharedText* sharedTextPtr, + struct TkText* textPtr, + const struct TkTextIndex* index1Ptr, + const struct TkTextIndex* index2Ptr); +/* 167 */ +EXTERN int TkBTreeNumLines(TkTextBTree tree, const struct TkText* textPtr); +/* 168 */ +EXTERN void TkTextInsertDisplayProc( + struct TkText* textPtr, + struct TkTextDispChunk* chunkPtr, + int x, + int y, + int height, + int baseline, + Display* display, + Drawable dst, + int screenY); +/* 169 */ +EXTERN int TkStateParseProc( + ClientData clientData, + Tcl_Interp* interp, + Tk_Window tkwin, + const char* value, + char* widgRec, + int offset); +/* 170 */ +EXTERN CONST86 char* TkStatePrintProc( + ClientData clientData, + Tk_Window tkwin, + char* widgRec, + int offset, + Tcl_FreeProc** freeProcPtr); +/* 171 */ +EXTERN int TkCanvasDashParseProc( + ClientData clientData, + Tcl_Interp* interp, + Tk_Window tkwin, + const char* value, + char* widgRec, + int offset); +/* 172 */ +EXTERN CONST86 char* TkCanvasDashPrintProc( + ClientData clientData, + Tk_Window tkwin, + char* widgRec, + int offset, + Tcl_FreeProc** freeProcPtr); +/* 173 */ +EXTERN int TkOffsetParseProc( + ClientData clientData, + Tcl_Interp* interp, + Tk_Window tkwin, + const char* value, + char* widgRec, + int offset); +/* 174 */ +EXTERN CONST86 char* TkOffsetPrintProc( + ClientData clientData, + Tk_Window tkwin, + char* widgRec, + int offset, + Tcl_FreeProc** freeProcPtr); +/* 175 */ +EXTERN int TkPixelParseProc( + ClientData clientData, + Tcl_Interp* interp, + Tk_Window tkwin, + const char* value, + char* widgRec, + int offset); +/* 176 */ +EXTERN CONST86 char* TkPixelPrintProc( + ClientData clientData, + Tk_Window tkwin, + char* widgRec, + int offset, + Tcl_FreeProc** freeProcPtr); +/* 177 */ +EXTERN int TkOrientParseProc( + ClientData clientData, + Tcl_Interp* interp, + Tk_Window tkwin, + const char* value, + char* widgRec, + int offset); +/* 178 */ +EXTERN CONST86 char* TkOrientPrintProc( + ClientData clientData, + Tk_Window tkwin, + char* widgRec, + int offset, + Tcl_FreeProc** freeProcPtr); +/* 179 */ +EXTERN int TkSmoothParseProc( + ClientData clientData, + Tcl_Interp* interp, + Tk_Window tkwin, + const char* value, + char* widgRec, + int offset); +/* 180 */ +EXTERN CONST86 char* TkSmoothPrintProc( + ClientData clientData, + Tk_Window tkwin, + char* widgRec, + int offset, + Tcl_FreeProc** freeProcPtr); +/* 181 */ +EXTERN void TkDrawAngledTextLayout( + Display* display, + Drawable drawable, + GC gc, + Tk_TextLayout layout, + int x, + int y, + double angle, + int firstChar, + int lastChar); +/* 182 */ +EXTERN void TkUnderlineAngledTextLayout( + Display* display, + Drawable drawable, + GC gc, + Tk_TextLayout layout, + int x, + int y, + double angle, + int underline); +/* 183 */ +EXTERN int TkIntersectAngledTextLayout( + Tk_TextLayout layout, + int x, + int y, + int width, + int height, + double angle); +/* 184 */ +EXTERN void TkDrawAngledChars( + Display* display, + Drawable drawable, + GC gc, + Tk_Font tkfont, + const char* source, + int numBytes, + double x, + double y, + double angle); + +typedef struct TkIntStubs { + int magic; + void* hooks; + + TkWindow* (*tkAllocWindow)( + TkDisplay* dispPtr, + int screenNum, + TkWindow* parentPtr); /* 0 */ + void (*tkBezierPoints)( + double control[], + int numSteps, + double* coordPtr); /* 1 */ + void (*tkBezierScreenPoints)( + Tk_Canvas canvas, + double control[], + int numSteps, + XPoint* xPointPtr); /* 2 */ + void (*reserved3)(void); + void (*tkBindEventProc)(TkWindow* winPtr, XEvent* eventPtr); /* 4 */ + void (*tkBindFree)(TkMainInfo* mainPtr); /* 5 */ + void (*tkBindInit)(TkMainInfo* mainPtr); /* 6 */ + void (*tkChangeEventWindow)(XEvent* eventPtr, TkWindow* winPtr); /* 7 */ + int (*tkClipInit)(Tcl_Interp* interp, TkDisplay* dispPtr); /* 8 */ + void (*tkComputeAnchor)( + Tk_Anchor anchor, + Tk_Window tkwin, + int padX, + int padY, + int innerWidth, + int innerHeight, + int* xPtr, + int* yPtr); /* 9 */ + void (*reserved10)(void); + void (*reserved11)(void); + TkCursor* (*tkCreateCursorFromData)( + Tk_Window tkwin, + const char* source, + const char* mask, + int width, + int height, + int xHot, + int yHot, + XColor fg, + XColor bg); /* 12 */ + int (*tkCreateFrame)( + ClientData clientData, + Tcl_Interp* interp, + int argc, + const char* const* argv, + int toplevel, + const char* appName); /* 13 */ + Tk_Window (*tkCreateMainWindow)( + Tcl_Interp* interp, + const char* screenName, + const char* baseName); /* 14 */ + Time (*tkCurrentTime)(TkDisplay* dispPtr); /* 15 */ + void (*tkDeleteAllImages)(TkMainInfo* mainPtr); /* 16 */ + void (*tkDoConfigureNotify)(TkWindow* winPtr); /* 17 */ + void (*tkDrawInsetFocusHighlight)( + Tk_Window tkwin, + GC gc, + int width, + Drawable drawable, + int padding); /* 18 */ + void (*tkEventDeadWindow)(TkWindow* winPtr); /* 19 */ + void (*tkFillPolygon)( + Tk_Canvas canvas, + double* coordPtr, + int numPoints, + Display* display, + Drawable drawable, + GC gc, + GC outlineGC); /* 20 */ + int (*tkFindStateNum)( + Tcl_Interp* interp, + const char* option, + const TkStateMap* mapPtr, + const char* strKey); /* 21 */ + CONST86 char* ( + *tkFindStateString)(const TkStateMap* mapPtr, int numKey); /* 22 */ + void (*tkFocusDeadWindow)(TkWindow* winPtr); /* 23 */ + int (*tkFocusFilterEvent)(TkWindow* winPtr, XEvent* eventPtr); /* 24 */ + TkWindow* (*tkFocusKeyEvent)(TkWindow* winPtr, XEvent* eventPtr); /* 25 */ + void (*tkFontPkgInit)(TkMainInfo* mainPtr); /* 26 */ + void (*tkFontPkgFree)(TkMainInfo* mainPtr); /* 27 */ + void (*tkFreeBindingTags)(TkWindow* winPtr); /* 28 */ + void (*tkpFreeCursor)(TkCursor* cursorPtr); /* 29 */ + char* (*tkGetBitmapData)( + Tcl_Interp* interp, + const char* string, + const char* fileName, + int* widthPtr, + int* heightPtr, + int* hotXPtr, + int* hotYPtr); /* 30 */ + void (*tkGetButtPoints)( + double p1[], + double p2[], + double width, + int project, + double m1[], + double m2[]); /* 31 */ + TkCursor* (*tkGetCursorByName)( + Tcl_Interp* interp, + Tk_Window tkwin, + Tk_Uid string); /* 32 */ + const char* (*tkGetDefaultScreenName)( + Tcl_Interp* interp, + const char* screenName); /* 33 */ + TkDisplay* (*tkGetDisplay)(Display* display); /* 34 */ + int (*tkGetDisplayOf)( + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[], + Tk_Window* tkwinPtr); /* 35 */ + TkWindow* (*tkGetFocusWin)(TkWindow* winPtr); /* 36 */ + int (*tkGetInterpNames)(Tcl_Interp* interp, Tk_Window tkwin); /* 37 */ + int (*tkGetMiterPoints)( + double p1[], + double p2[], + double p3[], + double width, + double m1[], + double m2[]); /* 38 */ + void (*tkGetPointerCoords)(Tk_Window tkwin, int* xPtr, int* yPtr); /* 39 */ + void (*tkGetServerInfo)(Tcl_Interp* interp, Tk_Window tkwin); /* 40 */ + void (*tkGrabDeadWindow)(TkWindow* winPtr); /* 41 */ + int (*tkGrabState)(TkWindow* winPtr); /* 42 */ + void (*tkIncludePoint)(Tk_Item* itemPtr, double* pointPtr); /* 43 */ + void (*tkInOutEvents)( + XEvent* eventPtr, + TkWindow* sourcePtr, + TkWindow* destPtr, + int leaveType, + int enterType, + Tcl_QueuePosition position); /* 44 */ + void (*tkInstallFrameMenu)(Tk_Window tkwin); /* 45 */ + CONST86 char* (*tkKeysymToString)(KeySym keysym); /* 46 */ + int (*tkLineToArea)( + double end1Ptr[], + double end2Ptr[], + double rectPtr[]); /* 47 */ + double (*tkLineToPoint)( + double end1Ptr[], + double end2Ptr[], + double pointPtr[]); /* 48 */ + int (*tkMakeBezierCurve)( + Tk_Canvas canvas, + double* pointPtr, + int numPoints, + int numSteps, + XPoint xPoints[], + double dblPoints[]); /* 49 */ + void (*tkMakeBezierPostscript)( + Tcl_Interp* interp, + Tk_Canvas canvas, + double* pointPtr, + int numPoints); /* 50 */ + void (*tkOptionClassChanged)(TkWindow* winPtr); /* 51 */ + void (*tkOptionDeadWindow)(TkWindow* winPtr); /* 52 */ + int (*tkOvalToArea)(double* ovalPtr, double* rectPtr); /* 53 */ + double (*tkOvalToPoint)( + double ovalPtr[], + double width, + int filled, + double pointPtr[]); /* 54 */ + int (*tkpChangeFocus)(TkWindow* winPtr, int force); /* 55 */ + void (*tkpCloseDisplay)(TkDisplay* dispPtr); /* 56 */ + void (*tkpClaimFocus)(TkWindow* topLevelPtr, int force); /* 57 */ + void (*tkpDisplayWarning)(const char* msg, const char* title); /* 58 */ + void (*tkpGetAppName)(Tcl_Interp* interp, Tcl_DString* name); /* 59 */ + TkWindow* (*tkpGetOtherWindow)(TkWindow* winPtr); /* 60 */ + TkWindow* (*tkpGetWrapperWindow)(TkWindow* winPtr); /* 61 */ + int (*tkpInit)(Tcl_Interp* interp); /* 62 */ + void (*tkpInitializeMenuBindings)( + Tcl_Interp* interp, + Tk_BindingTable bindingTable); /* 63 */ + void (*tkpMakeContainer)(Tk_Window tkwin); /* 64 */ + void (*tkpMakeMenuWindow)(Tk_Window tkwin, int transient); /* 65 */ + Window (*tkpMakeWindow)(TkWindow* winPtr, Window parent); /* 66 */ + void (*tkpMenuNotifyToplevelCreate)( + Tcl_Interp* interp, + const char* menuName); /* 67 */ + TkDisplay* (*tkpOpenDisplay)(const char* display_name); /* 68 */ + int (*tkPointerEvent)(XEvent* eventPtr, TkWindow* winPtr); /* 69 */ + int (*tkPolygonToArea)( + double* polyPtr, + int numPoints, + double* rectPtr); /* 70 */ + double (*tkPolygonToPoint)( + double* polyPtr, + int numPoints, + double* pointPtr); /* 71 */ + int (*tkPositionInTree)(TkWindow* winPtr, TkWindow* treePtr); /* 72 */ + void (*tkpRedirectKeyEvent)(TkWindow* winPtr, XEvent* eventPtr); /* 73 */ + void (*tkpSetMainMenubar)( + Tcl_Interp* interp, + Tk_Window tkwin, + const char* menuName); /* 74 */ + int (*tkpUseWindow)( + Tcl_Interp* interp, + Tk_Window tkwin, + const char* string); /* 75 */ + void (*reserved76)(void); + void ( + *tkQueueEventForAllChildren)(TkWindow* winPtr, XEvent* eventPtr); /* 77 */ + int (*tkReadBitmapFile)( + Display* display, + Drawable d, + const char* filename, + unsigned int* width_return, + unsigned int* height_return, + Pixmap* bitmap_return, + int* x_hot_return, + int* y_hot_return); /* 78 */ + int (*tkScrollWindow)( + Tk_Window tkwin, + GC gc, + int x, + int y, + int width, + int height, + int dx, + int dy, + TkRegion damageRgn); /* 79 */ + void (*tkSelDeadWindow)(TkWindow* winPtr); /* 80 */ + void (*tkSelEventProc)(Tk_Window tkwin, XEvent* eventPtr); /* 81 */ + void (*tkSelInit)(Tk_Window tkwin); /* 82 */ + void (*tkSelPropProc)(XEvent* eventPtr); /* 83 */ + void (*reserved84)(void); + void (*tkSetWindowMenuBar)( + Tcl_Interp* interp, + Tk_Window tkwin, + const char* oldMenuName, + const char* menuName); /* 85 */ + KeySym (*tkStringToKeysym)(const char* name); /* 86 */ + int (*tkThickPolyLineToArea)( + double* coordPtr, + int numPoints, + double width, + int capStyle, + int joinStyle, + double* rectPtr); /* 87 */ + void (*tkWmAddToColormapWindows)(TkWindow* winPtr); /* 88 */ + void (*tkWmDeadWindow)(TkWindow* winPtr); /* 89 */ + TkWindow* (*tkWmFocusToplevel)(TkWindow* winPtr); /* 90 */ + void (*tkWmMapWindow)(TkWindow* winPtr); /* 91 */ + void (*tkWmNewWindow)(TkWindow* winPtr); /* 92 */ + void (*tkWmProtocolEventProc)(TkWindow* winPtr, XEvent* evenvPtr); /* 93 */ + void (*tkWmRemoveFromColormapWindows)(TkWindow* winPtr); /* 94 */ + void (*tkWmRestackToplevel)( + TkWindow* winPtr, + int aboveBelow, + TkWindow* otherPtr); /* 95 */ + void (*tkWmSetClass)(TkWindow* winPtr); /* 96 */ + void (*tkWmUnmapWindow)(TkWindow* winPtr); /* 97 */ + Tcl_Obj* (*tkDebugBitmap)(Tk_Window tkwin, const char* name); /* 98 */ + Tcl_Obj* (*tkDebugBorder)(Tk_Window tkwin, const char* name); /* 99 */ + Tcl_Obj* (*tkDebugCursor)(Tk_Window tkwin, const char* name); /* 100 */ + Tcl_Obj* (*tkDebugColor)(Tk_Window tkwin, const char* name); /* 101 */ + Tcl_Obj* (*tkDebugConfig)(Tcl_Interp* interp, Tk_OptionTable table); /* 102 */ + Tcl_Obj* (*tkDebugFont)(Tk_Window tkwin, const char* name); /* 103 */ + int (*tkFindStateNumObj)( + Tcl_Interp* interp, + Tcl_Obj* optionPtr, + const TkStateMap* mapPtr, + Tcl_Obj* keyPtr); /* 104 */ + Tcl_HashTable* (*tkGetBitmapPredefTable)(void); /* 105 */ + TkDisplay* (*tkGetDisplayList)(void); /* 106 */ + TkMainInfo* (*tkGetMainInfoList)(void); /* 107 */ + int (*tkGetWindowFromObj)( + Tcl_Interp* interp, + Tk_Window tkwin, + Tcl_Obj* objPtr, + Tk_Window* windowPtr); /* 108 */ + CONST86 char* (*tkpGetString)( + TkWindow* winPtr, + XEvent* eventPtr, + Tcl_DString* dsPtr); /* 109 */ + void (*tkpGetSubFonts)(Tcl_Interp* interp, Tk_Font tkfont); /* 110 */ + Tcl_Obj* (*tkpGetSystemDefault)( + Tk_Window tkwin, + const char* dbName, + const char* className); /* 111 */ + void (*tkpMenuThreadInit)(void); /* 112 */ + void (*tkClipBox)(TkRegion rgn, XRectangle* rect_return); /* 113 */ + TkRegion (*tkCreateRegion)(void); /* 114 */ + void (*tkDestroyRegion)(TkRegion rgn); /* 115 */ + void (*tkIntersectRegion)( + TkRegion sra, + TkRegion srcb, + TkRegion dr_return); /* 116 */ + int (*tkRectInRegion)( + TkRegion rgn, + int x, + int y, + unsigned int width, + unsigned int height); /* 117 */ + void (*tkSetRegion)(Display* display, GC gc, TkRegion rgn); /* 118 */ + void (*tkUnionRectWithRegion)( + XRectangle* rect, + TkRegion src, + TkRegion dr_return); /* 119 */ + void (*reserved120)(void); +#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */ + void (*reserved121)(void); +#endif /* X11 */ +#if defined(_WIN32) /* WIN */ + void (*reserved121)(void); +#endif /* WIN */ +#ifdef MAC_OSX_TK /* AQUA */ + void (*reserved121)( + void); /* Dummy entry for stubs table backwards compatibility */ + Pixmap ( + *tkpCreateNativeBitmap)(Display* display, const void* source); /* 121 */ +#endif /* AQUA */ +#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */ + void (*reserved122)(void); +#endif /* X11 */ +#if defined(_WIN32) /* WIN */ + void (*reserved122)(void); +#endif /* WIN */ +#ifdef MAC_OSX_TK /* AQUA */ + void (*reserved122)( + void); /* Dummy entry for stubs table backwards compatibility */ + void (*tkpDefineNativeBitmaps)(void); /* 122 */ +#endif /* AQUA */ + void (*reserved123)(void); +#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */ + void (*reserved124)(void); +#endif /* X11 */ +#if defined(_WIN32) /* WIN */ + void (*reserved124)(void); +#endif /* WIN */ +#ifdef MAC_OSX_TK /* AQUA */ + void (*reserved124)( + void); /* Dummy entry for stubs table backwards compatibility */ + Pixmap (*tkpGetNativeAppBitmap)( + Display* display, + const char* name, + int* width, + int* height); /* 124 */ +#endif /* AQUA */ + void (*reserved125)(void); + void (*reserved126)(void); + void (*reserved127)(void); + void (*reserved128)(void); + void (*reserved129)(void); + void (*reserved130)(void); + void (*reserved131)(void); + void (*reserved132)(void); + void (*reserved133)(void); + void (*reserved134)(void); + void (*tkpDrawHighlightBorder)( + Tk_Window tkwin, + GC fgGC, + GC bgGC, + int highlightWidth, + Drawable drawable); /* 135 */ + void (*tkSetFocusWin)(TkWindow* winPtr, int force); /* 136 */ + void (*tkpSetKeycodeAndState)( + Tk_Window tkwin, + KeySym keySym, + XEvent* eventPtr); /* 137 */ + KeySym (*tkpGetKeySym)(TkDisplay* dispPtr, XEvent* eventPtr); /* 138 */ + void (*tkpInitKeymapInfo)(TkDisplay* dispPtr); /* 139 */ + TkRegion (*tkPhotoGetValidRegion)(Tk_PhotoHandle handle); /* 140 */ + TkWindow** (*tkWmStackorderToplevel)(TkWindow* parentPtr); /* 141 */ + void (*tkFocusFree)(TkMainInfo* mainPtr); /* 142 */ + void (*tkClipCleanup)(TkDisplay* dispPtr); /* 143 */ + void (*tkGCCleanup)(TkDisplay* dispPtr); /* 144 */ + void (*tkSubtractRegion)( + TkRegion sra, + TkRegion srcb, + TkRegion dr_return); /* 145 */ + void (*tkStylePkgInit)(TkMainInfo* mainPtr); /* 146 */ + void (*tkStylePkgFree)(TkMainInfo* mainPtr); /* 147 */ + Tk_Window (*tkToplevelWindowForCommand)( + Tcl_Interp* interp, + const char* cmdName); /* 148 */ + const Tk_OptionSpec* ( + *tkGetOptionSpec)(const char* name, Tk_OptionTable optionTable); /* 149 */ + int (*tkMakeRawCurve)( + Tk_Canvas canvas, + double* pointPtr, + int numPoints, + int numSteps, + XPoint xPoints[], + double dblPoints[]); /* 150 */ + void (*tkMakeRawCurvePostscript)( + Tcl_Interp* interp, + Tk_Canvas canvas, + double* pointPtr, + int numPoints); /* 151 */ + void (*tkpDrawFrame)( + Tk_Window tkwin, + Tk_3DBorder border, + int highlightWidth, + int borderWidth, + int relief); /* 152 */ + void (*tkCreateThreadExitHandler)( + Tcl_ExitProc* proc, + ClientData clientData); /* 153 */ + void (*tkDeleteThreadExitHandler)( + Tcl_ExitProc* proc, + ClientData clientData); /* 154 */ + void (*reserved155)(void); + int (*tkpTestembedCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 156 */ + int (*tkpTesttextCmd)( + ClientData dummy, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 157 */ + int (*tkSelGetSelection)( + Tcl_Interp* interp, + Tk_Window tkwin, + Atom selection, + Atom target, + Tk_GetSelProc* proc, + ClientData clientData); /* 158 */ + int (*tkTextGetIndex)( + Tcl_Interp* interp, + struct TkText* textPtr, + const char* string, + struct TkTextIndex* indexPtr); /* 159 */ + int (*tkTextIndexBackBytes)( + const struct TkText* textPtr, + const struct TkTextIndex* srcPtr, + int count, + struct TkTextIndex* dstPtr); /* 160 */ + int (*tkTextIndexForwBytes)( + const struct TkText* textPtr, + const struct TkTextIndex* srcPtr, + int count, + struct TkTextIndex* dstPtr); /* 161 */ + struct TkTextIndex* (*tkTextMakeByteIndex)( + TkTextBTree tree, + const struct TkText* textPtr, + int lineIndex, + int byteIndex, + struct TkTextIndex* indexPtr); /* 162 */ + int (*tkTextPrintIndex)( + const struct TkText* textPtr, + const struct TkTextIndex* indexPtr, + char* string); /* 163 */ + struct TkTextSegment* (*tkTextSetMark)( + struct TkText* textPtr, + const char* name, + struct TkTextIndex* indexPtr); /* 164 */ + int (*tkTextXviewCmd)( + struct TkText* textPtr, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 165 */ + void (*tkTextChanged)( + struct TkSharedText* sharedTextPtr, + struct TkText* textPtr, + const struct TkTextIndex* index1Ptr, + const struct TkTextIndex* index2Ptr); /* 166 */ + int (*tkBTreeNumLines)( + TkTextBTree tree, + const struct TkText* textPtr); /* 167 */ + void (*tkTextInsertDisplayProc)( + struct TkText* textPtr, + struct TkTextDispChunk* chunkPtr, + int x, + int y, + int height, + int baseline, + Display* display, + Drawable dst, + int screenY); /* 168 */ + int (*tkStateParseProc)( + ClientData clientData, + Tcl_Interp* interp, + Tk_Window tkwin, + const char* value, + char* widgRec, + int offset); /* 169 */ + CONST86 char* (*tkStatePrintProc)( + ClientData clientData, + Tk_Window tkwin, + char* widgRec, + int offset, + Tcl_FreeProc** freeProcPtr); /* 170 */ + int (*tkCanvasDashParseProc)( + ClientData clientData, + Tcl_Interp* interp, + Tk_Window tkwin, + const char* value, + char* widgRec, + int offset); /* 171 */ + CONST86 char* (*tkCanvasDashPrintProc)( + ClientData clientData, + Tk_Window tkwin, + char* widgRec, + int offset, + Tcl_FreeProc** freeProcPtr); /* 172 */ + int (*tkOffsetParseProc)( + ClientData clientData, + Tcl_Interp* interp, + Tk_Window tkwin, + const char* value, + char* widgRec, + int offset); /* 173 */ + CONST86 char* (*tkOffsetPrintProc)( + ClientData clientData, + Tk_Window tkwin, + char* widgRec, + int offset, + Tcl_FreeProc** freeProcPtr); /* 174 */ + int (*tkPixelParseProc)( + ClientData clientData, + Tcl_Interp* interp, + Tk_Window tkwin, + const char* value, + char* widgRec, + int offset); /* 175 */ + CONST86 char* (*tkPixelPrintProc)( + ClientData clientData, + Tk_Window tkwin, + char* widgRec, + int offset, + Tcl_FreeProc** freeProcPtr); /* 176 */ + int (*tkOrientParseProc)( + ClientData clientData, + Tcl_Interp* interp, + Tk_Window tkwin, + const char* value, + char* widgRec, + int offset); /* 177 */ + CONST86 char* (*tkOrientPrintProc)( + ClientData clientData, + Tk_Window tkwin, + char* widgRec, + int offset, + Tcl_FreeProc** freeProcPtr); /* 178 */ + int (*tkSmoothParseProc)( + ClientData clientData, + Tcl_Interp* interp, + Tk_Window tkwin, + const char* value, + char* widgRec, + int offset); /* 179 */ + CONST86 char* (*tkSmoothPrintProc)( + ClientData clientData, + Tk_Window tkwin, + char* widgRec, + int offset, + Tcl_FreeProc** freeProcPtr); /* 180 */ + void (*tkDrawAngledTextLayout)( + Display* display, + Drawable drawable, + GC gc, + Tk_TextLayout layout, + int x, + int y, + double angle, + int firstChar, + int lastChar); /* 181 */ + void (*tkUnderlineAngledTextLayout)( + Display* display, + Drawable drawable, + GC gc, + Tk_TextLayout layout, + int x, + int y, + double angle, + int underline); /* 182 */ + int (*tkIntersectAngledTextLayout)( + Tk_TextLayout layout, + int x, + int y, + int width, + int height, + double angle); /* 183 */ + void (*tkDrawAngledChars)( + Display* display, + Drawable drawable, + GC gc, + Tk_Font tkfont, + const char* source, + int numBytes, + double x, + double y, + double angle); /* 184 */ +} TkIntStubs; + +extern const TkIntStubs* tkIntStubsPtr; + +#ifdef __cplusplus +} +#endif + +#if defined(USE_TK_STUBS) + +/* + * Inline function declarations: + */ + +#define TkAllocWindow (tkIntStubsPtr->tkAllocWindow) /* 0 */ +#define TkBezierPoints (tkIntStubsPtr->tkBezierPoints) /* 1 */ +#define TkBezierScreenPoints (tkIntStubsPtr->tkBezierScreenPoints) /* 2 */ +/* Slot 3 is reserved */ +#define TkBindEventProc (tkIntStubsPtr->tkBindEventProc) /* 4 */ +#define TkBindFree (tkIntStubsPtr->tkBindFree) /* 5 */ +#define TkBindInit (tkIntStubsPtr->tkBindInit) /* 6 */ +#define TkChangeEventWindow (tkIntStubsPtr->tkChangeEventWindow) /* 7 */ +#define TkClipInit (tkIntStubsPtr->tkClipInit) /* 8 */ +#define TkComputeAnchor (tkIntStubsPtr->tkComputeAnchor) /* 9 */ +/* Slot 10 is reserved */ +/* Slot 11 is reserved */ +#define TkCreateCursorFromData (tkIntStubsPtr->tkCreateCursorFromData) /* 12 \ + */ +#define TkCreateFrame (tkIntStubsPtr->tkCreateFrame) /* 13 */ +#define TkCreateMainWindow (tkIntStubsPtr->tkCreateMainWindow) /* 14 */ +#define TkCurrentTime (tkIntStubsPtr->tkCurrentTime) /* 15 */ +#define TkDeleteAllImages (tkIntStubsPtr->tkDeleteAllImages) /* 16 */ +#define TkDoConfigureNotify (tkIntStubsPtr->tkDoConfigureNotify) /* 17 */ +#define TkDrawInsetFocusHighlight \ + (tkIntStubsPtr->tkDrawInsetFocusHighlight) /* 18 */ +#define TkEventDeadWindow (tkIntStubsPtr->tkEventDeadWindow) /* 19 */ +#define TkFillPolygon (tkIntStubsPtr->tkFillPolygon) /* 20 */ +#define TkFindStateNum (tkIntStubsPtr->tkFindStateNum) /* 21 */ +#define TkFindStateString (tkIntStubsPtr->tkFindStateString) /* 22 */ +#define TkFocusDeadWindow (tkIntStubsPtr->tkFocusDeadWindow) /* 23 */ +#define TkFocusFilterEvent (tkIntStubsPtr->tkFocusFilterEvent) /* 24 */ +#define TkFocusKeyEvent (tkIntStubsPtr->tkFocusKeyEvent) /* 25 */ +#define TkFontPkgInit (tkIntStubsPtr->tkFontPkgInit) /* 26 */ +#define TkFontPkgFree (tkIntStubsPtr->tkFontPkgFree) /* 27 */ +#define TkFreeBindingTags (tkIntStubsPtr->tkFreeBindingTags) /* 28 */ +#define TkpFreeCursor (tkIntStubsPtr->tkpFreeCursor) /* 29 */ +#define TkGetBitmapData (tkIntStubsPtr->tkGetBitmapData) /* 30 */ +#define TkGetButtPoints (tkIntStubsPtr->tkGetButtPoints) /* 31 */ +#define TkGetCursorByName (tkIntStubsPtr->tkGetCursorByName) /* 32 */ +#define TkGetDefaultScreenName (tkIntStubsPtr->tkGetDefaultScreenName) /* 33 \ + */ +#define TkGetDisplay (tkIntStubsPtr->tkGetDisplay) /* 34 */ +#define TkGetDisplayOf (tkIntStubsPtr->tkGetDisplayOf) /* 35 */ +#define TkGetFocusWin (tkIntStubsPtr->tkGetFocusWin) /* 36 */ +#define TkGetInterpNames (tkIntStubsPtr->tkGetInterpNames) /* 37 */ +#define TkGetMiterPoints (tkIntStubsPtr->tkGetMiterPoints) /* 38 */ +#define TkGetPointerCoords (tkIntStubsPtr->tkGetPointerCoords) /* 39 */ +#define TkGetServerInfo (tkIntStubsPtr->tkGetServerInfo) /* 40 */ +#define TkGrabDeadWindow (tkIntStubsPtr->tkGrabDeadWindow) /* 41 */ +#define TkGrabState (tkIntStubsPtr->tkGrabState) /* 42 */ +#define TkIncludePoint (tkIntStubsPtr->tkIncludePoint) /* 43 */ +#define TkInOutEvents (tkIntStubsPtr->tkInOutEvents) /* 44 */ +#define TkInstallFrameMenu (tkIntStubsPtr->tkInstallFrameMenu) /* 45 */ +#define TkKeysymToString (tkIntStubsPtr->tkKeysymToString) /* 46 */ +#define TkLineToArea (tkIntStubsPtr->tkLineToArea) /* 47 */ +#define TkLineToPoint (tkIntStubsPtr->tkLineToPoint) /* 48 */ +#define TkMakeBezierCurve (tkIntStubsPtr->tkMakeBezierCurve) /* 49 */ +#define TkMakeBezierPostscript (tkIntStubsPtr->tkMakeBezierPostscript) /* 50 \ + */ +#define TkOptionClassChanged (tkIntStubsPtr->tkOptionClassChanged) /* 51 */ +#define TkOptionDeadWindow (tkIntStubsPtr->tkOptionDeadWindow) /* 52 */ +#define TkOvalToArea (tkIntStubsPtr->tkOvalToArea) /* 53 */ +#define TkOvalToPoint (tkIntStubsPtr->tkOvalToPoint) /* 54 */ +#define TkpChangeFocus (tkIntStubsPtr->tkpChangeFocus) /* 55 */ +#define TkpCloseDisplay (tkIntStubsPtr->tkpCloseDisplay) /* 56 */ +#define TkpClaimFocus (tkIntStubsPtr->tkpClaimFocus) /* 57 */ +#define TkpDisplayWarning (tkIntStubsPtr->tkpDisplayWarning) /* 58 */ +#define TkpGetAppName (tkIntStubsPtr->tkpGetAppName) /* 59 */ +#define TkpGetOtherWindow (tkIntStubsPtr->tkpGetOtherWindow) /* 60 */ +#define TkpGetWrapperWindow (tkIntStubsPtr->tkpGetWrapperWindow) /* 61 */ +#define TkpInit (tkIntStubsPtr->tkpInit) /* 62 */ +#define TkpInitializeMenuBindings \ + (tkIntStubsPtr->tkpInitializeMenuBindings) /* 63 */ +#define TkpMakeContainer (tkIntStubsPtr->tkpMakeContainer) /* 64 */ +#define TkpMakeMenuWindow (tkIntStubsPtr->tkpMakeMenuWindow) /* 65 */ +#define TkpMakeWindow (tkIntStubsPtr->tkpMakeWindow) /* 66 */ +#define TkpMenuNotifyToplevelCreate \ + (tkIntStubsPtr->tkpMenuNotifyToplevelCreate) /* 67 */ +#define TkpOpenDisplay (tkIntStubsPtr->tkpOpenDisplay) /* 68 */ +#define TkPointerEvent (tkIntStubsPtr->tkPointerEvent) /* 69 */ +#define TkPolygonToArea (tkIntStubsPtr->tkPolygonToArea) /* 70 */ +#define TkPolygonToPoint (tkIntStubsPtr->tkPolygonToPoint) /* 71 */ +#define TkPositionInTree (tkIntStubsPtr->tkPositionInTree) /* 72 */ +#define TkpRedirectKeyEvent (tkIntStubsPtr->tkpRedirectKeyEvent) /* 73 */ +#define TkpSetMainMenubar (tkIntStubsPtr->tkpSetMainMenubar) /* 74 */ +#define TkpUseWindow (tkIntStubsPtr->tkpUseWindow) /* 75 */ +/* Slot 76 is reserved */ +#define TkQueueEventForAllChildren \ + (tkIntStubsPtr->tkQueueEventForAllChildren) /* 77 */ +#define TkReadBitmapFile (tkIntStubsPtr->tkReadBitmapFile) /* 78 */ +#define TkScrollWindow (tkIntStubsPtr->tkScrollWindow) /* 79 */ +#define TkSelDeadWindow (tkIntStubsPtr->tkSelDeadWindow) /* 80 */ +#define TkSelEventProc (tkIntStubsPtr->tkSelEventProc) /* 81 */ +#define TkSelInit (tkIntStubsPtr->tkSelInit) /* 82 */ +#define TkSelPropProc (tkIntStubsPtr->tkSelPropProc) /* 83 */ +/* Slot 84 is reserved */ +#define TkSetWindowMenuBar (tkIntStubsPtr->tkSetWindowMenuBar) /* 85 */ +#define TkStringToKeysym (tkIntStubsPtr->tkStringToKeysym) /* 86 */ +#define TkThickPolyLineToArea (tkIntStubsPtr->tkThickPolyLineToArea) /* 87 */ +#define TkWmAddToColormapWindows \ + (tkIntStubsPtr->tkWmAddToColormapWindows) /* 88 */ +#define TkWmDeadWindow (tkIntStubsPtr->tkWmDeadWindow) /* 89 */ +#define TkWmFocusToplevel (tkIntStubsPtr->tkWmFocusToplevel) /* 90 */ +#define TkWmMapWindow (tkIntStubsPtr->tkWmMapWindow) /* 91 */ +#define TkWmNewWindow (tkIntStubsPtr->tkWmNewWindow) /* 92 */ +#define TkWmProtocolEventProc (tkIntStubsPtr->tkWmProtocolEventProc) /* 93 */ +#define TkWmRemoveFromColormapWindows \ + (tkIntStubsPtr->tkWmRemoveFromColormapWindows) /* 94 */ +#define TkWmRestackToplevel (tkIntStubsPtr->tkWmRestackToplevel) /* 95 */ +#define TkWmSetClass (tkIntStubsPtr->tkWmSetClass) /* 96 */ +#define TkWmUnmapWindow (tkIntStubsPtr->tkWmUnmapWindow) /* 97 */ +#define TkDebugBitmap (tkIntStubsPtr->tkDebugBitmap) /* 98 */ +#define TkDebugBorder (tkIntStubsPtr->tkDebugBorder) /* 99 */ +#define TkDebugCursor (tkIntStubsPtr->tkDebugCursor) /* 100 */ +#define TkDebugColor (tkIntStubsPtr->tkDebugColor) /* 101 */ +#define TkDebugConfig (tkIntStubsPtr->tkDebugConfig) /* 102 */ +#define TkDebugFont (tkIntStubsPtr->tkDebugFont) /* 103 */ +#define TkFindStateNumObj (tkIntStubsPtr->tkFindStateNumObj) /* 104 */ +#define TkGetBitmapPredefTable (tkIntStubsPtr->tkGetBitmapPredefTable) /* 105 \ + */ +#define TkGetDisplayList (tkIntStubsPtr->tkGetDisplayList) /* 106 */ +#define TkGetMainInfoList (tkIntStubsPtr->tkGetMainInfoList) /* 107 */ +#define TkGetWindowFromObj (tkIntStubsPtr->tkGetWindowFromObj) /* 108 */ +#define TkpGetString (tkIntStubsPtr->tkpGetString) /* 109 */ +#define TkpGetSubFonts (tkIntStubsPtr->tkpGetSubFonts) /* 110 */ +#define TkpGetSystemDefault (tkIntStubsPtr->tkpGetSystemDefault) /* 111 */ +#define TkpMenuThreadInit (tkIntStubsPtr->tkpMenuThreadInit) /* 112 */ +#define TkClipBox (tkIntStubsPtr->tkClipBox) /* 113 */ +#define TkCreateRegion (tkIntStubsPtr->tkCreateRegion) /* 114 */ +#define TkDestroyRegion (tkIntStubsPtr->tkDestroyRegion) /* 115 */ +#define TkIntersectRegion (tkIntStubsPtr->tkIntersectRegion) /* 116 */ +#define TkRectInRegion (tkIntStubsPtr->tkRectInRegion) /* 117 */ +#define TkSetRegion (tkIntStubsPtr->tkSetRegion) /* 118 */ +#define TkUnionRectWithRegion (tkIntStubsPtr->tkUnionRectWithRegion) /* 119 */ +/* Slot 120 is reserved */ +#ifdef MAC_OSX_TK /* AQUA */ +#define TkpCreateNativeBitmap (tkIntStubsPtr->tkpCreateNativeBitmap) /* 121 */ +#endif /* AQUA */ +#ifdef MAC_OSX_TK /* AQUA */ +#define TkpDefineNativeBitmaps (tkIntStubsPtr->tkpDefineNativeBitmaps) /* 122 \ + */ +#endif /* AQUA */ +/* Slot 123 is reserved */ +#ifdef MAC_OSX_TK /* AQUA */ +#define TkpGetNativeAppBitmap (tkIntStubsPtr->tkpGetNativeAppBitmap) /* 124 */ +#endif /* AQUA */ +/* Slot 125 is reserved */ +/* Slot 126 is reserved */ +/* Slot 127 is reserved */ +/* Slot 128 is reserved */ +/* Slot 129 is reserved */ +/* Slot 130 is reserved */ +/* Slot 131 is reserved */ +/* Slot 132 is reserved */ +/* Slot 133 is reserved */ +/* Slot 134 is reserved */ +#define TkpDrawHighlightBorder (tkIntStubsPtr->tkpDrawHighlightBorder) /* 135 \ + */ +#define TkSetFocusWin (tkIntStubsPtr->tkSetFocusWin) /* 136 */ +#define TkpSetKeycodeAndState (tkIntStubsPtr->tkpSetKeycodeAndState) /* 137 */ +#define TkpGetKeySym (tkIntStubsPtr->tkpGetKeySym) /* 138 */ +#define TkpInitKeymapInfo (tkIntStubsPtr->tkpInitKeymapInfo) /* 139 */ +#define TkPhotoGetValidRegion (tkIntStubsPtr->tkPhotoGetValidRegion) /* 140 */ +#define TkWmStackorderToplevel (tkIntStubsPtr->tkWmStackorderToplevel) /* 141 \ + */ +#define TkFocusFree (tkIntStubsPtr->tkFocusFree) /* 142 */ +#define TkClipCleanup (tkIntStubsPtr->tkClipCleanup) /* 143 */ +#define TkGCCleanup (tkIntStubsPtr->tkGCCleanup) /* 144 */ +#define TkSubtractRegion (tkIntStubsPtr->tkSubtractRegion) /* 145 */ +#define TkStylePkgInit (tkIntStubsPtr->tkStylePkgInit) /* 146 */ +#define TkStylePkgFree (tkIntStubsPtr->tkStylePkgFree) /* 147 */ +#define TkToplevelWindowForCommand \ + (tkIntStubsPtr->tkToplevelWindowForCommand) /* 148 */ +#define TkGetOptionSpec (tkIntStubsPtr->tkGetOptionSpec) /* 149 */ +#define TkMakeRawCurve (tkIntStubsPtr->tkMakeRawCurve) /* 150 */ +#define TkMakeRawCurvePostscript \ + (tkIntStubsPtr->tkMakeRawCurvePostscript) /* 151 */ +#define TkpDrawFrame (tkIntStubsPtr->tkpDrawFrame) /* 152 */ +#define TkCreateThreadExitHandler \ + (tkIntStubsPtr->tkCreateThreadExitHandler) /* 153 */ +#define TkDeleteThreadExitHandler \ + (tkIntStubsPtr->tkDeleteThreadExitHandler) /* 154 */ +/* Slot 155 is reserved */ +#define TkpTestembedCmd (tkIntStubsPtr->tkpTestembedCmd) /* 156 */ +#define TkpTesttextCmd (tkIntStubsPtr->tkpTesttextCmd) /* 157 */ +#define TkSelGetSelection (tkIntStubsPtr->tkSelGetSelection) /* 158 */ +#define TkTextGetIndex (tkIntStubsPtr->tkTextGetIndex) /* 159 */ +#define TkTextIndexBackBytes (tkIntStubsPtr->tkTextIndexBackBytes) /* 160 */ +#define TkTextIndexForwBytes (tkIntStubsPtr->tkTextIndexForwBytes) /* 161 */ +#define TkTextMakeByteIndex (tkIntStubsPtr->tkTextMakeByteIndex) /* 162 */ +#define TkTextPrintIndex (tkIntStubsPtr->tkTextPrintIndex) /* 163 */ +#define TkTextSetMark (tkIntStubsPtr->tkTextSetMark) /* 164 */ +#define TkTextXviewCmd (tkIntStubsPtr->tkTextXviewCmd) /* 165 */ +#define TkTextChanged (tkIntStubsPtr->tkTextChanged) /* 166 */ +#define TkBTreeNumLines (tkIntStubsPtr->tkBTreeNumLines) /* 167 */ +#define TkTextInsertDisplayProc \ + (tkIntStubsPtr->tkTextInsertDisplayProc) /* 168 */ +#define TkStateParseProc (tkIntStubsPtr->tkStateParseProc) /* 169 */ +#define TkStatePrintProc (tkIntStubsPtr->tkStatePrintProc) /* 170 */ +#define TkCanvasDashParseProc (tkIntStubsPtr->tkCanvasDashParseProc) /* 171 */ +#define TkCanvasDashPrintProc (tkIntStubsPtr->tkCanvasDashPrintProc) /* 172 */ +#define TkOffsetParseProc (tkIntStubsPtr->tkOffsetParseProc) /* 173 */ +#define TkOffsetPrintProc (tkIntStubsPtr->tkOffsetPrintProc) /* 174 */ +#define TkPixelParseProc (tkIntStubsPtr->tkPixelParseProc) /* 175 */ +#define TkPixelPrintProc (tkIntStubsPtr->tkPixelPrintProc) /* 176 */ +#define TkOrientParseProc (tkIntStubsPtr->tkOrientParseProc) /* 177 */ +#define TkOrientPrintProc (tkIntStubsPtr->tkOrientPrintProc) /* 178 */ +#define TkSmoothParseProc (tkIntStubsPtr->tkSmoothParseProc) /* 179 */ +#define TkSmoothPrintProc (tkIntStubsPtr->tkSmoothPrintProc) /* 180 */ +#define TkDrawAngledTextLayout (tkIntStubsPtr->tkDrawAngledTextLayout) /* 181 \ + */ +#define TkUnderlineAngledTextLayout \ + (tkIntStubsPtr->tkUnderlineAngledTextLayout) /* 182 */ +#define TkIntersectAngledTextLayout \ + (tkIntStubsPtr->tkIntersectAngledTextLayout) /* 183 */ +#define TkDrawAngledChars (tkIntStubsPtr->tkDrawAngledChars) /* 184 */ + +#endif /* defined(USE_TK_STUBS) */ + +/* !END!: Do not edit above this line. */ + +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLIMPORT + +/* + * On X11, these macros are just wrappers for the equivalent X Region calls. + */ +#if !(defined(_WIN32) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ + +#undef TkClipBox +#undef TkCreateRegion +#undef TkDestroyRegion +#undef TkIntersectRegion +#undef TkRectInRegion +#undef TkSetRegion +#undef TkSubtractRegion +#undef TkUnionRectWithRegion + +#define TkClipBox(rgn, rect) XClipBox((Region)rgn, rect) +#define TkCreateRegion() (TkRegion) XCreateRegion() +#define TkDestroyRegion(rgn) XDestroyRegion((Region)rgn) +#define TkIntersectRegion(a, b, r) \ + XIntersectRegion((Region)a, (Region)b, (Region)r) +#define TkRectInRegion(r, x, y, w, h) XRectInRegion((Region)r, x, y, w, h) +#define TkSetRegion(d, gc, rgn) XSetRegion(d, gc, (Region)rgn) +#define TkSubtractRegion(a, b, r) \ + XSubtractRegion((Region)a, (Region)b, (Region)r) +#define TkUnionRectWithRegion(rect, src, ret) \ + XUnionRectWithRegion(rect, (Region)src, (Region)ret) + +#endif /* UNIX */ + +#endif /* _TKINTDECLS */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkIntPlatDecls.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkIntPlatDecls.h new file mode 100644 index 0000000..1aac845 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkIntPlatDecls.h @@ -0,0 +1,667 @@ +/* + * tkIntPlatDecls.h -- + * + * This file contains the declarations for all platform dependent + * unsupported functions that are exported by the Tk library. These + * interfaces are not guaranteed to remain the same between + * versions. Use at your own risk. + * + * Copyright (c) 1998-1999 by Scriptics Corporation. + * All rights reserved. + */ + +#ifndef _TKINTPLATDECLS +#define _TKINTPLATDECLS + +#ifdef BUILD_tk +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLEXPORT +#endif + +/* + * WARNING: This file is automatically generated by the tools/genStubs.tcl + * script. Any modifications to the function declarations below should be made + * in the generic/tkInt.decls script. + */ + +/* !BEGIN!: Do not edit below this line. */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Exported function declarations: + */ + +#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ +/* 0 */ +EXTERN char* TkAlignImageData(XImage* image, int alignment, int bitOrder); +/* Slot 1 is reserved */ +/* 2 */ +EXTERN void TkGenerateActivateEvents(TkWindow* winPtr, int active); +/* 3 */ +EXTERN unsigned long TkpGetMS(void); +/* 4 */ +EXTERN void TkPointerDeadWindow(TkWindow* winPtr); +/* 5 */ +EXTERN void TkpPrintWindowId(char* buf, Window window); +/* 6 */ +EXTERN int +TkpScanWindowId(Tcl_Interp* interp, const char* string, Window* idPtr); +/* 7 */ +EXTERN void TkpSetCapture(TkWindow* winPtr); +/* 8 */ +EXTERN void TkpSetCursor(TkpCursor cursor); +/* 9 */ +EXTERN int TkpWmSetState(TkWindow* winPtr, int state); +/* 10 */ +EXTERN void TkSetPixmapColormap(Pixmap pixmap, Colormap colormap); +/* 11 */ +EXTERN void TkWinCancelMouseTimer(void); +/* 12 */ +EXTERN void TkWinClipboardRender(TkDisplay* dispPtr, UINT format); +/* 13 */ +EXTERN LRESULT +TkWinEmbeddedEventProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); +/* 14 */ +EXTERN void +TkWinFillRect(HDC dc, int x, int y, int width, int height, int pixel); +/* 15 */ +EXTERN COLORREF +TkWinGetBorderPixels(Tk_Window tkwin, Tk_3DBorder border, int which); +/* 16 */ +EXTERN HDC +TkWinGetDrawableDC(Display* display, Drawable d, TkWinDCState* state); +/* 17 */ +EXTERN int TkWinGetModifierState(void); +/* 18 */ +EXTERN HPALETTE TkWinGetSystemPalette(void); +/* 19 */ +EXTERN HWND TkWinGetWrapperWindow(Tk_Window tkwin); +/* 20 */ +EXTERN int TkWinHandleMenuEvent( + HWND* phwnd, + UINT* pMessage, + WPARAM* pwParam, + LPARAM* plParam, + LRESULT* plResult); +/* 21 */ +EXTERN int TkWinIndexOfColor(XColor* colorPtr); +/* 22 */ +EXTERN void TkWinReleaseDrawableDC(Drawable d, HDC hdc, TkWinDCState* state); +/* 23 */ +EXTERN LRESULT TkWinResendEvent(WNDPROC wndproc, HWND hwnd, XEvent* eventPtr); +/* 24 */ +EXTERN HPALETTE TkWinSelectPalette(HDC dc, Colormap colormap); +/* 25 */ +EXTERN void TkWinSetMenu(Tk_Window tkwin, HMENU hMenu); +/* 26 */ +EXTERN void TkWinSetWindowPos(HWND hwnd, HWND siblingHwnd, int pos); +/* 27 */ +EXTERN void TkWinWmCleanup(HINSTANCE hInstance); +/* 28 */ +EXTERN void TkWinXCleanup(ClientData clientData); +/* 29 */ +EXTERN void TkWinXInit(HINSTANCE hInstance); +/* 30 */ +EXTERN void TkWinSetForegroundWindow(TkWindow* winPtr); +/* 31 */ +EXTERN void TkWinDialogDebug(int debug); +/* 32 */ +EXTERN Tcl_Obj* TkWinGetMenuSystemDefault( + Tk_Window tkwin, + const char* dbName, + const char* className); +/* 33 */ +EXTERN int TkWinGetPlatformId(void); +/* 34 */ +EXTERN void TkWinSetHINSTANCE(HINSTANCE hInstance); +/* 35 */ +EXTERN int TkWinGetPlatformTheme(void); +/* 36 */ +EXTERN LRESULT __stdcall TkWinChildProc( + HWND hwnd, + UINT message, + WPARAM wParam, + LPARAM lParam); +/* 37 */ +EXTERN void TkCreateXEventSource(void); +/* 38 */ +EXTERN int TkpCmapStressed(Tk_Window tkwin, Colormap colormap); +/* 39 */ +EXTERN void TkpSync(Display* display); +/* 40 */ +EXTERN Window TkUnixContainerId(TkWindow* winPtr); +/* 41 */ +EXTERN int TkUnixDoOneXEvent(Tcl_Time* timePtr); +/* 42 */ +EXTERN void TkUnixSetMenubar(Tk_Window tkwin, Tk_Window menubar); +/* 43 */ +EXTERN void TkWmCleanup(TkDisplay* dispPtr); +/* 44 */ +EXTERN void TkSendCleanup(TkDisplay* dispPtr); +/* 45 */ +EXTERN int TkpTestsendCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +#endif /* WIN */ +#ifdef MAC_OSX_TK /* AQUA */ +/* 0 */ +EXTERN void TkGenerateActivateEvents(TkWindow* winPtr, int active); +/* Slot 1 is reserved */ +/* Slot 2 is reserved */ +/* 3 */ +EXTERN void TkPointerDeadWindow(TkWindow* winPtr); +/* 4 */ +EXTERN void TkpSetCapture(TkWindow* winPtr); +/* 5 */ +EXTERN void TkpSetCursor(TkpCursor cursor); +/* 6 */ +EXTERN void TkpWmSetState(TkWindow* winPtr, int state); +/* 7 */ +EXTERN void TkAboutDlg(void); +/* 8 */ +EXTERN unsigned int TkMacOSXButtonKeyState(void); +/* 9 */ +EXTERN void TkMacOSXClearMenubarActive(void); +/* 10 */ +EXTERN int TkMacOSXDispatchMenuEvent(int menuID, int index); +/* 11 */ +EXTERN void TkMacOSXInstallCursor(int resizeOverride); +/* 12 */ +EXTERN void TkMacOSXHandleTearoffMenu(void); +/* Slot 13 is reserved */ +/* 14 */ +EXTERN int TkMacOSXDoHLEvent(void* theEvent); +/* Slot 15 is reserved */ +/* 16 */ +EXTERN Window TkMacOSXGetXWindow(void* macWinPtr); +/* 17 */ +EXTERN int TkMacOSXGrowToplevel(void* whichWindow, XPoint start); +/* 18 */ +EXTERN void TkMacOSXHandleMenuSelect( + short theMenu, + unsigned short theItem, + int optionKeyPressed); +/* Slot 19 is reserved */ +/* Slot 20 is reserved */ +/* 21 */ +EXTERN void TkMacOSXInvalidateWindow(MacDrawable* macWin, int flag); +/* 22 */ +EXTERN int TkMacOSXIsCharacterMissing(Tk_Font tkfont, unsigned int searchChar); +/* 23 */ +EXTERN void TkMacOSXMakeRealWindowExist(TkWindow* winPtr); +/* 24 */ +EXTERN void* TkMacOSXMakeStippleMap(Drawable d1, Drawable d2); +/* 25 */ +EXTERN void TkMacOSXMenuClick(void); +/* 26 */ +EXTERN void TkMacOSXRegisterOffScreenWindow(Window window, void* portPtr); +/* 27 */ +EXTERN int TkMacOSXResizable(TkWindow* winPtr); +/* 28 */ +EXTERN void TkMacOSXSetHelpMenuItemCount(void); +/* 29 */ +EXTERN void TkMacOSXSetScrollbarGrow(TkWindow* winPtr, int flag); +/* 30 */ +EXTERN void TkMacOSXSetUpClippingRgn(Drawable drawable); +/* 31 */ +EXTERN void TkMacOSXSetUpGraphicsPort(GC gc, void* destPort); +/* 32 */ +EXTERN void TkMacOSXUpdateClipRgn(TkWindow* winPtr); +/* 33 */ +EXTERN void TkMacOSXUnregisterMacWindow(void* portPtr); +/* 34 */ +EXTERN int TkMacOSXUseMenuID(short macID); +/* 35 */ +EXTERN TkRegion TkMacOSXVisableClipRgn(TkWindow* winPtr); +/* 36 */ +EXTERN void TkMacOSXWinBounds(TkWindow* winPtr, void* geometry); +/* 37 */ +EXTERN void TkMacOSXWindowOffset(void* wRef, int* xOffset, int* yOffset); +/* 38 */ +EXTERN int TkSetMacColor(unsigned long pixel, void* macColor); +/* 39 */ +EXTERN void TkSetWMName(TkWindow* winPtr, Tk_Uid titleUid); +/* 40 */ +EXTERN void TkSuspendClipboard(void); +/* 41 */ +EXTERN int TkMacOSXZoomToplevel(void* whichWindow, short zoomPart); +/* 42 */ +EXTERN Tk_Window Tk_TopCoordsToWindow( + Tk_Window tkwin, + int rootX, + int rootY, + int* newX, + int* newY); +/* 43 */ +EXTERN MacDrawable* TkMacOSXContainerId(TkWindow* winPtr); +/* 44 */ +EXTERN MacDrawable* TkMacOSXGetHostToplevel(TkWindow* winPtr); +/* 45 */ +EXTERN void TkMacOSXPreprocessMenu(void); +/* 46 */ +EXTERN int TkpIsWindowFloating(void* window); +/* 47 */ +EXTERN Tk_Window TkMacOSXGetCapture(void); +/* Slot 48 is reserved */ +/* 49 */ +EXTERN Window TkGetTransientMaster(TkWindow* winPtr); +/* 50 */ +EXTERN int +TkGenerateButtonEvent(int x, int y, Window window, unsigned int state); +/* 51 */ +EXTERN void TkGenWMDestroyEvent(Tk_Window tkwin); +/* 52 */ +EXTERN void TkMacOSXSetDrawingEnabled(TkWindow* winPtr, int flag); +/* 53 */ +EXTERN unsigned long TkpGetMS(void); +/* 54 */ +EXTERN void* TkMacOSXDrawable(Drawable drawable); +/* 55 */ +EXTERN int +TkpScanWindowId(Tcl_Interp* interp, const char* string, Window* idPtr); +#endif /* AQUA */ +#if !(defined(_WIN32) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ +/* 0 */ +EXTERN void TkCreateXEventSource(void); +/* Slot 1 is reserved */ +/* Slot 2 is reserved */ +/* 3 */ +EXTERN int TkpCmapStressed(Tk_Window tkwin, Colormap colormap); +/* 4 */ +EXTERN void TkpSync(Display* display); +/* 5 */ +EXTERN Window TkUnixContainerId(TkWindow* winPtr); +/* 6 */ +EXTERN int TkUnixDoOneXEvent(Tcl_Time* timePtr); +/* 7 */ +EXTERN void TkUnixSetMenubar(Tk_Window tkwin, Tk_Window menubar); +/* 8 */ +EXTERN int +TkpScanWindowId(Tcl_Interp* interp, const char* string, Window* idPtr); +/* 9 */ +EXTERN void TkWmCleanup(TkDisplay* dispPtr); +/* 10 */ +EXTERN void TkSendCleanup(TkDisplay* dispPtr); +/* Slot 11 is reserved */ +/* 12 */ +EXTERN int TkpWmSetState(TkWindow* winPtr, int state); +/* 13 */ +EXTERN int TkpTestsendCmd( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +#endif /* X11 */ + +typedef struct TkIntPlatStubs { + int magic; + void* hooks; + +#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ + char* (*tkAlignImageData)(XImage* image, int alignment, int bitOrder); /* 0 */ + void (*reserved1)(void); + void (*tkGenerateActivateEvents)(TkWindow* winPtr, int active); /* 2 */ + unsigned long (*tkpGetMS)(void); /* 3 */ + void (*tkPointerDeadWindow)(TkWindow* winPtr); /* 4 */ + void (*tkpPrintWindowId)(char* buf, Window window); /* 5 */ + int (*tkpScanWindowId)( + Tcl_Interp* interp, + const char* string, + Window* idPtr); /* 6 */ + void (*tkpSetCapture)(TkWindow* winPtr); /* 7 */ + void (*tkpSetCursor)(TkpCursor cursor); /* 8 */ + int (*tkpWmSetState)(TkWindow* winPtr, int state); /* 9 */ + void (*tkSetPixmapColormap)(Pixmap pixmap, Colormap colormap); /* 10 */ + void (*tkWinCancelMouseTimer)(void); /* 11 */ + void (*tkWinClipboardRender)(TkDisplay* dispPtr, UINT format); /* 12 */ + LRESULT (*tkWinEmbeddedEventProc) + (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); /* 13 */ + void (*tkWinFillRect)( + HDC dc, + int x, + int y, + int width, + int height, + int pixel); /* 14 */ + COLORREF (*tkWinGetBorderPixels) + (Tk_Window tkwin, Tk_3DBorder border, int which); /* 15 */ + HDC (*tkWinGetDrawableDC) + (Display* display, Drawable d, TkWinDCState* state); /* 16 */ + int (*tkWinGetModifierState)(void); /* 17 */ + HPALETTE (*tkWinGetSystemPalette)(void); /* 18 */ + HWND (*tkWinGetWrapperWindow)(Tk_Window tkwin); /* 19 */ + int (*tkWinHandleMenuEvent)( + HWND* phwnd, + UINT* pMessage, + WPARAM* pwParam, + LPARAM* plParam, + LRESULT* plResult); /* 20 */ + int (*tkWinIndexOfColor)(XColor* colorPtr); /* 21 */ + void (*tkWinReleaseDrawableDC)( + Drawable d, + HDC hdc, + TkWinDCState* state); /* 22 */ + LRESULT (*tkWinResendEvent) + (WNDPROC wndproc, HWND hwnd, XEvent* eventPtr); /* 23 */ + HPALETTE (*tkWinSelectPalette)(HDC dc, Colormap colormap); /* 24 */ + void (*tkWinSetMenu)(Tk_Window tkwin, HMENU hMenu); /* 25 */ + void (*tkWinSetWindowPos)(HWND hwnd, HWND siblingHwnd, int pos); /* 26 */ + void (*tkWinWmCleanup)(HINSTANCE hInstance); /* 27 */ + void (*tkWinXCleanup)(ClientData clientData); /* 28 */ + void (*tkWinXInit)(HINSTANCE hInstance); /* 29 */ + void (*tkWinSetForegroundWindow)(TkWindow* winPtr); /* 30 */ + void (*tkWinDialogDebug)(int debug); /* 31 */ + Tcl_Obj* (*tkWinGetMenuSystemDefault)( + Tk_Window tkwin, + const char* dbName, + const char* className); /* 32 */ + int (*tkWinGetPlatformId)(void); /* 33 */ + void (*tkWinSetHINSTANCE)(HINSTANCE hInstance); /* 34 */ + int (*tkWinGetPlatformTheme)(void); /* 35 */ + LRESULT(__stdcall* tkWinChildProc) + (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); /* 36 */ + void (*tkCreateXEventSource)(void); /* 37 */ + int (*tkpCmapStressed)(Tk_Window tkwin, Colormap colormap); /* 38 */ + void (*tkpSync)(Display* display); /* 39 */ + Window (*tkUnixContainerId)(TkWindow* winPtr); /* 40 */ + int (*tkUnixDoOneXEvent)(Tcl_Time* timePtr); /* 41 */ + void (*tkUnixSetMenubar)(Tk_Window tkwin, Tk_Window menubar); /* 42 */ + void (*tkWmCleanup)(TkDisplay* dispPtr); /* 43 */ + void (*tkSendCleanup)(TkDisplay* dispPtr); /* 44 */ + int (*tkpTestsendCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 45 */ +#endif /* WIN */ +#ifdef MAC_OSX_TK /* AQUA */ + void (*tkGenerateActivateEvents)(TkWindow* winPtr, int active); /* 0 */ + void (*reserved1)(void); + void (*reserved2)(void); + void (*tkPointerDeadWindow)(TkWindow* winPtr); /* 3 */ + void (*tkpSetCapture)(TkWindow* winPtr); /* 4 */ + void (*tkpSetCursor)(TkpCursor cursor); /* 5 */ + void (*tkpWmSetState)(TkWindow* winPtr, int state); /* 6 */ + void (*tkAboutDlg)(void); /* 7 */ + unsigned int (*tkMacOSXButtonKeyState)(void); /* 8 */ + void (*tkMacOSXClearMenubarActive)(void); /* 9 */ + int (*tkMacOSXDispatchMenuEvent)(int menuID, int index); /* 10 */ + void (*tkMacOSXInstallCursor)(int resizeOverride); /* 11 */ + void (*tkMacOSXHandleTearoffMenu)(void); /* 12 */ + void (*reserved13)(void); + int (*tkMacOSXDoHLEvent)(void* theEvent); /* 14 */ + void (*reserved15)(void); + Window (*tkMacOSXGetXWindow)(void* macWinPtr); /* 16 */ + int (*tkMacOSXGrowToplevel)(void* whichWindow, XPoint start); /* 17 */ + void (*tkMacOSXHandleMenuSelect)( + short theMenu, + unsigned short theItem, + int optionKeyPressed); /* 18 */ + void (*reserved19)(void); + void (*reserved20)(void); + void (*tkMacOSXInvalidateWindow)(MacDrawable* macWin, int flag); /* 21 */ + int (*tkMacOSXIsCharacterMissing)( + Tk_Font tkfont, + unsigned int searchChar); /* 22 */ + void (*tkMacOSXMakeRealWindowExist)(TkWindow* winPtr); /* 23 */ + void* (*tkMacOSXMakeStippleMap)(Drawable d1, Drawable d2); /* 24 */ + void (*tkMacOSXMenuClick)(void); /* 25 */ + void ( + *tkMacOSXRegisterOffScreenWindow)(Window window, void* portPtr); /* 26 */ + int (*tkMacOSXResizable)(TkWindow* winPtr); /* 27 */ + void (*tkMacOSXSetHelpMenuItemCount)(void); /* 28 */ + void (*tkMacOSXSetScrollbarGrow)(TkWindow* winPtr, int flag); /* 29 */ + void (*tkMacOSXSetUpClippingRgn)(Drawable drawable); /* 30 */ + void (*tkMacOSXSetUpGraphicsPort)(GC gc, void* destPort); /* 31 */ + void (*tkMacOSXUpdateClipRgn)(TkWindow* winPtr); /* 32 */ + void (*tkMacOSXUnregisterMacWindow)(void* portPtr); /* 33 */ + int (*tkMacOSXUseMenuID)(short macID); /* 34 */ + TkRegion (*tkMacOSXVisableClipRgn)(TkWindow* winPtr); /* 35 */ + void (*tkMacOSXWinBounds)(TkWindow* winPtr, void* geometry); /* 36 */ + void (*tkMacOSXWindowOffset)(void* wRef, int* xOffset, int* yOffset); /* 37 */ + int (*tkSetMacColor)(unsigned long pixel, void* macColor); /* 38 */ + void (*tkSetWMName)(TkWindow* winPtr, Tk_Uid titleUid); /* 39 */ + void (*tkSuspendClipboard)(void); /* 40 */ + int (*tkMacOSXZoomToplevel)(void* whichWindow, short zoomPart); /* 41 */ + Tk_Window (*tk_TopCoordsToWindow)( + Tk_Window tkwin, + int rootX, + int rootY, + int* newX, + int* newY); /* 42 */ + MacDrawable* (*tkMacOSXContainerId)(TkWindow* winPtr); /* 43 */ + MacDrawable* (*tkMacOSXGetHostToplevel)(TkWindow* winPtr); /* 44 */ + void (*tkMacOSXPreprocessMenu)(void); /* 45 */ + int (*tkpIsWindowFloating)(void* window); /* 46 */ + Tk_Window (*tkMacOSXGetCapture)(void); /* 47 */ + void (*reserved48)(void); + Window (*tkGetTransientMaster)(TkWindow* winPtr); /* 49 */ + int (*tkGenerateButtonEvent)( + int x, + int y, + Window window, + unsigned int state); /* 50 */ + void (*tkGenWMDestroyEvent)(Tk_Window tkwin); /* 51 */ + void (*tkMacOSXSetDrawingEnabled)(TkWindow* winPtr, int flag); /* 52 */ + unsigned long (*tkpGetMS)(void); /* 53 */ + void* (*tkMacOSXDrawable)(Drawable drawable); /* 54 */ + int (*tkpScanWindowId)( + Tcl_Interp* interp, + const char* string, + Window* idPtr); /* 55 */ +#endif /* AQUA */ +#if !(defined(_WIN32) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ + void (*tkCreateXEventSource)(void); /* 0 */ + void (*reserved1)(void); + void (*reserved2)(void); + int (*tkpCmapStressed)(Tk_Window tkwin, Colormap colormap); /* 3 */ + void (*tkpSync)(Display* display); /* 4 */ + Window (*tkUnixContainerId)(TkWindow* winPtr); /* 5 */ + int (*tkUnixDoOneXEvent)(Tcl_Time* timePtr); /* 6 */ + void (*tkUnixSetMenubar)(Tk_Window tkwin, Tk_Window menubar); /* 7 */ + int (*tkpScanWindowId)( + Tcl_Interp* interp, + const char* string, + Window* idPtr); /* 8 */ + void (*tkWmCleanup)(TkDisplay* dispPtr); /* 9 */ + void (*tkSendCleanup)(TkDisplay* dispPtr); /* 10 */ + void (*reserved11)(void); + int (*tkpWmSetState)(TkWindow* winPtr, int state); /* 12 */ + int (*tkpTestsendCmd)( + ClientData clientData, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); /* 13 */ +#endif /* X11 */ +} TkIntPlatStubs; + +extern const TkIntPlatStubs* tkIntPlatStubsPtr; + +#ifdef __cplusplus +} +#endif + +#if defined(USE_TK_STUBS) + +/* + * Inline function declarations: + */ + +#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ +#define TkAlignImageData (tkIntPlatStubsPtr->tkAlignImageData) /* 0 */ +/* Slot 1 is reserved */ +#define TkGenerateActivateEvents \ + (tkIntPlatStubsPtr->tkGenerateActivateEvents) /* 2 */ +#define TkpGetMS (tkIntPlatStubsPtr->tkpGetMS) /* 3 */ +#define TkPointerDeadWindow (tkIntPlatStubsPtr->tkPointerDeadWindow) /* 4 */ +#define TkpPrintWindowId (tkIntPlatStubsPtr->tkpPrintWindowId) /* 5 */ +#define TkpScanWindowId (tkIntPlatStubsPtr->tkpScanWindowId) /* 6 */ +#define TkpSetCapture (tkIntPlatStubsPtr->tkpSetCapture) /* 7 */ +#define TkpSetCursor (tkIntPlatStubsPtr->tkpSetCursor) /* 8 */ +#define TkpWmSetState (tkIntPlatStubsPtr->tkpWmSetState) /* 9 */ +#define TkSetPixmapColormap (tkIntPlatStubsPtr->tkSetPixmapColormap) /* 10 */ +#define TkWinCancelMouseTimer \ + (tkIntPlatStubsPtr->tkWinCancelMouseTimer) /* 11 */ +#define TkWinClipboardRender (tkIntPlatStubsPtr->tkWinClipboardRender) /* 12 \ + */ +#define TkWinEmbeddedEventProc \ + (tkIntPlatStubsPtr->tkWinEmbeddedEventProc) /* 13 */ +#define TkWinFillRect (tkIntPlatStubsPtr->tkWinFillRect) /* 14 */ +#define TkWinGetBorderPixels (tkIntPlatStubsPtr->tkWinGetBorderPixels) /* 15 \ + */ +#define TkWinGetDrawableDC (tkIntPlatStubsPtr->tkWinGetDrawableDC) /* 16 */ +#define TkWinGetModifierState \ + (tkIntPlatStubsPtr->tkWinGetModifierState) /* 17 */ +#define TkWinGetSystemPalette \ + (tkIntPlatStubsPtr->tkWinGetSystemPalette) /* 18 */ +#define TkWinGetWrapperWindow \ + (tkIntPlatStubsPtr->tkWinGetWrapperWindow) /* 19 */ +#define TkWinHandleMenuEvent (tkIntPlatStubsPtr->tkWinHandleMenuEvent) /* 20 \ + */ +#define TkWinIndexOfColor (tkIntPlatStubsPtr->tkWinIndexOfColor) /* 21 */ +#define TkWinReleaseDrawableDC \ + (tkIntPlatStubsPtr->tkWinReleaseDrawableDC) /* 22 */ +#define TkWinResendEvent (tkIntPlatStubsPtr->tkWinResendEvent) /* 23 */ +#define TkWinSelectPalette (tkIntPlatStubsPtr->tkWinSelectPalette) /* 24 */ +#define TkWinSetMenu (tkIntPlatStubsPtr->tkWinSetMenu) /* 25 */ +#define TkWinSetWindowPos (tkIntPlatStubsPtr->tkWinSetWindowPos) /* 26 */ +#define TkWinWmCleanup (tkIntPlatStubsPtr->tkWinWmCleanup) /* 27 */ +#define TkWinXCleanup (tkIntPlatStubsPtr->tkWinXCleanup) /* 28 */ +#define TkWinXInit (tkIntPlatStubsPtr->tkWinXInit) /* 29 */ +#define TkWinSetForegroundWindow \ + (tkIntPlatStubsPtr->tkWinSetForegroundWindow) /* 30 */ +#define TkWinDialogDebug (tkIntPlatStubsPtr->tkWinDialogDebug) /* 31 */ +#define TkWinGetMenuSystemDefault \ + (tkIntPlatStubsPtr->tkWinGetMenuSystemDefault) /* 32 */ +#define TkWinGetPlatformId (tkIntPlatStubsPtr->tkWinGetPlatformId) /* 33 */ +#define TkWinSetHINSTANCE (tkIntPlatStubsPtr->tkWinSetHINSTANCE) /* 34 */ +#define TkWinGetPlatformTheme \ + (tkIntPlatStubsPtr->tkWinGetPlatformTheme) /* 35 */ +#define TkWinChildProc (tkIntPlatStubsPtr->tkWinChildProc) /* 36 */ +#define TkCreateXEventSource (tkIntPlatStubsPtr->tkCreateXEventSource) /* 37 \ + */ +#define TkpCmapStressed (tkIntPlatStubsPtr->tkpCmapStressed) /* 38 */ +#define TkpSync (tkIntPlatStubsPtr->tkpSync) /* 39 */ +#define TkUnixContainerId (tkIntPlatStubsPtr->tkUnixContainerId) /* 40 */ +#define TkUnixDoOneXEvent (tkIntPlatStubsPtr->tkUnixDoOneXEvent) /* 41 */ +#define TkUnixSetMenubar (tkIntPlatStubsPtr->tkUnixSetMenubar) /* 42 */ +#define TkWmCleanup (tkIntPlatStubsPtr->tkWmCleanup) /* 43 */ +#define TkSendCleanup (tkIntPlatStubsPtr->tkSendCleanup) /* 44 */ +#define TkpTestsendCmd (tkIntPlatStubsPtr->tkpTestsendCmd) /* 45 */ +#endif /* WIN */ +#ifdef MAC_OSX_TK /* AQUA */ +#define TkGenerateActivateEvents \ + (tkIntPlatStubsPtr->tkGenerateActivateEvents) /* 0 */ +/* Slot 1 is reserved */ +/* Slot 2 is reserved */ +#define TkPointerDeadWindow (tkIntPlatStubsPtr->tkPointerDeadWindow) /* 3 */ +#define TkpSetCapture (tkIntPlatStubsPtr->tkpSetCapture) /* 4 */ +#define TkpSetCursor (tkIntPlatStubsPtr->tkpSetCursor) /* 5 */ +#define TkpWmSetState (tkIntPlatStubsPtr->tkpWmSetState) /* 6 */ +#define TkAboutDlg (tkIntPlatStubsPtr->tkAboutDlg) /* 7 */ +#define TkMacOSXButtonKeyState \ + (tkIntPlatStubsPtr->tkMacOSXButtonKeyState) /* 8 */ +#define TkMacOSXClearMenubarActive \ + (tkIntPlatStubsPtr->tkMacOSXClearMenubarActive) /* 9 */ +#define TkMacOSXDispatchMenuEvent \ + (tkIntPlatStubsPtr->tkMacOSXDispatchMenuEvent) /* 10 */ +#define TkMacOSXInstallCursor \ + (tkIntPlatStubsPtr->tkMacOSXInstallCursor) /* 11 */ +#define TkMacOSXHandleTearoffMenu \ + (tkIntPlatStubsPtr->tkMacOSXHandleTearoffMenu) /* 12 */ +/* Slot 13 is reserved */ +#define TkMacOSXDoHLEvent (tkIntPlatStubsPtr->tkMacOSXDoHLEvent) /* 14 */ +/* Slot 15 is reserved */ +#define TkMacOSXGetXWindow (tkIntPlatStubsPtr->tkMacOSXGetXWindow) /* 16 */ +#define TkMacOSXGrowToplevel (tkIntPlatStubsPtr->tkMacOSXGrowToplevel) /* 17 \ + */ +#define TkMacOSXHandleMenuSelect \ + (tkIntPlatStubsPtr->tkMacOSXHandleMenuSelect) /* 18 */ +/* Slot 19 is reserved */ +/* Slot 20 is reserved */ +#define TkMacOSXInvalidateWindow \ + (tkIntPlatStubsPtr->tkMacOSXInvalidateWindow) /* 21 */ +#define TkMacOSXIsCharacterMissing \ + (tkIntPlatStubsPtr->tkMacOSXIsCharacterMissing) /* 22 */ +#define TkMacOSXMakeRealWindowExist \ + (tkIntPlatStubsPtr->tkMacOSXMakeRealWindowExist) /* 23 */ +#define TkMacOSXMakeStippleMap \ + (tkIntPlatStubsPtr->tkMacOSXMakeStippleMap) /* 24 */ +#define TkMacOSXMenuClick (tkIntPlatStubsPtr->tkMacOSXMenuClick) /* 25 */ +#define TkMacOSXRegisterOffScreenWindow \ + (tkIntPlatStubsPtr->tkMacOSXRegisterOffScreenWindow) /* 26 */ +#define TkMacOSXResizable (tkIntPlatStubsPtr->tkMacOSXResizable) /* 27 */ +#define TkMacOSXSetHelpMenuItemCount \ + (tkIntPlatStubsPtr->tkMacOSXSetHelpMenuItemCount) /* 28 */ +#define TkMacOSXSetScrollbarGrow \ + (tkIntPlatStubsPtr->tkMacOSXSetScrollbarGrow) /* 29 */ +#define TkMacOSXSetUpClippingRgn \ + (tkIntPlatStubsPtr->tkMacOSXSetUpClippingRgn) /* 30 */ +#define TkMacOSXSetUpGraphicsPort \ + (tkIntPlatStubsPtr->tkMacOSXSetUpGraphicsPort) /* 31 */ +#define TkMacOSXUpdateClipRgn \ + (tkIntPlatStubsPtr->tkMacOSXUpdateClipRgn) /* 32 */ +#define TkMacOSXUnregisterMacWindow \ + (tkIntPlatStubsPtr->tkMacOSXUnregisterMacWindow) /* 33 */ +#define TkMacOSXUseMenuID (tkIntPlatStubsPtr->tkMacOSXUseMenuID) /* 34 */ +#define TkMacOSXVisableClipRgn \ + (tkIntPlatStubsPtr->tkMacOSXVisableClipRgn) /* 35 */ +#define TkMacOSXWinBounds (tkIntPlatStubsPtr->tkMacOSXWinBounds) /* 36 */ +#define TkMacOSXWindowOffset (tkIntPlatStubsPtr->tkMacOSXWindowOffset) /* 37 \ + */ +#define TkSetMacColor (tkIntPlatStubsPtr->tkSetMacColor) /* 38 */ +#define TkSetWMName (tkIntPlatStubsPtr->tkSetWMName) /* 39 */ +#define TkSuspendClipboard (tkIntPlatStubsPtr->tkSuspendClipboard) /* 40 */ +#define TkMacOSXZoomToplevel (tkIntPlatStubsPtr->tkMacOSXZoomToplevel) /* 41 \ + */ +#define Tk_TopCoordsToWindow (tkIntPlatStubsPtr->tk_TopCoordsToWindow) /* 42 \ + */ +#define TkMacOSXContainerId (tkIntPlatStubsPtr->tkMacOSXContainerId) /* 43 */ +#define TkMacOSXGetHostToplevel \ + (tkIntPlatStubsPtr->tkMacOSXGetHostToplevel) /* 44 */ +#define TkMacOSXPreprocessMenu \ + (tkIntPlatStubsPtr->tkMacOSXPreprocessMenu) /* 45 */ +#define TkpIsWindowFloating (tkIntPlatStubsPtr->tkpIsWindowFloating) /* 46 */ +#define TkMacOSXGetCapture (tkIntPlatStubsPtr->tkMacOSXGetCapture) /* 47 */ +/* Slot 48 is reserved */ +#define TkGetTransientMaster (tkIntPlatStubsPtr->tkGetTransientMaster) /* 49 \ + */ +#define TkGenerateButtonEvent \ + (tkIntPlatStubsPtr->tkGenerateButtonEvent) /* 50 */ +#define TkGenWMDestroyEvent (tkIntPlatStubsPtr->tkGenWMDestroyEvent) /* 51 */ +#define TkMacOSXSetDrawingEnabled \ + (tkIntPlatStubsPtr->tkMacOSXSetDrawingEnabled) /* 52 */ +#define TkpGetMS (tkIntPlatStubsPtr->tkpGetMS) /* 53 */ +#define TkMacOSXDrawable (tkIntPlatStubsPtr->tkMacOSXDrawable) /* 54 */ +#define TkpScanWindowId (tkIntPlatStubsPtr->tkpScanWindowId) /* 55 */ +#endif /* AQUA */ +#if !(defined(_WIN32) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ +#define TkCreateXEventSource (tkIntPlatStubsPtr->tkCreateXEventSource) /* 0 */ +/* Slot 1 is reserved */ +/* Slot 2 is reserved */ +#define TkpCmapStressed (tkIntPlatStubsPtr->tkpCmapStressed) /* 3 */ +#define TkpSync (tkIntPlatStubsPtr->tkpSync) /* 4 */ +#define TkUnixContainerId (tkIntPlatStubsPtr->tkUnixContainerId) /* 5 */ +#define TkUnixDoOneXEvent (tkIntPlatStubsPtr->tkUnixDoOneXEvent) /* 6 */ +#define TkUnixSetMenubar (tkIntPlatStubsPtr->tkUnixSetMenubar) /* 7 */ +#define TkpScanWindowId (tkIntPlatStubsPtr->tkpScanWindowId) /* 8 */ +#define TkWmCleanup (tkIntPlatStubsPtr->tkWmCleanup) /* 9 */ +#define TkSendCleanup (tkIntPlatStubsPtr->tkSendCleanup) /* 10 */ +/* Slot 11 is reserved */ +#define TkpWmSetState (tkIntPlatStubsPtr->tkpWmSetState) /* 12 */ +#define TkpTestsendCmd (tkIntPlatStubsPtr->tkpTestsendCmd) /* 13 */ +#endif /* X11 */ + +#endif /* defined(USE_TK_STUBS) */ + +/* !END!: Do not edit above this line. */ + +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLIMPORT + +#endif /* _TKINTPLATDECLS */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkIntXlibDecls.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkIntXlibDecls.h new file mode 100644 index 0000000..71d7376 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkIntXlibDecls.h @@ -0,0 +1,2093 @@ +/* + * tkIntXlibDecls.h -- + * + * This file contains the declarations for all platform dependent + * unsupported functions that are exported by the Tk library. These + * interfaces are not guaranteed to remain the same between + * versions. Use at your own risk. + * + * Copyright (c) 1998-1999 by Scriptics Corporation. + * All rights reserved. + */ + +#ifndef _TKINTXLIBDECLS +#define _TKINTXLIBDECLS + +/* + * WARNING: This file is automatically generated by the tools/genStubs.tcl + * script. Any modifications to the function declarations below should be made + * in the generic/tkInt.decls script. + */ + +#ifndef _TCL +#include +#endif + +/* Some (older) versions of X11/Xutil.h have a wrong signature of those + two functions, so move them out of the way temporarly. */ +#define XOffsetRegion _XOffsetRegion +#define XUnionRegion _XUnionRegion +#include "X11/Xutil.h" +#undef XOffsetRegion +#undef XUnionRegion + +#ifdef BUILD_tk +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLEXPORT +#endif + +typedef int (*XAfterFunction) ( /* WARNING, this type not in Xlib spec */ + Display* /* display */ +); + +/* !BEGIN!: Do not edit below this line. */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Exported function declarations: + */ + +#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ +/* 0 */ +EXTERN int XSetDashes( + Display* display, + GC gc, + int dash_offset, + _Xconst char* dash_list, + int n); +/* 1 */ +EXTERN XModifierKeymap* XGetModifierMapping(Display* d); +/* 2 */ +EXTERN XImage* XCreateImage( + Display* d, + Visual* v, + unsigned int ui1, + int i1, + int i2, + char* cp, + unsigned int ui2, + unsigned int ui3, + int i3, + int i4); +/* 3 */ +EXTERN XImage* XGetImage( + Display* d, + Drawable dr, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2, + unsigned long ul, + int i3); +/* 4 */ +EXTERN char* XGetAtomName(Display* d, Atom a); +/* 5 */ +EXTERN char* XKeysymToString(KeySym k); +/* 6 */ +EXTERN Colormap XCreateColormap(Display* d, Window w, Visual* v, int i); +/* 7 */ +EXTERN Cursor XCreatePixmapCursor( + Display* d, + Pixmap p1, + Pixmap p2, + XColor* x1, + XColor* x2, + unsigned int ui1, + unsigned int ui2); +/* 8 */ +EXTERN Cursor XCreateGlyphCursor( + Display* d, + Font f1, + Font f2, + unsigned int ui1, + unsigned int ui2, + XColor _Xconst* x1, + XColor _Xconst* x2); +/* 9 */ +EXTERN GContext XGContextFromGC(GC g); +/* 10 */ +EXTERN XHostAddress* XListHosts(Display* d, int* i, Bool* b); +/* 11 */ +EXTERN KeySym XKeycodeToKeysym(Display* d, unsigned int k, int i); +/* 12 */ +EXTERN KeySym XStringToKeysym(_Xconst char* c); +/* 13 */ +EXTERN Window XRootWindow(Display* d, int i); +/* 14 */ +EXTERN XErrorHandler XSetErrorHandler(XErrorHandler x); +/* 15 */ +EXTERN Status XIconifyWindow(Display* d, Window w, int i); +/* 16 */ +EXTERN Status XWithdrawWindow(Display* d, Window w, int i); +/* 17 */ +EXTERN Status +XGetWMColormapWindows(Display* d, Window w, Window** wpp, int* ip); +/* 18 */ +EXTERN Status XAllocColor(Display* d, Colormap c, XColor* xp); +/* 19 */ +EXTERN int XBell(Display* d, int i); +/* 20 */ +EXTERN int XChangeProperty( + Display* d, + Window w, + Atom a1, + Atom a2, + int i1, + int i2, + _Xconst unsigned char* c, + int i3); +/* 21 */ +EXTERN int XChangeWindowAttributes( + Display* d, + Window w, + unsigned long ul, + XSetWindowAttributes* x); +/* 22 */ +EXTERN int XClearWindow(Display* d, Window w); +/* 23 */ +EXTERN int +XConfigureWindow(Display* d, Window w, unsigned int i, XWindowChanges* x); +/* 24 */ +EXTERN int XCopyArea( + Display* d, + Drawable dr1, + Drawable dr2, + GC g, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2, + int i3, + int i4); +/* 25 */ +EXTERN int XCopyPlane( + Display* d, + Drawable dr1, + Drawable dr2, + GC g, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2, + int i3, + int i4, + unsigned long ul); +/* 26 */ +EXTERN Pixmap XCreateBitmapFromData( + Display* display, + Drawable d, + _Xconst char* data, + unsigned int width, + unsigned int height); +/* 27 */ +EXTERN int XDefineCursor(Display* d, Window w, Cursor c); +/* 28 */ +EXTERN int XDeleteProperty(Display* d, Window w, Atom a); +/* 29 */ +EXTERN int XDestroyWindow(Display* d, Window w); +/* 30 */ +EXTERN int XDrawArc( + Display* d, + Drawable dr, + GC g, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2, + int i3, + int i4); +/* 31 */ +EXTERN int XDrawLines(Display* d, Drawable dr, GC g, XPoint* x, int i1, int i2); +/* 32 */ +EXTERN int XDrawRectangle( + Display* d, + Drawable dr, + GC g, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2); +/* 33 */ +EXTERN int XFillArc( + Display* d, + Drawable dr, + GC g, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2, + int i3, + int i4); +/* 34 */ +EXTERN int +XFillPolygon(Display* d, Drawable dr, GC g, XPoint* x, int i1, int i2, int i3); +/* 35 */ +EXTERN int XFillRectangles(Display* d, Drawable dr, GC g, XRectangle* x, int i); +/* 36 */ +EXTERN int XForceScreenSaver(Display* d, int i); +/* 37 */ +EXTERN int XFreeColormap(Display* d, Colormap c); +/* 38 */ +EXTERN int XFreeColors( + Display* d, + Colormap c, + unsigned long* ulp, + int i, + unsigned long ul); +/* 39 */ +EXTERN int XFreeCursor(Display* d, Cursor c); +/* 40 */ +EXTERN int XFreeModifiermap(XModifierKeymap* x); +/* 41 */ +EXTERN Status XGetGeometry( + Display* d, + Drawable dr, + Window* w, + int* i1, + int* i2, + unsigned int* ui1, + unsigned int* ui2, + unsigned int* ui3, + unsigned int* ui4); +/* 42 */ +EXTERN int XGetInputFocus(Display* d, Window* w, int* i); +/* 43 */ +EXTERN int XGetWindowProperty( + Display* d, + Window w, + Atom a1, + long l1, + long l2, + Bool b, + Atom a2, + Atom* ap, + int* ip, + unsigned long* ulp1, + unsigned long* ulp2, + unsigned char** cpp); +/* 44 */ +EXTERN Status XGetWindowAttributes(Display* d, Window w, XWindowAttributes* x); +/* 45 */ +EXTERN int XGrabKeyboard(Display* d, Window w, Bool b, int i1, int i2, Time t); +/* 46 */ +EXTERN int XGrabPointer( + Display* d, + Window w1, + Bool b, + unsigned int ui, + int i1, + int i2, + Window w2, + Cursor c, + Time t); +/* 47 */ +EXTERN KeyCode XKeysymToKeycode(Display* d, KeySym k); +/* 48 */ +EXTERN Status +XLookupColor(Display* d, Colormap c1, _Xconst char* c2, XColor* x1, XColor* x2); +/* 49 */ +EXTERN int XMapWindow(Display* d, Window w); +/* 50 */ +EXTERN int XMoveResizeWindow( + Display* d, + Window w, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2); +/* 51 */ +EXTERN int XMoveWindow(Display* d, Window w, int i1, int i2); +/* 52 */ +EXTERN int XNextEvent(Display* d, XEvent* x); +/* 53 */ +EXTERN int XPutBackEvent(Display* d, XEvent* x); +/* 54 */ +EXTERN int XQueryColors(Display* d, Colormap c, XColor* x, int i); +/* 55 */ +EXTERN Bool XQueryPointer( + Display* d, + Window w1, + Window* w2, + Window* w3, + int* i1, + int* i2, + int* i3, + int* i4, + unsigned int* ui); +/* 56 */ +EXTERN Status XQueryTree( + Display* d, + Window w1, + Window* w2, + Window* w3, + Window** w4, + unsigned int* ui); +/* 57 */ +EXTERN int XRaiseWindow(Display* d, Window w); +/* 58 */ +EXTERN int XRefreshKeyboardMapping(XMappingEvent* x); +/* 59 */ +EXTERN int +XResizeWindow(Display* d, Window w, unsigned int ui1, unsigned int ui2); +/* 60 */ +EXTERN int XSelectInput(Display* d, Window w, long l); +/* 61 */ +EXTERN Status XSendEvent(Display* d, Window w, Bool b, long l, XEvent* x); +/* 62 */ +EXTERN int XSetCommand(Display* d, Window w, char** c, int i); +/* 63 */ +EXTERN int XSetIconName(Display* d, Window w, _Xconst char* c); +/* 64 */ +EXTERN int XSetInputFocus(Display* d, Window w, int i, Time t); +/* 65 */ +EXTERN int XSetSelectionOwner(Display* d, Atom a, Window w, Time t); +/* 66 */ +EXTERN int XSetWindowBackground(Display* d, Window w, unsigned long ul); +/* 67 */ +EXTERN int XSetWindowBackgroundPixmap(Display* d, Window w, Pixmap p); +/* 68 */ +EXTERN int XSetWindowBorder(Display* d, Window w, unsigned long ul); +/* 69 */ +EXTERN int XSetWindowBorderPixmap(Display* d, Window w, Pixmap p); +/* 70 */ +EXTERN int XSetWindowBorderWidth(Display* d, Window w, unsigned int ui); +/* 71 */ +EXTERN int XSetWindowColormap(Display* d, Window w, Colormap c); +/* 72 */ +EXTERN Bool XTranslateCoordinates( + Display* d, + Window w1, + Window w2, + int i1, + int i2, + int* i3, + int* i4, + Window* w3); +/* 73 */ +EXTERN int XUngrabKeyboard(Display* d, Time t); +/* 74 */ +EXTERN int XUngrabPointer(Display* d, Time t); +/* 75 */ +EXTERN int XUnmapWindow(Display* d, Window w); +/* 76 */ +EXTERN int XWindowEvent(Display* d, Window w, long l, XEvent* x); +/* 77 */ +EXTERN void XDestroyIC(XIC x); +/* 78 */ +EXTERN Bool XFilterEvent(XEvent* x, Window w); +/* 79 */ +EXTERN int XmbLookupString( + XIC xi, + XKeyPressedEvent* xk, + char* c, + int i, + KeySym* k, + Status* s); +/* 80 */ +EXTERN int TkPutImage( + unsigned long* colors, + int ncolors, + Display* display, + Drawable d, + GC gc, + XImage* image, + int src_x, + int src_y, + int dest_x, + int dest_y, + unsigned int width, + unsigned int height); +/* Slot 81 is reserved */ +/* 82 */ +EXTERN Status XParseColor( + Display* display, + Colormap map, + _Xconst char* spec, + XColor* colorPtr); +/* 83 */ +EXTERN GC XCreateGC( + Display* display, + Drawable d, + unsigned long valuemask, + XGCValues* values); +/* 84 */ +EXTERN int XFreeGC(Display* display, GC gc); +/* 85 */ +EXTERN Atom +XInternAtom(Display* display, _Xconst char* atom_name, Bool only_if_exists); +/* 86 */ +EXTERN int XSetBackground(Display* display, GC gc, unsigned long foreground); +/* 87 */ +EXTERN int XSetForeground(Display* display, GC gc, unsigned long foreground); +/* 88 */ +EXTERN int XSetClipMask(Display* display, GC gc, Pixmap pixmap); +/* 89 */ +EXTERN int +XSetClipOrigin(Display* display, GC gc, int clip_x_origin, int clip_y_origin); +/* 90 */ +EXTERN int +XSetTSOrigin(Display* display, GC gc, int ts_x_origin, int ts_y_origin); +/* 91 */ +EXTERN int XChangeGC(Display* d, GC gc, unsigned long mask, XGCValues* values); +/* 92 */ +EXTERN int XSetFont(Display* display, GC gc, Font font); +/* 93 */ +EXTERN int XSetArcMode(Display* display, GC gc, int arc_mode); +/* 94 */ +EXTERN int XSetStipple(Display* display, GC gc, Pixmap stipple); +/* 95 */ +EXTERN int XSetFillRule(Display* display, GC gc, int fill_rule); +/* 96 */ +EXTERN int XSetFillStyle(Display* display, GC gc, int fill_style); +/* 97 */ +EXTERN int XSetFunction(Display* display, GC gc, int function); +/* 98 */ +EXTERN int XSetLineAttributes( + Display* display, + GC gc, + unsigned int line_width, + int line_style, + int cap_style, + int join_style); +/* 99 */ +EXTERN int _XInitImageFuncPtrs(XImage* image); +/* 100 */ +EXTERN XIC XCreateIC(XIM xim, ...); +/* 101 */ +EXTERN XVisualInfo* XGetVisualInfo( + Display* display, + long vinfo_mask, + XVisualInfo* vinfo_template, + int* nitems_return); +/* 102 */ +EXTERN void +XSetWMClientMachine(Display* display, Window w, XTextProperty* text_prop); +/* 103 */ +EXTERN Status XStringListToTextProperty( + char** list, + int count, + XTextProperty* text_prop_return); +/* 104 */ +EXTERN int +XDrawLine(Display* d, Drawable dr, GC g, int x1, int y1, int x2, int y2); +/* 105 */ +EXTERN int XWarpPointer( + Display* d, + Window s, + Window dw, + int sx, + int sy, + unsigned int sw, + unsigned int sh, + int dx, + int dy); +/* 106 */ +EXTERN int XFillRectangle( + Display* display, + Drawable d, + GC gc, + int x, + int y, + unsigned int width, + unsigned int height); +/* 107 */ +EXTERN int XFlush(Display* display); +/* 108 */ +EXTERN int XGrabServer(Display* display); +/* 109 */ +EXTERN int XUngrabServer(Display* display); +/* 110 */ +EXTERN int XFree(void* data); +/* 111 */ +EXTERN int XNoOp(Display* display); +/* 112 */ +EXTERN XAfterFunction XSynchronize(Display* display, Bool onoff); +/* 113 */ +EXTERN int XSync(Display* display, Bool discard); +/* 114 */ +EXTERN VisualID XVisualIDFromVisual(Visual* visual); +/* Slot 115 is reserved */ +/* Slot 116 is reserved */ +/* Slot 117 is reserved */ +/* Slot 118 is reserved */ +/* Slot 119 is reserved */ +/* 120 */ +EXTERN int XOffsetRegion(Region rgn, int dx, int dy); +/* 121 */ +EXTERN int XUnionRegion(Region srca, Region srcb, Region dr_return); +/* 122 */ +EXTERN Window XCreateWindow( + Display* display, + Window parent, + int x, + int y, + unsigned int width, + unsigned int height, + unsigned int border_width, + int depth, + unsigned int clazz, + Visual* visual, + unsigned long value_mask, + XSetWindowAttributes* attributes); +/* Slot 123 is reserved */ +/* Slot 124 is reserved */ +/* Slot 125 is reserved */ +/* Slot 126 is reserved */ +/* Slot 127 is reserved */ +/* Slot 128 is reserved */ +/* 129 */ +EXTERN int XLowerWindow(Display* d, Window w); +/* 130 */ +EXTERN int XFillArcs(Display* d, Drawable dr, GC gc, XArc* a, int n); +/* 131 */ +EXTERN int XDrawArcs(Display* d, Drawable dr, GC gc, XArc* a, int n); +/* 132 */ +EXTERN int +XDrawRectangles(Display* d, Drawable dr, GC gc, XRectangle* r, int n); +/* 133 */ +EXTERN int XDrawSegments(Display* d, Drawable dr, GC gc, XSegment* s, int n); +/* 134 */ +EXTERN int XDrawPoint(Display* d, Drawable dr, GC gc, int x, int y); +/* 135 */ +EXTERN int XDrawPoints(Display* d, Drawable dr, GC gc, XPoint* p, int n, int m); +/* 136 */ +EXTERN int XReparentWindow(Display* d, Window w, Window p, int x, int y); +/* 137 */ +EXTERN int XPutImage( + Display* d, + Drawable dr, + GC gc, + XImage* im, + int sx, + int sy, + int dx, + int dy, + unsigned int w, + unsigned int h); +#endif /* WIN */ +#ifdef MAC_OSX_TK /* AQUA */ +/* 0 */ +EXTERN int XSetDashes( + Display* display, + GC gc, + int dash_offset, + _Xconst char* dash_list, + int n); +/* 1 */ +EXTERN XModifierKeymap* XGetModifierMapping(Display* d); +/* 2 */ +EXTERN XImage* XCreateImage( + Display* d, + Visual* v, + unsigned int ui1, + int i1, + int i2, + char* cp, + unsigned int ui2, + unsigned int ui3, + int i3, + int i4); +/* 3 */ +EXTERN XImage* XGetImage( + Display* d, + Drawable dr, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2, + unsigned long ul, + int i3); +/* 4 */ +EXTERN char* XGetAtomName(Display* d, Atom a); +/* 5 */ +EXTERN char* XKeysymToString(KeySym k); +/* 6 */ +EXTERN Colormap XCreateColormap(Display* d, Window w, Visual* v, int i); +/* 7 */ +EXTERN GContext XGContextFromGC(GC g); +/* 8 */ +EXTERN KeySym XKeycodeToKeysym(Display* d, KeyCode k, int i); +/* 9 */ +EXTERN KeySym XStringToKeysym(_Xconst char* c); +/* 10 */ +EXTERN Window XRootWindow(Display* d, int i); +/* 11 */ +EXTERN XErrorHandler XSetErrorHandler(XErrorHandler x); +/* 12 */ +EXTERN Status XAllocColor(Display* d, Colormap c, XColor* xp); +/* 13 */ +EXTERN int XBell(Display* d, int i); +/* 14 */ +EXTERN void XChangeProperty( + Display* d, + Window w, + Atom a1, + Atom a2, + int i1, + int i2, + _Xconst unsigned char* c, + int i3); +/* 15 */ +EXTERN void XChangeWindowAttributes( + Display* d, + Window w, + unsigned long ul, + XSetWindowAttributes* x); +/* 16 */ +EXTERN void +XConfigureWindow(Display* d, Window w, unsigned int i, XWindowChanges* x); +/* 17 */ +EXTERN void XCopyArea( + Display* d, + Drawable dr1, + Drawable dr2, + GC g, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2, + int i3, + int i4); +/* 18 */ +EXTERN void XCopyPlane( + Display* d, + Drawable dr1, + Drawable dr2, + GC g, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2, + int i3, + int i4, + unsigned long ul); +/* 19 */ +EXTERN Pixmap XCreateBitmapFromData( + Display* display, + Drawable d, + _Xconst char* data, + unsigned int width, + unsigned int height); +/* 20 */ +EXTERN int XDefineCursor(Display* d, Window w, Cursor c); +/* 21 */ +EXTERN void XDestroyWindow(Display* d, Window w); +/* 22 */ +EXTERN void XDrawArc( + Display* d, + Drawable dr, + GC g, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2, + int i3, + int i4); +/* 23 */ +EXTERN int XDrawLines(Display* d, Drawable dr, GC g, XPoint* x, int i1, int i2); +/* 24 */ +EXTERN void XDrawRectangle( + Display* d, + Drawable dr, + GC g, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2); +/* 25 */ +EXTERN void XFillArc( + Display* d, + Drawable dr, + GC g, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2, + int i3, + int i4); +/* 26 */ +EXTERN void +XFillPolygon(Display* d, Drawable dr, GC g, XPoint* x, int i1, int i2, int i3); +/* 27 */ +EXTERN int XFillRectangles(Display* d, Drawable dr, GC g, XRectangle* x, int i); +/* 28 */ +EXTERN int XFreeColormap(Display* d, Colormap c); +/* 29 */ +EXTERN int XFreeColors( + Display* d, + Colormap c, + unsigned long* ulp, + int i, + unsigned long ul); +/* 30 */ +EXTERN int XFreeModifiermap(XModifierKeymap* x); +/* 31 */ +EXTERN Status XGetGeometry( + Display* d, + Drawable dr, + Window* w, + int* i1, + int* i2, + unsigned int* ui1, + unsigned int* ui2, + unsigned int* ui3, + unsigned int* ui4); +/* 32 */ +EXTERN int XGetWindowProperty( + Display* d, + Window w, + Atom a1, + long l1, + long l2, + Bool b, + Atom a2, + Atom* ap, + int* ip, + unsigned long* ulp1, + unsigned long* ulp2, + unsigned char** cpp); +/* 33 */ +EXTERN int XGrabKeyboard(Display* d, Window w, Bool b, int i1, int i2, Time t); +/* 34 */ +EXTERN int XGrabPointer( + Display* d, + Window w1, + Bool b, + unsigned int ui, + int i1, + int i2, + Window w2, + Cursor c, + Time t); +/* 35 */ +EXTERN KeyCode XKeysymToKeycode(Display* d, KeySym k); +/* 36 */ +EXTERN void XMapWindow(Display* d, Window w); +/* 37 */ +EXTERN void XMoveResizeWindow( + Display* d, + Window w, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2); +/* 38 */ +EXTERN void XMoveWindow(Display* d, Window w, int i1, int i2); +/* 39 */ +EXTERN Bool XQueryPointer( + Display* d, + Window w1, + Window* w2, + Window* w3, + int* i1, + int* i2, + int* i3, + int* i4, + unsigned int* ui); +/* 40 */ +EXTERN void XRaiseWindow(Display* d, Window w); +/* 41 */ +EXTERN void XRefreshKeyboardMapping(XMappingEvent* x); +/* 42 */ +EXTERN void +XResizeWindow(Display* d, Window w, unsigned int ui1, unsigned int ui2); +/* 43 */ +EXTERN void XSelectInput(Display* d, Window w, long l); +/* 44 */ +EXTERN Status XSendEvent(Display* d, Window w, Bool b, long l, XEvent* x); +/* 45 */ +EXTERN void XSetIconName(Display* d, Window w, _Xconst char* c); +/* 46 */ +EXTERN void XSetInputFocus(Display* d, Window w, int i, Time t); +/* 47 */ +EXTERN int XSetSelectionOwner(Display* d, Atom a, Window w, Time t); +/* 48 */ +EXTERN void XSetWindowBackground(Display* d, Window w, unsigned long ul); +/* 49 */ +EXTERN void XSetWindowBackgroundPixmap(Display* d, Window w, Pixmap p); +/* 50 */ +EXTERN void XSetWindowBorder(Display* d, Window w, unsigned long ul); +/* 51 */ +EXTERN void XSetWindowBorderPixmap(Display* d, Window w, Pixmap p); +/* 52 */ +EXTERN void XSetWindowBorderWidth(Display* d, Window w, unsigned int ui); +/* 53 */ +EXTERN void XSetWindowColormap(Display* d, Window w, Colormap c); +/* 54 */ +EXTERN void XUngrabKeyboard(Display* d, Time t); +/* 55 */ +EXTERN int XUngrabPointer(Display* d, Time t); +/* 56 */ +EXTERN void XUnmapWindow(Display* d, Window w); +/* 57 */ +EXTERN int TkPutImage( + unsigned long* colors, + int ncolors, + Display* display, + Drawable d, + GC gc, + XImage* image, + int src_x, + int src_y, + int dest_x, + int dest_y, + unsigned int width, + unsigned int height); +/* 58 */ +EXTERN Status XParseColor( + Display* display, + Colormap map, + _Xconst char* spec, + XColor* colorPtr); +/* 59 */ +EXTERN GC XCreateGC( + Display* display, + Drawable d, + unsigned long valuemask, + XGCValues* values); +/* 60 */ +EXTERN int XFreeGC(Display* display, GC gc); +/* 61 */ +EXTERN Atom +XInternAtom(Display* display, _Xconst char* atom_name, Bool only_if_exists); +/* 62 */ +EXTERN int XSetBackground(Display* display, GC gc, unsigned long foreground); +/* 63 */ +EXTERN int XSetForeground(Display* display, GC gc, unsigned long foreground); +/* 64 */ +EXTERN int XSetClipMask(Display* display, GC gc, Pixmap pixmap); +/* 65 */ +EXTERN int +XSetClipOrigin(Display* display, GC gc, int clip_x_origin, int clip_y_origin); +/* 66 */ +EXTERN int +XSetTSOrigin(Display* display, GC gc, int ts_x_origin, int ts_y_origin); +/* 67 */ +EXTERN int XChangeGC(Display* d, GC gc, unsigned long mask, XGCValues* values); +/* 68 */ +EXTERN int XSetFont(Display* display, GC gc, Font font); +/* 69 */ +EXTERN int XSetArcMode(Display* display, GC gc, int arc_mode); +/* 70 */ +EXTERN int XSetStipple(Display* display, GC gc, Pixmap stipple); +/* 71 */ +EXTERN int XSetFillRule(Display* display, GC gc, int fill_rule); +/* 72 */ +EXTERN int XSetFillStyle(Display* display, GC gc, int fill_style); +/* 73 */ +EXTERN int XSetFunction(Display* display, GC gc, int function); +/* 74 */ +EXTERN int XSetLineAttributes( + Display* display, + GC gc, + unsigned int line_width, + int line_style, + int cap_style, + int join_style); +/* 75 */ +EXTERN int _XInitImageFuncPtrs(XImage* image); +/* 76 */ +EXTERN XIC XCreateIC(void); +/* 77 */ +EXTERN XVisualInfo* XGetVisualInfo( + Display* display, + long vinfo_mask, + XVisualInfo* vinfo_template, + int* nitems_return); +/* 78 */ +EXTERN void +XSetWMClientMachine(Display* display, Window w, XTextProperty* text_prop); +/* 79 */ +EXTERN Status XStringListToTextProperty( + char** list, + int count, + XTextProperty* text_prop_return); +/* 80 */ +EXTERN int XDrawSegments( + Display* display, + Drawable d, + GC gc, + XSegment* segments, + int nsegments); +/* 81 */ +EXTERN void XForceScreenSaver(Display* display, int mode); +/* 82 */ +EXTERN int +XDrawLine(Display* d, Drawable dr, GC g, int x1, int y1, int x2, int y2); +/* 83 */ +EXTERN int XFillRectangle( + Display* display, + Drawable d, + GC gc, + int x, + int y, + unsigned int width, + unsigned int height); +/* 84 */ +EXTERN void XClearWindow(Display* d, Window w); +/* 85 */ +EXTERN int XDrawPoint(Display* display, Drawable d, GC gc, int x, int y); +/* 86 */ +EXTERN int XDrawPoints( + Display* display, + Drawable d, + GC gc, + XPoint* points, + int npoints, + int mode); +/* 87 */ +EXTERN int XWarpPointer( + Display* display, + Window src_w, + Window dest_w, + int src_x, + int src_y, + unsigned int src_width, + unsigned int src_height, + int dest_x, + int dest_y); +/* 88 */ +EXTERN void +XQueryColor(Display* display, Colormap colormap, XColor* def_in_out); +/* 89 */ +EXTERN void XQueryColors( + Display* display, + Colormap colormap, + XColor* defs_in_out, + int ncolors); +/* 90 */ +EXTERN Status XQueryTree( + Display* d, + Window w1, + Window* w2, + Window* w3, + Window** w4, + unsigned int* ui); +/* 91 */ +EXTERN int XSync(Display* display, Bool flag); +#endif /* AQUA */ + +typedef struct TkIntXlibStubs { + int magic; + void* hooks; + +#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ + int (*xSetDashes)( + Display* display, + GC gc, + int dash_offset, + _Xconst char* dash_list, + int n); /* 0 */ + XModifierKeymap* (*xGetModifierMapping)(Display* d); /* 1 */ + XImage* (*xCreateImage)( + Display* d, + Visual* v, + unsigned int ui1, + int i1, + int i2, + char* cp, + unsigned int ui2, + unsigned int ui3, + int i3, + int i4); /* 2 */ + XImage* (*xGetImage)( + Display* d, + Drawable dr, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2, + unsigned long ul, + int i3); /* 3 */ + char* (*xGetAtomName)(Display* d, Atom a); /* 4 */ + char* (*xKeysymToString)(KeySym k); /* 5 */ + Colormap (*xCreateColormap)(Display* d, Window w, Visual* v, int i); /* 6 */ + Cursor (*xCreatePixmapCursor)( + Display* d, + Pixmap p1, + Pixmap p2, + XColor* x1, + XColor* x2, + unsigned int ui1, + unsigned int ui2); /* 7 */ + Cursor (*xCreateGlyphCursor)( + Display* d, + Font f1, + Font f2, + unsigned int ui1, + unsigned int ui2, + XColor _Xconst* x1, + XColor _Xconst* x2); /* 8 */ + GContext (*xGContextFromGC)(GC g); /* 9 */ + XHostAddress* (*xListHosts)(Display* d, int* i, Bool* b); /* 10 */ + KeySym (*xKeycodeToKeysym)(Display* d, unsigned int k, int i); /* 11 */ + KeySym (*xStringToKeysym)(_Xconst char* c); /* 12 */ + Window (*xRootWindow)(Display* d, int i); /* 13 */ + XErrorHandler (*xSetErrorHandler)(XErrorHandler x); /* 14 */ + Status (*xIconifyWindow)(Display* d, Window w, int i); /* 15 */ + Status (*xWithdrawWindow)(Display* d, Window w, int i); /* 16 */ + Status (*xGetWMColormapWindows)( + Display* d, + Window w, + Window** wpp, + int* ip); /* 17 */ + Status (*xAllocColor)(Display* d, Colormap c, XColor* xp); /* 18 */ + int (*xBell)(Display* d, int i); /* 19 */ + int (*xChangeProperty)( + Display* d, + Window w, + Atom a1, + Atom a2, + int i1, + int i2, + _Xconst unsigned char* c, + int i3); /* 20 */ + int (*xChangeWindowAttributes)( + Display* d, + Window w, + unsigned long ul, + XSetWindowAttributes* x); /* 21 */ + int (*xClearWindow)(Display* d, Window w); /* 22 */ + int (*xConfigureWindow)( + Display* d, + Window w, + unsigned int i, + XWindowChanges* x); /* 23 */ + int (*xCopyArea)( + Display* d, + Drawable dr1, + Drawable dr2, + GC g, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2, + int i3, + int i4); /* 24 */ + int (*xCopyPlane)( + Display* d, + Drawable dr1, + Drawable dr2, + GC g, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2, + int i3, + int i4, + unsigned long ul); /* 25 */ + Pixmap (*xCreateBitmapFromData)( + Display* display, + Drawable d, + _Xconst char* data, + unsigned int width, + unsigned int height); /* 26 */ + int (*xDefineCursor)(Display* d, Window w, Cursor c); /* 27 */ + int (*xDeleteProperty)(Display* d, Window w, Atom a); /* 28 */ + int (*xDestroyWindow)(Display* d, Window w); /* 29 */ + int (*xDrawArc)( + Display* d, + Drawable dr, + GC g, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2, + int i3, + int i4); /* 30 */ + int (*xDrawLines)( + Display* d, + Drawable dr, + GC g, + XPoint* x, + int i1, + int i2); /* 31 */ + int (*xDrawRectangle)( + Display* d, + Drawable dr, + GC g, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2); /* 32 */ + int (*xFillArc)( + Display* d, + Drawable dr, + GC g, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2, + int i3, + int i4); /* 33 */ + int (*xFillPolygon)( + Display* d, + Drawable dr, + GC g, + XPoint* x, + int i1, + int i2, + int i3); /* 34 */ + int (*xFillRectangles)( + Display* d, + Drawable dr, + GC g, + XRectangle* x, + int i); /* 35 */ + int (*xForceScreenSaver)(Display* d, int i); /* 36 */ + int (*xFreeColormap)(Display* d, Colormap c); /* 37 */ + int (*xFreeColors)( + Display* d, + Colormap c, + unsigned long* ulp, + int i, + unsigned long ul); /* 38 */ + int (*xFreeCursor)(Display* d, Cursor c); /* 39 */ + int (*xFreeModifiermap)(XModifierKeymap* x); /* 40 */ + Status (*xGetGeometry)( + Display* d, + Drawable dr, + Window* w, + int* i1, + int* i2, + unsigned int* ui1, + unsigned int* ui2, + unsigned int* ui3, + unsigned int* ui4); /* 41 */ + int (*xGetInputFocus)(Display* d, Window* w, int* i); /* 42 */ + int (*xGetWindowProperty)( + Display* d, + Window w, + Atom a1, + long l1, + long l2, + Bool b, + Atom a2, + Atom* ap, + int* ip, + unsigned long* ulp1, + unsigned long* ulp2, + unsigned char** cpp); /* 43 */ + Status (*xGetWindowAttributes)( + Display* d, + Window w, + XWindowAttributes* x); /* 44 */ + int (*xGrabKeyboard)( + Display* d, + Window w, + Bool b, + int i1, + int i2, + Time t); /* 45 */ + int (*xGrabPointer)( + Display* d, + Window w1, + Bool b, + unsigned int ui, + int i1, + int i2, + Window w2, + Cursor c, + Time t); /* 46 */ + KeyCode (*xKeysymToKeycode)(Display* d, KeySym k); /* 47 */ + Status (*xLookupColor)( + Display* d, + Colormap c1, + _Xconst char* c2, + XColor* x1, + XColor* x2); /* 48 */ + int (*xMapWindow)(Display* d, Window w); /* 49 */ + int (*xMoveResizeWindow)( + Display* d, + Window w, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2); /* 50 */ + int (*xMoveWindow)(Display* d, Window w, int i1, int i2); /* 51 */ + int (*xNextEvent)(Display* d, XEvent* x); /* 52 */ + int (*xPutBackEvent)(Display* d, XEvent* x); /* 53 */ + int (*xQueryColors)(Display* d, Colormap c, XColor* x, int i); /* 54 */ + Bool (*xQueryPointer)( + Display* d, + Window w1, + Window* w2, + Window* w3, + int* i1, + int* i2, + int* i3, + int* i4, + unsigned int* ui); /* 55 */ + Status (*xQueryTree)( + Display* d, + Window w1, + Window* w2, + Window* w3, + Window** w4, + unsigned int* ui); /* 56 */ + int (*xRaiseWindow)(Display* d, Window w); /* 57 */ + int (*xRefreshKeyboardMapping)(XMappingEvent* x); /* 58 */ + int (*xResizeWindow)( + Display* d, + Window w, + unsigned int ui1, + unsigned int ui2); /* 59 */ + int (*xSelectInput)(Display* d, Window w, long l); /* 60 */ + Status ( + *xSendEvent)(Display* d, Window w, Bool b, long l, XEvent* x); /* 61 */ + int (*xSetCommand)(Display* d, Window w, char** c, int i); /* 62 */ + int (*xSetIconName)(Display* d, Window w, _Xconst char* c); /* 63 */ + int (*xSetInputFocus)(Display* d, Window w, int i, Time t); /* 64 */ + int (*xSetSelectionOwner)(Display* d, Atom a, Window w, Time t); /* 65 */ + int (*xSetWindowBackground)(Display* d, Window w, unsigned long ul); /* 66 */ + int (*xSetWindowBackgroundPixmap)(Display* d, Window w, Pixmap p); /* 67 */ + int (*xSetWindowBorder)(Display* d, Window w, unsigned long ul); /* 68 */ + int (*xSetWindowBorderPixmap)(Display* d, Window w, Pixmap p); /* 69 */ + int (*xSetWindowBorderWidth)(Display* d, Window w, unsigned int ui); /* 70 */ + int (*xSetWindowColormap)(Display* d, Window w, Colormap c); /* 71 */ + Bool (*xTranslateCoordinates)( + Display* d, + Window w1, + Window w2, + int i1, + int i2, + int* i3, + int* i4, + Window* w3); /* 72 */ + int (*xUngrabKeyboard)(Display* d, Time t); /* 73 */ + int (*xUngrabPointer)(Display* d, Time t); /* 74 */ + int (*xUnmapWindow)(Display* d, Window w); /* 75 */ + int (*xWindowEvent)(Display* d, Window w, long l, XEvent* x); /* 76 */ + void (*xDestroyIC)(XIC x); /* 77 */ + Bool (*xFilterEvent)(XEvent* x, Window w); /* 78 */ + int (*xmbLookupString)( + XIC xi, + XKeyPressedEvent* xk, + char* c, + int i, + KeySym* k, + Status* s); /* 79 */ + int (*tkPutImage)( + unsigned long* colors, + int ncolors, + Display* display, + Drawable d, + GC gc, + XImage* image, + int src_x, + int src_y, + int dest_x, + int dest_y, + unsigned int width, + unsigned int height); /* 80 */ + void (*reserved81)(void); + Status (*xParseColor)( + Display* display, + Colormap map, + _Xconst char* spec, + XColor* colorPtr); /* 82 */ + GC (*xCreateGC) + (Display* display, + Drawable d, + unsigned long valuemask, + XGCValues* values); /* 83 */ + int (*xFreeGC)(Display* display, GC gc); /* 84 */ + Atom (*xInternAtom)( + Display* display, + _Xconst char* atom_name, + Bool only_if_exists); /* 85 */ + int (*xSetBackground)( + Display* display, + GC gc, + unsigned long foreground); /* 86 */ + int (*xSetForeground)( + Display* display, + GC gc, + unsigned long foreground); /* 87 */ + int (*xSetClipMask)(Display* display, GC gc, Pixmap pixmap); /* 88 */ + int (*xSetClipOrigin)( + Display* display, + GC gc, + int clip_x_origin, + int clip_y_origin); /* 89 */ + int (*xSetTSOrigin)( + Display* display, + GC gc, + int ts_x_origin, + int ts_y_origin); /* 90 */ + int (*xChangeGC)( + Display* d, + GC gc, + unsigned long mask, + XGCValues* values); /* 91 */ + int (*xSetFont)(Display* display, GC gc, Font font); /* 92 */ + int (*xSetArcMode)(Display* display, GC gc, int arc_mode); /* 93 */ + int (*xSetStipple)(Display* display, GC gc, Pixmap stipple); /* 94 */ + int (*xSetFillRule)(Display* display, GC gc, int fill_rule); /* 95 */ + int (*xSetFillStyle)(Display* display, GC gc, int fill_style); /* 96 */ + int (*xSetFunction)(Display* display, GC gc, int function); /* 97 */ + int (*xSetLineAttributes)( + Display* display, + GC gc, + unsigned int line_width, + int line_style, + int cap_style, + int join_style); /* 98 */ + int (*_XInitImageFuncPtrs)(XImage* image); /* 99 */ + XIC (*xCreateIC)(XIM xim, ...); /* 100 */ + XVisualInfo* (*xGetVisualInfo)( + Display* display, + long vinfo_mask, + XVisualInfo* vinfo_template, + int* nitems_return); /* 101 */ + void (*xSetWMClientMachine)( + Display* display, + Window w, + XTextProperty* text_prop); /* 102 */ + Status (*xStringListToTextProperty)( + char** list, + int count, + XTextProperty* text_prop_return); /* 103 */ + int (*xDrawLine)( + Display* d, + Drawable dr, + GC g, + int x1, + int y1, + int x2, + int y2); /* 104 */ + int (*xWarpPointer)( + Display* d, + Window s, + Window dw, + int sx, + int sy, + unsigned int sw, + unsigned int sh, + int dx, + int dy); /* 105 */ + int (*xFillRectangle)( + Display* display, + Drawable d, + GC gc, + int x, + int y, + unsigned int width, + unsigned int height); /* 106 */ + int (*xFlush)(Display* display); /* 107 */ + int (*xGrabServer)(Display* display); /* 108 */ + int (*xUngrabServer)(Display* display); /* 109 */ + int (*xFree)(void* data); /* 110 */ + int (*xNoOp)(Display* display); /* 111 */ + XAfterFunction (*xSynchronize)(Display* display, Bool onoff); /* 112 */ + int (*xSync)(Display* display, Bool discard); /* 113 */ + VisualID (*xVisualIDFromVisual)(Visual* visual); /* 114 */ + void (*reserved115)(void); + void (*reserved116)(void); + void (*reserved117)(void); + void (*reserved118)(void); + void (*reserved119)(void); + int (*xOffsetRegion)(Region rgn, int dx, int dy); /* 120 */ + int (*xUnionRegion)(Region srca, Region srcb, Region dr_return); /* 121 */ + Window (*xCreateWindow)( + Display* display, + Window parent, + int x, + int y, + unsigned int width, + unsigned int height, + unsigned int border_width, + int depth, + unsigned int clazz, + Visual* visual, + unsigned long value_mask, + XSetWindowAttributes* attributes); /* 122 */ + void (*reserved123)(void); + void (*reserved124)(void); + void (*reserved125)(void); + void (*reserved126)(void); + void (*reserved127)(void); + void (*reserved128)(void); + int (*xLowerWindow)(Display* d, Window w); /* 129 */ + int (*xFillArcs)(Display* d, Drawable dr, GC gc, XArc* a, int n); /* 130 */ + int (*xDrawArcs)(Display* d, Drawable dr, GC gc, XArc* a, int n); /* 131 */ + int (*xDrawRectangles)( + Display* d, + Drawable dr, + GC gc, + XRectangle* r, + int n); /* 132 */ + int (*xDrawSegments)( + Display* d, + Drawable dr, + GC gc, + XSegment* s, + int n); /* 133 */ + int (*xDrawPoint)(Display* d, Drawable dr, GC gc, int x, int y); /* 134 */ + int (*xDrawPoints)( + Display* d, + Drawable dr, + GC gc, + XPoint* p, + int n, + int m); /* 135 */ + int ( + *xReparentWindow)(Display* d, Window w, Window p, int x, int y); /* 136 */ + int (*xPutImage)( + Display* d, + Drawable dr, + GC gc, + XImage* im, + int sx, + int sy, + int dx, + int dy, + unsigned int w, + unsigned int h); /* 137 */ +#endif /* WIN */ +#ifdef MAC_OSX_TK /* AQUA */ + int (*xSetDashes)( + Display* display, + GC gc, + int dash_offset, + _Xconst char* dash_list, + int n); /* 0 */ + XModifierKeymap* (*xGetModifierMapping)(Display* d); /* 1 */ + XImage* (*xCreateImage)( + Display* d, + Visual* v, + unsigned int ui1, + int i1, + int i2, + char* cp, + unsigned int ui2, + unsigned int ui3, + int i3, + int i4); /* 2 */ + XImage* (*xGetImage)( + Display* d, + Drawable dr, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2, + unsigned long ul, + int i3); /* 3 */ + char* (*xGetAtomName)(Display* d, Atom a); /* 4 */ + char* (*xKeysymToString)(KeySym k); /* 5 */ + Colormap (*xCreateColormap)(Display* d, Window w, Visual* v, int i); /* 6 */ + GContext (*xGContextFromGC)(GC g); /* 7 */ + KeySym (*xKeycodeToKeysym)(Display* d, KeyCode k, int i); /* 8 */ + KeySym (*xStringToKeysym)(_Xconst char* c); /* 9 */ + Window (*xRootWindow)(Display* d, int i); /* 10 */ + XErrorHandler (*xSetErrorHandler)(XErrorHandler x); /* 11 */ + Status (*xAllocColor)(Display* d, Colormap c, XColor* xp); /* 12 */ + int (*xBell)(Display* d, int i); /* 13 */ + void (*xChangeProperty)( + Display* d, + Window w, + Atom a1, + Atom a2, + int i1, + int i2, + _Xconst unsigned char* c, + int i3); /* 14 */ + void (*xChangeWindowAttributes)( + Display* d, + Window w, + unsigned long ul, + XSetWindowAttributes* x); /* 15 */ + void (*xConfigureWindow)( + Display* d, + Window w, + unsigned int i, + XWindowChanges* x); /* 16 */ + void (*xCopyArea)( + Display* d, + Drawable dr1, + Drawable dr2, + GC g, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2, + int i3, + int i4); /* 17 */ + void (*xCopyPlane)( + Display* d, + Drawable dr1, + Drawable dr2, + GC g, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2, + int i3, + int i4, + unsigned long ul); /* 18 */ + Pixmap (*xCreateBitmapFromData)( + Display* display, + Drawable d, + _Xconst char* data, + unsigned int width, + unsigned int height); /* 19 */ + int (*xDefineCursor)(Display* d, Window w, Cursor c); /* 20 */ + void (*xDestroyWindow)(Display* d, Window w); /* 21 */ + void (*xDrawArc)( + Display* d, + Drawable dr, + GC g, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2, + int i3, + int i4); /* 22 */ + int (*xDrawLines)( + Display* d, + Drawable dr, + GC g, + XPoint* x, + int i1, + int i2); /* 23 */ + void (*xDrawRectangle)( + Display* d, + Drawable dr, + GC g, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2); /* 24 */ + void (*xFillArc)( + Display* d, + Drawable dr, + GC g, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2, + int i3, + int i4); /* 25 */ + void (*xFillPolygon)( + Display* d, + Drawable dr, + GC g, + XPoint* x, + int i1, + int i2, + int i3); /* 26 */ + int (*xFillRectangles)( + Display* d, + Drawable dr, + GC g, + XRectangle* x, + int i); /* 27 */ + int (*xFreeColormap)(Display* d, Colormap c); /* 28 */ + int (*xFreeColors)( + Display* d, + Colormap c, + unsigned long* ulp, + int i, + unsigned long ul); /* 29 */ + int (*xFreeModifiermap)(XModifierKeymap* x); /* 30 */ + Status (*xGetGeometry)( + Display* d, + Drawable dr, + Window* w, + int* i1, + int* i2, + unsigned int* ui1, + unsigned int* ui2, + unsigned int* ui3, + unsigned int* ui4); /* 31 */ + int (*xGetWindowProperty)( + Display* d, + Window w, + Atom a1, + long l1, + long l2, + Bool b, + Atom a2, + Atom* ap, + int* ip, + unsigned long* ulp1, + unsigned long* ulp2, + unsigned char** cpp); /* 32 */ + int (*xGrabKeyboard)( + Display* d, + Window w, + Bool b, + int i1, + int i2, + Time t); /* 33 */ + int (*xGrabPointer)( + Display* d, + Window w1, + Bool b, + unsigned int ui, + int i1, + int i2, + Window w2, + Cursor c, + Time t); /* 34 */ + KeyCode (*xKeysymToKeycode)(Display* d, KeySym k); /* 35 */ + void (*xMapWindow)(Display* d, Window w); /* 36 */ + void (*xMoveResizeWindow)( + Display* d, + Window w, + int i1, + int i2, + unsigned int ui1, + unsigned int ui2); /* 37 */ + void (*xMoveWindow)(Display* d, Window w, int i1, int i2); /* 38 */ + Bool (*xQueryPointer)( + Display* d, + Window w1, + Window* w2, + Window* w3, + int* i1, + int* i2, + int* i3, + int* i4, + unsigned int* ui); /* 39 */ + void (*xRaiseWindow)(Display* d, Window w); /* 40 */ + void (*xRefreshKeyboardMapping)(XMappingEvent* x); /* 41 */ + void (*xResizeWindow)( + Display* d, + Window w, + unsigned int ui1, + unsigned int ui2); /* 42 */ + void (*xSelectInput)(Display* d, Window w, long l); /* 43 */ + Status ( + *xSendEvent)(Display* d, Window w, Bool b, long l, XEvent* x); /* 44 */ + void (*xSetIconName)(Display* d, Window w, _Xconst char* c); /* 45 */ + void (*xSetInputFocus)(Display* d, Window w, int i, Time t); /* 46 */ + int (*xSetSelectionOwner)(Display* d, Atom a, Window w, Time t); /* 47 */ + void (*xSetWindowBackground)(Display* d, Window w, unsigned long ul); /* 48 */ + void (*xSetWindowBackgroundPixmap)(Display* d, Window w, Pixmap p); /* 49 */ + void (*xSetWindowBorder)(Display* d, Window w, unsigned long ul); /* 50 */ + void (*xSetWindowBorderPixmap)(Display* d, Window w, Pixmap p); /* 51 */ + void (*xSetWindowBorderWidth)(Display* d, Window w, unsigned int ui); /* 52 */ + void (*xSetWindowColormap)(Display* d, Window w, Colormap c); /* 53 */ + void (*xUngrabKeyboard)(Display* d, Time t); /* 54 */ + int (*xUngrabPointer)(Display* d, Time t); /* 55 */ + void (*xUnmapWindow)(Display* d, Window w); /* 56 */ + int (*tkPutImage)( + unsigned long* colors, + int ncolors, + Display* display, + Drawable d, + GC gc, + XImage* image, + int src_x, + int src_y, + int dest_x, + int dest_y, + unsigned int width, + unsigned int height); /* 57 */ + Status (*xParseColor)( + Display* display, + Colormap map, + _Xconst char* spec, + XColor* colorPtr); /* 58 */ + GC (*xCreateGC) + (Display* display, + Drawable d, + unsigned long valuemask, + XGCValues* values); /* 59 */ + int (*xFreeGC)(Display* display, GC gc); /* 60 */ + Atom (*xInternAtom)( + Display* display, + _Xconst char* atom_name, + Bool only_if_exists); /* 61 */ + int (*xSetBackground)( + Display* display, + GC gc, + unsigned long foreground); /* 62 */ + int (*xSetForeground)( + Display* display, + GC gc, + unsigned long foreground); /* 63 */ + int (*xSetClipMask)(Display* display, GC gc, Pixmap pixmap); /* 64 */ + int (*xSetClipOrigin)( + Display* display, + GC gc, + int clip_x_origin, + int clip_y_origin); /* 65 */ + int (*xSetTSOrigin)( + Display* display, + GC gc, + int ts_x_origin, + int ts_y_origin); /* 66 */ + int (*xChangeGC)( + Display* d, + GC gc, + unsigned long mask, + XGCValues* values); /* 67 */ + int (*xSetFont)(Display* display, GC gc, Font font); /* 68 */ + int (*xSetArcMode)(Display* display, GC gc, int arc_mode); /* 69 */ + int (*xSetStipple)(Display* display, GC gc, Pixmap stipple); /* 70 */ + int (*xSetFillRule)(Display* display, GC gc, int fill_rule); /* 71 */ + int (*xSetFillStyle)(Display* display, GC gc, int fill_style); /* 72 */ + int (*xSetFunction)(Display* display, GC gc, int function); /* 73 */ + int (*xSetLineAttributes)( + Display* display, + GC gc, + unsigned int line_width, + int line_style, + int cap_style, + int join_style); /* 74 */ + int (*_XInitImageFuncPtrs)(XImage* image); /* 75 */ + XIC (*xCreateIC)(void); /* 76 */ + XVisualInfo* (*xGetVisualInfo)( + Display* display, + long vinfo_mask, + XVisualInfo* vinfo_template, + int* nitems_return); /* 77 */ + void (*xSetWMClientMachine)( + Display* display, + Window w, + XTextProperty* text_prop); /* 78 */ + Status (*xStringListToTextProperty)( + char** list, + int count, + XTextProperty* text_prop_return); /* 79 */ + int (*xDrawSegments)( + Display* display, + Drawable d, + GC gc, + XSegment* segments, + int nsegments); /* 80 */ + void (*xForceScreenSaver)(Display* display, int mode); /* 81 */ + int (*xDrawLine)( + Display* d, + Drawable dr, + GC g, + int x1, + int y1, + int x2, + int y2); /* 82 */ + int (*xFillRectangle)( + Display* display, + Drawable d, + GC gc, + int x, + int y, + unsigned int width, + unsigned int height); /* 83 */ + void (*xClearWindow)(Display* d, Window w); /* 84 */ + int (*xDrawPoint)(Display* display, Drawable d, GC gc, int x, int y); /* 85 */ + int (*xDrawPoints)( + Display* display, + Drawable d, + GC gc, + XPoint* points, + int npoints, + int mode); /* 86 */ + int (*xWarpPointer)( + Display* display, + Window src_w, + Window dest_w, + int src_x, + int src_y, + unsigned int src_width, + unsigned int src_height, + int dest_x, + int dest_y); /* 87 */ + void (*xQueryColor)( + Display* display, + Colormap colormap, + XColor* def_in_out); /* 88 */ + void (*xQueryColors)( + Display* display, + Colormap colormap, + XColor* defs_in_out, + int ncolors); /* 89 */ + Status (*xQueryTree)( + Display* d, + Window w1, + Window* w2, + Window* w3, + Window** w4, + unsigned int* ui); /* 90 */ + int (*xSync)(Display* display, Bool flag); /* 91 */ +#endif /* AQUA */ +} TkIntXlibStubs; + +extern const TkIntXlibStubs* tkIntXlibStubsPtr; + +#ifdef __cplusplus +} +#endif + +#if defined(USE_TK_STUBS) + +/* + * Inline function declarations: + */ + +#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ +#define XSetDashes (tkIntXlibStubsPtr->xSetDashes) /* 0 */ +#define XGetModifierMapping (tkIntXlibStubsPtr->xGetModifierMapping) /* 1 */ +#define XCreateImage (tkIntXlibStubsPtr->xCreateImage) /* 2 */ +#define XGetImage (tkIntXlibStubsPtr->xGetImage) /* 3 */ +#define XGetAtomName (tkIntXlibStubsPtr->xGetAtomName) /* 4 */ +#define XKeysymToString (tkIntXlibStubsPtr->xKeysymToString) /* 5 */ +#define XCreateColormap (tkIntXlibStubsPtr->xCreateColormap) /* 6 */ +#define XCreatePixmapCursor (tkIntXlibStubsPtr->xCreatePixmapCursor) /* 7 */ +#define XCreateGlyphCursor (tkIntXlibStubsPtr->xCreateGlyphCursor) /* 8 */ +#define XGContextFromGC (tkIntXlibStubsPtr->xGContextFromGC) /* 9 */ +#define XListHosts (tkIntXlibStubsPtr->xListHosts) /* 10 */ +#define XKeycodeToKeysym (tkIntXlibStubsPtr->xKeycodeToKeysym) /* 11 */ +#define XStringToKeysym (tkIntXlibStubsPtr->xStringToKeysym) /* 12 */ +#define XRootWindow (tkIntXlibStubsPtr->xRootWindow) /* 13 */ +#define XSetErrorHandler (tkIntXlibStubsPtr->xSetErrorHandler) /* 14 */ +#define XIconifyWindow (tkIntXlibStubsPtr->xIconifyWindow) /* 15 */ +#define XWithdrawWindow (tkIntXlibStubsPtr->xWithdrawWindow) /* 16 */ +#define XGetWMColormapWindows \ + (tkIntXlibStubsPtr->xGetWMColormapWindows) /* 17 */ +#define XAllocColor (tkIntXlibStubsPtr->xAllocColor) /* 18 */ +#define XBell (tkIntXlibStubsPtr->xBell) /* 19 */ +#define XChangeProperty (tkIntXlibStubsPtr->xChangeProperty) /* 20 */ +#define XChangeWindowAttributes \ + (tkIntXlibStubsPtr->xChangeWindowAttributes) /* 21 */ +#define XClearWindow (tkIntXlibStubsPtr->xClearWindow) /* 22 */ +#define XConfigureWindow (tkIntXlibStubsPtr->xConfigureWindow) /* 23 */ +#define XCopyArea (tkIntXlibStubsPtr->xCopyArea) /* 24 */ +#define XCopyPlane (tkIntXlibStubsPtr->xCopyPlane) /* 25 */ +#define XCreateBitmapFromData \ + (tkIntXlibStubsPtr->xCreateBitmapFromData) /* 26 */ +#define XDefineCursor (tkIntXlibStubsPtr->xDefineCursor) /* 27 */ +#define XDeleteProperty (tkIntXlibStubsPtr->xDeleteProperty) /* 28 */ +#define XDestroyWindow (tkIntXlibStubsPtr->xDestroyWindow) /* 29 */ +#define XDrawArc (tkIntXlibStubsPtr->xDrawArc) /* 30 */ +#define XDrawLines (tkIntXlibStubsPtr->xDrawLines) /* 31 */ +#define XDrawRectangle (tkIntXlibStubsPtr->xDrawRectangle) /* 32 */ +#define XFillArc (tkIntXlibStubsPtr->xFillArc) /* 33 */ +#define XFillPolygon (tkIntXlibStubsPtr->xFillPolygon) /* 34 */ +#define XFillRectangles (tkIntXlibStubsPtr->xFillRectangles) /* 35 */ +#define XForceScreenSaver (tkIntXlibStubsPtr->xForceScreenSaver) /* 36 */ +#define XFreeColormap (tkIntXlibStubsPtr->xFreeColormap) /* 37 */ +#define XFreeColors (tkIntXlibStubsPtr->xFreeColors) /* 38 */ +#define XFreeCursor (tkIntXlibStubsPtr->xFreeCursor) /* 39 */ +#define XFreeModifiermap (tkIntXlibStubsPtr->xFreeModifiermap) /* 40 */ +#define XGetGeometry (tkIntXlibStubsPtr->xGetGeometry) /* 41 */ +#define XGetInputFocus (tkIntXlibStubsPtr->xGetInputFocus) /* 42 */ +#define XGetWindowProperty (tkIntXlibStubsPtr->xGetWindowProperty) /* 43 */ +#define XGetWindowAttributes (tkIntXlibStubsPtr->xGetWindowAttributes) /* 44 \ + */ +#define XGrabKeyboard (tkIntXlibStubsPtr->xGrabKeyboard) /* 45 */ +#define XGrabPointer (tkIntXlibStubsPtr->xGrabPointer) /* 46 */ +#define XKeysymToKeycode (tkIntXlibStubsPtr->xKeysymToKeycode) /* 47 */ +#define XLookupColor (tkIntXlibStubsPtr->xLookupColor) /* 48 */ +#define XMapWindow (tkIntXlibStubsPtr->xMapWindow) /* 49 */ +#define XMoveResizeWindow (tkIntXlibStubsPtr->xMoveResizeWindow) /* 50 */ +#define XMoveWindow (tkIntXlibStubsPtr->xMoveWindow) /* 51 */ +#define XNextEvent (tkIntXlibStubsPtr->xNextEvent) /* 52 */ +#define XPutBackEvent (tkIntXlibStubsPtr->xPutBackEvent) /* 53 */ +#define XQueryColors (tkIntXlibStubsPtr->xQueryColors) /* 54 */ +#define XQueryPointer (tkIntXlibStubsPtr->xQueryPointer) /* 55 */ +#define XQueryTree (tkIntXlibStubsPtr->xQueryTree) /* 56 */ +#define XRaiseWindow (tkIntXlibStubsPtr->xRaiseWindow) /* 57 */ +#define XRefreshKeyboardMapping \ + (tkIntXlibStubsPtr->xRefreshKeyboardMapping) /* 58 */ +#define XResizeWindow (tkIntXlibStubsPtr->xResizeWindow) /* 59 */ +#define XSelectInput (tkIntXlibStubsPtr->xSelectInput) /* 60 */ +#define XSendEvent (tkIntXlibStubsPtr->xSendEvent) /* 61 */ +#define XSetCommand (tkIntXlibStubsPtr->xSetCommand) /* 62 */ +#define XSetIconName (tkIntXlibStubsPtr->xSetIconName) /* 63 */ +#define XSetInputFocus (tkIntXlibStubsPtr->xSetInputFocus) /* 64 */ +#define XSetSelectionOwner (tkIntXlibStubsPtr->xSetSelectionOwner) /* 65 */ +#define XSetWindowBackground (tkIntXlibStubsPtr->xSetWindowBackground) /* 66 \ + */ +#define XSetWindowBackgroundPixmap \ + (tkIntXlibStubsPtr->xSetWindowBackgroundPixmap) /* 67 */ +#define XSetWindowBorder (tkIntXlibStubsPtr->xSetWindowBorder) /* 68 */ +#define XSetWindowBorderPixmap \ + (tkIntXlibStubsPtr->xSetWindowBorderPixmap) /* 69 */ +#define XSetWindowBorderWidth \ + (tkIntXlibStubsPtr->xSetWindowBorderWidth) /* 70 */ +#define XSetWindowColormap (tkIntXlibStubsPtr->xSetWindowColormap) /* 71 */ +#define XTranslateCoordinates \ + (tkIntXlibStubsPtr->xTranslateCoordinates) /* 72 */ +#define XUngrabKeyboard (tkIntXlibStubsPtr->xUngrabKeyboard) /* 73 */ +#define XUngrabPointer (tkIntXlibStubsPtr->xUngrabPointer) /* 74 */ +#define XUnmapWindow (tkIntXlibStubsPtr->xUnmapWindow) /* 75 */ +#define XWindowEvent (tkIntXlibStubsPtr->xWindowEvent) /* 76 */ +#define XDestroyIC (tkIntXlibStubsPtr->xDestroyIC) /* 77 */ +#define XFilterEvent (tkIntXlibStubsPtr->xFilterEvent) /* 78 */ +#define XmbLookupString (tkIntXlibStubsPtr->xmbLookupString) /* 79 */ +#define TkPutImage (tkIntXlibStubsPtr->tkPutImage) /* 80 */ +/* Slot 81 is reserved */ +#define XParseColor (tkIntXlibStubsPtr->xParseColor) /* 82 */ +#define XCreateGC (tkIntXlibStubsPtr->xCreateGC) /* 83 */ +#define XFreeGC (tkIntXlibStubsPtr->xFreeGC) /* 84 */ +#define XInternAtom (tkIntXlibStubsPtr->xInternAtom) /* 85 */ +#define XSetBackground (tkIntXlibStubsPtr->xSetBackground) /* 86 */ +#define XSetForeground (tkIntXlibStubsPtr->xSetForeground) /* 87 */ +#define XSetClipMask (tkIntXlibStubsPtr->xSetClipMask) /* 88 */ +#define XSetClipOrigin (tkIntXlibStubsPtr->xSetClipOrigin) /* 89 */ +#define XSetTSOrigin (tkIntXlibStubsPtr->xSetTSOrigin) /* 90 */ +#define XChangeGC (tkIntXlibStubsPtr->xChangeGC) /* 91 */ +#define XSetFont (tkIntXlibStubsPtr->xSetFont) /* 92 */ +#define XSetArcMode (tkIntXlibStubsPtr->xSetArcMode) /* 93 */ +#define XSetStipple (tkIntXlibStubsPtr->xSetStipple) /* 94 */ +#define XSetFillRule (tkIntXlibStubsPtr->xSetFillRule) /* 95 */ +#define XSetFillStyle (tkIntXlibStubsPtr->xSetFillStyle) /* 96 */ +#define XSetFunction (tkIntXlibStubsPtr->xSetFunction) /* 97 */ +#define XSetLineAttributes (tkIntXlibStubsPtr->xSetLineAttributes) /* 98 */ +#define _XInitImageFuncPtrs (tkIntXlibStubsPtr->_XInitImageFuncPtrs) /* 99 */ +#define XCreateIC (tkIntXlibStubsPtr->xCreateIC) /* 100 */ +#define XGetVisualInfo (tkIntXlibStubsPtr->xGetVisualInfo) /* 101 */ +#define XSetWMClientMachine (tkIntXlibStubsPtr->xSetWMClientMachine) /* 102 */ +#define XStringListToTextProperty \ + (tkIntXlibStubsPtr->xStringListToTextProperty) /* 103 */ +#define XDrawLine (tkIntXlibStubsPtr->xDrawLine) /* 104 */ +#define XWarpPointer (tkIntXlibStubsPtr->xWarpPointer) /* 105 */ +#define XFillRectangle (tkIntXlibStubsPtr->xFillRectangle) /* 106 */ +#define XFlush (tkIntXlibStubsPtr->xFlush) /* 107 */ +#define XGrabServer (tkIntXlibStubsPtr->xGrabServer) /* 108 */ +#define XUngrabServer (tkIntXlibStubsPtr->xUngrabServer) /* 109 */ +#define XFree (tkIntXlibStubsPtr->xFree) /* 110 */ +#define XNoOp (tkIntXlibStubsPtr->xNoOp) /* 111 */ +#define XSynchronize (tkIntXlibStubsPtr->xSynchronize) /* 112 */ +#define XSync (tkIntXlibStubsPtr->xSync) /* 113 */ +#define XVisualIDFromVisual (tkIntXlibStubsPtr->xVisualIDFromVisual) /* 114 */ +/* Slot 115 is reserved */ +/* Slot 116 is reserved */ +/* Slot 117 is reserved */ +/* Slot 118 is reserved */ +/* Slot 119 is reserved */ +#define XOffsetRegion (tkIntXlibStubsPtr->xOffsetRegion) /* 120 */ +#define XUnionRegion (tkIntXlibStubsPtr->xUnionRegion) /* 121 */ +#define XCreateWindow (tkIntXlibStubsPtr->xCreateWindow) /* 122 */ +/* Slot 123 is reserved */ +/* Slot 124 is reserved */ +/* Slot 125 is reserved */ +/* Slot 126 is reserved */ +/* Slot 127 is reserved */ +/* Slot 128 is reserved */ +#define XLowerWindow (tkIntXlibStubsPtr->xLowerWindow) /* 129 */ +#define XFillArcs (tkIntXlibStubsPtr->xFillArcs) /* 130 */ +#define XDrawArcs (tkIntXlibStubsPtr->xDrawArcs) /* 131 */ +#define XDrawRectangles (tkIntXlibStubsPtr->xDrawRectangles) /* 132 */ +#define XDrawSegments (tkIntXlibStubsPtr->xDrawSegments) /* 133 */ +#define XDrawPoint (tkIntXlibStubsPtr->xDrawPoint) /* 134 */ +#define XDrawPoints (tkIntXlibStubsPtr->xDrawPoints) /* 135 */ +#define XReparentWindow (tkIntXlibStubsPtr->xReparentWindow) /* 136 */ +#define XPutImage (tkIntXlibStubsPtr->xPutImage) /* 137 */ +#endif /* WIN */ +#ifdef MAC_OSX_TK /* AQUA */ +#define XSetDashes (tkIntXlibStubsPtr->xSetDashes) /* 0 */ +#define XGetModifierMapping (tkIntXlibStubsPtr->xGetModifierMapping) /* 1 */ +#define XCreateImage (tkIntXlibStubsPtr->xCreateImage) /* 2 */ +#define XGetImage (tkIntXlibStubsPtr->xGetImage) /* 3 */ +#define XGetAtomName (tkIntXlibStubsPtr->xGetAtomName) /* 4 */ +#define XKeysymToString (tkIntXlibStubsPtr->xKeysymToString) /* 5 */ +#define XCreateColormap (tkIntXlibStubsPtr->xCreateColormap) /* 6 */ +#define XGContextFromGC (tkIntXlibStubsPtr->xGContextFromGC) /* 7 */ +#define XKeycodeToKeysym (tkIntXlibStubsPtr->xKeycodeToKeysym) /* 8 */ +#define XStringToKeysym (tkIntXlibStubsPtr->xStringToKeysym) /* 9 */ +#define XRootWindow (tkIntXlibStubsPtr->xRootWindow) /* 10 */ +#define XSetErrorHandler (tkIntXlibStubsPtr->xSetErrorHandler) /* 11 */ +#define XAllocColor (tkIntXlibStubsPtr->xAllocColor) /* 12 */ +#define XBell (tkIntXlibStubsPtr->xBell) /* 13 */ +#define XChangeProperty (tkIntXlibStubsPtr->xChangeProperty) /* 14 */ +#define XChangeWindowAttributes \ + (tkIntXlibStubsPtr->xChangeWindowAttributes) /* 15 */ +#define XConfigureWindow (tkIntXlibStubsPtr->xConfigureWindow) /* 16 */ +#define XCopyArea (tkIntXlibStubsPtr->xCopyArea) /* 17 */ +#define XCopyPlane (tkIntXlibStubsPtr->xCopyPlane) /* 18 */ +#define XCreateBitmapFromData \ + (tkIntXlibStubsPtr->xCreateBitmapFromData) /* 19 */ +#define XDefineCursor (tkIntXlibStubsPtr->xDefineCursor) /* 20 */ +#define XDestroyWindow (tkIntXlibStubsPtr->xDestroyWindow) /* 21 */ +#define XDrawArc (tkIntXlibStubsPtr->xDrawArc) /* 22 */ +#define XDrawLines (tkIntXlibStubsPtr->xDrawLines) /* 23 */ +#define XDrawRectangle (tkIntXlibStubsPtr->xDrawRectangle) /* 24 */ +#define XFillArc (tkIntXlibStubsPtr->xFillArc) /* 25 */ +#define XFillPolygon (tkIntXlibStubsPtr->xFillPolygon) /* 26 */ +#define XFillRectangles (tkIntXlibStubsPtr->xFillRectangles) /* 27 */ +#define XFreeColormap (tkIntXlibStubsPtr->xFreeColormap) /* 28 */ +#define XFreeColors (tkIntXlibStubsPtr->xFreeColors) /* 29 */ +#define XFreeModifiermap (tkIntXlibStubsPtr->xFreeModifiermap) /* 30 */ +#define XGetGeometry (tkIntXlibStubsPtr->xGetGeometry) /* 31 */ +#define XGetWindowProperty (tkIntXlibStubsPtr->xGetWindowProperty) /* 32 */ +#define XGrabKeyboard (tkIntXlibStubsPtr->xGrabKeyboard) /* 33 */ +#define XGrabPointer (tkIntXlibStubsPtr->xGrabPointer) /* 34 */ +#define XKeysymToKeycode (tkIntXlibStubsPtr->xKeysymToKeycode) /* 35 */ +#define XMapWindow (tkIntXlibStubsPtr->xMapWindow) /* 36 */ +#define XMoveResizeWindow (tkIntXlibStubsPtr->xMoveResizeWindow) /* 37 */ +#define XMoveWindow (tkIntXlibStubsPtr->xMoveWindow) /* 38 */ +#define XQueryPointer (tkIntXlibStubsPtr->xQueryPointer) /* 39 */ +#define XRaiseWindow (tkIntXlibStubsPtr->xRaiseWindow) /* 40 */ +#define XRefreshKeyboardMapping \ + (tkIntXlibStubsPtr->xRefreshKeyboardMapping) /* 41 */ +#define XResizeWindow (tkIntXlibStubsPtr->xResizeWindow) /* 42 */ +#define XSelectInput (tkIntXlibStubsPtr->xSelectInput) /* 43 */ +#define XSendEvent (tkIntXlibStubsPtr->xSendEvent) /* 44 */ +#define XSetIconName (tkIntXlibStubsPtr->xSetIconName) /* 45 */ +#define XSetInputFocus (tkIntXlibStubsPtr->xSetInputFocus) /* 46 */ +#define XSetSelectionOwner (tkIntXlibStubsPtr->xSetSelectionOwner) /* 47 */ +#define XSetWindowBackground (tkIntXlibStubsPtr->xSetWindowBackground) /* 48 \ + */ +#define XSetWindowBackgroundPixmap \ + (tkIntXlibStubsPtr->xSetWindowBackgroundPixmap) /* 49 */ +#define XSetWindowBorder (tkIntXlibStubsPtr->xSetWindowBorder) /* 50 */ +#define XSetWindowBorderPixmap \ + (tkIntXlibStubsPtr->xSetWindowBorderPixmap) /* 51 */ +#define XSetWindowBorderWidth \ + (tkIntXlibStubsPtr->xSetWindowBorderWidth) /* 52 */ +#define XSetWindowColormap (tkIntXlibStubsPtr->xSetWindowColormap) /* 53 */ +#define XUngrabKeyboard (tkIntXlibStubsPtr->xUngrabKeyboard) /* 54 */ +#define XUngrabPointer (tkIntXlibStubsPtr->xUngrabPointer) /* 55 */ +#define XUnmapWindow (tkIntXlibStubsPtr->xUnmapWindow) /* 56 */ +#define TkPutImage (tkIntXlibStubsPtr->tkPutImage) /* 57 */ +#define XParseColor (tkIntXlibStubsPtr->xParseColor) /* 58 */ +#define XCreateGC (tkIntXlibStubsPtr->xCreateGC) /* 59 */ +#define XFreeGC (tkIntXlibStubsPtr->xFreeGC) /* 60 */ +#define XInternAtom (tkIntXlibStubsPtr->xInternAtom) /* 61 */ +#define XSetBackground (tkIntXlibStubsPtr->xSetBackground) /* 62 */ +#define XSetForeground (tkIntXlibStubsPtr->xSetForeground) /* 63 */ +#define XSetClipMask (tkIntXlibStubsPtr->xSetClipMask) /* 64 */ +#define XSetClipOrigin (tkIntXlibStubsPtr->xSetClipOrigin) /* 65 */ +#define XSetTSOrigin (tkIntXlibStubsPtr->xSetTSOrigin) /* 66 */ +#define XChangeGC (tkIntXlibStubsPtr->xChangeGC) /* 67 */ +#define XSetFont (tkIntXlibStubsPtr->xSetFont) /* 68 */ +#define XSetArcMode (tkIntXlibStubsPtr->xSetArcMode) /* 69 */ +#define XSetStipple (tkIntXlibStubsPtr->xSetStipple) /* 70 */ +#define XSetFillRule (tkIntXlibStubsPtr->xSetFillRule) /* 71 */ +#define XSetFillStyle (tkIntXlibStubsPtr->xSetFillStyle) /* 72 */ +#define XSetFunction (tkIntXlibStubsPtr->xSetFunction) /* 73 */ +#define XSetLineAttributes (tkIntXlibStubsPtr->xSetLineAttributes) /* 74 */ +#define _XInitImageFuncPtrs (tkIntXlibStubsPtr->_XInitImageFuncPtrs) /* 75 */ +#define XCreateIC (tkIntXlibStubsPtr->xCreateIC) /* 76 */ +#define XGetVisualInfo (tkIntXlibStubsPtr->xGetVisualInfo) /* 77 */ +#define XSetWMClientMachine (tkIntXlibStubsPtr->xSetWMClientMachine) /* 78 */ +#define XStringListToTextProperty \ + (tkIntXlibStubsPtr->xStringListToTextProperty) /* 79 */ +#define XDrawSegments (tkIntXlibStubsPtr->xDrawSegments) /* 80 */ +#define XForceScreenSaver (tkIntXlibStubsPtr->xForceScreenSaver) /* 81 */ +#define XDrawLine (tkIntXlibStubsPtr->xDrawLine) /* 82 */ +#define XFillRectangle (tkIntXlibStubsPtr->xFillRectangle) /* 83 */ +#define XClearWindow (tkIntXlibStubsPtr->xClearWindow) /* 84 */ +#define XDrawPoint (tkIntXlibStubsPtr->xDrawPoint) /* 85 */ +#define XDrawPoints (tkIntXlibStubsPtr->xDrawPoints) /* 86 */ +#define XWarpPointer (tkIntXlibStubsPtr->xWarpPointer) /* 87 */ +#define XQueryColor (tkIntXlibStubsPtr->xQueryColor) /* 88 */ +#define XQueryColors (tkIntXlibStubsPtr->xQueryColors) /* 89 */ +#define XQueryTree (tkIntXlibStubsPtr->xQueryTree) /* 90 */ +#define XSync (tkIntXlibStubsPtr->xSync) /* 91 */ +#endif /* AQUA */ + +#endif /* defined(USE_TK_STUBS) */ + +/* !END!: Do not edit above this line. */ + +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLIMPORT + +#endif /* _TKINTXLIBDECLS */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkMenu.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkMenu.h new file mode 100644 index 0000000..e0b95b9 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkMenu.h @@ -0,0 +1,572 @@ +/* + * tkMenu.h -- + * + * Declarations shared among all of the files that implement menu + * widgets. + * + * Copyright (c) 1996-1998 by Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TKMENU +#define _TKMENU + +#ifndef _TK +#include "tk.h" +#endif + +#ifndef _TKINT +#include "tkInt.h" +#endif + +#ifndef _DEFAULT +#include "default.h" +#endif + +/* + * Dummy types used by the platform menu code. + */ + +typedef struct TkMenuPlatformData_* TkMenuPlatformData; +typedef struct TkMenuPlatformEntryData_* TkMenuPlatformEntryData; + +/* + * Legal values for the "compound" field of TkMenuEntry and TkMenuButton + * records. + */ + +enum compound { + COMPOUND_BOTTOM, + COMPOUND_CENTER, + COMPOUND_LEFT, + COMPOUND_NONE, + COMPOUND_RIGHT, + COMPOUND_TOP +}; + +/* + * Additional menu entry drawing parameters for Windows platform. + * DRAW_MENU_ENTRY_ARROW makes TkpDrawMenuEntry draw the arrow + * itself when cascade entry is disabled. + * DRAW_MENU_ENTRY_NOUNDERLINE forbids underline when ODS_NOACCEL + * is set, thus obeying the system-wide Windows UI setting. + */ + +enum drawingParameters { + DRAW_MENU_ENTRY_ARROW = (1 << 0), + DRAW_MENU_ENTRY_NOUNDERLINE = (1 << 1) +}; + +/* + * One of the following data structures is kept for each entry of each menu + * managed by this file: + */ + +typedef struct TkMenuEntry { + int type; /* Type of menu entry; see below for valid + * types. */ + struct TkMenu* menuPtr; /* Menu with which this entry is + * associated. */ + Tk_OptionTable optionTable; /* Option table for this menu entry. */ + Tcl_Obj* labelPtr; /* Main text label displayed in entry (NULL if + * no label). */ + int labelLength; /* Number of non-NULL characters in label. */ + int state; /* State of button for display purposes: + * normal, active, or disabled. */ + int underline; /* Value of -underline option: specifies index + * of character to underline (<0 means don't + * underline anything). */ + Tcl_Obj* underlinePtr; /* Index of character to underline. */ + Tcl_Obj* bitmapPtr; /* Bitmap to display in menu entry, or None. + * If not None then label is ignored. */ + Tcl_Obj* imagePtr; /* Name of image to display, or NULL. If not + * NULL, bitmap, text, and textVarName are + * ignored. */ + Tk_Image image; /* Image to display in menu entry, or NULL if + * none. */ + Tcl_Obj* selectImagePtr; /* Name of image to display when selected, or + * NULL. */ + Tk_Image selectImage; /* Image to display in entry when selected, or + * NULL if none. Ignored if image is NULL. */ + Tcl_Obj* accelPtr; /* Accelerator string displayed at right of + * menu entry. NULL means no such accelerator. + * Malloc'ed. */ + int accelLength; /* Number of non-NULL characters in + * accelerator. */ + int indicatorOn; /* True means draw indicator, false means + * don't draw it. This field is ignored unless + * the entry is a radio or check button. */ + /* + * Display attributes + */ + + Tcl_Obj* borderPtr; /* Structure used to draw background for + * entry. NULL means use overall border for + * menu. */ + Tcl_Obj* fgPtr; /* Foreground color to use for entry. NULL + * means use foreground color from menu. */ + Tcl_Obj* activeBorderPtr; /* Used to draw background and border when + * element is active. NULL means use + * activeBorder from menu. */ + Tcl_Obj* activeFgPtr; /* Foreground color to use when entry is + * active. NULL means use active foreground + * from menu. */ + Tcl_Obj* indicatorFgPtr; /* Color for indicators in radio and check + * button entries. NULL means use indicatorFg + * GC from menu. */ + Tcl_Obj* fontPtr; /* Text font for menu entries. NULL means use + * overall font for menu. */ + int columnBreak; /* If this is 0, this item appears below the + * item in front of it. If this is 1, this + * item starts a new column. This field is + * always 0 for tearoff and separator + * entries. */ + int hideMargin; /* If this is 0, then the item has enough + * margin to accomodate a standard check mark + * and a default right margin. If this is 1, + * then the item has no such margins, and + * checkbuttons and radiobuttons with this set + * will have a rectangle drawn in the + * indicator around the item if the item is + * checked. This is useful for palette menus. + * This field is ignored for separators and + * tearoffs. */ + int indicatorSpace; /* The width of the indicator space for this + * entry. */ + int labelWidth; /* Number of pixels to allow for displaying + * labels in menu entries. */ + int compound; /* Value of -compound option; specifies + * whether the entry should show both an image + * and text, and, if so, how. */ + + /* + * Information used to implement this entry's action: + */ + + Tcl_Obj* commandPtr; /* Command to invoke when entry is invoked. + * Malloc'ed. */ + Tcl_Obj* namePtr; /* Name of variable (for check buttons and + * radio buttons) or menu (for cascade + * entries). Malloc'ed. */ + Tcl_Obj* onValuePtr; /* Value to store in variable when selected + * (only for radio and check buttons). + * Malloc'ed. */ + Tcl_Obj* offValuePtr; /* Value to store in variable when not + * selected (only for check buttons). + * Malloc'ed. */ + + /* + * Information used for drawing this menu entry. + */ + + int width; /* Number of pixels occupied by entry in + * horizontal dimension. Not used except in + * menubars. The width of norma menus is + * dependent on the rest of the menu. */ + int x; /* X-coordinate of leftmost pixel in entry. */ + int height; /* Number of pixels occupied by entry in + * vertical dimension, including raised border + * drawn around entry when active. */ + int y; /* Y-coordinate of topmost pixel in entry. */ + GC textGC; /* GC for drawing text in entry. NULL means + * use overall textGC for menu. */ + GC activeGC; /* GC for drawing text in entry when active. + * NULL means use overall activeGC for + * menu. */ + GC disabledGC; /* Used to produce disabled effect for entry. + * NULL means use overall disabledGC from menu + * structure. See comments for disabledFg in + * menu structure for more information. */ + GC indicatorGC; /* For drawing indicators. None means use GC + * from menu. */ + + /* + * Miscellaneous fields. + */ + + int entryFlags; /* Various flags. See below for + * definitions. */ + int index; /* Need to know which index we are. This is + * zero-based. This is the top-left entry of + * the menu. */ + + /* + * Bookeeping for master menus and cascade menus. + */ + + struct TkMenuReferences* childMenuRefPtr; + /* A pointer to the hash table entry for the + * child menu. Stored here when the menu entry + * is configured so that a hash lookup is not + * necessary later.*/ + struct TkMenuEntry* nextCascadePtr; + /* The next cascade entry that is a parent of + * this entry's child cascade menu. NULL end + * of list, this is not a cascade entry, or + * the menu that this entry point to does not + * yet exist. */ + TkMenuPlatformEntryData platformEntryData; + /* The data for the specific type of menu. + * Depends on platform and menu type what kind + * of options are in this structure. */ +} TkMenuEntry; + +/* + * Flag values defined for menu entries: + * + * ENTRY_SELECTED: Non-zero means this is a radio or check button + * and that it should be drawn in the "selected" + * state. + * ENTRY_NEEDS_REDISPLAY: Non-zero means the entry should be redisplayed. + * ENTRY_LAST_COLUMN: Used by the drawing code. If the entry is in + * the last column, the space to its right needs + * to be filled. + * ENTRY_PLATFORM_FLAG1 - 4 These flags are reserved for use by the + * platform-dependent implementation of menus + * and should not be used by anything else. + */ + +#define ENTRY_SELECTED 1 +#define ENTRY_NEEDS_REDISPLAY 2 +#define ENTRY_LAST_COLUMN 4 +#define ENTRY_PLATFORM_FLAG1 (1 << 30) +#define ENTRY_PLATFORM_FLAG2 (1 << 29) +#define ENTRY_PLATFORM_FLAG3 (1 << 28) +#define ENTRY_PLATFORM_FLAG4 (1 << 27) + +/* + * Types defined for MenuEntries: + */ + +#define CASCADE_ENTRY 0 +#define CHECK_BUTTON_ENTRY 1 +#define COMMAND_ENTRY 2 +#define RADIO_BUTTON_ENTRY 3 +#define SEPARATOR_ENTRY 4 +#define TEAROFF_ENTRY 5 + +/* + * Menu states + */ + +#define ENTRY_ACTIVE 0 +#define ENTRY_NORMAL 1 +#define ENTRY_DISABLED 2 + +/* + * A data structure of the following type is kept for each menu widget: + */ + +typedef struct TkMenu { + Tk_Window tkwin; /* Window that embodies the pane. NULL means + * that the window has been destroyed but the + * data structures haven't yet been cleaned + * up. */ + Display* display; /* Display containing widget. Needed, among + * other things, so that resources can be + * freed up even after tkwin has gone away. */ + Tcl_Interp* interp; /* Interpreter associated with menu. */ + Tcl_Command widgetCmd; /* Token for menu's widget command. */ + TkMenuEntry** entries; /* Array of pointers to all the entries in the + * menu. NULL means no entries. */ + int numEntries; /* Number of elements in entries. */ + int active; /* Index of active entry. -1 means nothing + * active. */ + int menuType; /* MASTER_MENU, TEAROFF_MENU, or MENUBAR. See + * below for definitions. */ + Tcl_Obj* menuTypePtr; /* Used to control whether created tkwin is a + * toplevel or not. "normal", "menubar", or + * "toplevel" */ + + /* + * Information used when displaying widget: + */ + + Tcl_Obj* borderPtr; /* Structure used to draw 3-D border and + * background for menu. */ + Tcl_Obj* borderWidthPtr; /* Width of border around whole menu. */ + Tcl_Obj* activeBorderPtr; /* Used to draw background and border for + * active element (if any). */ + Tcl_Obj* activeBorderWidthPtr; + /* Width of border around active element. */ + Tcl_Obj* reliefPtr; /* 3-d effect: TK_RELIEF_RAISED, etc. */ + Tcl_Obj* fontPtr; /* Text font for menu entries. */ + Tcl_Obj* fgPtr; /* Foreground color for entries. */ + Tcl_Obj* disabledFgPtr; /* Foreground color when disabled. NULL means + * use normalFg with a 50% stipple instead. */ + Tcl_Obj* activeFgPtr; /* Foreground color for active entry. */ + Tcl_Obj* indicatorFgPtr; /* Color for indicators in radio and check + * button entries. */ + Pixmap gray; /* Bitmap for drawing disabled entries in a + * stippled fashion. None means not allocated + * yet. */ + GC textGC; /* GC for drawing text and other features of + * menu entries. */ + GC disabledGC; /* Used to produce disabled effect. If + * disabledFg isn't NULL, this GC is used to + * draw text and icons for disabled entries. + * Otherwise text and icons are drawn with + * normalGC and this GC is used to stipple + * background across them. */ + GC activeGC; /* GC for drawing active entry. */ + GC indicatorGC; /* For drawing indicators. */ + GC disabledImageGC; /* Used for drawing disabled images. They have + * to be stippled. This is created when the + * image is about to be drawn the first + * time. */ + + /* + * Information about geometry of menu. + */ + + int totalWidth; /* Width of entire menu. */ + int totalHeight; /* Height of entire menu. */ + + /* + * Miscellaneous information: + */ + + int tearoff; /* 1 means this menu can be torn off. On some + * platforms, the user can drag an outline of + * the menu by just dragging outside of the + * menu, and the tearoff is created where the + * mouse is released. On others, an indicator + * (such as a dashed stripe) is drawn, and + * when the menu is selected, the tearoff is + * created. */ + Tcl_Obj* titlePtr; /* The title to use when this menu is torn + * off. If this is NULL, a default scheme will + * be used to generate a title for tearoff. */ + Tcl_Obj* tearoffCommandPtr; /* If non-NULL, points to a command to run + * whenever the menu is torn-off. */ + Tcl_Obj* takeFocusPtr; /* Value of -takefocus option; not used in the + * C code, but used by keyboard traversal + * scripts. Malloc'ed, but may be NULL. */ + Tcl_Obj* cursorPtr; /* Current cursor for window, or None. */ + Tcl_Obj* postCommandPtr; /* Used to detect cycles in cascade hierarchy + * trees when preprocessing postcommands on + * some platforms. See PostMenu for more + * details. */ + int postCommandGeneration; /* Need to do pre-invocation post command + * traversal. */ + int menuFlags; /* Flags for use by X; see below for + * definition. */ + TkMenuEntry* postedCascade; /* Points to menu entry for cascaded submenu + * that is currently posted or NULL if no + * submenu posted. */ + struct TkMenu* nextInstancePtr; + /* The next instance of this menu in the + * chain. */ + struct TkMenu* masterMenuPtr; + /* A pointer to the original menu for this + * clone chain. Points back to this structure + * if this menu is a master menu. */ + void* reserved1; /* not used any more. */ + Tk_Window parentTopLevelPtr; /* If this menu is a menubar, this is the + * toplevel that owns the menu. Only + * applicable for menubar clones. */ + struct TkMenuReferences* menuRefPtr; + /* Each menu is hashed into a table with the + * name of the menu's window as the key. The + * information in this hash table includes a + * pointer to the menu (so that cascades can + * find this menu), a pointer to the list of + * toplevel widgets that have this menu as its + * menubar, and a list of menu entries that + * have this menu specified as a cascade. */ + TkMenuPlatformData platformData; + /* The data for the specific type of menu. + * Depends on platform and menu type what kind + * of options are in this structure. */ + Tk_OptionSpec* extensionPtr; /* Needed by the configuration package for + * this widget to be extended. */ + Tk_SavedOptions* errorStructPtr; + /* We actually have to allocate these because + * multiple menus get changed during one + * ConfigureMenu call. */ +} TkMenu; + +/* + * When the toplevel configure -menu command is executed, the menu may not + * exist yet. We need to keep a linked list of windows that reference a + * particular menu. + */ + +typedef struct TkMenuTopLevelList { + struct TkMenuTopLevelList* nextPtr; + /* The next window in the list. */ + Tk_Window tkwin; /* The window that has this menu as its + * menubar. */ +} TkMenuTopLevelList; + +/* + * The following structure is used to keep track of things which reference a + * menu. It is created when: + * - a menu is created. + * - a cascade entry is added to a menu with a non-null name + * - the "-menu" configuration option is used on a toplevel widget with a + * non-null parameter. + * + * One of these three fields must be non-NULL, but any of the fields may be + * NULL. This structure makes it easy to determine whether or not anything + * like recalculating platform data or geometry is necessary when one of the + * three actions above is performed. + */ + +typedef struct TkMenuReferences { + struct TkMenu* menuPtr; /* The menu data structure. This is NULL if + * the menu does not exist. */ + TkMenuTopLevelList* topLevelListPtr; + /* First in the list of all toplevels that + * have this menu as its menubar. NULL if no + * toplevel widgets have this menu as its + * menubar. */ + TkMenuEntry* parentEntryPtr; /* First in the list of all cascade menu + * entries that have this menu as their child. + * NULL means no cascade entries. */ + Tcl_HashEntry* hashEntryPtr; /* This is needed because the pathname of the + * window (which is what we hash on) may not + * be around when we are deleting. */ +} TkMenuReferences; + +/* + * Flag bits for menus: + * + * REDRAW_PENDING: Non-zero means a DoWhenIdle handler has + * already been queued to redraw this window. + * RESIZE_PENDING: Non-zero means a call to ComputeMenuGeometry + * has already been scheduled. + * MENU_DELETION_PENDING Non-zero means that we are currently + * destroying this menu's internal structures. + * This is useful when we are in the middle of + * cleaning this master menu's chain of menus up + * when TkDestroyMenu was called again on this + * menu (via a destroy binding or somesuch). + * MENU_WIN_DESTRUCTION_PENDING Non-zero means we are in the middle of + * destroying this menu's Tk_Window. + * MENU_PLATFORM_FLAG1... Reserved for use by the platform-specific menu + * code. + */ + +#define REDRAW_PENDING 1 +#define RESIZE_PENDING 2 +#define MENU_DELETION_PENDING 4 +#define MENU_WIN_DESTRUCTION_PENDING 8 +#define MENU_PLATFORM_FLAG1 (1 << 30) +#define MENU_PLATFORM_FLAG2 (1 << 29) +#define MENU_PLATFORM_FLAG3 (1 << 28) + +/* + * Each menu created by the user is a MASTER_MENU. When a menu is torn off, a + * TEAROFF_MENU instance is created. When a menu is assigned to a toplevel as + * a menu bar, a MENUBAR instance is created. All instances have the same + * configuration information. If the master instance is deleted, all instances + * are deleted. If one of the other instances is deleted, only that instance + * is deleted. + */ + +#define UNKNOWN_TYPE -1 +#define MASTER_MENU 0 +#define TEAROFF_MENU 1 +#define MENUBAR 2 + +/* + * Various geometry definitions: + */ + +#define CASCADE_ARROW_HEIGHT 10 +#define CASCADE_ARROW_WIDTH 8 +#define DECORATION_BORDER_WIDTH 2 + +/* + * Menu-related functions that are shared among Tk modules but not exported to + * the outside world: + */ + +MODULE_SCOPE int TkActivateMenuEntry(TkMenu* menuPtr, int index); +MODULE_SCOPE void TkBindMenu(Tk_Window tkwin, TkMenu* menuPtr); +MODULE_SCOPE TkMenuReferences* TkCreateMenuReferences( + Tcl_Interp* interp, + const char* name); +MODULE_SCOPE void TkDestroyMenu(TkMenu* menuPtr); +MODULE_SCOPE void TkEventuallyRecomputeMenu(TkMenu* menuPtr); +MODULE_SCOPE void TkEventuallyRedrawMenu(TkMenu* menuPtr, TkMenuEntry* mePtr); +MODULE_SCOPE TkMenuReferences* TkFindMenuReferences( + Tcl_Interp* interp, + const char* name); +MODULE_SCOPE TkMenuReferences* TkFindMenuReferencesObj( + Tcl_Interp* interp, + Tcl_Obj* namePtr); +MODULE_SCOPE int TkFreeMenuReferences(TkMenuReferences* menuRefPtr); +MODULE_SCOPE Tcl_HashTable* TkGetMenuHashTable(Tcl_Interp* interp); +MODULE_SCOPE int TkGetMenuIndex( + Tcl_Interp* interp, + TkMenu* menuPtr, + Tcl_Obj* objPtr, + int lastOK, + int* indexPtr); +MODULE_SCOPE void TkMenuInitializeDrawingFields(TkMenu* menuPtr); +MODULE_SCOPE void TkMenuInitializeEntryDrawingFields(TkMenuEntry* mePtr); +MODULE_SCOPE int TkInvokeMenu(Tcl_Interp* interp, TkMenu* menuPtr, int index); +MODULE_SCOPE void TkMenuConfigureDrawOptions(TkMenu* menuPtr); +MODULE_SCOPE int TkMenuConfigureEntryDrawOptions(TkMenuEntry* mePtr, int index); +MODULE_SCOPE void TkMenuFreeDrawOptions(TkMenu* menuPtr); +MODULE_SCOPE void TkMenuEntryFreeDrawOptions(TkMenuEntry* mePtr); +MODULE_SCOPE void TkMenuEventProc(ClientData clientData, XEvent* eventPtr); +MODULE_SCOPE void TkMenuImageProc( + ClientData clientData, + int x, + int y, + int width, + int height, + int imgWidth, + int imgHeight); +MODULE_SCOPE void TkMenuInit(void); +MODULE_SCOPE void TkMenuSelectImageProc( + ClientData clientData, + int x, + int y, + int width, + int height, + int imgWidth, + int imgHeight); +MODULE_SCOPE Tcl_Obj* +TkNewMenuName(Tcl_Interp* interp, Tcl_Obj* parentNamePtr, TkMenu* menuPtr); +MODULE_SCOPE int TkPostCommand(TkMenu* menuPtr); +MODULE_SCOPE int +TkPostSubmenu(Tcl_Interp* interp, TkMenu* menuPtr, TkMenuEntry* mePtr); +MODULE_SCOPE int +TkPostTearoffMenu(Tcl_Interp* interp, TkMenu* menuPtr, int x, int y); +MODULE_SCOPE int TkPreprocessMenu(TkMenu* menuPtr); +MODULE_SCOPE void TkRecomputeMenu(TkMenu* menuPtr); + +/* + * These routines are the platform-dependent routines called by the common + * code. + */ + +MODULE_SCOPE void TkpComputeMenubarGeometry(TkMenu* menuPtr); +MODULE_SCOPE void TkpComputeStandardMenuGeometry(TkMenu* menuPtr); +MODULE_SCOPE int TkpConfigureMenuEntry(TkMenuEntry* mePtr); +MODULE_SCOPE void TkpDestroyMenu(TkMenu* menuPtr); +MODULE_SCOPE void TkpDestroyMenuEntry(TkMenuEntry* mEntryPtr); +MODULE_SCOPE void TkpDrawMenuEntry( + TkMenuEntry* mePtr, + Drawable d, + Tk_Font tkfont, + const Tk_FontMetrics* menuMetricsPtr, + int x, + int y, + int width, + int height, + int strictMotif, + int drawingParameters); +MODULE_SCOPE void TkpMenuInit(void); +MODULE_SCOPE int TkpMenuNewEntry(TkMenuEntry* mePtr); +MODULE_SCOPE int TkpNewMenu(TkMenu* menuPtr); +MODULE_SCOPE int TkpPostMenu(Tcl_Interp* interp, TkMenu* menuPtr, int x, int y); +MODULE_SCOPE void TkpSetWindowMenuBar(Tk_Window tkwin, TkMenu* menuPtr); + +#endif /* _TKMENU */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkMenubutton.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkMenubutton.h new file mode 100644 index 0000000..2ebf506 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkMenubutton.h @@ -0,0 +1,217 @@ +/* + * tkMenubutton.h -- + * + * Declarations of types and functions used to implement the menubutton + * widget. + * + * Copyright (c) 1996-1997 by Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TKMENUBUTTON +#define _TKMENUBUTTON + +#ifndef _TKINT +#include "tkInt.h" +#endif + +#ifndef _TKMENU +#include "tkMenu.h" +#endif + +/* + * Legal values for the "orient" field of TkMenubutton records. + */ + +enum direction { + DIRECTION_ABOVE, + DIRECTION_BELOW, + DIRECTION_FLUSH, + DIRECTION_LEFT, + DIRECTION_RIGHT +}; + +/* + * Legal values for the "state" field of TkMenubutton records. + */ + +enum state { STATE_ACTIVE, STATE_DISABLED, STATE_NORMAL }; + +/* + * A data structure of the following type is kept for each widget managed by + * this file: + */ + +typedef struct { + Tk_Window tkwin; /* Window that embodies the widget. NULL means + * that the window has been destroyed but the + * data structures haven't yet been cleaned + * up. */ + Display* display; /* Display containing widget. Needed, among + * other things, so that resources can bee + * freed up even after tkwin has gone away. */ + Tcl_Interp* interp; /* Interpreter associated with menubutton. */ + Tcl_Command widgetCmd; /* Token for menubutton's widget command. */ + Tk_OptionTable optionTable; /* Table that defines configuration options + * available for this widget. */ + char* menuName; /* Name of menu associated with widget. + * Malloc-ed. */ + + /* + * Information about what's displayed in the menu button: + */ + + char* text; /* Text to display in button (malloc'ed) or + * NULL. */ + int underline; /* Index of character to underline. */ + char* textVarName; /* Name of variable (malloc'ed) or NULL. If + * non-NULL, button displays the contents of + * this variable. */ + Pixmap bitmap; /* Bitmap to display or None. If not None then + * text and textVar and underline are + * ignored. */ + char* imageString; /* Name of image to display (malloc'ed), or + * NULL. If non-NULL, bitmap, text, and + * textVarName are ignored. */ + Tk_Image image; /* Image to display in window, or NULL if + * none. */ + + /* + * Information used when displaying widget: + */ + + enum state state; /* State of button for display purposes: + * normal, active, or disabled. */ + Tk_3DBorder normalBorder; /* Structure used to draw 3-D border and + * background when window isn't active. NULL + * means no such border exists. */ + Tk_3DBorder activeBorder; /* Structure used to draw 3-D border and + * background when window is active. NULL + * means no such border exists. */ + int borderWidth; /* Width of border. */ + int relief; /* 3-d effect: TK_RELIEF_RAISED, etc. */ + int highlightWidth; /* Width in pixels of highlight to draw around + * widget when it has the focus. <= 0 means + * don't draw a highlight. */ + XColor* highlightBgColorPtr; /* Color for drawing traversal highlight area + * when highlight is off. */ + XColor* highlightColorPtr; /* Color for drawing traversal highlight. */ + int inset; /* Total width of all borders, including + * traversal highlight and 3-D border. + * Indicates how much interior stuff must be + * offset from outside edges to leave room for + * borders. */ + Tk_Font tkfont; /* Information about text font, or NULL. */ + XColor* normalFg; /* Foreground color in normal mode. */ + XColor* activeFg; /* Foreground color in active mode. NULL means + * use normalFg instead. */ + XColor* disabledFg; /* Foreground color when disabled. NULL means + * use normalFg with a 50% stipple instead. */ + GC normalTextGC; /* GC for drawing text in normal mode. */ + GC activeTextGC; /* GC for drawing text in active mode (NULL + * means use normalTextGC). */ + Pixmap gray; /* Pixmap for displaying disabled text/icon if + * disabledFg is NULL. */ + GC disabledGC; /* Used to produce disabled effect for + * text. */ + GC stippleGC; /* Used to produce disabled stipple effect for + * images when disabled. */ + int leftBearing; /* Distance from text origin to leftmost drawn + * pixel (positive means to right). */ + int rightBearing; /* Amount text sticks right from its + * origin. */ + char* widthString; /* Value of -width option. Malloc'ed. */ + char* heightString; /* Value of -height option. Malloc'ed. */ + int width, height; /* If > 0, these specify dimensions to request + * for window, in characters for text and in + * pixels for bitmaps. In this case the actual + * size of the text string or bitmap is + * ignored in computing desired window + * size. */ + int wrapLength; /* Line length (in pixels) at which to wrap + * onto next line. <= 0 means don't wrap + * except at newlines. */ + int padX, padY; /* Extra space around text or bitmap (pixels + * on each side). */ + Tk_Anchor anchor; /* Where text/bitmap should be displayed + * inside window region. */ + Tk_Justify justify; /* Justification to use for multi-line + * text. */ + int textWidth; /* Width needed to display text as requested, + * in pixels. */ + int textHeight; /* Height needed to display text as requested, + * in pixels. */ + Tk_TextLayout textLayout; /* Saved text layout information. */ + int indicatorOn; /* Non-zero means display indicator; 0 means + * don't display. */ + int indicatorHeight; /* Height of indicator in pixels. This same + * amount of extra space is also left on each + * side of the indicator. 0 if no + * indicator. */ + int indicatorWidth; /* Width of indicator in pixels, including + * indicatorHeight in padding on each side. 0 + * if no indicator. */ + + /* + * Miscellaneous information: + */ + + int compound; /* Value of -compound option; specifies + * whether the menubutton should show both an + * image and text, and, if so, how. */ + enum direction direction; /* Direction for where to pop the menu. Valid + * directions are "above", "below", "left", + * "right", and "flush". "flush" means that + * the upper left corner of the menubutton is + * where the menu pops up. "above" and "below" + * will attempt to pop the menu compleletly + * above or below the menu respectively. + * "left" and "right" will pop the menu left + * or right, and the active item will be next + * to the button. */ + Tk_Cursor cursor; /* Current cursor for window, or None. */ + char* takeFocus; /* Value of -takefocus option; not used in the + * C code, but used by keyboard traversal + * scripts. Malloc'ed, but may be NULL. */ + int flags; /* Various flags; see below for + * definitions. */ +} TkMenuButton; + +/* + * Flag bits for buttons: + * + * REDRAW_PENDING: Non-zero means a DoWhenIdle handler has + * already been queued to redraw this window. + * POSTED: Non-zero means that the menu associated with + * this button has been posted (typically because + * of an active button press). + * GOT_FOCUS: Non-zero means this button currently has the + * input focus. + */ + +#define REDRAW_PENDING 1 +#define POSTED 2 +#define GOT_FOCUS 4 + +/* + * The following constants define the dimensions of the cascade indicator, + * which is displayed if the "-indicatoron" option is true. The units for + * these options are 1/10 millimeters. + */ + +#define INDICATOR_WIDTH 40 +#define INDICATOR_HEIGHT 17 + +/* + * Declaration of procedures used in the implementation of the button widget. + */ + +MODULE_SCOPE void TkpComputeMenuButtonGeometry(TkMenuButton* mbPtr); +MODULE_SCOPE TkMenuButton* TkpCreateMenuButton(Tk_Window tkwin); +MODULE_SCOPE void TkpDisplayMenuButton(ClientData clientData); +MODULE_SCOPE void TkpDestroyMenuButton(TkMenuButton* mbPtr); +MODULE_SCOPE void TkMenuButtonWorldChanged(ClientData instanceData); + +#endif /* _TKMENUBUTTON */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkPlatDecls.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkPlatDecls.h new file mode 100644 index 0000000..4fd10a7 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkPlatDecls.h @@ -0,0 +1,188 @@ +/* + * tkPlatDecls.h -- + * + * Declarations of functions in the platform-specific public Tcl API. + * + * Copyright (c) 1998-1999 by Scriptics Corporation. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TKPLATDECLS +#define _TKPLATDECLS + +#ifdef BUILD_tk +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLEXPORT +#endif + +/* + * WARNING: This file is automatically generated by the tools/genStubs.tcl + * script. Any modifications to the function declarations below should be made + * in the generic/tk.decls script. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* !BEGIN!: Do not edit below this line. */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Exported function declarations: + */ + +#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ +/* 0 */ +EXTERN Window Tk_AttachHWND(Tk_Window tkwin, HWND hwnd); +/* 1 */ +EXTERN HINSTANCE Tk_GetHINSTANCE(void); +/* 2 */ +EXTERN HWND Tk_GetHWND(Window window); +/* 3 */ +EXTERN Tk_Window Tk_HWNDToWindow(HWND hwnd); +/* 4 */ +EXTERN void Tk_PointerEvent(HWND hwnd, int x, int y); +/* 5 */ +EXTERN int Tk_TranslateWinEvent( + HWND hwnd, + UINT message, + WPARAM wParam, + LPARAM lParam, + LRESULT* result); +#endif /* WIN */ +#ifdef MAC_OSX_TK /* AQUA */ +/* 0 */ +EXTERN void Tk_MacOSXSetEmbedHandler( + Tk_MacOSXEmbedRegisterWinProc* registerWinProcPtr, + Tk_MacOSXEmbedGetGrafPortProc* getPortProcPtr, + Tk_MacOSXEmbedMakeContainerExistProc* containerExistProcPtr, + Tk_MacOSXEmbedGetClipProc* getClipProc, + Tk_MacOSXEmbedGetOffsetInParentProc* getOffsetProc); +/* 1 */ +EXTERN void Tk_MacOSXTurnOffMenus(void); +/* 2 */ +EXTERN void Tk_MacOSXTkOwnsCursor(int tkOwnsIt); +/* 3 */ +EXTERN void TkMacOSXInitMenus(Tcl_Interp* interp); +/* 4 */ +EXTERN void TkMacOSXInitAppleEvents(Tcl_Interp* interp); +/* 5 */ +EXTERN void TkGenWMConfigureEvent( + Tk_Window tkwin, + int x, + int y, + int width, + int height, + int flags); +/* 6 */ +EXTERN void TkMacOSXInvalClipRgns(Tk_Window tkwin); +/* 7 */ +EXTERN void* TkMacOSXGetDrawablePort(Drawable drawable); +/* 8 */ +EXTERN void* TkMacOSXGetRootControl(Drawable drawable); +/* 9 */ +EXTERN void Tk_MacOSXSetupTkNotifier(void); +/* 10 */ +EXTERN int Tk_MacOSXIsAppInFront(void); +#endif /* AQUA */ + +typedef struct TkPlatStubs { + int magic; + void* hooks; + +#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ + Window (*tk_AttachHWND)(Tk_Window tkwin, HWND hwnd); /* 0 */ + HINSTANCE (*tk_GetHINSTANCE)(void); /* 1 */ + HWND (*tk_GetHWND)(Window window); /* 2 */ + Tk_Window (*tk_HWNDToWindow)(HWND hwnd); /* 3 */ + void (*tk_PointerEvent)(HWND hwnd, int x, int y); /* 4 */ + int (*tk_TranslateWinEvent)( + HWND hwnd, + UINT message, + WPARAM wParam, + LPARAM lParam, + LRESULT* result); /* 5 */ +#endif /* WIN */ +#ifdef MAC_OSX_TK /* AQUA */ + void (*tk_MacOSXSetEmbedHandler)( + Tk_MacOSXEmbedRegisterWinProc* registerWinProcPtr, + Tk_MacOSXEmbedGetGrafPortProc* getPortProcPtr, + Tk_MacOSXEmbedMakeContainerExistProc* containerExistProcPtr, + Tk_MacOSXEmbedGetClipProc* getClipProc, + Tk_MacOSXEmbedGetOffsetInParentProc* getOffsetProc); /* 0 */ + void (*tk_MacOSXTurnOffMenus)(void); /* 1 */ + void (*tk_MacOSXTkOwnsCursor)(int tkOwnsIt); /* 2 */ + void (*tkMacOSXInitMenus)(Tcl_Interp* interp); /* 3 */ + void (*tkMacOSXInitAppleEvents)(Tcl_Interp* interp); /* 4 */ + void (*tkGenWMConfigureEvent)( + Tk_Window tkwin, + int x, + int y, + int width, + int height, + int flags); /* 5 */ + void (*tkMacOSXInvalClipRgns)(Tk_Window tkwin); /* 6 */ + void* (*tkMacOSXGetDrawablePort)(Drawable drawable); /* 7 */ + void* (*tkMacOSXGetRootControl)(Drawable drawable); /* 8 */ + void (*tk_MacOSXSetupTkNotifier)(void); /* 9 */ + int (*tk_MacOSXIsAppInFront)(void); /* 10 */ +#endif /* AQUA */ +} TkPlatStubs; + +extern const TkPlatStubs* tkPlatStubsPtr; + +#ifdef __cplusplus +} +#endif + +#if defined(USE_TK_STUBS) + +/* + * Inline function declarations: + */ + +#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ +#define Tk_AttachHWND (tkPlatStubsPtr->tk_AttachHWND) /* 0 */ +#define Tk_GetHINSTANCE (tkPlatStubsPtr->tk_GetHINSTANCE) /* 1 */ +#define Tk_GetHWND (tkPlatStubsPtr->tk_GetHWND) /* 2 */ +#define Tk_HWNDToWindow (tkPlatStubsPtr->tk_HWNDToWindow) /* 3 */ +#define Tk_PointerEvent (tkPlatStubsPtr->tk_PointerEvent) /* 4 */ +#define Tk_TranslateWinEvent (tkPlatStubsPtr->tk_TranslateWinEvent) /* 5 */ +#endif /* WIN */ +#ifdef MAC_OSX_TK /* AQUA */ +#define Tk_MacOSXSetEmbedHandler \ + (tkPlatStubsPtr->tk_MacOSXSetEmbedHandler) /* 0 */ +#define Tk_MacOSXTurnOffMenus (tkPlatStubsPtr->tk_MacOSXTurnOffMenus) /* 1 */ +#define Tk_MacOSXTkOwnsCursor (tkPlatStubsPtr->tk_MacOSXTkOwnsCursor) /* 2 */ +#define TkMacOSXInitMenus (tkPlatStubsPtr->tkMacOSXInitMenus) /* 3 */ +#define TkMacOSXInitAppleEvents \ + (tkPlatStubsPtr->tkMacOSXInitAppleEvents) /* 4 */ +#define TkGenWMConfigureEvent (tkPlatStubsPtr->tkGenWMConfigureEvent) /* 5 */ +#define TkMacOSXInvalClipRgns (tkPlatStubsPtr->tkMacOSXInvalClipRgns) /* 6 */ +#define TkMacOSXGetDrawablePort \ + (tkPlatStubsPtr->tkMacOSXGetDrawablePort) /* 7 */ +#define TkMacOSXGetRootControl (tkPlatStubsPtr->tkMacOSXGetRootControl) /* 8 \ + */ +#define Tk_MacOSXSetupTkNotifier \ + (tkPlatStubsPtr->tk_MacOSXSetupTkNotifier) /* 9 */ +#define Tk_MacOSXIsAppInFront (tkPlatStubsPtr->tk_MacOSXIsAppInFront) /* 10 */ +#endif /* AQUA */ + +#endif /* defined(USE_TK_STUBS) */ + +/* !END!: Do not edit above this line. */ + +#ifdef __cplusplus +} +#endif + +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLIMPORT + +#endif /* _TKPLATDECLS */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkPort.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkPort.h new file mode 100644 index 0000000..d083bb0 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkPort.h @@ -0,0 +1,31 @@ +/* + * tkPort.h -- + * + * This header file handles porting issues that occur because of + * differences between systems. It reads in platform specific + * portability files. + * + * Copyright (c) 1995 Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TKPORT +#define _TKPORT + +#if defined(_WIN32) +#include "tkWinPort.h" +#endif +#ifndef _TK +#include "tk.h" +#endif +#if !defined(_WIN32) +#if defined(MAC_OSX_TK) +#include "tkMacOSXPort.h" +#else +#include "tkUnixPort.h" +#endif +#endif + +#endif /* _TKPORT */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkScale.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkScale.h new file mode 100644 index 0000000..c2997ba --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkScale.h @@ -0,0 +1,228 @@ +/* + * tkScale.h -- + * + * Declarations of types and functions used to implement the scale + * widget. + * + * Copyright (c) 1996 by Sun Microsystems, Inc. + * Copyright (c) 1999-2000 by Scriptics Corporation. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TKSCALE +#define _TKSCALE + +#ifndef _TKINT +#include "tkInt.h" +#endif + +/* + * Legal values for the "orient" field of TkScale records. + */ + +enum orient { ORIENT_HORIZONTAL, ORIENT_VERTICAL }; + +/* + * Legal values for the "state" field of TkScale records. + */ + +enum state { STATE_ACTIVE, STATE_DISABLED, STATE_NORMAL }; + +/* + * A data structure of the following type is kept for each scale widget + * managed by this file: + */ + +typedef struct TkScale { + Tk_Window tkwin; /* Window that embodies the scale. NULL means + * that the window has been destroyed but the + * data structures haven't yet been cleaned + * up.*/ + Display* display; /* Display containing widget. Used, among + * other things, so that resources can be + * freed even after tkwin has gone away. */ + Tcl_Interp* interp; /* Interpreter associated with scale. */ + Tcl_Command widgetCmd; /* Token for scale's widget command. */ + Tk_OptionTable optionTable; /* Table that defines configuration options + * available for this widget. */ + enum orient orient; /* Orientation for window (vertical or + * horizontal). */ + int width; /* Desired narrow dimension of scale, in + * pixels. */ + int length; /* Desired long dimension of scale, in + * pixels. */ + double value; /* Current value of scale. */ + Tcl_Obj* varNamePtr; /* Name of variable or NULL. If non-NULL, + * scale's value tracks the contents of this + * variable and vice versa. */ + double fromValue; /* Value corresponding to left or top of + * scale. */ + double toValue; /* Value corresponding to right or bottom of + * scale. */ + double tickInterval; /* Distance between tick marks; 0 means don't + * display any tick marks. */ + double resolution; /* If > 0, all values are rounded to an even + * multiple of this value. */ + int digits; /* Number of significant digits to print in + * values. 0 means we get to choose the number + * based on resolution and/or the range of the + * scale. */ + char format[10]; /* Sprintf conversion specifier computed from + * digits and other information. */ + double bigIncrement; /* Amount to use for large increments to scale + * value. (0 means we pick a value). */ + char* command; /* Command prefix to use when invoking Tcl + * commands because the scale value changed. + * NULL means don't invoke commands. */ + int repeatDelay; /* How long to wait before auto-repeating on + * scrolling actions (in ms). */ + int repeatInterval; /* Interval between autorepeats (in ms). */ + char* label; /* Label to display above or to right of + * scale; NULL means don't display a label. */ + int labelLength; /* Number of non-NULL chars. in label. */ + enum state state; /* Values are active, normal, or disabled. + * Value of scale cannot be changed when + * disabled. */ + + /* + * Information used when displaying widget: + */ + + int borderWidth; /* Width of 3-D border around window. */ + Tk_3DBorder bgBorder; /* Used for drawing slider and other + * background areas. */ + Tk_3DBorder activeBorder; /* For drawing the slider when active. */ + int sliderRelief; /* Is slider to be drawn raised, sunken, + * etc. */ + XColor* troughColorPtr; /* Color for drawing trough. */ + GC troughGC; /* For drawing trough. */ + GC copyGC; /* Used for copying from pixmap onto screen */ + Tk_Font tkfont; /* Information about text font, or NULL. */ + XColor* textColorPtr; /* Color for drawing text. */ + GC textGC; /* GC for drawing text in normal mode. */ + int relief; /* Indicates whether window as a whole is + * raised, sunken, or flat. */ + int highlightWidth; /* Width in pixels of highlight to draw around + * widget when it has the focus. <= 0 means + * don't draw a highlight. */ + Tk_3DBorder highlightBorder; /* Value of -highlightbackground option: + * specifies background with which to draw 3-D + * default ring and focus highlight area when + * highlight is off. */ + XColor* highlightColorPtr; /* Color for drawing traversal highlight. */ + int inset; /* Total width of all borders, including + * traversal highlight and 3-D border. + * Indicates how much interior stuff must be + * offset from outside edges to leave room for + * borders. */ + int sliderLength; /* Length of slider, measured in pixels along + * long dimension of scale. */ + int showValue; /* Non-zero means to display the scale value + * below or to the left of the slider; zero + * means don't display the value. */ + + /* + * Layout information for horizontal scales, assuming that window gets the + * size it requested: + */ + + int horizLabelY; /* Y-coord at which to draw label. */ + int horizValueY; /* Y-coord at which to draw value text. */ + int horizTroughY; /* Y-coord of top of slider trough. */ + int horizTickY; /* Y-coord at which to draw tick text. */ + /* + * Layout information for vertical scales, assuming that window gets the + * size it requested: + */ + + int vertTickRightX; /* X-location of right side of tick-marks. */ + int vertValueRightX; /* X-location of right side of value string. */ + int vertTroughX; /* X-location of scale's slider trough. */ + int vertLabelX; /* X-location of origin of label. */ + + /* + * Miscellaneous information: + */ + + int fontHeight; /* Height of scale font. */ + Tk_Cursor cursor; /* Current cursor for window, or None. */ + Tcl_Obj* takeFocusPtr; /* Value of -takefocus option; not used in the + * C code, but used by keyboard traversal + * scripts. May be NULL. */ + int flags; /* Various flags; see below for + * definitions. */ +} TkScale; + +/* + * Flag bits for scales: + * + * REDRAW_SLIDER - 1 means slider (and numerical readout) need to + * be redrawn. + * REDRAW_OTHER - 1 means other stuff besides slider and value + * need to be redrawn. + * REDRAW_ALL - 1 means the entire widget needs to be redrawn. + * REDRAW_PENDING - 1 means any sort of redraw is pending + * ACTIVE - 1 means the widget is active (the mouse is in + * its window). + * INVOKE_COMMAND - 1 means the scale's command needs to be + * invoked during the next redisplay (the value + * of the scale has changed since the last time + * the command was invoked). + * SETTING_VAR - 1 means that the associated variable is being + * set by us, so there's no need for ScaleVarProc + * to do anything. + * NEVER_SET - 1 means that the scale's value has never been + * set before (so must invoke -command and set + * associated variable even if the value doesn't + * appear to have changed). + * GOT_FOCUS - 1 means that the focus is currently in this + * widget. + * SCALE_DELETED - 1 means the scale widget is being deleted + */ + +#define REDRAW_SLIDER (1 << 0) +#define REDRAW_OTHER (1 << 1) +#define REDRAW_ALL (REDRAW_OTHER | REDRAW_SLIDER) +#define REDRAW_PENDING (1 << 2) +#define ACTIVE (1 << 3) +#define INVOKE_COMMAND (1 << 4) +#define SETTING_VAR (1 << 5) +#define NEVER_SET (1 << 6) +#define GOT_FOCUS (1 << 7) +#define SCALE_DELETED (1 << 8) + +/* + * Symbolic values for the active parts of a slider. These are the values that + * may be returned by the ScaleElement procedure. + */ + +#define OTHER 0 +#define TROUGH1 1 +#define SLIDER 2 +#define TROUGH2 3 + +/* + * Space to leave between scale area and text, and between text and edge of + * window. + */ + +#define SPACING 2 + +/* + * Declaration of procedures used in the implementation of the scale widget. + */ + +MODULE_SCOPE void TkEventuallyRedrawScale(TkScale* scalePtr, int what); +MODULE_SCOPE double TkRoundToResolution(TkScale* scalePtr, double value); +MODULE_SCOPE TkScale* TkpCreateScale(Tk_Window tkwin); +MODULE_SCOPE void TkpDestroyScale(TkScale* scalePtr); +MODULE_SCOPE void TkpDisplayScale(ClientData clientData); +MODULE_SCOPE int TkpScaleElement(TkScale* scalePtr, int x, int y); +MODULE_SCOPE void +TkScaleSetValue(TkScale* scalePtr, double value, int setVar, int invokeCommand); +MODULE_SCOPE double TkScalePixelToValue(TkScale* scalePtr, int x, int y); +MODULE_SCOPE int TkScaleValueToPixel(TkScale* scalePtr, double value); + +#endif /* _TKSCALE */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkScrollbar.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkScrollbar.h new file mode 100644 index 0000000..65a4431 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkScrollbar.h @@ -0,0 +1,181 @@ +/* + * tkScrollbar.h -- + * + * Declarations of types and functions used to implement the scrollbar + * widget. + * + * Copyright (c) 1996 by Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TKSCROLLBAR +#define _TKSCROLLBAR + +#ifndef _TKINT +#include "tkInt.h" +#endif + +/* + * A data structure of the following type is kept for each scrollbar widget. + */ + +typedef struct TkScrollbar { + Tk_Window tkwin; /* Window that embodies the scrollbar. NULL + * means that the window has been destroyed + * but the data structures haven't yet been + * cleaned up.*/ + Display* display; /* Display containing widget. Used, among + * other things, so that resources can be + * freed even after tkwin has gone away. */ + Tcl_Interp* interp; /* Interpreter associated with scrollbar. */ + Tcl_Command widgetCmd; /* Token for scrollbar's widget command. */ + int vertical; /* Non-zero means vertical orientation + * requested, zero means horizontal. */ + int width; /* Desired narrow dimension of scrollbar, in + * pixels. */ + char* command; /* Command prefix to use when invoking + * scrolling commands. NULL means don't invoke + * commands. Malloc'ed. */ + int commandSize; /* Number of non-NULL bytes in command. */ + int repeatDelay; /* How long to wait before auto-repeating on + * scrolling actions (in ms). */ + int repeatInterval; /* Interval between autorepeats (in ms). */ + int jump; /* Value of -jump option. */ + + /* + * Information used when displaying widget: + */ + + int borderWidth; /* Width of 3-D borders. */ + Tk_3DBorder bgBorder; /* Used for drawing background (all flat + * surfaces except for trough). */ + Tk_3DBorder activeBorder; /* For drawing backgrounds when active (i.e. + * when mouse is positioned over element). */ + XColor* troughColorPtr; /* Color for drawing trough. */ + int relief; /* Indicates whether window as a whole is + * raised, sunken, or flat. */ + int highlightWidth; /* Width in pixels of highlight to draw around + * widget when it has the focus. <= 0 means + * don't draw a highlight. */ + XColor* highlightBgColorPtr; + /* Color for drawing traversal highlight area + * when highlight is off. */ + XColor* highlightColorPtr; /* Color for drawing traversal highlight. */ + int inset; /* Total width of all borders, including + * traversal highlight and 3-D border. + * Indicates how much interior stuff must be + * offset from outside edges to leave room for + * borders. */ + int elementBorderWidth; /* Width of border to draw around elements + * inside scrollbar (arrows and slider). -1 + * means use borderWidth. */ + int arrowLength; /* Length of arrows along long dimension of + * scrollbar, including space for a small gap + * between the arrow and the slider. + * Recomputed on window size changes. */ + int sliderFirst; /* Pixel coordinate of top or left edge of + * slider area, including border. */ + int sliderLast; /* Coordinate of pixel just after bottom or + * right edge of slider area, including + * border. */ + int activeField; /* Names field to be displayed in active + * colors, such as TOP_ARROW, or 0 for no + * field. */ + int activeRelief; /* Value of -activeRelief option: relief to + * use for active element. */ + + /* + * Information describing the application related to the scrollbar. This + * information is provided by the application by invoking the "set" widget + * command. This information can now be provided in two ways: the "old" + * form (totalUnits, windowUnits, firstUnit, and lastUnit), or the "new" + * form (firstFraction and lastFraction). FirstFraction and lastFraction + * will always be valid, but the old-style information is only valid if + * the NEW_STYLE_COMMANDS flag is 0. + */ + + int totalUnits; /* Total dimension of application, in units. + * Valid only if the NEW_STYLE_COMMANDS flag + * isn't set. */ + int windowUnits; /* Maximum number of units that can be + * displayed in the window at once. Valid only + * if the NEW_STYLE_COMMANDS flag isn't set. */ + int firstUnit; /* Number of last unit visible in + * application's window. Valid only if the + * NEW_STYLE_COMMANDS flag isn't set. */ + int lastUnit; /* Index of last unit visible in window. + * Valid only if the NEW_STYLE_COMMANDS flag + * isn't set. */ + double firstFraction; /* Position of first visible thing in window, + * specified as a fraction between 0 and + * 1.0. */ + double lastFraction; /* Position of last visible thing in window, + * specified as a fraction between 0 and + * 1.0. */ + + /* + * Miscellaneous information: + */ + + Tk_Cursor cursor; /* Current cursor for window, or None. */ + char* takeFocus; /* Value of -takefocus option; not used in the + * C code, but used by keyboard traversal + * scripts. Malloc'ed, but may be NULL. */ + int flags; /* Various flags; see below for + * definitions. */ +} TkScrollbar; + +/* + * Legal values for "activeField" field of Scrollbar structures. These are + * also the return values from the ScrollbarPosition function. + */ + +#define OUTSIDE 0 +#define TOP_ARROW 1 +#define TOP_GAP 2 +#define SLIDER 3 +#define BOTTOM_GAP 4 +#define BOTTOM_ARROW 5 + +/* + * Flag bits for scrollbars: + * + * REDRAW_PENDING: Non-zero means a DoWhenIdle handler has + * already been queued to redraw this window. + * NEW_STYLE_COMMANDS: Non-zero means the new style of commands + * should be used to communicate with the widget: + * ".t yview scroll 2 lines", instead of + * ".t yview 40", for example. + * GOT_FOCUS: Non-zero means this window has the input + * focus. + */ + +#define REDRAW_PENDING 1 +#define NEW_STYLE_COMMANDS 2 +#define GOT_FOCUS 4 + +/* + * Declaration of scrollbar class functions structure + * and default scrollbar width, for use in configSpec. + */ + +MODULE_SCOPE const Tk_ClassProcs tkpScrollbarProcs; +MODULE_SCOPE char tkDefScrollbarWidth[TCL_INTEGER_SPACE]; + +/* + * Declaration of functions used in the implementation of the scrollbar + * widget. + */ + +MODULE_SCOPE void TkScrollbarEventProc(ClientData clientData, XEvent* eventPtr); +MODULE_SCOPE void TkScrollbarEventuallyRedraw(TkScrollbar* scrollPtr); +MODULE_SCOPE void TkpComputeScrollbarGeometry(TkScrollbar* scrollPtr); +MODULE_SCOPE TkScrollbar* TkpCreateScrollbar(Tk_Window tkwin); +MODULE_SCOPE void TkpDestroyScrollbar(TkScrollbar* scrollPtr); +MODULE_SCOPE void TkpDisplayScrollbar(ClientData clientData); +MODULE_SCOPE void TkpConfigureScrollbar(TkScrollbar* scrollPtr); +MODULE_SCOPE int TkpScrollbarPosition(TkScrollbar* scrollPtr, int x, int y); + +#endif /* _TKSCROLLBAR */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkSelect.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkSelect.h new file mode 100644 index 0000000..8536827 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkSelect.h @@ -0,0 +1,171 @@ +/* + * tkSelect.h -- + * + * Declarations of types shared among the files that implement selection + * support. + * + * Copyright (c) 1995 Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TKSELECT +#define _TKSELECT + +/* + * When a selection is owned by a window on a given display, one of the + * following structures is present on a list of current selections in the + * display structure. The structure is used to record the current owner of a + * selection for use in later retrieval requests. There is a list of such + * structures because a display can have multiple different selections active + * at the same time. + */ + +typedef struct TkSelectionInfo { + Atom selection; /* Selection name, e.g. XA_PRIMARY. */ + Tk_Window owner; /* Current owner of this selection. */ + int serial; /* Serial number of last XSelectionSetOwner + * request made to server for this selection + * (used to filter out redundant + * SelectionClear events). */ + Time time; /* Timestamp used to acquire selection. */ + Tk_LostSelProc* clearProc; /* Procedure to call when owner loses + * selection. */ + ClientData clearData; /* Info to pass to clearProc. */ + struct TkSelectionInfo* nextPtr; + /* Next in list of current selections on this + * display. NULL means end of list. */ +} TkSelectionInfo; + +/* + * One of the following structures exists for each selection handler created + * for a window by calling Tk_CreateSelHandler. The handlers are linked in a + * list rooted in the TkWindow structure. + */ + +typedef struct TkSelHandler { + Atom selection; /* Selection name, e.g. XA_PRIMARY. */ + Atom target; /* Target type for selection conversion, such + * as TARGETS or STRING. */ + Atom format; /* Format in which selection info will be + * returned, such as STRING or ATOM. */ + Tk_SelectionProc* proc; /* Procedure to generate selection in this + * format. */ + ClientData clientData; /* Argument to pass to proc. */ + int size; /* Size of units returned by proc (8 for + * STRING, 32 for almost anything else). */ + struct TkSelHandler* nextPtr; + /* Next selection handler associated with same + * window (NULL for end of list). */ +} TkSelHandler; + +/* + * When the selection is being retrieved, one of the following structures is + * present on a list of pending selection retrievals. The structure is used to + * communicate between the background procedure that requests the selection + * and the foreground event handler that processes the events in which the + * selection is returned. There is a list of such structures so that there can + * be multiple simultaneous selection retrievals (e.g. on different displays). + */ + +typedef struct TkSelRetrievalInfo { + Tcl_Interp* interp; /* Interpreter for error reporting. */ + TkWindow* winPtr; /* Window used as requestor for selection. */ + Atom selection; /* Selection being requested. */ + Atom property; /* Property where selection will appear. */ + Atom target; /* Desired form for selection. */ + Tk_GetSelProc* proc; /* Procedure to call to handle pieces of + * selection. */ + ClientData clientData; /* Argument for proc. */ + int result; /* Initially -1. Set to a Tcl return value + * once the selection has been retrieved. */ + Tcl_TimerToken timeout; /* Token for current timeout procedure. */ + int idleTime; /* Number of seconds that have gone by without + * hearing anything from the selection + * owner. */ + Tcl_EncodingState encState; /* Holds intermediate state during translations + * of data that cross buffer boundaries. */ + int encFlags; /* Encoding translation state flags. */ + Tcl_DString buf; /* Buffer to hold translation data. */ + struct TkSelRetrievalInfo* nextPtr; + /* Next in list of all pending selection + * retrievals. NULL means end of list. */ +} TkSelRetrievalInfo; + +/* + * The clipboard contains a list of buffers of various types and formats. All + * of the buffers of a given type will be returned in sequence when the + * CLIPBOARD selection is retrieved. All buffers of a given type on the same + * clipboard must have the same format. The TkClipboardTarget structure is + * used to record the information about a chain of buffers of the same type. + */ + +typedef struct TkClipboardBuffer { + char* buffer; /* Null terminated data buffer. */ + long length; /* Length of string in buffer. */ + struct TkClipboardBuffer* nextPtr; + /* Next in list of buffers. NULL means end of + * list . */ +} TkClipboardBuffer; + +typedef struct TkClipboardTarget { + Atom type; /* Type conversion supported. */ + Atom format; /* Representation used for data. */ + TkClipboardBuffer* firstBufferPtr; + /* First in list of data buffers. */ + TkClipboardBuffer* lastBufferPtr; + /* Last in list of clipboard buffers. Used to + * speed up appends. */ + struct TkClipboardTarget* nextPtr; + /* Next in list of targets on clipboard. NULL + * means end of list. */ +} TkClipboardTarget; + +/* + * It is possible for a Tk_SelectionProc to delete the handler that it + * represents. If this happens, the code that is retrieving the selection + * needs to know about it so it doesn't use the now-defunct handler structure. + * One structure of the following form is created for each retrieval in + * progress, so that the retriever can find out if its handler is deleted. All + * of the pending retrievals (if there are more than one) are linked into a + * list. + */ + +typedef struct TkSelInProgress { + TkSelHandler* selPtr; /* Handler being executed. If this handler is + * deleted, the field is set to NULL. */ + struct TkSelInProgress* nextPtr; + /* Next higher nested search. */ +} TkSelInProgress; + +/* + * Chunk size for retrieving selection. It's defined both in words and in + * bytes; the word size is used to allocate buffer space that's guaranteed to + * be word-aligned and that has an extra character for the terminating NULL. + */ + +#define TK_SEL_BYTES_AT_ONCE 4000 +#define TK_SEL_WORDS_AT_ONCE 1001 + +/* + * Declarations for procedures that are used by the selection-related files + * but shouldn't be used anywhere else in Tk (or by Tk clients): + */ + +MODULE_SCOPE TkSelInProgress* TkSelGetInProgress(void); +MODULE_SCOPE void TkSelSetInProgress(TkSelInProgress* pendingPtr); +MODULE_SCOPE void TkSelClearSelection(Tk_Window tkwin, XEvent* eventPtr); +MODULE_SCOPE int TkSelDefaultSelection( + TkSelectionInfo* infoPtr, + Atom target, + char* buffer, + int maxBytes, + Atom* typePtr); +#ifndef TkSelUpdateClipboard +MODULE_SCOPE void TkSelUpdateClipboard( + TkWindow* winPtr, + TkClipboardTarget* targetPtr); +#endif + +#endif /* _TKSELECT */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkText.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkText.h new file mode 100644 index 0000000..130919c --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkText.h @@ -0,0 +1,1291 @@ +/* + * tkText.h -- + * + * Declarations shared among the files that implement text widgets. + * + * Copyright (c) 1992-1994 The Regents of the University of California. + * Copyright (c) 1994-1995 Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TKTEXT +#define _TKTEXT + +#ifndef _TK +#include "tk.h" +#endif + +#ifndef _TKUNDO +#include "tkUndo.h" +#endif + +/* + * The data structure below defines a single logical line of text (from + * newline to newline, not necessarily what appears on one display line of the + * screen). + */ + +typedef struct TkTextLine { + struct Node* parentPtr; /* Pointer to parent node containing line. */ + struct TkTextLine* nextPtr; /* Next in linked list of lines with same + * parent node in B-tree. NULL means end of + * list. */ + struct TkTextSegment* segPtr; + /* First in ordered list of segments that make + * up the line. */ + int* pixels; /* Array containing two integers for each + * referring text widget. The first of these + * is the number of vertical pixels taken up + * by this line, whether currently displayed + * or not. This number is only updated + * asychronously. The second of these is the + * last epoch at which the pixel height was + * recalculated. */ +} TkTextLine; + +/* + * ----------------------------------------------------------------------- + * Segments: each line is divided into one or more segments, where each + * segment is one of several things, such as a group of characters, a tag + * toggle, a mark, or an embedded widget. Each segment starts with a standard + * header followed by a body that varies from type to type. + * ----------------------------------------------------------------------- + */ + +/* + * The data structure below defines the body of a segment that represents a + * tag toggle. There is one of these structures at both the beginning and end + * of each tagged range. + */ + +typedef struct TkTextToggle { + struct TkTextTag* tagPtr; /* Tag that starts or ends here. */ + int inNodeCounts; /* 1 means this toggle has been accounted for + * in node toggle counts; 0 means it hasn't, + * yet. */ +} TkTextToggle; + +/* + * The data structure below defines line segments that represent marks. There + * is one of these for each mark in the text. + */ + +typedef struct TkTextMark { + struct TkText* textPtr; /* Overall information about text widget. */ + TkTextLine* linePtr; /* Line structure that contains the + * segment. */ + Tcl_HashEntry* hPtr; /* Pointer to hash table entry for mark (in + * sharedTextPtr->markTable). */ +} TkTextMark; + +/* + * A structure of the following type holds information for each window + * embedded in a text widget. This information is only used by the file + * tkTextWind.c + */ + +typedef struct TkTextEmbWindowClient { + struct TkText* textPtr; /* Information about the overall text + * widget. */ + Tk_Window tkwin; /* Window for this segment. NULL means that + * the window hasn't been created yet. */ + int chunkCount; /* Number of display chunks that refer to this + * window. */ + int displayed; /* Non-zero means that the window has been + * displayed on the screen recently. */ + struct TkTextSegment* parent; + struct TkTextEmbWindowClient* next; +} TkTextEmbWindowClient; + +typedef struct TkTextEmbWindow { + struct TkSharedText* sharedTextPtr; + /* Information about the shared portion of the + * text widget. */ + Tk_Window tkwin; /* Window for this segment. This is just a + * temporary value, copied from 'clients', to + * make option table updating easier. NULL + * means that the window hasn't been created + * yet. */ + TkTextLine* linePtr; /* Line structure that contains this + * window. */ + char* create; /* Script to create window on-demand. NULL + * means no such script. Malloc-ed. */ + int align; /* How to align window in vertical space. See + * definitions in tkTextWind.c. */ + int padX, padY; /* Padding to leave around each side of + * window, in pixels. */ + int stretch; /* Should window stretch to fill vertical + * space of line (except for pady)? 0 or 1. */ + Tk_OptionTable optionTable; /* Token representing the configuration + * specifications. */ + TkTextEmbWindowClient* clients; + /* Linked list of peer-widget specific + * information for this embedded window. */ +} TkTextEmbWindow; + +/* + * A structure of the following type holds information for each image embedded + * in a text widget. This information is only used by the file tkTextImage.c + */ + +typedef struct TkTextEmbImage { + struct TkSharedText* sharedTextPtr; + /* Information about the shared portion of the + * text widget. This is used when the image + * changes or is deleted. */ + TkTextLine* linePtr; /* Line structure that contains this image. */ + char* imageString; /* Name of the image for this segment. */ + char* imageName; /* Name used by text widget to identify this + * image. May be unique-ified. */ + char* name; /* Name used in the hash table. Used by + * "image names" to identify this instance of + * the image. */ + Tk_Image image; /* Image for this segment. NULL means that the + * image hasn't been created yet. */ + int align; /* How to align image in vertical space. See + * definitions in tkTextImage.c. */ + int padX, padY; /* Padding to leave around each side of image, + * in pixels. */ + int chunkCount; /* Number of display chunks that refer to this + * image. */ + Tk_OptionTable optionTable; /* Token representing the configuration + * specifications. */ +} TkTextEmbImage; + +/* + * The data structure below defines line segments. + */ + +typedef struct TkTextSegment { + const struct Tk_SegType* typePtr; + /* Pointer to record describing segment's + * type. */ + struct TkTextSegment* nextPtr; + /* Next in list of segments for this line, or + * NULL for end of list. */ + int size; /* Size of this segment (# of bytes of index + * space it occupies). */ + union { + char chars[2]; /* Characters that make up character info. + * Actual length varies to hold as many + * characters as needed.*/ + TkTextToggle toggle; /* Information about tag toggle. */ + TkTextMark mark; /* Information about mark. */ + TkTextEmbWindow ew; /* Information about embedded window. */ + TkTextEmbImage ei; /* Information about embedded image. */ + } body; +} TkTextSegment; + +/* + * Data structures of the type defined below are used during the execution of + * Tcl commands to keep track of various interesting places in a text. An + * index is only valid up until the next modification to the character + * structure of the b-tree so they can't be retained across Tcl commands. + * However, mods to marks or tags don't invalidate indices. + */ + +typedef struct TkTextIndex { + TkTextBTree tree; /* Tree containing desired position. */ + TkTextLine* linePtr; /* Pointer to line containing position of + * interest. */ + int byteIndex; /* Index within line of desired character (0 + * means first one). */ + struct TkText* textPtr; /* May be NULL, but otherwise the text widget + * with which this index is associated. If not + * NULL, then we have a refCount on the + * widget. */ +} TkTextIndex; + +/* + * Types for procedure pointers stored in TkTextDispChunk strutures: + */ + +typedef struct TkTextDispChunk TkTextDispChunk; + +typedef void Tk_ChunkDisplayProc( + struct TkText* textPtr, + TkTextDispChunk* chunkPtr, + int x, + int y, + int height, + int baseline, + Display* display, + Drawable dst, + int screenY); +typedef void Tk_ChunkUndisplayProc( + struct TkText* textPtr, + TkTextDispChunk* chunkPtr); +typedef int Tk_ChunkMeasureProc(TkTextDispChunk* chunkPtr, int x); +typedef void Tk_ChunkBboxProc( + struct TkText* textPtr, + TkTextDispChunk* chunkPtr, + int index, + int y, + int lineHeight, + int baseline, + int* xPtr, + int* yPtr, + int* widthPtr, + int* heightPtr); + +/* + * The structure below represents a chunk of stuff that is displayed together + * on the screen. This structure is allocated and freed by generic display + * code but most of its fields are filled in by segment-type-specific code. + */ + +struct TkTextDispChunk { + /* + * The fields below are set by the type-independent code before calling + * the segment-type-specific layoutProc. They should not be modified by + * segment-type-specific code. + */ + + int x; /* X position of chunk, in pixels. This + * position is measured from the left edge of + * the logical line, not from the left edge of + * the window (i.e. it doesn't change under + * horizontal scrolling). */ + struct TkTextDispChunk* nextPtr; + /* Next chunk in the display line or NULL for + * the end of the list. */ + struct TextStyle* stylePtr; /* Display information, known only to + * tkTextDisp.c. */ + + /* + * The fields below are set by the layoutProc that creates the chunk. + */ + + Tk_ChunkDisplayProc* displayProc; + /* Procedure to invoke to draw this chunk on + * the display or an off-screen pixmap. */ + Tk_ChunkUndisplayProc* undisplayProc; + /* Procedure to invoke when segment ceases to + * be displayed on screen anymore. */ + Tk_ChunkMeasureProc* measureProc; + /* Procedure to find character under a given + * x-location. */ + Tk_ChunkBboxProc* bboxProc; /* Procedure to find bounding box of character + * in chunk. */ + int numBytes; /* Number of bytes that will be displayed in + * the chunk. */ + int minAscent; /* Minimum space above the baseline needed by + * this chunk. */ + int minDescent; /* Minimum space below the baseline needed by + * this chunk. */ + int minHeight; /* Minimum total line height needed by this + * chunk. */ + int width; /* Width of this chunk, in pixels. Initially + * set by chunk-specific code, but may be + * increased to include tab or extra space at + * end of line. */ + int breakIndex; /* Index within chunk of last acceptable + * position for a line (break just before this + * byte index). <= 0 means don't break during + * or immediately after this chunk. */ + ClientData clientData; /* Additional information for use of + * displayProc and undisplayProc. */ +}; + +/* + * One data structure of the following type is used for each tag in a text + * widget. These structures are kept in sharedTextPtr->tagTable and referred + * to in other structures. + */ + +typedef enum { + TEXT_WRAPMODE_CHAR, + TEXT_WRAPMODE_NONE, + TEXT_WRAPMODE_WORD, + TEXT_WRAPMODE_NULL +} TkWrapMode; + +typedef struct TkTextTag { + const char* name; /* Name of this tag. This field is actually a + * pointer to the key from the entry in + * sharedTextPtr->tagTable, so it needn't be + * freed explicitly. For 'sel' tags this is + * just a static string, so again need not be + * freed. */ + const struct TkText* textPtr; + /* If non-NULL, then this tag only applies to + * the given text widget (when there are peer + * widgets). */ + int priority; /* Priority of this tag within widget. 0 means + * lowest priority. Exactly one tag has each + * integer value between 0 and numTags-1. */ + struct Node* tagRootPtr; /* Pointer into the B-Tree at the lowest node + * that completely dominates the ranges of + * text occupied by the tag. At this node + * there is no information about the tag. One + * or more children of the node do contain + * information about the tag. */ + int toggleCount; /* Total number of tag toggles. */ + + /* + * Information for displaying text with this tag. The information belows + * acts as an override on information specified by lower-priority tags. + * If no value is specified, then the next-lower-priority tag on the text + * determins the value. The text widget itself provides defaults if no tag + * specifies an override. + */ + + Tk_3DBorder border; /* Used for drawing background. NULL means no + * value specified here. */ + int borderWidth; /* Width of 3-D border for background. */ + Tcl_Obj* borderWidthPtr; /* Width of 3-D border for background. */ + char* reliefString; /* -relief option string (malloc-ed). NULL + * means option not specified. */ + int relief; /* 3-D relief for background. */ + Pixmap bgStipple; /* Stipple bitmap for background. None means + * no value specified here. */ + XColor* fgColor; /* Foreground color for text. NULL means no + * value specified here. */ + Tk_Font tkfont; /* Font for displaying text. NULL means no + * value specified here. */ + Pixmap fgStipple; /* Stipple bitmap for text and other + * foreground stuff. None means no value + * specified here.*/ + char* justifyString; /* -justify option string (malloc-ed). NULL + * means option not specified. */ + Tk_Justify justify; /* How to justify text: TK_JUSTIFY_LEFT, + * TK_JUSTIFY_RIGHT, or TK_JUSTIFY_CENTER. + * Only valid if justifyString is non-NULL. */ + char* lMargin1String; /* -lmargin1 option string (malloc-ed). NULL + * means option not specified. */ + int lMargin1; /* Left margin for first display line of each + * text line, in pixels. Only valid if + * lMargin1String is non-NULL. */ + char* lMargin2String; /* -lmargin2 option string (malloc-ed). NULL + * means option not specified. */ + int lMargin2; /* Left margin for second and later display + * lines of each text line, in pixels. Only + * valid if lMargin2String is non-NULL. */ + Tk_3DBorder lMarginColor; /* Used for drawing background in left margins. + * This is used for both lmargin1 and lmargin2. + * NULL means no value specified here. */ + char* offsetString; /* -offset option string (malloc-ed). NULL + * means option not specified. */ + int offset; /* Vertical offset of text's baseline from + * baseline of line. Used for superscripts and + * subscripts. Only valid if offsetString is + * non-NULL. */ + char* overstrikeString; /* -overstrike option string (malloc-ed). NULL + * means option not specified. */ + int overstrike; /* Non-zero means draw horizontal line through + * middle of text. Only valid if + * overstrikeString is non-NULL. */ + XColor* overstrikeColor; /* Color for the overstrike. NULL means same + * color as foreground. */ + char* rMarginString; /* -rmargin option string (malloc-ed). NULL + * means option not specified. */ + int rMargin; /* Right margin for text, in pixels. Only + * valid if rMarginString is non-NULL. */ + Tk_3DBorder rMarginColor; /* Used for drawing background in right margin. + * NULL means no value specified here. */ + Tk_3DBorder selBorder; /* Used for drawing background for selected text. + * NULL means no value specified here. */ + XColor* selFgColor; /* Foreground color for selected text. NULL means + * no value specified here. */ + char* spacing1String; /* -spacing1 option string (malloc-ed). NULL + * means option not specified. */ + int spacing1; /* Extra spacing above first display line for + * text line. Only valid if spacing1String is + * non-NULL. */ + char* spacing2String; /* -spacing2 option string (malloc-ed). NULL + * means option not specified. */ + int spacing2; /* Extra spacing between display lines for the + * same text line. Only valid if + * spacing2String is non-NULL. */ + char* spacing3String; /* -spacing2 option string (malloc-ed). NULL + * means option not specified. */ + int spacing3; /* Extra spacing below last display line for + * text line. Only valid if spacing3String is + * non-NULL. */ + Tcl_Obj* tabStringPtr; /* -tabs option string. NULL means option not + * specified. */ + struct TkTextTabArray* tabArrayPtr; + /* Info about tabs for tag (malloc-ed) or + * NULL. Corresponds to tabString. */ + int tabStyle; /* One of TABULAR or WORDPROCESSOR or NONE (if + * not specified). */ + char* underlineString; /* -underline option string (malloc-ed). NULL + * means option not specified. */ + int underline; /* Non-zero means draw underline underneath + * text. Only valid if underlineString is + * non-NULL. */ + XColor* underlineColor; /* Color for the underline. NULL means same + * color as foreground. */ + TkWrapMode wrapMode; /* How to handle wrap-around for this tag. + * Must be TEXT_WRAPMODE_CHAR, + * TEXT_WRAPMODE_NONE, TEXT_WRAPMODE_WORD, or + * TEXT_WRAPMODE_NULL to use wrapmode for + * whole widget. */ + char* elideString; /* -elide option string (malloc-ed). NULL + * means option not specified. */ + int elide; /* Non-zero means that data under this tag + * should not be displayed. */ + int affectsDisplay; /* Non-zero means that this tag affects the + * way information is displayed on the screen + * (so need to redisplay if tag changes). */ + Tk_OptionTable optionTable; /* Token representing the configuration + * specifications. */ + int affectsDisplayGeometry; /* Non-zero means that this tag affects the + * size with which information is displayed on + * the screen (so need to recalculate line + * dimensions if tag changes). */ +} TkTextTag; + +#define TK_TAG_AFFECTS_DISPLAY 0x1 +#define TK_TAG_UNDERLINE 0x2 +#define TK_TAG_JUSTIFY 0x4 +#define TK_TAG_OFFSET 0x10 + +/* + * The data structure below is used for searching a B-tree for transitions on + * a single tag (or for all tag transitions). No code outside of tkTextBTree.c + * should ever modify any of the fields in these structures, but it's OK to + * use them for read-only information. + */ + +typedef struct TkTextSearch { + TkTextIndex curIndex; /* Position of last tag transition returned by + * TkBTreeNextTag, or index of start of + * segment containing starting position for + * search if TkBTreeNextTag hasn't been called + * yet, or same as stopIndex if search is + * over. */ + TkTextSegment* segPtr; /* Actual tag segment returned by last call to + * TkBTreeNextTag, or NULL if TkBTreeNextTag + * hasn't returned anything yet. */ + TkTextSegment* nextPtr; /* Where to resume search in next call to + * TkBTreeNextTag. */ + TkTextSegment* lastPtr; /* Stop search before just before considering + * this segment. */ + TkTextTag* tagPtr; /* Tag to search for (or tag found, if allTags + * is non-zero). */ + int linesLeft; /* Lines left to search (including curIndex + * and stopIndex). When this becomes <= 0 the + * search is over. */ + int allTags; /* Non-zero means ignore tag check: search for + * transitions on all tags. */ +} TkTextSearch; + +/* + * The following data structure describes a single tab stop. It must be kept + * in sync with the 'tabOptionStrings' array in the function 'TkTextGetTabs' + */ + +typedef enum { LEFT, RIGHT, CENTER, NUMERIC } TkTextTabAlign; + +/* + * The following are the supported styles of tabbing, used for the -tabstyle + * option of the text widget. The last element is only used for tag options. + */ + +typedef enum { + TK_TEXT_TABSTYLE_TABULAR, + TK_TEXT_TABSTYLE_WORDPROCESSOR, + TK_TEXT_TABSTYLE_NONE +} TkTextTabStyle; + +typedef struct TkTextTab { + int location; /* Offset in pixels of this tab stop from the + * left margin (lmargin2) of the text. */ + TkTextTabAlign alignment; /* Where the tab stop appears relative to the + * text. */ +} TkTextTab; + +typedef struct TkTextTabArray { + int numTabs; /* Number of tab stops. */ + double lastTab; /* The accurate fractional pixel position of + * the last tab. */ + double tabIncrement; /* The accurate fractional pixel increment + * between interpolated tabs we have to create + * when we exceed numTabs. */ + TkTextTab tabs[1]; /* Array of tabs. The actual size will be + * numTabs. THIS FIELD MUST BE THE LAST IN THE + * STRUCTURE. */ +} TkTextTabArray; + +/* + * Enumeration defining the edit modes of the widget. + */ + +typedef enum { + TK_TEXT_EDIT_INSERT, /* insert mode */ + TK_TEXT_EDIT_DELETE, /* delete mode */ + TK_TEXT_EDIT_REPLACE, /* replace mode */ + TK_TEXT_EDIT_OTHER /* none of the above */ +} TkTextEditMode; + +/* + * Enumeration defining the ways in which a text widget may be modified (for + * undo/redo handling). + */ + +typedef enum { + TK_TEXT_DIRTY_NORMAL, /* Normal behavior. */ + TK_TEXT_DIRTY_UNDO, /* Reverting a compound action. */ + TK_TEXT_DIRTY_REDO, /* Reapplying a compound action. */ + TK_TEXT_DIRTY_FIXED /* Forced to be dirty; can't be undone/redone + * by normal activity. */ +} TkTextDirtyMode; + +/* + * The following enum is used to define a type for the -state option of the + * Text widget. + */ + +typedef enum { TK_TEXT_STATE_DISABLED, TK_TEXT_STATE_NORMAL } TkTextState; + +/* + * A data structure of the following type is shared between each text widget + * that are peers. + */ + +typedef struct TkSharedText { + int refCount; /* Reference count this shared object. */ + TkTextBTree tree; /* B-tree representation of text and tags for + * widget. */ + Tcl_HashTable tagTable; /* Hash table that maps from tag names to + * pointers to TkTextTag structures. The "sel" + * tag does not feature in this table, since + * there's one of those for each text peer. */ + int numTags; /* Number of tags currently defined for + * widget; needed to keep track of + * priorities. */ + Tcl_HashTable markTable; /* Hash table that maps from mark names to + * pointers to mark segments. The special + * "insert" and "current" marks are not stored + * in this table, but directly accessed as + * fields of textPtr. */ + Tcl_HashTable windowTable; /* Hash table that maps from window names to + * pointers to window segments. If a window + * segment doesn't yet have an associated + * window, there is no entry for it here. */ + Tcl_HashTable imageTable; /* Hash table that maps from image names to + * pointers to image segments. If an image + * segment doesn't yet have an associated + * image, there is no entry for it here. */ + Tk_BindingTable bindingTable; + /* Table of all bindings currently defined for + * this widget. NULL means that no bindings + * exist, so the table hasn't been created. + * Each "object" used for this table is the + * name of a tag. */ + int stateEpoch; /* This is incremented each time the B-tree's + * contents change structurally, or when the + * start/end limits change, and means that any + * cached TkTextIndex objects are no longer + * valid. */ + + /* + * Information related to the undo/redo functionality. + */ + + TkUndoRedoStack* undoStack; /* The undo/redo stack. */ + int undo; /* Non-zero means the undo/redo behaviour is + * enabled. */ + int maxUndo; /* The maximum depth of the undo stack + * expressed as the maximum number of compound + * statements. */ + int autoSeparators; /* Non-zero means the separators will be + * inserted automatically. */ + int isDirty; /* Flag indicating the 'dirtyness' of the + * text widget. If the flag is not zero, + * unsaved modifications have been applied to + * the text widget. */ + TkTextDirtyMode dirtyMode; /* The nature of the dirtyness characterized + * by the isDirty flag. */ + TkTextEditMode lastEditMode; /* Keeps track of what the last edit mode + * was. */ + + /* + * Keep track of all the peers + */ + + struct TkText* peers; +} TkSharedText; + +/* + * The following enum is used to define a type for the -insertunfocussed + * option of the Text widget. + */ + +typedef enum { + TK_TEXT_INSERT_NOFOCUS_HOLLOW, + TK_TEXT_INSERT_NOFOCUS_NONE, + TK_TEXT_INSERT_NOFOCUS_SOLID +} TkTextInsertUnfocussed; + +/* + * A data structure of the following type is kept for each text widget that + * currently exists for this process: + */ + +typedef struct TkText { + /* + * Information related to and accessed by widget peers and the + * TkSharedText handling routines. + */ + + TkSharedText* sharedTextPtr; /* Shared section of all peers. */ + struct TkText* next; /* Next in list of linked peers. */ + TkTextLine* start; /* First B-tree line to show, or NULL to start + * at the beginning. */ + TkTextLine* end; /* Last B-tree line to show, or NULL for up to + * the end. */ + int pixelReference; /* Counter into the current tree reference + * index corresponding to this widget. */ + int abortSelections; /* Set to 1 whenever the text is modified in a + * way that interferes with selection + * retrieval: used to abort incremental + * selection retrievals. */ + + /* + * Standard Tk widget information and text-widget specific items + */ + + Tk_Window tkwin; /* Window that embodies the text. NULL means + * that the window has been destroyed but the + * data structures haven't yet been cleaned + * up.*/ + Display* display; /* Display for widget. Needed, among other + * things, to allow resources to be freed even + * after tkwin has gone away. */ + Tcl_Interp* interp; /* Interpreter associated with widget. Used to + * delete widget command. */ + Tcl_Command widgetCmd; /* Token for text's widget command. */ + int state; /* Either STATE_NORMAL or STATE_DISABLED. A + * text widget is read-only when disabled. */ + + /* + * Default information for displaying (may be overridden by tags applied + * to ranges of characters). + */ + + Tk_3DBorder border; /* Structure used to draw 3-D border and + * default background. */ + int borderWidth; /* Width of 3-D border to draw around entire + * widget. */ + int padX, padY; /* Padding between text and window border. */ + int relief; /* 3-d effect for border around entire widget: + * TK_RELIEF_RAISED etc. */ + int highlightWidth; /* Width in pixels of highlight to draw around + * widget when it has the focus. <= 0 means + * don't draw a highlight. */ + XColor* highlightBgColorPtr; + /* Color for drawing traversal highlight area + * when highlight is off. */ + XColor* highlightColorPtr; /* Color for drawing traversal highlight. */ + Tk_Cursor cursor; /* Current cursor for window, or None. */ + XColor* fgColor; /* Default foreground color for text. */ + Tk_Font tkfont; /* Default font for displaying text. */ + int charWidth; /* Width of average character in default + * font. */ + int charHeight; /* Height of average character in default + * font, including line spacing. */ + int spacing1; /* Default extra spacing above first display + * line for each text line. */ + int spacing2; /* Default extra spacing between display lines + * for the same text line. */ + int spacing3; /* Default extra spacing below last display + * line for each text line. */ + Tcl_Obj* tabOptionPtr; /* Value of -tabs option string. */ + TkTextTabArray* tabArrayPtr; + /* Information about tab stops (malloc'ed). + * NULL means perform default tabbing + * behavior. */ + int tabStyle; /* One of TABULAR or WORDPROCESSOR. */ + + /* + * Additional information used for displaying: + */ + + TkWrapMode wrapMode; /* How to handle wrap-around. Must be + * TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or + * TEXT_WRAPMODE_WORD. */ + int width, height; /* Desired dimensions for window, measured in + * characters. */ + int setGrid; /* Non-zero means pass gridding information to + * window manager. */ + int prevWidth, prevHeight; /* Last known dimensions of window; used to + * detect changes in size. */ + TkTextIndex topIndex; /* Identifies first character in top display + * line of window. */ + struct TextDInfo* dInfoPtr; /* Information maintained by tkTextDisp.c. */ + + /* + * Information related to selection. + */ + + TkTextTag* selTagPtr; /* Pointer to "sel" tag. Used to tell when a + * new selection has been made. */ + Tk_3DBorder selBorder; /* Border and background for selected + * characters. This is a copy of information + * in *selTagPtr, so it shouldn't be + * explicitly freed. */ + Tk_3DBorder inactiveSelBorder; + /* Border and background for selected + * characters when they don't have the + * focus. */ + int selBorderWidth; /* Width of border around selection. */ + Tcl_Obj* selBorderWidthPtr; /* Width of border around selection. */ + XColor* selFgColorPtr; /* Foreground color for selected text. This is + * a copy of information in *selTagPtr, so it + * shouldn't be explicitly freed. */ + int exportSelection; /* Non-zero means tie "sel" tag to X + * selection. */ + TkTextIndex selIndex; /* Used during multi-pass selection + * retrievals. This index identifies the next + * character to be returned from the + * selection. */ + + /* + * Information related to insertion cursor: + */ + + TkTextSegment* insertMarkPtr; + /* Points to segment for "insert" mark. */ + Tk_3DBorder insertBorder; /* Used to draw vertical bar for insertion + * cursor. */ + int insertWidth; /* Total width of insert cursor. */ + int insertBorderWidth; /* Width of 3-D border around insert cursor */ + TkTextInsertUnfocussed insertUnfocussed; + /* How to display the insert cursor when the + * text widget does not have the focus. */ + int insertOnTime; /* Number of milliseconds cursor should spend + * in "on" state for each blink. */ + int insertOffTime; /* Number of milliseconds cursor should spend + * in "off" state for each blink. */ + Tcl_TimerToken insertBlinkHandler; + /* Timer handler used to blink cursor on and + * off. */ + + /* + * Information used for event bindings associated with tags: + */ + + TkTextSegment* currentMarkPtr; + /* Pointer to segment for "current" mark, or + * NULL if none. */ + XEvent pickEvent; /* The event from which the current character + * was chosen. Must be saved so that we can + * repick after modifications to the text. */ + int numCurTags; /* Number of tags associated with character at + * current mark. */ + TkTextTag** curTagArrayPtr; /* Pointer to array of tags for current mark, + * or NULL if none. */ + + /* + * Miscellaneous additional information: + */ + + char* takeFocus; /* Value of -takeFocus option; not used in the + * C code, but used by keyboard traversal + * scripts. Malloc'ed, but may be NULL. */ + char* xScrollCmd; /* Prefix of command to issue to update + * horizontal scrollbar when view changes. */ + char* yScrollCmd; /* Prefix of command to issue to update + * vertical scrollbar when view changes. */ + int flags; /* Miscellaneous flags; see below for + * definitions. */ + Tk_OptionTable optionTable; /* Token representing the configuration + * specifications. */ + int refCount; /* Number of cached TkTextIndex objects + * refering to us. */ + int insertCursorType; /* 0 = standard insertion cursor, 1 = block + * cursor. */ + + /* + * Copies of information from the shared section relating to the undo/redo + * functonality + */ + + int undo; /* Non-zero means the undo/redo behaviour is + * enabled. */ + int maxUndo; /* The maximum depth of the undo stack + * expressed as the maximum number of compound + * statements. */ + int autoSeparators; /* Non-zero means the separators will be + * inserted automatically. */ + Tcl_Obj* afterSyncCmd; /* Command to be executed when lines are up to + * date */ +} TkText; + +/* + * Flag values for TkText records: + * + * GOT_SELECTION: Non-zero means we've already claimed the + * selection. + * INSERT_ON: Non-zero means insertion cursor should be + * displayed on screen. + * GOT_FOCUS: Non-zero means this window has the input + * focus. + * BUTTON_DOWN: 1 means that a mouse button is currently down; + * this is used to implement grabs for the + * duration of button presses. + * UPDATE_SCROLLBARS: Non-zero means scrollbar(s) should be updated + * during next redisplay operation. + * NEED_REPICK This appears unused and should probably be + * ignored. + * OPTIONS_FREED The widget's options have been freed. + * DESTROYED The widget is going away. + */ + +#define GOT_SELECTION 1 +#define INSERT_ON 2 +#define GOT_FOCUS 4 +#define BUTTON_DOWN 8 +#define UPDATE_SCROLLBARS 0x10 +#define NEED_REPICK 0x20 +#define OPTIONS_FREED 0x40 +#define DESTROYED 0x80 + +/* + * Records of the following type define segment types in terms of a collection + * of procedures that may be called to manipulate segments of that type. + */ + +typedef TkTextSegment* Tk_SegSplitProc(struct TkTextSegment* segPtr, int index); +typedef int Tk_SegDeleteProc( + struct TkTextSegment* segPtr, + TkTextLine* linePtr, + int treeGone); +typedef TkTextSegment* Tk_SegCleanupProc( + struct TkTextSegment* segPtr, + TkTextLine* linePtr); +typedef void Tk_SegLineChangeProc( + struct TkTextSegment* segPtr, + TkTextLine* linePtr); +typedef int Tk_SegLayoutProc( + struct TkText* textPtr, + struct TkTextIndex* indexPtr, + TkTextSegment* segPtr, + int offset, + int maxX, + int maxChars, + int noCharsYet, + TkWrapMode wrapMode, + struct TkTextDispChunk* chunkPtr); +typedef void Tk_SegCheckProc(TkTextSegment* segPtr, TkTextLine* linePtr); + +typedef struct Tk_SegType { + const char* name; /* Name of this kind of segment. */ + int leftGravity; /* If a segment has zero size (e.g. a mark or + * tag toggle), does it attach to character to + * its left or right? 1 means left, 0 means + * right. */ + Tk_SegSplitProc* splitProc; /* Procedure to split large segment into two + * smaller ones. */ + Tk_SegDeleteProc* deleteProc; + /* Procedure to call to delete segment. */ + Tk_SegCleanupProc* cleanupProc; + /* After any change to a line, this procedure + * is invoked for all segments left in the + * line to perform any cleanup they wish + * (e.g. joining neighboring segments). */ + Tk_SegLineChangeProc* lineChangeProc; + /* Invoked when a segment is about to be moved + * from its current line to an earlier line + * because of a deletion. The linePtr is that + * for the segment's old line. CleanupProc + * will be invoked after the deletion is + * finished. */ + Tk_SegLayoutProc* layoutProc; + /* Returns size information when figuring out + * what to display in window. */ + Tk_SegCheckProc* checkProc; /* Called during consistency checks to check + * internal consistency of segment. */ +} Tk_SegType; + +/* + * The following type and items describe different flags for text widget items + * to count. They are used in both tkText.c and tkTextIndex.c, in + * 'CountIndices', 'TkTextIndexBackChars', 'TkTextIndexForwChars', and + * 'TkTextIndexCount'. + */ + +typedef int TkTextCountType; + +#define COUNT_CHARS 0 +#define COUNT_INDICES 1 +#define COUNT_DISPLAY 2 +#define COUNT_DISPLAY_CHARS (COUNT_CHARS | COUNT_DISPLAY) +#define COUNT_DISPLAY_INDICES (COUNT_INDICES | COUNT_DISPLAY) + +/* + * The following structure is used to keep track of elided text taking account + * of different tag priorities, it is need for quick calculations of whether a + * single index is elided, and to start at a given index and maintain a + * correct elide state as we move or count forwards or backwards. + */ + +#define LOTSA_TAGS 1000 +typedef struct TkTextElideInfo { + int numTags; /* Total tags in widget. */ + int elide; /* Is the state currently elided. */ + int elidePriority; /* Tag priority controlling elide state. */ + TkTextSegment* segPtr; /* Segment to look at next. */ + int segOffset; /* Offset of segment within line. */ + int deftagCnts[LOTSA_TAGS]; + TkTextTag* deftagPtrs[LOTSA_TAGS]; + int* tagCnts; /* 0 or 1 depending if the tag with that + * priority is on or off. */ + TkTextTag** tagPtrs; /* Only filled with a tagPtr if the + * corresponding tagCnt is 1. */ +} TkTextElideInfo; + +/* + * The constant below is used to specify a line when what is really wanted is + * the entire text. For now, just use a very big number. + */ + +#define TK_END_OF_TEXT 1000000 + +/* + * The following definition specifies the maximum number of characters needed + * in a string to hold a position specifier. + */ + +#define TK_POS_CHARS 30 + +/* + * Mask used for those options which may impact the pixel height calculations + * of individual lines displayed in the widget. + */ + +#define TK_TEXT_LINE_GEOMETRY 1 + +/* + * Mask used for those options which may impact the start and end lines used + * in the widget. + */ + +#define TK_TEXT_LINE_RANGE 2 + +/* + * Used as 'action' values in calls to TkTextInvalidateLineMetrics + */ + +#define TK_TEXT_INVALIDATE_ONLY 0 +#define TK_TEXT_INVALIDATE_INSERT 1 +#define TK_TEXT_INVALIDATE_DELETE 2 + +/* + * Used as special 'pickPlace' values in calls to TkTextSetYView. Zero or + * positive values indicate a number of pixels. + */ + +#define TK_TEXT_PICKPLACE -1 +#define TK_TEXT_NOPIXELADJUST -2 + +/* + * Declarations for variables shared among the text-related files: + */ + +MODULE_SCOPE int tkBTreeDebug; +MODULE_SCOPE int tkTextDebug; +MODULE_SCOPE const Tk_SegType tkTextCharType; +MODULE_SCOPE const Tk_SegType tkTextLeftMarkType; +MODULE_SCOPE const Tk_SegType tkTextRightMarkType; +MODULE_SCOPE const Tk_SegType tkTextToggleOnType; +MODULE_SCOPE const Tk_SegType tkTextToggleOffType; +MODULE_SCOPE const Tk_SegType tkTextEmbWindowType; +MODULE_SCOPE const Tk_SegType tkTextEmbImageType; + +/* + * Convenience macros for use by B-tree clients which want to access pixel + * information on each line. Currently only used by TkTextDisp.c + */ + +#define TkBTreeLinePixelCount(text, line) \ + (line)->pixels[2 * (text)->pixelReference] +#define TkBTreeLinePixelEpoch(text, line) \ + (line)->pixels[1 + 2 * (text)->pixelReference] + +/* + * Declarations for procedures that are used by the text-related files but + * shouldn't be used anywhere else in Tk (or by Tk clients): + */ + +MODULE_SCOPE int TkBTreeAdjustPixelHeight( + const TkText* textPtr, + TkTextLine* linePtr, + int newPixelHeight, + int mergedLogicalLines); +MODULE_SCOPE int TkBTreeCharTagged( + const TkTextIndex* indexPtr, + TkTextTag* tagPtr); +MODULE_SCOPE void TkBTreeCheck(TkTextBTree tree); +MODULE_SCOPE TkTextBTree TkBTreeCreate(TkSharedText* sharedTextPtr); +MODULE_SCOPE void +TkBTreeAddClient(TkTextBTree tree, TkText* textPtr, int defaultHeight); +MODULE_SCOPE void TkBTreeClientRangeChanged(TkText* textPtr, int defaultHeight); +MODULE_SCOPE void TkBTreeRemoveClient(TkTextBTree tree, TkText* textPtr); +MODULE_SCOPE void TkBTreeDestroy(TkTextBTree tree); +MODULE_SCOPE void TkBTreeDeleteIndexRange( + TkTextBTree tree, + TkTextIndex* index1Ptr, + TkTextIndex* index2Ptr); +MODULE_SCOPE int TkBTreeEpoch(TkTextBTree tree); +MODULE_SCOPE TkTextLine* +TkBTreeFindLine(TkTextBTree tree, const TkText* textPtr, int line); +MODULE_SCOPE TkTextLine* TkBTreeFindPixelLine( + TkTextBTree tree, + const TkText* textPtr, + int pixels, + int* pixelOffset); +MODULE_SCOPE TkTextTag** TkBTreeGetTags( + const TkTextIndex* indexPtr, + const TkText* textPtr, + int* numTagsPtr); +MODULE_SCOPE void +TkBTreeInsertChars(TkTextBTree tree, TkTextIndex* indexPtr, const char* string); +MODULE_SCOPE int TkBTreeLinesTo(const TkText* textPtr, TkTextLine* linePtr); +MODULE_SCOPE int TkBTreePixelsTo(const TkText* textPtr, TkTextLine* linePtr); +MODULE_SCOPE void TkBTreeLinkSegment( + TkTextSegment* segPtr, + TkTextIndex* indexPtr); +MODULE_SCOPE TkTextLine* TkBTreeNextLine( + const TkText* textPtr, + TkTextLine* linePtr); +MODULE_SCOPE int TkBTreeNextTag(TkTextSearch* searchPtr); +MODULE_SCOPE int TkBTreeNumPixels(TkTextBTree tree, const TkText* textPtr); +MODULE_SCOPE TkTextLine* TkBTreePreviousLine( + TkText* textPtr, + TkTextLine* linePtr); +MODULE_SCOPE int TkBTreePrevTag(TkTextSearch* searchPtr); +MODULE_SCOPE void TkBTreeStartSearch( + TkTextIndex* index1Ptr, + TkTextIndex* index2Ptr, + TkTextTag* tagPtr, + TkTextSearch* searchPtr); +MODULE_SCOPE void TkBTreeStartSearchBack( + TkTextIndex* index1Ptr, + TkTextIndex* index2Ptr, + TkTextTag* tagPtr, + TkTextSearch* searchPtr); +MODULE_SCOPE int TkBTreeTag( + TkTextIndex* index1Ptr, + TkTextIndex* index2Ptr, + TkTextTag* tagPtr, + int add); +MODULE_SCOPE void TkBTreeUnlinkSegment( + TkTextSegment* segPtr, + TkTextLine* linePtr); +MODULE_SCOPE void TkTextBindProc(ClientData clientData, XEvent* eventPtr); +MODULE_SCOPE void TkTextSelectionEvent(TkText* textPtr); +MODULE_SCOPE int TkTextIndexBbox( + TkText* textPtr, + const TkTextIndex* indexPtr, + int* xPtr, + int* yPtr, + int* widthPtr, + int* heightPtr, + int* charWidthPtr); +MODULE_SCOPE int TkTextCharLayoutProc( + TkText* textPtr, + TkTextIndex* indexPtr, + TkTextSegment* segPtr, + int offset, + int maxX, + int maxChars, + int noBreakYet, + TkWrapMode wrapMode, + TkTextDispChunk* chunkPtr); +MODULE_SCOPE void TkTextCreateDInfo(TkText* textPtr); +MODULE_SCOPE int TkTextDLineInfo( + TkText* textPtr, + const TkTextIndex* indexPtr, + int* xPtr, + int* yPtr, + int* widthPtr, + int* heightPtr, + int* basePtr); +MODULE_SCOPE void TkTextEmbWinDisplayProc( + TkText* textPtr, + TkTextDispChunk* chunkPtr, + int x, + int y, + int lineHeight, + int baseline, + Display* display, + Drawable dst, + int screenY); +MODULE_SCOPE TkTextTag* +TkTextCreateTag(TkText* textPtr, const char* tagName, int* newTag); +MODULE_SCOPE void TkTextFreeDInfo(TkText* textPtr); +MODULE_SCOPE void TkTextDeleteTag(TkText* textPtr, TkTextTag* tagPtr); +MODULE_SCOPE void TkTextFreeTag(TkText* textPtr, TkTextTag* tagPtr); +MODULE_SCOPE int TkTextGetObjIndex( + Tcl_Interp* interp, + TkText* textPtr, + Tcl_Obj* idxPtr, + TkTextIndex* indexPtr); +MODULE_SCOPE int TkTextSharedGetObjIndex( + Tcl_Interp* interp, + TkSharedText* sharedTextPtr, + Tcl_Obj* idxPtr, + TkTextIndex* indexPtr); +MODULE_SCOPE const TkTextIndex* +TkTextGetIndexFromObj(Tcl_Interp* interp, TkText* textPtr, Tcl_Obj* objPtr); +MODULE_SCOPE TkTextTabArray* +TkTextGetTabs(Tcl_Interp* interp, TkText* textPtr, Tcl_Obj* stringPtr); +MODULE_SCOPE void TkTextFindDisplayLineEnd( + TkText* textPtr, + TkTextIndex* indexPtr, + int end, + int* xOffset); +MODULE_SCOPE void TkTextIndexBackChars( + const TkText* textPtr, + const TkTextIndex* srcPtr, + int count, + TkTextIndex* dstPtr, + TkTextCountType type); +MODULE_SCOPE int TkTextIndexCmp( + const TkTextIndex* index1Ptr, + const TkTextIndex* index2Ptr); +MODULE_SCOPE int TkTextIndexCountBytes( + const TkText* textPtr, + const TkTextIndex* index1Ptr, + const TkTextIndex* index2Ptr); +MODULE_SCOPE int TkTextIndexCount( + const TkText* textPtr, + const TkTextIndex* index1Ptr, + const TkTextIndex* index2Ptr, + TkTextCountType type); +MODULE_SCOPE void TkTextIndexForwChars( + const TkText* textPtr, + const TkTextIndex* srcPtr, + int count, + TkTextIndex* dstPtr, + TkTextCountType type); +MODULE_SCOPE void TkTextIndexOfX(TkText* textPtr, int x, TkTextIndex* indexPtr); +MODULE_SCOPE int TkTextIndexYPixels( + TkText* textPtr, + const TkTextIndex* indexPtr); +MODULE_SCOPE TkTextSegment* TkTextIndexToSeg( + const TkTextIndex* indexPtr, + int* offsetPtr); +MODULE_SCOPE void TkTextLostSelection(ClientData clientData); +MODULE_SCOPE TkTextIndex* TkTextMakeCharIndex( + TkTextBTree tree, + TkText* textPtr, + int lineIndex, + int charIndex, + TkTextIndex* indexPtr); +MODULE_SCOPE int +TkTextMeasureDown(TkText* textPtr, TkTextIndex* srcPtr, int distance); +MODULE_SCOPE void TkTextFreeElideInfo(TkTextElideInfo* infoPtr); +MODULE_SCOPE int TkTextIsElided( + const TkText* textPtr, + const TkTextIndex* indexPtr, + TkTextElideInfo* infoPtr); +MODULE_SCOPE int +TkTextMakePixelIndex(TkText* textPtr, int pixelIndex, TkTextIndex* indexPtr); +MODULE_SCOPE void TkTextInvalidateLineMetrics( + TkSharedText* sharedTextPtr, + TkText* textPtr, + TkTextLine* linePtr, + int lineCount, + int action); +MODULE_SCOPE int TkTextUpdateLineMetrics( + TkText* textPtr, + int lineNum, + int endLine, + int doThisMuch); +MODULE_SCOPE int TkTextUpdateOneLine( + TkText* textPtr, + TkTextLine* linePtr, + int pixelHeight, + TkTextIndex* indexPtr, + int partialCalc); +MODULE_SCOPE int TkTextMarkCmd( + TkText* textPtr, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int +TkTextMarkNameToIndex(TkText* textPtr, const char* name, TkTextIndex* indexPtr); +MODULE_SCOPE void TkTextMarkSegToIndex( + TkText* textPtr, + TkTextSegment* markPtr, + TkTextIndex* indexPtr); +MODULE_SCOPE void TkTextEventuallyRepick(TkText* textPtr); +MODULE_SCOPE Bool TkTextPendingsync(TkText* textPtr); +MODULE_SCOPE void TkTextPickCurrent(TkText* textPtr, XEvent* eventPtr); +MODULE_SCOPE void TkTextPixelIndex( + TkText* textPtr, + int x, + int y, + TkTextIndex* indexPtr, + int* nearest); +MODULE_SCOPE Tcl_Obj* TkTextNewIndexObj( + TkText* textPtr, + const TkTextIndex* indexPtr); +MODULE_SCOPE void +TkTextRedrawRegion(TkText* textPtr, int x, int y, int width, int height); +MODULE_SCOPE void TkTextRedrawTag( + TkSharedText* sharedTextPtr, + TkText* textPtr, + TkTextIndex* index1Ptr, + TkTextIndex* index2Ptr, + TkTextTag* tagPtr, + int withTag); +MODULE_SCOPE void TkTextRelayoutWindow(TkText* textPtr, int mask); +MODULE_SCOPE int TkTextScanCmd( + TkText* textPtr, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int TkTextSeeCmd( + TkText* textPtr, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int TkTextSegToOffset( + const TkTextSegment* segPtr, + const TkTextLine* linePtr); +MODULE_SCOPE void +TkTextSetYView(TkText* textPtr, TkTextIndex* indexPtr, int pickPlace); +MODULE_SCOPE int TkTextTagCmd( + TkText* textPtr, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int TkTextImageCmd( + TkText* textPtr, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int +TkTextImageIndex(TkText* textPtr, const char* name, TkTextIndex* indexPtr); +MODULE_SCOPE int TkTextWindowCmd( + TkText* textPtr, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE int +TkTextWindowIndex(TkText* textPtr, const char* name, TkTextIndex* indexPtr); +MODULE_SCOPE int TkTextYviewCmd( + TkText* textPtr, + Tcl_Interp* interp, + int objc, + Tcl_Obj* const objv[]); +MODULE_SCOPE void TkTextWinFreeClient( + Tcl_HashEntry* hPtr, + TkTextEmbWindowClient* client); + +#endif /* _TKTEXT */ + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkUndo.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkUndo.h new file mode 100644 index 0000000..43e24f4 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkUndo.h @@ -0,0 +1,121 @@ +/* + * tkUndo.h -- + * + * Declarations shared among the files that implement an undo stack. + * + * Copyright (c) 2002 Ludwig Callewaert. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TKUNDO +#define _TKUNDO + +#ifndef _TKINT +#include "tkInt.h" +#endif + +/* + * Enum defining the types used in an undo stack. + */ + +typedef enum { + TK_UNDO_SEPARATOR, /* Marker */ + TK_UNDO_ACTION /* Command */ +} TkUndoAtomType; + +/* + * Callback proc type to carry out an undo or redo action via C code. (Actions + * can also be defined by Tcl scripts). + */ + +typedef int( + TkUndoProc)(Tcl_Interp* interp, ClientData clientData, Tcl_Obj* objPtr); + +/* + * Struct defining a single action, one or more of which may be defined (and + * stored in a linked list) separately for each undo and redo action of an + * undo atom. + */ + +typedef struct TkUndoSubAtom { + Tcl_Command command; /* Tcl token used to get the current Tcl + * command name which will be used to execute + * apply/revert scripts. If NULL then it is + * assumed the apply/revert scripts already + * contain everything. */ + TkUndoProc* funcPtr; /* Function pointer for callback to perform + * undo/redo actions. */ + ClientData clientData; /* Data for 'funcPtr'. */ + Tcl_Obj* action; /* Command to apply the action that was + * taken. */ + struct TkUndoSubAtom* next; /* Pointer to the next element in the linked + * list. */ +} TkUndoSubAtom; + +/* + * Struct representing a single undo+redo atom to be placed in the stack. + */ + +typedef struct TkUndoAtom { + TkUndoAtomType type; /* The type that will trigger the required + * action. */ + TkUndoSubAtom* apply; /* Linked list of 'apply' actions to perform + * for this operation. */ + TkUndoSubAtom* revert; /* Linked list of 'revert' actions to perform + * for this operation. */ + struct TkUndoAtom* next; /* Pointer to the next element in the + * stack. */ +} TkUndoAtom; + +/* + * Struct defining a single undo+redo stack. + */ + +typedef struct TkUndoRedoStack { + TkUndoAtom* undoStack; /* The undo stack. */ + TkUndoAtom* redoStack; /* The redo stack. */ + Tcl_Interp* interp; /* The interpreter in which to execute the + * revert and apply scripts. */ + int maxdepth; + int depth; +} TkUndoRedoStack; + +/* + * Basic functions. + */ + +MODULE_SCOPE void TkUndoPushStack(TkUndoAtom** stack, TkUndoAtom* elem); +MODULE_SCOPE TkUndoAtom* TkUndoPopStack(TkUndoAtom** stack); +MODULE_SCOPE int TkUndoInsertSeparator(TkUndoAtom** stack); +MODULE_SCOPE void TkUndoClearStack(TkUndoAtom** stack); + +/* + * Functions for working on an undo/redo stack. + */ + +MODULE_SCOPE TkUndoRedoStack* TkUndoInitStack(Tcl_Interp* interp, int maxdepth); +MODULE_SCOPE void TkUndoSetMaxDepth(TkUndoRedoStack* stack, int maxdepth); +MODULE_SCOPE void TkUndoClearStacks(TkUndoRedoStack* stack); +MODULE_SCOPE void TkUndoFreeStack(TkUndoRedoStack* stack); +MODULE_SCOPE int TkUndoCanRedo(TkUndoRedoStack* stack); +MODULE_SCOPE int TkUndoCanUndo(TkUndoRedoStack* stack); +MODULE_SCOPE void TkUndoInsertUndoSeparator(TkUndoRedoStack* stack); +MODULE_SCOPE TkUndoSubAtom* TkUndoMakeCmdSubAtom( + Tcl_Command command, + Tcl_Obj* actionScript, + TkUndoSubAtom* subAtomList); +MODULE_SCOPE TkUndoSubAtom* TkUndoMakeSubAtom( + TkUndoProc* funcPtr, + ClientData clientData, + Tcl_Obj* actionScript, + TkUndoSubAtom* subAtomList); +MODULE_SCOPE void TkUndoPushAction( + TkUndoRedoStack* stack, + TkUndoSubAtom* apply, + TkUndoSubAtom* revert); +MODULE_SCOPE int TkUndoRevert(TkUndoRedoStack* stack); +MODULE_SCOPE int TkUndoApply(TkUndoRedoStack* stack); + +#endif /* _TKUNDO */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkUnixDefault.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkUnixDefault.h new file mode 100644 index 0000000..b0bd994 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkUnixDefault.h @@ -0,0 +1,533 @@ +/* + * tkUnixDefault.h -- + * + * This file defines the defaults for all options for all of + * the Tk widgets. + * + * Copyright (c) 1991-1994 The Regents of the University of California. + * Copyright (c) 1994-1997 Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TKUNIXDEFAULT +#define _TKUNIXDEFAULT + +/* + * The definitions below provide symbolic names for the default colors. + * NORMAL_BG - Normal background color. + * ACTIVE_BG - Background color when widget is active. + * SELECT_BG - Background color for selected text. + * TROUGH - Background color for troughs in scales and scrollbars. + * INDICATOR - Color for indicator when button is selected. + * DISABLED - Foreground color when widget is disabled. + */ + +#define BLACK "#000000" +#define WHITE "#ffffff" + +#define NORMAL_BG "#d9d9d9" +#define ACTIVE_BG "#ececec" +#define SELECT_BG "#c3c3c3" +#define TROUGH "#b3b3b3" +#define CHECK_INDICATOR WHITE +#define MENU_INDICATOR BLACK +#define DISABLED "#a3a3a3" + +/* + * Defaults for labels, buttons, checkbuttons, and radiobuttons: + */ + +#define DEF_BUTTON_ANCHOR "center" +#define DEF_BUTTON_ACTIVE_BG_COLOR ACTIVE_BG +#define DEF_BUTTON_ACTIVE_BG_MONO BLACK +#define DEF_BUTTON_ACTIVE_FG_COLOR BLACK +#define DEF_CHKRAD_ACTIVE_FG_COLOR DEF_BUTTON_ACTIVE_FG_COLOR +#define DEF_BUTTON_ACTIVE_FG_MONO WHITE +#define DEF_BUTTON_BG_COLOR NORMAL_BG +#define DEF_BUTTON_BG_MONO WHITE +#define DEF_BUTTON_BITMAP "" +#define DEF_BUTTON_BORDER_WIDTH "1" +#define DEF_BUTTON_CURSOR "" +#define DEF_BUTTON_COMPOUND "none" +#define DEF_BUTTON_COMMAND "" +#define DEF_BUTTON_DEFAULT "disabled" +#define DEF_BUTTON_DISABLED_FG_COLOR DISABLED +#define DEF_BUTTON_DISABLED_FG_MONO "" +#define DEF_BUTTON_FG BLACK +#define DEF_CHKRAD_FG DEF_BUTTON_FG +#define DEF_BUTTON_FONT "TkDefaultFont" +#define DEF_BUTTON_HEIGHT "0" +#define DEF_BUTTON_HIGHLIGHT_BG_COLOR DEF_BUTTON_BG_COLOR +#define DEF_BUTTON_HIGHLIGHT_BG_MONO DEF_BUTTON_BG_MONO +#define DEF_BUTTON_HIGHLIGHT BLACK +#define DEF_LABEL_HIGHLIGHT_WIDTH "0" +#define DEF_BUTTON_HIGHLIGHT_WIDTH "1" +#define DEF_BUTTON_IMAGE ((char*)NULL) +#define DEF_BUTTON_INDICATOR "1" +#define DEF_BUTTON_JUSTIFY "center" +#define DEF_BUTTON_OFF_VALUE "0" +#define DEF_BUTTON_ON_VALUE "1" +#define DEF_BUTTON_TRISTATE_VALUE "" +#define DEF_BUTTON_OVER_RELIEF "" +#define DEF_BUTTON_PADX "3m" +#define DEF_LABCHKRAD_PADX "1" +#define DEF_BUTTON_PADY "1m" +#define DEF_LABCHKRAD_PADY "1" +#define DEF_BUTTON_RELIEF "raised" +#define DEF_LABCHKRAD_RELIEF "flat" +#define DEF_BUTTON_REPEAT_DELAY "0" +#define DEF_BUTTON_REPEAT_INTERVAL "0" +#define DEF_BUTTON_SELECT_COLOR CHECK_INDICATOR +#define DEF_BUTTON_SELECT_MONO BLACK +#define DEF_BUTTON_SELECT_IMAGE ((char*)NULL) +#define DEF_BUTTON_STATE "normal" +#define DEF_LABEL_TAKE_FOCUS "0" +#define DEF_BUTTON_TAKE_FOCUS ((char*)NULL) +#define DEF_BUTTON_TEXT "" +#define DEF_BUTTON_TEXT_VARIABLE "" +#define DEF_BUTTON_UNDERLINE "-1" +#define DEF_BUTTON_VALUE "" +#define DEF_BUTTON_WIDTH "0" +#define DEF_BUTTON_WRAP_LENGTH "0" +#define DEF_RADIOBUTTON_VARIABLE "selectedButton" +#define DEF_CHECKBUTTON_VARIABLE "" + +/* + * Defaults for canvases: + */ + +#define DEF_CANVAS_BG_COLOR NORMAL_BG +#define DEF_CANVAS_BG_MONO WHITE +#define DEF_CANVAS_BORDER_WIDTH "0" +#define DEF_CANVAS_CLOSE_ENOUGH "1" +#define DEF_CANVAS_CONFINE "1" +#define DEF_CANVAS_CURSOR "" +#define DEF_CANVAS_HEIGHT "7c" +#define DEF_CANVAS_HIGHLIGHT_BG NORMAL_BG +#define DEF_CANVAS_HIGHLIGHT BLACK +#define DEF_CANVAS_HIGHLIGHT_WIDTH "1" +#define DEF_CANVAS_INSERT_BG BLACK +#define DEF_CANVAS_INSERT_BD_COLOR "0" +#define DEF_CANVAS_INSERT_BD_MONO "0" +#define DEF_CANVAS_INSERT_OFF_TIME "300" +#define DEF_CANVAS_INSERT_ON_TIME "600" +#define DEF_CANVAS_INSERT_WIDTH "2" +#define DEF_CANVAS_RELIEF "flat" +#define DEF_CANVAS_SCROLL_REGION "" +#define DEF_CANVAS_SELECT_COLOR SELECT_BG +#define DEF_CANVAS_SELECT_MONO BLACK +#define DEF_CANVAS_SELECT_BD_COLOR "1" +#define DEF_CANVAS_SELECT_BD_MONO "0" +#define DEF_CANVAS_SELECT_FG_COLOR BLACK +#define DEF_CANVAS_SELECT_FG_MONO WHITE +#define DEF_CANVAS_TAKE_FOCUS ((char*)NULL) +#define DEF_CANVAS_WIDTH "10c" +#define DEF_CANVAS_X_SCROLL_CMD "" +#define DEF_CANVAS_X_SCROLL_INCREMENT "0" +#define DEF_CANVAS_Y_SCROLL_CMD "" +#define DEF_CANVAS_Y_SCROLL_INCREMENT "0" + +/* + * Defaults for entries: + */ + +#define DEF_ENTRY_BG_COLOR WHITE +#define DEF_ENTRY_BG_MONO WHITE +#define DEF_ENTRY_BORDER_WIDTH "1" +#define DEF_ENTRY_CURSOR "xterm" +#define DEF_ENTRY_DISABLED_BG_COLOR NORMAL_BG +#define DEF_ENTRY_DISABLED_BG_MONO WHITE +#define DEF_ENTRY_DISABLED_FG DISABLED +#define DEF_ENTRY_EXPORT_SELECTION "1" +#define DEF_ENTRY_FONT "TkTextFont" +#define DEF_ENTRY_FG BLACK +#define DEF_ENTRY_HIGHLIGHT_BG NORMAL_BG +#define DEF_ENTRY_HIGHLIGHT BLACK +#define DEF_ENTRY_HIGHLIGHT_WIDTH "1" +#define DEF_ENTRY_INSERT_BG BLACK +#define DEF_ENTRY_INSERT_BD_COLOR "0" +#define DEF_ENTRY_INSERT_BD_MONO "0" +#define DEF_ENTRY_INSERT_OFF_TIME "300" +#define DEF_ENTRY_INSERT_ON_TIME "600" +#define DEF_ENTRY_INSERT_WIDTH "2" +#define DEF_ENTRY_JUSTIFY "left" +#define DEF_ENTRY_READONLY_BG_COLOR NORMAL_BG +#define DEF_ENTRY_READONLY_BG_MONO WHITE +#define DEF_ENTRY_RELIEF "sunken" +#define DEF_ENTRY_SCROLL_COMMAND "" +#define DEF_ENTRY_SELECT_COLOR SELECT_BG +#define DEF_ENTRY_SELECT_MONO BLACK +#define DEF_ENTRY_SELECT_BD_COLOR "0" +#define DEF_ENTRY_SELECT_BD_MONO "0" +#define DEF_ENTRY_SELECT_FG_COLOR BLACK +#define DEF_ENTRY_SELECT_FG_MONO WHITE +#define DEF_ENTRY_SHOW ((char*)NULL) +#define DEF_ENTRY_STATE "normal" +#define DEF_ENTRY_TAKE_FOCUS ((char*)NULL) +#define DEF_ENTRY_TEXT_VARIABLE "" +#define DEF_ENTRY_WIDTH "20" + +/* + * Defaults for frames: + */ + +#define DEF_FRAME_BG_COLOR NORMAL_BG +#define DEF_FRAME_BG_MONO WHITE +#define DEF_FRAME_BORDER_WIDTH "0" +#define DEF_FRAME_CLASS "Frame" +#define DEF_FRAME_COLORMAP "" +#define DEF_FRAME_CONTAINER "0" +#define DEF_FRAME_CURSOR "" +#define DEF_FRAME_HEIGHT "0" +#define DEF_FRAME_HIGHLIGHT_BG NORMAL_BG +#define DEF_FRAME_HIGHLIGHT BLACK +#define DEF_FRAME_HIGHLIGHT_WIDTH "0" +#define DEF_FRAME_LABEL "" +#define DEF_FRAME_PADX "0" +#define DEF_FRAME_PADY "0" +#define DEF_FRAME_RELIEF "flat" +#define DEF_FRAME_TAKE_FOCUS "0" +#define DEF_FRAME_VISUAL "" +#define DEF_FRAME_WIDTH "0" + +/* + * Defaults for labelframes: + */ + +#define DEF_LABELFRAME_BORDER_WIDTH "2" +#define DEF_LABELFRAME_CLASS "Labelframe" +#define DEF_LABELFRAME_RELIEF "groove" +#define DEF_LABELFRAME_FG BLACK +#define DEF_LABELFRAME_FONT "TkDefaultFont" +#define DEF_LABELFRAME_TEXT "" +#define DEF_LABELFRAME_LABELANCHOR "nw" + +/* + * Defaults for listboxes: + */ + +#define DEF_LISTBOX_ACTIVE_STYLE "dotbox" +#define DEF_LISTBOX_BG_COLOR WHITE +#define DEF_LISTBOX_BG_MONO WHITE +#define DEF_LISTBOX_BORDER_WIDTH "1" +#define DEF_LISTBOX_CURSOR "" +#define DEF_LISTBOX_DISABLED_FG DISABLED +#define DEF_LISTBOX_EXPORT_SELECTION "1" +#define DEF_LISTBOX_FONT "TkDefaultFont" +#define DEF_LISTBOX_FG BLACK +#define DEF_LISTBOX_HEIGHT "10" +#define DEF_LISTBOX_HIGHLIGHT_BG NORMAL_BG +#define DEF_LISTBOX_HIGHLIGHT BLACK +#define DEF_LISTBOX_HIGHLIGHT_WIDTH "1" +#define DEF_LISTBOX_JUSTIFY "left" +#define DEF_LISTBOX_RELIEF "sunken" +#define DEF_LISTBOX_SCROLL_COMMAND "" +#define DEF_LISTBOX_LIST_VARIABLE "" +#define DEF_LISTBOX_SELECT_COLOR SELECT_BG +#define DEF_LISTBOX_SELECT_MONO BLACK +#define DEF_LISTBOX_SELECT_BD "0" +#define DEF_LISTBOX_SELECT_FG_COLOR BLACK +#define DEF_LISTBOX_SELECT_FG_MONO WHITE +#define DEF_LISTBOX_SELECT_MODE "browse" +#define DEF_LISTBOX_SET_GRID "0" +#define DEF_LISTBOX_STATE "normal" +#define DEF_LISTBOX_TAKE_FOCUS ((char*)NULL) +#define DEF_LISTBOX_WIDTH "20" + +/* + * Defaults for individual entries of menus: + */ + +#define DEF_MENU_ENTRY_ACTIVE_BG ((char*)NULL) +#define DEF_MENU_ENTRY_ACTIVE_FG ((char*)NULL) +#define DEF_MENU_ENTRY_ACCELERATOR ((char*)NULL) +#define DEF_MENU_ENTRY_BG ((char*)NULL) +#define DEF_MENU_ENTRY_BITMAP None +#define DEF_MENU_ENTRY_COLUMN_BREAK "0" +#define DEF_MENU_ENTRY_COMMAND ((char*)NULL) +#define DEF_MENU_ENTRY_COMPOUND "none" +#define DEF_MENU_ENTRY_FG ((char*)NULL) +#define DEF_MENU_ENTRY_FONT ((char*)NULL) +#define DEF_MENU_ENTRY_HIDE_MARGIN "0" +#define DEF_MENU_ENTRY_IMAGE ((char*)NULL) +#define DEF_MENU_ENTRY_INDICATOR "1" +#define DEF_MENU_ENTRY_LABEL ((char*)NULL) +#define DEF_MENU_ENTRY_MENU ((char*)NULL) +#define DEF_MENU_ENTRY_OFF_VALUE "0" +#define DEF_MENU_ENTRY_ON_VALUE "1" +#define DEF_MENU_ENTRY_SELECT_IMAGE ((char*)NULL) +#define DEF_MENU_ENTRY_STATE "normal" +#define DEF_MENU_ENTRY_VALUE ((char*)NULL) +#define DEF_MENU_ENTRY_CHECK_VARIABLE ((char*)NULL) +#define DEF_MENU_ENTRY_RADIO_VARIABLE "selectedButton" +#define DEF_MENU_ENTRY_SELECT ((char*)NULL) +#define DEF_MENU_ENTRY_UNDERLINE "-1" + +/* + * Defaults for menus overall: + */ + +#define DEF_MENU_ACTIVE_BG_COLOR ACTIVE_BG +#define DEF_MENU_ACTIVE_BG_MONO BLACK +#define DEF_MENU_ACTIVE_BORDER_WIDTH "1" +#define DEF_MENU_ACTIVE_FG_COLOR BLACK +#define DEF_MENU_ACTIVE_FG_MONO WHITE +#define DEF_MENU_BG_COLOR NORMAL_BG +#define DEF_MENU_BG_MONO WHITE +#define DEF_MENU_BORDER_WIDTH "1" +#define DEF_MENU_CURSOR "arrow" +#define DEF_MENU_DISABLED_FG_COLOR DISABLED +#define DEF_MENU_DISABLED_FG_MONO "" +#define DEF_MENU_FONT "TkMenuFont" +#define DEF_MENU_FG BLACK +#define DEF_MENU_POST_COMMAND "" +#define DEF_MENU_RELIEF "raised" +#define DEF_MENU_SELECT_COLOR MENU_INDICATOR +#define DEF_MENU_SELECT_MONO BLACK +#define DEF_MENU_TAKE_FOCUS "0" +#define DEF_MENU_TEAROFF "1" +#define DEF_MENU_TEAROFF_CMD ((char*)NULL) +#define DEF_MENU_TITLE "" +#define DEF_MENU_TYPE "normal" + +/* + * Defaults for menubuttons: + */ + +#define DEF_MENUBUTTON_ANCHOR "center" +#define DEF_MENUBUTTON_ACTIVE_BG_COLOR ACTIVE_BG +#define DEF_MENUBUTTON_ACTIVE_BG_MONO BLACK +#define DEF_MENUBUTTON_ACTIVE_FG_COLOR BLACK +#define DEF_MENUBUTTON_ACTIVE_FG_MONO WHITE +#define DEF_MENUBUTTON_BG_COLOR NORMAL_BG +#define DEF_MENUBUTTON_BG_MONO WHITE +#define DEF_MENUBUTTON_BITMAP "" +#define DEF_MENUBUTTON_BORDER_WIDTH "1" +#define DEF_MENUBUTTON_CURSOR "" +#define DEF_MENUBUTTON_DIRECTION "below" +#define DEF_MENUBUTTON_DISABLED_FG_COLOR DISABLED +#define DEF_MENUBUTTON_DISABLED_FG_MONO "" +#define DEF_MENUBUTTON_FONT "TkDefaultFont" +#define DEF_MENUBUTTON_FG BLACK +#define DEF_MENUBUTTON_HEIGHT "0" +#define DEF_MENUBUTTON_HIGHLIGHT_BG_COLOR DEF_MENUBUTTON_BG_COLOR +#define DEF_MENUBUTTON_HIGHLIGHT_BG_MONO DEF_MENUBUTTON_BG_MONO +#define DEF_MENUBUTTON_HIGHLIGHT BLACK +#define DEF_MENUBUTTON_HIGHLIGHT_WIDTH "0" +#define DEF_MENUBUTTON_IMAGE ((char*)NULL) +#define DEF_MENUBUTTON_INDICATOR "0" +#define DEF_MENUBUTTON_JUSTIFY "center" +#define DEF_MENUBUTTON_MENU "" +#define DEF_MENUBUTTON_PADX "4p" +#define DEF_MENUBUTTON_PADY "3p" +#define DEF_MENUBUTTON_RELIEF "flat" +#define DEF_MENUBUTTON_STATE "normal" +#define DEF_MENUBUTTON_TAKE_FOCUS "0" +#define DEF_MENUBUTTON_TEXT "" +#define DEF_MENUBUTTON_TEXT_VARIABLE "" +#define DEF_MENUBUTTON_UNDERLINE "-1" +#define DEF_MENUBUTTON_WIDTH "0" +#define DEF_MENUBUTTON_WRAP_LENGTH "0" + +/* + * Defaults for messages: + */ + +#define DEF_MESSAGE_ANCHOR "center" +#define DEF_MESSAGE_ASPECT "150" +#define DEF_MESSAGE_BG_COLOR NORMAL_BG +#define DEF_MESSAGE_BG_MONO WHITE +#define DEF_MESSAGE_BORDER_WIDTH "1" +#define DEF_MESSAGE_CURSOR "" +#define DEF_MESSAGE_FG BLACK +#define DEF_MESSAGE_FONT "TkDefaultFont" +#define DEF_MESSAGE_HIGHLIGHT_BG NORMAL_BG +#define DEF_MESSAGE_HIGHLIGHT BLACK +#define DEF_MESSAGE_HIGHLIGHT_WIDTH "0" +#define DEF_MESSAGE_JUSTIFY "left" +#define DEF_MESSAGE_PADX "-1" +#define DEF_MESSAGE_PADY "-1" +#define DEF_MESSAGE_RELIEF "flat" +#define DEF_MESSAGE_TAKE_FOCUS "0" +#define DEF_MESSAGE_TEXT "" +#define DEF_MESSAGE_TEXT_VARIABLE "" +#define DEF_MESSAGE_WIDTH "0" + +/* + * Defaults for panedwindows + */ + +#define DEF_PANEDWINDOW_BG_COLOR NORMAL_BG +#define DEF_PANEDWINDOW_BG_MONO WHITE +#define DEF_PANEDWINDOW_BORDERWIDTH "1" +#define DEF_PANEDWINDOW_CURSOR "" +#define DEF_PANEDWINDOW_HANDLEPAD "8" +#define DEF_PANEDWINDOW_HANDLESIZE "8" +#define DEF_PANEDWINDOW_HEIGHT "" +#define DEF_PANEDWINDOW_OPAQUERESIZE "1" +#define DEF_PANEDWINDOW_ORIENT "horizontal" +#define DEF_PANEDWINDOW_PROXYBORDER "2" +#define DEF_PANEDWINDOW_RELIEF "flat" +#define DEF_PANEDWINDOW_SASHCURSOR "" +#define DEF_PANEDWINDOW_SASHPAD "0" +#define DEF_PANEDWINDOW_SASHRELIEF "flat" +#define DEF_PANEDWINDOW_SASHWIDTH "3" +#define DEF_PANEDWINDOW_SHOWHANDLE "0" +#define DEF_PANEDWINDOW_WIDTH "" + +/* + * Defaults for panedwindow panes + */ + +#define DEF_PANEDWINDOW_PANE_AFTER "" +#define DEF_PANEDWINDOW_PANE_BEFORE "" +#define DEF_PANEDWINDOW_PANE_HEIGHT "" +#define DEF_PANEDWINDOW_PANE_MINSIZE "0" +#define DEF_PANEDWINDOW_PANE_PADX "0" +#define DEF_PANEDWINDOW_PANE_PADY "0" +#define DEF_PANEDWINDOW_PANE_STICKY "nsew" +#define DEF_PANEDWINDOW_PANE_WIDTH "" +#define DEF_PANEDWINDOW_PANE_HIDE "0" +#define DEF_PANEDWINDOW_PANE_STRETCH "last" + +/* + * Defaults for scales: + */ + +#define DEF_SCALE_ACTIVE_BG_COLOR ACTIVE_BG +#define DEF_SCALE_ACTIVE_BG_MONO BLACK +#define DEF_SCALE_BG_COLOR NORMAL_BG +#define DEF_SCALE_BG_MONO WHITE +#define DEF_SCALE_BIG_INCREMENT "0" +#define DEF_SCALE_BORDER_WIDTH "1" +#define DEF_SCALE_COMMAND "" +#define DEF_SCALE_CURSOR "" +#define DEF_SCALE_DIGITS "0" +#define DEF_SCALE_FONT "TkDefaultFont" +#define DEF_SCALE_FG_COLOR BLACK +#define DEF_SCALE_FG_MONO BLACK +#define DEF_SCALE_FROM "0" +#define DEF_SCALE_HIGHLIGHT_BG_COLOR DEF_SCALE_BG_COLOR +#define DEF_SCALE_HIGHLIGHT_BG_MONO DEF_SCALE_BG_MONO +#define DEF_SCALE_HIGHLIGHT BLACK +#define DEF_SCALE_HIGHLIGHT_WIDTH "1" +#define DEF_SCALE_LABEL "" +#define DEF_SCALE_LENGTH "100" +#define DEF_SCALE_ORIENT "vertical" +#define DEF_SCALE_RELIEF "flat" +#define DEF_SCALE_REPEAT_DELAY "300" +#define DEF_SCALE_REPEAT_INTERVAL "100" +#define DEF_SCALE_RESOLUTION "1" +#define DEF_SCALE_TROUGH_COLOR TROUGH +#define DEF_SCALE_TROUGH_MONO WHITE +#define DEF_SCALE_SHOW_VALUE "1" +#define DEF_SCALE_SLIDER_LENGTH "30" +#define DEF_SCALE_SLIDER_RELIEF "raised" +#define DEF_SCALE_STATE "normal" +#define DEF_SCALE_TAKE_FOCUS ((char*)NULL) +#define DEF_SCALE_TICK_INTERVAL "0" +#define DEF_SCALE_TO "100" +#define DEF_SCALE_VARIABLE "" +#define DEF_SCALE_WIDTH "15" + +/* + * Defaults for scrollbars: + */ + +#define DEF_SCROLLBAR_ACTIVE_BG_COLOR ACTIVE_BG +#define DEF_SCROLLBAR_ACTIVE_BG_MONO BLACK +#define DEF_SCROLLBAR_ACTIVE_RELIEF "raised" +#define DEF_SCROLLBAR_BG_COLOR NORMAL_BG +#define DEF_SCROLLBAR_BG_MONO WHITE +#define DEF_SCROLLBAR_BORDER_WIDTH "1" +#define DEF_SCROLLBAR_COMMAND "" +#define DEF_SCROLLBAR_CURSOR "" +#define DEF_SCROLLBAR_EL_BORDER_WIDTH "-1" +#define DEF_SCROLLBAR_HIGHLIGHT_BG NORMAL_BG +#define DEF_SCROLLBAR_HIGHLIGHT BLACK +#define DEF_SCROLLBAR_HIGHLIGHT_WIDTH "0" +#define DEF_SCROLLBAR_JUMP "0" +#define DEF_SCROLLBAR_ORIENT "vertical" +#define DEF_SCROLLBAR_RELIEF "sunken" +#define DEF_SCROLLBAR_REPEAT_DELAY "300" +#define DEF_SCROLLBAR_REPEAT_INTERVAL "100" +#define DEF_SCROLLBAR_TAKE_FOCUS ((char*)NULL) +#define DEF_SCROLLBAR_TROUGH_COLOR TROUGH +#define DEF_SCROLLBAR_TROUGH_MONO WHITE +#define DEF_SCROLLBAR_WIDTH "11" + +/* + * Defaults for texts: + */ + +#define DEF_TEXT_AUTO_SEPARATORS "1" +#define DEF_TEXT_BG_COLOR WHITE +#define DEF_TEXT_BG_MONO WHITE +#define DEF_TEXT_BLOCK_CURSOR "0" +#define DEF_TEXT_BORDER_WIDTH "1" +#define DEF_TEXT_CURSOR "xterm" +#define DEF_TEXT_FG BLACK +#define DEF_TEXT_EXPORT_SELECTION "1" +#define DEF_TEXT_FONT "TkFixedFont" +#define DEF_TEXT_HEIGHT "24" +#define DEF_TEXT_HIGHLIGHT_BG NORMAL_BG +#define DEF_TEXT_HIGHLIGHT BLACK +#define DEF_TEXT_HIGHLIGHT_WIDTH "1" +#define DEF_TEXT_INSERT_BG BLACK +#define DEF_TEXT_INSERT_BD_COLOR "0" +#define DEF_TEXT_INSERT_BD_MONO "0" +#define DEF_TEXT_INSERT_OFF_TIME "300" +#define DEF_TEXT_INSERT_ON_TIME "600" +#define DEF_TEXT_INSERT_UNFOCUSSED "none" +#define DEF_TEXT_INSERT_WIDTH "2" +#define DEF_TEXT_MAX_UNDO "0" +#define DEF_TEXT_PADX "1" +#define DEF_TEXT_PADY "1" +#define DEF_TEXT_RELIEF "sunken" +#define DEF_TEXT_INACTIVE_SELECT_COLOR SELECT_BG +#define DEF_TEXT_SELECT_COLOR SELECT_BG +#define DEF_TEXT_SELECT_MONO BLACK +#define DEF_TEXT_SELECT_BD_COLOR "0" +#define DEF_TEXT_SELECT_BD_MONO "0" +#define DEF_TEXT_SELECT_FG_COLOR BLACK +#define DEF_TEXT_SELECT_FG_MONO WHITE +#define DEF_TEXT_SELECT_RELIEF "raised" +#define DEF_TEXT_SET_GRID "0" +#define DEF_TEXT_SPACING1 "0" +#define DEF_TEXT_SPACING2 "0" +#define DEF_TEXT_SPACING3 "0" +#define DEF_TEXT_STATE "normal" +#define DEF_TEXT_TABS "" +#define DEF_TEXT_TABSTYLE "tabular" +#define DEF_TEXT_TAKE_FOCUS ((char*)NULL) +#define DEF_TEXT_UNDO "0" +#define DEF_TEXT_WIDTH "80" +#define DEF_TEXT_WRAP "char" +#define DEF_TEXT_XSCROLL_COMMAND "" +#define DEF_TEXT_YSCROLL_COMMAND "" + +/* + * Defaults for canvas text: + */ + +#define DEF_CANVTEXT_FONT "TkDefaultFont" + +/* + * Defaults for toplevels (most of the defaults for frames also apply + * to toplevels): + */ + +#define DEF_TOPLEVEL_CLASS "Toplevel" +#define DEF_TOPLEVEL_MENU "" +#define DEF_TOPLEVEL_SCREEN "" +#define DEF_TOPLEVEL_USE "" + +/* + * Defaults for busy windows: + */ + +#define DEF_BUSY_CURSOR "watch" + +#endif /* _TKUNIXDEFAULT */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkUnixInt.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkUnixInt.h new file mode 100644 index 0000000..e0a417f --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkUnixInt.h @@ -0,0 +1,35 @@ +/* + * tkUnixInt.h -- + * + * This file contains declarations that are shared among the + * UNIX-specific parts of Tk but aren't used by the rest of Tk. + * + * Copyright (c) 1995-1997 Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TKUNIXINT +#define _TKUNIXINT + +#ifndef _TKINT +#include "tkInt.h" +#endif + +/* + * Prototypes for procedures that are referenced in files other than the ones + * they're defined in. + */ + +#include "tkIntPlatDecls.h" + +#endif /* _TKUNIXINT */ + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/tkUnixPort.h b/src_cpp/elfgames/tasks/elf2codingenv/include/tkUnixPort.h new file mode 100644 index 0000000..1acedc5 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/tkUnixPort.h @@ -0,0 +1,206 @@ +/* + * tkUnixPort.h -- + * + * This file is included by all of the Tk C files. It contains + * information that may be configuration-dependent, such as + * #includes for system include files and a few other things. + * + * Copyright (c) 1991-1993 The Regents of the University of California. + * Copyright (c) 1994-1996 Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _UNIXPORT +#define _UNIXPORT + +#define __UNIX__ 1 + +#include +#include +#include +#include +#include +#include +#ifdef NO_STDLIB_H +#include "../compat/stdlib.h" +#else +#include +#endif +#include +#include +#include +#ifdef HAVE_SYS_SELECT_H +#include +#endif +#include +#ifndef _TCL +#include +#endif +#if TIME_WITH_SYS_TIME +#include +#include +#else +#if HAVE_SYS_TIME_H +#include +#else +#include +#endif +#endif +#if HAVE_INTTYPES_H +#include +#endif +#ifndef NO_UNISTD_H +#include +#else +#include "../compat/unistd.h" +#endif +#include +#include +#include +#include +#include +#include +#include + +/* + * The following macro defines the type of the mask arguments to + * select: + */ + +#ifndef NO_FD_SET +#define SELECT_MASK fd_set +#else +#ifndef _AIX +typedef long fd_mask; +#endif +#if defined(_IBMR2) +#define SELECT_MASK void +#else +#define SELECT_MASK int +#endif +#endif + +/* + * The following macro defines the number of fd_masks in an fd_set: + */ + +#ifndef FD_SETSIZE +#ifdef OPEN_MAX +#define FD_SETSIZE OPEN_MAX +#else +#define FD_SETSIZE 256 +#endif +#endif +#if !defined(howmany) +#define howmany(x, y) (((x) + ((y)-1)) / (y)) +#endif +#ifndef NFDBITS +#define NFDBITS NBBY * sizeof(fd_mask) +#endif +#define MASK_SIZE howmany(FD_SETSIZE, NFDBITS) + +/* + * Define "NBBY" (number of bits per byte) if it's not already defined. + */ + +#ifndef NBBY +#define NBBY 8 +#endif + +#ifdef __CYGWIN__ +#include "tkIntXlibDecls.h" +#define UINT unsigned int +#define HWND void* +#define HDC void* +#define HINSTANCE void* +#define COLORREF void* +#define HMENU void* +#define TkWinDCState void +#define HPALETTE void* +#define WNDPROC void* +#define WPARAM void* +#define LPARAM void* +#define LRESULT void* + +#else /* !__CYGWIN__ */ +/* + * The TkPutImage macro strips off the color table information, which isn't + * needed for X. + */ + +#define TkPutImage( \ + colors, \ + ncolors, \ + display, \ + pixels, \ + gc, \ + image, \ + srcx, \ + srcy, \ + destx, \ + desty, \ + width, \ + height) \ + XPutImage( \ + display, pixels, gc, image, srcx, srcy, destx, desty, width, height); + +#endif /* !__CYGWIN__ */ + +/* + * Supply macros for seek offsets, if they're not already provided by + * an include file. + */ + +#ifndef SEEK_SET +#define SEEK_SET 0 +#endif + +#ifndef SEEK_CUR +#define SEEK_CUR 1 +#endif + +#ifndef SEEK_END +#define SEEK_END 2 +#endif + +/* + * Declarations for various library procedures that may not be declared + * in any other header file. + */ + +/* + * These functions do nothing under Unix, so we just eliminate calls to them. + */ + +#define TkpButtonSetDefaults() \ + {} +#define TkpDestroyButton(butPtr) \ + {} +#define TkSelUpdateClipboard(a, b) \ + {} +#ifndef __CYGWIN__ +#define TkSetPixmapColormap(p, c) \ + {} +#endif + +/* + * These calls implement native bitmaps which are not supported under + * UNIX. The macros eliminate the calls. + */ + +#define TkpDefineNativeBitmaps() +#define TkpCreateNativeBitmap(display, source) None +#define TkpGetNativeAppBitmap(display, name, w, h) None + +/* + * This macro stores a representation of the window handle in a string. + * This should perhaps use the real size of an XID. + */ + +#ifndef __CYGWIN__ +#define TkpPrintWindowId(buf, w) sprintf((buf), "%#08lx", (unsigned long)(w)) +#endif + +#endif /* _UNIXPORT */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/unctrl.h b/src_cpp/elfgames/tasks/elf2codingenv/include/unctrl.h new file mode 100644 index 0000000..581f6a5 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/unctrl.h @@ -0,0 +1,67 @@ +/**************************************************************************** + * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* + * unctrl.h + * + * Display a printable version of a control character. + * Control characters are displayed in caret notation (^x), DELETE is displayed + * as ^?. Printable characters are displayed as is. + */ + +/* $Id: unctrl.h.in,v 1.11 2009/04/18 21:00:52 tom Exp $ */ + +#ifndef NCURSES_UNCTRL_H_incl +#define NCURSES_UNCTRL_H_incl 1 + +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.1" + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#undef unctrl +NCURSES_EXPORT(NCURSES_CONST char*) unctrl(chtype); + +#if 1 +NCURSES_EXPORT(NCURSES_CONST char*) NCURSES_SP_NAME(unctrl)(SCREEN*, chtype); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* NCURSES_UNCTRL_H_incl */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/zconf.h b/src_cpp/elfgames/tasks/elf2codingenv/include/zconf.h new file mode 100644 index 0000000..bcb96ea --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/zconf.h @@ -0,0 +1,535 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#ifndef ZCONF_H +#define ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + * Even better than compiling with -DZ_PREFIX would be to use configure to set + * this permanently in zconf.h using "./configure --zprefix". + */ +#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ +#define Z_PREFIX_SET + +/* all linked symbols and init macros */ +#define _dist_code z__dist_code +#define _length_code z__length_code +#define _tr_align z__tr_align +#define _tr_flush_bits z__tr_flush_bits +#define _tr_flush_block z__tr_flush_block +#define _tr_init z__tr_init +#define _tr_stored_block z__tr_stored_block +#define _tr_tally z__tr_tally +#define adler32 z_adler32 +#define adler32_combine z_adler32_combine +#define adler32_combine64 z_adler32_combine64 +#define adler32_z z_adler32_z +#ifndef Z_SOLO +#define compress z_compress +#define compress2 z_compress2 +#define compressBound z_compressBound +#endif +#define crc32 z_crc32 +#define crc32_combine z_crc32_combine +#define crc32_combine64 z_crc32_combine64 +#define crc32_z z_crc32_z +#define deflate z_deflate +#define deflateBound z_deflateBound +#define deflateCopy z_deflateCopy +#define deflateEnd z_deflateEnd +#define deflateGetDictionary z_deflateGetDictionary +#define deflateInit z_deflateInit +#define deflateInit2 z_deflateInit2 +#define deflateInit2_ z_deflateInit2_ +#define deflateInit_ z_deflateInit_ +#define deflateParams z_deflateParams +#define deflatePending z_deflatePending +#define deflatePrime z_deflatePrime +#define deflateReset z_deflateReset +#define deflateResetKeep z_deflateResetKeep +#define deflateSetDictionary z_deflateSetDictionary +#define deflateSetHeader z_deflateSetHeader +#define deflateTune z_deflateTune +#define deflate_copyright z_deflate_copyright +#define get_crc_table z_get_crc_table +#ifndef Z_SOLO +#define gz_error z_gz_error +#define gz_intmax z_gz_intmax +#define gz_strwinerror z_gz_strwinerror +#define gzbuffer z_gzbuffer +#define gzclearerr z_gzclearerr +#define gzclose z_gzclose +#define gzclose_r z_gzclose_r +#define gzclose_w z_gzclose_w +#define gzdirect z_gzdirect +#define gzdopen z_gzdopen +#define gzeof z_gzeof +#define gzerror z_gzerror +#define gzflush z_gzflush +#define gzfread z_gzfread +#define gzfwrite z_gzfwrite +#define gzgetc z_gzgetc +#define gzgetc_ z_gzgetc_ +#define gzgets z_gzgets +#define gzoffset z_gzoffset +#define gzoffset64 z_gzoffset64 +#define gzopen z_gzopen +#define gzopen64 z_gzopen64 +#ifdef _WIN32 +#define gzopen_w z_gzopen_w +#endif +#define gzprintf z_gzprintf +#define gzputc z_gzputc +#define gzputs z_gzputs +#define gzread z_gzread +#define gzrewind z_gzrewind +#define gzseek z_gzseek +#define gzseek64 z_gzseek64 +#define gzsetparams z_gzsetparams +#define gztell z_gztell +#define gztell64 z_gztell64 +#define gzungetc z_gzungetc +#define gzvprintf z_gzvprintf +#define gzwrite z_gzwrite +#endif +#define inflate z_inflate +#define inflateBack z_inflateBack +#define inflateBackEnd z_inflateBackEnd +#define inflateBackInit z_inflateBackInit +#define inflateBackInit_ z_inflateBackInit_ +#define inflateCodesUsed z_inflateCodesUsed +#define inflateCopy z_inflateCopy +#define inflateEnd z_inflateEnd +#define inflateGetDictionary z_inflateGetDictionary +#define inflateGetHeader z_inflateGetHeader +#define inflateInit z_inflateInit +#define inflateInit2 z_inflateInit2 +#define inflateInit2_ z_inflateInit2_ +#define inflateInit_ z_inflateInit_ +#define inflateMark z_inflateMark +#define inflatePrime z_inflatePrime +#define inflateReset z_inflateReset +#define inflateReset2 z_inflateReset2 +#define inflateResetKeep z_inflateResetKeep +#define inflateSetDictionary z_inflateSetDictionary +#define inflateSync z_inflateSync +#define inflateSyncPoint z_inflateSyncPoint +#define inflateUndermine z_inflateUndermine +#define inflateValidate z_inflateValidate +#define inflate_copyright z_inflate_copyright +#define inflate_fast z_inflate_fast +#define inflate_table z_inflate_table +#ifndef Z_SOLO +#define uncompress z_uncompress +#define uncompress2 z_uncompress2 +#endif +#define zError z_zError +#ifndef Z_SOLO +#define zcalloc z_zcalloc +#define zcfree z_zcfree +#endif +#define zlibCompileFlags z_zlibCompileFlags +#define zlibVersion z_zlibVersion + +/* all zlib typedefs in zlib.h and zconf.h */ +#define Byte z_Byte +#define Bytef z_Bytef +#define alloc_func z_alloc_func +#define charf z_charf +#define free_func z_free_func +#ifndef Z_SOLO +#define gzFile z_gzFile +#endif +#define gz_header z_gz_header +#define gz_headerp z_gz_headerp +#define in_func z_in_func +#define intf z_intf +#define out_func z_out_func +#define uInt z_uInt +#define uIntf z_uIntf +#define uLong z_uLong +#define uLongf z_uLongf +#define voidp z_voidp +#define voidpc z_voidpc +#define voidpf z_voidpf + +/* all zlib structs in zlib.h and zconf.h */ +#define gz_header_s z_gz_header_s +#define internal_state z_internal_state + +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +#define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +#define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +#define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +#ifndef WIN32 +#define WIN32 +#endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +#if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +#ifndef SYS16BIT +#define SYS16BIT +#endif +#endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +#define MAXSEG_64K +#endif +#ifdef MSDOS +#define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +#ifndef STDC +#define STDC +#endif +#if __STDC_VERSION__ >= 199901L +#ifndef STDC99 +#define STDC99 +#endif +#endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +#define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +#define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +#define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +#define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +#define STDC +#endif + +#ifndef STDC +#ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +#define const /* note: need a more gentle solution here */ +#endif +#endif + +#if defined(ZLIB_CONST) && !defined(z_const) +#define z_const const +#else +#define z_const +#endif + +#ifdef Z_SOLO +typedef unsigned long z_size_t; +#else +#define z_longlong long long +#if defined(NO_SIZE_T) +typedef unsigned NO_SIZE_T z_size_t; +#elif defined(STDC) +#include +typedef size_t z_size_t; +#else +typedef unsigned long z_size_t; +#endif +#undef z_longlong +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +#ifdef MAXSEG_64K +#define MAX_MEM_LEVEL 8 +#else +#define MAX_MEM_LEVEL 9 +#endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +#define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus about 7 kilobytes + for small objects. +*/ + +/* Type declarations */ + +#ifndef OF /* function prototypes */ +#ifdef STDC +#define OF(args) args +#else +#define OF(args) () +#endif +#endif + +#ifndef Z_ARG /* function prototypes for stdarg */ +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +#define Z_ARG(args) args +#else +#define Z_ARG(args) () +#endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +#if defined(M_I86SM) || defined(M_I86MM) +/* MSC small or medium model */ +#define SMALL_MEDIUM +#ifdef _MSC_VER +#define FAR _far +#else +#define FAR far +#endif +#endif +#if (defined(__SMALL__) || defined(__MEDIUM__)) +/* Turbo C small or medium model */ +#define SMALL_MEDIUM +#ifdef __BORLANDC__ +#define FAR _far +#else +#define FAR far +#endif +#endif +#endif + +#if defined(WINDOWS) || defined(WIN32) +/* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +#ifdef ZLIB_DLL +#if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +#ifdef ZLIB_INTERNAL +#define ZEXTERN extern __declspec(dllexport) +#else +#define ZEXTERN extern __declspec(dllimport) +#endif +#endif +#endif /* ZLIB_DLL */ +/* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +#ifdef ZLIB_WINAPI +#ifdef FAR +#undef FAR +#endif +#include +/* No need for _export, use ZLIB.DEF instead. */ +/* For complete Windows compatibility, use WINAPI, not __stdcall. */ +#define ZEXPORT WINAPI +#ifdef WIN32 +#define ZEXPORTVA WINAPIV +#else +#define ZEXPORTVA FAR CDECL +#endif +#endif +#endif + +#if defined(__BEOS__) +#ifdef ZLIB_DLL +#ifdef ZLIB_INTERNAL +#define ZEXPORT __declspec(dllexport) +#define ZEXPORTVA __declspec(dllexport) +#else +#define ZEXPORT __declspec(dllimport) +#define ZEXPORTVA __declspec(dllimport) +#endif +#endif +#endif + +#ifndef ZEXTERN +#define ZEXTERN extern +#endif +#ifndef ZEXPORT +#define ZEXPORT +#endif +#ifndef ZEXPORTVA +#define ZEXPORTVA +#endif + +#ifndef FAR +#define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM +/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +#define Bytef Byte FAR +#else +typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC +typedef void const* voidpc; +typedef void FAR* voidpf; +typedef void* voidp; +#else +typedef Byte const* voidpc; +typedef Byte FAR* voidpf; +typedef Byte* voidp; +#endif + +#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) +#include +#if (UINT_MAX == 0xffffffffUL) +#define Z_U4 unsigned +#elif (ULONG_MAX == 0xffffffffUL) +#define Z_U4 unsigned long +#elif (USHRT_MAX == 0xffffffffUL) +#define Z_U4 unsigned short +#endif +#endif + +#ifdef Z_U4 +typedef Z_U4 z_crc_t; +#else +typedef unsigned long z_crc_t; +#endif + +#if 1 /* was set to #if 1 by ./configure */ +#define Z_HAVE_UNISTD_H +#endif + +#if 1 /* was set to #if 1 by ./configure */ +#define Z_HAVE_STDARG_H +#endif + +#ifdef STDC +#ifndef Z_SOLO +#include /* for off_t */ +#endif +#endif + +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +#ifndef Z_SOLO +#include /* for va_list */ +#endif +#endif + +#ifdef _WIN32 +#ifndef Z_SOLO +#include /* for wchar_t */ +#endif +#endif + +/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and + * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even + * though the former does not conform to the LFS document), but considering + * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as + * equivalently requesting no 64-bit operations + */ +#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 +#undef _LARGEFILE64_SOURCE +#endif + +#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) +#define Z_HAVE_UNISTD_H +#endif +#ifndef Z_SOLO +#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) +#include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ +#ifdef VMS +#include /* for off_t */ +#endif +#ifndef z_off_t +#define z_off_t off_t +#endif +#endif +#endif + +#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE - 0 +#define Z_LFS64 +#endif + +#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) +#define Z_LARGE64 +#endif + +#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS - 0 == 64 && \ + defined(Z_LFS64) +#define Z_WANT64 +#endif + +#if !defined(SEEK_SET) && !defined(Z_SOLO) +#define SEEK_SET 0 /* Seek from beginning of file. */ +#define SEEK_CUR 1 /* Seek from current position. */ +#define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif + +#ifndef z_off_t +#define z_off_t long +#endif + +#if !defined(_WIN32) && defined(Z_LARGE64) +#define z_off64_t off64_t +#else +#if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) +#define z_off64_t __int64 +#else +#define z_off64_t z_off_t +#endif +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) +#pragma map(deflateInit_, "DEIN") +#pragma map(deflateInit2_, "DEIN2") +#pragma map(deflateEnd, "DEEND") +#pragma map(deflateBound, "DEBND") +#pragma map(inflateInit_, "ININ") +#pragma map(inflateInit2_, "ININ2") +#pragma map(inflateEnd, "INEND") +#pragma map(inflateSync, "INSY") +#pragma map(inflateSetDictionary, "INSEDI") +#pragma map(compressBound, "CMBND") +#pragma map(inflate_table, "INTABL") +#pragma map(inflate_fast, "INFA") +#pragma map(inflate_copyright, "INCOPY") +#endif + +#endif /* ZCONF_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/include/zlib.h b/src_cpp/elfgames/tasks/elf2codingenv/include/zlib.h new file mode 100644 index 0000000..fa595c3 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/include/zlib.h @@ -0,0 +1,1908 @@ +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.2.11, January 15th, 2017 + + Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 + (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). +*/ + +#ifndef ZLIB_H +#define ZLIB_H + +#include "zconf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZLIB_VERSION "1.2.11" +#define ZLIB_VERNUM 0x12b0 +#define ZLIB_VER_MAJOR 1 +#define ZLIB_VER_MINOR 2 +#define ZLIB_VER_REVISION 11 +#define ZLIB_VER_SUBREVISION 0 + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed data. + This version of the library supports only one compression method (deflation) + but other algorithms will be added later and will have the same stream + interface. + + Compression can be done in a single step if the buffers are large enough, + or can be done by repeated calls of the compression function. In the latter + case, the application must provide more input and/or consume the output + (providing more output space) before each call. + + The compressed data format used by default by the in-memory functions is + the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped + around a deflate stream, which is itself documented in RFC 1951. + + The library also supports reading and writing files in gzip (.gz) format + with an interface similar to that of stdio using the functions that start + with "gz". The gzip format is different from the zlib format. gzip is a + gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. + + This library can optionally read and write gzip and raw deflate streams in + memory as well. + + The zlib format was designed to be compact and fast for use in memory + and on communications channels. The gzip format was designed for single- + file compression on file systems, has a larger header than zlib to maintain + directory information, and uses a different, slower check method than zlib. + + The library does not install any signal handler. The decoder checks + the consistency of the compressed data, so the library should never crash + even in the case of corrupted input. +*/ + +typedef voidpf(*alloc_func) OF((voidpf opaque, uInt items, uInt size)); +typedef void(*free_func) OF((voidpf opaque, voidpf address)); + +struct internal_state; + +typedef struct z_stream_s { + z_const Bytef* next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total number of input bytes read so far */ + + Bytef* next_out; /* next output byte will go here */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total number of bytes output so far */ + + z_const char* msg; /* last error message, NULL if no error */ + struct internal_state FAR* state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: binary or text + for deflate, or the decoding state for inflate */ + uLong adler; /* Adler-32 or CRC-32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR* z_streamp; + +/* + gzip header information passed to and from zlib routines. See RFC 1952 + for more details on the meanings of these fields. +*/ +typedef struct gz_header_s { + int text; /* true if compressed data believed to be text */ + uLong time; /* modification time */ + int xflags; /* extra flags (not used when writing a gzip file) */ + int os; /* operating system */ + Bytef* extra; /* pointer to extra field or Z_NULL if none */ + uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ + uInt extra_max; /* space at extra (only when reading header) */ + Bytef* name; /* pointer to zero-terminated file name or Z_NULL */ + uInt name_max; /* space at name (only when reading header) */ + Bytef* comment; /* pointer to zero-terminated comment or Z_NULL */ + uInt comm_max; /* space at comment (only when reading header) */ + int hcrc; /* true if there was or will be a header crc */ + int done; /* true when done reading gzip header (not used + when writing a gzip file) */ +} gz_header; + +typedef gz_header FAR* gz_headerp; + +/* + The application must update next_in and avail_in when avail_in has dropped + to zero. It must update next_out and avail_out when avail_out has dropped + to zero. The application must initialize zalloc, zfree and opaque before + calling the init function. All other fields are set by the compression + library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + If zlib is used in a multi-threaded application, zalloc and zfree must be + thread safe. In that case, zlib is thread-safe. When zalloc and zfree are + Z_NULL on entry to the initialization function, they are set to internal + routines that use the standard library functions malloc() and free(). + + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this if + the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers + returned by zalloc for objects of exactly 65536 bytes *must* have their + offset normalized to zero. The default allocation function provided by this + library ensures this (see zutil.c). To reduce memory requirements and avoid + any allocation of 64K objects, at the expense of compression ratio, compile + the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or progress + reports. After compression, total_in holds the total size of the + uncompressed data and may be saved for use by the decompressor (particularly + if the decompressor wants to decompress everything in a single step). +*/ + +/* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 +#define Z_BLOCK 5 +#define Z_TREES 6 +/* Allowed flush values; see deflate() and inflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_RLE 3 +#define Z_FIXED 4 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_TEXT 1 +#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ +#define Z_UNKNOWN 2 +/* Possible values of the data_type field for deflate() */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + +/* basic functions */ + +ZEXTERN const char* ZEXPORT zlibVersion OF((void)); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is not + compatible with the zlib.h header file used by the application. This check + is automatically made by deflateInit and inflateInit. + */ + +/* +ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. If + zalloc and zfree are set to Z_NULL, deflateInit updates them to use default + allocation functions. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at all + (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION + requests a default compromise between speed and compression (currently + equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if level is not a valid compression level, or + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). msg is set to null + if there is no error message. deflateInit does not perform any compression: + this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); +/* + deflate compresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. deflate performs one or both of the + following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Generate more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary. Some output may be provided even if + flush is zero. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating avail_in or avail_out accordingly; avail_out should + never be zero before the call. The application can consume the compressed + output when it wants, for example when the output buffer is full (avail_out + == 0), or after each call of deflate(). If deflate returns Z_OK and with + zero avail_out, it must be called again after making room in the output + buffer because there might be more output pending. See deflatePending(), + which can be used if desired to determine whether or not there is more ouput + in that case. + + Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to + decide how much data to accumulate before producing output, in order to + maximize compression. + + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is + flushed to the output buffer and the output is aligned on a byte boundary, so + that the decompressor can get all input data available so far. (In + particular avail_in is zero after the call if enough output space has been + provided before the call.) Flushing may degrade compression for some + compression algorithms and so it should be used only when necessary. This + completes the current deflate block and follows it with an empty stored block + that is three bits plus filler bits to the next byte, followed by four bytes + (00 00 ff ff). + + If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the + output buffer, but the output is not aligned to a byte boundary. All of the + input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. + This completes the current deflate block and follows it with an empty fixed + codes block that is 10 bits long. This assures that enough bytes are output + in order for the decompressor to finish the block before the empty fixed + codes block. + + If flush is set to Z_BLOCK, a deflate block is completed and emitted, as + for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to + seven bits of the current block are held to be written as the next byte after + the next deflate block is completed. In this case, the decompressor may not + be provided enough bits at this point in order to complete decompression of + the data provided so far to the compressor. It may need to wait for the next + block to be emitted. This is for advanced applications that need to control + the emission of deflate blocks. + + If flush is set to Z_FULL_FLUSH, all output is flushed as with + Z_SYNC_FLUSH, and the compression state is reset so that decompression can + restart from this point if previous compressed data has been damaged or if + random access is desired. Using Z_FULL_FLUSH too often can seriously degrade + compression. + + If deflate returns with avail_out == 0, this function must be called again + with the same value of the flush parameter and more output space (updated + avail_out), until the flush is complete (deflate returns with non-zero + avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that + avail_out is greater than six to avoid repeated flush markers due to + avail_out == 0 on return. + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there was + enough output space. If deflate returns with Z_OK or Z_BUF_ERROR, this + function must be called again with Z_FINISH and more output space (updated + avail_out) but no more input data, until it returns with Z_STREAM_END or an + error. After deflate has returned Z_STREAM_END, the only possible operations + on the stream are deflateReset or deflateEnd. + + Z_FINISH can be used in the first deflate call after deflateInit if all the + compression is to be done in a single step. In order to complete in one + call, avail_out must be at least the value returned by deflateBound (see + below). Then deflate is guaranteed to return Z_STREAM_END. If not enough + output space is provided, deflate will not return Z_STREAM_END, and it must + be called again as described above. + + deflate() sets strm->adler to the Adler-32 checksum of all input read + so far (that is, total_in bytes). If a gzip stream is being generated, then + strm->adler will be the CRC-32 checksum of the input read so far. (See + deflateInit2 below.) + + deflate() may update strm->data_type if it can make a good guess about + the input data type (Z_BINARY or Z_TEXT). If in doubt, the data is + considered binary. This field is only for information purposes and does not + affect the compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was Z_NULL or the state was inadvertently written over + by the application), or Z_BUF_ERROR if no progress is possible (for example + avail_in or avail_out was zero). Note that Z_BUF_ERROR is not fatal, and + deflate() can be called again with more input and more output space to + continue compressing. +*/ + +ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, msg + may be set but then points to a static string (which must not be + deallocated). +*/ + +/* +ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); + + Initializes the internal stream state for decompression. The fields + next_in, avail_in, zalloc, zfree and opaque must be initialized before by + the caller. In the current version of inflate, the provided input is not + read or consumed. The allocation of a sliding window will be deferred to + the first call of inflate (if the decompression does not complete on the + first call). If zalloc and zfree are set to Z_NULL, inflateInit updates + them to use default allocation functions. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit does not perform any decompression. + Actual decompression will be done by inflate(). So next_in, and avail_in, + next_out, and avail_out are unused and unchanged. The current + implementation of inflateInit() does not process any header information -- + that is deferred until inflate() is called. +*/ + +ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); +/* + inflate decompresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. inflate performs one or both of the + following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), then next_in and avail_in are updated + accordingly, and processing will resume at this point for the next call of + inflate(). + + - Generate more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there is + no more input data or no more space in the output buffer (see below about + the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating the next_* and avail_* values accordingly. If the + caller of inflate() does not provide both available input and available + output space, it is possible that there will be no progress made. The + application can consume the uncompressed output when it wants, for example + when the output buffer is full (avail_out == 0), or after each call of + inflate(). If inflate returns Z_OK and with zero avail_out, it must be + called again after making room in the output buffer because there might be + more output pending. + + The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, + Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much + output as possible to the output buffer. Z_BLOCK requests that inflate() + stop if and when it gets to the next deflate block boundary. When decoding + the zlib or gzip format, this will cause inflate() to return immediately + after the header and before the first block. When doing a raw inflate, + inflate() will go ahead and process the first block, and will return when it + gets to the end of that block, or when it runs out of data. + + The Z_BLOCK option assists in appending to or combining deflate streams. + To assist in this, on return inflate() always sets strm->data_type to the + number of unused bits in the last byte taken from strm->next_in, plus 64 if + inflate() is currently decoding the last block in the deflate stream, plus + 128 if inflate() returned immediately after decoding an end-of-block code or + decoding the complete header up to just before the first byte of the deflate + stream. The end-of-block will not be indicated until all of the uncompressed + data from that block has been written to strm->next_out. The number of + unused bits may in general be greater than seven, except when bit 7 of + data_type is set, in which case the number of unused bits will be less than + eight. data_type is set as noted here every time inflate() returns for all + flush options, and so can be used to determine the amount of currently + consumed input in bits. + + The Z_TREES option behaves as Z_BLOCK does, but it also returns when the + end of each deflate block header is reached, before any actual data in that + block is decoded. This allows the caller to determine the length of the + deflate block header for later use in random access within a deflate block. + 256 is added to the value of strm->data_type when inflate() returns + immediately after reaching the end of the deflate block header. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step (a + single call of inflate), the parameter flush should be set to Z_FINISH. In + this case all pending input is processed and all pending output is flushed; + avail_out must be large enough to hold all of the uncompressed data for the + operation to complete. (The size of the uncompressed data may have been + saved by the compressor for this purpose.) The use of Z_FINISH is not + required to perform an inflation in one step. However it may be used to + inform inflate that a faster approach can be used for the single inflate() + call. Z_FINISH also informs inflate to not maintain a sliding window if the + stream completes, which reduces inflate's memory footprint. If the stream + does not complete, either because not all of the stream is provided or not + enough output space is provided, then a sliding window will be allocated and + inflate() can be called again to continue the operation as if Z_NO_FLUSH had + been used. + + In this implementation, inflate() always flushes as much output as + possible to the output buffer, and always uses the faster approach on the + first call. So the effects of the flush parameter in this implementation are + on the return value of inflate() as noted below, when inflate() returns early + when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of + memory for a sliding window when Z_FINISH is used. + + If a preset dictionary is needed after this call (see inflateSetDictionary + below), inflate sets strm->adler to the Adler-32 checksum of the dictionary + chosen by the compressor and returns Z_NEED_DICT; otherwise it sets + strm->adler to the Adler-32 checksum of all output produced so far (that is, + total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described + below. At the end of the stream, inflate() checks that its computed Adler-32 + checksum is equal to that saved by the compressor and returns Z_STREAM_END + only if the checksum is correct. + + inflate() can decompress and check either zlib-wrapped or gzip-wrapped + deflate data. The header type is detected automatically, if requested when + initializing with inflateInit2(). Any information contained in the gzip + header is not retained unless inflateGetHeader() is used. When processing + gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output + produced so far. The CRC-32 is checked against the gzip trailer, as is the + uncompressed length, modulo 2^32. + + inflate() returns Z_OK if some progress has been made (more input processed + or more output produced), Z_STREAM_END if the end of the compressed data has + been reached and all uncompressed output has been produced, Z_NEED_DICT if a + preset dictionary is needed at this point, Z_DATA_ERROR if the input data was + corrupted (input stream not conforming to the zlib format or incorrect check + value, in which case strm->msg points to a string with a more specific + error), Z_STREAM_ERROR if the stream structure was inconsistent (for example + next_in or next_out was Z_NULL, or the state was inadvertently written over + by the application), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR + if no progress was possible or if there was not enough room in the output + buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and + inflate() can be called again with more input and more output space to + continue decompressing. If Z_DATA_ERROR is returned, the application may + then call inflateSync() to look for a good compression block if a partial + recovery of the data is to be attempted. +*/ + +ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + inflateEnd returns Z_OK if success, or Z_STREAM_ERROR if the stream state + was inconsistent. +*/ + +/* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy)); + + This is another version of deflateInit with more compression options. The + fields next_in, zalloc, zfree and opaque must be initialized before by the + caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library. Larger values of this parameter result in better + compression at the expense of memory usage. The default value is 15 if + deflateInit is used instead. + + For the current implementation of deflate(), a windowBits value of 8 (a + window size of 256 bytes) is not supported. As a result, a request for 8 + will result in 9 (a 512-byte window). In that case, providing 8 to + inflateInit2() will result in an error when the zlib header with 9 is + checked against the initialization of inflate(). The remedy is to not use 8 + with deflateInit2() with this initialization, or at least in that case use 9 + with inflateInit2(). + + windowBits can also be -8..-15 for raw deflate. In this case, -windowBits + determines the window size. deflate() will then generate raw deflate data + with no zlib header or trailer, and will not compute a check value. + + windowBits can also be greater than 15 for optional gzip encoding. Add + 16 to windowBits to write a simple gzip header and trailer around the + compressed data instead of a zlib wrapper. The gzip header will have no + file name, no extra data, no comment, no modification time (set to zero), no + header crc, and the operating system will be set to the appropriate value, + if the operating system was determined at compile time. If a gzip stream is + being written, strm->adler is a CRC-32 instead of an Adler-32. + + For raw deflate or gzip encoding, a request for a 256-byte window is + rejected as invalid, since only the zlib header provides a means of + transmitting the window size to the decompressor. + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but is + slow and reduces compression ratio; memLevel=9 uses maximum memory for + optimal speed. The default value is 8. See zconf.h for total memory usage + as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match), or Z_RLE to limit match distances to one (run-length + encoding). Filtered data consists mostly of small values with a somewhat + random distribution. In this case, the compression algorithm is tuned to + compress them better. The effect of Z_FILTERED is to force more Huffman + coding and less string matching; it is somewhat intermediate between + Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as + fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The + strategy parameter only affects the compression ratio but not the + correctness of the compressed output even if it is not set appropriately. + Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler + decoder for special applications. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid + method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is + incompatible with the version assumed by the caller (ZLIB_VERSION). msg is + set to null if there is no error message. deflateInit2 does not perform any + compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateSetDictionary +OF((z_streamp strm, const Bytef* dictionary, uInt dictLength)); +/* + Initializes the compression dictionary from the given byte sequence + without producing any compressed output. When using the zlib format, this + function must be called immediately after deflateInit, deflateInit2 or + deflateReset, and before any call of deflate. When doing raw deflate, this + function must be called either before any call of deflate, or immediately + after the completion of a deflate block, i.e. after all input has been + consumed and all output has been delivered when using any of the flush + options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The + compressor and decompressor must use exactly the same dictionary (see + inflateSetDictionary). + + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and can be + predicted with good accuracy; the data can then be compressed better than + with the default empty dictionary. + + Depending on the size of the compression data structures selected by + deflateInit or deflateInit2, a part of the dictionary may in effect be + discarded, for example if the dictionary is larger than the window size + provided in deflateInit or deflateInit2. Thus the strings most likely to be + useful should be put at the end of the dictionary, not at the front. In + addition, the current implementation of deflate will use at most the window + size minus 262 bytes of the provided dictionary. + + Upon return of this function, strm->adler is set to the Adler-32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The Adler-32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) If a raw deflate was requested, then the + Adler-32 value is not computed and strm->adler is not set. + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent (for example if deflate has already been called for this stream + or if not at a block boundary for raw deflate). deflateSetDictionary does + not perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateGetDictionary +OF((z_streamp strm, Bytef* dictionary, uInt* dictLength)); +/* + Returns the sliding dictionary being maintained by deflate. dictLength is + set to the number of bytes in the dictionary, and that many bytes are copied + to dictionary. dictionary must have enough space, where 32768 bytes is + always enough. If deflateGetDictionary() is called with dictionary equal to + Z_NULL, then only the dictionary length is returned, and nothing is copied. + Similary, if dictLength is Z_NULL, then it is not set. + + deflateGetDictionary() may return a length less than the window size, even + when more than the window size in input has been provided. It may return up + to 258 bytes less in that case, due to how zlib's implementation of deflate + manages the sliding window and lookahead for matches, where matches can be + up to 258 bytes long. If the application needs the last window-size bytes of + input, then that would need to be saved by the application outside of zlib. + + deflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the + stream state is inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and can + consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); +/* + This function is equivalent to deflateEnd followed by deflateInit, but + does not free and reallocate the internal compression state. The stream + will leave the compression level and any other attributes that may have been + set unchanged. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, int level, int strategy)); +/* + Dynamically update the compression level and compression strategy. The + interpretation of level and strategy is as in deflateInit2(). This can be + used to switch between compression and straight copy of the input data, or + to switch to a different kind of input data requiring a different strategy. + If the compression approach (which is a function of the level) or the + strategy is changed, and if any input has been consumed in a previous + deflate() call, then the input available so far is compressed with the old + level and strategy using deflate(strm, Z_BLOCK). There are three approaches + for the compression levels 0, 1..3, and 4..9 respectively. The new level + and strategy will take effect at the next call of deflate(). + + If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does + not have enough output space to complete, then the parameter change will not + take effect. In this case, deflateParams() can be called again with the + same parameters and more output space to try again. + + In order to assure a change in the parameters on the first try, the + deflate stream should be flushed using deflate() with Z_BLOCK or other flush + request until strm.avail_out is not zero, before calling deflateParams(). + Then no more input data should be provided before the deflateParams() call. + If this is done, the old level and strategy will be applied to the data + compressed before deflateParams(), and the new level and strategy will be + applied to the the data compressed after deflateParams(). + + deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream + state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if + there was not enough output space to complete the compression of the + available input data before a change in the strategy or approach. Note that + in the case of a Z_BUF_ERROR, the parameters are not changed. A return + value of Z_BUF_ERROR is not fatal, in which case deflateParams() can be + retried with more output space. +*/ + +ZEXTERN int ZEXPORT deflateTune +OF((z_streamp strm, + int good_length, + int max_lazy, + int nice_length, + int max_chain)); +/* + Fine tune deflate's internal compression parameters. This should only be + used by someone who understands the algorithm used by zlib's deflate for + searching for the best matching string, and even then only by the most + fanatic optimizer trying to squeeze out the last compressed bit for their + specific input data. Read the deflate.c source code for the meaning of the + max_lazy, good_length, nice_length, and max_chain parameters. + + deflateTune() can be called after deflateInit() or deflateInit2(), and + returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. + */ + +ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, uLong sourceLen)); +/* + deflateBound() returns an upper bound on the compressed size after + deflation of sourceLen bytes. It must be called after deflateInit() or + deflateInit2(), and after deflateSetHeader(), if used. This would be used + to allocate an output buffer for deflation in a single pass, and so would be + called before deflate(). If that first deflate() call is provided the + sourceLen input bytes, an output buffer allocated to the size returned by + deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed + to return Z_STREAM_END. Note that it is possible for the compressed size to + be larger than the value returned by deflateBound() if flush options other + than Z_FINISH or Z_NO_FLUSH are used. +*/ + +ZEXTERN int ZEXPORT deflatePending +OF((z_streamp strm, unsigned* pending, int* bits)); +/* + deflatePending() returns the number of bytes and bits of output that have + been generated, but not yet provided in the available output. The bytes not + provided would be due to the available output space having being consumed. + The number of bits of output not provided are between 0 and 7, where they + await more bits to join them in order to fill out a full byte. If pending + or bits are Z_NULL, then those values are not set. + + deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. + */ + +ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, int bits, int value)); +/* + deflatePrime() inserts bits in the deflate output stream. The intent + is that this function is used to start off the deflate output with the bits + leftover from a previous deflate stream when appending to it. As such, this + function can only be used for raw deflate, and must be used before the first + deflate() call after a deflateInit2() or deflateReset(). bits must be less + than or equal to 16, and that many of the least significant bits of value + will be inserted in the output. + + deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough + room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the + source stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, gz_headerp head)); +/* + deflateSetHeader() provides gzip header information for when a gzip + stream is requested by deflateInit2(). deflateSetHeader() may be called + after deflateInit2() or deflateReset() and before the first call of + deflate(). The text, time, os, extra field, name, and comment information + in the provided gz_header structure are written to the gzip header (xflag is + ignored -- the extra flags are set according to the compression level). The + caller must assure that, if not Z_NULL, name and comment are terminated with + a zero byte, and that if extra is not Z_NULL, that extra_len bytes are + available there. If hcrc is true, a gzip header crc is included. Note that + the current versions of the command-line version of gzip (up through version + 1.3.x) do not support header crc's, and will report that it is a "multi-part + gzip file" and give up. + + If deflateSetHeader is not used, the default gzip header has text false, + the time set to zero, and os set to 255, with no extra, name, or comment + fields. The gzip header is returned to the default state by deflateReset(). + + deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, + int windowBits)); + + This is another version of inflateInit with an extra parameter. The + fields next_in, avail_in, zalloc, zfree and opaque must be initialized + before by the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library. The default value is 15 if inflateInit is used + instead. windowBits must be greater than or equal to the windowBits value + provided to deflateInit2() while compressing, or it must be equal to 15 if + deflateInit2() was not used. If a compressed stream with a larger window + size is given as input, inflate() will return with the error code + Z_DATA_ERROR instead of trying to allocate a larger window. + + windowBits can also be zero to request that inflate use the window size in + the zlib header of the compressed stream. + + windowBits can also be -8..-15 for raw inflate. In this case, -windowBits + determines the window size. inflate() will then process raw deflate data, + not looking for a zlib or gzip header, not generating a check value, and not + looking for any check values for comparison at the end of the stream. This + is for use with other formats that use the deflate compressed data format + such as zip. Those formats provide their own check values. If a custom + format is developed using the raw deflate format for compressed data, it is + recommended that a check value such as an Adler-32 or a CRC-32 be applied to + the uncompressed data as is done in the zlib, gzip, and zip formats. For + most applications, the zlib format should be used as is. Note that comments + above on the use in deflateInit2() applies to the magnitude of windowBits. + + windowBits can also be greater than 15 for optional gzip decoding. Add + 32 to windowBits to enable zlib and gzip decoding with automatic header + detection, or add 16 to decode only the gzip format (the zlib format will + return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a + CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see + below), inflate() will not automatically decode concatenated gzip streams. + inflate() will return Z_STREAM_END at the end of the gzip stream. The state + would need to be reset to continue decoding a subsequent gzip stream. + + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit2 does not perform any decompression + apart from possibly reading the zlib header if present: actual decompression + will be done by inflate(). (So next_in and avail_in may be modified, but + next_out and avail_out are unused and unchanged.) The current implementation + of inflateInit2() does not process any header information -- that is + deferred until inflate() is called. +*/ + +ZEXTERN int ZEXPORT inflateSetDictionary +OF((z_streamp strm, const Bytef* dictionary, uInt dictLength)); +/* + Initializes the decompression dictionary from the given uncompressed byte + sequence. This function must be called immediately after a call of inflate, + if that call returned Z_NEED_DICT. The dictionary chosen by the compressor + can be determined from the Adler-32 value returned by that call of inflate. + The compressor and decompressor must use exactly the same dictionary (see + deflateSetDictionary). For raw inflate, this function can be called at any + time to set the dictionary. If the provided dictionary is smaller than the + window and there is already data in the window, then the provided dictionary + will amend what's there. The application must insure that the dictionary + that was used for compression is provided. + + inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the + expected one (incorrect Adler-32 value). inflateSetDictionary does not + perform any decompression: this will be done by subsequent calls of + inflate(). +*/ + +ZEXTERN int ZEXPORT inflateGetDictionary +OF((z_streamp strm, Bytef* dictionary, uInt* dictLength)); +/* + Returns the sliding dictionary being maintained by inflate. dictLength is + set to the number of bytes in the dictionary, and that many bytes are copied + to dictionary. dictionary must have enough space, where 32768 bytes is + always enough. If inflateGetDictionary() is called with dictionary equal to + Z_NULL, then only the dictionary length is returned, and nothing is copied. + Similary, if dictLength is Z_NULL, then it is not set. + + inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the + stream state is inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); +/* + Skips invalid compressed data until a possible full flush point (see above + for the description of deflate with Z_FULL_FLUSH) can be found, or until all + available input is skipped. No output is provided. + + inflateSync searches for a 00 00 FF FF pattern in the compressed data. + All full flush points have this pattern, but not all occurrences of this + pattern are full flush points. + + inflateSync returns Z_OK if a possible full flush point has been found, + Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point + has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. + In the success case, the application may save the current current value of + total_in which indicates where valid compressed data was found. In the + error case, the application may repeatedly call inflateSync, providing more + input each time, until success or end of the input data. +*/ + +ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when randomly accessing a large stream. The + first pass through the stream can periodically record the inflate state, + allowing restarting inflate at those points when randomly accessing the + stream. + + inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); +/* + This function is equivalent to inflateEnd followed by inflateInit, + but does not free and reallocate the internal decompression state. The + stream will keep attributes that may have been set by inflateInit2. + + inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, int windowBits)); +/* + This function is the same as inflateReset, but it also permits changing + the wrap and window size requests. The windowBits parameter is interpreted + the same as it is for inflateInit2. If the window size is changed, then the + memory allocated for the window is freed, and the window will be reallocated + by inflate() if needed. + + inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL), or if + the windowBits parameter is invalid. +*/ + +ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, int bits, int value)); +/* + This function inserts bits in the inflate input stream. The intent is + that this function is used to start inflating at a bit position in the + middle of a byte. The provided bits will be used before any bytes are used + from next_in. This function should only be used with raw inflate, and + should be used before the first inflate() call after inflateInit2() or + inflateReset(). bits must be less than or equal to 16, and that many of the + least significant bits of value will be inserted in the input. + + If bits is negative, then the input stream bit buffer is emptied. Then + inflatePrime() can be called again to put bits in the buffer. This is used + to clear out bits leftover after feeding inflate a block description prior + to feeding inflate codes. + + inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); +/* + This function returns two values, one in the lower 16 bits of the return + value, and the other in the remaining upper bits, obtained by shifting the + return value down 16 bits. If the upper value is -1 and the lower value is + zero, then inflate() is currently decoding information outside of a block. + If the upper value is -1 and the lower value is non-zero, then inflate is in + the middle of a stored block, with the lower value equaling the number of + bytes from the input remaining to copy. If the upper value is not -1, then + it is the number of bits back from the current bit position in the input of + the code (literal or length/distance pair) currently being processed. In + that case the lower value is the number of bytes already emitted for that + code. + + A code is being processed if inflate is waiting for more input to complete + decoding of the code, or if it has completed decoding but is waiting for + more output space to write the literal or match data. + + inflateMark() is used to mark locations in the input data for random + access, which may be at bit positions, and to note those cases where the + output of a code may span boundaries of random access blocks. The current + location in the input stream can be determined from avail_in and data_type + as noted in the description for the Z_BLOCK flush parameter for inflate. + + inflateMark returns the value noted above, or -65536 if the provided + source stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, gz_headerp head)); +/* + inflateGetHeader() requests that gzip header information be stored in the + provided gz_header structure. inflateGetHeader() may be called after + inflateInit2() or inflateReset(), and before the first call of inflate(). + As inflate() processes the gzip stream, head->done is zero until the header + is completed, at which time head->done is set to one. If a zlib stream is + being decoded, then head->done is set to -1 to indicate that there will be + no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be + used to force inflate() to return immediately after header processing is + complete and before any actual data is decompressed. + + The text, time, xflags, and os fields are filled in with the gzip header + contents. hcrc is set to true if there is a header CRC. (The header CRC + was valid if done is set to one.) If extra is not Z_NULL, then extra_max + contains the maximum number of bytes to write to extra. Once done is true, + extra_len contains the actual extra field length, and extra contains the + extra field, or that field truncated if extra_max is less than extra_len. + If name is not Z_NULL, then up to name_max characters are written there, + terminated with a zero unless the length is greater than name_max. If + comment is not Z_NULL, then up to comm_max characters are written there, + terminated with a zero unless the length is greater than comm_max. When any + of extra, name, or comment are not Z_NULL and the respective field is not + present in the header, then that field is set to Z_NULL to signal its + absence. This allows the use of deflateSetHeader() with the returned + structure to duplicate the header. However if those fields are set to + allocated memory, then the application will need to save those pointers + elsewhere so that they can be eventually freed. + + If inflateGetHeader is not used, then the header information is simply + discarded. The header is always checked for validity, including the header + CRC if present. inflateReset() will reset the process to discard the header + information. The application would need to call inflateGetHeader() again to + retrieve the header from the next gzip stream. + + inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, + unsigned char FAR *window)); + + Initialize the internal stream state for decompression using inflateBack() + calls. The fields zalloc, zfree and opaque in strm must be initialized + before the call. If zalloc and zfree are Z_NULL, then the default library- + derived memory allocation routines are used. windowBits is the base two + logarithm of the window size, in the range 8..15. window is a caller + supplied buffer of that size. Except for special applications where it is + assured that deflate was used with small window sizes, windowBits must be 15 + and a 32K byte window must be supplied to be able to decompress general + deflate streams. + + See inflateBack() for the usage of these routines. + + inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of + the parameters are invalid, Z_MEM_ERROR if the internal state could not be + allocated, or Z_VERSION_ERROR if the version of the library does not match + the version of the header file. +*/ + +typedef unsigned(*in_func) OF((void FAR*, z_const unsigned char FAR* FAR*)); +typedef int(*out_func) OF((void FAR*, unsigned char FAR*, unsigned)); + +ZEXTERN int ZEXPORT inflateBack +OF((z_streamp strm, + in_func in, + void FAR* in_desc, + out_func out, + void FAR* out_desc)); +/* + inflateBack() does a raw inflate with a single call using a call-back + interface for input and output. This is potentially more efficient than + inflate() for file i/o applications, in that it avoids copying between the + output and the sliding window by simply making the window itself the output + buffer. inflate() can be faster on modern CPUs when used with large + buffers. inflateBack() trusts the application to not change the output + buffer passed by the output function, at least until inflateBack() returns. + + inflateBackInit() must be called first to allocate the internal state + and to initialize the state with the user-provided window buffer. + inflateBack() may then be used multiple times to inflate a complete, raw + deflate stream with each call. inflateBackEnd() is then called to free the + allocated state. + + A raw deflate stream is one with no zlib or gzip header or trailer. + This routine would normally be used in a utility that reads zip or gzip + files and writes out uncompressed files. The utility would decode the + header and process the trailer on its own, hence this routine expects only + the raw deflate stream to decompress. This is different from the default + behavior of inflate(), which expects a zlib header and trailer around the + deflate stream. + + inflateBack() uses two subroutines supplied by the caller that are then + called by inflateBack() for input and output. inflateBack() calls those + routines until it reads a complete deflate stream and writes out all of the + uncompressed data, or until it encounters an error. The function's + parameters and return types are defined above in the in_func and out_func + typedefs. inflateBack() will call in(in_desc, &buf) which should return the + number of bytes of provided input, and a pointer to that input in buf. If + there is no input available, in() must return zero -- buf is ignored in that + case -- and inflateBack() will return a buffer error. inflateBack() will + call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. + out() should return zero on success, or non-zero on failure. If out() + returns non-zero, inflateBack() will return with an error. Neither in() nor + out() are permitted to change the contents of the window provided to + inflateBackInit(), which is also the buffer that out() uses to write from. + The length written by out() will be at most the window size. Any non-zero + amount of input may be provided by in(). + + For convenience, inflateBack() can be provided input on the first call by + setting strm->next_in and strm->avail_in. If that input is exhausted, then + in() will be called. Therefore strm->next_in must be initialized before + calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called + immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in + must also be initialized, and then if strm->avail_in is not zero, input will + initially be taken from strm->next_in[0 .. strm->avail_in - 1]. + + The in_desc and out_desc parameters of inflateBack() is passed as the + first parameter of in() and out() respectively when they are called. These + descriptors can be optionally used to pass any information that the caller- + supplied in() and out() functions need to do their job. + + On return, inflateBack() will set strm->next_in and strm->avail_in to + pass back any unused input that was provided by the last in() call. The + return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR + if in() or out() returned an error, Z_DATA_ERROR if there was a format error + in the deflate stream (in which case strm->msg is set to indicate the nature + of the error), or Z_STREAM_ERROR if the stream was not properly initialized. + In the case of Z_BUF_ERROR, an input or output error can be distinguished + using strm->next_in which will be Z_NULL only if in() returned an error. If + strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning + non-zero. (in() will always be called before out(), so strm->next_in is + assured to be defined if out() returns non-zero.) Note that inflateBack() + cannot return Z_OK. +*/ + +ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); +/* + All memory allocated by inflateBackInit() is freed. + + inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream + state was inconsistent. +*/ + +ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); +/* Return flags indicating compile-time options. + + Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: + 1.0: size of uInt + 3.2: size of uLong + 5.4: size of voidpf (pointer) + 7.6: size of z_off_t + + Compiler, assembler, and debug options: + 8: ZLIB_DEBUG + 9: ASMV or ASMINF -- use ASM code + 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention + 11: 0 (reserved) + + One-time table building (smaller code, but not thread-safe if true): + 12: BUILDFIXED -- build static block decoding tables when needed + 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed + 14,15: 0 (reserved) + + Library content (indicates missing functionality): + 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking + deflate code when not needed) + 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect + and decode gzip streams (to avoid linking crc code) + 18-19: 0 (reserved) + + Operation variations (changes in library functionality): + 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate + 21: FASTEST -- deflate algorithm with only one, lowest compression level + 22,23: 0 (reserved) + + The sprintf variant used by gzprintf (zero is best): + 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format + 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! + 26: 0 = returns value, 1 = void -- 1 means inferred string length returned + + Remainder: + 27-31: 0 (reserved) + */ + +#ifndef Z_SOLO + +/* utility functions */ + +/* + The following utility functions are implemented on top of the basic + stream-oriented functions. To simplify the interface, some default options + are assumed (compression level and memory usage, standard memory allocation + functions). The source code of these utility functions can be modified if + you need special options. +*/ + +ZEXTERN int ZEXPORT compress +OF((Bytef * dest, uLongf* destLen, const Bytef* source, uLong sourceLen)); +/* + Compresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total size + of the destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed data. compress() is equivalent to compress2() with a level + parameter of Z_DEFAULT_COMPRESSION. + + compress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer. +*/ + +ZEXTERN int ZEXPORT compress2 +OF((Bytef * dest, + uLongf* destLen, + const Bytef* source, + uLong sourceLen, + int level)); +/* + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed data. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ + +ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); +/* + compressBound() returns an upper bound on the compressed size after + compress() or compress2() on sourceLen bytes. It would be used before a + compress() or compress2() call to allocate the destination buffer. +*/ + +ZEXTERN int ZEXPORT uncompress +OF((Bytef * dest, uLongf* destLen, const Bytef* source, uLong sourceLen)); +/* + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total size + of the destination buffer, which must be large enough to hold the entire + uncompressed data. (The size of the uncompressed data must have been saved + previously by the compressor and transmitted to the decompressor by some + mechanism outside the scope of this compression library.) Upon exit, destLen + is the actual size of the uncompressed data. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In + the case where there is not enough room, uncompress() will fill the output + buffer with the uncompressed data up to that point. +*/ + +ZEXTERN int ZEXPORT uncompress2 +OF((Bytef * dest, uLongf* destLen, const Bytef* source, uLong* sourceLen)); +/* + Same as uncompress, except that sourceLen is a pointer, where the + length of the source is *sourceLen. On return, *sourceLen is the number of + source bytes consumed. +*/ + +/* gzip file access functions */ + +/* + This library supports reading and writing files in gzip (.gz) format with + an interface similar to that of stdio, using the functions that start with + "gz". The gzip format is different from the zlib format. gzip is a gzip + wrapper, documented in RFC 1952, wrapped around a deflate stream. +*/ + +typedef struct gzFile_s* gzFile; /* semi-opaque gzip file descriptor */ + +/* +ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); + + Opens a gzip (.gz) file for reading or writing. The mode parameter is as + in fopen ("rb" or "wb") but can also include a compression level ("wb9") or + a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only + compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' + for fixed code compression as in "wb9F". (See the description of + deflateInit2 for more information about the strategy parameter.) 'T' will + request transparent writing or appending with no compression and not using + the gzip format. + + "a" can be used instead of "w" to request that the gzip stream that will + be written be appended to the file. "+" will result in an error, since + reading and writing to the same gzip file is not supported. The addition of + "x" when writing will create the file exclusively, which fails if the file + already exists. On systems that support it, the addition of "e" when + reading or writing will set the flag to close the file on an execve() call. + + These functions, as well as gzip, will read and decode a sequence of gzip + streams in a file. The append function of gzopen() can be used to create + such a file. (Also see gzflush() for another way to do this.) When + appending, gzopen does not test whether the file begins with a gzip stream, + nor does it look for the end of the gzip streams to begin appending. gzopen + will simply append a gzip stream to the existing file. + + gzopen can be used to read a file which is not in gzip format; in this + case gzread will directly read from the file without decompression. When + reading, this will be detected automatically by looking for the magic two- + byte gzip header. + + gzopen returns NULL if the file could not be opened, if there was + insufficient memory to allocate the gzFile state, or if an invalid mode was + specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). + errno can be checked to determine if the reason gzopen failed was that the + file could not be opened. +*/ + +ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char* mode)); +/* + gzdopen associates a gzFile with the file descriptor fd. File descriptors + are obtained from calls like open, dup, creat, pipe or fileno (if the file + has been previously opened with fopen). The mode parameter is as in gzopen. + + The next call of gzclose on the returned gzFile will also close the file + descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor + fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, + mode);. The duplicated descriptor should be saved to avoid a leak, since + gzdopen does not close fd if it fails. If you are using fileno() to get the + file descriptor from a FILE *, then you will have to use dup() to avoid + double-close()ing the file descriptor. Both gzclose() and fclose() will + close the associated file descriptor, so they need to have different file + descriptors. + + gzdopen returns NULL if there was insufficient memory to allocate the + gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not + provided, or '+' was provided), or if fd is -1. The file descriptor is not + used until the next gz* read, write, seek, or close operation, so gzdopen + will not detect if fd is invalid (unless fd is -1). +*/ + +ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); +/* + Set the internal buffer size used by this library's functions. The + default buffer size is 8192 bytes. This function must be called after + gzopen() or gzdopen(), and before any other calls that read or write the + file. The buffer memory allocation is always deferred to the first read or + write. Three times that size in buffer space is allocated. A larger buffer + size of, for example, 64K or 128K bytes will noticeably increase the speed + of decompression (reading). + + The new buffer size also affects the maximum length for gzprintf(). + + gzbuffer() returns 0 on success, or -1 on failure, such as being called + too late. +*/ + +ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); +/* + Dynamically update the compression level or strategy. See the description + of deflateInit2 for the meaning of these parameters. Previously provided + data is flushed before the parameter change. + + gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not + opened for writing, Z_ERRNO if there is an error writing the flushed data, + or Z_MEM_ERROR if there is a memory allocation error. +*/ + +ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); +/* + Reads the given number of uncompressed bytes from the compressed file. If + the input file is not in gzip format, gzread copies the given number of + bytes into the buffer directly from the file. + + After reaching the end of a gzip stream in the input, gzread will continue + to read, looking for another gzip stream. Any number of gzip streams may be + concatenated in the input file, and will all be decompressed by gzread(). + If something other than a gzip stream is encountered after a gzip stream, + that remaining trailing garbage is ignored (and no error is returned). + + gzread can be used to read a gzip file that is being concurrently written. + Upon reaching the end of the input, gzread will return with the available + data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then + gzclearerr can be used to clear the end of file indicator in order to permit + gzread to be tried again. Z_OK indicates that a gzip stream was completed + on the last gzread. Z_BUF_ERROR indicates that the input file ended in the + middle of a gzip stream. Note that gzread does not return -1 in the event + of an incomplete gzip stream. This error is deferred until gzclose(), which + will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip + stream. Alternatively, gzerror can be used before gzclose to detect this + case. + + gzread returns the number of uncompressed bytes actually read, less than + len for end of file, or -1 for error. If len is too large to fit in an int, + then nothing is read, -1 is returned, and the error state is set to + Z_STREAM_ERROR. +*/ + +ZEXTERN z_size_t ZEXPORT gzfread +OF((voidp buf, z_size_t size, z_size_t nitems, gzFile file)); +/* + Read up to nitems items of size size from file to buf, otherwise operating + as gzread() does. This duplicates the interface of stdio's fread(), with + size_t request and return types. If the library defines size_t, then + z_size_t is identical to size_t. If not, then z_size_t is an unsigned + integer type that can contain a pointer. + + gzfread() returns the number of full items read of size size, or zero if + the end of the file was reached and a full item could not be read, or if + there was an error. gzerror() must be consulted if zero is returned in + order to determine if there was an error. If the multiplication of size and + nitems overflows, i.e. the product does not fit in a z_size_t, then nothing + is read, zero is returned, and the error state is set to Z_STREAM_ERROR. + + In the event that the end of file is reached and only a partial item is + available at the end, i.e. the remaining uncompressed data length is not a + multiple of size, then the final partial item is nevetheless read into buf + and the end-of-file flag is set. The length of the partial item read is not + provided, but could be inferred from the result of gztell(). This behavior + is the same as the behavior of fread() implementations in common libraries, + but it prevents the direct use of gzfread() to read a concurrently written + file, reseting and retrying on end-of-file, when size is not 1. +*/ + +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, voidpc buf, unsigned len)); +/* + Writes the given number of uncompressed bytes into the compressed file. + gzwrite returns the number of uncompressed bytes written or 0 in case of + error. +*/ + +ZEXTERN z_size_t ZEXPORT gzfwrite +OF((voidpc buf, z_size_t size, z_size_t nitems, gzFile file)); +/* + gzfwrite() writes nitems items of size size from buf to file, duplicating + the interface of stdio's fwrite(), with size_t request and return types. If + the library defines size_t, then z_size_t is identical to size_t. If not, + then z_size_t is an unsigned integer type that can contain a pointer. + + gzfwrite() returns the number of full items written of size size, or zero + if there was an error. If the multiplication of size and nitems overflows, + i.e. the product does not fit in a z_size_t, then nothing is written, zero + is returned, and the error state is set to Z_STREAM_ERROR. +*/ + +ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char* format, ...)); +/* + Converts, formats, and writes the arguments to the compressed file under + control of the format string, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written, or a negative zlib error code in case + of error. The number of uncompressed bytes written is limited to 8191, or + one less than the buffer size given to gzbuffer(). The caller should assure + that this limit is not exceeded. If it is exceeded, then gzprintf() will + return an error (0) with nothing written. In this case, there may also be a + buffer overflow with unpredictable consequences, which is possible only if + zlib was compiled with the insecure functions sprintf() or vsprintf() + because the secure snprintf() or vsnprintf() functions were not available. + This can be determined using zlibCompileFlags(). +*/ + +ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char* s)); +/* + Writes the given null-terminated string to the compressed file, excluding + the terminating null character. + + gzputs returns the number of characters written, or -1 in case of error. +*/ + +ZEXTERN char* ZEXPORT gzgets OF((gzFile file, char* buf, int len)); +/* + Reads bytes from the compressed file until len-1 characters are read, or a + newline character is read and transferred to buf, or an end-of-file + condition is encountered. If any characters are read or if len == 1, the + string is terminated with a null character. If no characters are read due + to an end-of-file or len < 1, then the buffer is left untouched. + + gzgets returns buf which is a null-terminated string, or it returns NULL + for end-of-file or in case of error. If there was an error, the contents at + buf are indeterminate. +*/ + +ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); +/* + Writes c, converted to an unsigned char, into the compressed file. gzputc + returns the value that was written, or -1 in case of error. +*/ + +ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); +/* + Reads one byte from the compressed file. gzgetc returns this byte or -1 + in case of end of file or error. This is implemented as a macro for speed. + As such, it does not do all of the checking the other functions do. I.e. + it does not check to see if file is NULL, nor whether the structure file + points to has been clobbered or not. +*/ + +ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); +/* + Push one character back onto the stream to be read as the first character + on the next read. At least one character of push-back is allowed. + gzungetc() returns the character pushed, or -1 on failure. gzungetc() will + fail if c is -1, and may fail if a character has been pushed but not read + yet. If gzungetc is used immediately after gzopen or gzdopen, at least the + output buffer size of pushed characters is allowed. (See gzbuffer above.) + The pushed character will be discarded if the stream is repositioned with + gzseek() or gzrewind(). +*/ + +ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); +/* + Flushes all pending output into the compressed file. The parameter flush + is as in the deflate() function. The return value is the zlib error number + (see function gzerror below). gzflush is only permitted when writing. + + If the flush parameter is Z_FINISH, the remaining data is written and the + gzip stream is completed in the output. If gzwrite() is called again, a new + gzip stream will be started in the output. gzread() is able to read such + concatenated gzip streams. + + gzflush should be called only when strictly necessary because it will + degrade compression if called too often. +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, + z_off_t offset, int whence)); + + Sets the starting position for the next gzread or gzwrite on the given + compressed file. The offset represents a number of bytes in the + uncompressed data stream. The whence parameter is defined as in lseek(2); + the value SEEK_END is not supported. + + If the file is opened for reading, this function is emulated but can be + extremely slow. If the file is opened for writing, only forward seeks are + supported; gzseek then compresses a sequence of zeroes up to the new + starting position. + + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error, in + particular if the file is opened for writing and the new starting position + would be before the current position. +*/ + +ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); +/* + Rewinds the given file. This function is supported only for reading. + + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) +*/ + +/* +ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); + + Returns the starting position for the next gzread or gzwrite on the given + compressed file. This position represents a number of bytes in the + uncompressed data stream, and is zero when starting, even if appending or + reading a gzip stream from the middle of a file using gzdopen(). + + gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); + + Returns the current offset in the file being read or written. This offset + includes the count of bytes that precede the gzip stream, for example when + appending or when using gzdopen() for reading. When reading, the offset + does not include as yet unused buffered input. This information can be used + for a progress indicator. On error, gzoffset() returns -1. +*/ + +ZEXTERN int ZEXPORT gzeof OF((gzFile file)); +/* + Returns true (1) if the end-of-file indicator has been set while reading, + false (0) otherwise. Note that the end-of-file indicator is set only if the + read tried to go past the end of the input, but came up short. Therefore, + just like feof(), gzeof() may return false even if there is no more data to + read, in the event that the last read request was for the exact number of + bytes remaining in the input file. This will happen if the input file size + is an exact multiple of the buffer size. + + If gzeof() returns true, then the read functions will return no more data, + unless the end-of-file indicator is reset by gzclearerr() and the input file + has grown since the previous end of file was detected. +*/ + +ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); +/* + Returns true (1) if file is being copied directly while reading, or false + (0) if file is a gzip stream being decompressed. + + If the input file is empty, gzdirect() will return true, since the input + does not contain a gzip stream. + + If gzdirect() is used immediately after gzopen() or gzdopen() it will + cause buffers to be allocated to allow reading the file to determine if it + is a gzip file. Therefore if gzbuffer() is used, it should be called before + gzdirect(). + + When writing, gzdirect() returns true (1) if transparent writing was + requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: + gzdirect() is not needed when writing. Transparent writing must be + explicitly requested, so the application already knows the answer. When + linking statically, using gzdirect() will include all of the zlib code for + gzip file reading and decompression, which may not be desired.) +*/ + +ZEXTERN int ZEXPORT gzclose OF((gzFile file)); +/* + Flushes all pending output if necessary, closes the compressed file and + deallocates the (de)compression state. Note that once file is closed, you + cannot call gzerror with file, since its structures have been deallocated. + gzclose must not be called more than once on the same file, just as free + must not be called more than once on the same allocation. + + gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a + file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the + last read ended in the middle of a gzip stream, or Z_OK on success. +*/ + +ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); +ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); +/* + Same as gzclose(), but gzclose_r() is only for use when reading, and + gzclose_w() is only for use when writing or appending. The advantage to + using these instead of gzclose() is that they avoid linking in zlib + compression or decompression code that is not used when only reading or only + writing respectively. If gzclose() is used, then both compression and + decompression code will be included the application when linking to a static + zlib library. +*/ + +ZEXTERN const char* ZEXPORT gzerror OF((gzFile file, int* errnum)); +/* + Returns the error message for the last error which occurred on the given + compressed file. errnum is set to zlib error number. If an error occurred + in the file system and not in the compression library, errnum is set to + Z_ERRNO and the application may consult errno to get the exact error code. + + The application must not modify the returned string. Future calls to + this function may invalidate the previously returned string. If file is + closed, then the string previously returned by gzerror will no longer be + available. + + gzerror() should be used to distinguish errors from end-of-file for those + functions above that do not distinguish those cases in their return values. +*/ + +ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); +/* + Clears the error and end-of-file flags for file. This is analogous to the + clearerr() function in stdio. This is useful for continuing to read a gzip + file that is being written concurrently. +*/ + +#endif /* !Z_SOLO */ + +/* checksum functions */ + +/* + These functions are not related to compression but are exported + anyway because they might be useful in applications using the compression + library. +*/ + +ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef* buf, uInt len)); +/* + Update a running Adler-32 checksum with the bytes buf[0..len-1] and + return the updated checksum. If buf is Z_NULL, this function returns the + required initial value for the checksum. + + An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed + much faster. + + Usage example: + + uLong adler = adler32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); + } + if (adler != original_adler) error(); +*/ + +ZEXTERN uLong ZEXPORT adler32_z +OF((uLong adler, const Bytef* buf, z_size_t len)); +/* + Same as adler32(), but with a size_t length. +*/ + +/* +ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, + z_off_t len2)); + + Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 + and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for + each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of + seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note + that the z_off_t type (like off_t) is a signed integer. If len2 is + negative, the result has no meaning or utility. +*/ + +ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef* buf, uInt len)); +/* + Update a running CRC-32 with the bytes buf[0..len-1] and return the + updated CRC-32. If buf is Z_NULL, this function returns the required + initial value for the crc. Pre- and post-conditioning (one's complement) is + performed within this function so it shouldn't be done by the application. + + Usage example: + + uLong crc = crc32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); + } + if (crc != original_crc) error(); +*/ + +ZEXTERN uLong ZEXPORT crc32_z OF((uLong adler, const Bytef* buf, z_size_t len)); +/* + Same as crc32(), but with a size_t length. +*/ + +/* +ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); + + Combine two CRC-32 check values into one. For two sequences of bytes, + seq1 and seq2 with lengths len1 and len2, CRC-32 check values were + calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 + check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and + len2. +*/ + +/* various hacks, don't look :) */ + +/* deflateInit and inflateInit are macros to allow checking the zlib version + * and the compiler's view of z_stream: + */ +ZEXTERN int ZEXPORT deflateInit_ +OF((z_streamp strm, int level, const char* version, int stream_size)); +ZEXTERN int ZEXPORT inflateInit_ +OF((z_streamp strm, const char* version, int stream_size)); +ZEXTERN int ZEXPORT deflateInit2_ +OF((z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy, + const char* version, + int stream_size)); +ZEXTERN int ZEXPORT inflateInit2_ +OF((z_streamp strm, int windowBits, const char* version, int stream_size)); +ZEXTERN int ZEXPORT inflateBackInit_ +OF((z_streamp strm, + int windowBits, + unsigned char FAR* window, + const char* version, + int stream_size)); +#ifdef Z_PREFIX_SET +#define z_deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) +#define z_inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) +#define z_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_( \ + (strm), \ + (level), \ + (method), \ + (windowBits), \ + (memLevel), \ + (strategy), \ + ZLIB_VERSION, \ + (int)sizeof(z_stream)) +#define z_inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, (int)sizeof(z_stream)) +#define z_inflateBackInit(strm, windowBits, window) \ + inflateBackInit_( \ + (strm), (windowBits), (window), ZLIB_VERSION, (int)sizeof(z_stream)) +#else +#define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) +#define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) +#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_( \ + (strm), \ + (level), \ + (method), \ + (windowBits), \ + (memLevel), \ + (strategy), \ + ZLIB_VERSION, \ + (int)sizeof(z_stream)) +#define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, (int)sizeof(z_stream)) +#define inflateBackInit(strm, windowBits, window) \ + inflateBackInit_( \ + (strm), (windowBits), (window), ZLIB_VERSION, (int)sizeof(z_stream)) +#endif + +#ifndef Z_SOLO + +/* gzgetc() macro and its supporting function and exposed data structure. Note + * that the real internal state is much larger than the exposed structure. + * This abbreviated structure exposes just enough for the gzgetc() macro. The + * user should not mess with these exposed elements, since their names or + * behavior could change in the future, perhaps even capriciously. They can + * only be used by the gzgetc() macro. You have been warned. + */ +struct gzFile_s { + unsigned have; + unsigned char* next; + z_off64_t pos; +}; +ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ +#ifdef Z_PREFIX_SET +#undef z_gzgetc +#define z_gzgetc(g) \ + ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g)) +#else +#define gzgetc(g) \ + ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g)) +#endif + +/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or + * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if + * both are true, the application gets the *64 functions, and the regular + * functions are changed to 64 bits) -- in case these are set on systems + * without large file support, _LFS64_LARGEFILE must also be true + */ +#ifdef Z_LARGE64 +ZEXTERN gzFile ZEXPORT gzopen64 OF((const char*, const char*)); +ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); +ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); +ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); +ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); +ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); +#endif + +#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) +#ifdef Z_PREFIX_SET +#define z_gzopen z_gzopen64 +#define z_gzseek z_gzseek64 +#define z_gztell z_gztell64 +#define z_gzoffset z_gzoffset64 +#define z_adler32_combine z_adler32_combine64 +#define z_crc32_combine z_crc32_combine64 +#else +#define gzopen gzopen64 +#define gzseek gzseek64 +#define gztell gztell64 +#define gzoffset gzoffset64 +#define adler32_combine adler32_combine64 +#define crc32_combine crc32_combine64 +#endif +#ifndef Z_LARGE64 +ZEXTERN gzFile ZEXPORT gzopen64 OF((const char*, const char*)); +ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); +ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); +ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); +ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); +ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); +#endif +#else +ZEXTERN gzFile ZEXPORT gzopen OF((const char*, const char*)); +ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); +ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); +ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); +ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); +ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); +#endif + +#else /* Z_SOLO */ + +ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); +ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); + +#endif /* !Z_SOLO */ + +/* undocumented functions */ +ZEXTERN const char* ZEXPORT zError OF((int)); +ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); +ZEXTERN const z_crc_t FAR* ZEXPORT get_crc_table OF((void)); +ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); +ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int)); +ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF((z_streamp)); +ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); +ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); +#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(Z_SOLO) +ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t* path, const char* mode)); +#endif +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +#ifndef Z_SOLO +ZEXTERN int ZEXPORTVA gzvprintf +Z_ARG((gzFile file, const char* format, va_list va)); +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* ZLIB_H */ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/__future__.py b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/__future__.py new file mode 100644 index 0000000..b12b4c0 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/__future__.py @@ -0,0 +1,143 @@ +"""Record of phased-in incompatible language changes. + +Each line is of the form: + + FeatureName = "_Feature(" OptionalRelease "," MandatoryRelease "," + CompilerFlag ")" + +where, normally, OptionalRelease < MandatoryRelease, and both are 5-tuples +of the same form as sys.version_info: + + (PY_MAJOR_VERSION, # the 2 in 2.1.0a3; an int + PY_MINOR_VERSION, # the 1; an int + PY_MICRO_VERSION, # the 0; an int + PY_RELEASE_LEVEL, # "alpha", "beta", "candidate" or "final"; string + PY_RELEASE_SERIAL # the 3; an int + ) + +OptionalRelease records the first release in which + + from __future__ import FeatureName + +was accepted. + +In the case of MandatoryReleases that have not yet occurred, +MandatoryRelease predicts the release in which the feature will become part +of the language. + +Else MandatoryRelease records when the feature became part of the language; +in releases at or after that, modules no longer need + + from __future__ import FeatureName + +to use the feature in question, but may continue to use such imports. + +MandatoryRelease may also be None, meaning that a planned feature got +dropped. + +Instances of class _Feature have two corresponding methods, +.getOptionalRelease() and .getMandatoryRelease(). + +CompilerFlag is the (bitfield) flag that should be passed in the fourth +argument to the builtin function compile() to enable the feature in +dynamically compiled code. This flag is stored in the .compiler_flag +attribute on _Future instances. These values must match the appropriate +#defines of CO_xxx flags in Include/compile.h. + +No feature line is ever to be deleted from this file. +""" + +all_feature_names = [ + "nested_scopes", + "generators", + "division", + "absolute_import", + "with_statement", + "print_function", + "unicode_literals", + "barry_as_FLUFL", + "generator_stop", +] + +__all__ = ["all_feature_names"] + all_feature_names + +# The CO_xxx symbols are defined here under the same names used by +# compile.h, so that an editor search will find them here. However, +# they're not exported in __all__, because they don't really belong to +# this module. +CO_NESTED = 0x0010 # nested_scopes +CO_GENERATOR_ALLOWED = 0 # generators (obsolete, was 0x1000) +CO_FUTURE_DIVISION = 0x2000 # division +CO_FUTURE_ABSOLUTE_IMPORT = 0x4000 # perform absolute imports by default +CO_FUTURE_WITH_STATEMENT = 0x8000 # with statement +CO_FUTURE_PRINT_FUNCTION = 0x10000 # print function +CO_FUTURE_UNICODE_LITERALS = 0x20000 # unicode string literals +CO_FUTURE_BARRY_AS_BDFL = 0x40000 +# StopIteration becomes RuntimeError in generators +CO_FUTURE_GENERATOR_STOP = 0x80000 + + +class _Feature: + def __init__(self, optionalRelease, mandatoryRelease, compiler_flag): + self.optional = optionalRelease + self.mandatory = mandatoryRelease + self.compiler_flag = compiler_flag + + def getOptionalRelease(self): + """Return first release in which this feature was recognized. + + This is a 5-tuple, of the same form as sys.version_info. + """ + + return self.optional + + def getMandatoryRelease(self): + """Return release in which this feature will become mandatory. + + This is a 5-tuple, of the same form as sys.version_info, or, if + the feature was dropped, is None. + """ + + return self.mandatory + + def __repr__(self): + return "_Feature" + repr((self.optional, + self.mandatory, + self.compiler_flag)) + + +nested_scopes = _Feature((2, 1, 0, "beta", 1), + (2, 2, 0, "alpha", 0), + CO_NESTED) + +generators = _Feature((2, 2, 0, "alpha", 1), + (2, 3, 0, "final", 0), + CO_GENERATOR_ALLOWED) + +division = _Feature((2, 2, 0, "alpha", 2), + (3, 0, 0, "alpha", 0), + CO_FUTURE_DIVISION) + +absolute_import = _Feature((2, 5, 0, "alpha", 1), + (3, 0, 0, "alpha", 0), + CO_FUTURE_ABSOLUTE_IMPORT) + +with_statement = _Feature((2, 5, 0, "alpha", 1), + (2, 6, 0, "alpha", 0), + CO_FUTURE_WITH_STATEMENT) + +print_function = _Feature((2, 6, 0, "alpha", 2), + (3, 0, 0, "alpha", 0), + CO_FUTURE_PRINT_FUNCTION) + +unicode_literals = _Feature((2, 6, 0, "alpha", 2), + (3, 0, 0, "alpha", 0), + CO_FUTURE_UNICODE_LITERALS) + +barry_as_FLUFL = _Feature((3, 1, 0, "alpha", 2), + (3, 9, 0, "alpha", 0), + CO_FUTURE_BARRY_AS_BDFL) + +generator_stop = _Feature((3, 5, 0, "beta", 1), + (3, 7, 0, "alpha", 0), + CO_FUTURE_GENERATOR_STOP) diff --git a/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/__phello__.foo.py b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/__phello__.foo.py new file mode 100644 index 0000000..8e8623e --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/__phello__.foo.py @@ -0,0 +1 @@ +# This file exists as a helper for the test.test_frozen module. diff --git a/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/_bootlocale.py b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/_bootlocale.py new file mode 100644 index 0000000..4bccac1 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/_bootlocale.py @@ -0,0 +1,34 @@ +"""A minimal subset of the locale module used at interpreter startup +(imported by the _io module), in order to reduce startup time. + +Don't import directly from third-party code; use the `locale` module instead! +""" + +import sys +import _locale + +if sys.platform.startswith("win"): + def getpreferredencoding(do_setlocale=True): + return _locale._getdefaultlocale()[1] +else: + try: + _locale.CODESET + except AttributeError: + def getpreferredencoding(do_setlocale=True): + # This path for legacy systems needs the more complex + # getdefaultlocale() function, import the full locale module. + import locale + return locale.getpreferredencoding(do_setlocale) + else: + def getpreferredencoding(do_setlocale=True): + assert not do_setlocale + result = _locale.nl_langinfo(_locale.CODESET) + if not result and sys.platform == 'darwin': + # nl_langinfo can return an empty string + # when the setting has an invalid value. + # Default to UTF-8 in that case because + # UTF-8 is the default charset on OSX and + # returning nothing will crash the + # interpreter. + result = 'UTF-8' + return result diff --git a/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/_collections_abc.py b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/_collections_abc.py new file mode 100644 index 0000000..30ca27d --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/_collections_abc.py @@ -0,0 +1,1030 @@ +# Copyright 2007 Google, Inc. All Rights Reserved. +# Licensed to PSF under a Contributor Agreement. + +"""Abstract Base Classes (ABCs) for collections, according to PEP 3119. + +Unit tests are in test_collections. +""" + +from abc import ABCMeta, abstractmethod +import sys + +__all__ = ["Awaitable", "Coroutine", + "AsyncIterable", "AsyncIterator", "AsyncGenerator", + "Hashable", "Iterable", "Iterator", "Generator", "Reversible", + "Sized", "Container", "Callable", "Collection", + "Set", "MutableSet", + "Mapping", "MutableMapping", + "MappingView", "KeysView", "ItemsView", "ValuesView", + "Sequence", "MutableSequence", + "ByteString", + ] + +# This module has been renamed from collections.abc to _collections_abc to +# speed up interpreter startup. Some of the types such as MutableMapping are +# required early but collections module imports a lot of other modules. +# See issue #19218 +__name__ = "collections.abc" + +# Private list of types that we want to register with the various ABCs +# so that they will pass tests like: +# it = iter(somebytearray) +# assert isinstance(it, Iterable) +# Note: in other implementations, these types might not be distinct +# and they may have their own implementation specific types that +# are not included on this list. +bytes_iterator = type(iter(b'')) +bytearray_iterator = type(iter(bytearray())) +# callable_iterator = ??? +dict_keyiterator = type(iter({}.keys())) +dict_valueiterator = type(iter({}.values())) +dict_itemiterator = type(iter({}.items())) +list_iterator = type(iter([])) +list_reverseiterator = type(iter(reversed([]))) +range_iterator = type(iter(range(0))) +longrange_iterator = type(iter(range(1 << 1000))) +set_iterator = type(iter(set())) +str_iterator = type(iter("")) +tuple_iterator = type(iter(())) +zip_iterator = type(iter(zip())) +## views ## +dict_keys = type({}.keys()) +dict_values = type({}.values()) +dict_items = type({}.items()) +## misc ## +mappingproxy = type(type.__dict__) +generator = type((lambda: (yield))()) +## coroutine ## + + +async def _coro(): pass +_coro = _coro() +coroutine = type(_coro) +_coro.close() # Prevent ResourceWarning +del _coro +## asynchronous generator ## + + +async def _ag(): yield +_ag = _ag() +async_generator = type(_ag) +del _ag + + +### ONE-TRICK PONIES ### + +def _check_methods(C, *methods): + mro = C.__mro__ + for method in methods: + for B in mro: + if method in B.__dict__: + if B.__dict__[method] is None: + return NotImplemented + break + else: + return NotImplemented + return True + + +class Hashable(metaclass=ABCMeta): + + __slots__ = () + + @abstractmethod + def __hash__(self): + return 0 + + @classmethod + def __subclasshook__(cls, C): + if cls is Hashable: + return _check_methods(C, "__hash__") + return NotImplemented + + +class Awaitable(metaclass=ABCMeta): + + __slots__ = () + + @abstractmethod + def __await__(self): + yield + + @classmethod + def __subclasshook__(cls, C): + if cls is Awaitable: + return _check_methods(C, "__await__") + return NotImplemented + + +class Coroutine(Awaitable): + + __slots__ = () + + @abstractmethod + def send(self, value): + """Send a value into the coroutine. + Return next yielded value or raise StopIteration. + """ + raise StopIteration + + @abstractmethod + def throw(self, typ, val=None, tb=None): + """Raise an exception in the coroutine. + Return next yielded value or raise StopIteration. + """ + if val is None: + if tb is None: + raise typ + val = typ() + if tb is not None: + val = val.with_traceback(tb) + raise val + + def close(self): + """Raise GeneratorExit inside coroutine. + """ + try: + self.throw(GeneratorExit) + except (GeneratorExit, StopIteration): + pass + else: + raise RuntimeError("coroutine ignored GeneratorExit") + + @classmethod + def __subclasshook__(cls, C): + if cls is Coroutine: + return _check_methods(C, '__await__', 'send', 'throw', 'close') + return NotImplemented + + +Coroutine.register(coroutine) + + +class AsyncIterable(metaclass=ABCMeta): + + __slots__ = () + + @abstractmethod + def __aiter__(self): + return AsyncIterator() + + @classmethod + def __subclasshook__(cls, C): + if cls is AsyncIterable: + return _check_methods(C, "__aiter__") + return NotImplemented + + +class AsyncIterator(AsyncIterable): + + __slots__ = () + + @abstractmethod + async def __anext__(self): + """Return the next item or raise StopAsyncIteration when exhausted.""" + raise StopAsyncIteration + + def __aiter__(self): + return self + + @classmethod + def __subclasshook__(cls, C): + if cls is AsyncIterator: + return _check_methods(C, "__anext__", "__aiter__") + return NotImplemented + + +class AsyncGenerator(AsyncIterator): + + __slots__ = () + + async def __anext__(self): + """Return the next item from the asynchronous generator. + When exhausted, raise StopAsyncIteration. + """ + return await self.asend(None) + + @abstractmethod + async def asend(self, value): + """Send a value into the asynchronous generator. + Return next yielded value or raise StopAsyncIteration. + """ + raise StopAsyncIteration + + @abstractmethod + async def athrow(self, typ, val=None, tb=None): + """Raise an exception in the asynchronous generator. + Return next yielded value or raise StopAsyncIteration. + """ + if val is None: + if tb is None: + raise typ + val = typ() + if tb is not None: + val = val.with_traceback(tb) + raise val + + async def aclose(self): + """Raise GeneratorExit inside coroutine. + """ + try: + await self.athrow(GeneratorExit) + except (GeneratorExit, StopAsyncIteration): + pass + else: + raise RuntimeError("asynchronous generator ignored GeneratorExit") + + @classmethod + def __subclasshook__(cls, C): + if cls is AsyncGenerator: + return _check_methods(C, '__aiter__', '__anext__', + 'asend', 'athrow', 'aclose') + return NotImplemented + + +AsyncGenerator.register(async_generator) + + +class Iterable(metaclass=ABCMeta): + + __slots__ = () + + @abstractmethod + def __iter__(self): + while False: + yield None + + @classmethod + def __subclasshook__(cls, C): + if cls is Iterable: + return _check_methods(C, "__iter__") + return NotImplemented + + +class Iterator(Iterable): + + __slots__ = () + + @abstractmethod + def __next__(self): + 'Return the next item from the iterator. When exhausted, raise StopIteration' + raise StopIteration + + def __iter__(self): + return self + + @classmethod + def __subclasshook__(cls, C): + if cls is Iterator: + return _check_methods(C, '__iter__', '__next__') + return NotImplemented + + +Iterator.register(bytes_iterator) +Iterator.register(bytearray_iterator) +# Iterator.register(callable_iterator) +Iterator.register(dict_keyiterator) +Iterator.register(dict_valueiterator) +Iterator.register(dict_itemiterator) +Iterator.register(list_iterator) +Iterator.register(list_reverseiterator) +Iterator.register(range_iterator) +Iterator.register(longrange_iterator) +Iterator.register(set_iterator) +Iterator.register(str_iterator) +Iterator.register(tuple_iterator) +Iterator.register(zip_iterator) + + +class Reversible(Iterable): + + __slots__ = () + + @abstractmethod + def __reversed__(self): + while False: + yield None + + @classmethod + def __subclasshook__(cls, C): + if cls is Reversible: + return _check_methods(C, "__reversed__", "__iter__") + return NotImplemented + + +class Generator(Iterator): + + __slots__ = () + + def __next__(self): + """Return the next item from the generator. + When exhausted, raise StopIteration. + """ + return self.send(None) + + @abstractmethod + def send(self, value): + """Send a value into the generator. + Return next yielded value or raise StopIteration. + """ + raise StopIteration + + @abstractmethod + def throw(self, typ, val=None, tb=None): + """Raise an exception in the generator. + Return next yielded value or raise StopIteration. + """ + if val is None: + if tb is None: + raise typ + val = typ() + if tb is not None: + val = val.with_traceback(tb) + raise val + + def close(self): + """Raise GeneratorExit inside generator. + """ + try: + self.throw(GeneratorExit) + except (GeneratorExit, StopIteration): + pass + else: + raise RuntimeError("generator ignored GeneratorExit") + + @classmethod + def __subclasshook__(cls, C): + if cls is Generator: + return _check_methods(C, '__iter__', '__next__', + 'send', 'throw', 'close') + return NotImplemented + + +Generator.register(generator) + + +class Sized(metaclass=ABCMeta): + + __slots__ = () + + @abstractmethod + def __len__(self): + return 0 + + @classmethod + def __subclasshook__(cls, C): + if cls is Sized: + return _check_methods(C, "__len__") + return NotImplemented + + +class Container(metaclass=ABCMeta): + + __slots__ = () + + @abstractmethod + def __contains__(self, x): + return False + + @classmethod + def __subclasshook__(cls, C): + if cls is Container: + return _check_methods(C, "__contains__") + return NotImplemented + + +class Collection(Sized, Iterable, Container): + + __slots__ = () + + @classmethod + def __subclasshook__(cls, C): + if cls is Collection: + return _check_methods(C, "__len__", "__iter__", "__contains__") + return NotImplemented + + +class Callable(metaclass=ABCMeta): + + __slots__ = () + + @abstractmethod + def __call__(self, *args, **kwds): + return False + + @classmethod + def __subclasshook__(cls, C): + if cls is Callable: + return _check_methods(C, "__call__") + return NotImplemented + + +### SETS ### + + +class Set(Collection): + + """A set is a finite, iterable container. + + This class provides concrete generic implementations of all + methods except for __contains__, __iter__ and __len__. + + To override the comparisons (presumably for speed, as the + semantics are fixed), redefine __le__ and __ge__, + then the other operations will automatically follow suit. + """ + + __slots__ = () + + def __le__(self, other): + if not isinstance(other, Set): + return NotImplemented + if len(self) > len(other): + return False + for elem in self: + if elem not in other: + return False + return True + + def __lt__(self, other): + if not isinstance(other, Set): + return NotImplemented + return len(self) < len(other) and self.__le__(other) + + def __gt__(self, other): + if not isinstance(other, Set): + return NotImplemented + return len(self) > len(other) and self.__ge__(other) + + def __ge__(self, other): + if not isinstance(other, Set): + return NotImplemented + if len(self) < len(other): + return False + for elem in other: + if elem not in self: + return False + return True + + def __eq__(self, other): + if not isinstance(other, Set): + return NotImplemented + return len(self) == len(other) and self.__le__(other) + + @classmethod + def _from_iterable(cls, it): + '''Construct an instance of the class from any iterable input. + + Must override this method if the class constructor signature + does not accept an iterable for an input. + ''' + return cls(it) + + def __and__(self, other): + if not isinstance(other, Iterable): + return NotImplemented + return self._from_iterable(value for value in other if value in self) + + __rand__ = __and__ + + def isdisjoint(self, other): + 'Return True if two sets have a null intersection.' + for value in other: + if value in self: + return False + return True + + def __or__(self, other): + if not isinstance(other, Iterable): + return NotImplemented + chain = (e for s in (self, other) for e in s) + return self._from_iterable(chain) + + __ror__ = __or__ + + def __sub__(self, other): + if not isinstance(other, Set): + if not isinstance(other, Iterable): + return NotImplemented + other = self._from_iterable(other) + return self._from_iterable(value for value in self + if value not in other) + + def __rsub__(self, other): + if not isinstance(other, Set): + if not isinstance(other, Iterable): + return NotImplemented + other = self._from_iterable(other) + return self._from_iterable(value for value in other + if value not in self) + + def __xor__(self, other): + if not isinstance(other, Set): + if not isinstance(other, Iterable): + return NotImplemented + other = self._from_iterable(other) + return (self - other) | (other - self) + + __rxor__ = __xor__ + + def _hash(self): + """Compute the hash value of a set. + + Note that we don't define __hash__: not all sets are hashable. + But if you define a hashable set type, its __hash__ should + call this function. + + This must be compatible __eq__. + + All sets ought to compare equal if they contain the same + elements, regardless of how they are implemented, and + regardless of the order of the elements; so there's not much + freedom for __eq__ or __hash__. We match the algorithm used + by the built-in frozenset type. + """ + MAX = sys.maxsize + MASK = 2 * MAX + 1 + n = len(self) + h = 1927868237 * (n + 1) + h &= MASK + for x in self: + hx = hash(x) + h ^= (hx ^ (hx << 16) ^ 89869747) * 3644798167 + h &= MASK + h = h * 69069 + 907133923 + h &= MASK + if h > MAX: + h -= MASK + 1 + if h == -1: + h = 590923713 + return h + + +Set.register(frozenset) + + +class MutableSet(Set): + """A mutable set is a finite, iterable container. + + This class provides concrete generic implementations of all + methods except for __contains__, __iter__, __len__, + add(), and discard(). + + To override the comparisons (presumably for speed, as the + semantics are fixed), all you have to do is redefine __le__ and + then the other operations will automatically follow suit. + """ + + __slots__ = () + + @abstractmethod + def add(self, value): + """Add an element.""" + raise NotImplementedError + + @abstractmethod + def discard(self, value): + """Remove an element. Do not raise an exception if absent.""" + raise NotImplementedError + + def remove(self, value): + """Remove an element. If not a member, raise a KeyError.""" + if value not in self: + raise KeyError(value) + self.discard(value) + + def pop(self): + """Return the popped value. Raise KeyError if empty.""" + it = iter(self) + try: + value = next(it) + except StopIteration: + raise KeyError + self.discard(value) + return value + + def clear(self): + """This is slow (creates N new iterators!) but effective.""" + try: + while True: + self.pop() + except KeyError: + pass + + def __ior__(self, it): + for value in it: + self.add(value) + return self + + def __iand__(self, it): + for value in (self - it): + self.discard(value) + return self + + def __ixor__(self, it): + if it is self: + self.clear() + else: + if not isinstance(it, Set): + it = self._from_iterable(it) + for value in it: + if value in self: + self.discard(value) + else: + self.add(value) + return self + + def __isub__(self, it): + if it is self: + self.clear() + else: + for value in it: + self.discard(value) + return self + + +MutableSet.register(set) + + +### MAPPINGS ### + + +class Mapping(Collection): + + __slots__ = () + + """A Mapping is a generic container for associating key/value + pairs. + + This class provides concrete generic implementations of all + methods except for __getitem__, __iter__, and __len__. + + """ + + @abstractmethod + def __getitem__(self, key): + raise KeyError + + def get(self, key, default=None): + 'D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.' + try: + return self[key] + except KeyError: + return default + + def __contains__(self, key): + try: + self[key] + except KeyError: + return False + else: + return True + + def keys(self): + "D.keys() -> a set-like object providing a view on D's keys" + return KeysView(self) + + def items(self): + "D.items() -> a set-like object providing a view on D's items" + return ItemsView(self) + + def values(self): + "D.values() -> an object providing a view on D's values" + return ValuesView(self) + + def __eq__(self, other): + if not isinstance(other, Mapping): + return NotImplemented + return dict(self.items()) == dict(other.items()) + + __reversed__ = None + + +Mapping.register(mappingproxy) + + +class MappingView(Sized): + + __slots__ = '_mapping', + + def __init__(self, mapping): + self._mapping = mapping + + def __len__(self): + return len(self._mapping) + + def __repr__(self): + return '{0.__class__.__name__}({0._mapping!r})'.format(self) + + +class KeysView(MappingView, Set): + + __slots__ = () + + @classmethod + def _from_iterable(self, it): + return set(it) + + def __contains__(self, key): + return key in self._mapping + + def __iter__(self): + yield from self._mapping + + +KeysView.register(dict_keys) + + +class ItemsView(MappingView, Set): + + __slots__ = () + + @classmethod + def _from_iterable(self, it): + return set(it) + + def __contains__(self, item): + key, value = item + try: + v = self._mapping[key] + except KeyError: + return False + else: + return v is value or v == value + + def __iter__(self): + for key in self._mapping: + yield (key, self._mapping[key]) + + +ItemsView.register(dict_items) + + +class ValuesView(MappingView): + + __slots__ = () + + def __contains__(self, value): + for key in self._mapping: + v = self._mapping[key] + if v is value or v == value: + return True + return False + + def __iter__(self): + for key in self._mapping: + yield self._mapping[key] + + +ValuesView.register(dict_values) + + +class MutableMapping(Mapping): + + __slots__ = () + + """A MutableMapping is a generic container for associating + key/value pairs. + + This class provides concrete generic implementations of all + methods except for __getitem__, __setitem__, __delitem__, + __iter__, and __len__. + + """ + + @abstractmethod + def __setitem__(self, key, value): + raise KeyError + + @abstractmethod + def __delitem__(self, key): + raise KeyError + + __marker = object() + + def pop(self, key, default=__marker): + '''D.pop(k[,d]) -> v, remove specified key and return the corresponding value. + If key is not found, d is returned if given, otherwise KeyError is raised. + ''' + try: + value = self[key] + except KeyError: + if default is self.__marker: + raise + return default + else: + del self[key] + return value + + def popitem(self): + '''D.popitem() -> (k, v), remove and return some (key, value) pair + as a 2-tuple; but raise KeyError if D is empty. + ''' + try: + key = next(iter(self)) + except StopIteration: + raise KeyError + value = self[key] + del self[key] + return key, value + + def clear(self): + 'D.clear() -> None. Remove all items from D.' + try: + while True: + self.popitem() + except KeyError: + pass + + def update(*args, **kwds): + ''' D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. + If E present and has a .keys() method, does: for k in E: D[k] = E[k] + If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v + In either case, this is followed by: for k, v in F.items(): D[k] = v + ''' + if not args: + raise TypeError("descriptor 'update' of 'MutableMapping' object " + "needs an argument") + self, *args = args + if len(args) > 1: + raise TypeError('update expected at most 1 arguments, got %d' % + len(args)) + if args: + other = args[0] + if isinstance(other, Mapping): + for key in other: + self[key] = other[key] + elif hasattr(other, "keys"): + for key in other.keys(): + self[key] = other[key] + else: + for key, value in other: + self[key] = value + for key, value in kwds.items(): + self[key] = value + + def setdefault(self, key, default=None): + 'D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D' + try: + return self[key] + except KeyError: + self[key] = default + return default + + +MutableMapping.register(dict) + + +### SEQUENCES ### + + +class Sequence(Reversible, Collection): + + """All the operations on a read-only sequence. + + Concrete subclasses must override __new__ or __init__, + __getitem__, and __len__. + """ + + __slots__ = () + + @abstractmethod + def __getitem__(self, index): + raise IndexError + + def __iter__(self): + i = 0 + try: + while True: + v = self[i] + yield v + i += 1 + except IndexError: + return + + def __contains__(self, value): + for v in self: + if v is value or v == value: + return True + return False + + def __reversed__(self): + for i in reversed(range(len(self))): + yield self[i] + + def index(self, value, start=0, stop=None): + '''S.index(value, [start, [stop]]) -> integer -- return first index of value. + Raises ValueError if the value is not present. + + Supporting start and stop arguments is optional, but + recommended. + ''' + if start is not None and start < 0: + start = max(len(self) + start, 0) + if stop is not None and stop < 0: + stop += len(self) + + i = start + while stop is None or i < stop: + try: + v = self[i] + if v is value or v == value: + return i + except IndexError: + break + i += 1 + raise ValueError + + def count(self, value): + 'S.count(value) -> integer -- return number of occurrences of value' + return sum(1 for v in self if v is value or v == value) + + +Sequence.register(tuple) +Sequence.register(str) +Sequence.register(range) +Sequence.register(memoryview) + + +class ByteString(Sequence): + + """This unifies bytes and bytearray. + + XXX Should add all their methods. + """ + + __slots__ = () + + +ByteString.register(bytes) +ByteString.register(bytearray) + + +class MutableSequence(Sequence): + + __slots__ = () + + """All the operations on a read-write sequence. + + Concrete subclasses must provide __new__ or __init__, + __getitem__, __setitem__, __delitem__, __len__, and insert(). + + """ + + @abstractmethod + def __setitem__(self, index, value): + raise IndexError + + @abstractmethod + def __delitem__(self, index): + raise IndexError + + @abstractmethod + def insert(self, index, value): + 'S.insert(index, value) -- insert value before index' + raise IndexError + + def append(self, value): + 'S.append(value) -- append value to the end of the sequence' + self.insert(len(self), value) + + def clear(self): + 'S.clear() -> None -- remove all items from S' + try: + while True: + self.pop() + except IndexError: + pass + + def reverse(self): + 'S.reverse() -- reverse *IN PLACE*' + n = len(self) + for i in range(n//2): + self[i], self[n-i-1] = self[n-i-1], self[i] + + def extend(self, values): + 'S.extend(iterable) -- extend sequence by appending elements from the iterable' + for v in values: + self.append(v) + + def pop(self, index=-1): + '''S.pop([index]) -> item -- remove and return item at index (default last). + Raise IndexError if list is empty or index is out of range. + ''' + v = self[index] + del self[index] + return v + + def remove(self, value): + '''S.remove(value) -- remove first occurrence of value. + Raise ValueError if the value is not present. + ''' + del self[self.index(value)] + + def __iadd__(self, values): + self.extend(values) + return self + + +MutableSequence.register(list) +MutableSequence.register(bytearray) # Multiply inheriting, see ByteString diff --git a/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/_compat_pickle.py b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/_compat_pickle.py new file mode 100644 index 0000000..102ab5b --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/_compat_pickle.py @@ -0,0 +1,252 @@ +# This module is used to map the old Python 2 names to the new names used in +# Python 3 for the pickle module. This needed to make pickle streams +# generated with Python 2 loadable by Python 3. + +# This is a copy of lib2to3.fixes.fix_imports.MAPPING. We cannot import +# lib2to3 and use the mapping defined there, because lib2to3 uses pickle. +# Thus, this could cause the module to be imported recursively. +IMPORT_MAPPING = { + '__builtin__': 'builtins', + 'copy_reg': 'copyreg', + 'Queue': 'queue', + 'SocketServer': 'socketserver', + 'ConfigParser': 'configparser', + 'repr': 'reprlib', + 'tkFileDialog': 'tkinter.filedialog', + 'tkSimpleDialog': 'tkinter.simpledialog', + 'tkColorChooser': 'tkinter.colorchooser', + 'tkCommonDialog': 'tkinter.commondialog', + 'Dialog': 'tkinter.dialog', + 'Tkdnd': 'tkinter.dnd', + 'tkFont': 'tkinter.font', + 'tkMessageBox': 'tkinter.messagebox', + 'ScrolledText': 'tkinter.scrolledtext', + 'Tkconstants': 'tkinter.constants', + 'Tix': 'tkinter.tix', + 'ttk': 'tkinter.ttk', + 'Tkinter': 'tkinter', + 'markupbase': '_markupbase', + '_winreg': 'winreg', + 'thread': '_thread', + 'dummy_thread': '_dummy_thread', + 'dbhash': 'dbm.bsd', + 'dumbdbm': 'dbm.dumb', + 'dbm': 'dbm.ndbm', + 'gdbm': 'dbm.gnu', + 'xmlrpclib': 'xmlrpc.client', + 'SimpleXMLRPCServer': 'xmlrpc.server', + 'httplib': 'http.client', + 'htmlentitydefs': 'html.entities', + 'HTMLParser': 'html.parser', + 'Cookie': 'http.cookies', + 'cookielib': 'http.cookiejar', + 'BaseHTTPServer': 'http.server', + 'test.test_support': 'test.support', + 'commands': 'subprocess', + 'urlparse': 'urllib.parse', + 'robotparser': 'urllib.robotparser', + 'urllib2': 'urllib.request', + 'anydbm': 'dbm', + '_abcoll': 'collections.abc', +} + + +# This contains rename rules that are easy to handle. We ignore the more +# complex stuff (e.g. mapping the names in the urllib and types modules). +# These rules should be run before import names are fixed. +NAME_MAPPING = { + ('__builtin__', 'xrange'): ('builtins', 'range'), + ('__builtin__', 'reduce'): ('functools', 'reduce'), + ('__builtin__', 'intern'): ('sys', 'intern'), + ('__builtin__', 'unichr'): ('builtins', 'chr'), + ('__builtin__', 'unicode'): ('builtins', 'str'), + ('__builtin__', 'long'): ('builtins', 'int'), + ('itertools', 'izip'): ('builtins', 'zip'), + ('itertools', 'imap'): ('builtins', 'map'), + ('itertools', 'ifilter'): ('builtins', 'filter'), + ('itertools', 'ifilterfalse'): ('itertools', 'filterfalse'), + ('itertools', 'izip_longest'): ('itertools', 'zip_longest'), + ('UserDict', 'IterableUserDict'): ('collections', 'UserDict'), + ('UserList', 'UserList'): ('collections', 'UserList'), + ('UserString', 'UserString'): ('collections', 'UserString'), + ('whichdb', 'whichdb'): ('dbm', 'whichdb'), + ('_socket', 'fromfd'): ('socket', 'fromfd'), + ('_multiprocessing', 'Connection'): ('multiprocessing.connection', 'Connection'), + ('multiprocessing.process', 'Process'): ('multiprocessing.context', 'Process'), + ('multiprocessing.forking', 'Popen'): ('multiprocessing.popen_fork', 'Popen'), + ('urllib', 'ContentTooShortError'): ('urllib.error', 'ContentTooShortError'), + ('urllib', 'getproxies'): ('urllib.request', 'getproxies'), + ('urllib', 'pathname2url'): ('urllib.request', 'pathname2url'), + ('urllib', 'quote_plus'): ('urllib.parse', 'quote_plus'), + ('urllib', 'quote'): ('urllib.parse', 'quote'), + ('urllib', 'unquote_plus'): ('urllib.parse', 'unquote_plus'), + ('urllib', 'unquote'): ('urllib.parse', 'unquote'), + ('urllib', 'url2pathname'): ('urllib.request', 'url2pathname'), + ('urllib', 'urlcleanup'): ('urllib.request', 'urlcleanup'), + ('urllib', 'urlencode'): ('urllib.parse', 'urlencode'), + ('urllib', 'urlopen'): ('urllib.request', 'urlopen'), + ('urllib', 'urlretrieve'): ('urllib.request', 'urlretrieve'), + ('urllib2', 'HTTPError'): ('urllib.error', 'HTTPError'), + ('urllib2', 'URLError'): ('urllib.error', 'URLError'), +} + +PYTHON2_EXCEPTIONS = ( + "ArithmeticError", + "AssertionError", + "AttributeError", + "BaseException", + "BufferError", + "BytesWarning", + "DeprecationWarning", + "EOFError", + "EnvironmentError", + "Exception", + "FloatingPointError", + "FutureWarning", + "GeneratorExit", + "IOError", + "ImportError", + "ImportWarning", + "IndentationError", + "IndexError", + "KeyError", + "KeyboardInterrupt", + "LookupError", + "MemoryError", + "NameError", + "NotImplementedError", + "OSError", + "OverflowError", + "PendingDeprecationWarning", + "ReferenceError", + "RuntimeError", + "RuntimeWarning", + # StandardError is gone in Python 3, so we map it to Exception + "StopIteration", + "SyntaxError", + "SyntaxWarning", + "SystemError", + "SystemExit", + "TabError", + "TypeError", + "UnboundLocalError", + "UnicodeDecodeError", + "UnicodeEncodeError", + "UnicodeError", + "UnicodeTranslateError", + "UnicodeWarning", + "UserWarning", + "ValueError", + "Warning", + "ZeroDivisionError", +) + +try: + WindowsError +except NameError: + pass +else: + PYTHON2_EXCEPTIONS += ("WindowsError",) + +for excname in PYTHON2_EXCEPTIONS: + NAME_MAPPING[("exceptions", excname)] = ("builtins", excname) + +MULTIPROCESSING_EXCEPTIONS = ( + 'AuthenticationError', + 'BufferTooShort', + 'ProcessError', + 'TimeoutError', +) + +for excname in MULTIPROCESSING_EXCEPTIONS: + NAME_MAPPING[("multiprocessing", excname)] = ( + "multiprocessing.context", excname) + +# Same, but for 3.x to 2.x +REVERSE_IMPORT_MAPPING = dict((v, k) for (k, v) in IMPORT_MAPPING.items()) +assert len(REVERSE_IMPORT_MAPPING) == len(IMPORT_MAPPING) +REVERSE_NAME_MAPPING = dict((v, k) for (k, v) in NAME_MAPPING.items()) +assert len(REVERSE_NAME_MAPPING) == len(NAME_MAPPING) + +# Non-mutual mappings. + +IMPORT_MAPPING.update({ + 'cPickle': 'pickle', + '_elementtree': 'xml.etree.ElementTree', + 'FileDialog': 'tkinter.filedialog', + 'SimpleDialog': 'tkinter.simpledialog', + 'DocXMLRPCServer': 'xmlrpc.server', + 'SimpleHTTPServer': 'http.server', + 'CGIHTTPServer': 'http.server', + # For compatibility with broken pickles saved in old Python 3 versions + 'UserDict': 'collections', + 'UserList': 'collections', + 'UserString': 'collections', + 'whichdb': 'dbm', + 'StringIO': 'io', + 'cStringIO': 'io', +}) + +REVERSE_IMPORT_MAPPING.update({ + '_bz2': 'bz2', + '_dbm': 'dbm', + '_functools': 'functools', + '_gdbm': 'gdbm', + '_pickle': 'pickle', +}) + +NAME_MAPPING.update({ + ('__builtin__', 'basestring'): ('builtins', 'str'), + ('exceptions', 'StandardError'): ('builtins', 'Exception'), + ('UserDict', 'UserDict'): ('collections', 'UserDict'), + ('socket', '_socketobject'): ('socket', 'SocketType'), +}) + +REVERSE_NAME_MAPPING.update({ + ('_functools', 'reduce'): ('__builtin__', 'reduce'), + ('tkinter.filedialog', 'FileDialog'): ('FileDialog', 'FileDialog'), + ('tkinter.filedialog', 'LoadFileDialog'): ('FileDialog', 'LoadFileDialog'), + ('tkinter.filedialog', 'SaveFileDialog'): ('FileDialog', 'SaveFileDialog'), + ('tkinter.simpledialog', 'SimpleDialog'): ('SimpleDialog', 'SimpleDialog'), + ('xmlrpc.server', 'ServerHTMLDoc'): ('DocXMLRPCServer', 'ServerHTMLDoc'), + ('xmlrpc.server', 'XMLRPCDocGenerator'): + ('DocXMLRPCServer', 'XMLRPCDocGenerator'), + ('xmlrpc.server', 'DocXMLRPCRequestHandler'): + ('DocXMLRPCServer', 'DocXMLRPCRequestHandler'), + ('xmlrpc.server', 'DocXMLRPCServer'): + ('DocXMLRPCServer', 'DocXMLRPCServer'), + ('xmlrpc.server', 'DocCGIXMLRPCRequestHandler'): + ('DocXMLRPCServer', 'DocCGIXMLRPCRequestHandler'), + ('http.server', 'SimpleHTTPRequestHandler'): + ('SimpleHTTPServer', 'SimpleHTTPRequestHandler'), + ('http.server', 'CGIHTTPRequestHandler'): + ('CGIHTTPServer', 'CGIHTTPRequestHandler'), + ('_socket', 'socket'): ('socket', '_socketobject'), +}) + +PYTHON3_OSERROR_EXCEPTIONS = ( + 'BrokenPipeError', + 'ChildProcessError', + 'ConnectionAbortedError', + 'ConnectionError', + 'ConnectionRefusedError', + 'ConnectionResetError', + 'FileExistsError', + 'FileNotFoundError', + 'InterruptedError', + 'IsADirectoryError', + 'NotADirectoryError', + 'PermissionError', + 'ProcessLookupError', + 'TimeoutError', +) + +for excname in PYTHON3_OSERROR_EXCEPTIONS: + REVERSE_NAME_MAPPING[('builtins', excname)] = ('exceptions', 'OSError') + +PYTHON3_IMPORTERROR_EXCEPTIONS = ( + 'ModuleNotFoundError', +) + +for excname in PYTHON3_IMPORTERROR_EXCEPTIONS: + REVERSE_NAME_MAPPING[('builtins', excname)] = ('exceptions', 'ImportError') diff --git a/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/_compression.py b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/_compression.py new file mode 100644 index 0000000..b00f31b --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/_compression.py @@ -0,0 +1,152 @@ +"""Internal classes used by the gzip, lzma and bz2 modules""" + +import io + + +BUFFER_SIZE = io.DEFAULT_BUFFER_SIZE # Compressed data read chunk size + + +class BaseStream(io.BufferedIOBase): + """Mode-checking helper functions.""" + + def _check_not_closed(self): + if self.closed: + raise ValueError("I/O operation on closed file") + + def _check_can_read(self): + if not self.readable(): + raise io.UnsupportedOperation("File not open for reading") + + def _check_can_write(self): + if not self.writable(): + raise io.UnsupportedOperation("File not open for writing") + + def _check_can_seek(self): + if not self.readable(): + raise io.UnsupportedOperation("Seeking is only supported " + "on files open for reading") + if not self.seekable(): + raise io.UnsupportedOperation("The underlying file object " + "does not support seeking") + + +class DecompressReader(io.RawIOBase): + """Adapts the decompressor API to a RawIOBase reader API""" + + def readable(self): + return True + + def __init__(self, fp, decomp_factory, trailing_error=(), **decomp_args): + self._fp = fp + self._eof = False + self._pos = 0 # Current offset in decompressed stream + + # Set to size of decompressed stream once it is known, for SEEK_END + self._size = -1 + + # Save the decompressor factory and arguments. + # If the file contains multiple compressed streams, each + # stream will need a separate decompressor object. A new decompressor + # object is also needed when implementing a backwards seek(). + self._decomp_factory = decomp_factory + self._decomp_args = decomp_args + self._decompressor = self._decomp_factory(**self._decomp_args) + + # Exception class to catch from decompressor signifying invalid + # trailing data to ignore + self._trailing_error = trailing_error + + def close(self): + self._decompressor = None + return super().close() + + def seekable(self): + return self._fp.seekable() + + def readinto(self, b): + with memoryview(b) as view, view.cast("B") as byte_view: + data = self.read(len(byte_view)) + byte_view[:len(data)] = data + return len(data) + + def read(self, size=-1): + if size < 0: + return self.readall() + + if not size or self._eof: + return b"" + data = None # Default if EOF is encountered + # Depending on the input data, our call to the decompressor may not + # return any data. In this case, try again after reading another block. + while True: + if self._decompressor.eof: + rawblock = (self._decompressor.unused_data or + self._fp.read(BUFFER_SIZE)) + if not rawblock: + break + # Continue to next stream. + self._decompressor = self._decomp_factory( + **self._decomp_args) + try: + data = self._decompressor.decompress(rawblock, size) + except self._trailing_error: + # Trailing data isn't a valid compressed stream; ignore it. + break + else: + if self._decompressor.needs_input: + rawblock = self._fp.read(BUFFER_SIZE) + if not rawblock: + raise EOFError("Compressed file ended before the " + "end-of-stream marker was reached") + else: + rawblock = b"" + data = self._decompressor.decompress(rawblock, size) + if data: + break + if not data: + self._eof = True + self._size = self._pos + return b"" + self._pos += len(data) + return data + + # Rewind the file to the beginning of the data stream. + def _rewind(self): + self._fp.seek(0) + self._eof = False + self._pos = 0 + self._decompressor = self._decomp_factory(**self._decomp_args) + + def seek(self, offset, whence=io.SEEK_SET): + # Recalculate offset as an absolute file position. + if whence == io.SEEK_SET: + pass + elif whence == io.SEEK_CUR: + offset = self._pos + offset + elif whence == io.SEEK_END: + # Seeking relative to EOF - we need to know the file's size. + if self._size < 0: + while self.read(io.DEFAULT_BUFFER_SIZE): + pass + offset = self._size + offset + else: + raise ValueError("Invalid value for whence: {}".format(whence)) + + # Make it so that offset is the number of bytes to skip forward. + if offset < self._pos: + self._rewind() + else: + offset -= self._pos + + # Read and discard data until we reach the desired position. + while offset > 0: + data = self.read(min(io.DEFAULT_BUFFER_SIZE, offset)) + if not data: + break + offset -= len(data) + + return self._pos + + def tell(self): + """Return the current file position.""" + return self._pos diff --git a/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/_dummy_thread.py b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/_dummy_thread.py new file mode 100644 index 0000000..4b1f9c8 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/_dummy_thread.py @@ -0,0 +1,172 @@ +"""Drop-in replacement for the thread module. + +Meant to be used as a brain-dead substitute so that threaded code does +not need to be rewritten for when the thread module is not present. + +Suggested usage is:: + + try: + import _thread + except ImportError: + import _dummy_thread as _thread + +""" +# Exports only things specified by thread documentation; +# skipping obsolete synonyms allocate(), start_new(), exit_thread(). +__all__ = ['error', 'start_new_thread', 'exit', 'get_ident', 'allocate_lock', + 'interrupt_main', 'LockType'] + +# A dummy value +TIMEOUT_MAX = 2**31 + +# NOTE: this module can be imported early in the extension building process, +# and so top level imports of other modules should be avoided. Instead, all +# imports are done when needed on a function-by-function basis. Since threads +# are disabled, the import lock should not be an issue anyway (??). + +error = RuntimeError + + +def start_new_thread(function, args, kwargs={}): + """Dummy implementation of _thread.start_new_thread(). + + Compatibility is maintained by making sure that ``args`` is a + tuple and ``kwargs`` is a dictionary. If an exception is raised + and it is SystemExit (which can be done by _thread.exit()) it is + caught and nothing is done; all other exceptions are printed out + by using traceback.print_exc(). + + If the executed function calls interrupt_main the KeyboardInterrupt will be + raised when the function returns. + + """ + if type(args) != type(tuple()): + raise TypeError("2nd arg must be a tuple") + if type(kwargs) != type(dict()): + raise TypeError("3rd arg must be a dict") + global _main + _main = False + try: + function(*args, **kwargs) + except SystemExit: + pass + except: + import traceback + traceback.print_exc() + _main = True + global _interrupt + if _interrupt: + _interrupt = False + raise KeyboardInterrupt + + +def exit(): + """Dummy implementation of _thread.exit().""" + raise SystemExit + + +def get_ident(): + """Dummy implementation of _thread.get_ident(). + + Since this module should only be used when _threadmodule is not + available, it is safe to assume that the current process is the + only thread. Thus a constant can be safely returned. + """ + return -1 + + +def allocate_lock(): + """Dummy implementation of _thread.allocate_lock().""" + return LockType() + + +def stack_size(size=None): + """Dummy implementation of _thread.stack_size().""" + if size is not None: + raise error("setting thread stack size not supported") + return 0 + + +def _set_sentinel(): + """Dummy implementation of _thread._set_sentinel().""" + return LockType() + + +class LockType(object): + """Class implementing dummy implementation of _thread.LockType. + + Compatibility is maintained by maintaining self.locked_status + which is a boolean that stores the state of the lock. Pickling of + the lock, though, should not be done since if the _thread module is + then used with an unpickled ``lock()`` from here problems could + occur from this class not having atomic methods. + + """ + + def __init__(self): + self.locked_status = False + + def acquire(self, waitflag=None, timeout=-1): + """Dummy implementation of acquire(). + + For blocking calls, self.locked_status is automatically set to + True and returned appropriately based on value of + ``waitflag``. If it is non-blocking, then the value is + actually checked and not set if it is already acquired. This + is all done so that threading.Condition's assert statements + aren't triggered and throw a little fit. + + """ + if waitflag is None or waitflag: + self.locked_status = True + return True + else: + if not self.locked_status: + self.locked_status = True + return True + else: + if timeout > 0: + import time + time.sleep(timeout) + return False + + __enter__ = acquire + + def __exit__(self, typ, val, tb): + self.release() + + def release(self): + """Release the dummy lock.""" + # XXX Perhaps shouldn't actually bother to test? Could lead + # to problems for complex, threaded code. + if not self.locked_status: + raise error + self.locked_status = False + return True + + def locked(self): + return self.locked_status + + def __repr__(self): + return "<%s %s.%s object at %s>" % ( + "locked" if self.locked_status else "unlocked", + self.__class__.__module__, + self.__class__.__qualname__, + hex(id(self)) + ) + + +# Used to signal that interrupt_main was called in a "thread" +_interrupt = False +# True when not executing in a "thread" +_main = True + + +def interrupt_main(): + """Set _interrupt flag to True to have start_new_thread raise + KeyboardInterrupt upon exiting.""" + if _main: + raise KeyboardInterrupt + else: + global _interrupt + _interrupt = True diff --git a/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/_markupbase.py b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/_markupbase.py new file mode 100644 index 0000000..1139c1c --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/_markupbase.py @@ -0,0 +1,399 @@ +"""Shared support for scanning document type declarations in HTML and XHTML. + +This module is used as a foundation for the html.parser module. It has no +documented public API and should not be used directly. + +""" + +import re + +_declname_match = re.compile(r'[a-zA-Z][-_.a-zA-Z0-9]*\s*').match +_declstringlit_match = re.compile(r'(\'[^\']*\'|"[^"]*")\s*').match +_commentclose = re.compile(r'--\s*>') +_markedsectionclose = re.compile(r']\s*]\s*>') + +# An analysis of the MS-Word extensions is available at +# http://www.planetpublish.com/xmlarena/xap/Thursday/WordtoXML.pdf + +_msmarkedsectionclose = re.compile(r']\s*>') + +del re + + +class ParserBase: + """Parser base class which provides some common support methods used + by the SGML/HTML and XHTML parsers.""" + + def __init__(self): + if self.__class__ is ParserBase: + raise RuntimeError( + "_markupbase.ParserBase must be subclassed") + + def error(self, message): + raise NotImplementedError( + "subclasses of ParserBase must override error()") + + def reset(self): + self.lineno = 1 + self.offset = 0 + + def getpos(self): + """Return current line number and offset.""" + return self.lineno, self.offset + + # Internal -- update line number and offset. This should be + # called for each piece of data exactly once, in order -- in other + # words the concatenation of all the input strings to this + # function should be exactly the entire input. + def updatepos(self, i, j): + if i >= j: + return j + rawdata = self.rawdata + nlines = rawdata.count("\n", i, j) + if nlines: + self.lineno = self.lineno + nlines + pos = rawdata.rindex("\n", i, j) # Should not fail + self.offset = j-(pos+1) + else: + self.offset = self.offset + j-i + return j + + _decl_otherchars = '' + + # Internal -- parse declaration (for use by subclasses). + def parse_declaration(self, i): + # This is some sort of declaration; in "HTML as + # deployed," this should only be the document type + # declaration (""). + # ISO 8879:1986, however, has more complex + # declaration syntax for elements in , including: + # --comment-- + # [marked section] + # name in the following list: ENTITY, DOCTYPE, ELEMENT, + # ATTLIST, NOTATION, SHORTREF, USEMAP, + # LINKTYPE, LINK, IDLINK, USELINK, SYSTEM + rawdata = self.rawdata + j = i + 2 + assert rawdata[i:j] == "": + # the empty comment + return j + 1 + if rawdata[j:j+1] in ("-", ""): + # Start of comment followed by buffer boundary, + # or just a buffer boundary. + return -1 + # A simple, practical version could look like: ((name|stringlit) S*) + '>' + n = len(rawdata) + if rawdata[j:j+2] == '--': # comment + # Locate --.*-- as the body of the comment + return self.parse_comment(i) + elif rawdata[j] == '[': # marked section + # Locate [statusWord [...arbitrary SGML...]] as the body of the marked section + # Where statusWord is one of TEMP, CDATA, IGNORE, INCLUDE, RCDATA + # Note that this is extended by Microsoft Office "Save as Web" function + # to include [if...] and [endif]. + return self.parse_marked_section(i) + else: # all other declaration elements + decltype, j = self._scan_name(j, i) + if j < 0: + return j + if decltype == "doctype": + self._decl_otherchars = '' + while j < n: + c = rawdata[j] + if c == ">": + # end of declaration syntax + data = rawdata[i+2:j] + if decltype == "doctype": + self.handle_decl(data) + else: + # According to the HTML5 specs sections "8.2.4.44 Bogus + # comment state" and "8.2.4.45 Markup declaration open + # state", a comment token should be emitted. + # Calling unknown_decl provides more flexibility though. + self.unknown_decl(data) + return j + 1 + if c in "\"'": + m = _declstringlit_match(rawdata, j) + if not m: + return -1 # incomplete + j = m.end() + elif c in "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ": + name, j = self._scan_name(j, i) + elif c in self._decl_otherchars: + j = j + 1 + elif c == "[": + # this could be handled in a separate doctype parser + if decltype == "doctype": + j = self._parse_doctype_subset(j + 1, i) + elif decltype in {"attlist", "linktype", "link", "element"}: + # must tolerate []'d groups in a content model in an element declaration + # also in data attribute specifications of attlist declaration + # also link type declaration subsets in linktype declarations + # also link attribute specification lists in link declarations + self.error( + "unsupported '[' char in %s declaration" % decltype) + else: + self.error("unexpected '[' char in declaration") + else: + self.error( + "unexpected %r char in declaration" % rawdata[j]) + if j < 0: + return j + return -1 # incomplete + + # Internal -- parse a marked section + # Override this to handle MS-word extension syntax content + def parse_marked_section(self, i, report=1): + rawdata = self.rawdata + assert rawdata[i:i + + 3] == ' ending + match = _markedsectionclose.search(rawdata, i+3) + elif sectName in {"if", "else", "endif"}: + # look for MS Office ]> ending + match = _msmarkedsectionclose.search(rawdata, i+3) + else: + self.error('unknown status keyword %r in marked section' % + rawdata[i+3:j]) + if not match: + return -1 + if report: + j = match.start(0) + self.unknown_decl(rawdata[i+3: j]) + return match.end(0) + + # Internal -- parse comment, return length or -1 if not terminated + def parse_comment(self, i, report=1): + rawdata = self.rawdata + if rawdata[i:i+4] != ' + --> --> + + ''' + + +__UNDEF__ = [] # a special sentinel object + + +def small(text): + if text: + return '' + text + '' + else: + return '' + + +def strong(text): + if text: + return '' + text + '' + else: + return '' + + +def grey(text): + if text: + return '' + text + '' + else: + return '' + + +def lookup(name, frame, locals): + """Find the value for a given name in the given environment.""" + if name in locals: + return 'local', locals[name] + if name in frame.f_globals: + return 'global', frame.f_globals[name] + if '__builtins__' in frame.f_globals: + builtins = frame.f_globals['__builtins__'] + if type(builtins) is type({}): + if name in builtins: + return 'builtin', builtins[name] + else: + if hasattr(builtins, name): + return 'builtin', getattr(builtins, name) + return None, __UNDEF__ + + +def scanvars(reader, frame, locals): + """Scan one logical line of Python and look up values of variables used.""" + vars, lasttoken, parent, prefix, value = [], None, None, '', __UNDEF__ + for ttype, token, start, end, line in tokenize.generate_tokens(reader): + if ttype == tokenize.NEWLINE: + break + if ttype == tokenize.NAME and token not in keyword.kwlist: + if lasttoken == '.': + if parent is not __UNDEF__: + value = getattr(parent, token, __UNDEF__) + vars.append((prefix + token, prefix, value)) + else: + where, value = lookup(token, frame, locals) + vars.append((token, where, value)) + elif token == '.': + prefix += lasttoken + '.' + parent = value + else: + parent, prefix = None, '' + lasttoken = token + return vars + + +def html(einfo, context=5): + """Return a nice HTML document describing a given traceback.""" + etype, evalue, etb = einfo + if isinstance(etype, type): + etype = etype.__name__ + pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable + date = time.ctime(time.time()) + head = '' + pydoc.html.heading( + '%s' % + strong(pydoc.html.escape(str(etype))), + '#ffffff', '#6622aa', pyver + '
' + date) + ''' +

A problem occurred in a Python script. Here is the sequence of +function calls leading up to the error, in the order they occurred.

''' + + indent = '' + small(' ' * 5) + ' ' + frames = [] + records = inspect.getinnerframes(etb, context) + for frame, file, lnum, func, lines, index in records: + if file: + file = os.path.abspath(file) + link = '%s' % (file, + pydoc.html.escape(file)) + else: + file = link = '?' + args, varargs, varkw, locals = inspect.getargvalues(frame) + call = '' + if func != '?': + call = 'in ' + strong(func) + \ + inspect.formatargvalues(args, varargs, varkw, locals, + formatvalue=lambda value: '=' + pydoc.html.repr(value)) + + highlight = {} + + def reader(lnum=[lnum]): + highlight[lnum[0]] = 1 + try: + return linecache.getline(file, lnum[0]) + finally: + lnum[0] += 1 + vars = scanvars(reader, frame, locals) + + rows = ['%s%s %s' % + (' ', link, call)] + if index is not None: + i = lnum - index + for line in lines: + num = small(' ' * (5-len(str(i))) + str(i)) + ' ' + if i in highlight: + line = '=>%s%s' % (num, + pydoc.html.preformat(line)) + rows.append( + '%s' % line) + else: + line = '  %s%s' % ( + num, pydoc.html.preformat(line)) + rows.append('%s' % grey(line)) + i += 1 + + done, dump = {}, [] + for name, where, value in vars: + if name in done: + continue + done[name] = 1 + if value is not __UNDEF__: + if where in ('global', 'builtin'): + name = ('%s ' % where) + strong(name) + elif where == 'local': + name = strong(name) + else: + name = where + strong(name.split('.')[-1]) + dump.append('%s = %s' % (name, pydoc.html.repr(value))) + else: + dump.append(name + ' undefined') + + rows.append('%s' % small(grey(', '.join(dump)))) + frames.append(''' + +%s
''' % '\n'.join(rows)) + + exception = ['

%s: %s' % (strong(pydoc.html.escape(str(etype))), + pydoc.html.escape(str(evalue)))] + for name in dir(evalue): + if name[:1] == '_': + continue + value = pydoc.html.repr(getattr(evalue, name)) + exception.append('\n
%s%s =\n%s' % (indent, name, value)) + + return head + ''.join(frames) + ''.join(exception) + ''' + + + +''' % pydoc.html.escape( + ''.join(traceback.format_exception(etype, evalue, etb))) + + +def text(einfo, context=5): + """Return a plain text document describing a given traceback.""" + etype, evalue, etb = einfo + if isinstance(etype, type): + etype = etype.__name__ + pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable + date = time.ctime(time.time()) + head = "%s\n%s\n%s\n" % (str(etype), pyver, date) + ''' +A problem occurred in a Python script. Here is the sequence of +function calls leading up to the error, in the order they occurred. +''' + + frames = [] + records = inspect.getinnerframes(etb, context) + for frame, file, lnum, func, lines, index in records: + file = file and os.path.abspath(file) or '?' + args, varargs, varkw, locals = inspect.getargvalues(frame) + call = '' + if func != '?': + call = 'in ' + func + \ + inspect.formatargvalues(args, varargs, varkw, locals, + formatvalue=lambda value: '=' + pydoc.text.repr(value)) + + highlight = {} + + def reader(lnum=[lnum]): + highlight[lnum[0]] = 1 + try: + return linecache.getline(file, lnum[0]) + finally: + lnum[0] += 1 + vars = scanvars(reader, frame, locals) + + rows = [' %s %s' % (file, call)] + if index is not None: + i = lnum - index + for line in lines: + num = '%5d ' % i + rows.append(num+line.rstrip()) + i += 1 + + done, dump = {}, [] + for name, where, value in vars: + if name in done: + continue + done[name] = 1 + if value is not __UNDEF__: + if where == 'global': + name = 'global ' + name + elif where != 'local': + name = where + name.split('.')[-1] + dump.append('%s = %s' % (name, pydoc.text.repr(value))) + else: + dump.append(name + ' undefined') + + rows.append('\n'.join(dump)) + frames.append('\n%s\n' % '\n'.join(rows)) + + exception = ['%s: %s' % (str(etype), str(evalue))] + for name in dir(evalue): + value = pydoc.text.repr(getattr(evalue, name)) + exception.append('\n%s%s = %s' % (" "*4, name, value)) + + return head + ''.join(frames) + ''.join(exception) + ''' + +The above is a description of an error in a Python program. Here is +the original traceback: + +%s +''' % ''.join(traceback.format_exception(etype, evalue, etb)) + + +class Hook: + """A hook to replace sys.excepthook that shows tracebacks in HTML.""" + + def __init__(self, display=1, logdir=None, context=5, file=None, + format="html"): + self.display = display # send tracebacks to browser if true + self.logdir = logdir # log tracebacks to files if not None + self.context = context # number of source code lines per frame + self.file = file or sys.stdout # place to send the output + self.format = format + + def __call__(self, etype, evalue, etb): + self.handle((etype, evalue, etb)) + + def handle(self, info=None): + info = info or sys.exc_info() + if self.format == "html": + self.file.write(reset()) + + formatter = (self.format == "html") and html or text + plain = False + try: + doc = formatter(info, self.context) + except: # just in case something goes wrong + doc = ''.join(traceback.format_exception(*info)) + plain = True + + if self.display: + if plain: + doc = doc.replace('&', '&').replace('<', '<') + self.file.write('

' + doc + '
\n') + else: + self.file.write(doc + '\n') + else: + self.file.write('

A problem occurred in a Python script.\n') + + if self.logdir is not None: + suffix = ['.txt', '.html'][self.format == "html"] + (fd, path) = tempfile.mkstemp(suffix=suffix, dir=self.logdir) + + try: + with os.fdopen(fd, 'w') as file: + file.write(doc) + msg = '%s contains the description of this error.' % path + except: + msg = 'Tried to save traceback to %s, but failed.' % path + + if self.format == 'html': + self.file.write('

%s

\n' % msg) + else: + self.file.write(msg + '\n') + try: + self.file.flush() + except: + pass + + +handler = Hook().handle + + +def enable(display=1, logdir=None, context=5, format="html"): + """Install an exception handler that formats tracebacks as HTML. + + The optional argument 'display' can be set to 0 to suppress sending the + traceback to the browser, and 'logdir' can be set to a directory to cause + tracebacks to be written to files there.""" + sys.excepthook = Hook(display=display, logdir=logdir, + context=context, format=format) diff --git a/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/chunk.py b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/chunk.py new file mode 100644 index 0000000..3868021 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/chunk.py @@ -0,0 +1,170 @@ +"""Simple class to read IFF chunks. + +An IFF chunk (used in formats such as AIFF, TIFF, RMFF (RealMedia File +Format)) has the following structure: + ++----------------+ +| ID (4 bytes) | ++----------------+ +| size (4 bytes) | ++----------------+ +| data | +| ... | ++----------------+ + +The ID is a 4-byte string which identifies the type of chunk. + +The size field (a 32-bit value, encoded using big-endian byte order) +gives the size of the whole chunk, including the 8-byte header. + +Usually an IFF-type file consists of one or more chunks. The proposed +usage of the Chunk class defined here is to instantiate an instance at +the start of each chunk and read from the instance until it reaches +the end, after which a new instance can be instantiated. At the end +of the file, creating a new instance will fail with an EOFError +exception. + +Usage: +while True: + try: + chunk = Chunk(file) + except EOFError: + break + chunktype = chunk.getname() + while True: + data = chunk.read(nbytes) + if not data: + pass + # do something with data + +The interface is file-like. The implemented methods are: +read, close, seek, tell, isatty. +Extra methods are: skip() (called by close, skips to the end of the chunk), +getname() (returns the name (ID) of the chunk) + +The __init__ method has one required argument, a file-like object +(including a chunk instance), and one optional argument, a flag which +specifies whether or not chunks are aligned on 2-byte boundaries. The +default is 1, i.e. aligned. +""" + + +class Chunk: + def __init__(self, file, align=True, bigendian=True, inclheader=False): + import struct + self.closed = False + self.align = align # whether to align to word (2-byte) boundaries + if bigendian: + strflag = '>' + else: + strflag = '<' + self.file = file + self.chunkname = file.read(4) + if len(self.chunkname) < 4: + raise EOFError + try: + self.chunksize = struct.unpack_from(strflag+'L', file.read(4))[0] + except struct.error: + raise EOFError + if inclheader: + self.chunksize = self.chunksize - 8 # subtract header + self.size_read = 0 + try: + self.offset = self.file.tell() + except (AttributeError, OSError): + self.seekable = False + else: + self.seekable = True + + def getname(self): + """Return the name (ID) of the current chunk.""" + return self.chunkname + + def getsize(self): + """Return the size of the current chunk.""" + return self.chunksize + + def close(self): + if not self.closed: + try: + self.skip() + finally: + self.closed = True + + def isatty(self): + if self.closed: + raise ValueError("I/O operation on closed file") + return False + + def seek(self, pos, whence=0): + """Seek to specified position into the chunk. + Default position is 0 (start of chunk). + If the file is not seekable, this will result in an error. + """ + + if self.closed: + raise ValueError("I/O operation on closed file") + if not self.seekable: + raise OSError("cannot seek") + if whence == 1: + pos = pos + self.size_read + elif whence == 2: + pos = pos + self.chunksize + if pos < 0 or pos > self.chunksize: + raise RuntimeError + self.file.seek(self.offset + pos, 0) + self.size_read = pos + + def tell(self): + if self.closed: + raise ValueError("I/O operation on closed file") + return self.size_read + + def read(self, size=-1): + """Read at most size bytes from the chunk. + If size is omitted or negative, read until the end + of the chunk. + """ + + if self.closed: + raise ValueError("I/O operation on closed file") + if self.size_read >= self.chunksize: + return b'' + if size < 0: + size = self.chunksize - self.size_read + if size > self.chunksize - self.size_read: + size = self.chunksize - self.size_read + data = self.file.read(size) + self.size_read = self.size_read + len(data) + if self.size_read == self.chunksize and \ + self.align and \ + (self.chunksize & 1): + dummy = self.file.read(1) + self.size_read = self.size_read + len(dummy) + return data + + def skip(self): + """Skip the rest of the chunk. + If you are not interested in the contents of the chunk, + this method should be called so that the file points to + the start of the next chunk. + """ + + if self.closed: + raise ValueError("I/O operation on closed file") + if self.seekable: + try: + n = self.chunksize - self.size_read + # maybe fix alignment + if self.align and (self.chunksize & 1): + n = n + 1 + self.file.seek(n, 1) + self.size_read = self.size_read + n + return + except OSError: + pass + while self.size_read < self.chunksize: + n = min(8192, self.chunksize - self.size_read) + dummy = self.read(n) + if not dummy: + raise EOFError diff --git a/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/cmd.py b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/cmd.py new file mode 100644 index 0000000..05a13a1 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/cmd.py @@ -0,0 +1,403 @@ +"""A generic class to build line-oriented command interpreters. + +Interpreters constructed with this class obey the following conventions: + +1. End of file on input is processed as the command 'EOF'. +2. A command is parsed out of each line by collecting the prefix composed + of characters in the identchars member. +3. A command `foo' is dispatched to a method 'do_foo()'; the do_ method + is passed a single argument consisting of the remainder of the line. +4. Typing an empty line repeats the last command. (Actually, it calls the + method `emptyline', which may be overridden in a subclass.) +5. There is a predefined `help' method. Given an argument `topic', it + calls the command `help_topic'. With no arguments, it lists all topics + with defined help_ functions, broken into up to three topics; documented + commands, miscellaneous help topics, and undocumented commands. +6. The command '?' is a synonym for `help'. The command '!' is a synonym + for `shell', if a do_shell method exists. +7. If completion is enabled, completing commands will be done automatically, + and completing of commands args is done by calling complete_foo() with + arguments text, line, begidx, endidx. text is string we are matching + against, all returned matches must begin with it. line is the current + input line (lstripped), begidx and endidx are the beginning and end + indexes of the text being matched, which could be used to provide + different completion depending upon which position the argument is in. + +The `default' method may be overridden to intercept commands for which there +is no do_ method. + +The `completedefault' method may be overridden to intercept completions for +commands that have no complete_ method. + +The data member `self.ruler' sets the character used to draw separator lines +in the help messages. If empty, no ruler line is drawn. It defaults to "=". + +If the value of `self.intro' is nonempty when the cmdloop method is called, +it is printed out on interpreter startup. This value may be overridden +via an optional argument to the cmdloop() method. + +The data members `self.doc_header', `self.misc_header', and +`self.undoc_header' set the headers used for the help function's +listings of documented functions, miscellaneous topics, and undocumented +functions respectively. +""" + +import string +import sys + +__all__ = ["Cmd"] + +PROMPT = '(Cmd) ' +IDENTCHARS = string.ascii_letters + string.digits + '_' + + +class Cmd: + """A simple framework for writing line-oriented command interpreters. + + These are often useful for test harnesses, administrative tools, and + prototypes that will later be wrapped in a more sophisticated interface. + + A Cmd instance or subclass instance is a line-oriented interpreter + framework. There is no good reason to instantiate Cmd itself; rather, + it's useful as a superclass of an interpreter class you define yourself + in order to inherit Cmd's methods and encapsulate action methods. + + """ + prompt = PROMPT + identchars = IDENTCHARS + ruler = '=' + lastcmd = '' + intro = None + doc_leader = "" + doc_header = "Documented commands (type help ):" + misc_header = "Miscellaneous help topics:" + undoc_header = "Undocumented commands:" + nohelp = "*** No help on %s" + use_rawinput = 1 + + def __init__(self, completekey='tab', stdin=None, stdout=None): + """Instantiate a line-oriented interpreter framework. + + The optional argument 'completekey' is the readline name of a + completion key; it defaults to the Tab key. If completekey is + not None and the readline module is available, command completion + is done automatically. The optional arguments stdin and stdout + specify alternate input and output file objects; if not specified, + sys.stdin and sys.stdout are used. + + """ + if stdin is not None: + self.stdin = stdin + else: + self.stdin = sys.stdin + if stdout is not None: + self.stdout = stdout + else: + self.stdout = sys.stdout + self.cmdqueue = [] + self.completekey = completekey + + def cmdloop(self, intro=None): + """Repeatedly issue a prompt, accept input, parse an initial prefix + off the received input, and dispatch to action methods, passing them + the remainder of the line as argument. + + """ + + self.preloop() + if self.use_rawinput and self.completekey: + try: + import readline + self.old_completer = readline.get_completer() + readline.set_completer(self.complete) + readline.parse_and_bind(self.completekey+": complete") + except ImportError: + pass + try: + if intro is not None: + self.intro = intro + if self.intro: + self.stdout.write(str(self.intro)+"\n") + stop = None + while not stop: + if self.cmdqueue: + line = self.cmdqueue.pop(0) + else: + if self.use_rawinput: + try: + line = input(self.prompt) + except EOFError: + line = 'EOF' + else: + self.stdout.write(self.prompt) + self.stdout.flush() + line = self.stdin.readline() + if not len(line): + line = 'EOF' + else: + line = line.rstrip('\r\n') + line = self.precmd(line) + stop = self.onecmd(line) + stop = self.postcmd(stop, line) + self.postloop() + finally: + if self.use_rawinput and self.completekey: + try: + import readline + readline.set_completer(self.old_completer) + except ImportError: + pass + + def precmd(self, line): + """Hook method executed just before the command line is + interpreted, but after the input prompt is generated and issued. + + """ + return line + + def postcmd(self, stop, line): + """Hook method executed just after a command dispatch is finished.""" + return stop + + def preloop(self): + """Hook method executed once when the cmdloop() method is called.""" + pass + + def postloop(self): + """Hook method executed once when the cmdloop() method is about to + return. + + """ + pass + + def parseline(self, line): + """Parse the line into a command name and a string containing + the arguments. Returns a tuple containing (command, args, line). + 'command' and 'args' may be None if the line couldn't be parsed. + """ + line = line.strip() + if not line: + return None, None, line + elif line[0] == '?': + line = 'help ' + line[1:] + elif line[0] == '!': + if hasattr(self, 'do_shell'): + line = 'shell ' + line[1:] + else: + return None, None, line + i, n = 0, len(line) + while i < n and line[i] in self.identchars: + i = i+1 + cmd, arg = line[:i], line[i:].strip() + return cmd, arg, line + + def onecmd(self, line): + """Interpret the argument as though it had been typed in response + to the prompt. + + This may be overridden, but should not normally need to be; + see the precmd() and postcmd() methods for useful execution hooks. + The return value is a flag indicating whether interpretation of + commands by the interpreter should stop. + + """ + cmd, arg, line = self.parseline(line) + if not line: + return self.emptyline() + if cmd is None: + return self.default(line) + self.lastcmd = line + if line == 'EOF': + self.lastcmd = '' + if cmd == '': + return self.default(line) + else: + try: + func = getattr(self, 'do_' + cmd) + except AttributeError: + return self.default(line) + return func(arg) + + def emptyline(self): + """Called when an empty line is entered in response to the prompt. + + If this method is not overridden, it repeats the last nonempty + command entered. + + """ + if self.lastcmd: + return self.onecmd(self.lastcmd) + + def default(self, line): + """Called on an input line when the command prefix is not recognized. + + If this method is not overridden, it prints an error message and + returns. + + """ + self.stdout.write('*** Unknown syntax: %s\n' % line) + + def completedefault(self, *ignored): + """Method called to complete an input line when no command-specific + complete_*() method is available. + + By default, it returns an empty list. + + """ + return [] + + def completenames(self, text, *ignored): + dotext = 'do_'+text + return [a[3:] for a in self.get_names() if a.startswith(dotext)] + + def complete(self, text, state): + """Return the next possible completion for 'text'. + + If a command has not been entered, then complete against command list. + Otherwise try to call complete_ to get list of completions. + """ + if state == 0: + import readline + origline = readline.get_line_buffer() + line = origline.lstrip() + stripped = len(origline) - len(line) + begidx = readline.get_begidx() - stripped + endidx = readline.get_endidx() - stripped + if begidx > 0: + cmd, args, foo = self.parseline(line) + if cmd == '': + compfunc = self.completedefault + else: + try: + compfunc = getattr(self, 'complete_' + cmd) + except AttributeError: + compfunc = self.completedefault + else: + compfunc = self.completenames + self.completion_matches = compfunc(text, line, begidx, endidx) + try: + return self.completion_matches[state] + except IndexError: + return None + + def get_names(self): + # This method used to pull in base class attributes + # at a time dir() didn't do it yet. + return dir(self.__class__) + + def complete_help(self, *args): + commands = set(self.completenames(*args)) + topics = set(a[5:] for a in self.get_names() + if a.startswith('help_' + args[0])) + return list(commands | topics) + + def do_help(self, arg): + 'List available commands with "help" or detailed help with "help cmd".' + if arg: + # XXX check arg syntax + try: + func = getattr(self, 'help_' + arg) + except AttributeError: + try: + doc = getattr(self, 'do_' + arg).__doc__ + if doc: + self.stdout.write("%s\n" % str(doc)) + return + except AttributeError: + pass + self.stdout.write("%s\n" % str(self.nohelp % (arg,))) + return + func() + else: + names = self.get_names() + cmds_doc = [] + cmds_undoc = [] + help = {} + for name in names: + if name[:5] == 'help_': + help[name[5:]] = 1 + names.sort() + # There can be duplicates if routines overridden + prevname = '' + for name in names: + if name[:3] == 'do_': + if name == prevname: + continue + prevname = name + cmd = name[3:] + if cmd in help: + cmds_doc.append(cmd) + del help[cmd] + elif getattr(self, name).__doc__: + cmds_doc.append(cmd) + else: + cmds_undoc.append(cmd) + self.stdout.write("%s\n" % str(self.doc_leader)) + self.print_topics(self.doc_header, cmds_doc, 15, 80) + self.print_topics(self.misc_header, list(help.keys()), 15, 80) + self.print_topics(self.undoc_header, cmds_undoc, 15, 80) + + def print_topics(self, header, cmds, cmdlen, maxcol): + if cmds: + self.stdout.write("%s\n" % str(header)) + if self.ruler: + self.stdout.write("%s\n" % str(self.ruler * len(header))) + self.columnize(cmds, maxcol-1) + self.stdout.write("\n") + + def columnize(self, list, displaywidth=80): + """Display a list of strings as a compact set of columns. + + Each column is only as wide as necessary. + Columns are separated by two spaces (one was not legible enough). + """ + if not list: + self.stdout.write("\n") + return + + nonstrings = [i for i in range(len(list)) + if not isinstance(list[i], str)] + if nonstrings: + raise TypeError("list[i] not a string for i in %s" + % ", ".join(map(str, nonstrings))) + size = len(list) + if size == 1: + self.stdout.write('%s\n' % str(list[0])) + return + # Try every row count from 1 upwards + for nrows in range(1, len(list)): + ncols = (size+nrows-1) // nrows + colwidths = [] + totwidth = -2 + for col in range(ncols): + colwidth = 0 + for row in range(nrows): + i = row + nrows*col + if i >= size: + break + x = list[i] + colwidth = max(colwidth, len(x)) + colwidths.append(colwidth) + totwidth += colwidth + 2 + if totwidth > displaywidth: + break + if totwidth <= displaywidth: + break + else: + nrows = len(list) + ncols = 1 + colwidths = [0] + for row in range(nrows): + texts = [] + for col in range(ncols): + i = row + nrows*col + if i >= size: + x = "" + else: + x = list[i] + texts.append(x) + while texts and not texts[-1]: + del texts[-1] + for col in range(len(texts)): + texts[col] = texts[col].ljust(colwidths[col]) + self.stdout.write("%s\n" % str(" ".join(texts))) diff --git a/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/code.py b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/code.py new file mode 100644 index 0000000..a39ca2a --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/code.py @@ -0,0 +1,314 @@ +"""Utilities needed to emulate Python's interactive interpreter. + +""" + +# Inspired by similar code by Jeff Epler and Fredrik Lundh. + + +import sys +import traceback +import argparse +from codeop import CommandCompiler, compile_command + +__all__ = ["InteractiveInterpreter", "InteractiveConsole", "interact", + "compile_command"] + + +class InteractiveInterpreter: + """Base class for InteractiveConsole. + + This class deals with parsing and interpreter state (the user's + namespace); it doesn't deal with input buffering or prompting or + input file naming (the filename is always passed in explicitly). + + """ + + def __init__(self, locals=None): + """Constructor. + + The optional 'locals' argument specifies the dictionary in + which code will be executed; it defaults to a newly created + dictionary with key "__name__" set to "__console__" and key + "__doc__" set to None. + + """ + if locals is None: + locals = {"__name__": "__console__", "__doc__": None} + self.locals = locals + self.compile = CommandCompiler() + + def runsource(self, source, filename="", symbol="single"): + """Compile and run some source in the interpreter. + + Arguments are as for compile_command(). + + One several things can happen: + + 1) The input is incorrect; compile_command() raised an + exception (SyntaxError or OverflowError). A syntax traceback + will be printed by calling the showsyntaxerror() method. + + 2) The input is incomplete, and more input is required; + compile_command() returned None. Nothing happens. + + 3) The input is complete; compile_command() returned a code + object. The code is executed by calling self.runcode() (which + also handles run-time exceptions, except for SystemExit). + + The return value is True in case 2, False in the other cases (unless + an exception is raised). The return value can be used to + decide whether to use sys.ps1 or sys.ps2 to prompt the next + line. + + """ + try: + code = self.compile(source, filename, symbol) + except (OverflowError, SyntaxError, ValueError): + # Case 1 + self.showsyntaxerror(filename) + return False + + if code is None: + # Case 2 + return True + + # Case 3 + self.runcode(code) + return False + + def runcode(self, code): + """Execute a code object. + + When an exception occurs, self.showtraceback() is called to + display a traceback. All exceptions are caught except + SystemExit, which is reraised. + + A note about KeyboardInterrupt: this exception may occur + elsewhere in this code, and may not always be caught. The + caller should be prepared to deal with it. + + """ + try: + exec(code, self.locals) + except SystemExit: + raise + except: + self.showtraceback() + + def showsyntaxerror(self, filename=None): + """Display the syntax error that just occurred. + + This doesn't display a stack trace because there isn't one. + + If a filename is given, it is stuffed in the exception instead + of what was there before (because Python's parser always uses + "" when reading from a string). + + The output is written by self.write(), below. + + """ + type, value, tb = sys.exc_info() + sys.last_type = type + sys.last_value = value + sys.last_traceback = tb + if filename and type is SyntaxError: + # Work hard to stuff the correct filename in the exception + try: + msg, (dummy_filename, lineno, offset, line) = value.args + except ValueError: + # Not the format we expect; leave it alone + pass + else: + # Stuff in the right filename + value = SyntaxError(msg, (filename, lineno, offset, line)) + sys.last_value = value + if sys.excepthook is sys.__excepthook__: + lines = traceback.format_exception_only(type, value) + self.write(''.join(lines)) + else: + # If someone has set sys.excepthook, we let that take precedence + # over self.write + sys.excepthook(type, value, tb) + + def showtraceback(self): + """Display the exception that just occurred. + + We remove the first stack item because it is our own code. + + The output is written by self.write(), below. + + """ + sys.last_type, sys.last_value, last_tb = ei = sys.exc_info() + sys.last_traceback = last_tb + try: + lines = traceback.format_exception(ei[0], ei[1], last_tb.tb_next) + if sys.excepthook is sys.__excepthook__: + self.write(''.join(lines)) + else: + # If someone has set sys.excepthook, we let that take precedence + # over self.write + sys.excepthook(ei[0], ei[1], last_tb) + finally: + last_tb = ei = None + + def write(self, data): + """Write a string. + + The base implementation writes to sys.stderr; a subclass may + replace this with a different implementation. + + """ + sys.stderr.write(data) + + +class InteractiveConsole(InteractiveInterpreter): + """Closely emulate the behavior of the interactive Python interpreter. + + This class builds on InteractiveInterpreter and adds prompting + using the familiar sys.ps1 and sys.ps2, and input buffering. + + """ + + def __init__(self, locals=None, filename=""): + """Constructor. + + The optional locals argument will be passed to the + InteractiveInterpreter base class. + + The optional filename argument should specify the (file)name + of the input stream; it will show up in tracebacks. + + """ + InteractiveInterpreter.__init__(self, locals) + self.filename = filename + self.resetbuffer() + + def resetbuffer(self): + """Reset the input buffer.""" + self.buffer = [] + + def interact(self, banner=None, exitmsg=None): + """Closely emulate the interactive Python console. + + The optional banner argument specifies the banner to print + before the first interaction; by default it prints a banner + similar to the one printed by the real Python interpreter, + followed by the current class name in parentheses (so as not + to confuse this with the real interpreter -- since it's so + close!). + + The optional exitmsg argument specifies the exit message + printed when exiting. Pass the empty string to suppress + printing an exit message. If exitmsg is not given or None, + a default message is printed. + + """ + try: + sys.ps1 + except AttributeError: + sys.ps1 = ">>> " + try: + sys.ps2 + except AttributeError: + sys.ps2 = "... " + cprt = 'Type "help", "copyright", "credits" or "license" for more information.' + if banner is None: + self.write("Python %s on %s\n%s\n(%s)\n" % + (sys.version, sys.platform, cprt, + self.__class__.__name__)) + elif banner: + self.write("%s\n" % str(banner)) + more = 0 + while 1: + try: + if more: + prompt = sys.ps2 + else: + prompt = sys.ps1 + try: + line = self.raw_input(prompt) + except EOFError: + self.write("\n") + break + else: + more = self.push(line) + except KeyboardInterrupt: + self.write("\nKeyboardInterrupt\n") + self.resetbuffer() + more = 0 + if exitmsg is None: + self.write('now exiting %s...\n' % self.__class__.__name__) + elif exitmsg != '': + self.write('%s\n' % exitmsg) + + def push(self, line): + """Push a line to the interpreter. + + The line should not have a trailing newline; it may have + internal newlines. The line is appended to a buffer and the + interpreter's runsource() method is called with the + concatenated contents of the buffer as source. If this + indicates that the command was executed or invalid, the buffer + is reset; otherwise, the command is incomplete, and the buffer + is left as it was after the line was appended. The return + value is 1 if more input is required, 0 if the line was dealt + with in some way (this is the same as runsource()). + + """ + self.buffer.append(line) + source = "\n".join(self.buffer) + more = self.runsource(source, self.filename) + if not more: + self.resetbuffer() + return more + + def raw_input(self, prompt=""): + """Write a prompt and read a line. + + The returned line does not include the trailing newline. + When the user enters the EOF key sequence, EOFError is raised. + + The base implementation uses the built-in function + input(); a subclass may replace this with a different + implementation. + + """ + return input(prompt) + + +def interact(banner=None, readfunc=None, local=None, exitmsg=None): + """Closely emulate the interactive Python interpreter. + + This is a backwards compatible interface to the InteractiveConsole + class. When readfunc is not specified, it attempts to import the + readline module to enable GNU readline if it is available. + + Arguments (all optional, all default to None): + + banner -- passed to InteractiveConsole.interact() + readfunc -- if not None, replaces InteractiveConsole.raw_input() + local -- passed to InteractiveInterpreter.__init__() + exitmsg -- passed to InteractiveConsole.interact() + + """ + console = InteractiveConsole(local) + if readfunc is not None: + console.raw_input = readfunc + else: + try: + import readline + except ImportError: + pass + console.interact(banner, exitmsg) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument('-q', action='store_true', + help="don't print version and copyright messages") + args = parser.parse_args() + if args.q or sys.flags.quiet: + banner = '' + else: + banner = None + interact(banner) diff --git a/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/codecs.py b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/codecs.py new file mode 100644 index 0000000..6e23268 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/codecs.py @@ -0,0 +1,1112 @@ +""" codecs -- Python Codec Registry, API and helpers. + + +Written by Marc-Andre Lemburg (mal@lemburg.com). + +(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. + +""" # " + +import builtins +import sys + +# Registry and builtin stateless codec functions + +try: + from _codecs import * +except ImportError as why: + raise SystemError('Failed to load the builtin codecs: %s' % why) + +__all__ = ["register", "lookup", "open", "EncodedFile", "BOM", "BOM_BE", + "BOM_LE", "BOM32_BE", "BOM32_LE", "BOM64_BE", "BOM64_LE", + "BOM_UTF8", "BOM_UTF16", "BOM_UTF16_LE", "BOM_UTF16_BE", + "BOM_UTF32", "BOM_UTF32_LE", "BOM_UTF32_BE", + "CodecInfo", "Codec", "IncrementalEncoder", "IncrementalDecoder", + "StreamReader", "StreamWriter", + "StreamReaderWriter", "StreamRecoder", + "getencoder", "getdecoder", "getincrementalencoder", + "getincrementaldecoder", "getreader", "getwriter", + "encode", "decode", "iterencode", "iterdecode", + "strict_errors", "ignore_errors", "replace_errors", + "xmlcharrefreplace_errors", + "backslashreplace_errors", "namereplace_errors", + "register_error", "lookup_error"] + +# Constants + +# +# Byte Order Mark (BOM = ZERO WIDTH NO-BREAK SPACE = U+FEFF) +# and its possible byte string values +# for UTF8/UTF16/UTF32 output and little/big endian machines +# + +# UTF-8 +BOM_UTF8 = b'\xef\xbb\xbf' + +# UTF-16, little endian +BOM_LE = BOM_UTF16_LE = b'\xff\xfe' + +# UTF-16, big endian +BOM_BE = BOM_UTF16_BE = b'\xfe\xff' + +# UTF-32, little endian +BOM_UTF32_LE = b'\xff\xfe\x00\x00' + +# UTF-32, big endian +BOM_UTF32_BE = b'\x00\x00\xfe\xff' + +if sys.byteorder == 'little': + + # UTF-16, native endianness + BOM = BOM_UTF16 = BOM_UTF16_LE + + # UTF-32, native endianness + BOM_UTF32 = BOM_UTF32_LE + +else: + + # UTF-16, native endianness + BOM = BOM_UTF16 = BOM_UTF16_BE + + # UTF-32, native endianness + BOM_UTF32 = BOM_UTF32_BE + +# Old broken names (don't use in new code) +BOM32_LE = BOM_UTF16_LE +BOM32_BE = BOM_UTF16_BE +BOM64_LE = BOM_UTF32_LE +BOM64_BE = BOM_UTF32_BE + + +# Codec base classes (defining the API) + +class CodecInfo(tuple): + """Codec details when looking up the codec registry""" + + # Private API to allow Python 3.4 to blacklist the known non-Unicode + # codecs in the standard library. A more general mechanism to + # reliably distinguish test encodings from other codecs will hopefully + # be defined for Python 3.5 + # + # See http://bugs.python.org/issue19619 + _is_text_encoding = True # Assume codecs are text encodings by default + + def __new__(cls, encode, decode, streamreader=None, streamwriter=None, + incrementalencoder=None, incrementaldecoder=None, name=None, + *, _is_text_encoding=None): + self = tuple.__new__(cls, (encode, decode, streamreader, streamwriter)) + self.name = name + self.encode = encode + self.decode = decode + self.incrementalencoder = incrementalencoder + self.incrementaldecoder = incrementaldecoder + self.streamwriter = streamwriter + self.streamreader = streamreader + if _is_text_encoding is not None: + self._is_text_encoding = _is_text_encoding + return self + + def __repr__(self): + return "<%s.%s object for encoding %s at %#x>" % \ + (self.__class__.__module__, self.__class__.__qualname__, + self.name, id(self)) + + +class Codec: + + """ Defines the interface for stateless encoders/decoders. + + The .encode()/.decode() methods may use different error + handling schemes by providing the errors argument. These + string values are predefined: + + 'strict' - raise a ValueError error (or a subclass) + 'ignore' - ignore the character and continue with the next + 'replace' - replace with a suitable replacement character; + Python will use the official U+FFFD REPLACEMENT + CHARACTER for the builtin Unicode codecs on + decoding and '?' on encoding. + 'surrogateescape' - replace with private code points U+DCnn. + 'xmlcharrefreplace' - Replace with the appropriate XML + character reference (only for encoding). + 'backslashreplace' - Replace with backslashed escape sequences. + 'namereplace' - Replace with \\N{...} escape sequences + (only for encoding). + + The set of allowed values can be extended via register_error. + + """ + + def encode(self, input, errors='strict'): + """ Encodes the object input and returns a tuple (output + object, length consumed). + + errors defines the error handling to apply. It defaults to + 'strict' handling. + + The method may not store state in the Codec instance. Use + StreamWriter for codecs which have to keep state in order to + make encoding efficient. + + The encoder must be able to handle zero length input and + return an empty object of the output object type in this + situation. + + """ + raise NotImplementedError + + def decode(self, input, errors='strict'): + """ Decodes the object input and returns a tuple (output + object, length consumed). + + input must be an object which provides the bf_getreadbuf + buffer slot. Python strings, buffer objects and memory + mapped files are examples of objects providing this slot. + + errors defines the error handling to apply. It defaults to + 'strict' handling. + + The method may not store state in the Codec instance. Use + StreamReader for codecs which have to keep state in order to + make decoding efficient. + + The decoder must be able to handle zero length input and + return an empty object of the output object type in this + situation. + + """ + raise NotImplementedError + + +class IncrementalEncoder(object): + """ + An IncrementalEncoder encodes an input in multiple steps. The input can + be passed piece by piece to the encode() method. The IncrementalEncoder + remembers the state of the encoding process between calls to encode(). + """ + + def __init__(self, errors='strict'): + """ + Creates an IncrementalEncoder instance. + + The IncrementalEncoder may use different error handling schemes by + providing the errors keyword argument. See the module docstring + for a list of possible values. + """ + self.errors = errors + self.buffer = "" + + def encode(self, input, final=False): + """ + Encodes input and returns the resulting object. + """ + raise NotImplementedError + + def reset(self): + """ + Resets the encoder to the initial state. + """ + + def getstate(self): + """ + Return the current state of the encoder. + """ + return 0 + + def setstate(self, state): + """ + Set the current state of the encoder. state must have been + returned by getstate(). + """ + + +class BufferedIncrementalEncoder(IncrementalEncoder): + """ + This subclass of IncrementalEncoder can be used as the baseclass for an + incremental encoder if the encoder must keep some of the output in a + buffer between calls to encode(). + """ + + def __init__(self, errors='strict'): + IncrementalEncoder.__init__(self, errors) + # unencoded input that is kept between calls to encode() + self.buffer = "" + + def _buffer_encode(self, input, errors, final): + # Overwrite this method in subclasses: It must encode input + # and return an (output, length consumed) tuple + raise NotImplementedError + + def encode(self, input, final=False): + # encode input (taking the buffer into account) + data = self.buffer + input + (result, consumed) = self._buffer_encode(data, self.errors, final) + # keep unencoded input until the next call + self.buffer = data[consumed:] + return result + + def reset(self): + IncrementalEncoder.reset(self) + self.buffer = "" + + def getstate(self): + return self.buffer or 0 + + def setstate(self, state): + self.buffer = state or "" + + +class IncrementalDecoder(object): + """ + An IncrementalDecoder decodes an input in multiple steps. The input can + be passed piece by piece to the decode() method. The IncrementalDecoder + remembers the state of the decoding process between calls to decode(). + """ + + def __init__(self, errors='strict'): + """ + Create an IncrementalDecoder instance. + + The IncrementalDecoder may use different error handling schemes by + providing the errors keyword argument. See the module docstring + for a list of possible values. + """ + self.errors = errors + + def decode(self, input, final=False): + """ + Decode input and returns the resulting object. + """ + raise NotImplementedError + + def reset(self): + """ + Reset the decoder to the initial state. + """ + + def getstate(self): + """ + Return the current state of the decoder. + + This must be a (buffered_input, additional_state_info) tuple. + buffered_input must be a bytes object containing bytes that + were passed to decode() that have not yet been converted. + additional_state_info must be a non-negative integer + representing the state of the decoder WITHOUT yet having + processed the contents of buffered_input. In the initial state + and after reset(), getstate() must return (b"", 0). + """ + return (b"", 0) + + def setstate(self, state): + """ + Set the current state of the decoder. + + state must have been returned by getstate(). The effect of + setstate((b"", 0)) must be equivalent to reset(). + """ + + +class BufferedIncrementalDecoder(IncrementalDecoder): + """ + This subclass of IncrementalDecoder can be used as the baseclass for an + incremental decoder if the decoder must be able to handle incomplete + byte sequences. + """ + + def __init__(self, errors='strict'): + IncrementalDecoder.__init__(self, errors) + # undecoded input that is kept between calls to decode() + self.buffer = b"" + + def _buffer_decode(self, input, errors, final): + # Overwrite this method in subclasses: It must decode input + # and return an (output, length consumed) tuple + raise NotImplementedError + + def decode(self, input, final=False): + # decode input (taking the buffer into account) + data = self.buffer + input + (result, consumed) = self._buffer_decode(data, self.errors, final) + # keep undecoded input until the next call + self.buffer = data[consumed:] + return result + + def reset(self): + IncrementalDecoder.reset(self) + self.buffer = b"" + + def getstate(self): + # additional state info is always 0 + return (self.buffer, 0) + + def setstate(self, state): + # ignore additional state info + self.buffer = state[0] + +# +# The StreamWriter and StreamReader class provide generic working +# interfaces which can be used to implement new encoding submodules +# very easily. See encodings/utf_8.py for an example on how this is +# done. +# + + +class StreamWriter(Codec): + + def __init__(self, stream, errors='strict'): + """ Creates a StreamWriter instance. + + stream must be a file-like object open for writing. + + The StreamWriter may use different error handling + schemes by providing the errors keyword argument. These + parameters are predefined: + + 'strict' - raise a ValueError (or a subclass) + 'ignore' - ignore the character and continue with the next + 'replace'- replace with a suitable replacement character + 'xmlcharrefreplace' - Replace with the appropriate XML + character reference. + 'backslashreplace' - Replace with backslashed escape + sequences. + 'namereplace' - Replace with \\N{...} escape sequences. + + The set of allowed parameter values can be extended via + register_error. + """ + self.stream = stream + self.errors = errors + + def write(self, object): + """ Writes the object's contents encoded to self.stream. + """ + data, consumed = self.encode(object, self.errors) + self.stream.write(data) + + def writelines(self, list): + """ Writes the concatenated list of strings to the stream + using .write(). + """ + self.write(''.join(list)) + + def reset(self): + """ Flushes and resets the codec buffers used for keeping state. + + Calling this method should ensure that the data on the + output is put into a clean state, that allows appending + of new fresh data without having to rescan the whole + stream to recover state. + + """ + pass + + def seek(self, offset, whence=0): + self.stream.seek(offset, whence) + if whence == 0 and offset == 0: + self.reset() + + def __getattr__(self, name, + getattr=getattr): + """ Inherit all other methods from the underlying stream. + """ + return getattr(self.stream, name) + + def __enter__(self): + return self + + def __exit__(self, type, value, tb): + self.stream.close() + +### + + +class StreamReader(Codec): + + charbuffertype = str + + def __init__(self, stream, errors='strict'): + """ Creates a StreamReader instance. + + stream must be a file-like object open for reading. + + The StreamReader may use different error handling + schemes by providing the errors keyword argument. These + parameters are predefined: + + 'strict' - raise a ValueError (or a subclass) + 'ignore' - ignore the character and continue with the next + 'replace'- replace with a suitable replacement character + 'backslashreplace' - Replace with backslashed escape sequences; + + The set of allowed parameter values can be extended via + register_error. + """ + self.stream = stream + self.errors = errors + self.bytebuffer = b"" + self._empty_charbuffer = self.charbuffertype() + self.charbuffer = self._empty_charbuffer + self.linebuffer = None + + def decode(self, input, errors='strict'): + raise NotImplementedError + + def read(self, size=-1, chars=-1, firstline=False): + """ Decodes data from the stream self.stream and returns the + resulting object. + + chars indicates the number of decoded code points or bytes to + return. read() will never return more data than requested, + but it might return less, if there is not enough available. + + size indicates the approximate maximum number of decoded + bytes or code points to read for decoding. The decoder + can modify this setting as appropriate. The default value + -1 indicates to read and decode as much as possible. size + is intended to prevent having to decode huge files in one + step. + + If firstline is true, and a UnicodeDecodeError happens + after the first line terminator in the input only the first line + will be returned, the rest of the input will be kept until the + next call to read(). + + The method should use a greedy read strategy, meaning that + it should read as much data as is allowed within the + definition of the encoding and the given size, e.g. if + optional encoding endings or state markers are available + on the stream, these should be read too. + """ + # If we have lines cached, first merge them back into characters + if self.linebuffer: + self.charbuffer = self._empty_charbuffer.join(self.linebuffer) + self.linebuffer = None + + if chars < 0: + # For compatibility with other read() methods that take a + # single argument + chars = size + + # read until we get the required number of characters (if available) + while True: + # can the request be satisfied from the character buffer? + if chars >= 0: + if len(self.charbuffer) >= chars: + break + # we need more data + if size < 0: + newdata = self.stream.read() + else: + newdata = self.stream.read(size) + # decode bytes (those remaining from the last call included) + data = self.bytebuffer + newdata + if not data: + break + try: + newchars, decodedbytes = self.decode(data, self.errors) + except UnicodeDecodeError as exc: + if firstline: + newchars, decodedbytes = \ + self.decode(data[:exc.start], self.errors) + lines = newchars.splitlines(keepends=True) + if len(lines) <= 1: + raise + else: + raise + # keep undecoded bytes until the next call + self.bytebuffer = data[decodedbytes:] + # put new characters in the character buffer + self.charbuffer += newchars + # there was no data available + if not newdata: + break + if chars < 0: + # Return everything we've got + result = self.charbuffer + self.charbuffer = self._empty_charbuffer + else: + # Return the first chars characters + result = self.charbuffer[:chars] + self.charbuffer = self.charbuffer[chars:] + return result + + def readline(self, size=None, keepends=True): + """ Read one line from the input stream and return the + decoded data. + + size, if given, is passed as size argument to the + read() method. + + """ + # If we have lines cached from an earlier read, return + # them unconditionally + if self.linebuffer: + line = self.linebuffer[0] + del self.linebuffer[0] + if len(self.linebuffer) == 1: + # revert to charbuffer mode; we might need more data + # next time + self.charbuffer = self.linebuffer[0] + self.linebuffer = None + if not keepends: + line = line.splitlines(keepends=False)[0] + return line + + readsize = size or 72 + line = self._empty_charbuffer + # If size is given, we call read() only once + while True: + data = self.read(readsize, firstline=True) + if data: + # If we're at a "\r" read one extra character (which might + # be a "\n") to get a proper line ending. If the stream is + # temporarily exhausted we return the wrong line ending. + if (isinstance(data, str) and data.endswith("\r")) or \ + (isinstance(data, bytes) and data.endswith(b"\r")): + data += self.read(size=1, chars=1) + + line += data + lines = line.splitlines(keepends=True) + if lines: + if len(lines) > 1: + # More than one line result; the first line is a full line + # to return + line = lines[0] + del lines[0] + if len(lines) > 1: + # cache the remaining lines + lines[-1] += self.charbuffer + self.linebuffer = lines + self.charbuffer = None + else: + # only one remaining line, put it back into charbuffer + self.charbuffer = lines[0] + self.charbuffer + if not keepends: + line = line.splitlines(keepends=False)[0] + break + line0withend = lines[0] + line0withoutend = lines[0].splitlines(keepends=False)[0] + if line0withend != line0withoutend: # We really have a line end + # Put the rest back together and keep it until the next call + self.charbuffer = self._empty_charbuffer.join(lines[1:]) + \ + self.charbuffer + if keepends: + line = line0withend + else: + line = line0withoutend + break + # we didn't get anything or this was our only try + if not data or size is not None: + if line and not keepends: + line = line.splitlines(keepends=False)[0] + break + if readsize < 8000: + readsize *= 2 + return line + + def readlines(self, sizehint=None, keepends=True): + """ Read all lines available on the input stream + and return them as a list. + + Line breaks are implemented using the codec's decoder + method and are included in the list entries. + + sizehint, if given, is ignored since there is no efficient + way to finding the true end-of-line. + + """ + data = self.read() + return data.splitlines(keepends) + + def reset(self): + """ Resets the codec buffers used for keeping state. + + Note that no stream repositioning should take place. + This method is primarily intended to be able to recover + from decoding errors. + + """ + self.bytebuffer = b"" + self.charbuffer = self._empty_charbuffer + self.linebuffer = None + + def seek(self, offset, whence=0): + """ Set the input stream's current position. + + Resets the codec buffers used for keeping state. + """ + self.stream.seek(offset, whence) + self.reset() + + def __next__(self): + """ Return the next decoded line from the input stream.""" + line = self.readline() + if line: + return line + raise StopIteration + + def __iter__(self): + return self + + def __getattr__(self, name, + getattr=getattr): + """ Inherit all other methods from the underlying stream. + """ + return getattr(self.stream, name) + + def __enter__(self): + return self + + def __exit__(self, type, value, tb): + self.stream.close() + +### + + +class StreamReaderWriter: + + """ StreamReaderWriter instances allow wrapping streams which + work in both read and write modes. + + The design is such that one can use the factory functions + returned by the codec.lookup() function to construct the + instance. + + """ + # Optional attributes set by the file wrappers below + encoding = 'unknown' + + def __init__(self, stream, Reader, Writer, errors='strict'): + """ Creates a StreamReaderWriter instance. + + stream must be a Stream-like object. + + Reader, Writer must be factory functions or classes + providing the StreamReader, StreamWriter interface resp. + + Error handling is done in the same way as defined for the + StreamWriter/Readers. + + """ + self.stream = stream + self.reader = Reader(stream, errors) + self.writer = Writer(stream, errors) + self.errors = errors + + def read(self, size=-1): + + return self.reader.read(size) + + def readline(self, size=None): + + return self.reader.readline(size) + + def readlines(self, sizehint=None): + + return self.reader.readlines(sizehint) + + def __next__(self): + """ Return the next decoded line from the input stream.""" + return next(self.reader) + + def __iter__(self): + return self + + def write(self, data): + + return self.writer.write(data) + + def writelines(self, list): + + return self.writer.writelines(list) + + def reset(self): + + self.reader.reset() + self.writer.reset() + + def seek(self, offset, whence=0): + self.stream.seek(offset, whence) + self.reader.reset() + if whence == 0 and offset == 0: + self.writer.reset() + + def __getattr__(self, name, + getattr=getattr): + """ Inherit all other methods from the underlying stream. + """ + return getattr(self.stream, name) + + # these are needed to make "with codecs.open(...)" work properly + + def __enter__(self): + return self + + def __exit__(self, type, value, tb): + self.stream.close() + +### + + +class StreamRecoder: + + """ StreamRecoder instances translate data from one encoding to another. + + They use the complete set of APIs returned by the + codecs.lookup() function to implement their task. + + Data written to the StreamRecoder is first decoded into an + intermediate format (depending on the "decode" codec) and then + written to the underlying stream using an instance of the provided + Writer class. + + In the other direction, data is read from the underlying stream using + a Reader instance and then encoded and returned to the caller. + + """ + # Optional attributes set by the file wrappers below + data_encoding = 'unknown' + file_encoding = 'unknown' + + def __init__(self, stream, encode, decode, Reader, Writer, + errors='strict'): + """ Creates a StreamRecoder instance which implements a two-way + conversion: encode and decode work on the frontend (the + data visible to .read() and .write()) while Reader and Writer + work on the backend (the data in stream). + + You can use these objects to do transparent + transcodings from e.g. latin-1 to utf-8 and back. + + stream must be a file-like object. + + encode and decode must adhere to the Codec interface; Reader and + Writer must be factory functions or classes providing the + StreamReader and StreamWriter interfaces resp. + + Error handling is done in the same way as defined for the + StreamWriter/Readers. + + """ + self.stream = stream + self.encode = encode + self.decode = decode + self.reader = Reader(stream, errors) + self.writer = Writer(stream, errors) + self.errors = errors + + def read(self, size=-1): + + data = self.reader.read(size) + data, bytesencoded = self.encode(data, self.errors) + return data + + def readline(self, size=None): + + if size is None: + data = self.reader.readline() + else: + data = self.reader.readline(size) + data, bytesencoded = self.encode(data, self.errors) + return data + + def readlines(self, sizehint=None): + + data = self.reader.read() + data, bytesencoded = self.encode(data, self.errors) + return data.splitlines(keepends=True) + + def __next__(self): + """ Return the next decoded line from the input stream.""" + data = next(self.reader) + data, bytesencoded = self.encode(data, self.errors) + return data + + def __iter__(self): + return self + + def write(self, data): + + data, bytesdecoded = self.decode(data, self.errors) + return self.writer.write(data) + + def writelines(self, list): + + data = ''.join(list) + data, bytesdecoded = self.decode(data, self.errors) + return self.writer.write(data) + + def reset(self): + + self.reader.reset() + self.writer.reset() + + def __getattr__(self, name, + getattr=getattr): + """ Inherit all other methods from the underlying stream. + """ + return getattr(self.stream, name) + + def __enter__(self): + return self + + def __exit__(self, type, value, tb): + self.stream.close() + +# Shortcuts + + +def open(filename, mode='r', encoding=None, errors='strict', buffering=1): + """ Open an encoded file using the given mode and return + a wrapped version providing transparent encoding/decoding. + + Note: The wrapped version will only accept the object format + defined by the codecs, i.e. Unicode objects for most builtin + codecs. Output is also codec dependent and will usually be + Unicode as well. + + Underlying encoded files are always opened in binary mode. + The default file mode is 'r', meaning to open the file in read mode. + + encoding specifies the encoding which is to be used for the + file. + + errors may be given to define the error handling. It defaults + to 'strict' which causes ValueErrors to be raised in case an + encoding error occurs. + + buffering has the same meaning as for the builtin open() API. + It defaults to line buffered. + + The returned wrapped file object provides an extra attribute + .encoding which allows querying the used encoding. This + attribute is only available if an encoding was specified as + parameter. + + """ + if encoding is not None and \ + 'b' not in mode: + # Force opening of the file in binary mode + mode = mode + 'b' + file = builtins.open(filename, mode, buffering) + if encoding is None: + return file + info = lookup(encoding) + srw = StreamReaderWriter(file, info.streamreader, + info.streamwriter, errors) + # Add attributes to simplify introspection + srw.encoding = encoding + return srw + + +def EncodedFile(file, data_encoding, file_encoding=None, errors='strict'): + """ Return a wrapped version of file which provides transparent + encoding translation. + + Data written to the wrapped file is decoded according + to the given data_encoding and then encoded to the underlying + file using file_encoding. The intermediate data type + will usually be Unicode but depends on the specified codecs. + + Bytes read from the file are decoded using file_encoding and then + passed back to the caller encoded using data_encoding. + + If file_encoding is not given, it defaults to data_encoding. + + errors may be given to define the error handling. It defaults + to 'strict' which causes ValueErrors to be raised in case an + encoding error occurs. + + The returned wrapped file object provides two extra attributes + .data_encoding and .file_encoding which reflect the given + parameters of the same name. The attributes can be used for + introspection by Python programs. + + """ + if file_encoding is None: + file_encoding = data_encoding + data_info = lookup(data_encoding) + file_info = lookup(file_encoding) + sr = StreamRecoder(file, data_info.encode, data_info.decode, + file_info.streamreader, file_info.streamwriter, errors) + # Add attributes to simplify introspection + sr.data_encoding = data_encoding + sr.file_encoding = file_encoding + return sr + +# Helpers for codec lookup + + +def getencoder(encoding): + """ Lookup up the codec for the given encoding and return + its encoder function. + + Raises a LookupError in case the encoding cannot be found. + + """ + return lookup(encoding).encode + + +def getdecoder(encoding): + """ Lookup up the codec for the given encoding and return + its decoder function. + + Raises a LookupError in case the encoding cannot be found. + + """ + return lookup(encoding).decode + + +def getincrementalencoder(encoding): + """ Lookup up the codec for the given encoding and return + its IncrementalEncoder class or factory function. + + Raises a LookupError in case the encoding cannot be found + or the codecs doesn't provide an incremental encoder. + + """ + encoder = lookup(encoding).incrementalencoder + if encoder is None: + raise LookupError(encoding) + return encoder + + +def getincrementaldecoder(encoding): + """ Lookup up the codec for the given encoding and return + its IncrementalDecoder class or factory function. + + Raises a LookupError in case the encoding cannot be found + or the codecs doesn't provide an incremental decoder. + + """ + decoder = lookup(encoding).incrementaldecoder + if decoder is None: + raise LookupError(encoding) + return decoder + + +def getreader(encoding): + """ Lookup up the codec for the given encoding and return + its StreamReader class or factory function. + + Raises a LookupError in case the encoding cannot be found. + + """ + return lookup(encoding).streamreader + + +def getwriter(encoding): + """ Lookup up the codec for the given encoding and return + its StreamWriter class or factory function. + + Raises a LookupError in case the encoding cannot be found. + + """ + return lookup(encoding).streamwriter + + +def iterencode(iterator, encoding, errors='strict', **kwargs): + """ + Encoding iterator. + + Encodes the input strings from the iterator using an IncrementalEncoder. + + errors and kwargs are passed through to the IncrementalEncoder + constructor. + """ + encoder = getincrementalencoder(encoding)(errors, **kwargs) + for input in iterator: + output = encoder.encode(input) + if output: + yield output + output = encoder.encode("", True) + if output: + yield output + + +def iterdecode(iterator, encoding, errors='strict', **kwargs): + """ + Decoding iterator. + + Decodes the input strings from the iterator using an IncrementalDecoder. + + errors and kwargs are passed through to the IncrementalDecoder + constructor. + """ + decoder = getincrementaldecoder(encoding)(errors, **kwargs) + for input in iterator: + output = decoder.decode(input) + if output: + yield output + output = decoder.decode(b"", True) + if output: + yield output + +# Helpers for charmap-based codecs + + +def make_identity_dict(rng): + """ make_identity_dict(rng) -> dict + + Return a dictionary where elements of the rng sequence are + mapped to themselves. + + """ + return {i: i for i in rng} + + +def make_encoding_map(decoding_map): + """ Creates an encoding map from a decoding map. + + If a target mapping in the decoding map occurs multiple + times, then that target is mapped to None (undefined mapping), + causing an exception when encountered by the charmap codec + during translation. + + One example where this happens is cp875.py which decodes + multiple character to \\u001a. + + """ + m = {} + for k, v in decoding_map.items(): + if not v in m: + m[v] = k + else: + m[v] = None + return m + +# error handlers + + +try: + strict_errors = lookup_error("strict") + ignore_errors = lookup_error("ignore") + replace_errors = lookup_error("replace") + xmlcharrefreplace_errors = lookup_error("xmlcharrefreplace") + backslashreplace_errors = lookup_error("backslashreplace") + namereplace_errors = lookup_error("namereplace") +except LookupError: + # In --disable-unicode builds, these error handler are missing + strict_errors = None + ignore_errors = None + replace_errors = None + xmlcharrefreplace_errors = None + backslashreplace_errors = None + namereplace_errors = None + +# Tell modulefinder that using codecs probably needs the encodings +# package +_false = 0 +if _false: + import encodings + +# Tests + +if __name__ == '__main__': + + # Make stdout translate Latin-1 output into UTF-8 output + sys.stdout = EncodedFile(sys.stdout, 'latin-1', 'utf-8') + + # Have stdin translate Latin-1 input into UTF-8 input + sys.stdin = EncodedFile(sys.stdin, 'utf-8', 'latin-1') diff --git a/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/codeop.py b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/codeop.py new file mode 100644 index 0000000..75c70a0 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/codeop.py @@ -0,0 +1,174 @@ +r"""Utilities to compile possibly incomplete Python source code. + +This module provides two interfaces, broadly similar to the builtin +function compile(), which take program text, a filename and a 'mode' +and: + +- Return code object if the command is complete and valid +- Return None if the command is incomplete +- Raise SyntaxError, ValueError or OverflowError if the command is a + syntax error (OverflowError and ValueError can be produced by + malformed literals). + +Approach: + +First, check if the source consists entirely of blank lines and +comments; if so, replace it with 'pass', because the built-in +parser doesn't always do the right thing for these. + +Compile three times: as is, with \n, and with \n\n appended. If it +compiles as is, it's complete. If it compiles with one \n appended, +we expect more. If it doesn't compile either way, we compare the +error we get when compiling with \n or \n\n appended. If the errors +are the same, the code is broken. But if the errors are different, we +expect more. Not intuitive; not even guaranteed to hold in future +releases; but this matches the compiler's behavior from Python 1.4 +through 2.2, at least. + +Caveat: + +It is possible (but not likely) that the parser stops parsing with a +successful outcome before reaching the end of the source; in this +case, trailing symbols may be ignored instead of causing an error. +For example, a backslash followed by two newlines may be followed by +arbitrary garbage. This will be fixed once the API for the parser is +better. + +The two interfaces are: + +compile_command(source, filename, symbol): + + Compiles a single command in the manner described above. + +CommandCompiler(): + + Instances of this class have __call__ methods identical in + signature to compile_command; the difference is that if the + instance compiles program text containing a __future__ statement, + the instance 'remembers' and compiles all subsequent program texts + with the statement in force. + +The module also provides another class: + +Compile(): + + Instances of this class act like the built-in function compile, + but with 'memory' in the sense described above. +""" + +import __future__ + +_features = [getattr(__future__, fname) + for fname in __future__.all_feature_names] + +__all__ = ["compile_command", "Compile", "CommandCompiler"] + +PyCF_DONT_IMPLY_DEDENT = 0x200 # Matches pythonrun.h + + +def _maybe_compile(compiler, source, filename, symbol): + # Check for source consisting of only blank lines and comments + for line in source.split("\n"): + line = line.strip() + if line and line[0] != '#': + break # Leave it alone + else: + if symbol != "eval": + source = "pass" # Replace it with a 'pass' statement + + err = err1 = err2 = None + code = code1 = code2 = None + + try: + code = compiler(source, filename, symbol) + except SyntaxError as err: + pass + + try: + code1 = compiler(source + "\n", filename, symbol) + except SyntaxError as e: + err1 = e + + try: + code2 = compiler(source + "\n\n", filename, symbol) + except SyntaxError as e: + err2 = e + + if code: + return code + if not code1 and repr(err1) == repr(err2): + raise err1 + + +def _compile(source, filename, symbol): + return compile(source, filename, symbol, PyCF_DONT_IMPLY_DEDENT) + + +def compile_command(source, filename="", symbol="single"): + r"""Compile a command and determine whether it is incomplete. + + Arguments: + + source -- the source string; may contain \n characters + filename -- optional filename from which source was read; default + "" + symbol -- optional grammar start symbol; "single" (default) or "eval" + + Return value / exceptions raised: + + - Return a code object if the command is complete and valid + - Return None if the command is incomplete + - Raise SyntaxError, ValueError or OverflowError if the command is a + syntax error (OverflowError and ValueError can be produced by + malformed literals). + """ + return _maybe_compile(_compile, source, filename, symbol) + + +class Compile: + """Instances of this class behave much like the built-in compile + function, but if one is used to compile text containing a future + statement, it "remembers" and compiles all subsequent program texts + with the statement in force.""" + + def __init__(self): + self.flags = PyCF_DONT_IMPLY_DEDENT + + def __call__(self, source, filename, symbol): + codeob = compile(source, filename, symbol, self.flags, 1) + for feature in _features: + if codeob.co_flags & feature.compiler_flag: + self.flags |= feature.compiler_flag + return codeob + + +class CommandCompiler: + """Instances of this class have __call__ methods identical in + signature to compile_command; the difference is that if the + instance compiles program text containing a __future__ statement, + the instance 'remembers' and compiles all subsequent program texts + with the statement in force.""" + + def __init__(self,): + self.compiler = Compile() + + def __call__(self, source, filename="", symbol="single"): + r"""Compile a command and determine whether it is incomplete. + + Arguments: + + source -- the source string; may contain \n characters + filename -- optional filename from which source was read; + default "" + symbol -- optional grammar start symbol; "single" (default) or + "eval" + + Return value / exceptions raised: + + - Return a code object if the command is complete and valid + - Return None if the command is incomplete + - Raise SyntaxError, ValueError or OverflowError if the command is a + syntax error (OverflowError and ValueError can be produced by + malformed literals). + """ + return _maybe_compile(self.compiler, source, filename, symbol) diff --git a/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/collections/__init__.py b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/collections/__init__.py new file mode 100644 index 0000000..4c05c24 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/collections/__init__.py @@ -0,0 +1,1353 @@ +'''This module implements specialized container datatypes providing +alternatives to Python's general purpose built-in containers, dict, +list, set, and tuple. + +* namedtuple factory function for creating tuple subclasses with named fields +* deque list-like container with fast appends and pops on either end +* ChainMap dict-like class for creating a single view of multiple mappings +* Counter dict subclass for counting hashable objects +* OrderedDict dict subclass that remembers the order entries were added +* defaultdict dict subclass that calls a factory function to supply missing values +* UserDict wrapper around dictionary objects for easier dict subclassing +* UserList wrapper around list objects for easier list subclassing +* UserString wrapper around string objects for easier string subclassing + +''' + +__all__ = ['deque', 'defaultdict', 'namedtuple', 'UserDict', 'UserList', + 'UserString', 'Counter', 'OrderedDict', 'ChainMap'] + +# For backwards compatibility, continue to make the collections ABCs +# available through the collections module. +from _collections_abc import * +import _collections_abc +__all__ += _collections_abc.__all__ + +from operator import itemgetter as _itemgetter, eq as _eq +from keyword import iskeyword as _iskeyword +import sys as _sys +import heapq as _heapq +from _weakref import proxy as _proxy +from itertools import repeat as _repeat, chain as _chain, starmap as _starmap +from reprlib import recursive_repr as _recursive_repr + +try: + from _collections import deque +except ImportError: + pass +else: + MutableSequence.register(deque) + +try: + from _collections import defaultdict +except ImportError: + pass + + +################################################################################ +# OrderedDict +################################################################################ + +class _OrderedDictKeysView(KeysView): + + def __reversed__(self): + yield from reversed(self._mapping) + + +class _OrderedDictItemsView(ItemsView): + + def __reversed__(self): + for key in reversed(self._mapping): + yield (key, self._mapping[key]) + + +class _OrderedDictValuesView(ValuesView): + + def __reversed__(self): + for key in reversed(self._mapping): + yield self._mapping[key] + + +class _Link(object): + __slots__ = 'prev', 'next', 'key', '__weakref__' + + +class OrderedDict(dict): + 'Dictionary that remembers insertion order' + # An inherited dict maps keys to values. + # The inherited dict provides __getitem__, __len__, __contains__, and get. + # The remaining methods are order-aware. + # Big-O running times for all methods are the same as regular dictionaries. + + # The internal self.__map dict maps keys to links in a doubly linked list. + # The circular doubly linked list starts and ends with a sentinel element. + # The sentinel element never gets deleted (this simplifies the algorithm). + # The sentinel is in self.__hardroot with a weakref proxy in self.__root. + # The prev links are weakref proxies (to prevent circular references). + # Individual links are kept alive by the hard reference in self.__map. + # Those hard references disappear when a key is deleted from an OrderedDict. + + def __init__(*args, **kwds): + '''Initialize an ordered dictionary. The signature is the same as + regular dictionaries. Keyword argument order is preserved. + ''' + if not args: + raise TypeError("descriptor '__init__' of 'OrderedDict' object " + "needs an argument") + self, *args = args + if len(args) > 1: + raise TypeError('expected at most 1 arguments, got %d' % len(args)) + try: + self.__root + except AttributeError: + self.__hardroot = _Link() + self.__root = root = _proxy(self.__hardroot) + root.prev = root.next = root + self.__map = {} + self.__update(*args, **kwds) + + def __setitem__(self, key, value, + dict_setitem=dict.__setitem__, proxy=_proxy, Link=_Link): + 'od.__setitem__(i, y) <==> od[i]=y' + # Setting a new item creates a new link at the end of the linked list, + # and the inherited dictionary is updated with the new key/value pair. + if key not in self: + self.__map[key] = link = Link() + root = self.__root + last = root.prev + link.prev, link.next, link.key = last, root, key + last.next = link + root.prev = proxy(link) + dict_setitem(self, key, value) + + def __delitem__(self, key, dict_delitem=dict.__delitem__): + 'od.__delitem__(y) <==> del od[y]' + # Deleting an existing item uses self.__map to find the link which gets + # removed by updating the links in the predecessor and successor nodes. + dict_delitem(self, key) + link = self.__map.pop(key) + link_prev = link.prev + link_next = link.next + link_prev.next = link_next + link_next.prev = link_prev + link.prev = None + link.next = None + + def __iter__(self): + 'od.__iter__() <==> iter(od)' + # Traverse the linked list in order. + root = self.__root + curr = root.next + while curr is not root: + yield curr.key + curr = curr.next + + def __reversed__(self): + 'od.__reversed__() <==> reversed(od)' + # Traverse the linked list in reverse order. + root = self.__root + curr = root.prev + while curr is not root: + yield curr.key + curr = curr.prev + + def clear(self): + 'od.clear() -> None. Remove all items from od.' + root = self.__root + root.prev = root.next = root + self.__map.clear() + dict.clear(self) + + def popitem(self, last=True): + '''Remove and return a (key, value) pair from the dictionary. + + Pairs are returned in LIFO order if last is true or FIFO order if false. + ''' + if not self: + raise KeyError('dictionary is empty') + root = self.__root + if last: + link = root.prev + link_prev = link.prev + link_prev.next = root + root.prev = link_prev + else: + link = root.next + link_next = link.next + root.next = link_next + link_next.prev = root + key = link.key + del self.__map[key] + value = dict.pop(self, key) + return key, value + + def move_to_end(self, key, last=True): + '''Move an existing element to the end (or beginning if last==False). + + Raises KeyError if the element does not exist. + When last=True, acts like a fast version of self[key]=self.pop(key). + + ''' + link = self.__map[key] + link_prev = link.prev + link_next = link.next + soft_link = link_next.prev + link_prev.next = link_next + link_next.prev = link_prev + root = self.__root + if last: + last = root.prev + link.prev = last + link.next = root + root.prev = soft_link + last.next = link + else: + first = root.next + link.prev = root + link.next = first + first.prev = soft_link + root.next = link + + def __sizeof__(self): + sizeof = _sys.getsizeof + # number of links including root + n = len(self) + 1 + size = sizeof(self.__dict__) # instance dictionary + # internal dict and inherited dict + size += sizeof(self.__map) * 2 + size += sizeof(self.__hardroot) * n # link objects + size += sizeof(self.__root) * n # proxy objects + return size + + update = __update = MutableMapping.update + + def keys(self): + "D.keys() -> a set-like object providing a view on D's keys" + return _OrderedDictKeysView(self) + + def items(self): + "D.items() -> a set-like object providing a view on D's items" + return _OrderedDictItemsView(self) + + def values(self): + "D.values() -> an object providing a view on D's values" + return _OrderedDictValuesView(self) + + __ne__ = MutableMapping.__ne__ + + __marker = object() + + def pop(self, key, default=__marker): + '''od.pop(k[,d]) -> v, remove specified key and return the corresponding + value. If key is not found, d is returned if given, otherwise KeyError + is raised. + + ''' + if key in self: + result = self[key] + del self[key] + return result + if default is self.__marker: + raise KeyError(key) + return default + + def setdefault(self, key, default=None): + 'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od' + if key in self: + return self[key] + self[key] = default + return default + + @_recursive_repr() + def __repr__(self): + 'od.__repr__() <==> repr(od)' + if not self: + return '%s()' % (self.__class__.__name__,) + return '%s(%r)' % (self.__class__.__name__, list(self.items())) + + def __reduce__(self): + 'Return state information for pickling' + inst_dict = vars(self).copy() + for k in vars(OrderedDict()): + inst_dict.pop(k, None) + return self.__class__, (), inst_dict or None, None, iter(self.items()) + + def copy(self): + 'od.copy() -> a shallow copy of od' + return self.__class__(self) + + @classmethod + def fromkeys(cls, iterable, value=None): + '''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S. + If not specified, the value defaults to None. + + ''' + self = cls() + for key in iterable: + self[key] = value + return self + + def __eq__(self, other): + '''od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive + while comparison to a regular mapping is order-insensitive. + + ''' + if isinstance(other, OrderedDict): + return dict.__eq__(self, other) and all(map(_eq, self, other)) + return dict.__eq__(self, other) + + +try: + from _collections import OrderedDict +except ImportError: + # Leave the pure Python version in place. + pass + + +################################################################################ +# namedtuple +################################################################################ + +_class_template = """\ +from builtins import property as _property, tuple as _tuple +from operator import itemgetter as _itemgetter +from collections import OrderedDict + +class {typename}(tuple): + '{typename}({arg_list})' + + __slots__ = () + + _fields = {field_names!r} + + def __new__(_cls, {arg_list}): + 'Create new instance of {typename}({arg_list})' + return _tuple.__new__(_cls, ({arg_list})) + + @classmethod + def _make(cls, iterable, new=tuple.__new__, len=len): + 'Make a new {typename} object from a sequence or iterable' + result = new(cls, iterable) + if len(result) != {num_fields:d}: + raise TypeError('Expected {num_fields:d} arguments, got %d' % len(result)) + return result + + def _replace(_self, **kwds): + 'Return a new {typename} object replacing specified fields with new values' + result = _self._make(map(kwds.pop, {field_names!r}, _self)) + if kwds: + raise ValueError('Got unexpected field names: %r' % list(kwds)) + return result + + def __repr__(self): + 'Return a nicely formatted representation string' + return self.__class__.__name__ + '({repr_fmt})' % self + + def _asdict(self): + 'Return a new OrderedDict which maps field names to their values.' + return OrderedDict(zip(self._fields, self)) + + def __getnewargs__(self): + 'Return self as a plain tuple. Used by copy and pickle.' + return tuple(self) + +{field_defs} +""" + +_repr_template = '{name}=%r' + +_field_template = '''\ + {name} = _property(_itemgetter({index:d}), doc='Alias for field number {index:d}') +''' + + +def namedtuple(typename, field_names, *, verbose=False, rename=False, module=None): + """Returns a new subclass of tuple with named fields. + + >>> Point = namedtuple('Point', ['x', 'y']) + >>> Point.__doc__ # docstring for the new class + 'Point(x, y)' + >>> p = Point(11, y=22) # instantiate with positional args or keywords + >>> p[0] + p[1] # indexable like a plain tuple + 33 + >>> x, y = p # unpack like a regular tuple + >>> x, y + (11, 22) + >>> p.x + p.y # fields also accessible by name + 33 + >>> d = p._asdict() # convert to a dictionary + >>> d['x'] + 11 + >>> Point(**d) # convert from a dictionary + Point(x=11, y=22) + >>> p._replace(x=100) # _replace() is like str.replace() but targets named fields + Point(x=100, y=22) + + """ + + # Validate the field names. At the user's option, either generate an error + # message or automatically replace the field name with a valid name. + if isinstance(field_names, str): + field_names = field_names.replace(',', ' ').split() + field_names = list(map(str, field_names)) + typename = str(typename) + if rename: + seen = set() + for index, name in enumerate(field_names): + if (not name.isidentifier() + or _iskeyword(name) + or name.startswith('_') + or name in seen): + field_names[index] = '_%d' % index + seen.add(name) + for name in [typename] + field_names: + if type(name) is not str: + raise TypeError('Type names and field names must be strings') + if not name.isidentifier(): + raise ValueError('Type names and field names must be valid ' + 'identifiers: %r' % name) + if _iskeyword(name): + raise ValueError('Type names and field names cannot be a ' + 'keyword: %r' % name) + seen = set() + for name in field_names: + if name.startswith('_') and not rename: + raise ValueError('Field names cannot start with an underscore: ' + '%r' % name) + if name in seen: + raise ValueError('Encountered duplicate field name: %r' % name) + seen.add(name) + + # Fill-in the class template + class_definition = _class_template.format( + typename=typename, + field_names=tuple(field_names), + num_fields=len(field_names), + arg_list=repr(tuple(field_names)).replace("'", "")[1:-1], + repr_fmt=', '.join(_repr_template.format(name=name) + for name in field_names), + field_defs='\n'.join(_field_template.format(index=index, name=name) + for index, name in enumerate(field_names)) + ) + + # Execute the template string in a temporary namespace and support + # tracing utilities by setting a value for frame.f_globals['__name__'] + namespace = dict(__name__='namedtuple_%s' % typename) + exec(class_definition, namespace) + result = namespace[typename] + result._source = class_definition + if verbose: + print(result._source) + + # For pickling to work, the __module__ variable needs to be set to the frame + # where the named tuple is created. Bypass this step in environments where + # sys._getframe is not defined (Jython for example) or sys._getframe is not + # defined for arguments greater than 0 (IronPython), or where the user has + # specified a particular module. + if module is None: + try: + module = _sys._getframe(1).f_globals.get('__name__', '__main__') + except (AttributeError, ValueError): + pass + if module is not None: + result.__module__ = module + + return result + + +######################################################################## +# Counter +######################################################################## + +def _count_elements(mapping, iterable): + 'Tally elements from the iterable.' + mapping_get = mapping.get + for elem in iterable: + mapping[elem] = mapping_get(elem, 0) + 1 + + +try: # Load C helper function if available + from _collections import _count_elements +except ImportError: + pass + + +class Counter(dict): + '''Dict subclass for counting hashable items. Sometimes called a bag + or multiset. Elements are stored as dictionary keys and their counts + are stored as dictionary values. + + >>> c = Counter('abcdeabcdabcaba') # count elements from a string + + >>> c.most_common(3) # three most common elements + [('a', 5), ('b', 4), ('c', 3)] + >>> sorted(c) # list all unique elements + ['a', 'b', 'c', 'd', 'e'] + >>> ''.join(sorted(c.elements())) # list elements with repetitions + 'aaaaabbbbcccdde' + >>> sum(c.values()) # total of all counts + 15 + + >>> c['a'] # count of letter 'a' + 5 + >>> for elem in 'shazam': # update counts from an iterable + ... c[elem] += 1 # by adding 1 to each element's count + >>> c['a'] # now there are seven 'a' + 7 + >>> del c['b'] # remove all 'b' + >>> c['b'] # now there are zero 'b' + 0 + + >>> d = Counter('simsalabim') # make another counter + >>> c.update(d) # add in the second counter + >>> c['a'] # now there are nine 'a' + 9 + + >>> c.clear() # empty the counter + >>> c + Counter() + + Note: If a count is set to zero or reduced to zero, it will remain + in the counter until the entry is deleted or the counter is cleared: + + >>> c = Counter('aaabbc') + >>> c['b'] -= 2 # reduce the count of 'b' by two + >>> c.most_common() # 'b' is still in, but its count is zero + [('a', 3), ('c', 1), ('b', 0)] + + ''' + # References: + # http://en.wikipedia.org/wiki/Multiset + # http://www.gnu.org/software/smalltalk/manual-base/html_node/Bag.html + # http://www.demo2s.com/Tutorial/Cpp/0380__set-multiset/Catalog0380__set-multiset.htm + # http://code.activestate.com/recipes/259174/ + # Knuth, TAOCP Vol. II section 4.6.3 + + def __init__(*args, **kwds): + '''Create a new, empty Counter object. And if given, count elements + from an input iterable. Or, initialize the count from another mapping + of elements to their counts. + + >>> c = Counter() # a new, empty counter + >>> c = Counter('gallahad') # a new counter from an iterable + >>> c = Counter({'a': 4, 'b': 2}) # a new counter from a mapping + >>> c = Counter(a=4, b=2) # a new counter from keyword args + + ''' + if not args: + raise TypeError("descriptor '__init__' of 'Counter' object " + "needs an argument") + self, *args = args + if len(args) > 1: + raise TypeError('expected at most 1 arguments, got %d' % len(args)) + super(Counter, self).__init__() + self.update(*args, **kwds) + + def __missing__(self, key): + 'The count of elements not in the Counter is zero.' + # Needed so that self[missing_item] does not raise KeyError + return 0 + + def most_common(self, n=None): + '''List the n most common elements and their counts from the most + common to the least. If n is None, then list all element counts. + + >>> Counter('abcdeabcdabcaba').most_common(3) + [('a', 5), ('b', 4), ('c', 3)] + + ''' + # Emulate Bag.sortedByCount from Smalltalk + if n is None: + return sorted(self.items(), key=_itemgetter(1), reverse=True) + return _heapq.nlargest(n, self.items(), key=_itemgetter(1)) + + def elements(self): + '''Iterator over elements repeating each as many times as its count. + + >>> c = Counter('ABCABC') + >>> sorted(c.elements()) + ['A', 'A', 'B', 'B', 'C', 'C'] + + # Knuth's example for prime factors of 1836: 2**2 * 3**3 * 17**1 + >>> prime_factors = Counter({2: 2, 3: 3, 17: 1}) + >>> product = 1 + >>> for factor in prime_factors.elements(): # loop over factors + ... product *= factor # and multiply them + >>> product + 1836 + + Note, if an element's count has been set to zero or is a negative + number, elements() will ignore it. + + ''' + # Emulate Bag.do from Smalltalk and Multiset.begin from C++. + return _chain.from_iterable(_starmap(_repeat, self.items())) + + # Override dict methods where necessary + + @classmethod + def fromkeys(cls, iterable, v=None): + # There is no equivalent method for counters because setting v=1 + # means that no element can have a count greater than one. + raise NotImplementedError( + 'Counter.fromkeys() is undefined. Use Counter(iterable) instead.') + + def update(*args, **kwds): + '''Like dict.update() but add counts instead of replacing them. + + Source can be an iterable, a dictionary, or another Counter instance. + + >>> c = Counter('which') + >>> c.update('witch') # add elements from another iterable + >>> d = Counter('watch') + >>> c.update(d) # add elements from another counter + >>> c['h'] # four 'h' in which, witch, and watch + 4 + + ''' + # The regular dict.update() operation makes no sense here because the + # replace behavior results in the some of original untouched counts + # being mixed-in with all of the other counts for a mismash that + # doesn't have a straight-forward interpretation in most counting + # contexts. Instead, we implement straight-addition. Both the inputs + # and outputs are allowed to contain zero and negative counts. + + if not args: + raise TypeError("descriptor 'update' of 'Counter' object " + "needs an argument") + self, *args = args + if len(args) > 1: + raise TypeError('expected at most 1 arguments, got %d' % len(args)) + iterable = args[0] if args else None + if iterable is not None: + if isinstance(iterable, Mapping): + if self: + self_get = self.get + for elem, count in iterable.items(): + self[elem] = count + self_get(elem, 0) + else: + # fast path when counter is empty + super(Counter, self).update(iterable) + else: + _count_elements(self, iterable) + if kwds: + self.update(kwds) + + def subtract(*args, **kwds): + '''Like dict.update() but subtracts counts instead of replacing them. + Counts can be reduced below zero. Both the inputs and outputs are + allowed to contain zero and negative counts. + + Source can be an iterable, a dictionary, or another Counter instance. + + >>> c = Counter('which') + >>> c.subtract('witch') # subtract elements from another iterable + >>> c.subtract(Counter('watch')) # subtract elements from another counter + >>> c['h'] # 2 in which, minus 1 in witch, minus 1 in watch + 0 + >>> c['w'] # 1 in which, minus 1 in witch, minus 1 in watch + -1 + + ''' + if not args: + raise TypeError("descriptor 'subtract' of 'Counter' object " + "needs an argument") + self, *args = args + if len(args) > 1: + raise TypeError('expected at most 1 arguments, got %d' % len(args)) + iterable = args[0] if args else None + if iterable is not None: + self_get = self.get + if isinstance(iterable, Mapping): + for elem, count in iterable.items(): + self[elem] = self_get(elem, 0) - count + else: + for elem in iterable: + self[elem] = self_get(elem, 0) - 1 + if kwds: + self.subtract(kwds) + + def copy(self): + 'Return a shallow copy.' + return self.__class__(self) + + def __reduce__(self): + return self.__class__, (dict(self),) + + def __delitem__(self, elem): + 'Like dict.__delitem__() but does not raise KeyError for missing values.' + if elem in self: + super().__delitem__(elem) + + def __repr__(self): + if not self: + return '%s()' % self.__class__.__name__ + try: + items = ', '.join(map('%r: %r'.__mod__, self.most_common())) + return '%s({%s})' % (self.__class__.__name__, items) + except TypeError: + # handle case where values are not orderable + return '{0}({1!r})'.format(self.__class__.__name__, dict(self)) + + # Multiset-style mathematical operations discussed in: + # Knuth TAOCP Volume II section 4.6.3 exercise 19 + # and at http://en.wikipedia.org/wiki/Multiset + # + # Outputs guaranteed to only include positive counts. + # + # To strip negative and zero counts, add-in an empty counter: + # c += Counter() + + def __add__(self, other): + '''Add counts from two counters. + + >>> Counter('abbb') + Counter('bcc') + Counter({'b': 4, 'c': 2, 'a': 1}) + + ''' + if not isinstance(other, Counter): + return NotImplemented + result = Counter() + for elem, count in self.items(): + newcount = count + other[elem] + if newcount > 0: + result[elem] = newcount + for elem, count in other.items(): + if elem not in self and count > 0: + result[elem] = count + return result + + def __sub__(self, other): + ''' Subtract count, but keep only results with positive counts. + + >>> Counter('abbbc') - Counter('bccd') + Counter({'b': 2, 'a': 1}) + + ''' + if not isinstance(other, Counter): + return NotImplemented + result = Counter() + for elem, count in self.items(): + newcount = count - other[elem] + if newcount > 0: + result[elem] = newcount + for elem, count in other.items(): + if elem not in self and count < 0: + result[elem] = 0 - count + return result + + def __or__(self, other): + '''Union is the maximum of value in either of the input counters. + + >>> Counter('abbb') | Counter('bcc') + Counter({'b': 3, 'c': 2, 'a': 1}) + + ''' + if not isinstance(other, Counter): + return NotImplemented + result = Counter() + for elem, count in self.items(): + other_count = other[elem] + newcount = other_count if count < other_count else count + if newcount > 0: + result[elem] = newcount + for elem, count in other.items(): + if elem not in self and count > 0: + result[elem] = count + return result + + def __and__(self, other): + ''' Intersection is the minimum of corresponding counts. + + >>> Counter('abbb') & Counter('bcc') + Counter({'b': 1}) + + ''' + if not isinstance(other, Counter): + return NotImplemented + result = Counter() + for elem, count in self.items(): + other_count = other[elem] + newcount = count if count < other_count else other_count + if newcount > 0: + result[elem] = newcount + return result + + def __pos__(self): + 'Adds an empty counter, effectively stripping negative and zero counts' + result = Counter() + for elem, count in self.items(): + if count > 0: + result[elem] = count + return result + + def __neg__(self): + '''Subtracts from an empty counter. Strips positive and zero counts, + and flips the sign on negative counts. + + ''' + result = Counter() + for elem, count in self.items(): + if count < 0: + result[elem] = 0 - count + return result + + def _keep_positive(self): + '''Internal method to strip elements with a negative or zero count''' + nonpositive = [elem for elem, count in self.items() if not count > 0] + for elem in nonpositive: + del self[elem] + return self + + def __iadd__(self, other): + '''Inplace add from another counter, keeping only positive counts. + + >>> c = Counter('abbb') + >>> c += Counter('bcc') + >>> c + Counter({'b': 4, 'c': 2, 'a': 1}) + + ''' + for elem, count in other.items(): + self[elem] += count + return self._keep_positive() + + def __isub__(self, other): + '''Inplace subtract counter, but keep only results with positive counts. + + >>> c = Counter('abbbc') + >>> c -= Counter('bccd') + >>> c + Counter({'b': 2, 'a': 1}) + + ''' + for elem, count in other.items(): + self[elem] -= count + return self._keep_positive() + + def __ior__(self, other): + '''Inplace union is the maximum of value from either counter. + + >>> c = Counter('abbb') + >>> c |= Counter('bcc') + >>> c + Counter({'b': 3, 'c': 2, 'a': 1}) + + ''' + for elem, other_count in other.items(): + count = self[elem] + if other_count > count: + self[elem] = other_count + return self._keep_positive() + + def __iand__(self, other): + '''Inplace intersection is the minimum of corresponding counts. + + >>> c = Counter('abbb') + >>> c &= Counter('bcc') + >>> c + Counter({'b': 1}) + + ''' + for elem, count in self.items(): + other_count = other[elem] + if other_count < count: + self[elem] = other_count + return self._keep_positive() + + +######################################################################## +# ChainMap +######################################################################## + +class ChainMap(MutableMapping): + ''' A ChainMap groups multiple dicts (or other mappings) together + to create a single, updateable view. + + The underlying mappings are stored in a list. That list is public and can + be accessed or updated using the *maps* attribute. There is no other + state. + + Lookups search the underlying mappings successively until a key is found. + In contrast, writes, updates, and deletions only operate on the first + mapping. + + ''' + + def __init__(self, *maps): + '''Initialize a ChainMap by setting *maps* to the given mappings. + If no mappings are provided, a single empty dictionary is used. + + ''' + self.maps = list(maps) or [{}] # always at least one map + + def __missing__(self, key): + raise KeyError(key) + + def __getitem__(self, key): + for mapping in self.maps: + try: + # can't use 'key in mapping' with defaultdict + return mapping[key] + except KeyError: + pass + # support subclasses that define __missing__ + return self.__missing__(key) + + def get(self, key, default=None): + return self[key] if key in self else default + + def __len__(self): + # reuses stored hash values if possible + return len(set().union(*self.maps)) + + def __iter__(self): + return iter(set().union(*self.maps)) + + def __contains__(self, key): + return any(key in m for m in self.maps) + + def __bool__(self): + return any(self.maps) + + @_recursive_repr() + def __repr__(self): + return '{0.__class__.__name__}({1})'.format( + self, ', '.join(map(repr, self.maps))) + + @classmethod + def fromkeys(cls, iterable, *args): + 'Create a ChainMap with a single dict created from the iterable.' + return cls(dict.fromkeys(iterable, *args)) + + def copy(self): + 'New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]' + return self.__class__(self.maps[0].copy(), *self.maps[1:]) + + __copy__ = copy + + def new_child(self, m=None): # like Django's Context.push() + '''New ChainMap with a new map followed by all previous maps. + If no map is provided, an empty dict is used. + ''' + if m is None: + m = {} + return self.__class__(m, *self.maps) + + @property + def parents(self): # like Django's Context.pop() + 'New ChainMap from maps[1:].' + return self.__class__(*self.maps[1:]) + + def __setitem__(self, key, value): + self.maps[0][key] = value + + def __delitem__(self, key): + try: + del self.maps[0][key] + except KeyError: + raise KeyError( + 'Key not found in the first mapping: {!r}'.format(key)) + + def popitem(self): + 'Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.' + try: + return self.maps[0].popitem() + except KeyError: + raise KeyError('No keys found in the first mapping.') + + def pop(self, key, *args): + 'Remove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].' + try: + return self.maps[0].pop(key, *args) + except KeyError: + raise KeyError( + 'Key not found in the first mapping: {!r}'.format(key)) + + def clear(self): + 'Clear maps[0], leaving maps[1:] intact.' + self.maps[0].clear() + + +################################################################################ +# UserDict +################################################################################ + +class UserDict(MutableMapping): + + # Start by filling-out the abstract methods + def __init__(*args, **kwargs): + if not args: + raise TypeError("descriptor '__init__' of 'UserDict' object " + "needs an argument") + self, *args = args + if len(args) > 1: + raise TypeError('expected at most 1 arguments, got %d' % len(args)) + if args: + dict = args[0] + elif 'dict' in kwargs: + dict = kwargs.pop('dict') + import warnings + warnings.warn("Passing 'dict' as keyword argument is deprecated", + DeprecationWarning, stacklevel=2) + else: + dict = None + self.data = {} + if dict is not None: + self.update(dict) + if len(kwargs): + self.update(kwargs) + + def __len__(self): return len(self.data) + + def __getitem__(self, key): + if key in self.data: + return self.data[key] + if hasattr(self.__class__, "__missing__"): + return self.__class__.__missing__(self, key) + raise KeyError(key) + + def __setitem__(self, key, item): self.data[key] = item + + def __delitem__(self, key): del self.data[key] + + def __iter__(self): + return iter(self.data) + + # Modify __contains__ to work correctly when __missing__ is present + def __contains__(self, key): + return key in self.data + + # Now, add the methods in dicts but not in MutableMapping + def __repr__(self): return repr(self.data) + + def copy(self): + if self.__class__ is UserDict: + return UserDict(self.data.copy()) + import copy + data = self.data + try: + self.data = {} + c = copy.copy(self) + finally: + self.data = data + c.update(self) + return c + + @classmethod + def fromkeys(cls, iterable, value=None): + d = cls() + for key in iterable: + d[key] = value + return d + + +################################################################################ +# UserList +################################################################################ + +class UserList(MutableSequence): + """A more or less complete user-defined wrapper around list objects.""" + + def __init__(self, initlist=None): + self.data = [] + if initlist is not None: + # XXX should this accept an arbitrary sequence? + if type(initlist) == type(self.data): + self.data[:] = initlist + elif isinstance(initlist, UserList): + self.data[:] = initlist.data[:] + else: + self.data = list(initlist) + + def __repr__(self): return repr(self.data) + + def __lt__(self, other): return self.data < self.__cast(other) + + def __le__(self, other): return self.data <= self.__cast(other) + + def __eq__(self, other): return self.data == self.__cast(other) + + def __gt__(self, other): return self.data > self.__cast(other) + + def __ge__(self, other): return self.data >= self.__cast(other) + + def __cast(self, other): + return other.data if isinstance(other, UserList) else other + + def __contains__(self, item): return item in self.data + + def __len__(self): return len(self.data) + + def __getitem__(self, i): return self.data[i] + + def __setitem__(self, i, item): self.data[i] = item + + def __delitem__(self, i): del self.data[i] + + def __add__(self, other): + if isinstance(other, UserList): + return self.__class__(self.data + other.data) + elif isinstance(other, type(self.data)): + return self.__class__(self.data + other) + return self.__class__(self.data + list(other)) + + def __radd__(self, other): + if isinstance(other, UserList): + return self.__class__(other.data + self.data) + elif isinstance(other, type(self.data)): + return self.__class__(other + self.data) + return self.__class__(list(other) + self.data) + + def __iadd__(self, other): + if isinstance(other, UserList): + self.data += other.data + elif isinstance(other, type(self.data)): + self.data += other + else: + self.data += list(other) + return self + + def __mul__(self, n): + return self.__class__(self.data*n) + __rmul__ = __mul__ + + def __imul__(self, n): + self.data *= n + return self + + def append(self, item): self.data.append(item) + + def insert(self, i, item): self.data.insert(i, item) + + def pop(self, i=-1): return self.data.pop(i) + + def remove(self, item): self.data.remove(item) + + def clear(self): self.data.clear() + + def copy(self): return self.__class__(self) + + def count(self, item): return self.data.count(item) + + def index(self, item, *args): return self.data.index(item, *args) + + def reverse(self): self.data.reverse() + + def sort(self, *args, **kwds): self.data.sort(*args, **kwds) + + def extend(self, other): + if isinstance(other, UserList): + self.data.extend(other.data) + else: + self.data.extend(other) + + +################################################################################ +# UserString +################################################################################ + +class UserString(Sequence): + def __init__(self, seq): + if isinstance(seq, str): + self.data = seq + elif isinstance(seq, UserString): + self.data = seq.data[:] + else: + self.data = str(seq) + + def __str__(self): return str(self.data) + + def __repr__(self): return repr(self.data) + + def __int__(self): return int(self.data) + + def __float__(self): return float(self.data) + + def __complex__(self): return complex(self.data) + + def __hash__(self): return hash(self.data) + + def __getnewargs__(self): + return (self.data[:],) + + def __eq__(self, string): + if isinstance(string, UserString): + return self.data == string.data + return self.data == string + + def __lt__(self, string): + if isinstance(string, UserString): + return self.data < string.data + return self.data < string + + def __le__(self, string): + if isinstance(string, UserString): + return self.data <= string.data + return self.data <= string + + def __gt__(self, string): + if isinstance(string, UserString): + return self.data > string.data + return self.data > string + + def __ge__(self, string): + if isinstance(string, UserString): + return self.data >= string.data + return self.data >= string + + def __contains__(self, char): + if isinstance(char, UserString): + char = char.data + return char in self.data + + def __len__(self): return len(self.data) + + def __getitem__(self, index): return self.__class__(self.data[index]) + + def __add__(self, other): + if isinstance(other, UserString): + return self.__class__(self.data + other.data) + elif isinstance(other, str): + return self.__class__(self.data + other) + return self.__class__(self.data + str(other)) + + def __radd__(self, other): + if isinstance(other, str): + return self.__class__(other + self.data) + return self.__class__(str(other) + self.data) + + def __mul__(self, n): + return self.__class__(self.data*n) + __rmul__ = __mul__ + + def __mod__(self, args): + return self.__class__(self.data % args) + + def __rmod__(self, format): + return self.__class__(format % args) + + # the following methods are defined in alphabetical order: + def capitalize(self): return self.__class__(self.data.capitalize()) + + def casefold(self): + return self.__class__(self.data.casefold()) + + def center(self, width, *args): + return self.__class__(self.data.center(width, *args)) + + def count(self, sub, start=0, end=_sys.maxsize): + if isinstance(sub, UserString): + sub = sub.data + return self.data.count(sub, start, end) + + def encode(self, encoding=None, errors=None): # XXX improve this? + if encoding: + if errors: + return self.__class__(self.data.encode(encoding, errors)) + return self.__class__(self.data.encode(encoding)) + return self.__class__(self.data.encode()) + + def endswith(self, suffix, start=0, end=_sys.maxsize): + return self.data.endswith(suffix, start, end) + + def expandtabs(self, tabsize=8): + return self.__class__(self.data.expandtabs(tabsize)) + + def find(self, sub, start=0, end=_sys.maxsize): + if isinstance(sub, UserString): + sub = sub.data + return self.data.find(sub, start, end) + + def format(self, *args, **kwds): + return self.data.format(*args, **kwds) + + def format_map(self, mapping): + return self.data.format_map(mapping) + + def index(self, sub, start=0, end=_sys.maxsize): + return self.data.index(sub, start, end) + + def isalpha(self): return self.data.isalpha() + + def isalnum(self): return self.data.isalnum() + + def isdecimal(self): return self.data.isdecimal() + + def isdigit(self): return self.data.isdigit() + + def isidentifier(self): return self.data.isidentifier() + + def islower(self): return self.data.islower() + + def isnumeric(self): return self.data.isnumeric() + + def isprintable(self): return self.data.isprintable() + + def isspace(self): return self.data.isspace() + + def istitle(self): return self.data.istitle() + + def isupper(self): return self.data.isupper() + + def join(self, seq): return self.data.join(seq) + + def ljust(self, width, *args): + return self.__class__(self.data.ljust(width, *args)) + + def lower(self): return self.__class__(self.data.lower()) + + def lstrip(self, chars=None): return self.__class__( + self.data.lstrip(chars)) + maketrans = str.maketrans + + def partition(self, sep): + return self.data.partition(sep) + + def replace(self, old, new, maxsplit=-1): + if isinstance(old, UserString): + old = old.data + if isinstance(new, UserString): + new = new.data + return self.__class__(self.data.replace(old, new, maxsplit)) + + def rfind(self, sub, start=0, end=_sys.maxsize): + if isinstance(sub, UserString): + sub = sub.data + return self.data.rfind(sub, start, end) + + def rindex(self, sub, start=0, end=_sys.maxsize): + return self.data.rindex(sub, start, end) + + def rjust(self, width, *args): + return self.__class__(self.data.rjust(width, *args)) + + def rpartition(self, sep): + return self.data.rpartition(sep) + + def rstrip(self, chars=None): + return self.__class__(self.data.rstrip(chars)) + + def split(self, sep=None, maxsplit=-1): + return self.data.split(sep, maxsplit) + + def rsplit(self, sep=None, maxsplit=-1): + return self.data.rsplit(sep, maxsplit) + + def splitlines(self, keepends=False): return self.data.splitlines(keepends) + + def startswith(self, prefix, start=0, end=_sys.maxsize): + return self.data.startswith(prefix, start, end) + + def strip(self, chars=None): return self.__class__(self.data.strip(chars)) + + def swapcase(self): return self.__class__(self.data.swapcase()) + + def title(self): return self.__class__(self.data.title()) + + def translate(self, *args): + return self.__class__(self.data.translate(*args)) + + def upper(self): return self.__class__(self.data.upper()) + + def zfill(self, width): return self.__class__(self.data.zfill(width)) diff --git a/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/collections/abc.py b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/collections/abc.py new file mode 100644 index 0000000..891600d --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/collections/abc.py @@ -0,0 +1,2 @@ +from _collections_abc import * +from _collections_abc import __all__ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/colorsys.py b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/colorsys.py new file mode 100644 index 0000000..5ba458a --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/colorsys.py @@ -0,0 +1,169 @@ +"""Conversion functions between RGB and other color systems. + +This modules provides two functions for each color system ABC: + + rgb_to_abc(r, g, b) --> a, b, c + abc_to_rgb(a, b, c) --> r, g, b + +All inputs and outputs are triples of floats in the range [0.0...1.0] +(with the exception of I and Q, which covers a slightly larger range). +Inputs outside the valid range may cause exceptions or invalid outputs. + +Supported color systems: +RGB: Red, Green, Blue components +YIQ: Luminance, Chrominance (used by composite video signals) +HLS: Hue, Luminance, Saturation +HSV: Hue, Saturation, Value +""" + +# References: +# http://en.wikipedia.org/wiki/YIQ +# http://en.wikipedia.org/wiki/HLS_color_space +# http://en.wikipedia.org/wiki/HSV_color_space + +__all__ = ["rgb_to_yiq", "yiq_to_rgb", "rgb_to_hls", "hls_to_rgb", + "rgb_to_hsv", "hsv_to_rgb"] + +# Some floating point constants + +ONE_THIRD = 1.0/3.0 +ONE_SIXTH = 1.0/6.0 +TWO_THIRD = 2.0/3.0 + +# YIQ: used by composite video signals (linear combinations of RGB) +# Y: perceived grey level (0.0 == black, 1.0 == white) +# I, Q: color components +# +# There are a great many versions of the constants used in these formulae. +# The ones in this library uses constants from the FCC version of NTSC. + + +def rgb_to_yiq(r, g, b): + y = 0.30*r + 0.59*g + 0.11*b + i = 0.74*(r-y) - 0.27*(b-y) + q = 0.48*(r-y) + 0.41*(b-y) + return (y, i, q) + + +def yiq_to_rgb(y, i, q): + # r = y + (0.27*q + 0.41*i) / (0.74*0.41 + 0.27*0.48) + # b = y + (0.74*q - 0.48*i) / (0.74*0.41 + 0.27*0.48) + # g = y - (0.30*(r-y) + 0.11*(b-y)) / 0.59 + + r = y + 0.9468822170900693*i + 0.6235565819861433*q + g = y - 0.27478764629897834*i - 0.6356910791873801*q + b = y - 1.1085450346420322*i + 1.7090069284064666*q + + if r < 0.0: + r = 0.0 + if g < 0.0: + g = 0.0 + if b < 0.0: + b = 0.0 + if r > 1.0: + r = 1.0 + if g > 1.0: + g = 1.0 + if b > 1.0: + b = 1.0 + return (r, g, b) + + +# HLS: Hue, Luminance, Saturation +# H: position in the spectrum +# L: color lightness +# S: color saturation + +def rgb_to_hls(r, g, b): + maxc = max(r, g, b) + minc = min(r, g, b) + # XXX Can optimize (maxc+minc) and (maxc-minc) + l = (minc+maxc)/2.0 + if minc == maxc: + return 0.0, l, 0.0 + if l <= 0.5: + s = (maxc-minc) / (maxc+minc) + else: + s = (maxc-minc) / (2.0-maxc-minc) + rc = (maxc-r) / (maxc-minc) + gc = (maxc-g) / (maxc-minc) + bc = (maxc-b) / (maxc-minc) + if r == maxc: + h = bc-gc + elif g == maxc: + h = 2.0+rc-bc + else: + h = 4.0+gc-rc + h = (h/6.0) % 1.0 + return h, l, s + + +def hls_to_rgb(h, l, s): + if s == 0.0: + return l, l, l + if l <= 0.5: + m2 = l * (1.0+s) + else: + m2 = l+s-(l*s) + m1 = 2.0*l - m2 + return (_v(m1, m2, h+ONE_THIRD), _v(m1, m2, h), _v(m1, m2, h-ONE_THIRD)) + + +def _v(m1, m2, hue): + hue = hue % 1.0 + if hue < ONE_SIXTH: + return m1 + (m2-m1)*hue*6.0 + if hue < 0.5: + return m2 + if hue < TWO_THIRD: + return m1 + (m2-m1)*(TWO_THIRD-hue)*6.0 + return m1 + + +# HSV: Hue, Saturation, Value +# H: position in the spectrum +# S: color saturation ("purity") +# V: color brightness + +def rgb_to_hsv(r, g, b): + maxc = max(r, g, b) + minc = min(r, g, b) + v = maxc + if minc == maxc: + return 0.0, 0.0, v + s = (maxc-minc) / maxc + rc = (maxc-r) / (maxc-minc) + gc = (maxc-g) / (maxc-minc) + bc = (maxc-b) / (maxc-minc) + if r == maxc: + h = bc-gc + elif g == maxc: + h = 2.0+rc-bc + else: + h = 4.0+gc-rc + h = (h/6.0) % 1.0 + return h, s, v + + +def hsv_to_rgb(h, s, v): + if s == 0.0: + return v, v, v + i = int(h*6.0) # XXX assume int() truncates! + f = (h*6.0) - i + p = v*(1.0 - s) + q = v*(1.0 - s*f) + t = v*(1.0 - s*(1.0-f)) + i = i % 6 + if i == 0: + return v, t, p + if i == 1: + return q, v, p + if i == 2: + return p, v, t + if i == 3: + return p, q, v + if i == 4: + return t, p, v + if i == 5: + return v, p, q + # Cannot get here diff --git a/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/compileall.py b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/compileall.py new file mode 100644 index 0000000..42574fc --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/compileall.py @@ -0,0 +1,298 @@ +"""Module/script to byte-compile all .py files to .pyc files. + +When called as a script with arguments, this compiles the directories +given as arguments recursively; the -l option prevents it from +recursing into directories. + +Without arguments, if compiles all modules on sys.path, without +recursing into subdirectories. (Even though it should do so for +packages -- for now, you'll have to deal with packages separately.) + +See module py_compile for details of the actual byte-compilation. +""" +import os +import sys +import importlib.util +import py_compile +import struct + +try: + from concurrent.futures import ProcessPoolExecutor +except ImportError: + ProcessPoolExecutor = None +from functools import partial + +__all__ = ["compile_dir", "compile_file", "compile_path"] + + +def _walk_dir(dir, ddir=None, maxlevels=10, quiet=0): + if quiet < 2 and isinstance(dir, os.PathLike): + dir = os.fspath(dir) + if not quiet: + print('Listing {!r}...'.format(dir)) + try: + names = os.listdir(dir) + except OSError: + if quiet < 2: + print("Can't list {!r}".format(dir)) + names = [] + names.sort() + for name in names: + if name == '__pycache__': + continue + fullname = os.path.join(dir, name) + if ddir is not None: + dfile = os.path.join(ddir, name) + else: + dfile = None + if not os.path.isdir(fullname): + yield fullname + elif (maxlevels > 0 and name != os.curdir and name != os.pardir and + os.path.isdir(fullname) and not os.path.islink(fullname)): + yield from _walk_dir(fullname, ddir=dfile, + maxlevels=maxlevels - 1, quiet=quiet) + + +def compile_dir(dir, maxlevels=10, ddir=None, force=False, rx=None, + quiet=0, legacy=False, optimize=-1, workers=1): + """Byte-compile all modules in the given directory tree. + + Arguments (only dir is required): + + dir: the directory to byte-compile + maxlevels: maximum recursion level (default 10) + ddir: the directory that will be prepended to the path to the + file as it is compiled into each byte-code file. + force: if True, force compilation, even if timestamps are up-to-date + quiet: full output with False or 0, errors only with 1, + no output with 2 + legacy: if True, produce legacy pyc paths instead of PEP 3147 paths + optimize: optimization level or -1 for level of the interpreter + workers: maximum number of parallel workers + """ + if workers is not None and workers < 0: + raise ValueError('workers must be greater or equal to 0') + + files = _walk_dir(dir, quiet=quiet, maxlevels=maxlevels, + ddir=ddir) + success = True + if workers is not None and workers != 1 and ProcessPoolExecutor is not None: + workers = workers or None + with ProcessPoolExecutor(max_workers=workers) as executor: + results = executor.map(partial(compile_file, + ddir=ddir, force=force, + rx=rx, quiet=quiet, + legacy=legacy, + optimize=optimize), + files) + success = min(results, default=True) + else: + for file in files: + if not compile_file(file, ddir, force, rx, quiet, + legacy, optimize): + success = False + return success + + +def compile_file(fullname, ddir=None, force=False, rx=None, quiet=0, + legacy=False, optimize=-1): + """Byte-compile one file. + + Arguments (only fullname is required): + + fullname: the file to byte-compile + ddir: if given, the directory name compiled in to the + byte-code file. + force: if True, force compilation, even if timestamps are up-to-date + quiet: full output with False or 0, errors only with 1, + no output with 2 + legacy: if True, produce legacy pyc paths instead of PEP 3147 paths + optimize: optimization level or -1 for level of the interpreter + """ + success = True + if quiet < 2 and isinstance(fullname, os.PathLike): + fullname = os.fspath(fullname) + name = os.path.basename(fullname) + if ddir is not None: + dfile = os.path.join(ddir, name) + else: + dfile = None + if rx is not None: + mo = rx.search(fullname) + if mo: + return success + if os.path.isfile(fullname): + if legacy: + cfile = fullname + 'c' + else: + if optimize >= 0: + opt = optimize if optimize >= 1 else '' + cfile = importlib.util.cache_from_source( + fullname, optimization=opt) + else: + cfile = importlib.util.cache_from_source(fullname) + cache_dir = os.path.dirname(cfile) + head, tail = name[:-3], name[-3:] + if tail == '.py': + if not force: + try: + mtime = int(os.stat(fullname).st_mtime) + expect = struct.pack('<4sl', importlib.util.MAGIC_NUMBER, + mtime) + with open(cfile, 'rb') as chandle: + actual = chandle.read(8) + if expect == actual: + return success + except OSError: + pass + if not quiet: + print('Compiling {!r}...'.format(fullname)) + try: + ok = py_compile.compile(fullname, cfile, dfile, True, + optimize=optimize) + except py_compile.PyCompileError as err: + success = False + if quiet >= 2: + return success + elif quiet: + print('*** Error compiling {!r}...'.format(fullname)) + else: + print('*** ', end='') + # escape non-printable characters in msg + msg = err.msg.encode(sys.stdout.encoding, + errors='backslashreplace') + msg = msg.decode(sys.stdout.encoding) + print(msg) + except (SyntaxError, UnicodeError, OSError) as e: + success = False + if quiet >= 2: + return success + elif quiet: + print('*** Error compiling {!r}...'.format(fullname)) + else: + print('*** ', end='') + print(e.__class__.__name__ + ':', e) + else: + if ok == 0: + success = False + return success + + +def compile_path(skip_curdir=1, maxlevels=0, force=False, quiet=0, + legacy=False, optimize=-1): + """Byte-compile all module on sys.path. + + Arguments (all optional): + + skip_curdir: if true, skip current directory (default True) + maxlevels: max recursion level (default 0) + force: as for compile_dir() (default False) + quiet: as for compile_dir() (default 0) + legacy: as for compile_dir() (default False) + optimize: as for compile_dir() (default -1) + """ + success = True + for dir in sys.path: + if (not dir or dir == os.curdir) and skip_curdir: + if quiet < 2: + print('Skipping current directory') + else: + success = success and compile_dir(dir, maxlevels, None, + force, quiet=quiet, + legacy=legacy, optimize=optimize) + return success + + +def main(): + """Script main program.""" + import argparse + + parser = argparse.ArgumentParser( + description='Utilities to support installing Python libraries.') + parser.add_argument('-l', action='store_const', const=0, + default=10, dest='maxlevels', + help="don't recurse into subdirectories") + parser.add_argument('-r', type=int, dest='recursion', + help=('control the maximum recursion level. ' + 'if `-l` and `-r` options are specified, ' + 'then `-r` takes precedence.')) + parser.add_argument('-f', action='store_true', dest='force', + help='force rebuild even if timestamps are up to date') + parser.add_argument('-q', action='count', dest='quiet', default=0, + help='output only error messages; -qq will suppress ' + 'the error messages as well.') + parser.add_argument('-b', action='store_true', dest='legacy', + help='use legacy (pre-PEP3147) compiled file locations') + parser.add_argument('-d', metavar='DESTDIR', dest='ddir', default=None, + help=('directory to prepend to file paths for use in ' + 'compile-time tracebacks and in runtime ' + 'tracebacks in cases where the source file is ' + 'unavailable')) + parser.add_argument('-x', metavar='REGEXP', dest='rx', default=None, + help=('skip files matching the regular expression; ' + 'the regexp is searched for in the full path ' + 'of each file considered for compilation')) + parser.add_argument('-i', metavar='FILE', dest='flist', + help=('add all the files and directories listed in ' + 'FILE to the list considered for compilation; ' + 'if "-", names are read from stdin')) + parser.add_argument('compile_dest', metavar='FILE|DIR', nargs='*', + help=('zero or more file and directory names ' + 'to compile; if no arguments given, defaults ' + 'to the equivalent of -l sys.path')) + parser.add_argument('-j', '--workers', default=1, + type=int, help='Run compileall concurrently') + + args = parser.parse_args() + compile_dests = args.compile_dest + + if args.rx: + import re + args.rx = re.compile(args.rx) + + if args.recursion is not None: + maxlevels = args.recursion + else: + maxlevels = args.maxlevels + + # if flist is provided then load it + if args.flist: + try: + with (sys.stdin if args.flist == '-' else open(args.flist)) as f: + for line in f: + compile_dests.append(line.strip()) + except OSError: + if args.quiet < 2: + print("Error reading file list {}".format(args.flist)) + return False + + if args.workers is not None: + args.workers = args.workers or None + + success = True + try: + if compile_dests: + for dest in compile_dests: + if os.path.isfile(dest): + if not compile_file(dest, args.ddir, args.force, args.rx, + args.quiet, args.legacy): + success = False + else: + if not compile_dir(dest, maxlevels, args.ddir, + args.force, args.rx, args.quiet, + args.legacy, workers=args.workers): + success = False + return success + else: + return compile_path(legacy=args.legacy, force=args.force, + quiet=args.quiet) + except KeyboardInterrupt: + if args.quiet < 2: + print("\n[interrupted]") + return False + return True + + +if __name__ == '__main__': + exit_status = int(not main()) + sys.exit(exit_status) diff --git a/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/concurrent/__init__.py b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/concurrent/__init__.py new file mode 100644 index 0000000..196d378 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/concurrent/__init__.py @@ -0,0 +1 @@ +# This directory is a Python package. diff --git a/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/concurrent/futures/__init__.py b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/concurrent/futures/__init__.py new file mode 100644 index 0000000..b5231f8 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/concurrent/futures/__init__.py @@ -0,0 +1,18 @@ +# Copyright 2009 Brian Quinlan. All Rights Reserved. +# Licensed to PSF under a Contributor Agreement. + +"""Execute computations asynchronously using threads or processes.""" + +__author__ = 'Brian Quinlan (brian@sweetapp.com)' + +from concurrent.futures._base import (FIRST_COMPLETED, + FIRST_EXCEPTION, + ALL_COMPLETED, + CancelledError, + TimeoutError, + Future, + Executor, + wait, + as_completed) +from concurrent.futures.process import ProcessPoolExecutor +from concurrent.futures.thread import ThreadPoolExecutor diff --git a/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/concurrent/futures/_base.py b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/concurrent/futures/_base.py new file mode 100644 index 0000000..598cf48 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/concurrent/futures/_base.py @@ -0,0 +1,628 @@ +# Copyright 2009 Brian Quinlan. All Rights Reserved. +# Licensed to PSF under a Contributor Agreement. + +__author__ = 'Brian Quinlan (brian@sweetapp.com)' + +import collections +import logging +import threading +import time + +FIRST_COMPLETED = 'FIRST_COMPLETED' +FIRST_EXCEPTION = 'FIRST_EXCEPTION' +ALL_COMPLETED = 'ALL_COMPLETED' +_AS_COMPLETED = '_AS_COMPLETED' + +# Possible future states (for internal use by the futures package). +PENDING = 'PENDING' +RUNNING = 'RUNNING' +# The future was cancelled by the user... +CANCELLED = 'CANCELLED' +# ...and _Waiter.add_cancelled() was called by a worker. +CANCELLED_AND_NOTIFIED = 'CANCELLED_AND_NOTIFIED' +FINISHED = 'FINISHED' + +_FUTURE_STATES = [ + PENDING, + RUNNING, + CANCELLED, + CANCELLED_AND_NOTIFIED, + FINISHED +] + +_STATE_TO_DESCRIPTION_MAP = { + PENDING: "pending", + RUNNING: "running", + CANCELLED: "cancelled", + CANCELLED_AND_NOTIFIED: "cancelled", + FINISHED: "finished" +} + +# Logger for internal use by the futures package. +LOGGER = logging.getLogger("concurrent.futures") + + +class Error(Exception): + """Base class for all future-related exceptions.""" + pass + + +class CancelledError(Error): + """The Future was cancelled.""" + pass + + +class TimeoutError(Error): + """The operation exceeded the given deadline.""" + pass + + +class _Waiter(object): + """Provides the event that wait() and as_completed() block on.""" + + def __init__(self): + self.event = threading.Event() + self.finished_futures = [] + + def add_result(self, future): + self.finished_futures.append(future) + + def add_exception(self, future): + self.finished_futures.append(future) + + def add_cancelled(self, future): + self.finished_futures.append(future) + + +class _AsCompletedWaiter(_Waiter): + """Used by as_completed().""" + + def __init__(self): + super(_AsCompletedWaiter, self).__init__() + self.lock = threading.Lock() + + def add_result(self, future): + with self.lock: + super(_AsCompletedWaiter, self).add_result(future) + self.event.set() + + def add_exception(self, future): + with self.lock: + super(_AsCompletedWaiter, self).add_exception(future) + self.event.set() + + def add_cancelled(self, future): + with self.lock: + super(_AsCompletedWaiter, self).add_cancelled(future) + self.event.set() + + +class _FirstCompletedWaiter(_Waiter): + """Used by wait(return_when=FIRST_COMPLETED).""" + + def add_result(self, future): + super().add_result(future) + self.event.set() + + def add_exception(self, future): + super().add_exception(future) + self.event.set() + + def add_cancelled(self, future): + super().add_cancelled(future) + self.event.set() + + +class _AllCompletedWaiter(_Waiter): + """Used by wait(return_when=FIRST_EXCEPTION and ALL_COMPLETED).""" + + def __init__(self, num_pending_calls, stop_on_exception): + self.num_pending_calls = num_pending_calls + self.stop_on_exception = stop_on_exception + self.lock = threading.Lock() + super().__init__() + + def _decrement_pending_calls(self): + with self.lock: + self.num_pending_calls -= 1 + if not self.num_pending_calls: + self.event.set() + + def add_result(self, future): + super().add_result(future) + self._decrement_pending_calls() + + def add_exception(self, future): + super().add_exception(future) + if self.stop_on_exception: + self.event.set() + else: + self._decrement_pending_calls() + + def add_cancelled(self, future): + super().add_cancelled(future) + self._decrement_pending_calls() + + +class _AcquireFutures(object): + """A context manager that does an ordered acquire of Future conditions.""" + + def __init__(self, futures): + self.futures = sorted(futures, key=id) + + def __enter__(self): + for future in self.futures: + future._condition.acquire() + + def __exit__(self, *args): + for future in self.futures: + future._condition.release() + + +def _create_and_install_waiters(fs, return_when): + if return_when == _AS_COMPLETED: + waiter = _AsCompletedWaiter() + elif return_when == FIRST_COMPLETED: + waiter = _FirstCompletedWaiter() + else: + pending_count = sum( + f._state not in [CANCELLED_AND_NOTIFIED, FINISHED] for f in fs) + + if return_when == FIRST_EXCEPTION: + waiter = _AllCompletedWaiter(pending_count, stop_on_exception=True) + elif return_when == ALL_COMPLETED: + waiter = _AllCompletedWaiter( + pending_count, stop_on_exception=False) + else: + raise ValueError("Invalid return condition: %r" % return_when) + + for f in fs: + f._waiters.append(waiter) + + return waiter + + +def _yield_finished_futures(fs, waiter, ref_collect): + """ + Iterate on the list *fs*, yielding finished futures one by one in + reverse order. + Before yielding a future, *waiter* is removed from its waiters + and the future is removed from each set in the collection of sets + *ref_collect*. + + The aim of this function is to avoid keeping stale references after + the future is yielded and before the iterator resumes. + """ + while fs: + f = fs[-1] + for futures_set in ref_collect: + futures_set.remove(f) + with f._condition: + f._waiters.remove(waiter) + del f + # Careful not to keep a reference to the popped value + yield fs.pop() + + +def as_completed(fs, timeout=None): + """An iterator over the given futures that yields each as it completes. + + Args: + fs: The sequence of Futures (possibly created by different Executors) to + iterate over. + timeout: The maximum number of seconds to wait. If None, then there + is no limit on the wait time. + + Returns: + An iterator that yields the given Futures as they complete (finished or + cancelled). If any given Futures are duplicated, they will be returned + once. + + Raises: + TimeoutError: If the entire result iterator could not be generated + before the given timeout. + """ + if timeout is not None: + end_time = timeout + time.time() + + fs = set(fs) + total_futures = len(fs) + with _AcquireFutures(fs): + finished = set( + f for f in fs + if f._state in [CANCELLED_AND_NOTIFIED, FINISHED]) + pending = fs - finished + waiter = _create_and_install_waiters(fs, _AS_COMPLETED) + finished = list(finished) + try: + yield from _yield_finished_futures(finished, waiter, + ref_collect=(fs,)) + + while pending: + if timeout is None: + wait_timeout = None + else: + wait_timeout = end_time - time.time() + if wait_timeout < 0: + raise TimeoutError( + '%d (of %d) futures unfinished' % ( + len(pending), total_futures)) + + waiter.event.wait(wait_timeout) + + with waiter.lock: + finished = waiter.finished_futures + waiter.finished_futures = [] + waiter.event.clear() + + # reverse to keep finishing order + finished.reverse() + yield from _yield_finished_futures(finished, waiter, + ref_collect=(fs, pending)) + + finally: + # Remove waiter from unfinished futures + for f in fs: + with f._condition: + f._waiters.remove(waiter) + + +DoneAndNotDoneFutures = collections.namedtuple( + 'DoneAndNotDoneFutures', 'done not_done') + + +def wait(fs, timeout=None, return_when=ALL_COMPLETED): + """Wait for the futures in the given sequence to complete. + + Args: + fs: The sequence of Futures (possibly created by different Executors) to + wait upon. + timeout: The maximum number of seconds to wait. If None, then there + is no limit on the wait time. + return_when: Indicates when this function should return. The options + are: + + FIRST_COMPLETED - Return when any future finishes or is + cancelled. + FIRST_EXCEPTION - Return when any future finishes by raising an + exception. If no future raises an exception + then it is equivalent to ALL_COMPLETED. + ALL_COMPLETED - Return when all futures finish or are cancelled. + + Returns: + A named 2-tuple of sets. The first set, named 'done', contains the + futures that completed (is finished or cancelled) before the wait + completed. The second set, named 'not_done', contains uncompleted + futures. + """ + with _AcquireFutures(fs): + done = set(f for f in fs + if f._state in [CANCELLED_AND_NOTIFIED, FINISHED]) + not_done = set(fs) - done + + if (return_when == FIRST_COMPLETED) and done: + return DoneAndNotDoneFutures(done, not_done) + elif (return_when == FIRST_EXCEPTION) and done: + if any(f for f in done + if not f.cancelled() and f.exception() is not None): + return DoneAndNotDoneFutures(done, not_done) + + if len(done) == len(fs): + return DoneAndNotDoneFutures(done, not_done) + + waiter = _create_and_install_waiters(fs, return_when) + + waiter.event.wait(timeout) + for f in fs: + with f._condition: + f._waiters.remove(waiter) + + done.update(waiter.finished_futures) + return DoneAndNotDoneFutures(done, set(fs) - done) + + +class Future(object): + """Represents the result of an asynchronous computation.""" + + def __init__(self): + """Initializes the future. Should not be called by clients.""" + self._condition = threading.Condition() + self._state = PENDING + self._result = None + self._exception = None + self._waiters = [] + self._done_callbacks = [] + + def _invoke_callbacks(self): + for callback in self._done_callbacks: + try: + callback(self) + except Exception: + LOGGER.exception('exception calling callback for %r', self) + + def __repr__(self): + with self._condition: + if self._state == FINISHED: + if self._exception: + return '<%s at %#x state=%s raised %s>' % ( + self.__class__.__name__, + id(self), + _STATE_TO_DESCRIPTION_MAP[self._state], + self._exception.__class__.__name__) + else: + return '<%s at %#x state=%s returned %s>' % ( + self.__class__.__name__, + id(self), + _STATE_TO_DESCRIPTION_MAP[self._state], + self._result.__class__.__name__) + return '<%s at %#x state=%s>' % ( + self.__class__.__name__, + id(self), + _STATE_TO_DESCRIPTION_MAP[self._state]) + + def cancel(self): + """Cancel the future if possible. + + Returns True if the future was cancelled, False otherwise. A future + cannot be cancelled if it is running or has already completed. + """ + with self._condition: + if self._state in [RUNNING, FINISHED]: + return False + + if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]: + return True + + self._state = CANCELLED + self._condition.notify_all() + + self._invoke_callbacks() + return True + + def cancelled(self): + """Return True if the future was cancelled.""" + with self._condition: + return self._state in [CANCELLED, CANCELLED_AND_NOTIFIED] + + def running(self): + """Return True if the future is currently executing.""" + with self._condition: + return self._state == RUNNING + + def done(self): + """Return True of the future was cancelled or finished executing.""" + with self._condition: + return self._state in [CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED] + + def __get_result(self): + if self._exception: + raise self._exception + else: + return self._result + + def add_done_callback(self, fn): + """Attaches a callable that will be called when the future finishes. + + Args: + fn: A callable that will be called with this future as its only + argument when the future completes or is cancelled. The callable + will always be called by a thread in the same process in which + it was added. If the future has already completed or been + cancelled then the callable will be called immediately. These + callables are called in the order that they were added. + """ + with self._condition: + if self._state not in [CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED]: + self._done_callbacks.append(fn) + return + fn(self) + + def result(self, timeout=None): + """Return the result of the call that the future represents. + + Args: + timeout: The number of seconds to wait for the result if the future + isn't done. If None, then there is no limit on the wait time. + + Returns: + The result of the call that the future represents. + + Raises: + CancelledError: If the future was cancelled. + TimeoutError: If the future didn't finish executing before the given + timeout. + Exception: If the call raised then that exception will be raised. + """ + with self._condition: + if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]: + raise CancelledError() + elif self._state == FINISHED: + return self.__get_result() + + self._condition.wait(timeout) + + if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]: + raise CancelledError() + elif self._state == FINISHED: + return self.__get_result() + else: + raise TimeoutError() + + def exception(self, timeout=None): + """Return the exception raised by the call that the future represents. + + Args: + timeout: The number of seconds to wait for the exception if the + future isn't done. If None, then there is no limit on the wait + time. + + Returns: + The exception raised by the call that the future represents or None + if the call completed without raising. + + Raises: + CancelledError: If the future was cancelled. + TimeoutError: If the future didn't finish executing before the given + timeout. + """ + + with self._condition: + if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]: + raise CancelledError() + elif self._state == FINISHED: + return self._exception + + self._condition.wait(timeout) + + if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]: + raise CancelledError() + elif self._state == FINISHED: + return self._exception + else: + raise TimeoutError() + + # The following methods should only be used by Executors and in tests. + def set_running_or_notify_cancel(self): + """Mark the future as running or process any cancel notifications. + + Should only be used by Executor implementations and unit tests. + + If the future has been cancelled (cancel() was called and returned + True) then any threads waiting on the future completing (though calls + to as_completed() or wait()) are notified and False is returned. + + If the future was not cancelled then it is put in the running state + (future calls to running() will return True) and True is returned. + + This method should be called by Executor implementations before + executing the work associated with this future. If this method returns + False then the work should not be executed. + + Returns: + False if the Future was cancelled, True otherwise. + + Raises: + RuntimeError: if this method was already called or if set_result() + or set_exception() was called. + """ + with self._condition: + if self._state == CANCELLED: + self._state = CANCELLED_AND_NOTIFIED + for waiter in self._waiters: + waiter.add_cancelled(self) + # self._condition.notify_all() is not necessary because + # self.cancel() triggers a notification. + return False + elif self._state == PENDING: + self._state = RUNNING + return True + else: + LOGGER.critical('Future %s in unexpected state: %s', + id(self), + self._state) + raise RuntimeError('Future in unexpected state') + + def set_result(self, result): + """Sets the return value of work associated with the future. + + Should only be used by Executor implementations and unit tests. + """ + with self._condition: + self._result = result + self._state = FINISHED + for waiter in self._waiters: + waiter.add_result(self) + self._condition.notify_all() + self._invoke_callbacks() + + def set_exception(self, exception): + """Sets the result of the future as being the given exception. + + Should only be used by Executor implementations and unit tests. + """ + with self._condition: + self._exception = exception + self._state = FINISHED + for waiter in self._waiters: + waiter.add_exception(self) + self._condition.notify_all() + self._invoke_callbacks() + + +class Executor(object): + """This is an abstract base class for concrete asynchronous executors.""" + + def submit(self, fn, *args, **kwargs): + """Submits a callable to be executed with the given arguments. + + Schedules the callable to be executed as fn(*args, **kwargs) and returns + a Future instance representing the execution of the callable. + + Returns: + A Future representing the given call. + """ + raise NotImplementedError() + + def map(self, fn, *iterables, timeout=None, chunksize=1): + """Returns an iterator equivalent to map(fn, iter). + + Args: + fn: A callable that will take as many arguments as there are + passed iterables. + timeout: The maximum number of seconds to wait. If None, then there + is no limit on the wait time. + chunksize: The size of the chunks the iterable will be broken into + before being passed to a child process. This argument is only + used by ProcessPoolExecutor; it is ignored by + ThreadPoolExecutor. + + Returns: + An iterator equivalent to: map(func, *iterables) but the calls may + be evaluated out-of-order. + + Raises: + TimeoutError: If the entire result iterator could not be generated + before the given timeout. + Exception: If fn(*args) raises for any values. + """ + if timeout is not None: + end_time = timeout + time.time() + + fs = [self.submit(fn, *args) for args in zip(*iterables)] + + # Yield must be hidden in closure so that the futures are submitted + # before the first iterator value is required. + def result_iterator(): + try: + # reverse to keep finishing order + fs.reverse() + while fs: + # Careful not to keep a reference to the popped future + if timeout is None: + yield fs.pop().result() + else: + yield fs.pop().result(end_time - time.time()) + finally: + for future in fs: + future.cancel() + return result_iterator() + + def shutdown(self, wait=True): + """Clean-up the resources associated with the Executor. + + It is safe to call this method several times. Otherwise, no other + methods can be called after this one. + + Args: + wait: If True then shutdown will not return until all running + futures have finished executing and the resources used by the + executor have been reclaimed. + """ + pass + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.shutdown(wait=True) + return False diff --git a/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/concurrent/futures/process.py b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/concurrent/futures/process.py new file mode 100644 index 0000000..33ff7ba --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/concurrent/futures/process.py @@ -0,0 +1,535 @@ +# Copyright 2009 Brian Quinlan. All Rights Reserved. +# Licensed to PSF under a Contributor Agreement. + +"""Implements ProcessPoolExecutor. + +The follow diagram and text describe the data-flow through the system: + +|======================= In-process =====================|== Out-of-process ==| + ++----------+ +----------+ +--------+ +-----------+ +---------+ +| | => | Work Ids | => | | => | Call Q | => | | +| | +----------+ | | +-----------+ | | +| | | ... | | | | ... | | | +| | | 6 | | | | 5, call() | | | +| | | 7 | | | | ... | | | +| Process | | ... | | Local | +-----------+ | Process | +| Pool | +----------+ | Worker | | #1..n | +| Executor | | Thread | | | +| | +----------- + | | +-----------+ | | +| | <=> | Work Items | <=> | | <= | Result Q | <= | | +| | +------------+ | | +-----------+ | | +| | | 6: call() | | | | ... | | | +| | | future | | | | 4, result | | | +| | | ... | | | | 3, except | | | ++----------+ +------------+ +--------+ +-----------+ +---------+ + +Executor.submit() called: +- creates a uniquely numbered _WorkItem and adds it to the "Work Items" dict +- adds the id of the _WorkItem to the "Work Ids" queue + +Local worker thread: +- reads work ids from the "Work Ids" queue and looks up the corresponding + WorkItem from the "Work Items" dict: if the work item has been cancelled then + it is simply removed from the dict, otherwise it is repackaged as a + _CallItem and put in the "Call Q". New _CallItems are put in the "Call Q" + until "Call Q" is full. NOTE: the size of the "Call Q" is kept small because + calls placed in the "Call Q" can no longer be cancelled with Future.cancel(). +- reads _ResultItems from "Result Q", updates the future stored in the + "Work Items" dict and deletes the dict entry + +Process #1..n: +- reads _CallItems from "Call Q", executes the calls, and puts the resulting + _ResultItems in "Result Q" +""" + +__author__ = 'Brian Quinlan (brian@sweetapp.com)' + +import atexit +import os +from concurrent.futures import _base +import queue +from queue import Full +import multiprocessing +from multiprocessing import SimpleQueue +from multiprocessing.connection import wait +import threading +import weakref +from functools import partial +import itertools +import traceback + +# Workers are created as daemon threads and processes. This is done to allow the +# interpreter to exit when there are still idle processes in a +# ProcessPoolExecutor's process pool (i.e. shutdown() was not called). However, +# allowing workers to die with the interpreter has two undesirable properties: +# - The workers would still be running during interpreter shutdown, +# meaning that they would fail in unpredictable ways. +# - The workers could be killed while evaluating a work item, which could +# be bad if the callable being evaluated has external side-effects e.g. +# writing to a file. +# +# To work around this problem, an exit handler is installed which tells the +# workers to exit when their work queues are empty and then waits until the +# threads/processes finish. + +_threads_queues = weakref.WeakKeyDictionary() +_shutdown = False + + +def _python_exit(): + global _shutdown + _shutdown = True + items = list(_threads_queues.items()) + for t, q in items: + q.put(None) + for t, q in items: + t.join() + + +# Controls how many more calls than processes will be queued in the call queue. +# A smaller number will mean that processes spend more time idle waiting for +# work while a larger number will make Future.cancel() succeed less frequently +# (Futures in the call queue cannot be cancelled). +EXTRA_QUEUED_CALLS = 1 + +# Hack to embed stringification of remote traceback in local traceback + + +class _RemoteTraceback(Exception): + def __init__(self, tb): + self.tb = tb + + def __str__(self): + return self.tb + + +class _ExceptionWithTraceback: + def __init__(self, exc, tb): + tb = traceback.format_exception(type(exc), exc, tb) + tb = ''.join(tb) + self.exc = exc + self.tb = '\n"""\n%s"""' % tb + + def __reduce__(self): + return _rebuild_exc, (self.exc, self.tb) + + +def _rebuild_exc(exc, tb): + exc.__cause__ = _RemoteTraceback(tb) + return exc + + +class _WorkItem(object): + def __init__(self, future, fn, args, kwargs): + self.future = future + self.fn = fn + self.args = args + self.kwargs = kwargs + + +class _ResultItem(object): + def __init__(self, work_id, exception=None, result=None): + self.work_id = work_id + self.exception = exception + self.result = result + + +class _CallItem(object): + def __init__(self, work_id, fn, args, kwargs): + self.work_id = work_id + self.fn = fn + self.args = args + self.kwargs = kwargs + + +def _get_chunks(*iterables, chunksize): + """ Iterates over zip()ed iterables in chunks. """ + it = zip(*iterables) + while True: + chunk = tuple(itertools.islice(it, chunksize)) + if not chunk: + return + yield chunk + + +def _process_chunk(fn, chunk): + """ Processes a chunk of an iterable passed to map. + + Runs the function passed to map() on a chunk of the + iterable passed to map. + + This function is run in a separate process. + + """ + return [fn(*args) for args in chunk] + + +def _process_worker(call_queue, result_queue): + """Evaluates calls from call_queue and places the results in result_queue. + + This worker is run in a separate process. + + Args: + call_queue: A multiprocessing.Queue of _CallItems that will be read and + evaluated by the worker. + result_queue: A multiprocessing.Queue of _ResultItems that will written + to by the worker. + shutdown: A multiprocessing.Event that will be set as a signal to the + worker that it should exit when call_queue is empty. + """ + while True: + call_item = call_queue.get(block=True) + if call_item is None: + # Wake up queue management thread + result_queue.put(os.getpid()) + return + try: + r = call_item.fn(*call_item.args, **call_item.kwargs) + except BaseException as e: + exc = _ExceptionWithTraceback(e, e.__traceback__) + result_queue.put(_ResultItem(call_item.work_id, exception=exc)) + else: + result_queue.put(_ResultItem(call_item.work_id, + result=r)) + + +def _add_call_item_to_queue(pending_work_items, + work_ids, + call_queue): + """Fills call_queue with _WorkItems from pending_work_items. + + This function never blocks. + + Args: + pending_work_items: A dict mapping work ids to _WorkItems e.g. + {5: <_WorkItem...>, 6: <_WorkItem...>, ...} + work_ids: A queue.Queue of work ids e.g. Queue([5, 6, ...]). Work ids + are consumed and the corresponding _WorkItems from + pending_work_items are transformed into _CallItems and put in + call_queue. + call_queue: A multiprocessing.Queue that will be filled with _CallItems + derived from _WorkItems. + """ + while True: + if call_queue.full(): + return + try: + work_id = work_ids.get(block=False) + except queue.Empty: + return + else: + work_item = pending_work_items[work_id] + + if work_item.future.set_running_or_notify_cancel(): + call_queue.put(_CallItem(work_id, + work_item.fn, + work_item.args, + work_item.kwargs), + block=True) + else: + del pending_work_items[work_id] + continue + + +def _queue_management_worker(executor_reference, + processes, + pending_work_items, + work_ids_queue, + call_queue, + result_queue): + """Manages the communication between this process and the worker processes. + + This function is run in a local thread. + + Args: + executor_reference: A weakref.ref to the ProcessPoolExecutor that owns + this thread. Used to determine if the ProcessPoolExecutor has been + garbage collected and that this function can exit. + process: A list of the multiprocessing.Process instances used as + workers. + pending_work_items: A dict mapping work ids to _WorkItems e.g. + {5: <_WorkItem...>, 6: <_WorkItem...>, ...} + work_ids_queue: A queue.Queue of work ids e.g. Queue([5, 6, ...]). + call_queue: A multiprocessing.Queue that will be filled with _CallItems + derived from _WorkItems for processing by the process workers. + result_queue: A multiprocessing.Queue of _ResultItems generated by the + process workers. + """ + executor = None + + def shutting_down(): + return _shutdown or executor is None or executor._shutdown_thread + + def shutdown_worker(): + # This is an upper bound + nb_children_alive = sum(p.is_alive() for p in processes.values()) + for i in range(0, nb_children_alive): + call_queue.put_nowait(None) + # Release the queue's resources as soon as possible. + call_queue.close() + # If .join() is not called on the created processes then + # some multiprocessing.Queue methods may deadlock on Mac OS X. + for p in processes.values(): + p.join() + + reader = result_queue._reader + + while True: + _add_call_item_to_queue(pending_work_items, + work_ids_queue, + call_queue) + + sentinels = [p.sentinel for p in processes.values()] + assert sentinels + ready = wait([reader] + sentinels) + if reader in ready: + result_item = reader.recv() + else: + # Mark the process pool broken so that submits fail right now. + executor = executor_reference() + if executor is not None: + executor._broken = True + executor._shutdown_thread = True + executor = None + # All futures in flight must be marked failed + for work_id, work_item in pending_work_items.items(): + work_item.future.set_exception( + BrokenProcessPool( + "A process in the process pool was " + "terminated abruptly while the future was " + "running or pending." + )) + # Delete references to object. See issue16284 + del work_item + pending_work_items.clear() + # Terminate remaining workers forcibly: the queues or their + # locks may be in a dirty state and block forever. + for p in processes.values(): + p.terminate() + shutdown_worker() + return + if isinstance(result_item, int): + # Clean shutdown of a worker using its PID + # (avoids marking the executor broken) + assert shutting_down() + p = processes.pop(result_item) + p.join() + if not processes: + shutdown_worker() + return + elif result_item is not None: + work_item = pending_work_items.pop(result_item.work_id, None) + # work_item can be None if another process terminated (see above) + if work_item is not None: + if result_item.exception: + work_item.future.set_exception(result_item.exception) + else: + work_item.future.set_result(result_item.result) + # Delete references to object. See issue16284 + del work_item + # Check whether we should start shutting down. + executor = executor_reference() + # No more work items can be added if: + # - The interpreter is shutting down OR + # - The executor that owns this worker has been collected OR + # - The executor that owns this worker has been shutdown. + if shutting_down(): + try: + # Since no new work items can be added, it is safe to shutdown + # this thread if there are no pending work items. + if not pending_work_items: + shutdown_worker() + return + except Full: + # This is not a problem: we will eventually be woken up (in + # result_queue.get()) and be able to send a sentinel again. + pass + executor = None + + +_system_limits_checked = False +_system_limited = None + + +def _check_system_limits(): + global _system_limits_checked, _system_limited + if _system_limits_checked: + if _system_limited: + raise NotImplementedError(_system_limited) + _system_limits_checked = True + try: + nsems_max = os.sysconf("SC_SEM_NSEMS_MAX") + except (AttributeError, ValueError): + # sysconf not available or setting not available + return + if nsems_max == -1: + # indetermined limit, assume that limit is determined + # by available memory only + return + if nsems_max >= 256: + # minimum number of semaphores available + # according to POSIX + return + _system_limited = "system provides too few semaphores (%d available, 256 necessary)" % nsems_max + raise NotImplementedError(_system_limited) + + +def _chain_from_iterable_of_lists(iterable): + """ + Specialized implementation of itertools.chain.from_iterable. + Each item in *iterable* should be a list. This function is + careful not to keep references to yielded objects. + """ + for element in iterable: + element.reverse() + while element: + yield element.pop() + + +class BrokenProcessPool(RuntimeError): + """ + Raised when a process in a ProcessPoolExecutor terminated abruptly + while a future was in the running state. + """ + + +class ProcessPoolExecutor(_base.Executor): + def __init__(self, max_workers=None): + """Initializes a new ProcessPoolExecutor instance. + + Args: + max_workers: The maximum number of processes that can be used to + execute the given calls. If None or not given then as many + worker processes will be created as the machine has processors. + """ + _check_system_limits() + + if max_workers is None: + self._max_workers = os.cpu_count() or 1 + else: + if max_workers <= 0: + raise ValueError("max_workers must be greater than 0") + + self._max_workers = max_workers + + # Make the call queue slightly larger than the number of processes to + # prevent the worker processes from idling. But don't make it too big + # because futures in the call queue cannot be cancelled. + self._call_queue = multiprocessing.Queue(self._max_workers + + EXTRA_QUEUED_CALLS) + # Killed worker processes can produce spurious "broken pipe" + # tracebacks in the queue's own worker thread. But we detect killed + # processes anyway, so silence the tracebacks. + self._call_queue._ignore_epipe = True + self._result_queue = SimpleQueue() + self._work_ids = queue.Queue() + self._queue_management_thread = None + # Map of pids to processes + self._processes = {} + + # Shutdown is a two-step process. + self._shutdown_thread = False + self._shutdown_lock = threading.Lock() + self._broken = False + self._queue_count = 0 + self._pending_work_items = {} + + def _start_queue_management_thread(self): + # When the executor gets lost, the weakref callback will wake up + # the queue management thread. + def weakref_cb(_, q=self._result_queue): + q.put(None) + if self._queue_management_thread is None: + # Start the processes so that their sentinels are known. + self._adjust_process_count() + self._queue_management_thread = threading.Thread( + target=_queue_management_worker, + args=(weakref.ref(self, weakref_cb), + self._processes, + self._pending_work_items, + self._work_ids, + self._call_queue, + self._result_queue)) + self._queue_management_thread.daemon = True + self._queue_management_thread.start() + _threads_queues[self._queue_management_thread] = self._result_queue + + def _adjust_process_count(self): + for _ in range(len(self._processes), self._max_workers): + p = multiprocessing.Process( + target=_process_worker, + args=(self._call_queue, + self._result_queue)) + p.start() + self._processes[p.pid] = p + + def submit(self, fn, *args, **kwargs): + with self._shutdown_lock: + if self._broken: + raise BrokenProcessPool('A child process terminated ' + 'abruptly, the process pool is not usable anymore') + if self._shutdown_thread: + raise RuntimeError( + 'cannot schedule new futures after shutdown') + + f = _base.Future() + w = _WorkItem(f, fn, args, kwargs) + + self._pending_work_items[self._queue_count] = w + self._work_ids.put(self._queue_count) + self._queue_count += 1 + # Wake up queue management thread + self._result_queue.put(None) + + self._start_queue_management_thread() + return f + submit.__doc__ = _base.Executor.submit.__doc__ + + def map(self, fn, *iterables, timeout=None, chunksize=1): + """Returns an iterator equivalent to map(fn, iter). + + Args: + fn: A callable that will take as many arguments as there are + passed iterables. + timeout: The maximum number of seconds to wait. If None, then there + is no limit on the wait time. + chunksize: If greater than one, the iterables will be chopped into + chunks of size chunksize and submitted to the process pool. + If set to one, the items in the list will be sent one at a time. + + Returns: + An iterator equivalent to: map(func, *iterables) but the calls may + be evaluated out-of-order. + + Raises: + TimeoutError: If the entire result iterator could not be generated + before the given timeout. + Exception: If fn(*args) raises for any values. + """ + if chunksize < 1: + raise ValueError("chunksize must be >= 1.") + + results = super().map(partial(_process_chunk, fn), + _get_chunks(*iterables, chunksize=chunksize), + timeout=timeout) + return _chain_from_iterable_of_lists(results) + + def shutdown(self, wait=True): + with self._shutdown_lock: + self._shutdown_thread = True + if self._queue_management_thread: + # Wake up queue management thread + self._result_queue.put(None) + if wait: + self._queue_management_thread.join() + # To reduce the risk of opening too many files, remove references to + # objects that use file descriptors. + self._queue_management_thread = None + self._call_queue = None + self._result_queue = None + self._processes = None + shutdown.__doc__ = _base.Executor.shutdown.__doc__ + + +atexit.register(_python_exit) diff --git a/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/concurrent/futures/thread.py b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/concurrent/futures/thread.py new file mode 100644 index 0000000..e34ad63 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/concurrent/futures/thread.py @@ -0,0 +1,159 @@ +# Copyright 2009 Brian Quinlan. All Rights Reserved. +# Licensed to PSF under a Contributor Agreement. + +"""Implements ThreadPoolExecutor.""" + +__author__ = 'Brian Quinlan (brian@sweetapp.com)' + +import atexit +from concurrent.futures import _base +import itertools +import queue +import threading +import weakref +import os + +# Workers are created as daemon threads. This is done to allow the interpreter +# to exit when there are still idle threads in a ThreadPoolExecutor's thread +# pool (i.e. shutdown() was not called). However, allowing workers to die with +# the interpreter has two undesirable properties: +# - The workers would still be running during interpreter shutdown, +# meaning that they would fail in unpredictable ways. +# - The workers could be killed while evaluating a work item, which could +# be bad if the callable being evaluated has external side-effects e.g. +# writing to a file. +# +# To work around this problem, an exit handler is installed which tells the +# workers to exit when their work queues are empty and then waits until the +# threads finish. + +_threads_queues = weakref.WeakKeyDictionary() +_shutdown = False + + +def _python_exit(): + global _shutdown + _shutdown = True + items = list(_threads_queues.items()) + for t, q in items: + q.put(None) + for t, q in items: + t.join() + + +atexit.register(_python_exit) + + +class _WorkItem(object): + def __init__(self, future, fn, args, kwargs): + self.future = future + self.fn = fn + self.args = args + self.kwargs = kwargs + + def run(self): + if not self.future.set_running_or_notify_cancel(): + return + + try: + result = self.fn(*self.args, **self.kwargs) + except BaseException as exc: + self.future.set_exception(exc) + # Break a reference cycle with the exception 'exc' + self = None + else: + self.future.set_result(result) + + +def _worker(executor_reference, work_queue): + try: + while True: + work_item = work_queue.get(block=True) + if work_item is not None: + work_item.run() + # Delete references to object. See issue16284 + del work_item + continue + executor = executor_reference() + # Exit if: + # - The interpreter is shutting down OR + # - The executor that owns the worker has been collected OR + # - The executor that owns the worker has been shutdown. + if _shutdown or executor is None or executor._shutdown: + # Notice other workers + work_queue.put(None) + return + del executor + except BaseException: + _base.LOGGER.critical('Exception in worker', exc_info=True) + + +class ThreadPoolExecutor(_base.Executor): + + # Used to assign unique thread names when thread_name_prefix is not supplied. + _counter = itertools.count().__next__ + + def __init__(self, max_workers=None, thread_name_prefix=''): + """Initializes a new ThreadPoolExecutor instance. + + Args: + max_workers: The maximum number of threads that can be used to + execute the given calls. + thread_name_prefix: An optional name prefix to give our threads. + """ + if max_workers is None: + # Use this number because ThreadPoolExecutor is often + # used to overlap I/O instead of CPU work. + max_workers = (os.cpu_count() or 1) * 5 + if max_workers <= 0: + raise ValueError("max_workers must be greater than 0") + + self._max_workers = max_workers + self._work_queue = queue.Queue() + self._threads = set() + self._shutdown = False + self._shutdown_lock = threading.Lock() + self._thread_name_prefix = (thread_name_prefix or + ("ThreadPoolExecutor-%d" % self._counter())) + + def submit(self, fn, *args, **kwargs): + with self._shutdown_lock: + if self._shutdown: + raise RuntimeError( + 'cannot schedule new futures after shutdown') + + f = _base.Future() + w = _WorkItem(f, fn, args, kwargs) + + self._work_queue.put(w) + self._adjust_thread_count() + return f + submit.__doc__ = _base.Executor.submit.__doc__ + + def _adjust_thread_count(self): + # When the executor gets lost, the weakref callback will wake up + # the worker threads. + def weakref_cb(_, q=self._work_queue): + q.put(None) + # TODO(bquinlan): Should avoid creating new threads if there are more + # idle threads than items in the work queue. + num_threads = len(self._threads) + if num_threads < self._max_workers: + thread_name = '%s_%d' % (self._thread_name_prefix or self, + num_threads) + t = threading.Thread(name=thread_name, target=_worker, + args=(weakref.ref(self, weakref_cb), + self._work_queue)) + t.daemon = True + t.start() + self._threads.add(t) + _threads_queues[t] = self._work_queue + + def shutdown(self, wait=True): + with self._shutdown_lock: + self._shutdown = True + self._work_queue.put(None) + if wait: + for t in self._threads: + t.join() + shutdown.__doc__ = _base.Executor.shutdown.__doc__ diff --git a/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/config-3.6m-x86_64-linux-gnu/python-config.py b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/config-3.6m-x86_64-linux-gnu/python-config.py new file mode 100755 index 0000000..b5dde63 --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/config-3.6m-x86_64-linux-gnu/python-config.py @@ -0,0 +1,71 @@ +#!/private/home/oteytaud/newtasks/src_cpp/elfgames/tasks/elf2codingenv/bin/python3.6m +# -*- python -*- + +# Keep this script in sync with python-config.sh.in + +import getopt +import os +import sys +import sysconfig + +valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags', + 'ldflags', 'extension-suffix', 'help', 'abiflags', 'configdir'] + + +def exit_with_usage(code=1): + print("Usage: {0} [{1}]".format( + sys.argv[0], '|'.join('--'+opt for opt in valid_opts)), file=sys.stderr) + sys.exit(code) + + +try: + opts, args = getopt.getopt(sys.argv[1:], '', valid_opts) +except getopt.error: + exit_with_usage() + +if not opts: + exit_with_usage() + +pyver = sysconfig.get_config_var('VERSION') +getvar = sysconfig.get_config_var + +opt_flags = [flag for (flag, val) in opts] + +if '--help' in opt_flags: + exit_with_usage(code=0) + +for opt in opt_flags: + if opt == '--prefix': + print(sysconfig.get_config_var('prefix')) + + elif opt == '--exec-prefix': + print(sysconfig.get_config_var('exec_prefix')) + + elif opt in ('--includes', '--cflags'): + flags = ['-I' + sysconfig.get_path('include'), + '-I' + sysconfig.get_path('platinclude')] + if opt == '--cflags': + flags.extend(getvar('CFLAGS').split()) + print(' '.join(flags)) + + elif opt in ('--libs', '--ldflags'): + libs = ['-lpython' + pyver + sys.abiflags] + libs += getvar('LIBS').split() + libs += getvar('SYSLIBS').split() + # add the prefix/lib/pythonX.Y/config dir, but only if there is no + # shared library in prefix/lib/. + if opt == '--ldflags': + if not getvar('Py_ENABLE_SHARED'): + libs.insert(0, '-L' + getvar('LIBPL')) + if not getvar('PYTHONFRAMEWORK'): + libs.extend(getvar('LINKFORSHARED').split()) + print(' '.join(libs)) + + elif opt == '--extension-suffix': + print(sysconfig.get_config_var('EXT_SUFFIX')) + + elif opt == '--abiflags': + print(sys.abiflags) + + elif opt == '--configdir': + print(sysconfig.get_config_var('LIBPL')) diff --git a/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/configparser.py b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/configparser.py new file mode 100644 index 0000000..919ac2d --- /dev/null +++ b/src_cpp/elfgames/tasks/elf2codingenv/lib/python3.6/configparser.py @@ -0,0 +1,1342 @@ +"""Configuration file parser. + +A configuration file consists of sections, lead by a "[section]" header, +and followed by "name: value" entries, with continuations and such in +the style of RFC 822. + +Intrinsic defaults can be specified by passing them into the +ConfigParser constructor as a dictionary. + +class: + +ConfigParser -- responsible for parsing a list of + configuration files, and managing the parsed database. + + methods: + + __init__(defaults=None, dict_type=_default_dict, allow_no_value=False, + delimiters=('=', ':'), comment_prefixes=('#', ';'), + inline_comment_prefixes=None, strict=True, + empty_lines_in_values=True, default_section='DEFAULT', + interpolation=, converters=): + Create the parser. When `defaults' is given, it is initialized into the + dictionary or intrinsic defaults. The keys must be strings, the values + must be appropriate for %()s string interpolation. + + When `dict_type' is given, it will be used to create the dictionary + objects for the list of sections, for the options within a section, and + for the default values. + + When `delimiters' is given, it will be used as the set of substrings + that divide keys from values. + + When `comment_prefixes' is given, it will be used as the set of + substrings that prefix comments in empty lines. Comments can be + indented. + + When `inline_comment_prefixes' is given, it will be used as the set of + substrings that prefix comments in non-empty lines. + + When `strict` is True, the parser won't allow for any section or option + duplicates while reading from a single source (file, string or + dictionary). Default is True. + + When `empty_lines_in_values' is False (default: True), each empty line + marks the end of an option. Otherwise, internal empty lines of + a multiline option are kept as part of the value. + + When `allow_no_value' is True (default: False), options without + values are accepted; the value presented for these is None. + + When `default_section' is given, the name of the special section is + named accordingly. By default it is called ``"DEFAULT"`` but this can + be customized to point to any other valid section name. Its current + value can be retrieved using the ``parser_instance.default_section`` + attribute and may be modified at runtime. + + When `interpolation` is given, it should be an Interpolation subclass + instance. It will be used as the handler for option value + pre-processing when using getters. RawConfigParser object s don't do + any sort of interpolation, whereas ConfigParser uses an instance of + BasicInterpolation. The library also provides a ``zc.buildbot`` + inspired ExtendedInterpolation implementation. + + When `converters` is given, it should be a dictionary where each key + represents the name of a type converter and each value is a callable + implementing the conversion from string to the desired datatype. Every + converter gets its corresponding get*() method on the parser object and + section proxies. + + sections() + Return all the configuration section names, sans DEFAULT. + + has_section(section) + Return whether the given section exists. + + has_option(section, option) + Return whether the given option exists in the given section. + + options(section) + Return list of configuration options for the named section. + + read(filenames, encoding=None) + Read and parse the list of named configuration files, given by + name. A single filename is also allowed. Non-existing files + are ignored. Return list of successfully read files. + + read_file(f, filename=None) + Read and parse one configuration file, given as a file object. + The filename defaults to f.name; it is only used in error + messages (if f has no `name' attribute, the string `' is used). + + read_string(string) + Read configuration from a given string. + + read_dict(dictionary) + Read configuration from a dictionary. Keys are section names, + values are dictionaries with keys and values that should be present + in the section. If the used dictionary type preserves order, sections + and their keys will be added in order. Values are automatically + converted to strings. + + get(section, option, raw=False, vars=None, fallback=_UNSET) + Return a string value for the named option. All % interpolations are + expanded in the return values, based on the defaults passed into the + constructor and the DEFAULT section. Additional substitutions may be + provided using the `vars' argument, which must be a dictionary whose + contents override any pre-existing defaults. If `option' is a key in + `vars', the value from `vars' is used. + + getint(section, options, raw=False, vars=None, fallback=_UNSET) + Like get(), but convert value to an integer. + + getfloat(section, options, raw=False, vars=None, fallback=_UNSET) + Like get(), but convert value to a float. + + getboolean(section, options, raw=False, vars=None, fallback=_UNSET) + Like get(), but convert value to a boolean (currently case + insensitively defined as 0, false, no, off for False, and 1, true, + yes, on for True). Returns False or True. + + items(section=_UNSET, raw=False, vars=None) + If section is given, return a list of tuples with (name, value) for + each option in the section. Otherwise, return a list of tuples with + (section_name, section_proxy) for each section, including DEFAULTSECT. + + remove_section(section) + Remove the given file section and all its options. + + remove_option(section, option) + Remove the given option from the given section. + + set(section, option, value) + Set the given option. + + write(fp, space_around_delimiters=True) + Write the configuration state in .ini format. If + `space_around_delimiters' is True (the default), delimiters + between keys and values are surrounded by spaces. +""" + +from collections.abc import MutableMapping +from collections import OrderedDict as _default_dict, ChainMap as _ChainMap +import functools +import io +import itertools +import os +import re +import sys +import warnings + +__all__ = ["NoSectionError", "DuplicateOptionError", "DuplicateSectionError", + "NoOptionError", "InterpolationError", "InterpolationDepthError", + "InterpolationMissingOptionError", "InterpolationSyntaxError", + "ParsingError", "MissingSectionHeaderError", + "ConfigParser", "SafeConfigParser", "RawConfigParser", + "Interpolation", "BasicInterpolation", "ExtendedInterpolation", + "LegacyInterpolation", "SectionProxy", "ConverterMapping", + "DEFAULTSECT", "MAX_INTERPOLATION_DEPTH"] + +DEFAULTSECT = "DEFAULT" + +MAX_INTERPOLATION_DEPTH = 10 + + +# exception classes +class Error(Exception): + """Base class for ConfigParser exceptions.""" + + def __init__(self, msg=''): + self.message = msg + Exception.__init__(self, msg) + + def __repr__(self): + return self.message + + __str__ = __repr__ + + +class NoSectionError(Error): + """Raised when no section matches a requested option.""" + + def __init__(self, section): + Error.__init__(self, 'No section: %r' % (section,)) + self.section = section + self.args = (section, ) + + +class DuplicateSectionError(Error): + """Raised when a section is repeated in an input source. + + Possible repetitions that raise this exception are: multiple creation + using the API or in strict parsers when a section is found more than once + in a single input file, string or dictionary. + """ + + def __init__(self, section, source=None, lineno=None): + msg = [repr(section), " already exists"] + if source is not None: + message = ["While reading from ", repr(source)] + if lineno is not None: + message.append(" [line {0:2d}]".format(lineno)) + message.append(": section ") + message.extend(msg) + msg = message + else: + msg.insert(0, "Section ") + Error.__init__(self, "".join(msg)) + self.section = section + self.source = source + self.lineno = lineno + self.args = (section, source, lineno) + + +class DuplicateOptionError(Error): + """Raised by strict parsers when an option is repeated in an input source. + + Current implementation raises this exception only when an option is found + more than once in a single file, string or dictionary. + """ + + def __init__(self, section, option, source=None, lineno=None): + msg = [repr(option), " in section ", repr(section), + " already exists"] + if source is not None: + message = ["While reading from ", repr(source)] + if lineno is not None: + message.append(" [line {0:2d}]".format(lineno)) + message.append(": option ") + message.extend(msg) + msg = message + else: + msg.insert(0, "Option ") + Error.__init__(self, "".join(msg)) + self.section = section + self.option = option + self.source = source + self.lineno = lineno + self.args = (section, option, source, lineno) + + +class NoOptionError(Error): + """A requested option was not found.""" + + def __init__(self, option, section): + Error.__init__(self, "No option %r in section: %r" % + (option, section)) + self.option = option + self.section = section + self.args = (option, section) + + +class InterpolationError(Error): + """Base class for interpolation-related exceptions.""" + + def __init__(self, option, section, msg): + Error.__init__(self, msg) + self.option = option + self.section = section + self.args = (option, section, msg) + + +class InterpolationMissingOptionError(InterpolationError): + """A string substitution required a setting which was not available.""" + + def __init__(self, option, section, rawval, reference): + msg = ("Bad value substitution: option {!r} in section {!r} contains " + "an interpolation key {!r} which is not a valid option name. " + "Raw value: {!r}".format(option, section, reference, rawval)) + InterpolationError.__init__(self, option, section, msg) + self.reference = reference + self.args = (option, section, rawval, reference) + + +class InterpolationSyntaxError(InterpolationError): + """Raised when the source text contains invalid syntax. + + Current implementation raises this exception when the source text into + which substitutions are made does not conform to the required syntax. + """ + + +class InterpolationDepthError(InterpolationError): + """Raised when substitutions are nested too deeply.""" + + def __init__(self, option, section, rawval): + msg = ("Recursion limit exceeded in value substitution: option {!r} " + "in section {!r} contains an interpolation key which " + "cannot be substituted in {} steps. Raw value: {!r}" + "".format(option, section, MAX_INTERPOLATION_DEPTH, + rawval)) + InterpolationError.__init__(self, option, section, msg) + self.args = (option, section, rawval) + + +class ParsingError(Error): + """Raised when a configuration file does not follow legal syntax.""" + + def __init__(self, source=None, filename=None): + # Exactly one of `source'/`filename' arguments has to be given. + # `filename' kept for compatibility. + if filename and source: + raise ValueError("Cannot specify both `filename' and `source'. " + "Use `source'.") + elif not filename and not source: + raise ValueError("Required argument `source' not given.") + elif filename: + source = filename + Error.__init__(self, 'Source contains parsing errors: %r' % source) + self.source = source + self.errors = [] + self.args = (source, ) + + @property + def filename(self): + """Deprecated, use `source'.""" + warnings.warn( + "The 'filename' attribute will be removed in future versions. " + "Use 'source' instead.", + DeprecationWarning, stacklevel=2 + ) + return self.source + + @filename.setter + def filename(self, value): + """Deprecated, user `source'.""" + warnings.warn( + "The 'filename' attribute will be removed in future versions. " + "Use 'source' instead.", + DeprecationWarning, stacklevel=2 + ) + self.source = value + + def append(self, lineno, line): + self.errors.append((lineno, line)) + self.message += '\n\t[line %2d]: %s' % (lineno, line) + + +class MissingSectionHeaderError(ParsingError): + """Raised when a key-value pair is found before any section header.""" + + def __init__(self, filename, lineno, line): + Error.__init__( + self, + 'File contains no section headers.\nfile: %r, line: %d\n%r' % + (filename, lineno, line)) + self.source = filename + self.lineno = lineno + self.line = line + self.args = (filename, lineno, line) + + +# Used in parser getters to indicate the default behaviour when a specific +# option is not found it to raise an exception. Created to enable `None' as +# a valid fallback value. +_UNSET = object() + + +class Interpolation: + """Dummy interpolation that passes the value through with no changes.""" + + def before_get(self, parser, section, option, value, defaults): + return value + + def before_set(self, parser, section, option, value): + return value + + def before_read(self, parser, section, option, value): + return value + + def before_write(self, parser, section, option, value): + return value + + +class BasicInterpolation(Interpolation): + """Interpolation as implemented in the classic ConfigParser. + + The option values can contain format strings which refer to other values in + the same section, or values in the special default section. + + For example: + + something: %(dir)s/whatever + + would resolve the "%(dir)s" to the value of dir. All reference + expansions are done late, on demand. If a user needs to use a bare % in + a configuration file, she can escape it by writing %%. Other % usage + is considered a user error and raises `InterpolationSyntaxError'.""" + + _KEYCRE = re.compile(r"%\(([^)]+)\)s") + + def before_get(self, parser, section, option, value, defaults): + L = [] + self._interpolate_some(parser, option, L, value, section, defaults, 1) + return ''.join(L) + + def before_set(self, parser, section, option, value): + tmp_value = value.replace('%%', '') # escaped percent signs + tmp_value = self._KEYCRE.sub('', tmp_value) # valid syntax + if '%' in tmp_value: + raise ValueError("invalid interpolation syntax in %r at " + "position %d" % (value, tmp_value.find('%'))) + return value + + def _interpolate_some(self, parser, option, accum, rest, section, map, + depth): + rawval = parser.get(section, option, raw=True, fallback=rest) + if depth > MAX_INTERPOLATION_DEPTH: + raise InterpolationDepthError(option, section, rawval) + while rest: + p = rest.find("%") + if p < 0: + accum.append(rest) + return + if p > 0: + accum.append(rest[:p]) + rest = rest[p:] + # p is no longer used + c = rest[1:2] + if c == "%": + accum.append("%") + rest = rest[2:] + elif c == "(": + m = self._KEYCRE.match(rest) + if m is None: + raise InterpolationSyntaxError(option, section, + "bad interpolation variable reference %r" % rest) + var = parser.optionxform(m.group(1)) + rest = rest[m.end():] + try: + v = map[var] + except KeyError: + raise InterpolationMissingOptionError( + option, section, rawval, var) from None + if "%" in v: + self._interpolate_some(parser, option, accum, v, + section, map, depth + 1) + else: + accum.append(v) + else: + raise InterpolationSyntaxError( + option, section, + "'%%' must be followed by '%%' or '(', " + "found: %r" % (rest,)) + + +class ExtendedInterpolation(Interpolation): + """Advanced variant of interpolation, supports the syntax used by + `zc.buildout'. Enables interpolation between sections.""" + + _KEYCRE = re.compile(r"\$\{([^}]+)\}") + + def before_get(self, parser, section, option, value, defaults): + L = [] + self._interpolate_some(parser, option, L, value, section, defaults, 1) + return ''.join(L) + + def before_set(self, parser, section, option, value): + tmp_value = value.replace('$$', '') # escaped dollar signs + tmp_value = self._KEYCRE.sub('', tmp_value) # valid syntax + if '$' in tmp_value: + raise ValueError("invalid interpolation syntax in %r at " + "position %d" % (value, tmp_value.find('$'))) + return value + + def _interpolate_some(self, parser, option, accum, rest, section, map, + depth): + rawval = parser.get(section, option, raw=True, fallback=rest) + if depth > MAX_INTERPOLATION_DEPTH: + raise InterpolationDepthError(option, section, rawval) + while rest: + p = rest.find("$") + if p < 0: + accum.append(rest) + return + if p > 0: + accum.append(rest[:p]) + rest = rest[p:] + # p is no longer used + c = rest[1:2] + if c == "$": + accum.append("$") + rest = rest[2:] + elif c == "{": + m = self._KEYCRE.match(rest) + if m is None: + raise InterpolationSyntaxError(option, section, + "bad interpolation variable reference %r" % rest) + path = m.group(1).split(':') + rest = rest[m.end():] + sect = section + opt = option + try: + if len(path) == 1: + opt = parser.optionxform(path[0]) + v = map[opt] + elif len(path) == 2: + sect = path[0] + opt = parser.optionxform(path[1]) + v = parser.get(sect, opt, raw=True) + else: + raise InterpolationSyntaxError( + option, section, + "More than one ':' found: %r" % (rest,)) + except (KeyError, NoSectionError, NoOptionError): + raise InterpolationMissingOptionError( + option, section, rawval, ":".join(path)) from None + if "$" in v: + self._interpolate_some(parser, opt, accum, v, sect, + dict(parser.items(sect, raw=True)), + depth + 1) + else: + accum.append(v) + else: + raise InterpolationSyntaxError( + option, section, + "'$' must be followed by '$' or '{', " + "found: %r" % (rest,)) + + +class LegacyInterpolation(Interpolation): + """Deprecated interpolation used in old versions of ConfigParser. + Use BasicInterpolation or ExtendedInterpolation instead.""" + + _KEYCRE = re.compile(r"%\(([^)]*)\)s|.") + + def before_get(self, parser, section, option, value, vars): + rawval = value + depth = MAX_INTERPOLATION_DEPTH + while depth: # Loop through this until it's done + depth -= 1 + if value and "%(" in value: + replace = functools.partial(self._interpolation_replace, + parser=parser) + value = self._KEYCRE.sub(replace, value) + try: + value = value % vars + except KeyError as e: + raise InterpolationMissingOptionError( + option, section, rawval, e.args[0]) from None + else: + break + if value and "%(" in value: + raise InterpolationDepthError(option, section, rawval) + return value + + def before_set(self, parser, section, option, value): + return value + + @staticmethod + def _interpolation_replace(match, parser): + s = match.group(1) + if s is None: + return match.group() + else: + return "%%(%s)s" % parser.optionxform(s) + + +class RawConfigParser(MutableMapping): + """ConfigParser that does not do interpolation.""" + + # Regular expressions for parsing section headers and options + _SECT_TMPL = r""" + \[ # [ + (?P
[^]]+) # very permissive! + \] # ] + """ + _OPT_TMPL = r""" + (?P