forked from oraoto/pib
-
-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathtidy-html.patch
340 lines (315 loc) · 11.7 KB
/
tidy-html.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
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;
*/