Files
php-wasm/patch/tidy-html.patch
2023-10-08 16:21:17 -04:00

341 lines
12 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 631f0fd..f0458d8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -56,8 +56,8 @@ if (LIBTIDY_VERSION)
list(GET VERSION_LIST 2 TIDY_POINT_VERSION)
else ()
message(FATAL_ERROR "*** FAILED to get a VERSION from version.txt!")
-endif ()
-
+endif ()
+
# Establish version date
if (LIBTIDY_DATE)
string(REPLACE "." ";" DATE_LIST ${LIBTIDY_DATE})
@@ -145,24 +145,24 @@ option( ENABLE_MEMORY_DEBUG "Set ON to output some memory diagnostics." OFF
if ( ENABLE_DEBUG_LOG )
add_definitions( -DENABLE_DEBUG_LOG )
- message(STATUS "*** Debug Logging is enabled.")
+ message(STATUS "*** Debug Logging is enabled.")
else ()
- message(STATUS "*** Debug Logging is NOT enabled.")
+ message(STATUS "*** Debug Logging is NOT enabled.")
endif ()
if (ENABLE_ALLOC_DEBUG)
add_definitions ( -DDEBUG_ALLOCATION ) # see lexer.c for details
message(STATUS "*** Note, lexer.c node allocation diagnostics are ON")
endif ()
-
+
if (ENABLE_MEMORY_DEBUG)
add_definitions ( -DDEBUG_MEMORY ) # see alloc.c for details
message(STATUS "*** Note, alloc.c memory diagnostics are ON")
endif ()
-
+
if (WIN32)
option( ENABLE_CRTDBG_MEMORY "Set ON to enable the Windows CRT debug library." OFF )
-
+
if (ENABLE_CRTDBG_MEMORY)
add_definitions ( -D_CRTDBG_MAP_ALLOC ) # see tidy.c for details
message(STATUS "*** Note, tidy.c Windows CRT memory debug is ON")
@@ -178,9 +178,9 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set( WARNING_FLAGS -Wall )
endif(CMAKE_COMPILER_IS_GNUCXX)
-if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set( WARNING_FLAGS "-Wall -Wno-overloaded-virtual" )
-endif()
+endif()
if(WIN32 AND MSVC)
# C4996: The compiler encountered a deprecated declaration.
@@ -190,7 +190,7 @@ if(WIN32 AND MSVC)
foreach(warning 4996 4090 4244 4267)
set(WARNING_FLAGS "${WARNING_FLAGS} /wd${warning}")
endforeach()
-
+
set( MSVC_FLAGS "-DNOMINMAX -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D__CRT_NONSTDC_NO_WARNINGS" )
# to distinguish between debug and release lib in windows
@@ -206,7 +206,7 @@ set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MSVC_LD_FLAGS}" )
#------------------------------------------------------------------------
# Static Windows Runtime
-# Option to statically link to the Windows runtime. Maybe only
+# Option to statically link to the Windows runtime. Maybe only
# applies to WIN32/MSVC.
#------------------------------------------------------------------------
if (MSVC)
@@ -222,7 +222,7 @@ if (MSVC)
)
foreach(CompilerFlag ${CompilerFlags})
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
- endforeach()
+ endforeach()
message(STATUS "Using /MT STATIC runtime")
else ()
message(STATUS "Using /MD DYNAMIC runtime")
@@ -255,14 +255,14 @@ if (NO_ACCESS_SUPPORT)
endif ()
# Delete me? Not used in Tidy source!
-add_definitions ( -DHAVE_CONFIG_H )
+add_definitions ( -DHAVE_CONFIG_H )
#------------------------------------------------------------------------
# Runtime Configuration File Support
# By default on Unix-like systems when building for the console program,
# support runtime configuration files in /etc/ and in ~/. To prevent this,
-# set ENABLE_CONFIG_FILES to NO. Specify -DTIDY_CONFIG_FILE and/or
+# set ENABLE_CONFIG_FILES to NO. Specify -DTIDY_CONFIG_FILE and/or
# -DTIDY_USER_CONFIG_FILE to override the default paths in tidyplatform.h.
# @note: this section refactored to support #584.
#------------------------------------------------------------------------
@@ -276,11 +276,11 @@ if ( UNIX AND SUPPORT_CONSOLE_APP )
else ()
option ( ENABLE_CONFIG_FILES "Set to ON to enable Tidy runtime configuration file support" OFF )
-
+
if ( SUPPORT_GETPWNAM )
add_definitions( -DSUPPORT_GETPWNAM=1 )
endif ()
-
+
endif ()
if ( ENABLE_CONFIG_FILES )
@@ -288,7 +288,7 @@ if ( ENABLE_CONFIG_FILES )
message(STATUS "*** Building support for runtime configuration files.")
add_definitions( -DTIDY_ENABLE_CONFIG_FILES )
-
+
# define a default here so we can pass to XSL.
if ( NOT TIDY_CONFIG_FILE )
set( TIDY_CONFIG_FILE "/etc/tidy.conf" )
@@ -304,7 +304,7 @@ if ( ENABLE_CONFIG_FILES )
add_definitions( -DTIDY_USER_CONFIG_FILE="${TIDY_USER_CONFIG_FILE}" )
endif ()
-
+
#------------------------------------------------------------------------
# Shared Library
@@ -341,7 +341,7 @@ set ( CFILES
${SRCDIR}/tmbstr.c ${SRCDIR}/utf8.c ${SRCDIR}/tidylib.c
${SRCDIR}/mappedio.c ${SRCDIR}/gdoc.c ${SRCDIR}/language.c
${SRCDIR}/messageobj.c ${SRCDIR}/sprtf.c )
-
+
set ( HFILES
${INCDIR}/tidyplatform.h ${INCDIR}/tidy.h ${INCDIR}/tidyenum.h
${INCDIR}/tidybuffio.h )
@@ -359,7 +359,7 @@ set ( LIBHFILES
${SRCDIR}/tmbstr.h ${SRCDIR}/utf8.h ${SRCDIR}/tidy-int.h
${SRCDIR}/version.h ${SRCDIR}/gdoc.h ${SRCDIR}/language.h
${SRCDIR}/language_en.h ${SRCDIR}/sprtf.h )
-
+
#------------------------------------------------------------------------
# Target Locations
@@ -383,11 +383,11 @@ endif ()
#------------------------------------------------------------------------
set(name tidy-static)
add_library ( ${name} STATIC ${CFILES} ${HFILES} ${LIBHFILES} )
-set_target_properties( ${name} PROPERTIES
+set_target_properties( ${name} PROPERTIES
OUTPUT_NAME ${LIB_NAME}s )
if (NOT TIDY_CONSOLE_SHARED) # user wants default static linkage
list ( APPEND add_LIBS ${name} )
-endif ()
+endif ()
install(TARGETS ${name}
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
@@ -406,14 +406,14 @@ if (BUILD_SHARED_LIB)
set(CMAKE_MACOSX_RPATH 1)
endif ()
add_library ( ${name} SHARED ${CFILES} ${HFILES} ${LIBHFILES} )
- set_target_properties( ${name} PROPERTIES
+ set_target_properties( ${name} PROPERTIES
OUTPUT_NAME ${LIB_NAME} )
set_target_properties( ${name} PROPERTIES
VERSION ${LIBTIDY_VERSION}
SOVERSION ${TIDY_MAJOR_VERSION} )
- set_target_properties( ${name} PROPERTIES
+ set_target_properties( ${name} PROPERTIES
COMPILE_FLAGS "-DBUILD_SHARED_LIB" )
- set_target_properties( ${name} PROPERTIES
+ set_target_properties( ${name} PROPERTIES
COMPILE_FLAGS "-DBUILDING_SHARED_LIB" )
install(TARGETS ${name}
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
@@ -422,7 +422,7 @@ if (BUILD_SHARED_LIB)
)
if (TIDY_CONSOLE_SHARED) # user wants shared/dll linkage
list ( APPEND add_LIBS ${name} )
- endif ()
+ endif ()
endif ()
@@ -440,7 +440,7 @@ if (SUPPORT_CONSOLE_APP)
set_target_properties( ${name} PROPERTIES DEBUG_POSTFIX d )
endif ()
if (NOT TIDY_CONSOLE_SHARED)
- set_target_properties( ${name} PROPERTIES
+ set_target_properties( ${name} PROPERTIES
COMPILE_FLAGS "-DTIDY_STATIC" )
endif ()
install (TARGETS ${name} DESTINATION bin)
@@ -471,62 +471,6 @@ if (BUILD_SAMPLE_CODE)
endif ()
-#################################################
-# Create man pages
-#################################################
-
-if (UNIX AND SUPPORT_CONSOLE_APP)
- find_program( XSLTPROC_FOUND xsltproc )
- if (XSLTPROC_FOUND)
- ## NOTE: man name must match exe ie currently `${LIB_NAME}.1` not `tidy.1`
- ## also could use `manpath` command output to determine target install path
- set(TIDY_MANFILE ${LIB_NAME}.1)
- message(STATUS "*** Generating man ${TIDY_MANFILE} custom commands...")
- set(TIDY1XSL ${CMAKE_CURRENT_BINARY_DIR}/tidy1.xsl)
- set(TIDYHELP ${CMAKE_CURRENT_BINARY_DIR}/tidy-help.xml)
- set(TIDYCONFIG ${CMAKE_CURRENT_BINARY_DIR}/tidy-config.xml)
- add_custom_target(man ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}")
-
- ## Populate the @VARIABLES@ in the input file.
- configure_file(
- ${CMAKE_CURRENT_SOURCE_DIR}/man/tidy1.xsl.in
- ${TIDY1XSL}
- )
-
- # Run the built EXE to generate xml output .
- add_custom_command(
- TARGET man
- COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME} -xml-help > ${TIDYHELP}
- COMMENT "Generate ${TIDYHELP}"
- VERBATIM
- )
-
- # Run the built EXE to generate more xml output.
- add_custom_command(
- TARGET man
- COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME} -xml-config > ${TIDYCONFIG}
- COMMENT "Generate ${TIDYCONFIG}"
- VERBATIM
- )
-
- # Run xsltproc to generate the install files.
- add_custom_command(
- TARGET man
- DEPENDS ${TIDYHELP}
- COMMAND xsltproc ARGS ${TIDY1XSL} ${TIDYHELP} > ${CMAKE_CURRENT_BINARY_DIR}/${TIDY_MANFILE}
- COMMENT "Generate ${TIDY_MANFILE}"
- VERBATIM
- )
-
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TIDY_MANFILE} DESTINATION ${MAN_INSTALL_DIR})
-
- else ()
- message(STATUS "*** NOTE: xsltproc NOT FOUND! Can NOT generate man page.")
- message(STATUS "*** You need to install xsltproc in your system.")
- endif ()
-endif ()
-
-
#################################################
# Create MSI,EXE, DMG, DEB/RPM
# TODO: Check each of these builds
@@ -540,7 +484,7 @@ endif()
#------------------------------------------------------------------------
# System Runtime Libraries
-# Need to ensure that system DLLs get included in a binary
+# Need to ensure that system DLLs get included in a binary
# distribution, but since it can miss some - seems incomplete - make
# optional.
#------------------------------------------------------------------------
@@ -627,7 +571,7 @@ configure_file(
"${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}.pc"
@ONLY
)
-
+
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}.pc"
DESTINATION "${LIB_INSTALL_DIR}/pkgconfig"
diff --git a/include/tidyplatform.h b/include/tidyplatform.h
index 28de468..ec0b99b 100644
--- a/include/tidyplatform.h
+++ b/include/tidyplatform.h
@@ -81,7 +81,7 @@ extern "C" {
#ifndef SUPPORT_LOCALIZATIONS
# define SUPPORT_LOCALIZATIONS 1
#endif
-
+
/* Enable/disable support for console */
#ifndef SUPPORT_CONSOLE_APP
# define SUPPORT_CONSOLE_APP 1
@@ -251,7 +251,7 @@ extern "C" {
#endif
/* === Convenience defines for Solaris platforms === */
-
+
#if defined(sun)
# define SOLARIS_OS
# ifndef PLATFORM_NAME
@@ -450,15 +450,11 @@ extern "C" {
# include <stat.h>
# endif
-# if HAS_FUTIME
-# include <sys/utime.h>
-# else
-# include <utime.h>
-# endif
+# include <utime.h>
/* MS Windows needs _ prefix for Unix file functions.
Not required by Metrowerks Standard Library (MSL).
-
+
Tidy uses following for preserving the last modified time.
WINDOWS automatically set by Win16 compilers.
@@ -622,7 +618,7 @@ typedef char tmbchar; /* single, possibly partial character */
/* `bool` is a reserved word in some but not all C++ compilers depending on age.
age. Work around is to avoid bool by introducing a new enum called `Bool`.
*/
-
+
/* We could use the C99 definition where supported
typedef _Bool Bool;
#define no (_Bool)0
@@ -634,7 +630,7 @@ typedef enum
yes
} Bool;
-/* for NULL pointers
+/* for NULL pointers
#define null ((const void*)0)
extern void* null;
*/