未验证 提交 719bedcf 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #2958 from taosdata/feature/os

Feature/os
......@@ -29,41 +29,30 @@ IF (TD_RANDOM_NETWORK_FAIL)
ADD_DEFINITIONS(-DTAOS_RANDOM_NETWORK_FAIL)
ENDIF ()
IF (TD_ARM)
ADD_DEFINITIONS(-D_TD_ARM_)
IF (TD_ARM_64)
ADD_DEFINITIONS(-D_TD_ARM_64_)
ENDIF ()
IF (TD_ARM_32)
ADD_DEFINITIONS(-D_TD_ARM_32_)
ENDIF ()
IF (TD_ARM_64)
ADD_DEFINITIONS(-D_TD_ARM_64_)
SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -g -fsigned-char -fpack-struct=8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
ENDIF ()
IF (TD_MIPS)
ADD_DEFINITIONS(-D_TD_MIPS_)
IF (TD_MIPS_64)
ADD_DEFINITIONS(-D_TD_MIPS_64_)
ENDIF ()
IF (TD_MIPS_32)
ADD_DEFINITIONS(-D_TD_MIPS_32_)
ENDIF ()
IF (TD_ARM_32)
ADD_DEFINITIONS(-D_TD_ARM_32_)
SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -g -fsigned-char -fpack-struct=8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
ENDIF ()
IF (TD_MIPS_64)
ADD_DEFINITIONS(-D_TD_MIPS_64_)
SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -g3 -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
ENDIF ()
IF (TD_MIPS_32)
ADD_DEFINITIONS(-D_TD_MIPS_32_)
SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -g3 -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
ENDIF ()
IF (TD_LINUX_64)
ADD_DEFINITIONS(-D_M_X64)
ADD_DEFINITIONS(-D_TD_LINUX_64)
IF (NOT TD_ARM)
#IF ((${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") OR (${CMAKE_CXX_COMPILER_ID} MATCHES "clang"))
# SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -Wno-missing-braces -fPIC -g3 -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
#ELSE ()
# SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -malign-double -g3 -gdwarf-2 -malign-stringops -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
#ENDIF ()
SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -g3 -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
ELSE ()
SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -g -fsigned-char -fpack-struct=8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
ENDIF ()
MESSAGE(STATUS "CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID})
MESSAGE(STATUS "COMMON_FLAGS: " ${COMMON_FLAGS})
SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -g3 -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
FIND_PATH(ICONV_INCLUDE_EXIST iconv.h /usr/include/ /usr/local/include/)
IF (ICONV_INCLUDE_EXIST)
......@@ -75,13 +64,17 @@ IF (TD_LINUX_32)
ADD_DEFINITIONS(-D_TD_LINUX_32)
ADD_DEFINITIONS(-DUSE_LIBICONV)
SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -g -fsigned-char -munaligned-access -fpack-struct=8 -latomic -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
IF (NOT TD_ARM)
EXIT ()
ENDIF ()
ENDIF ()
IF (TD_APLHINE)
SET(COMMON_FLAGS "${COMMON_FLAGS} -largp")
link_libraries(/usr/lib/libargp.a)
ADD_DEFINITIONS(-D_ALPINE)
ENDIF ()
IF (TD_LINUX)
ADD_DEFINITIONS(-DLINUX)
ADD_DEFINITIONS(-D_LINUX)
ADD_DEFINITIONS(-D_TD_LINUX)
ADD_DEFINITIONS(-D_REENTRANT -D__USE_POSIX -D_LIBC_REENTRANT)
......@@ -94,12 +87,9 @@ IF (TD_LINUX)
SET(GCC_COVERAGE_LINK_FLAGS "-lgcov --coverage")
SET(COMMON_FLAGS "${COMMON_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}")
ENDIF ()
ENDIF ()
IF (TD_APLHINE)
SET(COMMON_FLAGS "${COMMON_FLAGS} -largp")
link_libraries(/usr/lib/libargp.a)
ADD_DEFINITIONS(-D_ALPINE)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/cJson/inc)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/lz4/inc)
ENDIF ()
IF (TD_DARWIN_64)
......@@ -124,6 +114,11 @@ IF (TD_WINDOWS)
SET(DEBUG_FLAGS "/Zi /W3 /GL")
SET(RELEASE_FLAGS "/W0 /GL")
ENDIF ()
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/pthread)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/iconv)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/regex)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/wepoll/inc)
ENDIF ()
IF (TD_WINDOWS_64)
......@@ -136,3 +131,9 @@ IF (TD_WINDOWS_32)
ADD_DEFINITIONS(-D_TD_WINDOWS_32)
ENDIF ()
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/inc)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/os/inc)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/util/inc)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/common/inc)
MESSAGE(STATUS "CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID})
......@@ -15,44 +15,18 @@ PROJECT(TDengine)
# Set macro definitions according to os platform
SET(TD_LINUX FALSE)
SET(TD_LINUX_64 FALSE)
SET(TD_LINUX_32 FALSE)
SET(TD_ARM FALSE)
SET(TD_ARM_64 FALSE)
SET(TD_ARM_32 FALSE)
SET(TD_MIPS FALSE)
SET(TD_MIPS_64 FALSE)
SET(TD_MIPS_32 FALSE)
SET(TD_LINUX_64 FALSE)
SET(TD_LINUX_32 FALSE)
SET(TD_ARM_64 FALSE)
SET(TD_ARM_32 FALSE)
SET(TD_MIPS_64 FALSE)
SET(TD_MIPS_32 FALSE)
SET(TD_APLHINE FALSE)
SET(TD_WINDOWS FALSE)
SET(TD_WINDOWS_64 FALSE)
SET(TD_WINDOWS_32 FALSE)
SET(TD_DARWIN_64 FALSE)
SET(TD_APLHINE FALSE)
# if generate ARM version:
# cmake -DCPUTYPE=aarch32 .. or cmake -DCPUTYPE=aarch64
IF (${CPUTYPE} MATCHES "aarch32")
SET(TD_ARM TRUE)
SET(TD_ARM_32 TRUE)
SET(TD_PAGMODE_LITE TRUE)
MESSAGE(STATUS "input cpuType: aarch32")
ELSEIF (${CPUTYPE} MATCHES "aarch64")
SET(TD_ARM TRUE)
SET(TD_ARM_64 TRUE)
MESSAGE(STATUS "input cpuType: aarch64")
ELSEIF (${CPUTYPE} MATCHES "mips64")
SET(TD_MIPS TRUE)
SET(TD_MIPS_64 TRUE)
MESSAGE(STATUS "input cpuType: mips64")
ELSEIF (${CPUTYPE} MATCHES "x64")
MESSAGE(STATUS "input cpuType: x64")
ELSEIF (${CPUTYPE} MATCHES "x86")
MESSAGE(STATUS "input cpuType: x86")
ELSE ()
MESSAGE(STATUS "input cpuType unknown " ${CPUTYPE})
ENDIF ()
SET(TD_WINDOWS_64 FALSE)
SET(TD_WINDOWS_32 FALSE)
SET(TD_DARWIN FALSE)
SET(TD_DARWIN_64 FALSE)
IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
#
......@@ -68,12 +42,8 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
MESSAGE(STATUS "The current platform is Linux 64-bit")
ELSEIF (${CMAKE_SIZEOF_VOID_P} MATCHES 4)
SET(TD_LINUX_32 TRUE)
IF (TD_ARM)
MESSAGE(STATUS "The current platform is Linux 32-bit")
ELSE ()
MESSAGE(FATAL_ERROR "The current platform is Linux 32-bit, but no ARM not supported yet")
EXIT ()
ENDIF ()
MESSAGE(STATUS "The current platform is Linux 32-bit")
ELSE ()
MESSAGE(FATAL_ERROR "The current platform is Linux neither 32-bit nor 64-bit, not supported yet")
EXIT ()
......@@ -84,6 +54,7 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
MESSAGE(STATUS "The current OS is Alpine, append extra flags")
ENDIF()
ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
SET(TD_DARWIN TRUE)
IF (${CMAKE_SIZEOF_VOID_P} MATCHES 8)
SET(TD_DARWIN_64 TRUE)
MESSAGE(STATUS "The current platform is Darwin 64-bit")
......@@ -105,3 +76,25 @@ ELSE()
MESSAGE(FATAL_ERROR "The current platform is not Linux/Darwin/Windows, stop compile")
EXIT ()
ENDIF ()
# if generate ARM version:
# cmake -DCPUTYPE=aarch32 .. or cmake -DCPUTYPE=aarch64
IF (${CPUTYPE} MATCHES "aarch32")
SET(TD_LINUX TRUE)
SET(TD_ARM_32 TRUE)
MESSAGE(STATUS "input cpuType: aarch32")
ELSEIF (${CPUTYPE} MATCHES "aarch64")
SET(TD_LINUX TRUE)
SET(TD_ARM_64 TRUE)
MESSAGE(STATUS "input cpuType: aarch64")
ELSEIF (${CPUTYPE} MATCHES "mips64")
SET(TD_LINUX TRUE)
SET(TD_MIPS_64 TRUE)
MESSAGE(STATUS "input cpuType: mips64")
ELSEIF (${CPUTYPE} MATCHES "x64")
MESSAGE(STATUS "input cpuType: x64")
ELSEIF (${CPUTYPE} MATCHES "x86")
MESSAGE(STATUS "input cpuType: x86")
ELSE ()
MESSAGE(STATUS "input cpuType unknown " ${CPUTYPE})
ENDIF ()
......@@ -7,8 +7,9 @@ ADD_SUBDIRECTORY(regex)
ADD_SUBDIRECTORY(iconv)
ADD_SUBDIRECTORY(lz4)
ADD_SUBDIRECTORY(cJson)
#ADD_SUBDIRECTORY(MsvcLibX)
ADD_SUBDIRECTORY(wepoll)
ADD_SUBDIRECTORY(MsvcLibX)
IF (NOT TD_WINDOWS)
IF (TD_LINUX)
ADD_SUBDIRECTORY(MQTT-C)
ENDIF ()
\ No newline at end of file
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(TDengine)
IF (TD_WINDOWS_64)
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(FindWindowsSDK)
get_mywindowssdk_include_dirs(${WINDOWSSDK_PREFERRED_DIR} WINSDK_INCLUDE_DIR)
get_ucrt_include_dirs(${WINDOWSSDK_PREFERRED_DIR} UCRT_INCLUDE_DIR)
Add_Definitions("-DWSDKINCLUDE=${WINSDK_INCLUDE_DIR}")
include(FindMSVC)
Add_Definitions("-DMSVCINCLUDE=${VC_INCLUDE_DIR}")
IF ((NOT DEFINED UCRT_INCLUDE_DIR) OR (UCRT_INCLUDE_DIR STREQUAL "NOTFOUND"))
Message(STATUS "UCRT_INCLUDE_DIR notu found, set it to vc incude dir")
SET(UCRT_INCLUDE_DIR "${VC_INCLUDE_DIR}")
Add_Definitions("-DUCRTINCLUDE=${VC_INCLUDE_DIR}")
ELSE ()
Add_Definitions("-DUCRTINCLUDE=${UCRT_INCLUDE_DIR}")
ENDIF ()
Message(STATUS "WINSDK_INCLUDE_DIR: ${WINSDK_INCLUDE_DIR}")
Message(STATUS "UCRT_INCLUDE_DIR: ${UCRT_INCLUDE_DIR}")
Message(STATUS "VC_INCLUDE_DIR: ${VC_INCLUDE_DIR}")
INCLUDE_DIRECTORIES(include)
AUX_SOURCE_DIRECTORY(src SRC)
ADD_LIBRARY(MsvcLibXw64 ${SRC})
ENDIF ()
此差异已折叠。
:# config.DESKTOP-U79TD6T.bat generated by configure.bat on 2020/05/19 ܶ 7:49:05.47
:#
:# If changes are needeed, do not edit this file, but instead create a new script
:# called configure.YOURCHOICE.bat. This new script will be invoked automatically
:# by configure.bat while creating this file. Then your script can write extra
:# definitions, or change some of the variables before configure.bat writes them.
:#
:# Invoke configure.bat manually if anything changes in the tools config, such as
:# installing a Visual Studio update, or updating a configure.XXX.bat script.
set "HAS_STINCLUDE=1" &:# Found the System Tools global C includes
set "STINCLUDE=C:\Users\admin\Desktop\temp\MyGitHub\C\include" &:# System Tools global C includes
set "HAS_SDK_FLAGS=/DHAS_STINCLUDE=1" &:# SDK detection flags for the C compiler
SET "PF32=C:\Program Files (x86)" &:# 32-bits Program Files
SET "PF64=C:\Program Files" &:# 64-bits Program Files
SET "ARCH=AMD64" &:# PROCESSOR_ARCHITECTURE
SET "MASM=" &:# Microsoft 16-bits Assembler base path
SET "MSVC=" &:# Microsoft 16-bits Visual C++ base path
SET "MAPSYM=" &:# 16-bits debugging symbols generator
SET "VSTUDIOLONG=C:\Program Files (x86)\Microsoft Visual Studio 14.0" &:# Microsoft Visual Studio (Long path)
SET "VSTUDIO=C:\PROGRA~2\MICROS~2.0" &:# Microsoft Visual Studio (Short path)
SET "VSCOMMONLONG=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7" &:# Microsoft Visual Studio Common Files (Long path)
SET "VSCOMMON=C:\PROGRA~2\MICROS~2.0\Common7" &:# Microsoft Visual Studio Common Files (Short path)
SET "VSIDELONG=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE" &:# Microsoft Visual Studio IDE Files (Long path)
SET "VSIDE=C:\PROGRA~2\MICROS~2.0\Common7\IDE" &:# Microsoft Visual Studio IDE Files (Short path)
SET "VSTOOLSLONG=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools" &:# Microsoft Visual Studio Tools (Long paths)
SET "VSTOOLS=C:\PROGRA~2\MICROS~2.0\Common7\Tools" &:# Microsoft Visual Studio Tools (Short paths)
SET "MSVC32LONG=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC" &:# Microsoft Visual C++ 32/64 bits (Long path)
SET "MSVC32=C:\PROGRA~2\MICROS~2.0\VC" &:# Microsoft Visual C++ 32/64 bits (Short path)
SET "WIN_CP=936" &:# Windows Code Page
SET "WIN_CS=gb2312" &:# Windows Character Set
SET "DOS_CP=936" &:# DOS Code Page
SET "DOS_CS=gb2312" &:# DOS Character Set
SET "AS=" &:# Assembler
SET "CC=" &:# C compiler
SET "INCLUDE=C:\Users\admin\Desktop\temp\MyGitHub\C\include" &:# Include paths. Define USER_INCLUDE if needed.
SET "LK=" &:# Linker
SET "LIB=" &:# Libraries paths. Define USER_LIBS if needed.
SET "LB=" &:# Library manager
SET "RC=" &:# Resource compiler
SET "MT=" &:# Manifest tool
SET "DOS_CC=" &:# Microsoft Visual C++ 16-bits compiler
SET "DOS_AS=" &:# Microsoft 16-bits assembler
SET "DOS_LK=" &:# Microsoft 16-bits linker
SET "DOS_LB=" &:# Microsoft 16-bits librarian
SET "DOS_RC=" &:# Microsoft 16-bits resource compiler
SET "DOS_MT=" &:# Microsoft 16-bits manifest tool
SET "DOS_PATH=;C:\Windows\System32;C:\Windows" &:# All tools paths for 16-bits compilation
SET "DOS_VCINC=" &:# Visual C++ 16-bits compiler include dir for MsvcLibX include_next
SET "DOS_CRTINC=" &:# Visual C++ 16-bits CRT library include dir for MsvcLibX include_next
SET "DOS_INCPATH=" &:# Include paths for 16-bits compilation
SET "DOS_LIBPATH=" &:# Libraries paths for 16-bits linking
SET "DOS_WINSDK=" &:# Microsoft Windows 16-bits SDK
SET "DOS_WINSDKINC=" &:# Microsoft Windows 16-bits SDK Include directory
SET "WIN95_CC=" &:# Microsoft Visual C++ 32-bits compiler
SET "WIN95_AS=" &:# Microsoft 32-bits assembler
SET "WIN95_LK=" &:# Microsoft 32-bits linker
SET "WIN95_LB=" &:# Microsoft 32-bits librarian
SET "WIN95_RC=" &:# Microsoft 32-bits resource compiler
SET "WIN95_MT=" &:# Microsoft 32-bits manifest tool
SET "WIN95_PATH=;C:\Windows\System32;C:\Windows" &:# All tools paths for 32-bits compilation
SET "WIN95_VCINC=" &:# Visual C++ 32-bits compiler include dir for MsvcLibX include_next
SET "WIN95_CRTINC=" &:# Visual C++ 32-bits CRT library include dir for MsvcLibX include_next
SET "WIN95_INCPATH=" &:# Include paths for 32-bits compilation
SET "WIN95_LIBPATH=" &:# Libraries paths for 32-bits linking
SET "WIN95_WINSDK=" &:# Microsoft Windows 32-bits SDK
SET "WIN95_WINSDKINC=" &:# Microsoft Windows 32-bits SDK Include directory
SET "WIN32_CC="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\CL.EXE"" &:# Microsoft Visual C++ 32-bits compiler
SET "WIN32_AS="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\ML.EXE"" &:# Microsoft 32-bits assembler
SET "WIN32_LK="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\LINK.EXE"" &:# Microsoft 32-bits linker
SET "WIN32_LB="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\LIB.EXE"" &:# Microsoft 32-bits librarian
SET "WIN32_RC=" &:# Microsoft 32-bits resource compiler
SET "WIN32_MT=" &:# Microsoft 32-bits manifest tool
SET "WIN32_PATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools;C:\Windows\System32;C:\Windows" &:# All tools paths for 32-bits compilation
SET "WIN32_VCINC=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include" &:# Visual C++ 32-bits compiler include dir for MsvcLibX include_next
SET "WIN32_CRTINC=C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt" &:# Visual C++ 32-bits CRT library include dir for MsvcLibX include_next
SET "WIN32_INCPATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include;:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\winrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\winrt" &:# Include paths for 32-bits compilation
SET "WIN32_LIBPATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x86" &:# Libraries paths for 32-bits linking
SET "WIN32_WINSDK=C:\Program Files (x86)\Windows Kits\10" &:# Microsoft Windows 32-bits SDK
SET "WIN32_WINSDKINC=C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0" &:# Microsoft Windows 32-bits SDK Include directory
SET "IA64_CC=" &:# Microsoft Visual C++ IA64 compiler
SET "IA64_AS=" &:# Microsoft IA64 assembler
SET "IA64_LK=" &:# Microsoft IA64 linker
SET "IA64_LB=" &:# Microsoft IA64 librarian
SET "IA64_RC=" &:# Microsoft IA64 resource compiler
SET "IA64_MT=" &:# Microsoft IA64 manifest tool
SET "IA64_PATH=;C:\Windows\System32;C:\Windows" &:# All tools paths for IA64 compilation
SET "IA64_VCINC=" &:# Visual C++ IA64 compiler include dir for MsvcLibX include_next
SET "IA64_CRTINC=" &:# Visual C++ IA64 CRT library include dir for MsvcLibX include_next
SET "IA64_INCPATH=" &:# Include paths for IA64 compilation
SET "IA64_LIBPATH=" &:# Libraries paths for IA64 linking
SET "IA64_WINSDK=" &:# Microsoft Windows IA64 SDK
SET "IA64_WINSDKINC=" &:# Microsoft Windows IA64 SDK Include directory
SET "WIN64_CC="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\CL.EXE"" &:# Microsoft Visual C++ 64-bits compiler
SET "WIN64_AS="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\ML64.EXE"" &:# Microsoft 64-bits assembler
SET "WIN64_LK="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\LINK.EXE"" &:# Microsoft 64-bits linker
SET "WIN64_LB="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\LIB.EXE"" &:# Microsoft 64-bits librarian
SET "WIN64_RC=" &:# Microsoft 64-bits resource compiler
SET "WIN64_MT=" &:# Microsoft 64-bits manifest tool
SET "WIN64_PATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools;C:\Windows\System32;C:\Windows" &:# All tools paths for 64-bits compilation
SET "WIN64_VCINC=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include" &:# Visual C++ 64-bits compiler include dir for MsvcLibX include_next
SET "WIN64_CRTINC=C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt" &:# Visual C++ 64-bits CRT library include dir for MsvcLibX include_next
SET "WIN64_INCPATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include;:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\winrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\winrt" &:# Include paths for 64-bits compilation
SET "WIN64_LIBPATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\amd64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64" &:# Libraries paths for 64-bits linking
SET "WIN64_WINSDK=C:\Program Files (x86)\Windows Kits\10" &:# Microsoft Windows 64-bits SDK
SET "WIN64_WINSDKINC=C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0" &:# Microsoft Windows 64-bits SDK Include directory
SET "ARM_CC="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64_arm\CL.EXE"" &:# Microsoft Visual C++ ARM compiler
SET "ARM_AS="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64_arm\ARMASM.EXE"" &:# Microsoft ARM assembler
SET "ARM_LK="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64_arm\LINK.EXE"" &:# Microsoft ARM linker
SET "ARM_LB="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64_arm\LIB.EXE"" &:# Microsoft ARM librarian
SET "ARM_RC=" &:# Microsoft ARM resource compiler
SET "ARM_MT=" &:# Microsoft ARM manifest tool
SET "ARM_PATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64_arm;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools;C:\Windows\System32;C:\Windows" &:# All tools paths for ARM compilation
SET "ARM_VCINC=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include" &:# Visual C++ ARM compiler include dir for MsvcLibX include_next
SET "ARM_CRTINC=C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt" &:# Visual C++ ARM CRT library include dir for MsvcLibX include_next
SET "ARM_INCPATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include;:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\winrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\winrt" &:# Include paths for ARM compilation
SET "ARM_LIBPATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\arm" &:# Libraries paths for ARM linking
SET "ARM_WINSDK=C:\Program Files (x86)\Windows Kits\10" &:# Microsoft Windows ARM SDK
SET "ARM_WINSDKINC=C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0" &:# Microsoft Windows ARM SDK Include directory
SET "ARM64_CC=" &:# Microsoft Visual C++ ARM64 compiler
SET "ARM64_AS=" &:# Microsoft ARM64 assembler
SET "ARM64_LK=" &:# Microsoft ARM64 linker
SET "ARM64_LB=" &:# Microsoft ARM64 librarian
SET "ARM64_RC=" &:# Microsoft ARM64 resource compiler
SET "ARM64_MT=" &:# Microsoft ARM64 manifest tool
SET "ARM64_PATH=;C:\Windows\System32;C:\Windows" &:# All tools paths for ARM64 compilation
SET "ARM64_VCINC=" &:# Visual C++ ARM64 compiler include dir for MsvcLibX include_next
SET "ARM64_CRTINC=" &:# Visual C++ ARM64 CRT library include dir for MsvcLibX include_next
SET "ARM64_INCPATH=" &:# Include paths for ARM64 compilation
SET "ARM64_LIBPATH=" &:# Libraries paths for ARM64 linking
SET "ARM64_WINSDK=" &:# Microsoft Windows ARM64 SDK
SET "ARM64_WINSDKINC=" &:# Microsoft Windows ARM64 SDK Include directory
exit /b 0 &:# Configuration done successfully
@echo off
:#*****************************************************************************
:# *
:# Filename: configure.bat *
:# *
:# Description: Detect system-specific settings and create config.*.bat *
:# *
:# Notes: Proxy script for %STINCLUDE%\configure.bat. *
:# *
:# Make any change needed in %STINCLUDE%\configure.bat. *
:# *
:# History: *
:# 2016-10-10 JFL jf.larvoire@hpe.com created this file. *
:# 2016-12-15 JFL Search for the real make.bat in [.|..|../..]\include. *
:# *
:# Copyright 2016 Hewlett Packard Enterprise Development LP *
:# Licensed under the Apache 2.0 license www.apache.org/licenses/LICENSE-2.0 *
:#*****************************************************************************
:# Get the full pathname of the STINCLUDE library directory
if defined STINCLUDE if not exist "%STINCLUDE%\make.bat" set "STINCLUDE=" &:# Allow overriding with another alias name, but ignore invalid overrides
for %%p in (. .. ..\..) do if not defined STINCLUDE if exist %%p\include\make.bat ( :# Default: Search it the current directory, and 2 levels above.
for /f "delims=" %%d in ('"pushd %%p\include & cd & popd"') do SET "STINCLUDE=%%d"
)
if not defined STINCLUDE ( :# Try getting the copy in the master environment
for /f "tokens=3" %%v in ('reg query "HKCU\Environment" /v STINCLUDE 2^>NUL') do set "STINCLUDE=%%v"
)
if not exist %STINCLUDE%\make.bat (
>&2 echo %0 Error: Cannot find SysToolsLib's global C include directory. Please define variable STINCLUDE.
exit /b 1
)
if [%1]==[-d] echo "%STINCLUDE%\configure.bat" %*
"%STINCLUDE%\configure.bat" %*
/*****************************************************************************\
* *
* Filename: debugm.h *
* *
* Description: Debug macros *
* *
* Notes: Macros inspired by my Tcl/Bash/Batch debugging libraries. *
* The idea is to output the function call stack, indenting *
* subroutines proportionally to the call depth. *
* To ease reading the output, it must look like real C code.*
* *
* DEBUG_GLOBALS Define global variables used by macros below: *
* int iDebug = FALSE; Global variable enabling debug output if TRUE.*
* int iIndent = 0; Global variable controlling debug indentation.*
* *
* DEBUG_PRINTF((format, ...)) Print a debug string if debug is on. *
* The double parenthesis are necessary *
* because C90 does not support macros *
* with variable list of arguments. *
* DEBUG_ENTER((format, ...)) Print a function name and arguments. *
* Increase indentation of further calls.*
* It's the caller's responsibility to *
* format the routine name and arguments.*
* DEBUG_LEAVE((format, ...)) Print a function return value. *
* Decrease indentation of further calls.*
* It's the caller's responsibility to *
* format the return instruction & value.*
* *
* Any call to DEBUG_ENTER MUST be matched by one call to *
* DEBUG_LEAVE or RETURN_... when the function returns. * *
* *
* History: *
* 2012-01-16 JFL jf.larvoire@hp.com created this file. *
* 2012-02-03 JFL Renamed DEBUG_IF_IS_ON DEBUG_CODE_IF_ON. *
* Renamed file from debug.h to debugm.h because of a file *
* name collision with another library on my PC. *
* 2014-02-10 JFL Added macros for an extra debug mode. *
* 2014-07-02 JFL renamed macro RETURN() as RETURN_CONST(), and defined *
* new macro RETURN() to return nothing. *
* Idem for RETURN_COMMENT() as RETURN_CONST_COMMENT(). *
* 2016-09-09 JFL Flush every DEBUG_PRINTF output, to make sure to see *
* every debug string printed before a program crash. *
* 2016-09-13 JFL Added macros DEBUG_WSTR2NEWUTF8() and DEBUG_FREEUTF8(). *
* 2016-10-04 JFL Added macros DEBUG_OFF(), DEBUG_MORE(), DEBUG_LESS(). *
* Allow using DEBUG_ON()/MORE()/LESS()/OFF() in release mode.
* *
* Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifndef _DEBUGM_H
#define _DEBUGM_H 1
#include <stdio.h> /* Macros use printf */
#ifdef _MSC_VER
#pragma warning(disable:4127) /* Avoid warnings on while(0) below */
#endif
#define DEBUG_DO(code) do {code} while (0)
#define DEBUG_DO_NOTHING() do {} while (0)
/* Conditional compilation based on Microsoft's standard _DEBUG definition */
#if defined(_DEBUG)
#define DEBUG_VERSION " Debug"
#define DEBUG_GLOBALS \
int iDebug = 0; /* Global variable enabling debug output if TRUE. */ \
int iIndent = 0; /* Global variable controlling debug indentation. */
extern int iDebug; /* Global variable enabling of disabling debug messages */
#define DEBUG_ON() iDebug = 1 /* Turn debug mode on */
#define DEBUG_MORE() iDebug += 1 /* Increase the debug level */
#define DEBUG_LESS() iDebug -= 1 /* Decrease the debug level */
#define DEBUG_OFF() iDebug = 0 /* Turn debug mode off */
#define DEBUG_IS_ON() (iDebug > 0) /* Check if the debug mode is enabled */
#define XDEBUG_ON() iDebug = 2 /* Turn extra debug mode on. Same as calling DEBUG_MORE() twice. */
#define XDEBUG_IS_ON() (iDebug > 1) /* Check if the extra debug mode is enabled */
#define DEBUG_CODE(code) code /* Code included in the _DEBUG version only */
#define DEBUG_CODE_IF_ON(code) DEBUG_CODE(if (DEBUG_IS_ON()) {code}) /*
Debug code executed if debug mode is on */
#define XDEBUG_CODE_IF_ON(code) DEBUG_CODE(if (XDEBUG_IS_ON()) {code}) /*
Debug code executed if extra debug mode is on */
extern int iIndent; /* Debug messages indentation */
#define DEBUG_INDENT_STEP 2 /* How many spaces to add for each indentation level */
#define DEBUG_PRINT_INDENT() printf("%*s", iIndent, "")
/* Debug code, conditionally printing a string based on global variable 'debug' */
/* The enter and leave variants print, then respectively increase or decrease indentation,
to make recursive calls easier to review. */
#define DEBUG_FPRINTF(args) DEBUG_DO(if (DEBUG_IS_ON()) {DEBUG_PRINT_INDENT(); fprintf args;})
#define DEBUG_PRINTF(args) DEBUG_DO(if (DEBUG_IS_ON()) {DEBUG_PRINT_INDENT(); printf args; fflush(stdout);})
#define XDEBUG_PRINTF(args) DEBUG_DO(if (XDEBUG_IS_ON()) {DEBUG_PRINT_INDENT(); printf args; fflush(stdout);})
#define DEBUG_ENTER(args) DEBUG_DO(DEBUG_PRINTF(args); iIndent += DEBUG_INDENT_STEP;)
#define DEBUG_LEAVE(args) DEBUG_DO(DEBUG_PRINTF(args); iIndent -= DEBUG_INDENT_STEP;)
#define DEBUG_RETURN_INT(i, comment) DEBUG_DO(int DEBUG_i = (i); \
DEBUG_LEAVE(("return %d; // " comment "\n", DEBUG_i)); return DEBUG_i;)
/* print return instruction and decrease indent */
#define RETURN() DEBUG_DO(DEBUG_LEAVE(("return;\n")); return;)
#define RETURN_CONST(value) DEBUG_DO(DEBUG_LEAVE(("return %s;\n", #value)); return value;)
#define RETURN_INT(i) DEBUG_DO(int DEBUG_i = (i); \
DEBUG_LEAVE(("return %d;\n", DEBUG_i)); return DEBUG_i;)
#define RETURN_STRING(s) DEBUG_DO(char *DEBUG_s = (s); \
DEBUG_LEAVE(("return \"%s\";\n", DEBUG_s)); return DEBUG_s;)
#define RETURN_CHAR(c) DEBUG_DO(char DEBUG_c = (c); \
DEBUG_LEAVE(("return '%c';\n", DEBUG_c)); return DEBUG_c;)
#define RETURN_BOOL(b) DEBUG_DO(int DEBUG_b = (b); \
DEBUG_LEAVE(("return %s;\n", DEBUG_b ? "TRUE" : "FALSE")); return DEBUG_b;)
#define RETURN_COMMENT(args) DEBUG_DO(DEBUG_LEAVE(("return; // ")); \
if (DEBUG_IS_ON()) printf args; return;)
#define RETURN_CONST_COMMENT(value, args) DEBUG_DO(DEBUG_LEAVE(("return %s; // ", #value)); \
if (DEBUG_IS_ON()) printf args; return value;)
#define RETURN_INT_COMMENT(i, args) DEBUG_DO(int DEBUG_i = (i); \
DEBUG_LEAVE(("return %d; // ", DEBUG_i)); if (DEBUG_IS_ON()) printf args; return DEBUG_i;)
#define RETURN_BOOL_COMMENT(b, args) DEBUG_DO(int DEBUG_b = (b); \
DEBUG_LEAVE(("return %s; // ", DEBUG_b ? "TRUE" : "FALSE")); if (DEBUG_IS_ON()) printf args; return DEBUG_b;)
#else /* !defined(_DEBUG) */
#define DEBUG_VERSION "" /* Non debug version: Simply don't say it */
#define DEBUG_GLOBALS
#define DEBUG_ON() (void)0
#define DEBUG_MORE() (void)0
#define DEBUG_LESS() (void)0
#define DEBUG_OFF() (void)0
#define DEBUG_IS_ON() 0
#define XDEBUG_IS_ON() 0
#define DEBUG_CODE(code) /* Code included in _DEBUG version only */
#define DEBUG_CODE_IF_ON(code) /* Code included in _DEBUG version only */
#define XDEBUG_CODE_IF_ON(code) /* Code included in _DEBUG version only */
#define DEBUG_PRINT_INDENT() DEBUG_DO_NOTHING() /* Print call-depth spaces */
#define DEBUG_FPRINTF(args) DEBUG_DO_NOTHING() /* Print a debug string to a stream */
#define DEBUG_PRINTF(args) DEBUG_DO_NOTHING() /* Print a debug string to stdout */
#define XDEBUG_PRINTF(args) DEBUG_DO_NOTHING() /* Print an extra debug string to stdout */
#define DEBUG_ENTER(args) DEBUG_DO_NOTHING() /* Print and increase indent */
#define DEBUG_LEAVE(args) DEBUG_DO_NOTHING() /* Print and decrease indent */
#define DEBUG_RETURN_INT(i, comment) return(i)
/* print return instruction and decrease indent */
#define RETURN() return
#define RETURN_CONST(value) return(value)
#define RETURN_INT(i) return(i)
#define RETURN_STRING(s) return(s)
#define RETURN_CHAR(c) return(c)
#define RETURN_BOOL(b) return(b)
#define RETURN_COMMENT(args) return
#define RETURN_CONST_COMMENT(value, args) return(value)
#define RETURN_INT_COMMENT(i, args) return(i)
#define RETURN_BOOL_COMMENT(b, args) return(b)
#endif /* defined(_DEBUG) */
#define STRINGIZE(s) #s /* Convert a macro name to a string */
#define VALUEIZE(s) STRINGIZE(s) /* Convert a macro value to a string */
#define MACRODEF(s) "#define " #s " " STRINGIZE(s)
/* Display a macro name and value. */
#define DEBUG_PRINT_MACRO(name) DEBUG_DO( \
const char *pszName = #name; /* Don't use STRINGIZE because we're already inside a macro */ \
const char *pszValue = STRINGIZE(name); /* Don't use VALUEIZE because we're already inside a macro */ \
DEBUG_PRINT_INDENT(); \
if (strcmp(pszName, pszValue)) { \
printf("#define %s %s\n", pszName, pszValue); \
} else { /* Not 100% certain, but most likely. */ \
printf("#undef %s\n", pszName); \
} \
)
#ifdef _WIN32
/* Helper macros for displaying Unicode strings */
#define DEBUG_WSTR2UTF8(from, to, toSize) DEBUG_CODE( \
WideCharToMultiByte(CP_UTF8, 0, from, lstrlenW(from)+1, to, toSize, NULL, NULL); \
)
/* Dynamically allocate a new buffer, then convert a Unicode string to UTF-8 */
/* The dynamic allocation is useful in modules using lots of UTF-16 pathnames.
This avoids having many local buffers of length UTF8_PATH_MAX, which may
make the stack grow too large and overflow. */
#define DEBUG_WSTR2NEWUTF8(pwStr, pUtf8) \
DEBUG_CODE( \
do { \
int nUtf8 = (int)lstrlenW(pwStr) * 2 + 1; \
pUtf8 = malloc(nUtf8); \
DEBUG_WSTR2UTF8(pwStr, pUtf8, nUtf8); \
} while (0); \
) /* DEBUG_FREE(pUtf8) MUST be used to free the UTF-8 string after use, else there will be a memory leak */
#define DEBUG_FREEUTF8(pUtf8) DEBUG_CODE(free(pUtf8))
#endif /* defined(_WIN32) */
#endif /* !defined(_DEBUGM_H) */
/*****************************************************************************\
* *
* Filename: direct.h *
* *
* Description: MsvcLibX extensions to direct.h. *
* *
* Notes: *
* *
* History: *
* 2014-03-24 JFL Created this file, with content moved from unistd.h. *
* 2015-11-15 JFL Visual Studio 2015 moved this file to the Windows Kit UCRT.
* *
* Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifndef _MSVCLIBX_DIRECT_H
#define _MSVCLIBX_DIRECT_H 1
#include "msvclibx.h"
#include UCRT_INCLUDE_FILE(direct.h) /* Include MSVC's own <direct.h> file */
#undef mkdir /* This MSVC macro is incompatible with mkdir() function in unistd.h */
#endif /* defined(_MSVCLIBX_DIRECT_H) */
/*****************************************************************************\
* *
* Filename: dirent.h *
* *
* Description: DOS/WIN32 port of standard C library's dirent.h. *
* *
* Notes: There are also remains of an OS/2 implementation here. *
* This code did work c. 1990, in an OS/2 1.3 port of dirc.c.*
* It's not maintained anymore, and unlikely to still work. *
* Left in as a historic reference, in the very unlikely *
* case somebody wants to revive it. *
* *
* History: *
* 2012-01-09 JFL Created this file, based on dirc and other programs. *
* 2013-03-09 JFL Rewrote the stat/fstat/lstat and fseeko/ftello definitions*
* based on _FILE_OFFSET_BITS, _LARGEFILE_SOURCE, and *
* _LARGEFILE_SOURCE64 definitions. *
* 2014-02-06 JFL Moved stat extensions to statx.h. *
* 2014-02-27 JFL Use a WIN32_FIND_DATAW in Windows, to support UTF-8 names.*
* 2014-03-20 JFL Restructured Windows opendir and readdir functions into *
* Wide and MultiByte versions, and changed the Unicode and *
* Ansi versions to macros. *
* 2014-06-06 JFL Fixed macro _D_EXACT_NAMLEN(). *
* 2015-12-07 JFL Added the conditional definition of symlink constants, so *
* that our code builds even in XP and older Windows SDKs. *
* *
* Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifndef _DIRENT_H
#define _DIRENT_H 1
#include "msvclibx.h"
#define _DIRENT_FOR_DOS_WINDOWS /* Uniquely identify this module */
#include <inttypes.h>
#include <time.h>
#include <sys/types.h>
#include <stdio.h>
#include <errno.h>
#ifndef ENAMETOOLONG /* Not defined in DOS' errno.h */
#define ENAMETOOLONG 38
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Macros to extract size information from a struct dirent */
#define _D_EXACT_NAMLEN(d) (strlen((d)->d_name)) /* Name length, not including NUL */
#define _DIRENT_HAVE_D_TYPE /* We commit to providing this field */
/************************ MS-DOS-specific definitions ************************/
#ifdef _MSDOS /* Automatically defined when targeting an MS-DOS application */
#include <dos.h>
#define NAME_MAX 12
#pragma pack(1)
struct _fileinfo { /* MS-DOS structure returning file search results */
uint8_t fiReserved[21];
uint8_t fiAttribute; /* Attributes of file found */
uint16_t fiFileTime; /* Time of last write */
uint16_t fiFileDate; /* Time of last write */
uint32_t fiSize; /* File Size */
char fiFileName[13]; /* File name and extension */
};
#pragma pack()
typedef struct _fileinfo fileinfo;
#pragma pack(1)
struct dirent { /* Standard C library structure returning directory entries. */
/* Standard fields */
_ino_t d_ino; /* We don't need it, but it's required by the spec */
unsigned char d_type; /* File type. Values defined in macros DT_xxxx */
/* unsigned char d_namlen; /* File name length, not including NUL */
/* OS-specific extensions (allowed by the Posix specification) */
/* Matches exactly the struc _fileinfo above, to avoid doing any copying */
uint8_t d_reserved[21];
uint8_t d_attribs; /* Attribute of file found */
uint16_t d_time; /* Time of last write */
uint16_t d_date; /* Time of last write */
uint32_t d_filesize; /* File Size */
/* Standard field: The file name, which must be last in the dirent structure */
char d_name[NAME_MAX+1]; /* Null-terminated file name. Must be last */
};
#pragma pack()
#pragma pack(1)
struct _dirhandle { /* Private structure, not for use by users */
struct dirent sDirent;
/* char dta_buf[128]; /* Protection area, in case MS-DOS uses the whole DTA, and not just the struct _fileinfo ahead of it. */
char wildcards[4]; /* Leave room for the "\*.*" that we append initially. This field MUST follow sDirent. */
char first; /* Tracks if this is the first search call */
};
#pragma pack()
/* Macros to extract size information from a struct dirent */
#define _D_ALLOC_NAMLEN(d) 13 /* Upper bound of the block size to alloc for a name */
/* MS-DOS compatible functions for searching with a specific attribute */
int srch1st(char *pszFile, uint16_t wAttr, fileinfo *pFI); /* Search first matching file */
int srchnext(fileinfo *pFI); /* Search next matching file */
#define DOS_SEARCH_FUNCTIONS_DEFINED 1
#endif /* defined(_MSDOS) */
/************************ Win32-specific definitions *************************/
#ifdef _WIN32 /* Automatically defined when targeting a Win32 application */
#ifndef WINVER
#define WINVER 0x0400
#endif
#include <dos.h>
#include <windows.h>
/* Add symlink definitions, that may be missing in XP and older Windows SDKs */
#ifndef IO_REPARSE_TAG_SYMLINK
#define IO_REPARSE_TAG_SYMLINK 0xA000000CL
#endif
#ifndef SYMBOLIC_LINK_FLAG_DIRECTORY
#define SYMBOLIC_LINK_FLAG_DIRECTORY 1
#endif
#ifndef FSCTL_SET_REPARSE_POINT
#define FSCTL_SET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
#endif
#ifndef FSCTL_GET_REPARSE_POINT
#define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS)
#endif
#ifndef FSCTL_DELETE_REPARSE_POINT
#define FSCTL_DELETE_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 43, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
#endif
#define NAME_MAX (4 * FILENAME_MAX) /* Worst case using UTF-8 encoding: 4 bytes/WCHAR */
struct dirent { /* Structure used to return information about directory entries. */
/* OS-specific extensions */
uint32_t d_attribs;
uint32_t d_ReparseTag;
FILETIME d_CreationTime;
FILETIME d_LastAccessTime;
FILETIME d_LastWriteTime;
uint64_t d_filesize;
char d_shortname[14*sizeof(WCHAR)];
/* Standard fields */
_ino_t d_ino; /* We don't need it, but it's required by the spec */
unsigned char d_type; /* File type. Values defined in macros DT_xxxx */
/* unsigned char d_namlen; /* File name length, not including NUL */
char d_name[(NAME_MAX+1)*sizeof(WCHAR)]; /* Null-terminated file name */
};
struct _dirhandle { /* Private structure, not for use by users */
struct dirent sDirent;
WCHAR wszDirName[MAX_PATH+1]; /* Null-terminated directory name */
HANDLE hFindFile; /* Search handle */
WIN32_FIND_DATAW wfd; /* Where Win32 will store the file information */
};
/* Macros to extract size information from a struct dirent */
#define _D_ALLOC_NAMLEN(d) (_D_EXACT_NAMLEN(d)+1) /* Upper bound of the block size to alloc for a name */
#endif /* defined(_WIN32) */
/************************* OS/2-specific definitions *************************/
#ifdef _OS2 /* Automatically defined when targeting an OS/2 application? */
#include <dos.h>
#define INCL_DOSFILEMGR
#define INCL_DOSMISC
#define INCL_VIO
#include "os2.h"
#define NAME_MAX CCHMAXPATHCOMP
struct dirent { /* Structure used to return information about directory entries. */
_ino_t d_ino; /* We don't need it, but it's required by the spec */
/* Non standard extensions, to ease adapting old DOS/WIN32 apps */
uintmax_t d_filesize; /* File size */
uint16_t time; /* MS-DOS time */
uint16_t date; /* MS-DOS date */
uint8_t attribs; /* Attributes, the MS-DOS way */
/* Standard fields */
unsigned char d_type; /* File type. Values defined in macros DT_xxxx */
/* unsigned char d_namlen; /* File name length, not including NUL */
char d_name[NAME_MAX+1]; /* Null-terminated file name. Must be last */
};
struct _dirhandle { /* Private structure, not for use by users */
struct dirent sDirent;
short hDir; /* Directory handle */
FILEFINDBUF buf; /* Where OS/2 will store the file information */
};
/* Macros to extract size information from a struct dirent */
#define _D_ALLOC_NAMLEN(d) (_D_EXACT_NAMLEN(d)+1) /* Upper bound of the block size to alloc for a name */
#endif /* defined(_OS2) */
/********************** End of OS-specific definitions ***********************/
typedef struct _dirhandle DIR; /* Directory enumerator handle */
typedef struct dirent _dirent; /* Directory entry */
#define MAXNAMELEN NAME_MAX /* Alias used by some Unix versions */
/* File types for struct dirent d_type. Must match the S_IFMT field in sys/stat.h. */
#define DT_UNKNOWN 0
#define DT_FIFO 1 /* Fifo (not used in DOS/Windows dirs) */
#define DT_CHR 2 /* Character device (not used in DOS/Windows) */
#define DT_DIR 4 /* Directory */
#define DT_BLK 6 /* Block device (not used in DOS/Windows) */
#define DT_REG 8 /* Normal file */
#define DT_LNK 10 /* Symbolic link */
#define DT_SOCK 12 /* Socket (not used in DOS/Windows dirs) */
#define DT_VOLID 15 /* Volume ID (non-standard extension for MS-DOS FAT) */
/* Functions operating on directories */
#if defined(_MSDOS)
extern DIR *opendir(const char *name); /* Open a directory */
extern int closedir(DIR *pDir); /* Close the directory. Return 0 if successful, -1 if not. */
extern _dirent *readdir(DIR *pDir); /* Read a directory entry. Return pDirEnt, or NULL for EOF or error. */
#elif defined(_WIN32)
#if defined(_UTF8_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
#define opendir opendirU
#define readdir readdirU
#define scandir scandirU
#else /* _ANSI_SOURCE */
#define opendir opendirA
#define readdir readdirA
#define scandir scandirA
#endif
extern DIR *opendirW(const WCHAR *name); /* Open a directory - Wide char version */
extern DIR *opendirM(const char *name, UINT cp); /* Open a directory - MultiByte char version */
#define opendirA(name) opendirM(name, CP_ACP) /* Open a directory - ANSI version */
#define opendirU(name) opendirM(name, CP_UTF8) /* Open a directory - UTF-8 version */
extern int closedir(DIR *pDir); /* Close the directory. Return 0 if successful, -1 if not. */
extern _dirent *readdirW(DIR *pDir); /* Read a directory entry. Return pDirEnt, or NULL for EOF or error. */
extern _dirent *readdirM(DIR *pDir, UINT cp); /* Read a directory entry. Return pDirEnt, or NULL for EOF or error. */
#define readdirA(pDir) readdirM(pDir, CP_ACP) /* Read a directory entry. Return pDirEnt, or NULL for EOF or error. */
#define readdirU(pDir) readdirM(pDir, CP_UTF8) /* Read a directory entry. Return pDirEnt, or NULL for EOF or error. */
#endif /* defined(_WIN32) */
/* extern int readdir_r(DIR *pDir, _dirent *__entry, _dirent **__result); /* Reentrant readdir */
/* extern void rewinddir(DIR *pDir); /* Rewind DIRP to the beginning of the directory. */
/* extern void seekdir(DIR *pDir, long lPos); /* Seek to position POS on DIRP. */
/* extern long telldir(DIR *pDir); /* Return the current position of DIRP. */
/* extern int dirfd(DIR *pDir); /* Return the file descriptor used by DIRP. */
/* Scan the directory dir, calling cbSelect() on each directory entry.
Entries for which cbSelect() returns nonzero are individually malloc'd,
sorted using qsort with cbCompare(), and collected in a malloc'd array in
*namelist. Returns the number of entries selected, or -1 on error. */
extern int scandir(const char *dir,
_dirent ***namelist,
int (*cbSelect) (const _dirent *),
int (__cdecl *cbCompare) (const _dirent **,
const _dirent **));
/* Function to compare two `struct dirent's alphabetically. */
extern int __cdecl alphasort (const _dirent **ppDE1, const _dirent **ppDEe2);
/* extern int versionsort (const _dirent **ppDE1, const _dirent **ppDEe2); */
#ifdef __cplusplus
}
#endif
#endif /* defined(_DIRENT_H) */
/*****************************************************************************\
* *
* Filename: error.h *
* *
* Description: DOS/WIN32 port of the GNU CoreUtils library error funct. *
* *
* Notes: Gotcha: *
* The Windows SDK also contains a file called error.h *
* See C:\Program Files\Microsoft SDKs\Windows\v7.0\INCLUDE *
* *
* History: *
* 2012-10-21 JFL Created this file. *
* *
* Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifndef _ERROR_H_
#define _ERROR_H_
#include "msvclibx.h"
extern void error(int status, int errnum, const char *format, ...);
#endif
/*****************************************************************************\
* *
* Filename: fadvise.h *
* *
* Description: WIN32 makeshift version of Coreutils' fadvise.h. *
* *
* Notes: Gives hints to the kernel about future uses of a file. *
* Define constants, and replace functions by void macros. *
* *
* History: *
* 2012-10-17 JFL Created this file. *
* *
* Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
enum fadvice_t {
FADVISE_NORMAL,
FADVISE_SEQUENTIAL,
FADVISE_NOREUSE,
FADVISE_DONTNEED,
FADVISE_WILLNEED,
FADVISE_RANDOM
};
/* void fdadvise(int fd, off_t offset, off_t len, fadvice_t advice) */
#define fdadvise(fd, offset, len, advice)
/* void fadvise(FILE *fp, fadvice_t advice) */
#define fadvise(fp, advice)
/*****************************************************************************\
* *
* Filename: fcntl.h *
* *
* Description: MsvcLibX extensions to fcntl.h. *
* *
* Notes: *
* *
* History: *
* 2017-02-16 JFL Created this file. *
* *
* Copyright 2017 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifndef _MSVCLIBX_FCNTL_H
#define _MSVCLIBX_FCNTL_H 1
#include "msvclibx.h"
#include UCRT_INCLUDE_FILE(fcntl.h) /* Include MSVC's own <fcntl.h> file */
/* Microsoft defines _open() in io.h */
#include <io.h>
#if defined(_MSDOS)
#define open _open
#endif
#if defined(_WIN32)
extern int openA(const char *, int, ...); /* MsvcLibX ANSI version of open */
extern int openU(const char *, int, ...); /* MsvcLibX UTF-8 version of open */
#if defined(_UTF8_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
#define open openU
#else /* _ANSI_SOURCE */
#define open openA
#endif /* defined(_UTF8_SOURCE) */
#endif /* defined(_WIN32) */
#endif /* defined(_MSVCLIBX_FCNTL_H) */
/*****************************************************************************\
* *
* Filename: fnmatch.h *
* *
* Description: DOS/WIN32 port of standard C library's fnmatch.h. *
* *
* Notes: Reference for fnmatch and glob: *
* http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_9.html *
* *
* History: *
* 2012-01-17 JFL Created this file. *
* *
* Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifndef _FNMATCH_H
#define _FNMATCH_H 1
#include "msvclibx.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Bits set in the FLAGS argument to fnmatch() */
#define FNM_PATHNAME 0x01 /* Wildcards don't match '/' or '\\' */
#define FNM_FILE_NAME FNM_PATHNAME /* Equivalent GNU name */
#define FNM_NOESCAPE 0x02 /* Backslashes don't quote special chars (Irrelevant in DOS/Windows) */
#define FNM_PERIOD 0x04 /* Wildcards don't match leading dots */
#define FNM_LEADING_DIR 0x08 /* Match up to the first '/' or '\\' */
#define FNM_CASEFOLD 0x10 /* Case-insentitive comparison */
/* Values returned by fnmatch() */
#define FNM_MATCH 0 /* Non standard, but makes fnmatch.c more readable */
#define FNM_NOMATCH 1
/* Value returned by fnmatch() if unsupported */
#define FNM_NOSYS (-1)
/* Match NAME against the filename pattern PATTERN,
returning zero if it matches, FNM_NOMATCH if not. */
extern int fnmatch(const char *pszPattern, const char *pszName, int iFlags);
#ifdef __cplusplus
}
#endif
#endif /* !defined(_FNMATCH_H) */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Dieter Baron and Thomas Klausner.
*
* 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.
*
* $NetBSD: getopt.h,v 1.4 2000/07/07 10:43:54 ad Exp $
*/
#ifndef _GETOPT_H_
#define _GETOPT_H_
/*
* Gnu like getopt_long() and BSD4.4 getsubopt()/optreset extensions
*/
#define no_argument 0
#define required_argument 1
#define optional_argument 2
#ifdef __cplusplus
extern "C" {
#endif
struct option {
/* name of long option */
const char *name;
/*
* one of no_argument, required_argument, and optional_argument:
* whether option takes an argument
*/
int has_arg;
/* if not NULL, set *flag to val when option found */
int *flag;
/* if flag not NULL, value to set *flag to; else return value */
int val;
};
int getopt_long(int, char * const *, const char *,
const struct option *, int *);
extern int optreset;
extern char *optarg;
extern int opterr;
extern int optind;
extern int optopt;
#ifdef __cplusplus
};
#endif
#endif /* !_GETOPT_H_ */
/*****************************************************************************\
* *
* Filename iconv.h *
* *
* Description: WIN32 port of standard C library's iconv() *
* *
* Notes: Define here a number of routines, that will eventually *
* be used by iconv(). *
* *
* History: *
* 2014-02-27 JFL Created this file. *
* *
* © Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifndef _ICONV_H
#define _ICONV_H 1
#include "msvclibx.h"
#include <stdlib.h>
#if defined(_MSDOS)
/* Count the number of characters (not bytes!) in a string */
/* For now, assume the # of characters is the same as the # of bytes */
/* TO DO: Add support for DOS code pages! */
#define CountCharacters(string, cp) (int)strlen(string)
#endif /* defined(_MSDOS) */
#if defined(_WIN32)
#include <windows.h>
int ConvertString(char *buf, size_t nBytes, UINT cpFrom, UINT cpTo, LPCSTR lpDefaultChar);
int CountCharacters(const char *string, UINT cp);
char *DupAndConvert(const char *string, UINT cpFrom, UINT cpTo, LPCSTR lpDefaultChar);
#endif /* defined(_WIN32) */
#endif /* !defined(_ICONV_H) */
/*****************************************************************************\
* *
* Filename inttypes.h *
* *
* Description ISO C9x compliant inttypes.h for Microsoft Visual Studio *
* *
* Notes TO DO: Move imaxdiv to its own C file. *
* *
* History *
* 2014-02-07 JFL Added definitions for PRIdMAX and PRIiMAX. *
* 2016-01-07 JFL Restructured and improved support for MS-DOS. *
* *
* © Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifndef _MSC_VER
#error "Use this header only with Microsoft Visual C++ compilers!"
#endif
#ifndef _MSC_INTTYPES_H_
#define _MSC_INTTYPES_H_
#include <stdint.h>
/* 7.8 Format conversion of integer types */
typedef struct {
intmax_t quot;
intmax_t rem;
} imaxdiv_t;
/* 7.8.1 Macros for format specifiers */
#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) /* [ See footnote 185 at page 198 */
#if defined(_WIN64)
#define __I64_PREFIX "I64"
#define __I32_PREFIX "I32"
#define __PTR_PREFIX "I64"
#define __MAX_PREFIX "I64"
#elif defined(_WIN32)
#define __I64_PREFIX "I64"
#define __I32_PREFIX "I32"
#define __PTR_PREFIX "I32"
#define __MAX_PREFIX "I64"
#elif defined(_MSDOS)
#define __I64_PREFIX "ll" /* MSVC 1.5 actually ignores the second l */
#define __I32_PREFIX "l"
#if defined(_M_I86CM) || defined(_M_I86LM) || defined(_M_I86HM) /* Long pointer memory models */
#define __PTR_PREFIX "l"
#else /* Short pointer memory models */
#define __PTR_PREFIX ""
#endif
#define __MAX_PREFIX "l"
#endif
/* printf macros for integers */
#define PRId8 "d"
#define PRIi8 "i"
#define PRIo8 "o"
#define PRIu8 "u"
#define PRIx8 "x"
#define PRIX8 "X"
#define PRIdLEAST8 "d"
#define PRIiLEAST8 "i"
#define PRIoLEAST8 "o"
#define PRIuLEAST8 "u"
#define PRIxLEAST8 "x"
#define PRIXLEAST8 "X"
#define PRIdFAST8 "d"
#define PRIiFAST8 "i"
#define PRIoFAST8 "o"
#define PRIuFAST8 "u"
#define PRIxFAST8 "x"
#define PRIXFAST8 "X"
#define PRId16 "hd"
#define PRIi16 "hi"
#define PRIo16 "ho"
#define PRIu16 "hu"
#define PRIx16 "hx"
#define PRIX16 "hX"
#define PRIdLEAST16 PRId16
#define PRIiLEAST16 PRIi16
#define PRIoLEAST16 PRIo16
#define PRIuLEAST16 PRIu16
#define PRIxLEAST16 PRIx16
#define PRIXLEAST16 PRIX16
#define PRIdFAST16 PRId16
#define PRIiFAST16 PRIi16
#define PRIoFAST16 PRIo16
#define PRIuFAST16 PRIu16
#define PRIxFAST16 PRIx16
#define PRIXFAST16 PRIX16
#define PRId32 __I32_PREFIX "d"
#define PRIi32 __I32_PREFIX "i"
#define PRIo32 __I32_PREFIX "o"
#define PRIu32 __I32_PREFIX "u"
#define PRIx32 __I32_PREFIX "x"
#define PRIX32 __I32_PREFIX "X"
#define PRIdLEAST32 PRId32
#define PRIiLEAST32 PRIi32
#define PRIoLEAST32 PRIo32
#define PRIuLEAST32 PRIu32
#define PRIxLEAST32 PRIx32
#define PRIXLEAST32 PRIX32
#define PRIdFAST32 PRId32
#define PRIiFAST32 PRIi32
#define PRIoFAST32 PRIo32
#define PRIuFAST32 PRIu32
#define PRIxFAST32 PRIx32
#define PRIXFAST32 PRIX32
#define PRId64 __I64_PREFIX "d"
#define PRIi64 __I64_PREFIX "i"
#define PRIo64 __I64_PREFIX "o"
#define PRIu64 __I64_PREFIX "u"
#define PRIx64 __I64_PREFIX "x"
#define PRIX64 __I64_PREFIX "X"
#define PRIdLEAST64 PRId64
#define PRIiLEAST64 PRIi64
#define PRIoLEAST64 PRIo64
#define PRIuLEAST64 PRIu64
#define PRIxLEAST64 PRIx64
#define PRIXLEAST64 PRIX64
#define PRIdFAST64 PRId64
#define PRIiFAST64 PRIi64
#define PRIoFAST64 PRIo64
#define PRIuFAST64 PRIu64
#define PRIxFAST64 PRIx64
#define PRIXFAST64 PRIX64
#define PRIdMAX __MAX_PREFIX "d"
#define PRIiMAX __MAX_PREFIX "i"
#define PRIoMAX __MAX_PREFIX "o"
#define PRIuMAX __MAX_PREFIX "u"
#define PRIxMAX __MAX_PREFIX "x"
#define PRIXMAX __MAX_PREFIX "X"
#define PRIdPTR __PTR_PREFIX "d"
#define PRIiPTR __PTR_PREFIX "i"
#define PRIoPTR __PTR_PREFIX "o"
#define PRIuPTR __PTR_PREFIX "u"
#define PRIxPTR __PTR_PREFIX "x"
#define PRIXPTR __PTR_PREFIX "X"
/* scanf macros for integers */
#define SCNd8 "d"
#define SCNi8 "i"
#define SCNo8 "o"
#define SCNu8 "u"
#define SCNx8 "x"
#define SCNX8 "X"
#define SCNdLEAST8 SCNd8
#define SCNiLEAST8 SCNi8
#define SCNoLEAST8 SCNo8
#define SCNuLEAST8 SCNu8
#define SCNxLEAST8 SCNx8
#define SCNXLEAST8 SCNX8
#define SCNdFAST8 SCNd8
#define SCNiFAST8 SCNi8
#define SCNoFAST8 SCNo8
#define SCNuFAST8 SCNu8
#define SCNxFAST8 SCNx8
#define SCNXFAST8 SCNX8
#define SCNd16 "hd"
#define SCNi16 "hi"
#define SCNo16 "ho"
#define SCNu16 "hu"
#define SCNx16 "hx"
#define SCNX16 "hX"
#define SCNdLEAST16 SCNd16
#define SCNiLEAST16 SCNi16
#define SCNoLEAST16 SCNo16
#define SCNuLEAST16 SCNu16
#define SCNxLEAST16 SCNx16
#define SCNXLEAST16 SCNX16
#define SCNdFAST16 SCNd16
#define SCNiFAST16 SCNi16
#define SCNoFAST16 SCNo16
#define SCNuFAST16 SCNu16
#define SCNxFAST16 SCNx16
#define SCNXFAST16 SCNX16
#define SCNd32 __I32_PREFIX "d"
#define SCNi32 __I32_PREFIX "i"
#define SCNo32 __I32_PREFIX "o"
#define SCNu32 __I32_PREFIX "u"
#define SCNx32 __I32_PREFIX "x"
#define SCNX32 __I32_PREFIX "X"
#define SCNdLEAST32 SCNd32
#define SCNiLEAST32 SCNi32
#define SCNoLEAST32 SCNo32
#define SCNuLEAST32 SCNu32
#define SCNxLEAST32 SCNx32
#define SCNXLEAST32 SCNX32
#define SCNdFAST32 SCNd32
#define SCNiFAST32 SCNi32
#define SCNoFAST32 SCNo32
#define SCNuFAST32 SCNu32
#define SCNxFAST32 SCNx32
#define SCNXFAST32 SCNX32
#define SCNd64 __I64_PREFIX "d"
#define SCNi64 __I64_PREFIX "i"
#define SCNo64 __I64_PREFIX "o"
#define SCNu64 __I64_PREFIX "u"
#define SCNx64 __I64_PREFIX "x"
#define SCNX64 __I64_PREFIX "X"
#define SCNdLEAST64 SCNd64
#define SCNiLEAST64 SCNi64
#define SCNoLEAST64 SCNo64
#define SCNuLEAST64 SCNu64
#define SCNxLEAST64 SCNx64
#define SCNXLEAST64 SCNX64
#define SCNdFAST64 SCNd64
#define SCNiFAST64 SCNi64
#define SCNoFAST64 SCNo64
#define SCNuFAST64 SCNu64
#define SCNxFAST64 SCNx64
#define SCNXFAST64 SCNX64
#define SCNdMAX __MAX_PREFIX "d"
#define SCNiMAX __MAX_PREFIX "i"
#define SCNoMAX __MAX_PREFIX "o"
#define SCNuMAX __MAX_PREFIX "u"
#define SCNxMAX __MAX_PREFIX "x"
#define SCNXMAX __MAX_PREFIX "X"
#define SCNdPTR __PTR_PREFIX "d"
#define SCNiPTR __PTR_PREFIX "i"
#define SCNoPTR __PTR_PREFIX "o"
#define SCNuPTR __PTR_PREFIX "u"
#define SCNxPTR __PTR_PREFIX "x"
#define SCNXPTR __PTR_PREFIX "X"
#endif /* __STDC_FORMAT_MACROS ] */
/* 7.8.2 Functions for greatest-width integer types */
/* 7.8.2.1 imaxabs() */
#if defined(_WIN32)
#define imaxabs _abs64
#elif defined(_MSDOS)
#define imaxabs abs
#endif
/* 7.8.2.2 imaxdiv() */
/* This is modified version of div() function from Microsoft's div.c found */
/* in %MSVC.NET%\crt\src\div.c */
#if defined(_MSDOS) && !defined(STATIC_IMAXDIV) && !defined(__cplusplus)
/* MSVC 1.52 compiler for MS-DOS does not support inline for C */
extern imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom);
#else
#ifdef STATIC_IMAXDIV /* [ */
static
#else /* STATIC_IMAXDIV ][ */
_inline
#endif /* STATIC_IMAXDIV ] */
imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) {
imaxdiv_t result;
result.quot = numer / denom;
result.rem = numer % denom;
if (numer < 0 && result.rem > 0) {
/* did division wrong; must fix up */
++result.quot;
result.rem -= denom;
}
return result;
}
#endif /* defined(_MSDOS) && !defined(STATIC_IMAXDIV) && !defined(__cplusplus) */
/* 7.8.2.3 strtoimax() and strtoumax() */
#if defined(_WIN32)
#define strtoimax _strtoi64
#define strtoumax _strtoui64
#elif defined(_MSDOS)
#define strtoimax strtol
#define strtoumax strtoul
#endif
/* 7.8.2.4 wcstoimax() and wcstoumax() */
#if defined(_WIN32)
#define wcstoimax _wcstoi64
#define wcstoumax _wcstoui64
#elif defined(_MSDOS)
#define wcstoimax wcstol
#define wcstoumax wcstoul
#endif
#endif /* _MSC_INTTYPES_H_ */
/*****************************************************************************\
* *
* Filename: libgen.h *
* *
* Description: DOS/WIN32 port of standard C library's libgen.h. *
* *
* Notes: *
* *
* History: *
* 2016-09-08 JFL Created this file. *
* *
* Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifndef _LIBGEN_H
#define _LIBGEN_H
char *basename(char *pszPathname); /* Modifies pathname; Not thread-safe */
char *dirname(char *pszPathname); /* Modifies pathname; Not thread-safe */
#endif /* !defined(_LIBGEN_H) */
/*****************************************************************************\
* *
* Filename: limits.h *
* *
* Description: MsvcLibX extensions to limits.h. *
* *
* Notes: *
* *
* History: *
* 2014-06-30 JFL Created this file. *
* *
* ?Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifndef _MSVCLIBX_LIMITS_H
#define _MSVCLIBX_LIMITS_H 1
#include "msvclibx.h"
#include MSVC_INCLUDE_FILE(limits.h) /* Include MSVC's own <limits.h> file */
/************************ MS-DOS-specific definitions ************************/
#ifdef _MSDOS /* Automatically defined when targeting an MS-DOS application */
#define PATH_MAX 255 /* Many APIs actually limit it to 128 bytes, but longer paths paths are legal. */
#endif /* defined(_MSDOS) */
/************************ Win32-specific definitions *************************/
#ifdef _WIN32 /* Automatically defined when targeting a Win32 application */
#undef PATH_MAX
#define ANSI_PATH_MAX 260 /* Number of ANSI characters, including final NUL ( = Windef.h MAX_PATH) */
#define UNICODE_PATH_MAX 32768 /* Number of Unicode characters, including final NUL */
#define UTF8_PATH_MAX (4 * UNICODE_PATH_MAX) /* Worst UTF-8 case is 4 bytes / Unicode char */
#define PATH_MAX UNICODE_PATH_MAX /* MsvcLibX uses Unicode internally for file management */
#endif /* defined(_WIN32) */
/************************* OS/2-specific definitions *************************/
#ifdef _OS2 /* Automatically defined when targeting an OS/2 application? */
#endif /* defined(_OS2) */
/********************** End of OS-specific definitions ***********************/
#endif /* defined(_MSVCLIBX_LIMITS_H) */
/*****************************************************************************\
* *
* Filename MsvcLibX.h *
* *
* Description MsvcLibX-specific definitions *
* *
* Notes Generates a library search record to load MsvcLibX.lib. *
* *
* History: *
* 2013 JFL Created this file. *
* 2014-05-30 JFL Added macros to work around the lack of a #include_next. *
* 2015-11-15 JFL Added macro UCRT_INCLUDE_FILE for Visual Studio 2015. *
* 2016-09-15 JFL Added macro WINSDK_INCLUDE_FILE for Windows SDK. *
* 2016-09-20 JFL Added workaround preventing warnings in WIN95 builds. *
* 2016-09-28 JFL Can also be included by MS' Resource Compiler. *
* 2017-02-05 JFL Changed the UTF-8 programs initialization method. *
* *
* ?Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
/* Generate a library search record to load MsvcLibX.lib */
#ifndef _MSVCLIBX_H_
#define _MSVCLIBX_H_
#if !(defined(_MSC_VER) || defined(RC_INVOKED))
#error The msvclibx library is designed for use with the Microsoft Visual C/C++ tools only.
#endif
/* Compute the OS-specific suffix */
#if defined(_WIN64)
# define _MSVCLIBX_LIB_OS_SUFFIX "w64"
#elif defined(_WIN95)
# define _MSVCLIBX_LIB_OS_SUFFIX "w95"
#elif defined(_WIN32)
# define _MSVCLIBX_LIB_OS_SUFFIX "w32"
#elif defined(_MSDOS)
# if defined(_M_I86TM)
# define _MSVCLIBX_LIB_OS_SUFFIX "dt"
# elif defined(_M_I86SM)
# define _MSVCLIBX_LIB_OS_SUFFIX "ds"
# elif defined(_M_I86LM)
# define _MSVCLIBX_LIB_OS_SUFFIX "dl"
# else
# error No msvclibx.lib version yet for this DOS memory model.
# endif
#else
# error No msvclibx.lib version for this target OS.
#endif
/* Compute the debug-mode-specific suffix */
#if defined(_DEBUG)
# define _MSVCLIBX_LIB_DBG_SUFFIX "d"
#else
# define _MSVCLIBX_LIB_DBG_SUFFIX ""
#endif
/* Generate the OS-and-debug-mode-specific library name */
#define _MSVCLIBX_LIB "MsvcLibX" _MSVCLIBX_LIB_OS_SUFFIX _MSVCLIBX_LIB_DBG_SUFFIX ".lib"
#pragma message("Adding pragma comment(lib, \"" _MSVCLIBX_LIB "\")")
#pragma comment(lib, _MSVCLIBX_LIB)
/* Library-specific routine used internally by many standard routines */
#if defined(_WIN32)
extern int Win32ErrorToErrno(); /* Converts the last WIN32 error to a Posix error code */
#ifndef ELOOP /* Defined in VS10's errno.h, but not in VS9 */
#define ELOOP 114
#endif
/* Convert an ANSI or UTF-8 or OEM pathname to a Unicode string. Defined in mb2wpath.c. */
typedef unsigned int UINT; /* Defined in windef.h */
typedef const char* LPCSTR; /* Defined in winnt.h */
#ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t; /* Defined in crtdefs.h */
#define _WCHAR_T_DEFINED
#endif
typedef wchar_t* LPWSTR; /* Defined in winnt.h */
extern int MultiByteToWidePath(UINT nCodePage, LPCSTR pszName, LPWSTR pwszName, int nWideBufSize);
#endif
/* Count the number of elements in an array */
#define COUNTOF(array) (sizeof(array)/sizeof(array[0]))
/* Workaround for missing __pragma() directive in old versions of Visual Studio */
#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER <= 1400) /* For Visual C++ versions up to Visual Studio 2005 */
#define __pragma(x)
#endif /* (_MSC_VER <= 1400) */
/* Macros for working around the lack of a #include_next directive */
#define MSVCLIBX_CONCAT1(a,b) a##b /* Concatenate the raw arguments */
#define MSVCLIBX_CONCAT(a,b) MSVCLIBX_CONCAT1(a,b) /* Substitute the arguments, then concatenate the values */
#define MSVCLIBX_STRINGIZE1(x) #x /* Convert the raw argument to a string */
#define MSVCLIBX_STRINGIZE(x) MSVCLIBX_STRINGIZE1(x) /* Substitute the argument, then convert its value to a string */
/* Up to VS2013, both kinds of include files were in the same directory. Then in VS2015, they were split in two dirs. */
#define MSVC_INCLUDE_FILE(relpath) MSVCLIBX_STRINGIZE(MSVCLIBX_CONCAT(MSVCINCLUDE,MSVCLIBX_CONCAT(/,relpath))) /* C compiler include files */
#define UCRT_INCLUDE_FILE(relpath) MSVCLIBX_STRINGIZE(MSVCLIBX_CONCAT(UCRTINCLUDE,MSVCLIBX_CONCAT(/,relpath))) /* C runtime library include files */
#define WINSDK_INCLUDE_FILE(relpath) MSVCLIBX_STRINGIZE(MSVCLIBX_CONCAT(WSDKINCLUDE,MSVCLIBX_CONCAT(/,relpath))) /* Windows SDK include files */
/* Support for external linker symbols */
#if defined(_WIN64)
#define PUBLIC_SYMBOL_NAME(s) s
#else /* _MSDOS or _WIN32 */
#define PUBLIC_SYMBOL_NAME(s) _##s
#endif
/* Support for UTF-8 command lines */
#if defined(_WIN32)
#if defined(_UTF8_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
/* Force linking in MsvcLibX' UTF-8 initialization module */
#pragma comment(linker, "/include:" MSVCLIBX_STRINGIZE(PUBLIC_SYMBOL_NAME(_initU)))
#endif /* defined(_UTF8_SOURCE) ... */
#endif /* defined(_WIN32) */
/* Prevent an incompatibility with <winsock.h>. See MsvcLibX' "sys/time.h" for explanations. */
#define _WINSOCKAPI_ /* Prevent the inclusion of winsock.h in windows.h */
#endif /* _MSVCLIBX_H_ */
/*****************************************************************************\
* *
* Filename: netdb.h *
* *
* Description: Network definitions *
* *
* Notes: *
* *
* History: *
* 2012-01-24 JFL Created this file. *
* *
* Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifndef _NETDB_H
#define _NETDB_H 1
/* Absolute file name for network data base files. */
#define _PATH_HOSTS "C:/Windows/System32/drivers/etc/hosts"
#define _PATH_NETWORKS "C:/Windows/System32/drivers/etc/networks"
#define _PATH_PROTOCOLS "C:/Windows/System32/drivers/etc/protocols"
#define _PATH_SERVICES "C:/Windows/System32/drivers/etc/services"
#endif /* _NETDB_H */
/*****************************************************************************\
* *
* Filename: process.h *
* *
* Description: MsvcLibX extensions to process.h. *
* *
* Notes: *
* *
* History: *
* 2014-03-27 JFL Created this file. *
* 2015-11-15 JFL Visual Studio 2015 moved this file to the Windows Kit UCRT.
* *
* Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifndef _MSVCLIBX_PROCESS_H
#define _MSVCLIBX_PROCESS_H 1
#include "msvclibx.h"
#include UCRT_INCLUDE_FILE(process.h) /* Include MSVC's own <process.h> file */
#if defined(_WIN32)
extern intptr_t _spawnvpU(int iMode, const char *pszCommand, char *const *argv);
#if defined(_UTF8_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
#define _spawnvp _spawnvpU
#else /* _ANSI_SOURCE */
#define _spawnvp _spawnvp
#endif /* defined(_UTF8_SOURCE) */
#endif /* defined(_WIN32) */
#endif /* defined(_MSVCLIBX_PROCESS_H) */
#ifndef _HSREGEX_H_
#define _HSREGEX_H_
#ifndef _HSREGEX_H
#define _HSREGEX_H /* never again */
#include <sys/types.h> /* JFL 2012-01-24 Added definition of types used below */
#pragma comment( lib, "regex.lib" )
/* ========= begin header generated by ././mkh ========= */
#ifdef __cplusplus
extern "C" {
#endif
/* === regex2.h === */
#ifdef WIN32
#define API_EXPORT(type) __declspec(dllexport) type __stdcall
#elif defined(__GNUC__) && __GNUC__ >= 4
#define API_EXPORT(type) __attribute__ ((visibility("default"))) type
#else
#define API_EXPORT(type) type
#endif
typedef off_t regoff_t;
typedef struct {
int re_magic;
size_t re_nsub; /* number of parenthesized subexpressions */
const char *re_endp; /* end pointer for REG_PEND */
struct re_guts *re_g; /* none of your business :-) */
} regex_t;
typedef struct {
regoff_t rm_so; /* start of match */
regoff_t rm_eo; /* end of match */
} regmatch_t;
/* === regcomp.c === */
API_EXPORT(int) regcomp(regex_t *, const char *, int);
#define REG_BASIC 0000
#define REG_EXTENDED 0001
#define REG_ICASE 0002
#define REG_NOSUB 0004
#define REG_NEWLINE 0010
#define REG_NOSPEC 0020
#define REG_PEND 0040
#define REG_DUMP 0200
/* === regerror.c === */
#define REG_OKAY 0
#define REG_NOMATCH 1
#define REG_BADPAT 2
#define REG_ECOLLATE 3
#define REG_ECTYPE 4
#define REG_EESCAPE 5
#define REG_ESUBREG 6
#define REG_EBRACK 7
#define REG_EPAREN 8
#define REG_EBRACE 9
#define REG_BADBR 10
#define REG_ERANGE 11
#define REG_ESPACE 12
#define REG_BADRPT 13
#define REG_EMPTY 14
#define REG_ASSERT 15
#define REG_INVARG 16
#define REG_ATOI 255 /* convert name to number (!) */
#define REG_ITOA 0400 /* convert number to name (!) */
API_EXPORT(size_t) regerror(int, const regex_t *, char *, size_t);
/* === regexec.c === */
API_EXPORT(int) regexec(const regex_t *, const char *, size_t, regmatch_t [], int);
#define REG_NOTBOL 00001
#define REG_NOTEOL 00002
#define REG_STARTEND 00004
#define REG_TRACE 00400 /* tracing of execution */
#define REG_LARGE 01000 /* force large representation */
#define REG_BACKR 02000 /* force use of backref code */
/* === regfree.c === */
API_EXPORT(void) regfree(regex_t *);
#ifdef __cplusplus
}
#endif
/* ========= end header generated by ././mkh ========= */
#endif
#endif
/*****************************************************************************\
* *
* Filename: reparsept.h *
* *
* Description: Definitions for WIN32 reparse points. *
* *
* Notes: *
* *
* History: *
* 2014-02-28 JFL Created this file. *
* *
* Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
/* Reparse point iocontrol data buffer */
/* See http://msdn.microsoft.com/en-us/library/cc232006.aspx */
/* and http://msdn.microsoft.com/en-us/library/cc232007.aspx */
#include <windows.h>
/* NTFS reparse point definitions */
/* Constants from http://msdn.microsoft.com/en-us/library/dd541667.aspx */
/* Some, but not all, of them also defined in recent versions of winnt.h. */
/* Since the list varies a lot, redefine them one by one as needed */
#ifndef IO_REPARSE_TAG_RESERVED_ZERO
#define IO_REPARSE_TAG_RESERVED_ZERO 0x00000000 /* Reserved reparse tag value */
#endif
#ifndef IO_REPARSE_TAG_RESERVED_ONE
#define IO_REPARSE_TAG_RESERVED_ONE 0x00000001 /* Reserved reparse tag value */
#endif
#ifndef IO_REPARSE_TAG_MOUNT_POINT
#define IO_REPARSE_TAG_MOUNT_POINT 0xA0000003 /* Used for mount point support */
#endif
#ifndef IO_REPARSE_TAG_HSM
#define IO_REPARSE_TAG_HSM 0xC0000004 /* Obsolete. Used by legacy Hierarchical Storage Manager Product */
#endif
#ifndef IO_REPARSE_TAG_DRIVER_EXTENDER
#define IO_REPARSE_TAG_DRIVER_EXTENDER 0x80000005 /* Home server drive extender */
#endif
#ifndef IO_REPARSE_TAG_HSM2
#define IO_REPARSE_TAG_HSM2 0x80000006 /* Obsolete. Used by legacy Hierarchical Storage Manager Product */
#endif
#ifndef IO_REPARSE_TAG_SIS
#define IO_REPARSE_TAG_SIS 0x80000007 /* Used by single-instance storage (SIS) filter driver. Server-side interpretation only, not meaningful over the wire */
#endif
#ifndef IO_REPARSE_TAG_WIM
#define IO_REPARSE_TAG_WIM 0x80000008 /* Mounted Windows boot Image File? */
#endif
#ifndef IO_REPARSE_TAG_CSV
#define IO_REPARSE_TAG_CSV 0x80000009 /* Cluster Shared Volume? */
#endif
#ifndef IO_REPARSE_TAG_DFS
#define IO_REPARSE_TAG_DFS 0x8000000A /* Used by the DFS filter. The DFS is described in the Distributed File System (DFS): Referral Protocol Specification [MS-DFSC]. Server-side interpretation only, not meaningful over the wire */
#endif
#ifndef IO_REPARSE_TAG_FILTER_MANAGER
#define IO_REPARSE_TAG_FILTER_MANAGER 0x8000000B /* Used by filter manager test harness */
#endif
#ifndef IO_REPARSE_TAG_SYMLINK
#define IO_REPARSE_TAG_SYMLINK 0xA000000C /* Used for symbolic link support */
#endif
#ifndef IO_REPARSE_TAG_DFSR
#define IO_REPARSE_TAG_DFSR 0x80000012 /* Used by the DFS filter. The DFS is described in [MS-DFSC]. Server-side interpretation only, not meaningful over the wire */
#endif
#ifndef IO_REPARSE_TAG_DEDUP
#define IO_REPARSE_TAG_DEDUP 0x80000013 /* Mounted deduplicated volume? */
#endif
#ifndef IO_REPARSE_TAG_NFS
#define IO_REPARSE_TAG_NFS 0x80000014 /* Mounted NFS share? */
#endif
#if 0
#define IO_REPARSE_TAG_DRIVER_EXTENDER 0x80000005 /* Home server drive extender */
#define IO_REPARSE_TAG_FILTER_MANAGER 0x8000000B /* Used by filter manager test harness */
#endif
#pragma pack(1)
typedef struct _REPARSE_READ_BUFFER {
DWORD ReparseTag;
WORD ReparseDataLength;
WORD Reserved;
UCHAR DataBuffer[1];
} REPARSE_READ_BUFFER, *PREPARSE_READ_BUFFER;
#define REPARSE_READ_BUFFER_HEADER_SIZE (sizeof(REPARSE_READ_BUFFER) - sizeof(UCHAR))
typedef struct _REPARSE_SYMLINK_READ_BUFFER {
DWORD ReparseTag;
WORD ReparseDataLength;
WORD Reserved;
WORD SubstituteNameOffset;
WORD SubstituteNameLength;
WORD PrintNameOffset;
WORD PrintNameLength;
ULONG Flags;
WCHAR PathBuffer[1];
} SYMLINK_READ_BUFFER, *PSYMLINK_READ_BUFFER;
#define SYMLINK_READ_BUFFER_HEADER_SIZE (sizeof(SYMLINK_READ_BUFFER) - sizeof(WCHAR))
typedef struct _REPARSE_MOUNTPOINT_READ_BUFFER {
DWORD ReparseTag;
WORD ReparseDataLength;
WORD Reserved;
WORD SubstituteNameOffset;
WORD SubstituteNameLength;
WORD PrintNameOffset;
WORD PrintNameLength;
WCHAR PathBuffer[1];
} MOUNTPOINT_READ_BUFFER, *PMOUNTPOINT_READ_BUFFER;
#define MOUNTPOINT_READ_BUFFER_HEADER_SIZE (sizeof(MOUNTPOINT_READ_BUFFER) - sizeof(WCHAR))
typedef struct _REPARSE_MOUNTPOINT_WRITE_BUFFER {
DWORD ReparseTag;
DWORD ReparseDataLength;
WORD Reserved;
WORD ReparseTargetLength;
WORD ReparseTargetMaximumLength;
WORD Reserved1;
WCHAR ReparseTarget[1];
} MOUNTPOINT_WRITE_BUFFER, *PMOUNTPOINT_WRITE_BUFFER;
#define MOUNTPOINT_WRITE_BUFFER_HEADER_SIZE (sizeof(MOUNTPOINT_WRITE_BUFFER) - sizeof(WCHAR))
#pragma pack()
/*****************************************************************************\
* *
* Filename: stdbool.h *
* *
* Description: Standard boolean definitions *
* *
* Notes: Set standard values. May need to be adapted for C++? *
* *
* History: *
* 2012-10-17 JFL Created this file. *
* *
* Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifndef _STDBOOL_H
#define _STDBOOL_H
/* #define bool int /* Spec says _Bool */
typedef int bool;
#define true 1
#define false 0
#define __bool_true_false_are_defined 1
#endif
/*****************************************************************************\
* *
* Filename stdint.h *
* *
* Description ISO C9x compliant stdint.h for Microsoft Visual Studio *
* *
* Notes *
* *
* ISO C9x compliant stdint.h for Microsoft Visual Studio *
* Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 *
* *
* Copyright (c) 2006-2008 Alexander Chemeris *
* *
* 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. The name of the author may be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. *
* *
* History *
* 2008-07-17 AC Initial implementation by Alexander Chemeris. *
* 2011-05-23 JFL Added support for 16-bits compilers for MS-DOS. *
* 2011-05-28 JFL Added support for 16-bits compilers for MS-DOS. *
* 2012-01-18 JFL Added error messages if target is not DOS or Windows. *
* 2015-12-04 JFL Define _UINTPTR_T_DEFINED to tell MSVC99 it's done already*
* *
\*****************************************************************************/
#ifndef _MSC_VER
#error "Use this header only with Microsoft Visual C++ compilers!"
#endif /* _MSC_VER */
#ifndef _MSC_STDINT_H_
#define _MSC_STDINT_H_
#if _MSC_VER > 1000
#pragma once
#endif
#include <limits.h>
/*
// For Visual Studio 6 in C++ mode wrap <wchar.h> include with 'extern "C++" {}'
// or compiler give many errors like this:
// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
*/
/* 2015-12-04 JFL Bug fix: With VS14/VC19, MSVC's wchar.h includes inttypes.h,
which in turn includes this stdint.h, causing loop issues */
#if (_MSC_VER < 1900) && defined(_WIN32) /* Both WIN32 and WIN64 */
# if (_MSC_VER < 1300) && defined(__cplusplus)
extern "C++" {
# endif
# include <wchar.h>
# if (_MSC_VER < 1300) && defined(__cplusplus)
}
# endif
#endif
/* Define _W64 macros to mark types changing their size, like intptr_t. */
#ifndef _W64
# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
# define _W64 __w64
# else
# define _W64
# endif
#endif
/* 7.18.1 Integer types */
#ifndef _INTEGRAL_MAX_BITS
#define _INTEGRAL_MAX_BITS 32
#endif
/* 7.18.1.1 Exact-width integer types */
#if defined(_WIN32) /* Both WIN32 and WIN64 */
typedef __int8 int8_t;
typedef __int16 int16_t;
typedef __int32 int32_t;
typedef __int64 int64_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
#elif defined(_MSDOS) /* MS-DOS */
typedef char int8_t;
typedef short int16_t;
typedef long int32_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned long uint32_t;
#else
#error "I don't know what the integer types are in this case!"
#endif
/* 7.18.1.2 Minimum-width integer types */
typedef int8_t int_least8_t;
typedef int16_t int_least16_t;
typedef int32_t int_least32_t;
#ifdef LLONG_MAX
typedef int64_t int_least64_t;
#endif
typedef uint8_t uint_least8_t;
typedef uint16_t uint_least16_t;
typedef uint32_t uint_least32_t;
#ifdef LLONG_MAX
typedef uint64_t uint_least64_t;
#endif
/* 7.18.1.3 Fastest minimum-width integer types */
typedef int8_t int_fast8_t;
typedef int16_t int_fast16_t;
typedef int32_t int_fast32_t;
#ifdef LLONG_MAX
typedef int64_t int_fast64_t;
#endif
typedef uint8_t uint_fast8_t;
typedef uint16_t uint_fast16_t;
typedef uint32_t uint_fast32_t;
#ifdef LLONG_MAX
typedef uint64_t uint_fast64_t;
#endif
/* 7.18.1.4 Integer types capable of holding object pointers */
#if defined(_WIN64) /* _WIN64 */
# define _POINTER_BITS 64
typedef __int64 intptr_t;
typedef unsigned __int64 uintptr_t;
#elif defined(_WIN32) /* _WIN32 */
# define _POINTER_BITS 32
typedef _W64 int intptr_t;
typedef _W64 unsigned int uintptr_t;
#elif defined(_MSDOS) /* _MSDOS */
# if defined(_M_I86TM) || defined(_M_I86SM) /* Tiny or short memory models */
# define _POINTER_BITS 16
typedef int intptr_t;
typedef unsigned int uintptr_t;
# else /* Compact, medium, large or huge memory models */
# define _POINTER_BITS 32
typedef long intptr_t;
typedef unsigned long uintptr_t;
# endif
#else
#error "I don't know what the pointer types are in this case!"
#endif /* _WIN64 */
#define _INTPTR_T_DEFINED
#define _UINTPTR_T_DEFINED /* Prevent MSVC99 from redefining it */
/* 7.18.1.5 Greatest-width integer types */
#ifdef LLONG_MAX
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
#else
typedef int32_t intmax_t;
typedef uint32_t uintmax_t;
#endif
/* 7.18.2 Limits of specified-width integer types */
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) /* See footnote 220 at page 257 and footnote 221 at page 259 */
#ifdef _MSDOS
#define _I8_MIN SCHAR_MIN /* minimum signed 8 bit value */
#define _I8_MAX SCHAR_MAX /* maximum signed 8 bit value */
#define _UI8_MAX UCHAR_MAX /* maximum unsigned 8 bit value */
#define _I16_MIN SHRT_MIN /* minimum signed 16 bit value */
#define _I16_MAX SHRT_MAX /* maximum signed 16 bit value */
#define _UI16_MAX USHRT_MAX /* maximum unsigned 16 bit value */
#define _I32_MIN LONG_MIN /* minimum signed 32 bit value */
#define _I32_MAX LONG_MAX /* maximum signed 32 bit value */
#define _UI32_MAX ULONG_MAX /* maximum unsigned 32 bit value */
#endif
/* 7.18.2.1 Limits of exact-width integer types */
#define INT8_MIN ((int8_t)_I8_MIN)
#define INT8_MAX _I8_MAX
#define INT16_MIN ((int16_t)_I16_MIN)
#define INT16_MAX _I16_MAX
#define INT32_MIN ((int32_t)_I32_MIN)
#define INT32_MAX _I32_MAX
#ifdef LLONG_MAX
#define INT64_MIN ((int64_t)_I64_MIN)
#define INT64_MAX _I64_MAX
#endif
#define UINT8_MAX _UI8_MAX
#define UINT16_MAX _UI16_MAX
#define UINT32_MAX _UI32_MAX
#ifdef LLONG_MAX
#define UINT64_MAX _UI64_MAX
#endif
/* 7.18.2.2 Limits of minimum-width integer types */
#define INT_LEAST8_MIN INT8_MIN
#define INT_LEAST8_MAX INT8_MAX
#define INT_LEAST16_MIN INT16_MIN
#define INT_LEAST16_MAX INT16_MAX
#define INT_LEAST32_MIN INT32_MIN
#define INT_LEAST32_MAX INT32_MAX
#ifdef LLONG_MAX
#define INT_LEAST64_MIN INT64_MIN
#define INT_LEAST64_MAX INT64_MAX
#endif
#define UINT_LEAST8_MAX UINT8_MAX
#define UINT_LEAST16_MAX UINT16_MAX
#define UINT_LEAST32_MAX UINT32_MAX
#ifdef LLONG_MAX
#define UINT_LEAST64_MAX UINT64_MAX
#endif
/* 7.18.2.3 Limits of fastest minimum-width integer types */
#define INT_FAST8_MIN INT8_MIN
#define INT_FAST8_MAX INT8_MAX
#define INT_FAST16_MIN INT16_MIN
#define INT_FAST16_MAX INT16_MAX
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST32_MAX INT32_MAX
#ifdef LLONG_MAX
#define INT_FAST64_MIN INT64_MIN
#define INT_FAST64_MAX INT64_MAX
#endif
#define UINT_FAST8_MAX UINT8_MAX
#define UINT_FAST16_MAX UINT16_MAX
#define UINT_FAST32_MAX UINT32_MAX
#ifdef LLONG_MAX
#define UINT_FAST64_MAX UINT64_MAX
#endif
/* 7.18.2.4 Limits of integer types capable of holding object pointers */
#define INTPTR_MIN INT##_POINTER_BITS##MIN
#define INTPTR_MAX INT##_POINTER_BITS##_MAX
#define UINTPTR_MAX UINT##_POINTER_BITS##_MAX
/* 7.18.2.5 Limits of greatest-width integer types */
#ifdef LLONG_MAX
#define INTMAX_MIN INT64_MIN
#define INTMAX_MAX INT64_MAX
#define UINTMAX_MAX UINT64_MAX
#else
#define INTMAX_MIN INT32_MIN
#define INTMAX_MAX INT32_MAX
#define UINTMAX_MAX UINT32_MAX
#endif
/* 7.18.3 Limits of other integer types */
#define PTRDIFF_MIN _I##_POINTER_BITS##_MIN
#define PTRDIFF_MAX _I##_POINTER_BITS##_MAX
#define SIG_ATOMIC_MIN INT_MIN
#define SIG_ATOMIC_MAX INT_MAX
#ifndef SIZE_MAX
# define SIZE_MAX _UI##_POINTER_BITS##_MAX
#endif
/* WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h> */
#ifndef WCHAR_MIN
# define WCHAR_MIN 0
#endif
#ifndef WCHAR_MAX
# define WCHAR_MAX _UI16_MAX
#endif
#define WINT_MIN 0
#define WINT_MAX _UI16_MAX
#endif /* __STDC_LIMIT_MACROS */
/* 7.18.4 Limits of other integer types */
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) /* See footnote 224 at page 260 */
/* 7.18.4.1 Macros for minimum-width integer constants */
#define INT8_C(val) val##i8
#define INT16_C(val) val##i16
#define INT32_C(val) val##i32
#ifdef LLONG_MAX
#define INT64_C(val) val##i64
#endif
#define UINT8_C(val) val##ui8
#define UINT16_C(val) val##ui16
#define UINT32_C(val) val##ui32
#ifdef LLONG_MAX
#define UINT64_C(val) val##ui64
#endif
/* 7.18.4.2 Macros for greatest-width integer constants */
#ifdef LLONG_MAX
#define INTMAX_C INT64_C
#define UINTMAX_C UINT64_C
#else
#define INTMAX_C INT32_C
#define UINTMAX_C UINT32_C
#endif
#endif /* __STDC_CONSTANT_MACROS */
#endif /* _MSC_STDINT_H_ */
/*****************************************************************************\
* *
* Filename: stdio--.h *
* *
* Description: front-end to stdio.h that redefines some unsafe functions *
* *
* Notes: This header is part of the GNU CoreUtils library. *
* msvclibx: Pass through to the standard stdio.h. *
* *
* History: *
* 2012-10-17 JFL Created this file. *
* *
* © Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#include <stdio.h>
/*****************************************************************************\
* *
* Filename: stdio.h *
* *
* Description: MsvcLibX extensions to stdio.h. *
* *
* Notes: *
* *
* History: *
* 2014-06-03 JFL Created this file. *
* 2015-11-15 JFL Visual Studio 2015 moved this file to the Windows Kit UCRT.
* 2015-12-09 JFL Alias fputs to fputsU, and vfprintf to vfprintfU. *
* *
* Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifndef _MSVCLIBX_stdio_H
#define _MSVCLIBX_stdio_H 1
#include "msvclibx.h"
#include UCRT_INCLUDE_FILE(stdio.h) /* Include MSVC's own <stdio.h> file */
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
#define snprintf _snprintf /* This one _is_ standard */
#define popen _popen /* This one _is_ standard */
#define pclose _pclose /* This one _is_ standard */
/************************ MS-DOS-specific definitions ************************/
#ifdef _MSDOS /* Automatically defined when targeting an MS-DOS application */
/* Define functions fseeko and ftello */
#if defined(_LARGEFILE_SOURCE)
#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
/* TO DO: Windows 95 has extended functions for handling 64-bits files sizes */
#else
#endif
/* For now, use the MSVC 32-bits functions in all cases */
#define fseeko fseek
#define ftello ftell
#endif
/* Define standard 64-bits functions */
#if defined(_LARGEFILE_SOURCE64)
#define fseeko64 _fseek
#define ftello64 _ftell
#endif
#endif /* defined(_MSDOS) */
/************************ Win32-specific definitions *************************/
#ifdef _WIN32 /* Automatically defined when targeting a Win32 application */
#if defined(_UTF8_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
#define vfprintf vfprintfU /* For outputing UTF-8 strings */
#define fprintf fprintfU /* For outputing UTF-8 strings */
#define printf printfU /* For outputing UTF-8 strings */
#define fputs fputsU /* For outputing UTF-8 strings */
/* The UTF-8 output routines are defined in iconv.c */
extern int vfprintfU(FILE *f, const char *pszFormat, va_list vl);
extern int fprintfU(FILE *f, const char *pszFormat, ...);
extern int printfU(const char *pszFormat, ...);
extern int fputsU(const char *buf, FILE *f);
extern UINT codePage;
#endif
/* Define functions fseeko and ftello */
#if defined(_LARGEFILE_SOURCE)
#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
#define fseeko _fseeki64 /* _CONCAT(_fseeki64,_NS_SUFFIX) */
#define ftello _ftelli64 /* _CONCAT(_ftelli64,_NS_SUFFIX) */
#else
#define fseeko fseek
#define ftello ftell
#endif
#endif
/* Define standard 64-bits functions */
#if defined(_LARGEFILE_SOURCE64)
#define fseeko64 _fseeki64 /* _CONCAT(_fseeki64,_NS_SUFFIX) */
#define ftello64 _ftelli64 /* _CONCAT(_ftelli64,_NS_SUFFIX) */
#endif
#define fileno _fileno /* Avoid a warning about the deprecated name */
#endif /* defined(_WIN32) */
/************************* OS/2-specific definitions *************************/
#ifdef _OS2 /* Automatically defined when targeting an OS/2 application? */
/* Define functions fseeko and ftello */
#if defined(_LARGEFILE_SOURCE)
#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
#else
#endif
#define fseeko fseek
#define ftello ftell
#endif
/* Define standard 64-bits functions */
#if defined(_LARGEFILE_SOURCE64)
/* For now, hide the fact that DOS does not support 64-bits lengths */
#define fseeko64 _fseek
#define ftello64 _ftell
#endif
#endif /* defined(_OS2) */
/********************** End of OS-specific definitions ***********************/
#ifdef __cplusplus
}
#endif
#endif /* defined(_MSVCLIBX_stdio_H) */
/*****************************************************************************\
* *
* Filename: stdlib.h *
* *
* Description: MsvcLibX extensions to stdlib.h. *
* *
* Notes: *
* *
* History: *
* 2016-09-13 JFL Created this file. *
* *
* Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifndef _MSVCLIBX_stdlib_H
#define _MSVCLIBX_stdlib_H 1
#include "msvclibx.h"
#include UCRT_INCLUDE_FILE(stdlib.h) /* Include MSVC's own <stdlib.h> file */
#ifdef __cplusplus
extern "C" {
#endif
/************************ MS-DOS-specific definitions ************************/
#ifdef _MSDOS /* Automatically defined when targeting an MS-DOS application */
#endif /* defined(_MSDOS) */
/************************ Win32-specific definitions *************************/
#ifdef _WIN32 /* Automatically defined when targeting a Win32 application */
extern char *_fullpathU(char *absPath, const char *relPath, size_t maxLength);
#if defined(_UTF8_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
#define _fullpath _fullpathU /* For processing UTF-8 pathnames */
#endif
#endif /* defined(_WIN32) */
/********************** End of OS-specific definitions ***********************/
#ifdef __cplusplus
}
#endif
#endif /* defined(_MSVCLIBX_stdlib_H) */
/*****************************************************************************\
* *
* Filename sys/param.h *
* *
* Description DOS/WIN32 port of standard C library's sys/param.h. *
* *
* Notes *
* *
* History *
* 2014-06-10 JFL Created this file. *
* *
* Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifndef _SYS_PARAM_H
#define _SYS_PARAM_H
#ifdef _MSDOS
#define _POSIX_ARG_MAX 127 /* Maximum command line size */
#endif
#ifdef _WIN32
/* #include MSVC_INCLUDE_FILE(sys\param.h) /* Include MSVC's own <sys/param.h> file */
#define _POSIX_ARG_MAX 8191
#endif /* defined(_WIN32) */
#endif /* !defined(_SYS_PARAM_H) */
此差异已折叠。
/*****************************************************************************\
* *
* Filename sys/time.h *
* *
* Description DOS/WIN32 port of standard C library's sys/time.h. *
* *
* Notes MUST be included before any direct or indirect inclusion *
* of <windows.h>, as this sys/time.h file has a definition *
* of struct timeval conflicting with that in <winsock.h>, *
* and as a workaround it defines _WINSOCKAPI_ to prevent *
* <windows.h> from loading <winsock.h>. *
* *
* The same conflict exists with <winsock2.h>, but this one *
* is not loaded automatically, and hence should not be *
* visible to Unix apps built with the MsvcLibX library. *
* *
* History *
* 2014-02-11 JFL Created this file. *
* 2014-05-30 JFL Added the workaround for the conflict with <winsock.h>. *
* 2014-06-03 JFL Moved struct timespec definition from sys/stat.h. *
* Added macros TIMEVAL_TO_TIMESPEC & TIMESPEC_TO_TIMEVAL. *
* 2016-07-06 JFL Avoid error if winsocks2.h has been previously included. *
* *
* ?Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#include <time.h> /* for time_t definition */
#ifndef _SYS_TIME_H
#define _SYS_TIME_H
#ifdef _MSDOS
/* MS-DOS only has a 2-second resolution on file times.
Use the existence of macro _STRUCT_TIMEVAL to test if it's possible
to use utimes(), else use utime(), which is supported by all OSs */
#endif
#ifdef _WIN32
/* There's a conflict with the timeval definition in winsock.h, which uses
a long instead of a time_t for tv_sec. See:
C:\Pgm64\Microsoft SDKs\Windows\v7.0\INCLUDE\winsock.h
*/
#define _WINSOCKAPI_ /* Prevent the inclusion of winsock.h in windows.h */
/* Could also #define WIN32_LEAN_AND_MEAN /* Avoid including many optional Windows features, including winsock.h */
#include <windows.h> /* For WCHAR */
#ifndef _STRUCT_TIMEVAL
#define _STRUCT_TIMEVAL 1
#ifndef _WINSOCK2API_ /* Prevent compilation errors if winsocks2.h has been previously included */
/* A time value with microsecond precision */
struct timeval {
time_t tv_sec; /* Seconds */
int tv_usec; /* Signed count of microseconds */
};
#endif /* _WINSOCK2API */
#endif /* !defined(_STRUCT_TIMEVAL) */
/* 2015-12-04 JFL Bug fix: With VS14/VC19, the UCRT defines timespec, with a long tv_nsec */
#ifndef _UCRT
#ifndef _STRUCT_TIMESPEC
#define _STRUCT_TIMESPEC
/* A time value with nanosecond precision */
struct timespec {
time_t tv_sec; /* Seconds */
int tv_nsec; /* Signed count of nanoseconds */
};
#define _TIMESPEC_DEFINED /* Some packages test this before redefining it */
#endif /* !defined(_STRUCT_TIMESPEC) */
#endif /* !defined(_UCRT) */
#define TIMEVAL_TO_TIMESPEC(ptv, pts) { \
(pts)->tv_sec = (ptv)->tv_sec; \
(pts)->tv_nsec = (ptv)->tv_usec * 1000; \
}
#define TIMESPEC_TO_TIMEVAL(ptv, pts) { \
(ptv)->tv_sec = (pts)->tv_sec; \
(ptv)->tv_usec = (pts)->tv_nsec / 1000; \
}
/* Change the file access time to tvp[0] and its modification time to tvp[1]. */
int utimesA(const char *file, const struct timeval tvp[2]);
int utimesU(const char *file, const struct timeval tvp[2]);
int utimesW(const WCHAR *file, const struct timeval tvp[2]);
/* Same as 'utimes', but does not follow symbolic links. */
int lutimesA(const char *path, const struct timeval tvp[2]);
int lutimesU(const char *path, const struct timeval tvp[2]);
int lutimesW(const WCHAR *path, const struct timeval tvp[2]);
/* Same as 'utimes', but takes an open file descriptor instead of a name. */
int futimes(int fd, const struct timeval tvp[2]);
#if defined(_UTF8_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
#define utimes utimesU
#define lutimes lutimesU
#else /* _ANSI_SOURCE */
#define utimes utimesA
#define lutimes lutimesA
#endif
/* Get the current date and time into a struct timeval */
int gettimeofday(struct timeval *ptv, void *pTimeZone);
#endif /* defined(_WIN32) */
#endif /* !defined(_SYS_TIME_H) */
/*****************************************************************************\
* *
* Filename: sys/types.h *
* *
* Description: Add missing definitions in MSVC's sys/types.h. *
* *
* Notes: *
* *
* History: *
* 2014-05-26 JFL Created this file. *
* 2014-06-06 JFL Moved mode_t & off*_t definitions here, from sys\stat.h. *
* 2015-11-15 JFL Visual Studio 2015 moved this file to the Windows Kit UCRT.
* *
* Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifndef _MSVCLIBX_SYS_TYPES_H
#define _MSVCLIBX_SYS_TYPES_H 1
#include "msvclibx.h"
#include UCRT_INCLUDE_FILE(sys\types.h) /* Include MSVC's own <sys/types.h> file */
/************************ MS-DOS-specific definitions ************************/
#ifdef _MSDOS /* Automatically defined when targeting an MS-DOS application */
/* File offset type */
/* For now, use the MSVC 32-bits functions in all cases */
#define off_t _off_t
typedef int pid_t; /* The pid is the PSP segment. MSVC's process.h defines it as int. */
#endif /* defined(_MSDOS) */
/************************ Win32-specific definitions *************************/
#ifdef _WIN32 /* Automatically defined when targeting a Win32 application */
/* File offset types */
#define off64_t __int64 /* Don't use a typedef because MSVC's _fseeki64 doesn't like it */
#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
#define off_t off64_t
#else
#define off_t _off_t
#endif
typedef unsigned long DWORD; /* Don't include <windows.h> to get DWORD definition, as this draws too much,
including things we want to override in other parts of MsvcLibX */
typedef DWORD pid_t; /* Windows defines it as a DWORD */
#endif /* defined(_WIN32) */
/************************* OS/2-specific definitions *************************/
#ifdef _OS2 /* Automatically defined when targeting an OS/2 application? */
/* File offset type */
/* For now, use the MSVC 32-bits functions in all cases */
#define off_t _off_t
#endif /* defined(_OS2) */
/********************** End of OS-specific definitions ***********************/
/* Signed size type */
#ifndef _SSIZE_T_DEFINED
#if defined(_MSDOS)
typedef int ssize_t;
#elif defined(_WIN32)
#include <stdint.h>
#ifdef _WIN64
typedef __int64 ssize_t;
#else
typedef _W64 int ssize_t;
#endif /* defined(_WIN64) */
#endif /* defined(_WIN32) */
#define _SSIZE_T_DEFINED
#endif /* !_SSIZE_T_DEFINED */
/* MsvcLibX handles uid_t and gid_t in pwd.c and grp.c */
typedef int gid_t;
typedef int uid_t;
/* MsvcLibX uses mode_t in sys/stat.h */
typedef int mode_t;
/* File link counts type (not used by MsvcLibX so far) */
typedef int nlink_t; /* Is short in some Unix versions */
#endif /* !defined(_MSVCLIBX_SYS_TYPES_H) */
/*****************************************************************************\
* *
* Filename: sys/utsname.h *
* *
* Description: Defines structure utsname and function uname(). *
* *
* Notes: *
* *
* History: *
* 2014-05-30 JFL Created this file. *
* *
* Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifndef _SYS_UTSNAME_H
#define _SYS_UTSNAME_H 1
#include "msvclibx.h"
struct utsname {
char *sysname; /* Name of this implementation of the operating system */
char *nodename; /* Name of this node on the network */
char *release; /* Current release level of this implementation */
char *version; /* Current version level of this release */
char *machine; /* Name of the hardware type on which the system is running */
};
int uname(struct utsname *);
#endif /* _SYS_UTSNAME_H */
/* CoreUtils global system configuration definitions */
/*****************************************************************************\
* *
* Filename: time.h *
* *
* Description: MsvcLibX extensions to time.h. *
* *
* Notes: *
* *
* History: *
* 2014-06-04 JFL Created this file. *
* 2015-11-15 JFL Visual Studio 2015 moved this file to the Windows Kit UCRT.
* *
* ?Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifndef _MSVCLIBX_TIME_H
#define _MSVCLIBX_TIME_H 1
#include "msvclibx.h"
#include WINSDK_INCLUDE_FILE(winsock2.h)
#include UCRT_INCLUDE_FILE(time.h) /* Include MSVC's own <time.h> file */
#ifdef _MSDOS
/* Check for the definition of _STRUCT_TIMESPEC before using clock_gettime().
If it's not defined, use time() instead, which is supported by all OSs. */
#endif /* defined(_MSDOS) */
#ifdef _WIN32
#include "sys\time.h" /* for struct timespec */
typedef int clockid_t;
/* Supported values for clockid_t */
#define CLOCK_REALTIME 0
int clock_gettime(clockid_t clock_id, struct timespec *tp);
#endif /* defined(_WIN32) */
#endif /* defined(_MSVCLIBX_TIME_H) */
/*****************************************************************************\
* *
* Filename: unistd.h *
* *
* Description: DOS/WIN32 port of standard C library's unistd.h. *
* *
* Notes: *
* *
* History: *
* 2012-01-18 JFL Created this file. *
* 2012-10-17 JFL Added standard functions getcwd, chdir, getpid, access. *
* Added Microsoft-specific functions getdrive, chdrive. *
* 2013-03-27 JFL Updated getpid() and added getppid(). *
* 2014-02-03 JFL Added readlink(). *
* 2014-03-20 JFL Restructured Windows link management functions into Wide *
* and MultiByte versions, and changed the Unicode and Ansi *
* versions to macros. *
* 2014-06-30 JFL Moved PATH_MAX definition to limits.h. *
* 2016-08-25 JFL Implemented ResolveLinksA(). *
* *
* ?Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifndef _UNISTD_H
#define _UNISTD_H
#ifndef _MSC_VER
#error This include file is designed for use with the Microsoft C tools only.
#endif
#include "msvclibx.h" /* Generate a library search record to load MsvcLibX.lib. */
#include "sys/types.h" /* Define pid_t and getppid(). */
#include "dirent.h" /* Define pid_t and getppid(). */
#include <direct.h> /* For functions like _chdir() and _getcwd() */
#include <process.h> /* For _getpid() */
/* Microsoft tools think these are non standard, but they are standard! */
/* #define getcwd _getcwd */
/* #define chdir _chdir */
/* Actually use the improved versions in MsvcLibX */
#undef getcwd /* MSVC _does_ define a getcwd macro, in addition to the getcwd function! */
#if defined(_MSDOS)
#define getcwd(path, size) _getcwd(path, (int)(size)) /* Use MSVC LIB's own, changing argument 2 type */
#elif defined(_WIN32)
#if defined(_UTF8_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
#define getcwd getcwdU
#define _getdcwd _getdcwdU
#define chdir chdirU
#else /* _ANSI_SOURCE */
#define getcwd getcwdA
#define _getdcwd _getdcwdA
#define chdir chdirA
#endif
char *getcwdA(char *buf, size_t bufSize); /* Can't use the getcwd name, as MSVC has an incompatible prototype for it */
char *_getdcwdA(int iDrive, char *buf, int iBuflen);
char *getcwdU(char *buf, size_t bufSize); /* Can't use the getcwd name, as MSVC has an incompatible prototype for it */
char *_getdcwdU(int iDrive, char *buf, int iBuflen);
#endif /* defined(_MSDOS) */
int chdir(const char *path);
/* These are non standard indeed, but the leading _ is annoying */
#define getdrive _getdrive
#define chdrive _chdrive
#include <io.h> /* For low level I/O functions like read() & write() */
/* Microsoft tools think access is non standard, but it is standard! */
#if defined(_MSDOS)
#define access _access
#elif defined(_WIN32)
#if defined(_UTF8_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
#define access _accessU
int _accessU(const char *pszFilename, int iAccessMode);
#else /* _ANSI_SOURCE */
#define access _access
#endif
#endif
#define F_OK 0 /* test for the existence of the file */
#define X_OK 1 /* test for execute permission */
#define R_OK 2 /* test for read permission */
#define W_OK 4 /* test for read permission */
/* getpid() and getppid() */
#define getpid() ((pid_t)(_getpid()))
pid_t getppid(void); /* Get parent PID */
/* Contrary to in Unix, the above functions can fail in Windows. In this case they return INVALID_PID. */
#define INVALID_PID ((pid_t)-1L)
/* Path management */
#if defined(_WIN32)
#if defined(_UTF8_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
#define realpath realpathU
#define CompactPath CompactPathU
#else /* _ANSI_SOURCE */
#define realpath realpathA
#define CompactPath CompactPathA
#endif
#endif /* defined(_WIN32) */
char *realpath(const char *path, char *buf); /* Posix routine, normally defined in stdlib.h. Output buf must contain PATH_MAX bytes */
int CompactPath(const char *path, char *outbuf, size_t bufsize); /* A proprietary subroutine, that cleans up . and .. parts. */
/* Signed size type */
#ifndef _SSIZE_T_DEFINED
#if defined(_MSDOS)
typedef int ssize_t;
#elif defined(_WIN32)
#include <stdint.h>
#ifdef _WIN64
typedef __int64 ssize_t;
#else
typedef _W64 int ssize_t;
#endif /* defined(_WIN64) */
#endif /* defined(_WIN32) */
#define _SSIZE_T_DEFINED
#endif /* !_SSIZE_T_DEFINED */
/* Link management functions */
#if defined(_WIN32)
#if defined(_UTF8_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
#define readlink readlinkU
#define symlink symlinkU
#define symlinkd symlinkdU
#define junction junctionU
#define GetReparseTag GetReparseTagU
#define ResolveLinks ResolveLinksU
#else /* _ANSI_SOURCE */
#define readlink readlinkA
#define symlink symlinkA
#define symlinkd symlinkdA
#define junction junctionA
#define GetReparseTag GetReparseTagA
#define ResolveLinks ResolveLinksA
#endif
ssize_t readlinkW(const WCHAR *path, WCHAR *buf, size_t bufsiz); /* Posix routine readlink - Wide char version */
ssize_t readlinkM(const char *path, char *buf, size_t bufsiz, UINT cp); /* Posix routine readlink - Multibyte char version */
#define readlinkA(path, buf, bufsiz) readlinkM(path, buf, bufsiz, CP_ACP) /* Posix routine readlink - ANSI version */
#define readlinkU(path, buf, bufsiz) readlinkM(path, buf, bufsiz, CP_UTF8) /* Posix routine readlink - UTF-8 version */
int symlinkW(const WCHAR *targetname, const WCHAR *newlinkname); /* Posix routine symlink - Wide char version */
int symlinkM(const char *targetname, const char *newlinkname, UINT cp); /* Posix routine symlink - Multibyte char version */
#define symlinkA(target, newlink) symlinkM(target, newlink, CP_ACP) /* Posix routine symlink - ANSI version */
#define symlinkU(target, newlink) symlinkM(target, newlink, CP_UTF8) /* Posix routine symlink - UTF-8 version */
int symlinkdW(const WCHAR *targetname, const WCHAR *newlinkname); /* MsvcLibX Create an NTFS symlinkd - Wide char version */
int symlinkdM(const char *targetname, const char *newlinkname, UINT cp); /* MsvcLibX Create an NTFS symlinkd - Multibyte char version */
#define symlinkdA(target, newlink) symlinkdM(target, newlink, CP_ACP) /* MsvcLibX Create an NTFS symlinkd - ANSI version */
#define symlinkdU(target, newlink) symlinkdM(target, newlink, CP_UTF8) /* MsvcLibX Create an NTFS symlinkd - UTF-8 version */
int junctionW(const WCHAR *targetname, const WCHAR *junctionName); /* MsvcLibX Create an NTFS junction - Wide char version */
int junctionM(const char *targetname, const char *junctionName, UINT cp); /* MsvcLibX Create an NTFS junction - Multibyte char version */
#define junctionA(target, newjunc) junctionM(target, newjunc, CP_ACP) /* MsvcLibX Create an NTFS junction - ANSI version */
#define junctionU(target, newjunc) junctionM(target, newjunc, CP_UTF8) /* MsvcLibX Create an NTFS junction - UTF-8 version */
DWORD GetReparseTagW(const WCHAR *path); /* MsvcLibX Get a Repase Point tag - Wide char version */
DWORD GetReparseTagM(const char *path, UINT cp); /* MsvcLibX Get a Repase Point tag - MultiByte char version */
#define GetReparseTagA(path) GetReparseTagM(path, CP_ACP) /* MsvcLibX Get a Repase Point tag - ANSI version */
#define GetReparseTagU(path) GetReparseTagM(path, CP_UTF8) /* MsvcLibX Get a Repase Point tag - ANSI version */
int ResolveLinksA(const char *path, char *buf, size_t bufsize); /* Resolve pathnames with symlinks, symlinkds, and junctions */
int ResolveLinksU(const char *path, char *buf, size_t bufsize); /* Resolve pathnames with symlinks, symlinkds, and junctions */
#ifndef ELOOP
/*
// Unix defines ELOOP as errno 40.
// MS Visual C++ 1.52 for DOS is standard up to errno 34, then diverges up to errno 36.
// Many errnos within the list are actually unused, and for them _sys_errlist[] = "".
// MS Visual C++ 9 for Windows is standard up to errno 34, then diverges up to errno 43.
// Also MSVC9 does not define errno:
// 15 // The posix standard ENOTBLK "Block device required"
// 26 // The posix standard ETXTBSY "Text file busy"
// 35 // Positioned between standard ERANGE and EDEADLK
// 37 // Positioned between standard EDEADLK and ENAMETOOLONG
// 43 // Positioned last, after standard ENOTEMPTY
// The _sys_errlist[] pointer for all the above points to a single string "Unknown error".
*/
#define ELOOP 35 /* Using the first available slot */ /* Update _sys_errlist[ELOOP] accordingly in any routine that generates ELOOP! */
#endif /* !defined(ELOOP) */
#define SYMLOOP_MAX 31 /* Maximum depth of symbolic name resolution, to avoid stack overflows. Windows is documented to allow 31: http://msdn.microsoft.com/en-us/library/windows/desktop/aa365460(v=vs.85).aspx */
#endif /* defined(_WIN32) */
/* Standard file descriptor numbers, for low level I/O functions */
#define STDIN_FILENO 0 /* Standard input file number */
#define STDOUT_FILENO 1 /* Standard output file number */
#define STDERR_FILENO 2 /* Standard error file number */
#endif /* _UNISTD_H */
/*****************************************************************************\
* *
* Filename: utime.h *
* *
* Description: DOS/WIN32 adaptation of standard C library's utime.h. *
* *
* Notes: The Unix standard now standardizes utime.h location in *
* the include directory itself. *
* Microsoft put it in the include/sys subdirectory. *
* *
* History: *
* 2014-12-13 JFL Created this file. *
* *
* Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifndef _MSVXLIBX_UTIME_H
#define _MSVXLIBX_UTIME_H
/* In MS-DOS, simply use MSVC's sys/utime.h. */
#ifdef _MSDOS
#include <sys/utime.h>
#define lutime utime /* There are no links in MS-DOS, so lutime() is the same as utime() */
#endif /* _MSDOS */
/* In Windows, we use MSVC's sys/utime.h, but redefine the utime*() functions. */
#ifdef _WIN32
#include "msvclibx.h" /* Generate a library search record to load MsvcLibX.lib. */
/* Save the initial definition and value of __STDC__ */
#ifdef __STDC__
#define _UTIME__STDC__WAS_DEFINED 1
#pragma push_macro("__STDC__")
#undef __STDC__
#else
#define _UTIME__STDC__WAS_DEFINED 0
#endif
#define __STDC__ 1 /* Prevents <sys/utime.h> from defining structures and functions without _ */
#include <sys/utime.h>
#ifdef _USE_32BIT_TIME_T
#define utimbuf __utimbuf32
#define utime _utime32x
#error "32-bits time_t not supported in MsvcLibX' utime."
#else
#define utimbuf __utimbuf64
#if defined(_UTF8_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
#define utime utimeU
#define lutime lutimeU
#else /* _ANSI_SOURCE */
#define utime utimeA
#define lutime lutimeA
#endif
#endif
/* Our redefinition in utime.c */
int utimeA(const char * pszFilename, const struct utimbuf * pUtimbuf);
int lutimeA(const char * pszFilename, const struct utimbuf * pUtimbuf);
int utimeU(const char * pszFilename, const struct utimbuf * pUtimbuf);
int lutimeU(const char * pszFilename, const struct utimbuf * pUtimbuf);
int utimeW(const WCHAR * pszFilename, const struct utimbuf * pUtimbuf);
int lutimeW(const WCHAR * pszFilename, const struct utimbuf * pUtimbuf);
int futime(int fd, const struct utimbuf * pUtimbuf);
#undef __STDC__
/* Restore the initial definition and value of __STDC__ */
#if _UTIME__STDC__WAS_DEFINED
#pragma pop_macro("__STDC__")
#endif
#undef _UTIME__STDC__WAS_DEFINED
#endif /* _WIN32 */
#endif /* _MSVXLIBX_UTIME_H */
/*****************************************************************************\
* *
* Filename: windows.h *
* *
* Description: Define MsvcLibX' extensions to the WIN32 API functions *
* *
* Notes: *
* *
* History: *
* 2016-09-12 JFL Created this file. *
* *
* Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifndef _MSVCLIBX_WINDOWS_H
#define _MSVCLIBX_WINDOWS_H 1
#include "msvclibx.h"
#ifdef _WIN32
#include WINSDK_INCLUDE_FILE(windows.h) /* Include Windows SDK's own windows.h */
/****************** Define UTF-8 versions of WIN32 routines ******************/
#ifdef __cplusplus
extern "C" {
#endif
DWORD WINAPI GetFileAttributesU(LPCTSTR lpFileName);
BOOL WINAPI GetFileAttributesExU(LPCTSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation);
DWORD WINAPI GetFullPathNameU(LPCTSTR lpName, DWORD nBufferLength, LPTSTR lpBuf, LPTSTR *lpFilePart);
DWORD WINAPI GetLongPathNameU(LPCTSTR lpShortName, LPTSTR lpBuf, DWORD nBufferLength);
#ifdef __cplusplus
}
#endif
/********** Redefine the legacy names to point to the UTF-8 version **********/
#if defined(_UTF8_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
#undef GetFileAttributes
#define GetFileAttributes GetFileAttributesU
#undef GetFileAttributesEx
#define GetFileAttributesEx GetFileAttributesExU
#undef GetFullPathName
#define GetFullPathName GetFullPathNameU
#undef GetLongPathName
#define GetLongPathName GetLongPathNameU
#endif /* defined(_UTF8_SOURCE) ... */
#endif /* defined(_WIN32) */
#endif /* defined(_MSVCLIBX_WINDOWS_H) */
/*****************************************************************************\
* *
* Filename: error.h *
* *
* Description: DOS/WIN32 port of the GNU CoreUtils library xfreopen func.*
* *
* Notes: msvclibx: Implement using freopen or _setmode. *
* *
* History: *
* 2014-02-10 JFL Created this file. *
* *
* Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#include "msvclibx.h" /* Generate a library search record to load MsvcLibX.lib. */
extern FILE *xfreopen(const char *filename, const char *mode, FILE *stream);
@echo off
:#*****************************************************************************
:# *
:# Filename: make.bat *
:# *
:# Description: Build DOS and Windows targets *
:# *
:# Notes: Proxy script for %STINCLUDE%\make.bat. *
:# *
:# If any change is needed, put it in %STINCLUDE%\make.bat. *
:# *
:# History: *
:# 2016-10-10 JFL jf.larvoire@hpe.com created this file. *
:# 2016-12-15 JFL Search for the real make.bat in [.|..|../..]\include. *
:# *
:# Copyright 2016 Hewlett Packard Enterprise Development LP *
:# Licensed under the Apache 2.0 license www.apache.org/licenses/LICENSE-2.0 *
:#*****************************************************************************
:# Get the full pathname of the STINCLUDE library directory
if defined STINCLUDE if not exist "%STINCLUDE%\make.bat" set "STINCLUDE=" &:# Allow overriding with another alias name, but ignore invalid overrides
for %%p in (. .. ..\..) do if not defined STINCLUDE if exist %%p\include\make.bat ( :# Default: Search it the current directory, and 2 levels above.
for /f "delims=" %%d in ('"pushd %%p\include & cd & popd"') do SET "STINCLUDE=%%d"
)
if not defined STINCLUDE ( :# Try getting the copy in the master environment
for /f "tokens=3" %%v in ('reg query "HKCU\Environment" /v STINCLUDE 2^>NUL') do set "STINCLUDE=%%v"
)
if not exist %STINCLUDE%\make.bat (
>&2 echo %0 Error: Cannot find SysToolsLib's global C include directory. Please define variable STINCLUDE.
exit /b 1
)
if [%1]==[-d] echo "%STINCLUDE%\make.bat" %*
"%STINCLUDE%\make.bat" %*
###############################################################################
# #
# File name Files.mak #
# #
# Description MsvcLibX Specific file dependancies #
# #
# Notes #
# #
# History #
# 2012-10-21 JFL Initial version #
# 2013-03-27 JFL Added debugv.obj and getppid.obj. #
# 2014-02-03 JFL Added readlink.obj. #
# 2014-02-05 JFL Added symlink.obj. #
# 2014-02-06 JFL Added lstat*.obj. #
# 2014-02-10 JFL Added realpath.obj. #
# 2014-02-17 JFL Added err2errno.obj. #
# 2014-02-26 JFL Added filetime.obj. #
# 2014-02-27 JFL Added iconv.obj. #
# 2014-02-28 JFL Added chdir.obj and getcwd.obj. #
# 2014-03-04 JFL Added fopen.obj. #
# 2014-03-06 JFL Added strerror.obj. #
# 2014-03-24 JFL Added access.obj. #
# 2014-03-27 JFL Added spawn.obj. #
# 2014-05-30 JFL Moved here the OBJECTS macro definition from NMakeFile. #
# Added uname.obj and utimes.obj. #
# 2014-06-04 JFL Added clock_gettime.obj and gettimeofday.obj. #
# 2014-06-24 JFL Added fstat64.obj and fstat64i32.obj. #
# 2014-07-01 JFL Added mb2wpath.obj. #
# 2016-09-08 JFL Added basename.obj and dirname.obj. #
# 2016-09-12 JFL Added WIN32_OBJECTS, and several WIN32 UTF-8 routines. #
# 2016-10-11 JFL moved debugm.h to SysToolsLib global C include dir. #
# 2017-02-16 JFL Added open.obj. #
# #
# Copyright 2016 Hewlett Packard Enterprise Development LP #
# Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 #
###############################################################################
# List of object files to build and include in the MsvcLibX library
# IMPORTANT NOTE: Every time you add an object file in the list here, also
# store its specific source file dependancies below.
OBJECTS = \
+access.obj \
+basename.obj \
+chdir.obj \
+clock_gettime.obj \
+debugv.obj \
+dirent.obj \
+dirname.obj \
+err2errno.obj \
+filetime.obj \
+fnmatch.obj \
+fopen.obj \
+fstat64i32.obj \
+fstat64.obj \
+getcwd.obj \
+getopt.obj \
+getppid.obj \
+gettimeofday.obj \
+iconv.obj \
+lstat64i32.obj \
+lstat64.obj \
+main.obj \
+mb2wpath.obj \
+mkdir.obj \
+mkdtemp.obj \
+mkstemp.obj \
+open.obj \
+readlink.obj \
+realpath.obj \
+spawn.obj \
+strerror.obj \
+strndup.obj \
+strptime.obj \
+symlink.obj \
+uname.obj \
+utime.obj \
+utimes.obj \
+xfreopen.obj \
# +lstat32.obj \
# +lstat32i64.obj \
# WIN32 UTF-8 extension routines, used for implementing UTF-8 support for WIN32 libc.
WIN32_OBJECTS = \
+GetFileAttributes.obj \
+GetFileAttributesEx.obj \
+GetFullPathName.obj \
+GetLongPathName.obj \
+fullpath.obj \
# GnuLib routines that I mistakenly defined here
REMOVED_OBJECTS = \
+error.obj \
+initmain.obj \
+xnmalloc.obj \
###############################################################################
# Include files dependancies #
###############################################################################
I=..\include
CI=$(STINCLUDE)
$(I)\chdir.h: $(I)\unistd.h $(I)\iconv.h $(CI)\debugm.h
$(I)\config.h: $(I)\msvclibx.h $(I)\stdbool.h $(I)\unistd.h
$(I)\direct.h: $(I)\msvclibx.h
$(I)\dirent.h: $(I)\inttypes.h $(I)\sys\stat.h
$(I)\error.h: $(I)\msvclibx.h
# $(I)\fadvise.h:
$(I)\fcntl.h: $(I)\msvclibx.h
$(I)\fnmatch.h: $(I)\msvclibx.h
$(I)\getcwd.h: $(I)\unistd.h $(CI)\debugm.h
# $(I)\getopt.h:
$(I)\grp.h: $(I)\msvclibx.h
# $(I)\inttypes.h:
# $(I)\msvclibx.h:
# $(I)\netdb.h:
$(I)\process.h: $(I)\msvclibx.h
$(I)\pwd.h: $(I)\msvclibx.h
# $(I)\regex.h:
$(I)\sys\stat.h: $(I)\msvclibx.h $(I)\sys\types.h
# $(I)\stdbool.h:
# $(I)\stdint.h:
$(I)\stdio.h: $(I)\msvclibx.h
# $(I)\stdio--.h:
$(I)\stdlib.h: $(I)\msvclibx.h
# $(I)\system.h:
$(I)\unistd.h: $(I)\msvclibx.h $(I)\dirent.h
# $(I)\utime.h:
$(I)\windowsU.h: $(I)\msvclibx.h
$(I)\xfreopen.h: $(I)\msvclibx.h
$(I)\sys\types.h: $(I)\msvclibx.h
###############################################################################
# Source files dependancies #
###############################################################################
access.c: $(I)\MsvcLibX.h $(CI)\debugm.h
basename.c: $(I)\libgen.h
chdir.c: $(CI)\debugm.h $(I)\iconv.h $(I)\unistd.h
clock_gettime.c: $(I)\MsvcLibX.h $(I)\time.h $(I)\sys\stat.h
debugv.c: $(CI)\debugm.h
dirent.c: $(CI)\debugm.h $(I)\dirent.h $(I)\sys\stat.h $(I)\unistd.h
dirname.c: $(I)\libgen.h
err2errno.c: $(I)\MsvcLibX.h $(CI)\debugm.h
error.c: $(I)\config.h $(I)\error.h
filetime.c: $(I)\sys\stat.h
fnmatch.c: $(CI)\debugm.h $(I)\fnmatch.h
fopen.c: $(I)\MsvcLibX.h
fstat64.c: fstat.c $(CI)\debugm.h $(I)\dirent.h $(I)\MsvcLibX.h $(I)\sys\stat.h $(I)\stdint.h
fstat64i32.c: fstat.c $(CI)\debugm.h $(I)\dirent.h $(I)\MsvcLibX.h $(I)\sys\stat.h $(I)\stdint.h
fullpath.c: $(I)\stdlib.h $(I)\limits.h
getcwd.c: $(CI)\debugm.h $(I)\unistd.h
GetFileAttributesU.c: $(I)\windowsU.h $(I)\limits.h
GetFileAttributesExU.c: $(I)\windowsU.h $(I)\limits.h
GetFullPathNameU.c: $(I)\windowsU.h $(I)\limits.h
GetLongPathNameU.c: $(I)\windowsU.h $(I)\limits.h
getopt.c: $(I)\getopt.h
# getppid.c:
gettimeofday.c: $(I)\MsvcLibX.h $(I)\time.h $(I)\sys\time.h
grp.c: $(I)\grp.h
iconv.c: $(I)\iconv.h
initmain.c: $(I)\config.h
lstat32.c: lstat.c $(CI)\debugm.h $(I)\dirent.h $(I)\MsvcLibX.h $(I)\sys\stat.h $(I)\stdint.h $(I)\unistd.h
lstat32i64.c: lstat.c $(CI)\debugm.h $(I)\dirent.h $(I)\MsvcLibX.h $(I)\sys\stat.h $(I)\stdint.h $(I)\unistd.h
lstat64.c: lstat.c $(CI)\debugm.h $(I)\dirent.h $(I)\MsvcLibX.h $(I)\sys\stat.h $(I)\stdint.h $(I)\unistd.h
lstat64i32.c: lstat.c $(CI)\debugm.h $(I)\dirent.h $(I)\MsvcLibX.h $(I)\sys\stat.h $(I)\stdint.h $(I)\unistd.h
main.c: $(I)\MsvcLibX.h
mb2wpath.c: $(I)\MsvcLibX.h $(CI)\debugm.h
mkdir.c: $(I)\MsvcLibX.h $(I)\sys\stat.h
mkdtemp.c: $(I)\unistd.h
mkstemp.c: $(I)\unistd.h
open.c: $(I)\MsvcLibX.h $(I)\fcntl.h $(CI)\debugm.h
pwd.c: $(I)\pwd.h
readlink.c: $(CI)\debugm.h $(I)\unistd.h $(I)\reparsept.h
realpath.c: $(CI)\debugm.h $(I)\unistd.h
spawm.c: $(CI)\debugm.h $(I)\MsvcLibX.h $(I)\process.h
strerror.c: $(I)\MsvcLibX.h
# strndup.c:
# strptime.c:
symlink.c: $(CI)\debugm.h $(I)\reparsept.h $(I)\unistd.h
uname.c: $(I)\MsvcLibX.h $(I)\sys\utsname.h
utime.c: $(CI)\debugm.h $(I)\unistd.h $(I)\utime.h $(I)\sys\time.h
xfreopen.c: $(I)\xfreopen.h
xnmalloc.c: $(I)\config.h
/*****************************************************************************\
* *
* Filename GetFileAttributes.c *
* *
* Description: UTF-8 version of WIN32's GetFileAttributes() *
* *
* Notes: *
* *
* History: *
* 2016-09-12 JFL Created this file. *
* *
* ?Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifdef _WIN32 /* Automatically defined when targeting a Win32 application */
#include <windows.h> /* Also includes MsvcLibX' WIN32 UTF-8 extensions */
#include <limits.h>
/*---------------------------------------------------------------------------*\
* *
| Function: GetFileAttributesU |
| |
| Description: Get atributes for a UTF-8 path. |
| |
| Parameters: See WIN32's GetFileAttributes() |
| |
| Return value: The file attributes flags |
| |
| Notes: |
| |
| History: |
| 2014-07-02 JFL Created this routine |
* *
\*---------------------------------------------------------------------------*/
DWORD WINAPI GetFileAttributesU(LPCTSTR lpFileName) {
WCHAR *pwszName;
DWORD dwAttrs;
int n;
/* Allocate a buffer large enough for any Unicode pathname */
pwszName = (void *)LocalAlloc(LMEM_FIXED, UNICODE_PATH_MAX * sizeof(WCHAR));
if (!pwszName) return 0;
/* Convert the pathname to a unicode string, with the proper extension prefixes if it's longer than 260 bytes */
n = MultiByteToWidePath(CP_UTF8, /* CodePage, (CP_ACP, CP_OEMCP, CP_UTF8, ...) */
lpFileName, /* lpMultiByteStr, */
pwszName, /* lpWideCharStr, */
UNICODE_PATH_MAX /* cchWideChar, */
);
if (!n) {
LocalFree((HLOCAL)pwszName);
return 0;
}
/* Get the file attributes, using the Unicode version of the function */
dwAttrs = GetFileAttributesW(pwszName);
/* Cleanup and return */
LocalFree((HLOCAL)pwszName);
return dwAttrs;
}
#endif /* defined(_WIN32) */
/*****************************************************************************\
* *
* Filename GetFileAttributesEx.c *
* *
* Description: UTF-8 version of WIN32's GetFileAttributesEx() *
* *
* Notes: *
* *
* History: *
* 2016-09-12 JFL Created this file. *
* *
* Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifdef _WIN32 /* Automatically defined when targeting a Win32 application */
#include <windows.h> /* Also includes MsvcLibX' WIN32 UTF-8 extensions */
#include <limits.h>
/*---------------------------------------------------------------------------*\
* *
| Function: GetFileAttributesExU |
| |
| Description: Get file information for a UTF-8 pathname. |
| |
| Parameters: See WIN32's GetFileAttributesEx() |
| |
| Return value: 1 = done, or 0 if error |
| |
| Notes: Sets the file length, dates, attributes, etc. |
| |
| History: |
| 2016-09-12 JFL Created this routine. |
* *
\*---------------------------------------------------------------------------*/
BOOL WINAPI GetFileAttributesExU(
LPCTSTR lpFileName,
GET_FILEEX_INFO_LEVELS fInfoLevelId,
LPVOID lpFileInformation
) {
WIN32_FILE_ATTRIBUTE_DATA *lpFileData = lpFileInformation;
WCHAR *pwszName;
BOOL bDone;
int n;
/* Allocate a buffer large enough for any Unicode pathname */
pwszName = (void *)LocalAlloc(LMEM_FIXED, UNICODE_PATH_MAX * sizeof(WCHAR));
if (!pwszName) return 0;
/* Convert the pathname to a unicode string, with the proper extension prefixes if it's longer than 260 bytes */
n = MultiByteToWidePath(CP_UTF8, /* CodePage, (CP_ACP, CP_OEMCP, CP_UTF8, ...) */
lpFileName, /* lpMultiByteStr, */
pwszName, /* lpWideCharStr, */
UNICODE_PATH_MAX /* cchWideChar, */
);
if (!n) {
LocalFree((HLOCAL)pwszName);
return 0;
}
/* Get the file information, using the Unicode version of the function */
bDone = GetFileAttributesExW(pwszName, fInfoLevelId, lpFileData);
/* Cleanup and return */
LocalFree((HLOCAL)pwszName);
return bDone;
}
#endif /* defined(_WIN32) */
/*****************************************************************************\
* *
* Filename GetFullPathName.c *
* *
* Description: UTF-8 version of WIN32's GetFullPathName() *
* *
* Notes: *
* *
* History: *
* 2016-09-12 JFL Created this file, from the routine in truename.c. *
* *
* Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#ifdef _WIN32 /* Automatically defined when targeting a Win32 application */
#include <windows.h> /* Also includes MsvcLibX' WIN32 UTF-8 extensions */
#include <limits.h>
#include "debugm.h" /* MsvcLibX debugging macros */
/*---------------------------------------------------------------------------*\
* *
| Function: GetFullPathNameU |
| |
| Description: Get the absolute pathname for a relative UTF-8 path. |
| |
| Parameters: See WIN32's GetFullPathName() |
| |
| Return value: The length of the full pathname, or 0 if error |
| |
| Notes: Warning: Windows' GetFullPathname trims trailing dots and |
| spaces from the path. |
| This derived function reproduces the bug. |
| The caller MUST add trailing dots & spaces back if needed.|
| |
| History: |
| 2014-02-07 JFL Created this routine. |
* *
\*---------------------------------------------------------------------------*/
DWORD WINAPI GetFullPathNameU(LPCTSTR lpName, DWORD nBufferLength, LPTSTR lpBuf, LPTSTR *lpFilePart) {
WCHAR wszName[MAX_PATH];
WCHAR wszBuf[MAX_PATH];
char szName[MAX_PATH*4]; /* Worst case for UTF-8 is 4 bytes/Unicode character */
int n;
DWORD dwResult;
WCHAR *wlpFilePart;
DEBUG_ENTER(("GetFullPathNameU(\"%s\", %d, %p, %p);\n", lpName, nBufferLength, lpBuf, lpFilePart));
n = MultiByteToWideChar(CP_UTF8, /* CodePage, (CP_ACP, CP_OEMCP, CP_UTF8, ...) */
0, /* dwFlags, */
lpName, /* lpMultiByteStr, */
lstrlen(lpName)+1, /* cbMultiByte, */
wszName, /* lpWideCharStr, */
MAX_PATH /* cchWideChar, */
);
if (!n) RETURN_INT_COMMENT(0, ("Failed to convert the name to Unicode\n"));
dwResult = GetFullPathNameW(wszName, MAX_PATH, wszBuf, &wlpFilePart);
if (!dwResult) RETURN_INT_COMMENT(0, ("GetFullPathNameW() failed\n"));
/* nRead = UnicodeToBytes(pwStr, len, buf, bufsize); */
n = WideCharToMultiByte(CP_UTF8, /* CodePage, (CP_ACP, CP_OEMCP, CP_UTF8, ...) */
0, /* dwFlags, */
wszBuf, /* lpWideCharStr, */
(int)dwResult + 1, /* cchWideChar, */
lpBuf, /* lpMultiByteStr, */
(int)nBufferLength, /* cbMultiByte, */
NULL, /* lpDefaultChar, */
NULL /* lpUsedDefaultChar */
);
if (!n) RETURN_INT_COMMENT(0, ("Failed to convert the full name from Unicode\n"));
if (lpFilePart) { /* Convert the file part, and get the length of the converted string */
int m; /* Length of the converted string */
m = WideCharToMultiByte(CP_UTF8, /* CodePage, (CP_ACP, CP_OEMCP, CP_UTF8, ...) */
0, /* dwFlags, */
wlpFilePart, /* lpWideCharStr, */
lstrlenW(wlpFilePart), /* cchWideChar, */
szName, /* lpMultiByteStr, */
sizeof(szName), /* cbMultiByte, */
NULL, /* lpDefaultChar, */
NULL /* lpUsedDefaultChar */
);
/* (n-1) is the length of the full UTF-8 pathname */
/* So ((n-1) - m) is the offset of the file part in the full UTF-8 pathname */
*lpFilePart = lpBuf + (n - 1) - m;
}
RETURN_INT_COMMENT(n-1, ("\"%s\" \"%s\"\n", lpBuf, lpFilePart?*lpFilePart:"(NULL)"));
}
#endif /* defined(_WIN32) */
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -8,6 +8,7 @@
*********************************************************************/
/* We're building the pthreads-win32 library */
#undef PTW32_BUILD
#define PTW32_BUILD
/* Do we know about the C type sigset_t? */
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册